[pypy-commit] cffi default: Py3 compat

2017-06-19 Thread arigo
Author: Armin Rigo 
Branch: 
Changeset: r2982:7495a3729d42
Date: 2017-06-19 10:12 +0200
http://bitbucket.org/cffi/cffi/changeset/7495a3729d42/

Log:Py3 compat

diff --git a/cffi/_cffi_errors.h b/cffi/_cffi_errors.h
--- a/cffi/_cffi_errors.h
+++ b/cffi/_cffi_errors.h
@@ -36,7 +36,11 @@
 if (result == NULL)
 goto error;
 
+#if PY_MAJOR_VERSION >= 3
+bi = PyImport_ImportModule("builtins");
+#else
 bi = PyImport_ImportModule("__builtin__");
+#endif
 if (bi == NULL)
 goto error;
 PyDict_SetItemString(result, "__builtins__", bi);
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] cffi default: Py3 compat

2017-05-09 Thread arigo
Author: Armin Rigo 
Branch: 
Changeset: r2932:bac0dd1b86f9
Date: 2017-05-09 18:31 +0200
http://bitbucket.org/cffi/cffi/changeset/bac0dd1b86f9/

Log:Py3 compat

diff --git a/cffi/recompiler.py b/cffi/recompiler.py
--- a/cffi/recompiler.py
+++ b/cffi/recompiler.py
@@ -1484,7 +1484,7 @@
 msg = 'the current directory is'
 else:
 msg = 'setting the current directory to'
-print '%s %r' % (msg, os.path.abspath(tmpdir))
+print('%s %r' % (msg, os.path.abspath(tmpdir)))
 os.chdir(tmpdir)
 outputfilename = ffiplatform.compile('.', ext,
  compiler_verbose, debug)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] cffi default: py3 compat

2015-11-14 Thread arigo
Author: Armin Rigo 
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
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] cffi default: py3 compat

2013-04-06 Thread pjenvey
Author: Philip Jenvey 
Branch: 
Changeset: r1240:95eba1b0
Date: 2013-04-05 11:57 -0700
http://bitbucket.org/cffi/cffi/changeset/95eba1b0/

Log:py3 compat

diff --git a/testing/test_verify.py b/testing/test_verify.py
--- a/testing/test_verify.py
+++ b/testing/test_verify.py
@@ -7,7 +7,7 @@
 if sys.platform == 'win32':
 pass  # no obvious -Werror equivalent on MSVC
 elif (sys.platform == 'darwin' and
-  map(int, os.uname()[2].split('.')) >= [11, 0, 0]):
+  [int(x) for x in os.uname()[2].split('.')] >= [11, 0, 0]):
 pass  # recent MacOSX come with clang by default, and passing some
   # flags from the interpreter (-mno-fused-madd) generates a
   # warning --- which is interpreted as an error with -Werror
___
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit