mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Merged revisions 63791-63792 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r63791 | thomas.heller | 2008-05-29 21:18:12 +0200 (Do, 29 Mai 2008) | 1 line Fix compiler warning. ........ r63792 | thomas.heller | 2008-05-29 21:42:34 +0200 (Do, 29 Mai 2008) | 1 line ctypes NULL function pointers have a boolean False value now. ........
This commit is contained in:
parent
61dbbf02b6
commit
7dca3ebc97
2 changed files with 29 additions and 21 deletions
|
@ -175,5 +175,13 @@ class PointersTestCase(unittest.TestCase):
|
|||
self.assertRaises(TypeError, c_void_p, 3.14) # make sure floats are NOT accepted
|
||||
self.assertRaises(TypeError, c_void_p, object()) # nor other objects
|
||||
|
||||
def test_pointers_bool(self):
|
||||
# NULL pointers have a boolean False value, non-NULL pointers True.
|
||||
self.failUnlessEqual(bool(POINTER(c_int)()), False)
|
||||
self.failUnlessEqual(bool(pointer(c_int())), True)
|
||||
|
||||
self.failUnlessEqual(bool(CFUNCTYPE(None)(0)), False)
|
||||
self.failUnlessEqual(bool(CFUNCTYPE(None)(42)), True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue