File tree 2 files changed +12
-5
lines changed
2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -184,8 +184,6 @@ class _DeferredLine:
184
184
def __init__ (self , filename , lineno , module_globals = None ):
185
185
self .filename = filename
186
186
self .lineno = lineno
187
- # TODO: this is going away when we fix linecache
188
- # TODO: (mark) read about loader
189
187
if module_globals is None :
190
188
self ._mod_name = None
191
189
self ._mod_loader = None
@@ -660,7 +658,7 @@ def fix_print_exception():
660
658
"""
661
659
Sets the default exception hook :func:`sys.excepthook` to the
662
660
:func:`tbutils.print_exception` that uses all the ``tbutils``
663
- facilities to provide slightly more correct output behavior.
661
+ facilities to provide a consistent output behavior.
664
662
"""
665
663
sys .excepthook = print_exception
666
664
@@ -715,6 +713,12 @@ def to_string(self):
715
713
716
714
``ParsedException.from_string(text).to_string()`` should yield
717
715
``text``.
716
+
717
+ .. note::
718
+
719
+ Note that this method does not output "anchors" (e.g.,
720
+ ``~~~~~^^``), as were added in Python 3.13. See the built-in
721
+ ``traceback`` module if these are necessary.
718
722
"""
719
723
lines = ['Traceback (most recent call last):' ]
720
724
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ def test():
27
27
try :
28
28
test ()
29
29
except :
30
- _ , _ , exc_traceback = sys .exc_info ()
30
+ exc , _ , exc_traceback = sys .exc_info ()
31
31
tbi = TracebackInfo .from_traceback (exc_traceback )
32
32
exc_info = ExceptionInfo .from_exc_info (* sys .exc_info ())
33
33
exc_info2 = ExceptionInfo .from_current ()
@@ -53,7 +53,10 @@ def test():
53
53
assert "ValueError('yay fun')" in new_exc_hook_res
54
54
assert len (new_exc_hook_res ) > len (tbi_str )
55
55
56
- assert new_exc_hook_res == builtin_exc_hook_res
56
+ if sys .version_info <= (3 , 12 ):
57
+ # output diverges with Python 3.13+, see https://github.com/mahmoud/boltons/issues/365
58
+ # TLDR tbutils only has minimal handling for anchors (e.g., ~~~~^^)
59
+ assert new_exc_hook_res == builtin_exc_hook_res
57
60
58
61
59
62
def test_contextual ():
You can’t perform that action at this time.
0 commit comments