summaryrefslogtreecommitdiffstats
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorThomas Heller <theller@ctypes.org>2002-07-09 09:23:27 (GMT)
committerThomas Heller <theller@ctypes.org>2002-07-09 09:23:27 (GMT)
commit6b17abf6c0ddaed423a76e665124a80afbc39fe7 (patch)
tree2ac5bf135de125db8dc0d2cf942a9cd554fcde3d /Python/pythonrun.c
parent4254cbd29c77f3d26d701198735957375a995dcc (diff)
downloadcpython-6b17abf6c0ddaed423a76e665124a80afbc39fe7.zip
cpython-6b17abf6c0ddaed423a76e665124a80afbc39fe7.tar.gz
cpython-6b17abf6c0ddaed423a76e665124a80afbc39fe7.tar.bz2
Fix SF Bug 564931: compile() traceback must include filename.
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r--Python/pythonrun.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index ec8291c..88367ae 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -1134,7 +1134,9 @@ Py_CompileStringFlags(char *str, char *filename, int start,
{
node *n;
PyCodeObject *co;
- n = PyParser_SimpleParseStringFlags(str, start, PARSER_FLAGS(flags));
+
+ n = PyParser_SimpleParseStringFlagsFilename(str, filename, start,
+ PARSER_FLAGS(flags));
if (n == NULL)
return NULL;
co = PyNode_CompileFlags(n, filename, flags);
@@ -1147,7 +1149,8 @@ Py_SymtableString(char *str, char *filename, int start)
{
node *n;
struct symtable *st;
- n = PyParser_SimpleParseString(str, start);
+ n = PyParser_SimpleParseStringFlagsFilename(str, filename,
+ start, 0);
if (n == NULL)
return NULL;
st = PyNode_CompileSymtable(n, filename);
@@ -1195,6 +1198,28 @@ PyParser_SimpleParseString(char *str, int start)
return PyParser_SimpleParseStringFlags(str, start, 0);
}
+node *
+PyParser_SimpleParseStringFlagsFilename(char *str, char *filename,
+ int start, int flags)
+{
+ node *n;
+ perrdetail err;
+
+ n = PyParser_ParseStringFlagsFilename(str, filename,
+ &_PyParser_Grammar,
+ start, &err, flags);
+ if (n == NULL)
+ err_input(&err);
+ return n;
+}
+
+node *
+PyParser_SimpleParseStringFilename(char *str, char *filename, int start)
+{
+ return PyParser_SimpleParseStringFlagsFilename(str, filename,
+ start, 0);
+}
+
/* Set the error appropriate to the given input error code (see errcode.h) */
static void