Issue #18874: PyCode_New() now ensures that the filename is a ready Unicode
authorVictor Stinner <victor.stinner@gmail.com>
Thu, 10 Oct 2013 13:55:14 +0000 (15:55 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Thu, 10 Oct 2013 13:55:14 +0000 (15:55 +0200)
string. This change does nothing is most cases, but it is useful on Windows in
some cases.

Objects/codeobject.c

index 9713f61b244a714c9ddf8fc8a5e830fd48c31537..353f414a38486b8ab319d8fdd07934ba5b4b54d5 100644 (file)
@@ -74,6 +74,11 @@ PyCode_New(int argcount, int kwonlyargcount,
         PyErr_BadInternalCall();
         return NULL;
     }
+
+    /* Ensure that the filename is a ready Unicode string */
+    if (PyUnicode_READY(filename) < 0)
+        return NULL;
+
     n_cellvars = PyTuple_GET_SIZE(cellvars);
     intern_strings(names);
     intern_strings(varnames);