Commits

Armin Rigo  committed 2715acc

Additional checks.

  • Participants
  • Parent commits 5cfde74

Comments (0)

Files changed (2)

File ffi/backend_ctypes.py

                         setattr(self._blob, fname, BField._to_ctypes(value))
         #
         for fname, BField in zip(fnames, BFieldTypes):
+            if hasattr(CTypesStruct, fname):
+                raise ValueError("the field name %r conflicts in "
+                                 "the ctypes backend" % fname)
             def getter(self, fname=fname, BField=BField):
                 return BField._from_ctypes(getattr(self._blob, fname))
             def setter(self, value, fname=fname, BField=BField):

File testing/backend_tests.py

         assert s.a == -2
         assert s.b == -3
         assert s.c == 0
+        py.test.raises((AttributeError, TypeError), "del s.a")
         #
         py.test.raises(ValueError, ffi.new, "struct foo", [1, 2, 3, 4])