diff Python/_warnings.c @ 73655:2e37fc70e2dd

Fix misuse of PyUnicode_GET_SIZE() => PyUnicode_GET_LENGTH() And PyUnicode_GetSize() => PyUnicode_GetLength()
author Victor Stinner <victor.stinner@haypocalc.com>
date Mon, 21 Nov 2011 02:49:52 +0100
parents 6ae8c68eb0c1
children b7c5e30582d1
line wrap: on
line diff
--- a/Python/_warnings.c	Mon Nov 21 02:24:49 2011 +0100
+++ b/Python/_warnings.c	Mon Nov 21 02:49:52 2011 +0100
@@ -203,13 +203,13 @@
 
     mod_str = _PyUnicode_AsString(filename);
     if (mod_str == NULL)
-            return NULL;
-    len = PyUnicode_GetSize(filename);
+        return NULL;
+    len = PyUnicode_GetLength(filename);
     if (len < 0)
         return NULL;
     if (len >= 3 &&
         strncmp(mod_str + (len - 3), ".py", 3) == 0) {
-        module = PyUnicode_FromStringAndSize(mod_str, len-3);
+        module = PyUnicode_Substring(filename, 0, len-3);
     }
     else {
         module = filename;
@@ -506,7 +506,7 @@
         if (PyUnicode_READY(*filename))
             goto handle_error;
 
-        len = PyUnicode_GetSize(*filename);
+        len = PyUnicode_GetLength(*filename);
         kind = PyUnicode_KIND(*filename);
         data = PyUnicode_DATA(*filename);
 
@@ -690,7 +690,7 @@
         }
 
         /* Split the source into lines. */
-        source_list = PyObject_CallMethodObjArgs(source, 
+        source_list = PyObject_CallMethodObjArgs(source,
                                                  PyId_splitlines.object,
                                                  NULL);
         Py_DECREF(source);