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 paul.moore
Recipients Gabriele Tornetta, bup, paul.moore, r.david.murray, steven.daprano
Date 2021-12-09.15:59:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1639065562.72.0.786888947874.issue32683@roundup.psfhosted.org>
In-reply-to
Content
I tend to agree with Steven and David here. You define __getattribute__ and so that's the behaviour you get when an attribute of the class is requested (whether by the system or by your code). The documentation (here: https://docs.python.org/3/reference/datamodel.html#object.__getattribute__) seems to support this view as well.

Do you have a real-world example of code that is broken by this behaviour, or is this just a theoretical problem? Is it particularly hard to make the code work the way you want it to with the current behaviour? For example,

    # Don't intercept __class__
    if attr == "__class__":
        return object.__getattribute__(self, attr)
History
Date User Action Args
2021-12-09 15:59:22paul.mooresetrecipients: + paul.moore, steven.daprano, r.david.murray, bup, Gabriele Tornetta
2021-12-09 15:59:22paul.mooresetmessageid: <1639065562.72.0.786888947874.issue32683@roundup.psfhosted.org>
2021-12-09 15:59:22paul.moorelinkissue32683 messages
2021-12-09 15:59:22paul.moorecreate