Source: twisted Version: 24.3.0-1 Severity: serious Tags: patch Justification: 6a X-Debbugs-Cc: florent.jacq...@canonical.com
Hello there, Following some removal from Python itself, the following started to appear in autopkgtest: 2993s --- <exception caught here> --- 2993s File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 1999, in _inlineCallbacks 2993s result = context.run( 2993s File "/usr/lib/python3/dist-packages/twisted/python/failure.py", line 519, in throwExceptionIntoGenerator 2993s return g.throw(self.value.with_traceback(self.tb)) 2993s File "/usr/lib/python3/dist-packages/twisted/web/_flatten.py", line 435, in _flattenTree 2993s roots.append(frame.f_locals["root"]) 2993s builtins.KeyError: 'root' This is fixed upstream in https://github.com/twisted/twisted/pull/12213 I've cherry-picked the needed changes in a patch. I'll send a debdiff with everything shortly. -- System Information: Debian Release: trixie/sid APT prefers oracular APT policy: (500, 'oracular'), (400, 'oracular-proposed'), (200, 'noble-updates'), (200, 'noble'), (200, 'jammy-updates'), (200, 'jammy') Architecture: amd64 (x86_64) Kernel: Linux 6.8.0-31-generic (SMP w/12 CPU threads; PREEMPT) Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_WARN, TAINT_OOT_MODULE Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE not set Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled
From: Florent 'Skia' Jacquet <florent.jacq...@canonical.com> Date: Fri, 21 Jun 2024 12:06:48 +0200 Subject: Test: Fix twisted.web.test.test_flatten Following some removal from Python itself, the following started to appear in autopkgtest: 2993s --- <exception caught here> --- 2993s File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 1999, in _inlineCallbacks 2993s result = context.run( 2993s File "/usr/lib/python3/dist-packages/twisted/python/failure.py", line 519, in throwExceptionIntoGenerator 2993s return g.throw(self.value.with_traceback(self.tb)) 2993s File "/usr/lib/python3/dist-packages/twisted/web/_flatten.py", line 435, in _flattenTree 2993s roots.append(frame.f_locals["root"]) 2993s builtins.KeyError: 'root' This is fixed upstream in https://github.com/twisted/twisted/pull/12213 This patch is a cherry-pick of the needed changes, and can probably be dropped next release. --- a/src/twisted/web/_flatten.py +++ b/src/twisted/web/_flatten.py @@ -428,11 +427,11 @@ except StopIteration: stack.pop() except Exception as e: - stack.pop() roots = [] for generator in stack: - roots.append(generator.gi_frame.f_locals["root"]) - roots.append(frame.f_locals["root"]) + if generator.gi_frame is not None: + roots.append(generator.gi_frame.f_locals["root"]) + stack.pop() raise FlattenerError(e, roots, extract_tb(exc_info()[2])) else: stack.append(element)