Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metaclass causes __dict__ to be dict #37518

Closed
jhylton mannequin opened this issue Nov 22, 2002 · 4 comments
Closed

metaclass causes __dict__ to be dict #37518

jhylton mannequin opened this issue Nov 22, 2002 · 4 comments
Assignees
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs)

Comments

@jhylton
Copy link
Mannequin

jhylton mannequin commented Nov 22, 2002

BPO 642358
Nosy @gvanrossum

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/gvanrossum'
closed_at = <Date 2003-01-07.13:43:34.000>
created_at = <Date 2002-11-22.16:18:34.000>
labels = ['interpreter-core']
title = 'metaclass causes __dict__ to be dict'
updated_at = <Date 2003-01-07.13:43:34.000>
user = 'https://bugs.python.org/jhylton'

bugs.python.org fields:

activity = <Date 2003-01-07.13:43:34.000>
actor = 'gvanrossum'
assignee = 'gvanrossum'
closed = True
closed_date = None
closer = None
components = ['Interpreter Core']
creation = <Date 2002-11-22.16:18:34.000>
creator = 'jhylton'
dependencies = []
files = []
hgrepos = []
issue_num = 642358
keywords = []
message_count = 4.0
messages = ['13427', '13428', '13429', '13430']
nosy_count = 2.0
nosy_names = ['gvanrossum', 'jhylton']
pr_nums = []
priority = 'critical'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue642358'
versions = []

@jhylton
Copy link
Mannequin Author

jhylton mannequin commented Nov 22, 2002

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.

@jhylton jhylton mannequin closed this as completed Nov 22, 2002
@jhylton jhylton mannequin assigned gvanrossum Nov 22, 2002
@jhylton jhylton mannequin added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label Nov 22, 2002
@jhylton jhylton mannequin closed this as completed Nov 22, 2002
@jhylton jhylton mannequin assigned gvanrossum Nov 22, 2002
@jhylton jhylton mannequin added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label Nov 22, 2002
@gvanrossum
Copy link
Member

Logged In: YES
user_id=6380

I should address this next, since it apparently causes Zope3
problems.

@gvanrossum
Copy link
Member

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...

@gvanrossum
Copy link
Member

Logged In: YES
user_id=6380

This one was easy. Fixed as typeobject.c rev 2.202.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs)
Projects
None yet
Development

No branches or pull requests

1 participant