[Python-bugs-list] [ python-Bugs-642358 ] metaclass causes __dict__ to be dict

noreply@sourceforge.net noreply@sourceforge.net
Fri, 22 Nov 2002 08:18:34 -0800


Bugs item #642358, was opened at 2002-11-22 16:18
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=642358&group_id=5470

Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Jeremy Hylton (jhylton)
Assigned to: Guido van Rossum (gvanrossum)
Summary: metaclass causes __dict__ to be dict

Initial Comment:
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.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=642358&group_id=5470