comparison python/pydc/test/types.py @ 44:0f86a5ecfe61

- python: allow None to be passed for 'p'ointers, always passing NULL
author Tassilo Philipp
date Tue, 27 Oct 2020 18:44:18 +0100
parents 2682a627168c
children c21d1c2c84e1
comparison
equal deleted inserted replaced
43:1086ca649715 44:0f86a5ecfe61
130 130
131 t(l, "p)Z", "const char*", "ccp_plus_one", "(const char*)", ' "xY" => "Y"', bytearray(b'xY')) # bytearray object 131 t(l, "p)Z", "const char*", "ccp_plus_one", "(const char*)", ' "xY" => "Y"', bytearray(b'xY')) # bytearray object
132 t(l, "p)p", "const char*", "ccp_plus_one", "(const char*)", ' "xY" => p+1 (~ odd addr)', bytearray(b'xY')) # bytearray object 132 t(l, "p)p", "const char*", "ccp_plus_one", "(const char*)", ' "xY" => p+1 (~ odd addr)', bytearray(b'xY')) # bytearray object
133 t(l, "p)p", "const char*", "ccp_plus_one", "(const char*)", ' 0xdeadc0de => 0xdeadc0de+1=3735929055', long_h) # handle (integer interpreted as ptr) 133 t(l, "p)p", "const char*", "ccp_plus_one", "(const char*)", ' 0xdeadc0de => 0xdeadc0de+1=3735929055', long_h) # handle (integer interpreted as ptr)
134 t(l, "p)p", "const char*", "ccp_plus_one", "(const char*)", ' 0xdeadc0de => 0xdeadc0de+1=3735929055', long_h) # handle (integer interpreted as ptr, long in Python 2) 134 t(l, "p)p", "const char*", "ccp_plus_one", "(const char*)", ' 0xdeadc0de => 0xdeadc0de+1=3735929055', long_h) # handle (integer interpreted as ptr, long in Python 2)
135 t(l, "p)p", "const char*", "ccp_plus_one", "(const char*)", ' NULL => NULL+1=1', None) # NULL, addin gone will result in 0x1
135 136
136 # functions that change buffers 137 # functions that change buffers
137 theader('TESTS OF IMMUTABLE AND MUTABLE PYTHON BUFFERS:') 138 theader('TESTS OF IMMUTABLE AND MUTABLE PYTHON BUFFERS:')
138 t(l, "Z)v", "const char*", "cp_head_incr", "(const char*)", ' "string" => None / arg => "string" (not modified)"', 'string') # string object 139 t(l, "Z)v", "const char*", "cp_head_incr", "(const char*)", ' "string" => None / arg => "string" (not modified)"', 'string') # string object
139 t(l, "Z)v", "const char*", "cp_head_incr", "(const char*)", ' "UnIcOdE" => None / arg => "UnIcOdE" (not modified)"', u'UnIcOdE') # string object (unicode in Python 2) 140 t(l, "Z)v", "const char*", "cp_head_incr", "(const char*)", ' "UnIcOdE" => None / arg => "UnIcOdE" (not modified)"', u'UnIcOdE') # string object (unicode in Python 2)