Skip to content

Commit 8336350

Browse files
committed
Ignore AttributeError when deleting temporary audio buffers
1 parent 9f2c359 commit 8336350

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/sounddevice.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
__version__ = '0.5.4'
5252

5353
import atexit as _atexit
54+
import contextlib as _contextlib
5455
import os as _os
5556
import platform as _platform
5657
import sys as _sys
@@ -2649,8 +2650,10 @@ def callback_exit(self):
26492650
def finished_callback(self):
26502651
self.event.set()
26512652
# Drop temporary audio buffers to free memory
2652-
del self.data
2653-
del self.out
2653+
with _contextlib.suppress(AttributeError):
2654+
del self.data
2655+
with _contextlib.suppress(AttributeError):
2656+
del self.out
26542657
# Drop CFFI objects to avoid reference cycles
26552658
self.stream._callback = None
26562659
self.stream._finished_callback = None

0 commit comments

Comments
 (0)