Commit 7d36e4f0 authored by Victor Stinner's avatar Victor Stinner

Close #14439: Python now prints the traceback on runpy failure at startup.

parent 247109e7
...@@ -10,6 +10,8 @@ What's New in Python 3.4.0 Alpha 1? ...@@ -10,6 +10,8 @@ What's New in Python 3.4.0 Alpha 1?
Core and Builtins Core and Builtins
----------------- -----------------
- Issue #14439: Python now prints the traceback on runpy failure at startup.
- Issue #17469: Fix _Py_GetAllocatedBlocks() and sys.getallocatedblocks() - Issue #17469: Fix _Py_GetAllocatedBlocks() and sys.getallocatedblocks()
when running on valgrind. when running on valgrind.
...@@ -1053,7 +1055,7 @@ IDLE ...@@ -1053,7 +1055,7 @@ IDLE
- Issue #6698: IDLE now opens just an editor window when configured to do so. - Issue #6698: IDLE now opens just an editor window when configured to do so.
- Issue #8900: Using keyboard shortcuts in IDLE to open a file no longer - Issue #8900: Using keyboard shortcuts in IDLE to open a file no longer
raises an exception. raises an exception.
- Issue #6649: Fixed missing exit status in IDLE. Patch by Guilherme Polo. - Issue #6649: Fixed missing exit status in IDLE. Patch by Guilherme Polo.
...@@ -1092,7 +1094,7 @@ IDLE ...@@ -1092,7 +1094,7 @@ IDLE
- Issue #6698: IDLE now opens just an editor window when configured to do so. - Issue #6698: IDLE now opens just an editor window when configured to do so.
- Issue #8900: Using keyboard shortcuts in IDLE to open a file no longer - Issue #8900: Using keyboard shortcuts in IDLE to open a file no longer
raises an exception. raises an exception.
- Issue #6649: Fixed missing exit status in IDLE. Patch by Guilherme Polo. - Issue #6649: Fixed missing exit status in IDLE. Patch by Guilherme Polo.
......
...@@ -167,17 +167,20 @@ static int RunModule(wchar_t *modname, int set_argv0) ...@@ -167,17 +167,20 @@ static int RunModule(wchar_t *modname, int set_argv0)
runpy = PyImport_ImportModule("runpy"); runpy = PyImport_ImportModule("runpy");
if (runpy == NULL) { if (runpy == NULL) {
fprintf(stderr, "Could not import runpy module\n"); fprintf(stderr, "Could not import runpy module\n");
PyErr_Print();
return -1; return -1;
} }
runmodule = PyObject_GetAttrString(runpy, "_run_module_as_main"); runmodule = PyObject_GetAttrString(runpy, "_run_module_as_main");
if (runmodule == NULL) { if (runmodule == NULL) {
fprintf(stderr, "Could not access runpy._run_module_as_main\n"); fprintf(stderr, "Could not access runpy._run_module_as_main\n");
PyErr_Print();
Py_DECREF(runpy); Py_DECREF(runpy);
return -1; return -1;
} }
module = PyUnicode_FromWideChar(modname, wcslen(modname)); module = PyUnicode_FromWideChar(modname, wcslen(modname));
if (module == NULL) { if (module == NULL) {
fprintf(stderr, "Could not convert module name to unicode\n"); fprintf(stderr, "Could not convert module name to unicode\n");
PyErr_Print();
Py_DECREF(runpy); Py_DECREF(runpy);
Py_DECREF(runmodule); Py_DECREF(runmodule);
return -1; return -1;
...@@ -186,6 +189,7 @@ static int RunModule(wchar_t *modname, int set_argv0) ...@@ -186,6 +189,7 @@ static int RunModule(wchar_t *modname, int set_argv0)
if (runargs == NULL) { if (runargs == NULL) {
fprintf(stderr, fprintf(stderr,
"Could not create arguments for runpy._run_module_as_main\n"); "Could not create arguments for runpy._run_module_as_main\n");
PyErr_Print();
Py_DECREF(runpy); Py_DECREF(runpy);
Py_DECREF(runmodule); Py_DECREF(runmodule);
Py_DECREF(module); Py_DECREF(module);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment