summaryrefslogtreecommitdiffstats
path: root/Python/symtable.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2011-09-28 05:41:54 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2011-09-28 05:41:54 (GMT)
commitd63a3b8beb4a0841cb59fb3515347ccaab34b733 (patch)
tree3b4e3cc63151c5a5a910c3550a190aefaea96ad4 /Python/symtable.c
parent48d49497c50e79d14e9df9527d766ca3a0a38be5 (diff)
downloadcpython-d63a3b8beb4a0841cb59fb3515347ccaab34b733.zip
cpython-d63a3b8beb4a0841cb59fb3515347ccaab34b733.tar.gz
cpython-d63a3b8beb4a0841cb59fb3515347ccaab34b733.tar.bz2
Implement PEP 393.
Diffstat (limited to 'Python/symtable.c')
-rw-r--r--Python/symtable.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Python/symtable.c b/Python/symtable.c
index a0bedfc..3578b0c 100644
--- a/Python/symtable.c
+++ b/Python/symtable.c
@@ -1525,10 +1525,10 @@ symtable_visit_alias(struct symtable *st, alias_ty a)
*/
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;
}