New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-29110: add test for Aifc_write. #293
Conversation
Lib/aifc.py
Outdated
| @@ -371,7 +371,7 @@ def rewind(self): | |||
| self._soundpos = 0 | |||
|
|
|||
| def close(self): | |||
| file = self._file | |||
| file = getattr(self, '_file') | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is easier and more reliable to set a class attribute _file = None. This also helps when __del__ is called after clearing the builtins module. This is common idiom.
Lib/aifc.py
Outdated
| @@ -303,6 +303,8 @@ class Aifc_read: | |||
| # _ssnd_chunk -- instantiation of a chunk class for the SSND chunk | |||
| # _framesize -- size of one frame in the file | |||
|
|
|||
| _file = None | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a comment like in subprocess.py, tempfile.py, zipfile.py?
follow up of pythonGH-162 (cherry picked from commit 5dc33ee)
follow up of pythonGH-162 (cherry picked from commit 5dc33ee)
ref: https://github.com/python/cpython/pull/162/files#r102688420