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.

classification
Title: The traceback compounding of RecursionError fails to work with __get__
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.7, Python 3.6
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Jim Fasarakis-Hilliard, abarry, bup, ncoghlan
Priority: normal Keywords:

Created on 2017-03-19 23:37 by bup, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (3)
msg289867 - (view) Author: Dan Snider (bup) * Date: 2017-03-19 23:37
class Property:
    def __init__(self, getter):
        self.getter = getter

    def __get__(self, instance, cls):
        return self.getter(cls if instance is None else instance)

class MyClass:
    @Property
    def something(cls):
        return cls.something

Calling MyClass.something will show all 990+ RecursionError message.
msg289871 - (view) Author: Jim Fasarakis-Hilliard (Jim Fasarakis-Hilliard) * Date: 2017-03-20 03:58
I'm pretty sure this is by design; the change introduced in [1] tried to keep things simple by only trimming the output when the lines were identical. More complicated scenarios are trickier to implement.

It should be interesting to see if the core-devs believe a change like this is warranted, though.

[1]: https://bugs.python.org/issue26823
msg289875 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2017-03-20 06:41
Indeed, the traceback abbreviation doesn't try to detect recursive loops, only exactly duplicated lines.

The problem is that the more state management we do in the traceback printing, the higher the chance there is of getting an error while attempt to display the previous errors.

Keeping the immediately preceding entry and doing an exact comparison is straightforward, but pattern matching on up-to-N entries is something we'll leave to external traceback pretty printers.
History
Date User Action Args
2022-04-11 14:58:44adminsetgithub: 74041
2017-03-20 06:41:40ncoghlansetstatus: open -> closed
resolution: not a bug
messages: + msg289875

stage: resolved
2017-03-20 04:02:31xiang.zhangsetnosy: + ncoghlan, abarry
2017-03-20 03:58:58Jim Fasarakis-Hilliardsetversions: + Python 3.7
nosy: + Jim Fasarakis-Hilliard

messages: + msg289871

components: + Interpreter Core
2017-03-19 23:37:32bupcreate