aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/Twisted/py3/twisted/conch/manhole.py
diff options
context:
space:
mode:
authorrobot-piglet <robot-piglet@yandex-team.com>2024-11-12 07:54:50 +0300
committerrobot-piglet <robot-piglet@yandex-team.com>2024-11-12 08:05:59 +0300
commit55cec9f6b0618fb3570fc8ef66aad151f4932591 (patch)
tree9198c2ca0b0305269062c3674ce79f19c4990e65 /contrib/python/Twisted/py3/twisted/conch/manhole.py
parentb77b1fbf262ea4f40e33a60ce32c4db4e5e49015 (diff)
downloadydb-55cec9f6b0618fb3570fc8ef66aad151f4932591.tar.gz
Intermediate changes
commit_hash:c229701a8b4f4d9ee57ce1ed763099d862d53fa6
Diffstat (limited to 'contrib/python/Twisted/py3/twisted/conch/manhole.py')
-rw-r--r--contrib/python/Twisted/py3/twisted/conch/manhole.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/contrib/python/Twisted/py3/twisted/conch/manhole.py b/contrib/python/Twisted/py3/twisted/conch/manhole.py
index f552af5bbd..670ac0480e 100644
--- a/contrib/python/Twisted/py3/twisted/conch/manhole.py
+++ b/contrib/python/Twisted/py3/twisted/conch/manhole.py
@@ -124,7 +124,14 @@ class ManholeInterpreter(code.InteractiveInterpreter):
"""
Format exception tracebacks and write them to the output handler.
"""
- lines = format_exception(excType, excValue, excTraceback.tb_next)
+ 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))
def displayhook(self, obj):