Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7d36e4f

Browse files
committed
Close #14439: Python now prints the traceback on runpy failure at startup.
1 parent 247109e commit 7d36e4f

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

Misc/NEWS

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ What's New in Python 3.4.0 Alpha 1?
1010
Core and Builtins
1111
-----------------
1212

13+
- Issue #14439: Python now prints the traceback on runpy failure at startup.
14+
1315
- Issue #17469: Fix _Py_GetAllocatedBlocks() and sys.getallocatedblocks()
1416
when running on valgrind.
1517

@@ -1053,7 +1055,7 @@ IDLE
10531055

10541056
- Issue #6698: IDLE now opens just an editor window when configured to do so.
10551057

1056-
- Issue #8900: Using keyboard shortcuts in IDLE to open a file no longer
1058+
- Issue #8900: Using keyboard shortcuts in IDLE to open a file no longer
10571059
raises an exception.
10581060

10591061
- Issue #6649: Fixed missing exit status in IDLE. Patch by Guilherme Polo.
@@ -1092,7 +1094,7 @@ IDLE
10921094

10931095
- Issue #6698: IDLE now opens just an editor window when configured to do so.
10941096

1095-
- Issue #8900: Using keyboard shortcuts in IDLE to open a file no longer
1097+
- Issue #8900: Using keyboard shortcuts in IDLE to open a file no longer
10961098
raises an exception.
10971099

10981100
- Issue #6649: Fixed missing exit status in IDLE. Patch by Guilherme Polo.

Modules/main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,17 +167,20 @@ static int RunModule(wchar_t *modname, int set_argv0)
167167
runpy = PyImport_ImportModule("runpy");
168168
if (runpy == NULL) {
169169
fprintf(stderr, "Could not import runpy module\n");
170+
PyErr_Print();
170171
return -1;
171172
}
172173
runmodule = PyObject_GetAttrString(runpy, "_run_module_as_main");
173174
if (runmodule == NULL) {
174175
fprintf(stderr, "Could not access runpy._run_module_as_main\n");
176+
PyErr_Print();
175177
Py_DECREF(runpy);
176178
return -1;
177179
}
178180
module = PyUnicode_FromWideChar(modname, wcslen(modname));
179181
if (module == NULL) {
180182
fprintf(stderr, "Could not convert module name to unicode\n");
183+
PyErr_Print();
181184
Py_DECREF(runpy);
182185
Py_DECREF(runmodule);
183186
return -1;
@@ -186,6 +189,7 @@ static int RunModule(wchar_t *modname, int set_argv0)
186189
if (runargs == NULL) {
187190
fprintf(stderr,
188191
"Could not create arguments for runpy._run_module_as_main\n");
192+
PyErr_Print();
189193
Py_DECREF(runpy);
190194
Py_DECREF(runmodule);
191195
Py_DECREF(module);

0 commit comments

Comments
 (0)