Victor Stinner avatar Victor Stinner committed b809e16 Draft

Move PyUnicode_FromObject()

Comments (0)

Files changed (2)

Objects/unicodecodecs.c

 /* --- Codec Public API --------------------------------------------------- */
 
 PyObject *
-PyUnicode_FromObject(register PyObject *obj)
-{
-    /* XXX Perhaps we should make this API an alias of
-       PyObject_Str() instead ?! */
-    if (PyUnicode_CheckExact(obj)) {
-        if (PyUnicode_READY(obj) == -1)
-            return NULL;
-        Py_INCREF(obj);
-        return obj;
-    }
-    if (PyUnicode_Check(obj)) {
-        /* For a Unicode subtype that's not a Unicode object,
-           return a true Unicode object with the same data. */
-        return _PyUnicode_Copy(obj);
-    }
-    PyErr_Format(PyExc_TypeError,
-                 "Can't convert '%.100s' object to str implicitly",
-                 Py_TYPE(obj)->tp_name);
-    return NULL;
-}
-
-PyObject *
 PyUnicode_FromEncodedObject(register PyObject *obj,
                             const char *encoding,
                             const char *errors)

Objects/unicodenew.c

     return copy;
 }
 
+PyObject *
+PyUnicode_FromObject(register PyObject *obj)
+{
+    /* XXX Perhaps we should make this API an alias of
+       PyObject_Str() instead ?! */
+    if (PyUnicode_CheckExact(obj)) {
+        if (PyUnicode_READY(obj) == -1)
+            return NULL;
+        Py_INCREF(obj);
+        return obj;
+    }
+    if (PyUnicode_Check(obj)) {
+        /* For a Unicode subtype that's not a Unicode object,
+           return a true Unicode object with the same data. */
+        return _PyUnicode_Copy(obj);
+    }
+    PyErr_Format(PyExc_TypeError,
+                 "Can't convert '%.100s' object to str implicitly",
+                 Py_TYPE(obj)->tp_name);
+    return NULL;
+}
 
 /* Widen Unicode objects to larger buffers. Don't write terminating null
    character. Return NULL on error. */
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.