Nick Coghlan <ncogh...@gmail.com> added the comment:
Additional info showing the module getting reset back to the state of a freshly created module namespace: ``` >>> dir() ['__annotations__', '__builtins__', '__doc__', '__loader__', '__name__', '__package__', '__spec__'] >>> __builtins__ <module 'builtins' (built-in)> >>> import sys >>> mod = sys.modules[__name__] >>> sys.modules[__name__] = object() >>> __builtins__ Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name '__builtins__' is not defined >>> __annotations__ Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name '__annotations__' is not defined >>> __doc__ >>> __loader__ >>> __name__ '__main__' >>> __package__ >>> __spec__ >>> mod Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'mod' is not defined ``` ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue36665> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com