Skip to content

Commit faa22f4

Browse files
committed
Handle PYTHONSTARTUP script exceptions
1 parent f937468 commit faa22f4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Lib/asyncio/__main__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,12 @@ def run(self):
101101
import tokenize
102102
with tokenize.open(startup_path) as f:
103103
startup_code = compile(f.read(), startup_path, "exec")
104-
exec(startup_code, console.locals)
104+
try:
105+
exec(startup_code, console.locals)
106+
except SystemExit:
107+
raise
108+
except BaseException:
109+
sys.excepthook(*sys.exc_info())
105110

106111
ps1 = getattr(sys, "ps1", ">>> ")
107112
if CAN_USE_PYREPL:

0 commit comments

Comments
 (0)