Sync from SUSE:SLFO:Main python-Twisted revision bdf37c07fa93f26f61a8cd5c9954b219
This commit is contained in:
@@ -1,60 +0,0 @@
|
||||
From 185ff4b3f2e402e6a3c450d826223c79b53af333 Mon Sep 17 00:00:00 2001
|
||||
From: Itamar Turner-Trauring <itamar@pythonspeed.com>
|
||||
Date: Tue, 10 Sep 2024 14:04:21 -0400
|
||||
Subject: [PATCH 1/3] Fix (or workaround?) bug that happens in 3.13 where last
|
||||
frame of traceback is omitted.
|
||||
|
||||
---
|
||||
src/twisted/conch/manhole.py | 6 +++++-
|
||||
src/twisted/conch/newsfragments/12313.misc | 0
|
||||
2 files changed, 5 insertions(+), 1 deletion(-)
|
||||
create mode 100644 src/twisted/conch/newsfragments/12313.misc
|
||||
|
||||
diff --git a/src/twisted/conch/manhole.py b/src/twisted/conch/manhole.py
|
||||
index f552af5bbdc..1fce66a8cd4 100644
|
||||
--- a/src/twisted/conch/manhole.py
|
||||
+++ b/src/twisted/conch/manhole.py
|
||||
@@ -124,7 +124,11 @@ def excepthook(
|
||||
"""
|
||||
Format exception tracebacks and write them to the output handler.
|
||||
"""
|
||||
- lines = format_exception(excType, excValue, excTraceback.tb_next)
|
||||
+ if sys.version_info[:2] < (3, 13):
|
||||
+ traceback = excTraceback.tb_next
|
||||
+ else:
|
||||
+ traceback = excTraceback
|
||||
+ lines = format_exception(excType, excValue, traceback)
|
||||
self.write("".join(lines))
|
||||
|
||||
def displayhook(self, obj):
|
||||
diff --git a/src/twisted/conch/newsfragments/12313.misc b/src/twisted/conch/newsfragments/12313.misc
|
||||
new file mode 100644
|
||||
index 00000000000..e69de29bb2d
|
||||
|
||||
From 2a73df859a8f9f61bc9de535eb39878ab10200e6 Mon Sep 17 00:00:00 2001
|
||||
From: Itamar Turner-Trauring <itamar@pythonspeed.com>
|
||||
Date: Mon, 16 Sep 2024 10:51:39 -0400
|
||||
Subject: [PATCH 3/3] Check based on symptoms, rather than version.
|
||||
|
||||
---
|
||||
src/twisted/conch/manhole.py | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/twisted/conch/manhole.py b/src/twisted/conch/manhole.py
|
||||
index 1fce66a8cd4..670ac0480ec 100644
|
||||
--- a/src/twisted/conch/manhole.py
|
||||
+++ b/src/twisted/conch/manhole.py
|
||||
@@ -124,9 +124,12 @@ def excepthook(
|
||||
"""
|
||||
Format exception tracebacks and write them to the output handler.
|
||||
"""
|
||||
- if sys.version_info[:2] < (3, 13):
|
||||
+ code_obj = excTraceback.tb_frame.f_code
|
||||
+ if code_obj.co_filename == code.__file__ and code_obj.co_name == "runcode":
|
||||
traceback = excTraceback.tb_next
|
||||
else:
|
||||
+ # Workaround for https://github.com/python/cpython/issues/122478,
|
||||
+ # present e.g. in Python 3.12.6:
|
||||
traceback = excTraceback
|
||||
lines = format_exception(excType, excValue, traceback)
|
||||
self.write("".join(lines))
|
Reference in New Issue
Block a user