bpo-36763: _PyInitError always use int for exitcode by vstinner · Pull Request #13360 · python/cpython
if (PyList_Insert(sys_path, 0, path0)) { goto error; return -1; } return 0;
error: PyErr_Print(); return -1; }
static _PyInitError static void pymain_run_python(int *exitcode) { _PyInitError err;
PyInterpreterState *interp = _PyInterpreterState_GET_UNSAFE(); /* pymain_run_stdin() modify the config */ _PyCoreConfig *config = &interp->core_config;
if (main_importer_path != NULL) { if (pymain_sys_path_add_path0(interp, main_importer_path) < 0) { err = _Py_INIT_EXIT(1); goto done; goto error; } } else if (!config->isolated) { PyObject *path0 = NULL; if (_PyPathConfig_ComputeSysPath0(&config->argv, &path0)) { if (path0 == NULL) { err = _Py_INIT_NO_MEMORY(); goto done; } int res = _PyPathConfig_ComputeSysPath0(&config->argv, &path0); if (res < 0) { goto error; }
if (res > 0) { if (pymain_sys_path_add_path0(interp, path0) < 0) { Py_DECREF(path0); err = _Py_INIT_EXIT(1); goto done; goto error; } Py_DECREF(path0); }
pymain_repl(config, &cf, exitcode); err = _Py_INIT_OK(); goto done;
error: PyErr_Print(); *exitcode = 1;
done: Py_XDECREF(main_importer_path); return err; }
_PyInitError err = pymain_run_python(&exitcode); if (_Py_INIT_FAILED(err)) { pymain_exit_error(err); }
pymain_run_python(&exitcode); if (Py_FinalizeEx() < 0) { /* Value unlikely to be confused with a non-error exit status or other special meaning */ exitcode = 120; }
done: pymain_free();
if (_Py_UnhandledKeyboardInterrupt) {