Commits

Armin Rigo  committed 77df9af

Standardize the error message.

  • Participants
  • Parent commits 3436a0e

Comments (0)

Files changed (2)

File c/_cffi_backend.c

         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;
     }
     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")