Mark Shannon <m...@hotpy.org> added the comment: > 3. It doesn't add a name constant. Instead it uses a name from the names list > (which already has to contain this name).
This PR moves the constant for the name from `co_names` to `co_consts`. There is no duplication. >>> def f(): ... class C: ... a : 1 (It does add __annotations__ to `co_names`, but that seems reasonable to me) Current: >>> f.__code__.co_consts[1].co_names ('__name__', '__module__', '__qualname__', 'a') >>> f.__code__.co_consts[1].co_consts ('f.<locals>.C', 1, None) With PR 5181: >>> f.__code__.co_consts[1].co_names ('__name__', '__module__', '__qualname__', '__annotations__') >>> f.__code__.co_consts[1].co_consts ('f.<locals>.C', 1, 'a', None) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue32550> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com