[pypy-svn] r50735 - in pypy/dist/pypy/lib: _ctypes app_test/ctypes
fijal at codespeak.net
fijal at codespeak.net
Thu Jan 17 22:59:28 CET 2008
Author: fijal
Date: Thu Jan 17 22:59:27 2008
New Revision: 50735
Modified:
pypy/dist/pypy/lib/_ctypes/structure.py
pypy/dist/pypy/lib/app_test/ctypes/test_structures.py
Log:
Complain louder, test passes
Modified: pypy/dist/pypy/lib/_ctypes/structure.py
==============================================================================
--- pypy/dist/pypy/lib/_ctypes/structure.py (original)
+++ pypy/dist/pypy/lib/_ctypes/structure.py Thu Jan 17 22:59:27 2008
@@ -23,6 +23,9 @@
return size, alignment, pos
def names_and_fields(_fields_, superclass):
+ for _, tp in _fields_:
+ if not isinstance(tp, _CDataMeta):
+ raise TypeError("Expected CData subclass, got %s" % (tp,))
import ctypes
all_fields = _fields_[:]
for cls in inspect.getmro(superclass):
Modified: pypy/dist/pypy/lib/app_test/ctypes/test_structures.py
==============================================================================
--- pypy/dist/pypy/lib/app_test/ctypes/test_structures.py (original)
+++ pypy/dist/pypy/lib/app_test/ctypes/test_structures.py Thu Jan 17 22:59:27 2008
@@ -205,7 +205,7 @@
raises(ValueError, type(Structure), "X", (Structure,), d)
def test_initializers(self):
- py.test.skip("???")
+ py.test.skip("unsupported")
class Person(Structure):
_fields_ = [("name", c_char*6),
("age", c_int)]
@@ -232,7 +232,6 @@
assert (pt.x, pt.y) == (1, 2)
def test_invalid_field_types(self):
- py.test.skip("???")
class POINT(Structure):
pass
raises(TypeError, setattr, POINT, "_fields_", [("x", 1), ("y", 2)])
More information about the Pypy-commit
mailing list