summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-09-09 15:19:13 (GMT)
committerGitHub <noreply@github.com>2019-09-09 15:19:13 (GMT)
commitb7bf632d4ebacfeffc8770a7848c690fa2a90a62 (patch)
tree49d02ecd557eb5bb17165c2dab3fd5ea5b93bc71
parent55a6f73b49625ebff575521c3a0b919880f5f0ec (diff)
downloadcpython-b7bf632d4ebacfeffc8770a7848c690fa2a90a62.zip
cpython-b7bf632d4ebacfeffc8770a7848c690fa2a90a62.tar.gz
cpython-b7bf632d4ebacfeffc8770a7848c690fa2a90a62.tar.bz2
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 e3c59a75279b0df4e7553d6f0031e202de434e43) Co-authored-by: Alan Yee <alanyee@users.noreply.github.com>
-rw-r--r--Lib/inspect.py4
-rw-r--r--Misc/NEWS.d/next/Library/2019-09-08-11-36-50.bpo-38059.8SA6co.rst1
2 files changed, 3 insertions, 2 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py
index 4d4f33d..7f05172 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -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
index 0000000..001952a
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2019-09-08-11-36-50.bpo-38059.8SA6co.rst
@@ -0,0 +1 @@
+inspect.py now uses sys.exit() instead of exit()