Skip to content

Commit 7e777ea

Browse files
committed
scoping NotImplementedError to current file
1 parent 82af056 commit 7e777ea

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/cs50/cs50.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from distutils.sysconfig import get_python_lib
88
from os.path import abspath, join
99
from termcolor import colored
10-
from traceback import format_exception
10+
from traceback import extract_tb, format_exception
1111

1212

1313
class flushfile():
@@ -45,7 +45,8 @@ def formatException(type, value, tb):
4545
"""
4646

4747
# Don't print tracebacks for deprecations
48-
if type == NotImplementedError:
48+
summary = extract_tb(tb)
49+
if summary and summary[-1].filename == __file__ and type == NotImplementedError:
4950
return "".join(format_exception(type, value, None)).rstrip()
5051

5152
# Absolute paths to site-packages

0 commit comments

Comments
 (0)