Mercurial > cpython-lru_cache-weakref
diff Python/_warnings.c @ 71173:ac18e70cbe7e 3.2
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 02:43:09 +0200 |
| parents | 81d7f78a633a |
| children | f0382acebfe6 |
line wrap: on
line diff
--- a/Python/_warnings.c Sun Jul 03 17:39:20 2011 -0700 +++ b/Python/_warnings.c Mon Jul 04 02:43:09 2011 +0200 @@ -496,7 +496,7 @@ /* Setup filename. */ *filename = PyDict_GetItemString(globals, "__file__"); - if (*filename != NULL) { + if (*filename != NULL && PyUnicode_Check(*filename)) { Py_ssize_t len = PyUnicode_GetSize(*filename); Py_UNICODE *unicode = PyUnicode_AS_UNICODE(*filename);
