Mercurial > cpython-lru_cache-weakref
diff Python/_warnings.c @ 71175:fc46acf7a645 2.7
Issue #12467: warnings: fix a race condition if a warning is emitted at
shutdown, if globals()['__file__'] is None.
| author | Victor Stinner <victor.stinner@haypocalc.com> |
|---|---|
| date | Mon, 04 Jul 2011 03:05:37 +0200 |
| parents | ee5350f1d0c2 |
| children | a2944dd4ba7b |
line wrap: on
line diff
--- a/Python/_warnings.c Sun Jul 03 17:38:53 2011 -0700 +++ b/Python/_warnings.c Mon Jul 04 03:05:37 2011 +0200 @@ -491,7 +491,7 @@ /* Setup filename. */ *filename = PyDict_GetItemString(globals, "__file__"); - if (*filename != NULL) { + if (*filename != NULL && PyString_Check(*filename)) { Py_ssize_t len = PyString_Size(*filename); const char *file_str = PyString_AsString(*filename); if (file_str == NULL || (len < 0 && PyErr_Occurred()))
