Author: Armin Rigo <[email protected]>
Branch: release-1.6
Changeset: r2677:3605dede031e
Date: 2016-04-21 13:17 +0200
http://bitbucket.org/cffi/cffi/changeset/3605dede031e/
Log: hg merge default
diff --git a/c/realize_c_type.c b/c/realize_c_type.c
--- a/c/realize_c_type.c
+++ b/c/realize_c_type.c
@@ -650,7 +650,6 @@
_cffi_opcode_t opcodes[], int index)
{
PyObject *x;
- CTypeDescrObject *ct;
_cffi_opcode_t op = opcodes[index];
if ((((uintptr_t)op) & 1) == 0) {
diff --git a/testing/cffi0/test_ffi_backend.py
b/testing/cffi0/test_ffi_backend.py
--- a/testing/cffi0/test_ffi_backend.py
+++ b/testing/cffi0/test_ffi_backend.py
@@ -466,12 +466,12 @@
def test_introspect_order(self):
ffi = FFI()
- ffi.cdef("union aaa { int a; }; typedef struct ccc { int a; } b;")
- ffi.cdef("union g { int a; }; typedef struct cc { int a; } bbb;")
- ffi.cdef("union aa { int a; }; typedef struct a { int a; } bb;")
- assert ffi.list_types() == (['b', 'bb', 'bbb'],
- ['a', 'cc', 'ccc'],
- ['aa', 'aaa', 'g'])
+ ffi.cdef("union CFFIaaa { int a; }; typedef struct CFFIccc { int a; }
CFFIb;")
+ ffi.cdef("union CFFIg { int a; }; typedef struct CFFIcc { int a; }
CFFIbbb;")
+ ffi.cdef("union CFFIaa { int a; }; typedef struct CFFIa { int a; }
CFFIbb;")
+ assert ffi.list_types() == (['CFFIb', 'CFFIbb', 'CFFIbbb'],
+ ['CFFIa', 'CFFIcc', 'CFFIccc'],
+ ['CFFIaa', 'CFFIaaa', 'CFFIg'])
def test_unpack(self):
ffi = FFI()
diff --git a/testing/cffi1/test_recompiler.py b/testing/cffi1/test_recompiler.py
--- a/testing/cffi1/test_recompiler.py
+++ b/testing/cffi1/test_recompiler.py
@@ -1897,14 +1897,14 @@
def test_introspect_order():
ffi = FFI()
- ffi.cdef("union aaa { int a; }; typedef struct ccc { int a; } b;")
- ffi.cdef("union g { int a; }; typedef struct cc { int a; } bbb;")
- ffi.cdef("union aa { int a; }; typedef struct a { int a; } bb;")
+ ffi.cdef("union CFFIaaa { int a; }; typedef struct CFFIccc { int a; }
CFFIb;")
+ ffi.cdef("union CFFIg { int a; }; typedef struct CFFIcc { int a; }
CFFIbbb;")
+ ffi.cdef("union CFFIaa { int a; }; typedef struct CFFIa { int a; }
CFFIbb;")
verify(ffi, "test_introspect_order", """
- union aaa { int a; }; typedef struct ccc { int a; } b;
- union g { int a; }; typedef struct cc { int a; } bbb;
- union aa { int a; }; typedef struct a { int a; } bb;
+ union CFFIaaa { int a; }; typedef struct CFFIccc { int a; } CFFIb;
+ union CFFIg { int a; }; typedef struct CFFIcc { int a; } CFFIbbb;
+ union CFFIaa { int a; }; typedef struct CFFIa { int a; } CFFIbb;
""")
- assert ffi.list_types() == (['b', 'bb', 'bbb'],
- ['a', 'cc', 'ccc'],
- ['aa', 'aaa', 'g'])
+ assert ffi.list_types() == (['CFFIb', 'CFFIbb', 'CFFIbbb'],
+ ['CFFIa', 'CFFIcc', 'CFFIccc'],
+ ['CFFIaa', 'CFFIaaa', 'CFFIg'])
diff --git a/testing/cffi1/test_zdist.py b/testing/cffi1/test_zdist.py
--- a/testing/cffi1/test_zdist.py
+++ b/testing/cffi1/test_zdist.py
@@ -279,6 +279,14 @@
pass
with open("setup.py", "w") as f:
f.write("""if 1:
+ # https://bugs.python.org/issue23246
+ import sys
+ if sys.platform == 'win32':
+ try:
+ import setuptools
+ except ImportError:
+ pass
+
import cffi
ffi = cffi.FFI()
ffi.set_source("pack1.mymod", "/*code would be here*/")
diff --git a/testing/embedding/test_basic.py b/testing/embedding/test_basic.py
--- a/testing/embedding/test_basic.py
+++ b/testing/embedding/test_basic.py
@@ -79,8 +79,21 @@
# find a solution to that: we could hack sys.path inside the
# script run here, but we can't hack it in the same way in
# execute().
- output = self._run([sys.executable,
- os.path.join(local_dir, filename)])
+ pathname = os.path.join(path, filename)
+ with open(pathname, 'w') as g:
+ g.write('''
+# https://bugs.python.org/issue23246
+import sys
+if sys.platform == 'win32':
+ try:
+ import setuptools
+ except ImportError:
+ pass
+''')
+ with open(os.path.join(local_dir, filename), 'r') as f:
+ g.write(f.read())
+
+ output = self._run([sys.executable, pathname])
match = re.compile(r"\bFILENAME: (.+)").search(output)
assert match
dynamic_lib_name = match.group(1)
diff --git a/testing/udir.py b/testing/udir.py
--- a/testing/udir.py
+++ b/testing/udir.py
@@ -1,3 +1,13 @@
import py
+import sys
udir = py.path.local.make_numbered_dir(prefix = 'ffi-')
+
+
+# Windows-only workaround for some configurations: see
+# https://bugs.python.org/issue23246 (Python 2.7.9)
+if sys.platform == 'win32':
+ try:
+ import setuptools
+ except ImportError:
+ pass
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit