Mercurial > cpython-lru_cache-weakref
comparison Python/errors.c @ 36701:e3248f1fc54d legacy-trunk
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")).
| author | Tim Peters <tim.peters@gmail.com> |
|---|---|
| date | Mon, 27 Feb 2006 23:29:46 +0000 |
| parents | 30aef3ce2b26 |
| children | fa92fe15251a |
comparison
equal
deleted
inserted
replaced
| 36700:2a2d46d1929a | 36701:e3248f1fc54d |
|---|---|
| 736 { | 736 { |
| 737 FILE *fp; | 737 FILE *fp; |
| 738 int i; | 738 int i; |
| 739 char linebuf[1000]; | 739 char linebuf[1000]; |
| 740 | 740 |
| 741 if (filename == NULL || lineno <= 0) | 741 if (filename == NULL || *filename == '\0' || lineno <= 0) |
| 742 return NULL; | 742 return NULL; |
| 743 fp = fopen(filename, "r" PY_STDIOTEXTMODE); | 743 fp = fopen(filename, "r" PY_STDIOTEXTMODE); |
| 744 if (fp == NULL) | 744 if (fp == NULL) |
| 745 return NULL; | 745 return NULL; |
| 746 for (i = 0; i < lineno; i++) { | 746 for (i = 0; i < lineno; i++) { |
