diff Python/symtable.c @ 72475:8beaa9a37387

Implement PEP 393.
author Martin v. Löwis <martin@v.loewis.de>
date Wed, 28 Sep 2011 07:41:54 +0200
parents 6b3872a11299
children bddb455439d0
line wrap: on
line diff
--- a/Python/symtable.c	Tue Sep 27 20:52:04 2011 -0500
+++ b/Python/symtable.c	Wed Sep 28 07:41:54 2011 +0200
@@ -1525,10 +1525,10 @@
     */
     PyObject *store_name;
     PyObject *name = (a->asname == NULL) ? a->name : a->asname;
-    const Py_UNICODE *base = PyUnicode_AS_UNICODE(name);
-    Py_UNICODE *dot = Py_UNICODE_strchr(base, '.');
-    if (dot) {
-        store_name = PyUnicode_FromUnicode(base, dot - base);
+    Py_ssize_t dot = PyUnicode_FindChar(name, '.', 0,
+                                        PyUnicode_GET_LENGTH(name), 1);
+    if (dot != -1) {
+        store_name = PyUnicode_Substring(name, 0, dot);
         if (!store_name)
             return 0;
     }