mirror of
https://github.com/python/cpython.git
synced 2025-08-23 10:16:01 +00:00
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")).
This commit is contained in:
parent
0023a2f858
commit
a7444f47b2
1 changed files with 1 additions and 1 deletions
|
@ -738,7 +738,7 @@ PyErr_ProgramText(const char *filename, int lineno)
|
||||||
int i;
|
int i;
|
||||||
char linebuf[1000];
|
char linebuf[1000];
|
||||||
|
|
||||||
if (filename == NULL || lineno <= 0)
|
if (filename == NULL || *filename == '\0' || lineno <= 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
fp = fopen(filename, "r" PY_STDIOTEXTMODE);
|
fp = fopen(filename, "r" PY_STDIOTEXTMODE);
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue