[New-bugs-announce] [issue14095] type_new() removes __qualname__ from the input dictionary

STINNER Victor report at bugs.python.org
Thu Feb 23 01:27:45 CET 2012


New submission from STINNER Victor <victor.stinner at gmail.com>:

The C function type_new() creates a copy the dictionary for __dict__ and modifies the copy... except for __qualname__: it does modify the input dictionary before the copy.
---
def f(): pass

d = {'__qualname__': 42, '__new__': f}
assert d['__new__'] is f
assert '__qualname__' in d
Enum = type.__new__(type, 'Enum', (), d)
assert d['__new__'] is f
assert '__qualname__' in d
---

I don't know if it is expected. If not, the copy should be done before.

----------
messages: 154020
nosy: haypo, pitrou
priority: normal
severity: normal
status: open
title: type_new() removes __qualname__ from the input dictionary
versions: Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14095>
_______________________________________


More information about the New-bugs-announce mailing list