Martin Panter added the comment: Actually I was a bit hasty in my response last night. NameError indicates that the “open” symbol has been deleted, not just set to None. If you add print(sorted(builtins.__dict__.keys())) inside __exit__() you can verify this is the case.
This contradicts my understanding of the finalization process (symbols being deleted rather than being set to None). Maybe the documentation needs fixing? ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26528> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com