Skip to content

Commit 24bb5d1

Browse files
Update run.py
1 parent 282a8aa commit 24bb5d1

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Lib/idlelib/run.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ def get_message_lines(typ, exc, tb):
240240
return traceback.format_exception_only(typ, exc)
241241

242242

243-
def print_exception(in_test=False):
243+
def print_exception(in_test=False): #Only when in test it is True, other it is False
244244
import linecache
245245
linecache.checkcache()
246246
flush_stdout()
@@ -273,7 +273,8 @@ def print_exc(typ, exc, tb):
273273
print('Traceback (most recent call last):', file=efile)
274274
exclude = ("run.py", "rpc.py", "threading.py", "queue.py",
275275
"debugger_r.py", "bdb.py")
276-
cleanup_traceback(tbe, exclude)
276+
if not in_test: #When in test, the rpc.objecttable has no key 'exec'
277+
cleanup_traceback(tbe, exclude)
277278
traceback.print_list(tbe, file=efile)
278279
if ((not isinstance(exc, NameError) and not isinstance(exc, AttributeError))
279280
or "\n" not in str(exc)):

0 commit comments

Comments
 (0)