[issue26528] NameError for built in function open when re-raising stored exception from yielded function

Davide Rizzo report at bugs.python.org
Wed Apr 24 11:22:24 EDT 2019


Davide Rizzo <sorcio at gmail.com> added the comment:

I've just stumbled on the same thing happening on some code that attempts to use logging on __del__.

Comparing dir(__builtins__) normally and on shutdown, these are missing:

['copyright', 'credits', 'exit', 'help', 'license', 'open', 'quit']

The traceback of the real error looks like this:

  [...]
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/logging/__init__.py", line 1383, in info
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/logging/__init__.py", line 1519, in _log
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/logging/__init__.py", line 1529, in handle
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/logging/__init__.py", line 1591, in callHandlers
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/logging/__init__.py", line 905, in handle
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/logging/__init__.py", line 1131, in emit
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/logging/__init__.py", line 1121, in _open
NameError: name 'open' is not defined

----------
nosy: +davide.rizzo
versions: +Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue26528>
_______________________________________


More information about the Python-bugs-list mailing list