Serhiy Storchaka added the comment:

Ah, yet one purpose of the patch is to make close() methods more robust when 
called at shutdown. Objects can be partially deconstructed at that time, 
attributes can be set to None to break reference loops. That is why I use None 
as signaling value and always check some attribute for None.

The changes to aifc make sense. close() is called from __exit__(). When context 
manager is used in a generator, it creates a reference loop. So self.file is 
None in this case and self.file.close() will raise an AttributeError.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23865>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to