diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-04-09 22:27:23 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-04-09 22:27:23 (GMT) |
commit | 7d36e4f074a0141966394284f877bbe2270ccd93 (patch) | |
tree | a1c5c9d1ed3202e0c4d36043a3d8eac52dff492a /Modules | |
parent | 247109e74dcdde19c491c966496655cb87834981 (diff) | |
download | cpython-7d36e4f074a0141966394284f877bbe2270ccd93.zip cpython-7d36e4f074a0141966394284f877bbe2270ccd93.tar.gz cpython-7d36e4f074a0141966394284f877bbe2270ccd93.tar.bz2 |
Close #14439: Python now prints the traceback on runpy failure at startup.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/main.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/main.c b/Modules/main.c index 79ad6f5..1d6c09a 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -167,17 +167,20 @@ static int RunModule(wchar_t *modname, int set_argv0) runpy = PyImport_ImportModule("runpy"); if (runpy == NULL) { fprintf(stderr, "Could not import runpy module\n"); + PyErr_Print(); return -1; } runmodule = PyObject_GetAttrString(runpy, "_run_module_as_main"); if (runmodule == NULL) { fprintf(stderr, "Could not access runpy._run_module_as_main\n"); + PyErr_Print(); Py_DECREF(runpy); return -1; } module = PyUnicode_FromWideChar(modname, wcslen(modname)); if (module == NULL) { fprintf(stderr, "Could not convert module name to unicode\n"); + PyErr_Print(); Py_DECREF(runpy); Py_DECREF(runmodule); return -1; @@ -186,6 +189,7 @@ static int RunModule(wchar_t *modname, int set_argv0) if (runargs == NULL) { fprintf(stderr, "Could not create arguments for runpy._run_module_as_main\n"); + PyErr_Print(); Py_DECREF(runpy); Py_DECREF(runmodule); Py_DECREF(module); |