Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r2397:5631e450119f
Date: 2015-11-14 20:17 +0100
http://bitbucket.org/cffi/cffi/changeset/5631e450119f/

Log:    py3 compat

diff --git a/c/commontypes.c b/c/commontypes.c
--- a/c/commontypes.c
+++ b/c/commontypes.c
@@ -202,7 +202,7 @@
     int i, err;
     for (i = 0; i < num_common_simple_types; i++) {
         const char *s = common_simple_types[i];
-        PyObject *o = PyString_FromString(s + strlen(s) + 1);
+        PyObject *o = PyText_FromString(s + strlen(s) + 1);
         if (o == NULL)
             return NULL;
         err = PyDict_SetItemString(arg, s, o);
diff --git a/cffi/cparser.py b/cffi/cparser.py
--- a/cffi/cparser.py
+++ b/cffi/cparser.py
@@ -62,7 +62,8 @@
         if csource.startswith('*', endpos):
             parts.append('('); closing += ')'
         level = 0
-        for i in xrange(endpos, len(csource)):
+        i = endpos
+        while i < len(csource):
             c = csource[i]
             if c == '(':
                 level += 1
@@ -73,6 +74,7 @@
             elif c in ',;=':
                 if level == 0:
                     break
+            i += 1
         csource = csource[endpos:i] + closing + csource[i:]
         #print repr(''.join(parts)+csource)
     parts.append(csource)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to