Skip to content

Python 3.8: List does not iterate over all members when mutated during loop #16

Open
@andrewbest-tri

Description

@andrewbest-tri

for buffer in _buffers:

The above line leaves dangling references in python 3.8 which causes OpenAL to crash.

To reproduce:

for iteration in range(2):
    if not openal.oalGetInit():
            openal.oalInit()
    source1 = openal.oalOpen(path_to_a_sound)
    source2 = openal.oalOpen(path_to_a_sound) 
    source1.play()
    source2.play()
    openal.oalQuit()
    print(len(openal._buffers))  # This will have length 1.

The above code will crash on iteration 2 with INVALID_OPERATION.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions