New submission from Steven D'Aprano <steve+pyt...@pearwood.info>:
This function crashes on the following recursive list: def length(x): try: return sum(length(i) for i in x) except Exception: return 1 a = [[1, 2, 3], [4, 5, 6]] a.append(a) length(a) Crashes: Fatal Python error: _Py_CheckRecursiveCall: Cannot recover from stack overflow. Python runtime state: initialized Current thread 0x00007eff18d77740 (most recent call first): File "<stdin>", line 3 in length File "<stdin>", line 3 in <genexpr> File "<stdin>", line 3 in length File "<stdin>", line 3 in <genexpr> ... Aborted (core dumped) For brevity I've cut some of the output. There are about fifty pairs of "line 3 in length"/line 3 in <genexpr>" lines, all identical. ---------- components: Interpreter Core messages: 384150 nosy: steven.daprano priority: normal severity: normal status: open title: Exception catching function crashes on recursive list type: crash versions: Python 3.7, Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue42801> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com