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.

Author sjpalt
Recipients sjpalt
Date 2016-12-04.14:35:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1480862145.72.0.468660451957.issue28866@psf.upfronthosting.co.za>
In-reply-to
Content
I ran into a strange bug while experimenting with metaclasses that implement a custom mro() method. It only seems to occur in interactive mode, either returning completely unrelated values or causing a segfault. Python 2 appears unaffected. I have been able to reproduce this with the following code:

# $ python -i weird.py
# >>> proxy.x
# 52011448
# >>> proxy.x
# 6160
# ...

class Foo:
    pass

class Meta(type):
    def mro(cls):
        return (cls, Foo, object)

    def __setattr__(cls, name, value):
        setattr(Foo, name, value)

proxy = Meta('FooProxy', (), {})

proxy.x = 300
proxy.x  # don't omit
proxy.x = 0
History
Date User Action Args
2016-12-04 14:35:45sjpaltsetrecipients: + sjpalt
2016-12-04 14:35:45sjpaltsetmessageid: <1480862145.72.0.468660451957.issue28866@psf.upfronthosting.co.za>
2016-12-04 14:35:45sjpaltlinkissue28866 messages
2016-12-04 14:35:45sjpaltcreate