[Python-checkins] cpython: Close #14439: Python now prints the traceback on runpy failure at startup.

victor.stinner python-checkins at python.org
Wed Apr 10 00:27:39 CEST 2013


http://hg.python.org/cpython/rev/39b9b05c3085
changeset: 83229:39b9b05c3085
user: Victor Stinner <victor.stinner at gmail.com>
date: Wed Apr 10 00:27:23 2013 +0200
summary:
 Close #14439: Python now prints the traceback on runpy failure at startup.
files:
 Misc/NEWS | 6 ++++--
 Modules/main.c | 4 ++++
 2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,8 @@
 Core and Builtins
 -----------------
 
+- Issue #14439: Python now prints the traceback on runpy failure at startup.
+
 - Issue #17469: Fix _Py_GetAllocatedBlocks() and sys.getallocatedblocks()
 when running on valgrind.
 
@@ -1053,7 +1055,7 @@
 
 - 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.
 
 - Issue #6649: Fixed missing exit status in IDLE. Patch by Guilherme Polo.
@@ -1092,7 +1094,7 @@
 
 - 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.
 
 - Issue #6649: Fixed missing exit status in IDLE. Patch by Guilherme Polo.
diff --git a/Modules/main.c b/Modules/main.c
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -167,17 +167,20 @@
 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 @@
 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);
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /