[issue34136] Del on class __annotations__ regressed, failing test

Guido van Rossum report at bugs.python.org
Fri Jul 20 23:14:05 EDT 2018


Guido van Rossum <guido at python.org> added the comment:

(Serhiy: I think you meant Nuitka, not numba -- Nuitka is a Python-to-C++ compiler, and Kay is its author. Somehow he managed to confuse us all. :-)

I suspect that the way `python3 -m test` runs the tests whose name you pass on the command line causes there to be no `__annotations__` global, while the way `python3 -m test.test_opcodes` runs its argument causes there to be one.  It seems that when a module is run as `__main__` it always is endowed with an `__annotations__` global, but when it is an imported module, `__annotations__` is only created when there is at least one top-level annotation.

I don't know why the global is always created for a `__main__`, but I suspect there's a good reason; the test will have to cope, because I think it should be able to run the tests either way.

----------

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


More information about the Python-bugs-list mailing list