Ignore AttributeError when deleting temporary audio buffers#622
Ignore AttributeError when deleting temporary audio buffers#622mgeier merged 1 commit intospatialaudio:masterfrom
Conversation
|
Can we do the same thing with the following? Not sure if there's a need to import contextlib here. |
|
No: You could do something like
It's not strictly necessary, we could also just use It's also not strictly necessary to rely on catching exceptions at all (which is called "it's easier to ask for forgiveness than permission"), but instead check first whether the instance variables are defined or not (which is called "look before you leap"). There are many choices, and it's mostly a matter of taste. |
|
I'm merging this to avoid too many people tripping over this problem, but if you @jared-v-hoyt have (or anybody else has) any ideas for improvements, we can of course do them afterwards. PRs are welcome! |
Pure input/output streams only use one of
data/outrespectively, so we have to take care whether they even exist before we delete them.Fixes #621.