[Python-checkins] cpython: Add ready checks for make_compiled_pathname.

martin.v.loewis python-checkins at python.org
Sun Oct 23 18:05:13 CEST 2011


http://hg.python.org/cpython/rev/fdb0ccf1f4b3
changeset:   73064:fdb0ccf1f4b3
user:        Martin v. Löwis <martin at v.loewis.de>
date:        Sun Oct 23 17:35:46 2011 +0200
summary:
  Add ready checks for make_compiled_pathname.

files:
  Python/import.c |  10 +++++++++-
  1 files changed, 9 insertions(+), 1 deletions(-)


diff --git a/Python/import.c b/Python/import.c
--- a/Python/import.c
+++ b/Python/import.c
@@ -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);
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list