mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-11-03 04:37:06 -08:00
56 lines
2.1 KiB
Diff
56 lines
2.1 KiB
Diff
From 074fc742a699278ea5266b34aace1e34049b3de3 Mon Sep 17 00:00:00 2001
|
|
From: Colin Watson <cjwatson@canonical.com>
|
|
Date: Sat, 23 Apr 2022 22:29:07 +0100
|
|
Subject: [PATCH] Implement twisted.python.failure._Code.co_positions
|
|
|
|
This is needed for compatibility with Python 3.11.
|
|
---
|
|
src/twisted/newsfragments/10336.bugfix | 1 +
|
|
src/twisted/python/failure.py | 5 ++++-
|
|
src/twisted/test/test_failure.py | 1 +
|
|
3 files changed, 6 insertions(+), 1 deletion(-)
|
|
create mode 100644 src/twisted/newsfragments/10336.bugfix
|
|
|
|
diff --git a/src/twisted/newsfragments/10336.bugfix b/src/twisted/newsfragments/10336.bugfix
|
|
new file mode 100644
|
|
index 00000000000..a7ffab3627d
|
|
--- /dev/null
|
|
+++ b/src/twisted/newsfragments/10336.bugfix
|
|
@@ -0,0 +1 @@
|
|
+Implement twisted.python.failure._Code.co_positions for compatibility with Python 3.11.
|
|
diff --git a/src/twisted/python/failure.py b/src/twisted/python/failure.py
|
|
index 6471e7bca59..c5a359e405b 100644
|
|
--- a/src/twisted/python/failure.py
|
|
+++ b/src/twisted/python/failure.py
|
|
@@ -130,7 +130,7 @@ def _Traceback(stackFrames, tbFrames):
|
|
|
|
|
|
# The set of attributes for _TracebackFrame, _Frame and _Code were taken from
|
|
-# https://docs.python.org/3.10/library/inspect.html Other Pythons may have a
|
|
+# https://docs.python.org/3.11/library/inspect.html Other Pythons may have a
|
|
# few more attributes that should be added if needed.
|
|
class _TracebackFrame:
|
|
"""
|
|
@@ -202,6 +202,9 @@ def __init__(self, name, filename):
|
|
self.co_nlocals = 0
|
|
self.co_stacksize = 0
|
|
|
|
+ def co_positions(self):
|
|
+ return ((None, None, None, None),)
|
|
+
|
|
|
|
_inlineCallbacksExtraneous = []
|
|
|
|
diff --git a/src/twisted/test/test_failure.py b/src/twisted/test/test_failure.py
|
|
index 6dd7c682bf9..6fd82c868ec 100644
|
|
--- a/src/twisted/test/test_failure.py
|
|
+++ b/src/twisted/test/test_failure.py
|
|
@@ -825,6 +825,7 @@ def test_fakeCodeAttributes(self):
|
|
self.assertIsInstance(code.co_nlocals, int)
|
|
self.assertIsInstance(code.co_stacksize, int)
|
|
self.assertIsInstance(code.co_varnames, list)
|
|
+ self.assertIsInstance(code.co_positions(), tuple)
|
|
|
|
def test_fakeTracebackFrame(self):
|
|
"""
|