Author: Amaury Forgeot d'Arc <[email protected]>
Branch:
Changeset: r64558:ff06e504ab9c
Date: 2013-05-25 21:37 +0200
http://bitbucket.org/pypy/pypy/changeset/ff06e504ab9c/
Log: Issue1498: Fix another issue with subclasses of ctypes structures.
diff --git a/lib_pypy/_ctypes/structure.py b/lib_pypy/_ctypes/structure.py
--- a/lib_pypy/_ctypes/structure.py
+++ b/lib_pypy/_ctypes/structure.py
@@ -166,8 +166,7 @@
if self is StructOrUnion:
return
if '_fields_' not in self.__dict__:
- self._fields_ = []
- _set_shape(self, [], self._is_union)
+ self._fields_ = [] # As a side-effet, this also sets the ffishape.
__setattr__ = struct_setattr
diff --git a/pypy/module/test_lib_pypy/ctypes_tests/test_structures.py
b/pypy/module/test_lib_pypy/ctypes_tests/test_structures.py
--- a/pypy/module/test_lib_pypy/ctypes_tests/test_structures.py
+++ b/pypy/module/test_lib_pypy/ctypes_tests/test_structures.py
@@ -239,6 +239,9 @@
pass
pos = POSITION(1, 2)
assert (pos.x, pos.y) == (1, 2)
+ # Try a second time, result may be different (cf. issue1498)
+ pos = POSITION(1, 2)
+ assert (pos.x, pos.y) == (1, 2)
def test_invalid_field_types(self):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit