Mercurial > cpython-lru_cache-weakref
diff Python/import.c @ 73064:fdb0ccf1f4b3
Add ready checks for make_compiled_pathname.
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Sun, 23 Oct 2011 17:35:46 +0200 |
| parents | 1959b2332c6a |
| children | 6fa4386d48a9 |
line wrap: on
line diff
--- a/Python/import.c Sun Oct 23 17:29:08 2011 +0200 +++ b/Python/import.c Sun Oct 23 17:35:46 2011 +0200 @@ -929,7 +929,10 @@ for the compiled file, or NULL if there's no space in the buffer. Doesn't set an exception. - foo.py -> __pycache__/foo.<tag>.pyc */ + foo.py -> __pycache__/foo.<tag>.pyc + + pathstr is assumed to be "ready". +*/ static PyObject* make_compiled_pathname(PyObject *pathstr, int debug) @@ -1458,6 +1461,8 @@ goto error; } #endif + if (PyUnicode_READY(pathname) < 0) + return NULL; cpathname = make_compiled_pathname(pathname, !Py_OptimizeFlag); if (cpathname != NULL) @@ -3949,6 +3954,9 @@ return NULL; } + if (PyUnicode_READY(pathname) < 0) + return NULL; + cpathname = make_compiled_pathname(pathname, debug); Py_DECREF(pathname);
