diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2011-10-23 15:35:46 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2011-10-23 15:35:46 (GMT) |
commit | 30260a7fe31c4051bd66e901c6d87296e29c0dfc (patch) | |
tree | 17f91651390f9856408789d3a5d464c676cc0975 | |
parent | 2db72863fb38bfe7cb10c733dfaef15316619930 (diff) | |
download | cpython-30260a7fe31c4051bd66e901c6d87296e29c0dfc.zip cpython-30260a7fe31c4051bd66e901c6d87296e29c0dfc.tar.gz cpython-30260a7fe31c4051bd66e901c6d87296e29c0dfc.tar.bz2 |
Add ready checks for make_compiled_pathname.
-rw-r--r-- | Python/import.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Python/import.c b/Python/import.c index 1101c92..5dcaf3a 100644 --- a/Python/import.c +++ b/Python/import.c @@ -929,7 +929,10 @@ rightmost_sep_obj(PyObject* o) 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 @@ load_source_module(PyObject *name, PyObject *pathname, FILE *fp) goto error; } #endif + if (PyUnicode_READY(pathname) < 0) + return NULL; cpathname = make_compiled_pathname(pathname, !Py_OptimizeFlag); if (cpathname != NULL) @@ -3949,6 +3954,9 @@ imp_cache_from_source(PyObject *self, PyObject *args, PyObject *kws) return NULL; } + if (PyUnicode_READY(pathname) < 0) + return NULL; + cpathname = make_compiled_pathname(pathname, debug); Py_DECREF(pathname); |