[pypy-commit] cffi sirtom67/float_complex: merge in default again. All tests pass in 2.7 on linux.
Author: Tom Krauss <thomas.p.kra...@gmail.com> Branch: sirtom67/float_complex Changeset: r2924:67fe455916a4 Date: 2017-04-02 15:39 -0500 http://bitbucket.org/cffi/cffi/changeset/67fe455916a4/ Log:merge in default again. All tests pass in 2.7 on linux. diff --git a/c/misc_thread_common.h b/c/misc_thread_common.h --- a/c/misc_thread_common.h +++ b/c/misc_thread_common.h @@ -29,12 +29,7 @@ struct cffi_tls_s *tls = (struct cffi_tls_s *)p; if (tls->local_thread_state != NULL) { -/* We need to re-acquire the GIL temporarily to free the - thread state. I hope it is not a problem to do it in - a thread-local destructor. -*/ -PyEval_RestoreThread(tls->local_thread_state); -PyThreadState_DeleteCurrent(); +PyThreadState_Delete(tls->local_thread_state); } free(tls); } ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] cffi sirtom67/float_complex: merge default into sirtom67/float_complex.
Author: Tom Krauss <thomas.p.kra...@gmail.com> Branch: sirtom67/float_complex Changeset: r2922:ce482ab27242 Date: 2017-03-27 08:32 -0500 http://bitbucket.org/cffi/cffi/changeset/ce482ab27242/ Log:merge default into sirtom67/float_complex. diff --git a/cffi/recompiler.py b/cffi/recompiler.py --- a/cffi/recompiler.py +++ b/cffi/recompiler.py @@ -1180,7 +1180,7 @@ size_of_result = '(int)sizeof(%s)' % ( tp.result.get_c_name('', context),) prnt('static struct _cffi_externpy_s _cffi_externpy__%s =' % name) -prnt(' { "%s", %s };' % (name, size_of_result)) +prnt(' { "%s.%s", %s };' % (self.module_name, name, size_of_result)) prnt() # arguments = [] diff --git a/doc/source/installation.rst b/doc/source/installation.rst --- a/doc/source/installation.rst +++ b/doc/source/installation.rst @@ -53,11 +53,11 @@ * http://pypi.python.org/packages/source/c/cffi/cffi-1.10.0.tar.gz - - MD5: ... + - MD5: 2b5fa41182ed0edaf929a789e602a070 - - SHA: ... + - SHA: 8484aba03d1e64367d3110c0e36c1ed052b43f12 - - SHA256: ... + - SHA256: b3b02911eb1f6ada203b0763ba924234629b51586f72a21faacc638269f4ced5 * Or grab the most current version from the `Bitbucket page`_: ``hg clone https://bitbucket.org/cffi/cffi`` diff --git a/doc/source/whatsnew.rst b/doc/source/whatsnew.rst --- a/doc/source/whatsnew.rst +++ b/doc/source/whatsnew.rst @@ -9,18 +9,16 @@ * Issue #295: use calloc() directly instead of PyObject_Malloc()+memset() to handle ffi.new() with a default allocator. Speeds up ``ffi.new(large-array)`` where most of the time - you never touch most of the array. (But avoid doing that too often: - on 32-bit PyPy it will quickly exhaust the address space. If possible, - use instead explicit calls to calloc() and free().) + you never touch most of the array. * Some OS/X build fixes ("only with Xcode but without CLT"). * Improve a couple of error messages: when getting mismatched versions of cffi and its backend; and when calling functions which cannot be called with libffi because an argument is a struct that is "too - complicated" (not a struct *pointer*). + complicated" (and not a struct *pointer*, which always works). -* Add support for some obscure compilers (non-msvc, non-gcc, non-icc, +* Add support for some unusual compilers (non-msvc, non-gcc, non-icc, non-clang) * Implemented the remaining cases for ``ffi.from_buffer``. Now all @@ -33,15 +31,15 @@ * The C type ``_Bool`` or ``bool`` now converts to a Python boolean when reading, instead of the content of the byte as an integer. The - change here is mostly what occurs if the byte happens to contain a + potential incompatibility here is what occurs if the byte contains a value different from 0 and 1. Previously, it would just return it; with this change, CFFI raises an exception in this case. But this case means "undefined behavior" in C; if you really have to interface - with a library relying on this, don't use ``_Bool`` in the CFFI side. + with a library relying on this, don't use ``bool`` in the CFFI side. Also, it is still valid to use a byte string as initializer for a - ``_Bool[]``, but now it must only contain ``\x00`` or ``\x01``. As an - aside, ``ffi.string()`` no longer works on ``_Bool[]`` (but it never - made much sense, as this function stops on the first zero). + ``bool[]``, but now it must only contain ``\x00`` or ``\x01``. As an + aside, ``ffi.string()`` no longer works on ``bool[]`` (but it never + made much sense, as this function stops at the first zero). * ``ffi.buffer`` is now the name of cffi's buffer type, and ``ffi.buffer()`` works like before but is the constructor of that type. @@ -61,6 +59,11 @@ "memory pressure", causing the GC to run too infrequently if you call ``ffi.new()`` very often and/or with large arrays. Fixed in PyPy 5.7. +* Support in ``ffi.cdef()`` for numeric expressions with ``+`` or + ``-``. Assumes that there is no overflow; it should be fixed first + before we add more general support for arbitrary arithmetic on + constants. + v1.9 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 @@ -1552,7 +1552,8 @@ res = lib.bar(4, 5) assert res == 0 assert f.getvalue() == ( -b"extern \"Python\": function bar() called, but no code was attached " +b"extern \"Python\": function _CFFI_test_extern_python_1.bar() called, " +b"but no code was attached " b"to it yet with @ffi.def_extern(). Returning 0.\n") @ffi.def_extern("bar") ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] cffi sirtom67/float_complex: tests pass. Had to #include - might want to make that optional
Author: Tom Krauss <thomas.p.kra...@gmail.com> Branch: sirtom67/float_complex Changeset: r2921:8e77b23da941 Date: 2017-03-27 08:27 -0500 http://bitbucket.org/cffi/cffi/changeset/8e77b23da941/ Log:tests pass. Had to #include - might want to make that optional diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c --- a/c/_cffi_backend.c +++ b/c/_cffi_backend.c @@ -2964,9 +2964,20 @@ if (cd->c_type->ct_flags & CT_PRIMITIVE_COMPLEX) { Py_complex value = read_raw_complex_data(cd->c_data, cd->c_type->ct_size); PyObject *op = PyComplex_FromCComplex(value); -PyComplexObject *opc = (PyComplexObject *) op; return op; } +// floats can also be converted to complex +if (cd->c_type->ct_flags & CT_PRIMITIVE_FLOAT) { +Py_complex value; +if (!(cd->c_type->ct_flags & CT_IS_LONGDOUBLE)) { +value.real = read_raw_float_data(cd->c_data, cd->c_type->ct_size); +} +else { +value.real = (double)read_raw_longdouble_data(cd->c_data); +} +value.imag = 0.0; +return PyComplex_FromCComplex(value); +} PyErr_Format(PyExc_TypeError, "complex() not supported on cdata '%s'", cd->c_type->ct_name); return NULL; diff --git a/c/parse_c_type.c b/c/parse_c_type.c --- a/c/parse_c_type.c +++ b/c/parse_c_type.c @@ -797,7 +797,6 @@ int parse_c_type_from(struct _cffi_parse_info_s *info, size_t *output_index, const char *input) { -printf("parse_c_type_from\n"); int result; token_t token; diff --git a/cffi/_cffi_include.h b/cffi/_cffi_include.h --- a/cffi/_cffi_include.h +++ b/cffi/_cffi_include.h @@ -16,6 +16,7 @@ #endif #include +#include #ifdef __cplusplus extern "C" { #endif @@ -99,6 +100,29 @@ #define _cffi_to_c_double PyFloat_AsDouble #define _cffi_to_c_float PyFloat_AsDouble +#define _cffi_from_c_float__Complex(x) PyComplex_FromDoubles(crealf(x), cimagf(x)) +#define _cffi_from_c_double__Complex(x) PyComplex_FromDoubles(creal(x), cimag(x)) + +/* inefficient - converts twice! */ +#define _cffi_to_c_float__Complex(op)\ + ( ((float)(PyComplex_AsCComplex(op).real)) + \ +I*((float)(PyComplex_AsCComplex(op).imag)) ) +/* not safe! +//#define _cffi_to_c_float__Complex(op) \ +//( ((float)((PyComplexObject *)(op))->cval.real) +\ +// I*((float)((PyComplexObject *)(op))->cval.imag) ) +*/ + +/* inefficient - converts twice! */ +#define _cffi_to_c_double__Complex(op) \ + ( (PyComplex_AsCComplex(op).real) +\ +I*(PyComplex_AsCComplex(op).imag) ) +/* not safe! +//#define _cffi_to_c_double__Complex(op) \ +//( (((PyComplexObject *)(op))->cval.real) + \ +// I*(((PyComplexObject *)(op))->cval.imag) ) +*/ + #define _cffi_from_c_int(x, type)\ (((type)-1) > 0 ? /* unsigned */ \ (sizeof(type) < sizeof(long) ? \ @@ -110,9 +134,6 @@ PyInt_FromLong((long)x) :\ PyLong_FromLongLong((long long)x))) -#define _cffi_from_c_float__Complex(x) PyComplex_FromDoubles(crealf(x), cimagf(x)) -#define _cffi_from_c_double__Complex(x) PyComplex_FromDoubles(creal(x), cimag(x)) - #define _cffi_to_c_int(o, type) \ ((type)( \ sizeof(type) == 1 ? (((type)-1) > 0 ? (type)_cffi_to_c_u8(o)\ diff --git a/cffi/vengine_cpy.py b/cffi/vengine_cpy.py --- a/cffi/vengine_cpy.py +++ b/cffi/vengine_cpy.py @@ -806,6 +806,7 @@ cffimod_header = r''' #include #include +#include /* this block of #ifs should be kept exactly identical between c/_cffi_backend.c, cffi/vengine_cpy.py, cffi/vengine_gen.py */ @@ -873,6 +874,29 @@ #define _cffi_to_c_double PyFloat_AsDouble #define _cffi_to_c_float PyFloat_AsDouble +#define _cffi_from_c_float__Complex(x) PyComplex_FromDoubles(crealf(x), cimagf(x)) +#define _cffi_from_c_double__Complex(x) PyComplex_FromDoubles(creal(x), cimag(x)) + +/* inefficient - converts twice! */ +#define _cffi_to_c_float__Complex(op)\ +( ((float)(PyComplex_AsCComplex(op).real)) + \ + I*((float)(PyComplex_AsCComplex(op).imag)) ) +/* not safe! +//#define _cffi_to_c_float__Complex(op) \ +//( ((float)((PyComplexObject *)(op))->cval.real) +\ +// I*((float)((PyComplexObject *)(op))->cval.imag) ) +*/ + +/* inefficient - conv
[pypy-commit] cffi sirtom67/float_complex: merge default in again.
Author: Tom Krauss <thomas.p.kra...@gmail.com> Branch: sirtom67/float_complex Changeset: r2920:8e884c0520fe Date: 2017-03-19 18:33 -0500 http://bitbucket.org/cffi/cffi/changeset/8e884c0520fe/ Log:merge default in again. diff --git a/cffi/cparser.py b/cffi/cparser.py --- a/cffi/cparser.py +++ b/cffi/cparser.py @@ -803,6 +803,16 @@ "the actual array length in this context" % exprnode.coord.line) # +if (isinstance(exprnode, pycparser.c_ast.BinaryOp) and +exprnode.op == '+'): +return (self._parse_constant(exprnode.left) + +self._parse_constant(exprnode.right)) +# +if (isinstance(exprnode, pycparser.c_ast.BinaryOp) and +exprnode.op == '-'): +return (self._parse_constant(exprnode.left) - +self._parse_constant(exprnode.right)) +# raise FFIError(":%d: unsupported expression: expected a " "simple numeric constant" % exprnode.coord.line) diff --git a/testing/cffi0/backend_tests.py b/testing/cffi0/backend_tests.py --- a/testing/cffi0/backend_tests.py +++ b/testing/cffi0/backend_tests.py @@ -1230,7 +1230,8 @@ def test_ffi_buffer_comparisons(self): ffi = FFI(backend=self.Backend()) ba = bytearray(range(100, 110)) -assert ba == memoryview(ba)# justification for the following +if sys.version_info >= (2, 7): +assert ba == memoryview(ba)# justification for the following a = ffi.new("uint8_t[]", list(ba)) c = ffi.new("uint8_t[]", [99] + list(ba)) try: diff --git a/testing/cffi0/test_parsing.py b/testing/cffi0/test_parsing.py --- a/testing/cffi0/test_parsing.py +++ b/testing/cffi0/test_parsing.py @@ -386,13 +386,14 @@ def test_enum(): ffi = FFI() ffi.cdef(""" -enum Enum { POS = +1, TWO = 2, NIL = 0, NEG = -1}; +enum Enum { POS = +1, TWO = 2, NIL = 0, NEG = -1, OP = (POS+TWO)-1}; """) C = ffi.dlopen(None) assert C.POS == 1 assert C.TWO == 2 assert C.NIL == 0 assert C.NEG == -1 +assert C.OP == 2 def test_stdcall(): 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 @@ -2063,7 +2063,7 @@ struct foo s = { 40, 200 }; return s; } -struct foo g(int a, ...) { } +struct foo g(int a, ...) { return f(); } """) assert lib.f().x == 200 e = py.test.raises(NotImplementedError, lib.g, 0) @@ -2092,7 +2092,7 @@ s.b = 200; return s; } -struct foo g(int a, ...) { } +struct foo g(int a, ...) { return f(); } """) assert lib.f().b == 200 e = py.test.raises(NotImplementedError, lib.g, 0) @@ -2118,7 +2118,7 @@ struct foo s = { 11 }; return s; } -struct foo g(int a, ...) { } +struct foo g(int a, ...) { return f(); } """) assert lib.f().x == 11 e = py.test.raises(NotImplementedError, lib.g, 0) @@ -2130,6 +2130,8 @@ "set_source() and not taking a final '...' argument)") def test_call_with_zero_length_field(): +if sys.platform == 'win32': +py.test.skip("zero-length field not supported by MSVC") ffi = FFI() ffi.cdef(""" struct foo { int a; int x[0]; }; @@ -2142,7 +2144,7 @@ struct foo s = { 42 }; return s; } -struct foo g(int a, ...) { } +struct foo g(int a, ...) { return f(); } """) assert lib.f().a == 42 e = py.test.raises(NotImplementedError, lib.g, 0) @@ -2166,7 +2168,7 @@ union foo s = { 42 }; return s; } -union foo g(int a, ...) { } +union foo g(int a, ...) { return f(); } """) assert lib.f().a == 42 e = py.test.raises(NotImplementedError, lib.g, 0) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] cffi sirtom67/float_complex: fix test (now apparently cast(p, -1.1j) == cast(p, -1.1j))
Author: Tom Krauss <thomas.p.kra...@gmail.com> Branch: sirtom67/float_complex Changeset: r2906:38562ef9d8f7 Date: 2017-03-12 20:08 -0500 http://bitbucket.org/cffi/cffi/changeset/38562ef9d8f7/ Log:fix test (now apparently cast(p, -1.1j) == cast(p, -1.1j)) Remove a printf. diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c --- a/c/_cffi_backend.c +++ b/c/_cffi_backend.c @@ -2965,7 +2965,6 @@ Py_complex value = read_raw_complex_data(cd->c_data, cd->c_type->ct_size); PyObject *op = PyComplex_FromCComplex(value); PyComplexObject *opc = (PyComplexObject *) op; -printf("%f %f\n",opc->cval.real,opc->cval.imag); return op; } PyErr_Format(PyExc_TypeError, "complex() not supported on cdata '%s'", diff --git a/c/test_c.py b/c/test_c.py --- a/c/test_c.py +++ b/c/test_c.py @@ -206,7 +206,7 @@ assert complex(cast(p, 1E200+3j)) == INF+3j # limited range assert complex(cast(p, complex(3,1E200))) == complex(3,INF) # limited range -assert cast(p, -1.1j) != cast(p, -1.1j) +assert cast(p, -1.1j) == cast(p, -1.1j) assert repr(complex(cast(p, -0.0)).real) == '-0.0' #assert repr(complex(cast(p, -0j))) == '-0j' # http://bugs.python.org/issue29602 assert complex(cast(p, b'\x09')) == 9.0 ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] cffi sirtom67/float_complex: Merge default in.
Author: Tom Krauss <thomas.p.kra...@gmail.com> Branch: sirtom67/float_complex Changeset: r2905:ab7c2855f10f Date: 2017-03-12 19:43 -0500 http://bitbucket.org/cffi/cffi/changeset/ab7c2855f10f/ Log:Merge default in. diff too long, truncating to 2000 out of 2939 lines diff --git a/README.md b/README.md --- a/README.md +++ b/README.md @@ -15,6 +15,16 @@ [Mailing list](https://groups.google.com/forum/#!forum/python-cffi) -To run tests under CPython, run: +Testing/development tips + -python setup.py build_ext -i +To run tests under CPython, run:: + +pip install pytest # if you don't have py.test already +pip install pycparser +python setup.py build_ext -f -i +py.test c/ testing/ + +If you run in another directory (either the tests or another program), +you should use the environment variable ``PYTHONPATH=/path`` to point +to the location that contains the ``_cffi_backend.so`` just compiled. diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c --- a/c/_cffi_backend.c +++ b/c/_cffi_backend.c @@ -2,7 +2,7 @@ #include #include "structmember.h" -#define CFFI_VERSION "1.9.2" +#define CFFI_VERSION "1.10.0" #ifdef MS_WIN32 #include @@ -460,6 +460,8 @@ static PyObject * get_field_name(CTypeDescrObject *ct, CFieldObject *cf); /* forward */ +/* returns 0 if the struct ctype is opaque, 1 if it is not, or -1 if + an exception occurs */ #define force_lazy_struct(ct) \ ((ct)->ct_stuff != NULL ? 1 : do_realize_lazy_struct(ct)) @@ -1014,8 +1016,23 @@ /*READ(data, ct->ct_size)*/ value = read_raw_unsigned_data(data, ct->ct_size); -if (ct->ct_flags & CT_PRIMITIVE_FITS_LONG) +if (ct->ct_flags & CT_PRIMITIVE_FITS_LONG) { +if (ct->ct_flags & CT_IS_BOOL) { +PyObject *x; +switch ((int)value) { +case 0: x = Py_False; break; +case 1: x = Py_True; break; +default: +PyErr_Format(PyExc_ValueError, + "got a _Bool of value %d, expected 0 or 1", + (int)value); +return NULL; +} +Py_INCREF(x); +return x; +} return PyInt_FromLong((long)value); +} else return PyLong_FromUnsignedLongLong(value); } @@ -1256,6 +1273,20 @@ } static int +must_be_array_of_zero_or_one(const char *data, Py_ssize_t n) +{ +Py_ssize_t i; +for (i = 0; i < n; i++) { +if (((unsigned char)data[i]) > 1) { +PyErr_SetString(PyExc_ValueError, +"an array of _Bool can only contain \\x00 or \\x01"); +return -1; +} +} +return 0; +} + +static int convert_array_from_object(char *data, CTypeDescrObject *ct, PyObject *init) { /* used by convert_from_object(), and also to decode lists/tuples/unicodes @@ -1302,6 +1333,9 @@ if (n != ct->ct_length) n++; srcdata = PyBytes_AS_STRING(init); +if (ctitem->ct_flags & CT_IS_BOOL) +if (must_be_array_of_zero_or_one(srcdata, n) < 0) +return -1; memcpy(data, srcdata, n); return 0; } @@ -1472,12 +1506,15 @@ unsigned PY_LONG_LONG value = _my_PyLong_AsUnsignedLongLong(init, 1); if (value == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred()) return -1; -if (ct->ct_flags & CT_IS_BOOL) -if (value & ~1) /* value != 0 && value != 1 */ +if (ct->ct_flags & CT_IS_BOOL) { +if (value > 1ULL) /* value != 0 && value != 1 */ goto overflow; -write_raw_integer_data(buf, value, ct->ct_size); -if (value != read_raw_unsigned_data(buf, ct->ct_size)) -goto overflow; +} +else { +write_raw_integer_data(buf, value, ct->ct_size); +if (value != read_raw_unsigned_data(buf, ct->ct_size)) +goto overflow; +} write_raw_integer_data(data, value, ct->ct_size); return 0; } @@ -2047,47 +2084,97 @@ static PyObject *cdata_richcompare(PyObject *v, PyObject *w, int op) { -int res; +int v_is_ptr, w_is_ptr; PyObject *pyres; -char *v_cdata, *w_cdata; assert(CData_Check(v)); -if (!CData_Check(w)) { + +/* Comparisons involving a primitive cdata work differently than + * comparisons involving a struct/array/pointer. + * + * If v or w is a struct/array/pointer, then the other must be too + * (otherwise we return NotImplemented and leave the case to + * Python). If both are, then we compare the addresses. +
[pypy-commit] cffi sirtom67/float_complex: Support for "double _Complex". Skip the test_c tests for now
Author: Tom Krauss <thomas.p.kra...@gmail.com> Branch: sirtom67/float_complex Changeset: r2904:2e64e82fb960 Date: 2017-03-12 19:26 -0500 http://bitbucket.org/cffi/cffi/changeset/2e64e82fb960/ Log:Support for "double _Complex". Skip the test_c tests for now since libffi returning non-sense. Add complex tests in testing/cffi1/test_recompiler.py diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c --- a/c/_cffi_backend.c +++ b/c/_cffi_backend.c @@ -2035,7 +2035,8 @@ } return PyFloat_FromDouble(value); } -if (cd->c_type->ct_flags & CT_PRIMITIVE_COMPLEX) { +if ((cd->c_type->ct_flags & CT_PRIMITIVE_COMPLEX) && +(cd->c_type->ct_size<16)) { double value = read_raw_float_data(cd->c_data, cd->c_type->ct_size); return PyComplex_FromDoubles(value, 0.0); } @@ -4104,6 +4105,16 @@ else goto bad_ffi_type; } +else if (ptypes->flags & CT_PRIMITIVE_COMPLEX) { +// as of March 2017, still no libffi support for complex +// but it fails silently. +if (strcmp(ptypes->name, "float _Complex") == 0) +ffitype = _type_complex_float; +else if (strcmp(ptypes->name, "double _Complex") == 0) +ffitype = _type_complex_double; +else +goto bad_ffi_type; +} else { switch (ptypes->size) { case 1: ffitype = _type_uint8; break; @@ -6594,6 +6605,10 @@ { return a + I*2.0*b; } +static double _Complex _testfunc25(double a, double b) +{ +return a + I*2.0*b; +} static PyObject *b__testfunc(PyObject *self, PyObject *args) { @@ -6628,6 +6643,7 @@ case 22: f = &_testfunc22; break; case 23: f = &_testfunc23; break; case 24: f = &_testfunc24; break; +case 25: f = &_testfunc25; break; default: PyErr_SetNone(PyExc_ValueError); return NULL; diff --git a/c/test_c.py b/c/test_c.py --- a/c/test_c.py +++ b/c/test_c.py @@ -184,7 +184,7 @@ def test_complex_types(): INF = 1E200 * 1E200 -for name in ["float"]: #, "double"]: +for name in ["float", "double"]: p = new_primitive_type(name + " _Complex") assert bool(cast(p, 0)) assert bool(cast(p, INF)) @@ -1085,6 +1085,7 @@ assert f(3, cast(BSChar, -3), cast(BUChar, 200), cast(BSShort, -5)) == 192 def test_call_function_24(): +py.test.skip("libffi returning nonsense silently") BFloat = new_primitive_type("float") BFloatComplex = new_primitive_type("float _Complex") BFunc3 = new_function_type((BFloat, BFloat), BFloatComplex, False) @@ -1094,6 +1095,18 @@ assert result.real == 1.25 # exact assert (result.imag != 2*5.1) and (abs(result.imag - 2*5.1) < 1e-5) # inexact +def test_call_function_25(): +py.test.skip("libffi returning nonsense silently") +BDouble = new_primitive_type("double") +BDoubleComplex = new_primitive_type("double _Complex") +BFunc3 = new_function_type((BDouble, BDouble), BDoubleComplex, False) +f = cast(BFunc3, _testfunc(25)) +result = f(1.25, 5.1) +assert type(result) == complex +assert result.real == 1.25 # exact +assert (result.imag != 2*5.1) and (abs(result.imag - 2*5.1) < 1e-10) # inexact + + def test_cannot_call_with_a_autocompleted_struct(): BSChar = new_primitive_type("signed char") BDouble = new_primitive_type("double") diff --git a/cffi/_cffi_include.h b/cffi/_cffi_include.h --- a/cffi/_cffi_include.h +++ b/cffi/_cffi_include.h @@ -110,6 +110,9 @@ PyInt_FromLong((long)x) :\ PyLong_FromLongLong((long long)x))) +#define _cffi_from_c_float__Complex(x) PyComplex_FromDoubles(crealf(x), cimagf(x)) +#define _cffi_from_c_double__Complex(x) PyComplex_FromDoubles(creal(x), cimag(x)) + #define _cffi_to_c_int(o, type) \ ((type)( \ sizeof(type) == 1 ? (((type)-1) > 0 ? (type)_cffi_to_c_u8(o)\ 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 @@ -1994,6 +1994,30 @@ """) assert lib.f1(52).a == 52 +def test_function_returns_float_complex(): +ffi = FFI() +ffi.cdef("float _Complex f1(float a, float b);"); +lib = verify(ffi, "test_function_returns_float_complex", """ +#include +static float _Complex f1 (float a, float b) { return a + I*2.0*b; } +""") +result = lib.f1(1.25, 5.1) +assert type(result) == complex +assert result.real == 1.25 # exac
[pypy-commit] cffi sirtom67/float_complex: in test_c.py, add a test_call_function24 which
Author: Tom Krauss <thomas.p.kra...@gmail.com> Branch: sirtom67/float_complex Changeset: r2893:7b2c8b6072c2 Date: 2017-02-26 19:17 -0600 http://bitbucket.org/cffi/cffi/changeset/7b2c8b6072c2/ Log:in test_c.py, add a test_call_function24 which calls a C function that returns a "float _Complex" diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c --- a/c/_cffi_backend.c +++ b/c/_cffi_backend.c @@ -62,6 +62,8 @@ #include "malloc_closure.h" +#include + #if PY_MAJOR_VERSION >= 3 # define STR_OR_BYTES "bytes" # define PyText_Type PyUnicode_Type @@ -6588,6 +6590,10 @@ return 1000 * p[0]; return -42; } +static float _Complex _testfunc24(float a, float b) +{ +return a + I*2.0*b; +} static PyObject *b__testfunc(PyObject *self, PyObject *args) { @@ -6621,6 +6627,7 @@ case 21: f = &_testfunc21; break; case 22: f = &_testfunc22; break; case 23: f = &_testfunc23; break; +case 24: f = &_testfunc24; break; default: PyErr_SetNone(PyExc_ValueError); return NULL; diff --git a/c/test_c.py b/c/test_c.py --- a/c/test_c.py +++ b/c/test_c.py @@ -1084,6 +1084,16 @@ BSShort = new_primitive_type("short") assert f(3, cast(BSChar, -3), cast(BUChar, 200), cast(BSShort, -5)) == 192 +def test_call_function_24(): +BFloat = new_primitive_type("float") +BFloatComplex = new_primitive_type("float _Complex") +BFunc3 = new_function_type((BFloat, BFloat), BFloatComplex, False) +f = cast(BFunc3, _testfunc(24)) +result = f(1.25, 5.1) +assert type(result) == complex +assert result.real == 1.25 # exact +assert (result.imag != 2*5.1) and (abs(result.imag - 2*5.1) < 1e-5) # inexact + def test_cannot_call_with_a_autocompleted_struct(): BSChar = new_primitive_type("signed char") BDouble = new_primitive_type("double") ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] cffi sirtom67/float_complex: "c" tests pass!
Author: Tom Krauss <thomas.p.kra...@gmail.com> Branch: sirtom67/float_complex Changeset: r2891:3ce9e47d35f0 Date: 2017-02-19 19:51 -0600 http://bitbucket.org/cffi/cffi/changeset/3ce9e47d35f0/ Log:"c" tests pass! diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c --- a/c/_cffi_backend.c +++ b/c/_cffi_backend.c @@ -3536,6 +3536,36 @@ return cd; } +static void check_bytes_for_float_compatible( +PyObject *io, +double * value, +int * got_value_indicator, +int * cannot_cast_indicator) +{ +*got_value_indicator = 0; +*cannot_cast_indicator = 0; +if (PyBytes_Check(io)) { +if (PyBytes_GET_SIZE(io) != 1) { +Py_DECREF(io); +*cannot_cast_indicator = 1; +} +*value = (unsigned char)PyBytes_AS_STRING(io)[0]; +*got_value_indicator = 1; +} +#if HAVE_WCHAR_H +else if (PyUnicode_Check(io)) { +wchar_t ordinal; +if (_my_PyUnicode_AsSingleWideChar(io, ) < 0) { +Py_DECREF(io); +*cannot_cast_indicator = 1; +} +*value = (long)ordinal; +*got_value_indicator = 1; +} +#endif + +} + static PyObject *do_cast(CTypeDescrObject *ct, PyObject *ob) { CDataObject *cd; @@ -3592,23 +3622,16 @@ Py_INCREF(io); } -if (PyBytes_Check(io)) { -if (PyBytes_GET_SIZE(io) != 1) { -Py_DECREF(io); -goto cannot_cast; -} -value = (unsigned char)PyBytes_AS_STRING(io)[0]; -} -#if HAVE_WCHAR_H -else if (PyUnicode_Check(io)) { -wchar_t ordinal; -if (_my_PyUnicode_AsSingleWideChar(io, ) < 0) { -Py_DECREF(io); -goto cannot_cast; -} -value = (long)ordinal; -} -#endif +int got_value_indicator; +int cannot_cast_indicator; +check_bytes_for_float_compatible(io, , +_value_indicator, _cast_indicator); +if (cannot_cast_indicator) { +goto cannot_cast; +} +if (got_value_indicator) { +// got it from string +} else if ((ct->ct_flags & CT_IS_LONGDOUBLE) && CData_Check(io) && (((CDataObject *)io)->c_type->ct_flags & CT_IS_LONGDOUBLE)) { @@ -3658,11 +3681,23 @@ Py_INCREF(io); } -value = PyComplex_AsCComplex(io); +int got_value_indicator; +int cannot_cast_indicator; +check_bytes_for_float_compatible(io, &(value.real), +_value_indicator, _cast_indicator); +if (cannot_cast_indicator) { +goto cannot_cast; +} +if (got_value_indicator) { +// got it from string +value.imag = 0.0; +} else { +value = PyComplex_AsCComplex(io); +} Py_DECREF(io); -if (value.real == -1.0 && value.imag == 0.0 && PyErr_Occurred()) +if (value.real == -1.0 && value.imag == 0.0 && PyErr_Occurred()) { return NULL; - +} cd = _new_casted_primitive(ct); if (cd != NULL) { write_raw_complex_data(cd->c_data, value, ct->ct_size); diff --git a/c/test_c.py b/c/test_c.py --- a/c/test_c.py +++ b/c/test_c.py @@ -206,8 +206,9 @@ assert cast(p, -1.1j) != cast(p, -1.1j) assert repr(complex(cast(p, -0.0)).real) == '-0.0' -assert repr(complex(cast(p, -0j))) == '-0j' -assert complex(cast(p, '\x09')) == 9.0 +#assert repr(complex(cast(p, -0j))) == '-0j' # http://bugs.python.org/issue29602 +assert complex(cast(p, b'\x09')) == 9.0 +assert complex(cast(p, u+'\x09')) == 9.0 assert complex(cast(p, True)) == 1.0 py.test.raises(TypeError, cast, p, None) # ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] cffi sirtom67/float_complex: all but two tests in c/test_c.py:test_complex_types() pass.
Author: Tom Krauss <thomas.p.kra...@gmail.com> Branch: sirtom67/float_complex Changeset: r2889:82ad2ada5811 Date: 2017-02-12 19:16 -0600 http://bitbucket.org/cffi/cffi/changeset/82ad2ada5811/ Log:all but two tests in c/test_c.py:test_complex_types() pass. 1) assert repr(complex(cast(p, -0j))) == '-0j' 2) assert complex(cast(p, '\x09')) == 9.0 I haven't looked at 2) yet but 1) is failing due to python's behavior: the answer should be -0j, it is returning 0j instead. The issue is in complexobject.c: complex_new, at the end where it does this: if (cr_is_complex) { ci.real += cr.imag; } return complex_subtype_from_doubles(type, cr.real, ci.real); cr.imag is appropriately "-0" still, but after this statement, ci.real is just 0. The resulting returned object is just 0j, not -0j. diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c --- a/c/_cffi_backend.c +++ b/c/_cffi_backend.c @@ -2842,7 +2842,10 @@ if (cd->c_type->ct_flags & CT_PRIMITIVE_COMPLEX) { Py_complex value = read_raw_complex_data(cd->c_data, cd->c_type->ct_size); -return PyComplex_FromCComplex(value); +PyObject *op = PyComplex_FromCComplex(value); +PyComplexObject *opc = (PyComplexObject *) op; +printf("%f %f\n",opc->cval.real,opc->cval.imag); +return op; } PyErr_Format(PyExc_TypeError, "complex() not supported on cdata '%s'", cd->c_type->ct_name); diff --git a/c/test_c.py b/c/test_c.py --- a/c/test_c.py +++ b/c/test_c.py @@ -211,8 +211,8 @@ assert complex(cast(p, True)) == 1.0 py.test.raises(TypeError, cast, p, None) # -py.test.raises(cast, new_primitive_type(name), 1+2j) -py.test.raises(cast, new_primitive_type("int"), 1+2j) +py.test.raises(TypeError, cast, new_primitive_type(name), 1+2j) +py.test.raises(TypeError, cast, new_primitive_type("int"), 1+2j) def test_character_type(): p = new_primitive_type("char") ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] cffi sirtom67/float_complex: float complex progress. Added __complex__ method to cdata.
Author: Tom Krauss <thomas.p.kra...@gmail.com> Branch: sirtom67/float_complex Changeset: r2879:6dcf51c6003c Date: 2017-02-05 17:13 -0600 http://bitbucket.org/cffi/cffi/changeset/6dcf51c6003c/ Log:float complex progress. Added __complex__ method to cdata. Test currently failing at > assert repr(complex(cast(p, -0j))) == '-0j' E assert '0j' == '-0j' E - 0j E + -0j E ? + diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c --- a/c/_cffi_backend.c +++ b/c/_cffi_backend.c @@ -884,6 +884,26 @@ return 0; } +static Py_complex +read_raw_complex_data(char *target, int size) +{ +Py_complex r = {.real=0, .imag=0}; +if (size == 2*sizeof(float)) { +float real_part, imag_part; +memcpy(_part, target + 0, sizeof(float)); +memcpy(_part, target + sizeof(float), sizeof(float)); +r.real = real_part; +r.imag = imag_part; +return r; +} +if (size == 2*sizeof(double)) { +memcpy(&(r.real), target, 2*sizeof(double)); +return r; +} +Py_FatalError("read_raw_complex_data: bad float size"); +return r; +} + static void write_raw_float_data(char *target, double source, int size) { @@ -1011,6 +1031,10 @@ return (PyObject *)cd; } } +else if (ct->ct_flags & CT_PRIMITIVE_COMPLEX) { +Py_complex value = read_raw_complex_data(data, ct->ct_size); +return PyComplex_FromCComplex(value); +} else if (ct->ct_flags & CT_PRIMITIVE_CHAR) { /*READ(data, ct->ct_size)*/ if (ct->ct_size == sizeof(char)) @@ -2009,6 +2033,10 @@ } return PyFloat_FromDouble(value); } +if (cd->c_type->ct_flags & CT_PRIMITIVE_COMPLEX) { +double value = read_raw_float_data(cd->c_data, cd->c_type->ct_size); +return PyComplex_FromDoubles(value, 0.0); +} PyErr_Format(PyExc_TypeError, "float() not supported on cdata '%s'", cd->c_type->ct_name); return NULL; @@ -2808,6 +2836,19 @@ } } +static PyObject *cdata_complex(PyObject *cd_, PyObject *noarg) +{ +CDataObject *cd = (CDataObject *)cd_; + +if (cd->c_type->ct_flags & CT_PRIMITIVE_COMPLEX) { +Py_complex value = read_raw_complex_data(cd->c_data, cd->c_type->ct_size); +return PyComplex_FromCComplex(value); +} +PyErr_Format(PyExc_TypeError, "complex() not supported on cdata '%s'", + cd->c_type->ct_name); +return NULL; +} + static PyObject *cdata_iter(CDataObject *); static PyNumberMethods CData_as_number = { @@ -2857,8 +2898,9 @@ }; static PyMethodDef cdata_methods[] = { -{"__dir__", cdata_dir, METH_NOARGS}, -{NULL,NULL} /* sentinel */ +{"__dir__", cdata_dir, METH_NOARGS}, +{"__complex__", cdata_complex, METH_NOARGS}, +{NULL, NULL} /* sentinel */ }; static PyTypeObject CData_Type = { @@ -3599,7 +3641,6 @@ /* cast to a complex */ Py_complex value; PyObject *io; -printf("_cffi_backend.c do_cast ct->ct_size=%ld\n", ct->ct_size); if (CData_Check(ob)) { CDataObject *cdsrc = (CDataObject *)ob; @@ -3983,8 +4024,6 @@ int name_size; ffi_type *ffitype; -printf("hello\n"); - for (ptypes=types; ; ptypes++) { if (ptypes->name == NULL) { #ifndef HAVE_WCHAR_H 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 @@ -101,7 +101,6 @@ static PyObject *build_primitive_type(int num) { -fprintf(stderr, "fonum=%d\n",num); /* XXX too many translations between here and new_primitive_type() */ static const char *primitive_name[] = { NULL, diff --git a/c/test_c.py b/c/test_c.py --- a/c/test_c.py +++ b/c/test_c.py @@ -197,12 +197,12 @@ py.test.raises(TypeError, float, cast(p, -150)) assert complex(cast(p, 1.25)) == 1.25 assert complex(cast(p, 1.25j)) == 1.25j -assert float(cast(p, INF*1j)) == INF*1j -assert float(cast(p, -INF)) == -INF +assert complex(cast(p, complex(0,INF))) == complex(0,INF) +assert complex(cast(p, -INF)) == -INF if name == "float": assert complex(cast(p, 1.1j)) != 1.1j # rounding error assert complex(cast(p, 1E200+3j)) == INF+3j # limited range -assert complex(cast(p, 3+1E200j)) == 3+INF*1j # limited range +assert complex(cast(p, complex(3,1E200))) == complex(3,INF) # limited range assert cast(p, -1.1j) != cast(p, -1.1j) assert repr(complex(cast(p, -0.0)).real) == '-0.0' ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] cffi sirtom67/float_complex: unskip the complex test in c/test_c.py. It still doesn't pass but gets past a couple points
Author: Tom Krauss <thomas.p.kra...@gmail.com> Branch: sirtom67/float_complex Changeset: r2865:d3cb148ff6fa Date: 2017-01-22 19:36 -0600 http://bitbucket.org/cffi/cffi/changeset/d3cb148ff6fa/ Log:unskip the complex test in c/test_c.py. It still doesn't pass but gets past a couple points diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c --- a/c/_cffi_backend.c +++ b/c/_cffi_backend.c @@ -899,6 +899,25 @@ _write_raw_data(long double); } +#define _write_raw_complex_data(type) \ +do { \ +if (size == 2*sizeof(type)) { \ +type r = (type)source.real;\ +memcpy(target, , sizeof(type)); \ +type i = (type)source.imag;\ +memcpy(target+sizeof(type), , sizeof(type)); \ +return;\ +} \ +} while(0) + +static void +write_raw_complex_data(char *target, Py_complex source, int size) +{ +_write_raw_complex_data(float); +_write_raw_complex_data(double); +Py_FatalError("write_raw_complex_data: bad float size"); +} + static PyObject * new_simple_cdata(char *data, CTypeDescrObject *ct) { @@ -3574,6 +3593,40 @@ } return (PyObject *)cd; } + + +else if (ct->ct_flags & CT_PRIMITIVE_COMPLEX) { +/* cast to a complex */ +Py_complex value; +PyObject *io; +printf("_cffi_backend.c do_cast ct->ct_size=%ld\n", ct->ct_size); +if (CData_Check(ob)) { +CDataObject *cdsrc = (CDataObject *)ob; + +if (!(cdsrc->c_type->ct_flags & CT_PRIMITIVE_ANY)) +goto cannot_cast; +io = convert_to_object(cdsrc->c_data, cdsrc->c_type); +if (io == NULL) +return NULL; +} +else { +io = ob; +Py_INCREF(io); +} + +value = PyComplex_AsCComplex(io); +Py_DECREF(io); +if (value.real == -1.0 && value.imag == 0.0 && PyErr_Occurred()) +return NULL; + +cd = _new_casted_primitive(ct); +if (cd != NULL) { +write_raw_complex_data(cd->c_data, value, ct->ct_size); +} +return (PyObject *)cd; +} + + else { PyErr_Format(PyExc_TypeError, "cannot cast to ctype '%s'", ct->ct_name); diff --git a/c/test_c.py b/c/test_c.py --- a/c/test_c.py +++ b/c/test_c.py @@ -183,10 +183,9 @@ py.test.raises(TypeError, cast, p, None) def test_complex_types(): -py.test.skip("later") INF = 1E200 * 1E200 -for name in ["float", "double"]: -p = new_primitive_type("_Complex " + name) +for name in ["float"]: #, "double"]: +p = new_primitive_type(name + " _Complex") assert bool(cast(p, 0)) assert bool(cast(p, INF)) assert bool(cast(p, -INF)) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] cffi sirtom67/float_complex: initial support for 'float _Complex' and 'double _Complex'
Author: Tom Krauss <thomas.p.kra...@gmail.com> Branch: sirtom67/float_complex Changeset: r2860:7ad66643d015 Date: 2017-01-15 10:40 -0600 http://bitbucket.org/cffi/cffi/changeset/7ad66643d015/ Log:initial support for 'float _Complex' and 'double _Complex' Work In Progress - sources have printfs that will be removed. diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c --- a/c/_cffi_backend.c +++ b/c/_cffi_backend.c @@ -127,6 +127,8 @@ #define CT_FUNCTIONPTR 256/* pointer to function */ #define CT_VOID 512/* void */ +#define CT_PRIMITIVE_COMPLEX 16777216 /* float _Complex, double _Complex */ + /* other flags that may also be set in addition to the base flag: */ #define CT_IS_VOIDCHAR_PTR 1024 #define CT_PRIMITIVE_FITS_LONG 2048 @@ -145,7 +147,8 @@ #define CT_PRIMITIVE_ANY (CT_PRIMITIVE_SIGNED |\ CT_PRIMITIVE_UNSIGNED | \ CT_PRIMITIVE_CHAR | \ - CT_PRIMITIVE_FLOAT) + CT_PRIMITIVE_FLOAT | \ + CT_PRIMITIVE_COMPLEX) typedef struct _ctypedescr { PyObject_VAR_HEAD @@ -3855,6 +3858,8 @@ EPTYPE(f, float, CT_PRIMITIVE_FLOAT )\ EPTYPE(d, double, CT_PRIMITIVE_FLOAT ) \ EPTYPE(ld, long double, CT_PRIMITIVE_FLOAT | CT_IS_LONGDOUBLE ) \ + EPTYPE(fc, float _Complex, CT_PRIMITIVE_COMPLEX )\ + EPTYPE(dc, double _Complex, CT_PRIMITIVE_COMPLEX ) \ ENUM_PRIMITIVE_TYPES_WCHAR \ EPTYPE(b, _Bool, CT_PRIMITIVE_UNSIGNED | CT_IS_BOOL )\ /* the following types are not primitive in the C sense */ \ @@ -3925,6 +3930,8 @@ int name_size; ffi_type *ffitype; +printf("hello\n"); + for (ptypes=types; ; ptypes++) { if (ptypes->name == NULL) { #ifndef HAVE_WCHAR_H diff --git a/c/parse_c_type.c b/c/parse_c_type.c --- a/c/parse_c_type.c +++ b/c/parse_c_type.c @@ -25,7 +25,7 @@ /* keywords */ TOK__BOOL, TOK_CHAR, -//TOK__COMPLEX, +TOK__COMPLEX, TOK_CONST, TOK_DOUBLE, TOK_ENUM, @@ -797,6 +797,7 @@ int parse_c_type_from(struct _cffi_parse_info_s *info, size_t *output_index, const char *input) { +printf("parse_c_type_from\n"); int result; token_t token; 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 @@ -101,6 +101,7 @@ static PyObject *build_primitive_type(int num) { +fprintf(stderr, "fonum=%d\n",num); /* XXX too many translations between here and new_primitive_type() */ static const char *primitive_name[] = { NULL, @@ -151,6 +152,8 @@ "uint_fast64_t", "intmax_t", "uintmax_t", +"float _Complex", +"double _Complex", }; PyObject *x; diff --git a/cffi/cffi_opcode.py b/cffi/cffi_opcode.py --- a/cffi/cffi_opcode.py +++ b/cffi/cffi_opcode.py @@ -105,8 +105,11 @@ PRIM_UINT_FAST64 = 45 PRIM_INTMAX= 46 PRIM_UINTMAX = 47 +PRIM_FLOATCOMPLEX = 48 +PRIM_DOUBLECOMPLEX = 49 -_NUM_PRIM = 48 + +_NUM_PRIM = 50 _UNKNOWN_PRIM = -1 _UNKNOWN_FLOAT_PRIM= -2 _UNKNOWN_LONG_DOUBLE = -3 @@ -128,6 +131,8 @@ 'float': PRIM_FLOAT, 'double': PRIM_DOUBLE, 'long double':PRIM_LONGDOUBLE, +'float _Complex': PRIM_FLOATCOMPLEX, +'double _Complex':PRIM_DOUBLECOMPLEX, '_Bool': PRIM_BOOL, 'wchar_t':PRIM_WCHAR, 'int8_t': PRIM_INT8, diff --git a/cffi/model.py b/cffi/model.py --- a/cffi/model.py +++ b/cffi/model.py @@ -117,6 +117,8 @@ 'float': 'f', 'double': 'f', 'long double':'f', +'float _Complex': 'f', +'double _Complex':'f', '_Bool': 'i', # the following types are not primitive in the C sense 'wchar_t':'c', diff --git a/cffi/parse_c_type.h b/cffi/parse_c_type.h --- a/cffi/parse_c_type.h +++ b/cffi/parse_c_type.h @@ -79,8 +79,10 @@ #define _CFFI_PRIM_UINT_FAST64 45 #define _CFFI_PRIM_INTMAX 46 #define _CFFI_PRIM_UINTMAX 47 +#define _CFFI_PRIM_FLOATCOMPLEX 48 +#define _CFFI_PRIM_DOUBLECOMPLEX 49 -#define _CFFI__NUM_PRIM 48 +#define _CFFI__NUM_PRIM 50 #define _CFFI__UNKNOWN_PRIM (-1) #define _CFFI__UNKNOWN_FLOAT_PRIM (-2) #define _CFFI__UNKNOWN_LONG_DOUBLE(-3) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit