This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Mark.Shannon
Recipients Mark.Shannon, gvanrossum, levkivskyi, serhiy.storchaka, yselivanov
Date 2018-01-14.13:18:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1515935898.56.0.467229070634.issue32550@psf.upfronthosting.co.za>
In-reply-to
Content
> 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)
History
Date User Action Args
2018-01-14 13:18:18Mark.Shannonsetrecipients: + Mark.Shannon, gvanrossum, serhiy.storchaka, yselivanov, levkivskyi
2018-01-14 13:18:18Mark.Shannonsetmessageid: <1515935898.56.0.467229070634.issue32550@psf.upfronthosting.co.za>
2018-01-14 13:18:18Mark.Shannonlinkissue32550 messages
2018-01-14 13:18:18Mark.Shannoncreate