Author: Armin Rigo <[email protected]>
Branch: cffi-1.0
Changeset: r1701:ac35ddf71ece
Date: 2015-04-14 15:58 +0200
http://bitbucket.org/cffi/cffi/changeset/ac35ddf71ece/
Log: Pass test_realize_c_type
diff --git a/new/cffi1_module.c b/new/cffi1_module.c
--- a/new/cffi1_module.c
+++ b/new/cffi1_module.c
@@ -25,6 +25,9 @@
return -1;
if (PyDict_SetItemString(FFI_Type.tp_dict, "error", FFIError) < 0)
return -1;
+ if (PyDict_SetItemString(FFI_Type.tp_dict, "CType",
+ (PyObject *)&CTypeDescr_Type) < 0)
+ return -1;
Py_INCREF(&FFI_Type);
if (PyModule_AddObject(m, "FFI", (PyObject *)&FFI_Type) < 0)
diff --git a/new/ffi_obj.c b/new/ffi_obj.c
--- a/new/ffi_obj.c
+++ b/new/ffi_obj.c
@@ -148,21 +148,19 @@
return PyInt_FromSsize_t(ct->ct_size);
}
-#if 0
-static PyObject *ffi_typeof(ZefFFIObject *self, PyObject *arg)
+static PyObject *ffi_typeof(FFIObject *self, PyObject *arg)
{
PyObject *x = (PyObject *)_ffi_type(self, arg, ACCEPT_STRING|ACCEPT_CDATA);
if (x != NULL) {
Py_INCREF(x);
}
else if (PyCFunction_Check(arg)) {
- PyErr_SetString(PyExc_TypeError, "typeof(lib.func) not supported: the "
- "exact type of functions is unknown (declare that "
- "function as a function pointer instead)");
+ abort(); // XXX
}
return x;
}
+#if 0
static PyObject *ffi_new(ZefFFIObject *self, PyObject *args)
{
CTypeDescrObject *ct, *ctitem;
@@ -559,8 +557,8 @@
{"sizeof", (PyCFunction)ffi_sizeof, METH_O},
#if 0
{"string", (PyCFunction)ffi_string, METH_VARARGS},
+#endif
{"typeof", (PyCFunction)ffi_typeof, METH_O},
-#endif
{NULL}
};
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit