[docs] [issue24081] Obsolete caveat in reload() docs

Petr Viktorin report at bugs.python.org
Sat May 2 09:34:36 CEST 2015


Petr Viktorin added the comment:

Not true (on 3.3 & 2.7).

>>> import sys
>>> import x
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/tmp/x.py", line 1, in <module>
    import y
  File "/tmp/y.py", line 1, in <module>
    1/0
ZeroDivisionError: division by zero
>>> sys.modules['x']
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError: 'x'
>>> sys.modules['y']
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError: 'y'

For 3.4, PEP 451 explicitly specifies ``del sys.modules[spec.name]`` if ``loader.exec_module`` fails [0].

[0] https://www.python.org/dev/peps/pep-0451/#how-loading-will-work

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24081>
_______________________________________


More information about the docs mailing list