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 steven.daprano
Recipients prasechen, steven.daprano
Date 2022-02-17.13:13:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1645103610.97.0.154211677909.issue46776@roundup.psfhosted.org>
In-reply-to
Content
This is not a bug, Python is working correctly here. The interpreter is doing exactly what you told it to do, and then raising a RecursionError before you can crash the system.


You have a property instance.bar which returns instance.bar, which returns instance.bar, which returns instance.bar... forever, or until RecursionError is triggered.

Your class is the same as:

class Foo:
    @property
    def bar(self):
        return self.bar

So when you call instance.bar, it looks up bar, which is the property, which looks up bar, which is the property, which looks up bar, and so on.

What did you expect to happen?
History
Date User Action Args
2022-02-17 13:13:31steven.dapranosetrecipients: + steven.daprano, prasechen
2022-02-17 13:13:30steven.dapranosetmessageid: <1645103610.97.0.154211677909.issue46776@roundup.psfhosted.org>
2022-02-17 13:13:30steven.dapranolinkissue46776 messages
2022-02-17 13:13:30steven.dapranocreate