mirror of
https://github.com/python/cpython.git
synced 2025-07-28 05:34:31 +00:00
[3.13] gh-82378 fix sys.tracebacklimit in pyrepl, approach 2 (GH-123062) (#123252)
Make sure that pyrepl uses the same logic for sys.tracebacklimit as both
the basic repl and the standard sys.excepthook
(cherry picked from commit 63603bca35
)
This commit is contained in:
parent
95b4f9c9ad
commit
0955db1bd8
4 changed files with 53 additions and 12 deletions
|
@ -164,8 +164,13 @@ class InteractiveColoredConsole(code.InteractiveConsole):
|
|||
def showsyntaxerror(self, filename=None, **kwargs):
|
||||
super().showsyntaxerror(filename=filename, **kwargs)
|
||||
|
||||
def showtraceback(self):
|
||||
super().showtraceback(colorize=self.can_colorize)
|
||||
def _excepthook(self, typ, value, tb):
|
||||
import traceback
|
||||
lines = traceback.format_exception(
|
||||
typ, value, tb,
|
||||
colorize=self.can_colorize,
|
||||
limit=traceback.BUILTIN_EXCEPTION_LIMIT)
|
||||
self.write(''.join(lines))
|
||||
|
||||
def runsource(self, source, filename="<input>", symbol="single"):
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue