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.

classification
Title: metaclass causes __dict__ to be dict
Type: Stage:
Components: Interpreter Core Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: gvanrossum Nosy List: gvanrossum, jhylton
Priority: critical Keywords:

Created on 2002-11-22 16:18 by jhylton, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Messages (4)
msg13427 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2002-11-22 16:18
class Meta(type):
    def __new__(meta, name, bases, dict):
        return super(Meta, name).__new__(meta, name,
bases, dict)

class AClass:
    __metaclass__ = Meta

print type(AClass.__dict__)

With 2.2.2, this prints dict-proxy.
With 2.3, this prints dict.

As you noted, it should always be a dict-proxy to
prevent people from getting the __dict__ and the tp
slots out of sync.
msg13428 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2003-01-06 23:02
Logged In: YES 
user_id=6380

I should address this next, since it apparently causes Zope3
problems.
msg13429 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2003-01-07 12:47
Logged In: YES 
user_id=6380

I think why this is. type_new() now always adds a __dict__
descriptor. Will have to be more subtle than that...
msg13430 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2003-01-07 13:43
Logged In: YES 
user_id=6380

This one was easy. Fixed as typeobject.c rev 2.202.
History
Date User Action Args
2022-04-10 16:05:55adminsetgithub: 37518
2002-11-22 16:18:34jhyltoncreate