Please find attached the debdiff fixing this bug.
diff -Nru twisted-24.3.0/debian/changelog twisted-24.3.0/debian/changelog
--- twisted-24.3.0/debian/changelog     2024-03-04 15:57:17.000000000 +0100
+++ twisted-24.3.0/debian/changelog     2024-06-21 11:20:23.000000000 +0200
@@ -1,3 +1,10 @@
+twisted (24.3.0-2) unstable; urgency=medium
+
+  * Patch: fix test_flatten in autopkgtest. (Closes: #1073996)
+    This patch can probably be dropped after next upstream release.
+
+ -- Florent 'Skia' Jacquet <florent.jacq...@canonical.com>  Fri, 21 Jun 2024 
11:20:23 +0200
+
 twisted (24.3.0-1) unstable; urgency=medium
 
   * New upstream release.
diff -Nru twisted-24.3.0/debian/patches/series 
twisted-24.3.0/debian/patches/series
--- twisted-24.3.0/debian/patches/series        2024-03-04 15:57:17.000000000 
+0100
+++ twisted-24.3.0/debian/patches/series        2024-06-21 11:20:23.000000000 
+0200
@@ -15,3 +15,4 @@
 debian-hacks/Drop-dependency-on-typing_extensions.patch
 debian-hacks/reproducible-docs.patch
 tests/skip-test_sendFileDescriptorTriggersPauseProducing.patch
+tests/Tests-Fix-test_flatten.patch
diff -Nru twisted-24.3.0/debian/patches/tests/Tests-Fix-test_flatten.patch 
twisted-24.3.0/debian/patches/tests/Tests-Fix-test_flatten.patch
--- twisted-24.3.0/debian/patches/tests/Tests-Fix-test_flatten.patch    
1970-01-01 01:00:00.000000000 +0100
+++ twisted-24.3.0/debian/patches/tests/Tests-Fix-test_flatten.patch    
2024-06-21 11:20:23.000000000 +0200
@@ -0,0 +1,34 @@
+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)

Reply via email to