summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2006-02-27 23:29:46 (GMT)
committerTim Peters <tim.peters@gmail.com>2006-02-27 23:29:46 (GMT)
commita7444f47b21ac75cd6e4bb06b615b39cd7876fa2 (patch)
treeb6a755e860c27869a5d493d89894ea3433bb05aa
parent0023a2f858e62ad364156c008a3f79d6ae32d1c8 (diff)
downloadcpython-a7444f47b21ac75cd6e4bb06b615b39cd7876fa2.zip
cpython-a7444f47b21ac75cd6e4bb06b615b39cd7876fa2.tar.gz
cpython-a7444f47b21ac75cd6e4bb06b615b39cd7876fa2.tar.bz2
PyErr_ProgramText(): Grrrrrr.
In a Windows debug build, trying to open a file using an empty string as the name causes assertion death inside MS's C runtime code. We probably need to worm around that in many places. I'm worming around it here to stop the new test_with.py from assert-dying in the Windows debug build (it calls compile() with an empty string for "the file name", which indirectly leads to C-level code in Python trying to fopen("", "r")).
-rw-r--r--Python/errors.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/errors.c b/Python/errors.c
index ace63ff..cbcc6fa 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -738,7 +738,7 @@ PyErr_ProgramText(const char *filename, int lineno)
int i;
char linebuf[1000];
- if (filename == NULL || lineno <= 0)
+ if (filename == NULL || *filename == '\0' || lineno <= 0)
return NULL;
fp = fopen(filename, "r" PY_STDIOTEXTMODE);
if (fp == NULL)