Skip to content

Commit b7bf632

Browse files
bpo-38059: Using sys.exit() over exit() in inspect.py (GH-15666)
Constants added by the site module like exit() "should not be used in programs" (cherry picked from commit e3c59a7) Co-authored-by: Alan Yee <[email protected]>
1 parent 55a6f73 commit b7bf632

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Lib/inspect.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3108,7 +3108,7 @@ def _main():
31083108
type(exc).__name__,
31093109
exc)
31103110
print(msg, file=sys.stderr)
3111-
exit(2)
3111+
sys.exit(2)
31123112

31133113
if has_attrs:
31143114
parts = attrs.split(".")
@@ -3118,7 +3118,7 @@ def _main():
31183118

31193119
if module.__name__ in sys.builtin_module_names:
31203120
print("Can't get info for builtin modules.", file=sys.stderr)
3121-
exit(1)
3121+
sys.exit(1)
31223122

31233123
if args.details:
31243124
print('Target: {}'.format(target))
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
inspect.py now uses sys.exit() instead of exit()

0 commit comments

Comments
 (0)