summaryrefslogtreecommitdiff
path: root/Python/errors.c
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2006-02-27 23:29:46 +0000
committerTim Peters <tim.peters@gmail.com>2006-02-27 23:29:46 +0000
commita70dfd86e26da3b7ba7c05c195d6f0cd95e45f4a (patch)
tree189f0b4ce83d319771bcd3171dea195072b8508d /Python/errors.c
parentd4e46e691f737a0ebb3eeee2cc259093ed058ba6 (diff)
downloadcpython-a70dfd86e26da3b7ba7c05c195d6f0cd95e45f4a.tar.gz
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")).
Diffstat (limited to 'Python/errors.c')
-rw-r--r--Python/errors.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/errors.c b/Python/errors.c
index ace63ffd81..cbcc6facaf 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)