diff options
author | Victor Stinner <vstinner@redhat.com> | 2019-03-01 11:14:41 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-01 11:14:41 (GMT) |
commit | dfe884759d1f4441c889695f8985bc9feb9f37eb (patch) | |
tree | 64e8bc65ee86db1bfca6a4a5cda8a7b598614989 /Programs | |
parent | b9f0354efce95b7557bc43ea193c4b652cd28392 (diff) | |
download | cpython-dfe884759d1f4441c889695f8985bc9feb9f37eb.zip cpython-dfe884759d1f4441c889695f8985bc9feb9f37eb.tar.gz cpython-dfe884759d1f4441c889695f8985bc9feb9f37eb.tar.bz2 |
bpo-36142: Rework error reporting in pymain_main() (GH-12113)
Add a new _Py_INIT_EXIT() macro to be able to exit Python with an
exitcode using _PyInitError API. Rewrite function calls by
pymain_main() to use _PyInitError.
Changes:
* Remove _PyMain.err and _PyMain.status field
* Add _Py_INIT_EXIT() macro and _PyInitError.exitcode field.
* Rename _Py_FatalInitError() to _Py_ExitInitError().
Diffstat (limited to 'Programs')
-rw-r--r-- | Programs/_freeze_importlib.c | 2 | ||||
-rw-r--r-- | Programs/_testembed.c | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/Programs/_freeze_importlib.c b/Programs/_freeze_importlib.c index 3f43757..d0e40c9 100644 --- a/Programs/_freeze_importlib.c +++ b/Programs/_freeze_importlib.c @@ -89,7 +89,7 @@ main(int argc, char *argv[]) /* No need to call _PyCoreConfig_Clear() since we didn't allocate any memory: program_name is a constant string. */ if (_Py_INIT_FAILED(err)) { - _Py_FatalInitError(err); + _Py_ExitInitError(err); } sprintf(buf, "<frozen %s>", name); diff --git a/Programs/_testembed.c b/Programs/_testembed.c index e28d94c..6b5311b 100644 --- a/Programs/_testembed.c +++ b/Programs/_testembed.c @@ -553,7 +553,7 @@ static int test_init_from_config(void) _PyInitError err = _Py_InitializeFromConfig(&config); /* Don't call _PyCoreConfig_Clear() since all strings are static */ if (_Py_INIT_FAILED(err)) { - _Py_FatalInitError(err); + _Py_ExitInitError(err); } dump_config(); Py_Finalize(); @@ -618,7 +618,7 @@ static int test_init_isolated(void) test_init_env_putenvs(); _PyInitError err = _Py_InitializeFromConfig(&config); if (_Py_INIT_FAILED(err)) { - _Py_FatalInitError(err); + _Py_ExitInitError(err); } dump_config(); Py_Finalize(); @@ -635,7 +635,7 @@ static int test_init_dev_mode(void) config.program_name = L"./_testembed"; _PyInitError err = _Py_InitializeFromConfig(&config); if (_Py_INIT_FAILED(err)) { - _Py_FatalInitError(err); + _Py_ExitInitError(err); } dump_config(); Py_Finalize(); |