Skip to content

Commit 4c44ef2

Browse files
committed
Fix: sys.tracebacklimit can be at most sys.maxsize
1 parent 0e6f906 commit 4c44ef2

File tree

1 file changed

+3
-0
lines changed
  • graalpython/lib-graalpython

1 file changed

+3
-0
lines changed

graalpython/lib-graalpython/sys.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ def __print_traceback__(typ, value, tb):
131131
limit = 0
132132
no_traceback = True
133133
else:
134+
# (*) CPython convert 'limit' to C long and if it overflows, it uses 'LONG_MAX'; we use Java int
135+
if limit > sys.maxsize:
136+
limit = sys.maxsize
134137
# (*) in the C printer limit is interpreted as -limit in format_exception
135138
limit = -limit
136139
else:

0 commit comments

Comments
 (0)