Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r1011:2e6275abecea Date: 2012-10-26 16:23 +0200 http://bitbucket.org/cffi/cffi/changeset/2e6275abecea/
Log: Fixes for test_verify. diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c --- a/c/_cffi_backend.c +++ b/c/_cffi_backend.c @@ -4606,8 +4606,14 @@ static char *_cffi_to_c_pointer(PyObject *obj, CTypeDescrObject *ct) { char *result; - if (convert_from_object((char *)&result, ct, obj) < 0) + if (convert_from_object((char *)&result, ct, obj) < 0) { + if (PyFile_Check(obj) && (ct->ct_flags & CT_POINTER) && + (ct->ct_itemdescr->ct_flags & CT_IS_FILE)) { + PyErr_Clear(); + return (char *)PyFile_AsFile(obj); + } return NULL; + } return result; } diff --git a/testing/test_verify.py b/testing/test_verify.py --- a/testing/test_verify.py +++ b/testing/test_verify.py @@ -1265,7 +1265,7 @@ import posix fdr, fdw = posix.pipe() fw1 = posix.fdopen(fdw, 'wb', 256) - lib.myfile = fw1 + lib.myfile = ffi.cast("FILE *", fw1) # fw1.write(b"X") r = lib.myprintf(b"hello, %d!\n", ffi.cast("int", 42)) _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit