]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-38059: Using sys.exit() over exit() in inspect.py (GH-15666)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 9 Sep 2019 15:19:13 +0000 (08:19 -0700)
committerGitHub <noreply@github.com>
Mon, 9 Sep 2019 15:19:13 +0000 (08:19 -0700)
Constants added by the site module like exit() "should not be used in programs"
(cherry picked from commit e3c59a75279b0df4e7553d6f0031e202de434e43)

Co-authored-by: Alan Yee <alanyee@users.noreply.github.com>
Lib/inspect.py
Misc/NEWS.d/next/Library/2019-09-08-11-36-50.bpo-38059.8SA6co.rst [new file with mode: 0644]

index 4d4f33dcc57b5edad4fab44f33524be455c32078..7f0517207d15c4f740d672bb0c9e1ba0d20cf18f 100644 (file)
@@ -3108,7 +3108,7 @@ def _main():
                                                     type(exc).__name__,
                                                     exc)
         print(msg, file=sys.stderr)
-        exit(2)
+        sys.exit(2)
 
     if has_attrs:
         parts = attrs.split(".")
@@ -3118,7 +3118,7 @@ def _main():
 
     if module.__name__ in sys.builtin_module_names:
         print("Can't get info for builtin modules.", file=sys.stderr)
-        exit(1)
+        sys.exit(1)
 
     if args.details:
         print('Target: {}'.format(target))
diff --git a/Misc/NEWS.d/next/Library/2019-09-08-11-36-50.bpo-38059.8SA6co.rst b/Misc/NEWS.d/next/Library/2019-09-08-11-36-50.bpo-38059.8SA6co.rst
new file mode 100644 (file)
index 0000000..001952a
--- /dev/null
@@ -0,0 +1 @@
+inspect.py now uses sys.exit() instead of exit()