Author: Amaury Forgeot d'Arc <amaur...@gmail.com> Branch: Changeset: r75858:2a0f777f5f5b Date: 2015-02-13 09:42 +0100 http://bitbucket.org/pypy/pypy/changeset/2a0f777f5f5b/
Log: Issue #1982 Avoid name clash and rename cls._names to cls._names_ 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 @@ -60,7 +60,7 @@ is_bitfield = (len(field) == 3) startpos = self._ffistruct.fieldoffset(name) if name in anonymous_fields: - for subname in value._pyctypes__names: + for subname in value._names_: resnames.append(subname) subfield = getattr(value, subname) relpos = startpos + subfield.offset @@ -71,7 +71,7 @@ else: resnames.append(name) names = resnames - self._pyctypes__names = names + self._names_ = names for name, field in fields.items(): setattr(self, name, field) @@ -230,9 +230,9 @@ def __init__(self, *args, **kwds): type(self)._make_final() - if len(args) > len(self._pyctypes__names): + if len(args) > len(self._names_): raise TypeError("too many initializers") - for name, arg in zip(self._pyctypes__names, args): + for name, arg in zip(self._names_, args): if name in kwds: raise TypeError("duplicate value for argument %r" % ( name,)) diff --git a/pypy/module/test_lib_pypy/ctypes_tests/test_anon.py b/pypy/module/test_lib_pypy/ctypes_tests/test_anon.py --- a/pypy/module/test_lib_pypy/ctypes_tests/test_anon.py +++ b/pypy/module/test_lib_pypy/ctypes_tests/test_anon.py @@ -56,3 +56,4 @@ assert Y._.offset == sizeof(c_int) assert Y.y.offset == sizeof(c_int) * 2 + assert Y._names_ == ['x', 'a', 'b', 'y'] 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 @@ -23,7 +23,7 @@ assert Y._fields_ == [("b", c_int)] assert Z._fields_ == [("a", c_int)] - assert Y._pyctypes__names == ['a', 'b'] + assert Y._names_ == ['a', 'b'] def test_subclass_delayed(self): class X(Structure): _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit