Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0d4396c

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 3bd4bed commit 0d4396c

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
@@ -3118,7 +3118,7 @@ def _main():
31183118
type(exc).__name__,
31193119
exc)
31203120
print(msg, file=sys.stderr)
3121-
exit(2)
3121+
sys.exit(2)
31223122

31233123
if has_attrs:
31243124
parts = attrs.split(".")
@@ -3128,7 +3128,7 @@ def _main():
31283128

31293129
if module.__name__ in sys.builtin_module_names:
31303130
print("Can't get info for builtin modules.", file=sys.stderr)
3131-
exit(1)
3131+
sys.exit(1)
31323132

31333133
if args.details:
31343134
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)