summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-04-26 11:05:47 (GMT)
committerGitHub <noreply@github.com>2019-04-26 11:05:47 (GMT)
commit4cb525a1f0cba152d1da61e531f2ad5db633120a (patch)
tree1f1763445e6150950986d8ba8e24181375124a7a /Include
parent00db7c73af4f60df61e9df87cde7401c3ed9df69 (diff)
downloadcpython-4cb525a1f0cba152d1da61e531f2ad5db633120a.zip
cpython-4cb525a1f0cba152d1da61e531f2ad5db633120a.tar.gz
cpython-4cb525a1f0cba152d1da61e531f2ad5db633120a.tar.bz2
bpo-36356: pymain_exit_error() only call pymain_free() for exit (GH-12968)
Add _Py_INIT_HAS_EXITCODE() macro.
Diffstat (limited to 'Include')
-rw-r--r--Include/cpython/coreconfig.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/Include/cpython/coreconfig.h b/Include/cpython/coreconfig.h
index c1a7298..ed2f09f 100644
--- a/Include/cpython/coreconfig.h
+++ b/Include/cpython/coreconfig.h
@@ -33,8 +33,10 @@ typedef struct {
#define _Py_INIT_NO_MEMORY() _Py_INIT_USER_ERR("memory allocation failed")
#define _Py_INIT_EXIT(EXITCODE) \
(_PyInitError){.prefix = NULL, .msg = NULL, .user_err = 0, .exitcode = (EXITCODE)}
+#define _Py_INIT_HAS_EXITCODE(err) \
+ (err.exitcode != -1)
#define _Py_INIT_FAILED(err) \
- (err.msg != NULL || err.exitcode != -1)
+ (err.msg != NULL || _Py_INIT_HAS_EXITCODE(err))
/* --- _PyWstrList ------------------------------------------------ */