[pypy-svn] r78922 - in pypy/branch/fast-forward: lib_pypy/_ctypes pypy/module/test_lib_pypy/ctypes_tests
afa at codespeak.net
afa at codespeak.net
Tue Nov 9 15:09:21 CET 2010
Author: afa
Date: Tue Nov 9 15:09:19 2010
New Revision: 78922
Modified:
pypy/branch/fast-forward/lib_pypy/_ctypes/structure.py
pypy/branch/fast-forward/pypy/module/test_lib_pypy/ctypes_tests/test_structures.py
Log:
Base fields should appear before subclass fields
Modified: pypy/branch/fast-forward/lib_pypy/_ctypes/structure.py
==============================================================================
--- pypy/branch/fast-forward/lib_pypy/_ctypes/structure.py (original)
+++ pypy/branch/fast-forward/lib_pypy/_ctypes/structure.py Tue Nov 9 15:09:19 2010
@@ -40,9 +40,10 @@
if isinstance(tp, StructOrUnionMeta):
tp._make_final()
import ctypes
- all_fields = _fields_[:]
+ all_fields = []
for cls in inspect.getmro(superclass):
all_fields += getattr(cls, '_fields_', [])
+ all_fields += _fields_
names = [f[0] for f in all_fields]
rawfields = [(f[0], f[1]._ffishape)
for f in all_fields]
Modified: pypy/branch/fast-forward/pypy/module/test_lib_pypy/ctypes_tests/test_structures.py
==============================================================================
--- pypy/branch/fast-forward/pypy/module/test_lib_pypy/ctypes_tests/test_structures.py (original)
+++ pypy/branch/fast-forward/pypy/module/test_lib_pypy/ctypes_tests/test_structures.py Tue Nov 9 15:09:19 2010
@@ -22,6 +22,8 @@
assert Y._fields_ == [("b", c_int)]
assert Z._fields_ == [("a", c_int)]
+ assert Y._names == ['a', 'b']
+
def test_subclass_delayed(self):
class X(Structure):
pass
More information about the Pypy-commit
mailing list