Author: Armin Rigo <[email protected]>
Branch:
Changeset: r1000:77df9afbe082
Date: 2012-10-20 09:38 +0200
http://bitbucket.org/cffi/cffi/changeset/77df9afbe082/
Log: Standardize the error message.
diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c
--- a/c/_cffi_backend.c
+++ b/c/_cffi_backend.c
@@ -1727,12 +1727,8 @@
length = _my_PyUnicode_SizeAsWideChar(init) + 1;
}
else if (PyFile_Check(init)) {
- if (strcmp(ctptr->ct_itemdescr->ct_name, "struct _IO_FILE") != 0) {
- PyErr_Format(PyExc_TypeError,
- "FILE object passed to a '%s' argument",
- ctptr->ct_name);
- return -1;
- }
+ if (strcmp(ctptr->ct_itemdescr->ct_name, "struct _IO_FILE") != 0)
+ return 0;
output_data[0] = (char *)PyFile_AsFile(init);
return 1;
}
diff --git a/c/test_c.py b/c/test_c.py
--- a/c/test_c.py
+++ b/c/test_c.py
@@ -2265,5 +2265,5 @@
fw1 = posix.fdopen(fdw, 'w')
#
e = py.test.raises(TypeError, fputs, b"hello world\n", fw1)
- assert str(e.value) == ("FILE object passed to a 'struct NOT_FILE *' "
- "argument")
+ assert str(e.value) == ("initializer for ctype 'struct NOT_FILE *' must "
+ "be a cdata pointer, not file")
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit