Author vstinner
Recipients christian.heimes, inada.naoki, pitrou, rhettinger, scoder, serhiy.storchaka, vstinner
Date 2017-09-11.16:53:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Serhiy on the PR: "This is overgeneralization. Can tp_dict be not exact dict at all? I don't think this is possible. In many places concrete dict API is used with tp_dict. If you want to allow tp_dict be not exact dict, please open a separate issue for this."

Using the following code, A.__dict__ type is dict even if the metaclass creates a different type, probably because type_new() calls PyDict_Copy(orig_dict):
class mydict(dict):
    def __setitem__(self, name, value):
        if name == "__module__":
            value = "<mock module>"
        super().__setitem__(name, value)

class MetaClass(type):
    def __prepare__(mcl, name, bases):
        return mydict()

class A(metaclass=MetaClass):

Date User Action Args
2017-09-11 16:53:22vstinnersetrecipients: + vstinner, rhettinger, pitrou, scoder, christian.heimes, inada.naoki, serhiy.storchaka
2017-09-11 16:53:21vstinnersetmessageid: <>
2017-09-11 16:53:21vstinnerlinkissue31336 messages
2017-09-11 16:53:21vstinnercreate