diff options
author | Thomas Heller <theller@ctypes.org> | 2006-07-10 11:11:10 +0000 |
---|---|---|
committer | Thomas Heller <theller@ctypes.org> | 2006-07-10 11:11:10 +0000 |
commit | 7644262aa5ef62a0e033ac1158b7cc7b41ffdd1a (patch) | |
tree | 4c45284216ecd8a6476f3a5d4e17b1782b8c3915 /Lib | |
parent | 7b1da513fd5620e3046047af28a6cf38e753e6f5 (diff) | |
download | cpython-git-7644262aa5ef62a0e033ac1158b7cc7b41ffdd1a.tar.gz |
Assigning None to pointer type structure fields possible overwrote
wrong fields.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/ctypes/test/test_structures.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/ctypes/test/test_structures.py b/Lib/ctypes/test/test_structures.py index bb56a61850..8a4531db93 100644 --- a/Lib/ctypes/test/test_structures.py +++ b/Lib/ctypes/test/test_structures.py @@ -371,5 +371,15 @@ class PointerMemberTestCase(unittest.TestCase): items = [s.array[i] for i in range(3)] self.failUnlessEqual(items, [1, 2, 3]) + def test_none_to_pointer_fields(self): + class S(Structure): + _fields_ = [("x", c_int), + ("p", POINTER(c_int))] + + s = S() + s.x = 12345678 + s.p = None + self.failUnlessEqual(s.x, 12345678) + if __name__ == '__main__': unittest.main() |