Mercurial > pub > dyncall > bindings
annotate python/pydc/test/types_test.py @ 63:9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
* prev commit had bugs
* added overflow tests for also int, long, long long (for both, lp64 and llp64)
- while at it, fixing a reference leak when not using python with utf8 caching
author | Tassilo Philipp |
---|---|
date | Sun, 19 May 2024 15:33:18 +0200 |
parents | c5a69c454963 |
children |
rev | line source |
---|---|
29 | 1 import pydc |
2 import sys | |
3 import platform | |
57 | 4 import copy |
5 import types | |
29 | 6 |
7 | |
8 | |
9 def theader(title): | |
34 | 10 print("\n"+title) |
63
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
11 print('%8s %20s %16s %-20s %11s %-20s -> %20s %-20s %12s %-20s # %s' % ('DC_SIG', 'C_RET_T', 'C_FSYM', 'C_PARAMLIST', 'PY_ARG_T', 'IN_ARGS', 'RET_VAL', 'PY_RET_T', 'OUT_ARGS_T', 'OUT_ARGS', 'NOTES')) |
29 | 12 |
13 | |
57 | 14 def t(lib, dcsig, c_rtype, c_fsym, c_paramlist, extra_msg, **kwargs): |
15 args = kwargs['i'] if 'i' in kwargs else () | |
16 post_args = kwargs['p'] if 'p' in kwargs else copy.deepcopy(args) # expected args after call (as some can be modified in-place) | |
17 exp_ret = kwargs['r'] if 'r' in kwargs else None # expected return value | |
18 err_sgr = '' | |
34 | 19 # before call |
20 inarg_types = '('+','.join(map(lambda x: type(x).__name__, args))+')' | |
57 | 21 inargs_str = ','.join(map(str, args)) |
34 | 22 # call |
29 | 23 try: |
24 fp = pydc.find(lib, c_fsym) | |
25 r = pydc.call(fp, dcsig, *args) | |
26 rt = type(r).__name__ | |
58 | 27 if(r != exp_ret or args != post_args): # @@@ type test also or type(r) is not type(exp_ret)): |
28 if((type(exp_ret) is not types.LambdaType) or exp_ret(r) == False): | |
57 | 29 err_sgr = '\033[41m' |
29 | 30 except: |
31 r = '[EXCEPTION]' | |
32 rt = '!' | |
57 | 33 if(exp_ret != Exception): |
34 err_sgr = '\033[41m' | |
34 | 35 e = str(sys.exc_info()[1]) |
36 extra_msg += ' "'+(e if len(e)<32 else e[0:32]+'...')+'"' | |
37 # after call | |
38 outarg_types = '('+','.join(map(lambda x: type(x).__name__, args))+')' | |
39 outargs = ','.join(map(str, args)) | |
63
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
40 print('%s%8s %20s %16s %-20s %11s \033[33m%-20s\033[39m -> \033[32m%20.20s\033[39m %-20s %12s \033[32m%-20s\033[0m # %s' % (err_sgr, dcsig, c_rtype, c_fsym, c_paramlist, inarg_types, inargs_str, str(r), '('+rt+')', outarg_types, outargs, extra_msg)) |
57 | 41 |
42 return r | |
29 | 43 |
44 | |
45 | |
46 # some libc tests ------------------ | |
47 | |
48 try: | |
57 | 49 if len(sys.argv) > 1: |
50 libc = pydc.load(sys.argv[1]) | |
51 elif sys.platform == "win32": | |
29 | 52 libc = pydc.load("msvcrt") |
53 elif sys.platform == "darwin": | |
54 libc = pydc.load("/usr/lib/libc.dylib") | |
55 elif "bsd" in sys.platform: | |
56 libc = pydc.load("/usr/lib/libc.so") | |
57 #libc = pydc.load("/lib/libc.so.7") | |
58 elif platform.architecture()[0] == "64bit": | |
59 libc = pydc.load("/lib64/libc.so.6") | |
60 else: | |
57 | 61 libc = pydc.load("/lib/libc.so") |
29 | 62 |
63 theader('CLIB TESTS:') | |
64 | |
65 # void() | |
66 t(libc, ")v", "void", "sranddev", "(void)", '') | |
67 | |
68 # int() | |
58 | 69 t(libc, ")i", "int", "rand", "(void)", '', r=lambda i: type(i) is int) |
29 | 70 |
71 # void(unsigned int) | |
57 | 72 t(libc, "I)v", "void", "srand", "(int)", '', i=(123,)) |
29 | 73 |
74 # int() (and one different helper call for test) | |
57 | 75 x = \ |
76 t(libc, ")i", "int", "rand", "(void)", 'with seed <------,', r=lambda i: type(i) is int) | |
77 t(libc, "I)v", "void", "srand", "(int)", 'set same seed |', i=(123,)) | |
78 t(libc, ")i", "int", "rand", "(void)", 'should be same result...', r=x) | |
79 t(libc, ")i", "int", "rand", "(void)", '...and now different result', r=lambda i: type(i) is int and i!=x) | |
29 | 80 |
81 # int(int) | |
57 | 82 t(libc, "i)i", "int", "abs", "(int)", ' 10 => 10', i=( 10,), r=10) |
83 t(libc, "i)i", "int", "abs", "(int)", ' 0 => 0', i=( 0,), r=0) | |
84 t(libc, "i)i", "int", "abs", "(int)", ' -9209 => 9209', i=(-9209,), r=9209) | |
29 | 85 |
86 # long(long) | |
57 | 87 t(libc, "j)j", "long", "labs", "(long)", ' 48 => 48', i=( 48,), r=48) |
88 t(libc, "j)j", "long", "labs", "(long)", ' 0 => 0', i=( 0,), r=0) | |
89 t(libc, "j)j", "long", "labs", "(long)", '-4271477497 => 4271477497', i=(-4271477497,), r=4271477497) | |
29 | 90 |
91 # long long(long long) | |
57 | 92 t(libc, "l)l", "long long", "labs", "(long long)", ' 6334810198 => 6334810198', i=( 6334810198,), r=6334810198) |
93 t(libc, "l)l", "long long", "labs", "(long long)", ' 1 => 1', i=( 1,), r=1) | |
94 t(libc, "l)l", "long long", "labs", "(long long)", ' 0 => 0', i=( 0,), r=0) | |
95 t(libc, "l)l", "long long", "labs", "(long long)", ' -1 => 1', i=( -1,), r=1) | |
96 t(libc, "l)l", "long long", "labs", "(long long)", '-7358758407 => 7358758407', i=(-7358758407,), r=7358758407) | |
29 | 97 |
98 pydc.free(libc) | |
99 except: | |
57 | 100 print("\033[33mskipping clib tests because: "+str(sys.exc_info()[1])+"\033[0m\nnote: c-lib to use can be specified as command line param") |
29 | 101 |
102 | |
103 # tests with own .so for testing all conversions ------------------ | |
104 | |
105 l = pydc.load(sys.path[0]+"/test.so") | |
106 | |
63
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
107 # detect if C sizeof(long) == sizeof(int) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
108 llp64 = pydc.call(pydc.find(l, "llp64"), ")i") |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
109 |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
110 |
34 | 111 # "long" typed test value use for Python 2 |
112 long_i = 11234 | |
113 long_h = 0xdeadc0de | |
114 if sys.version_info < (3, 0): | |
115 long_i = long(11234) | |
116 long_h = long(0xdeadc0de) | |
117 | |
29 | 118 # test all possible arg types and their conversions to and from python, with |
119 # specific focus/tests in areas where python 2 and 3 differ | |
120 theader('ARG & RET TYPE CONVERSION TESTS:') | |
57 | 121 t(l, "B)B", "int", "i_plus_one", "(int)", ' False => True (using int func in C)', i=(False,), r=True) |
34 | 122 |
57 | 123 t(l, "c)c", "char", "c_plus_one", "(char)", ' "a" (97) => 98', i=( 'a',), r=98) |
124 t(l, "C)C", "unsigned char", "uc_plus_one", "(unsigned char)", ' "a" (97) => 98', i=( 'a',), r=98) | |
125 t(l, "c)c", "char", "c_plus_one", "(char)", ' -2 => -1', i=( -2,), r=-1) | |
126 t(l, "C)C", "unsigned char", "uc_plus_one", "(unsigned char)", ' 10 => 11', i=( 10,), r=11) | |
34 | 127 |
57 | 128 t(l, "s)s", "short", "s_plus_one", "(short)", ' 10 => 11', i=( 10,), r=11) |
129 t(l, "S)S", "unsigned short", "us_plus_one", "(unsigned short)", ' 10 => 11', i=( 10,), r=11) | |
34 | 130 |
57 | 131 t(l, "i)i", "int", "i_plus_one", "(int)", ' 10 => 11', i=( 10,), r=11) |
132 t(l, "I)I", "unsigned int", "ui_plus_one", "(unsigned int)", ' 10 => 11', i=( 10,), r=11) | |
34 | 133 |
57 | 134 t(l, "j)j", "long", "l_plus_one", "(long)", ' 10 => 11', i=( 10,), r=11) |
135 t(l, "J)J", "unsigned long", "ul_plus_one", "(unsigned long)", ' 10 => 11', i=( 10,), r=11) | |
34 | 136 |
57 | 137 t(l, "l)l", "long long", "ll_plus_one", "(long long)", ' 10 => 11', i=( 10,), r=11) |
138 t(l, "L)L", "unsigned long long", "ull_plus_one", "(unsigned long long)", ' 10 => 11', i=( 10,), r=11) | |
139 t(l, "l)l", "long long", "ll_plus_one", "(long long)", ' 11234 => 11235', i=(long_i,), r=11235) | |
140 t(l, "L)L", "unsigned long long", "ull_plus_one", "(unsigned long long)", ' 11234 => 11235', i=(long_i,), r=11235) | |
34 | 141 |
57 | 142 t(l, "f)f", "float", "f_plus_one", "(float)", ' -1.23 => -0.23... (w/ fp imprecision)', i=( -1.23,), r=-0.23000001907348633) |
143 t(l, "d)d", "double", "d_plus_one", "(double)", ' 5.67 => 6.67', i=( 5.67,), r= 6.67) | |
34 | 144 |
57 | 145 t(l, "Z)Z", "const char*", "ccp_plus_one", "(const char*)", '"lose char" => "ose char"', i=( 'lose char',), r= 'ose char') # string object |
146 t(l, "Z)Z", "const char*", "ccp_plus_one", "(const char*)", '"X_unicode" => "_unicode"', i=( u'X_unicode',), r=u'_unicode') # string object (unicode in Python 2) | |
147 t(l, "Z)Z", "const char*", "ccp_plus_one", "(const char*)", '"1lessbyte" => "lessbyte"', i=( b'1lessbyte',), r= 'lessbyte') # bytes object | |
148 t(l, "Z)Z", "const char*", "ccp_plus_one", "(const char*)", ' "xY" => "Y"', i=(bytearray(b'xY'),), r= 'Y') # bytearray object | |
61 | 149 t(l, "Z)p", "const char*", "ccp_plus_one", "(const char*)", ' NULL => NULL+1=1', i=( None,), r=1) # NULL, adding one will result in 0x1 |
34 | 150 |
57 | 151 t(l, "p)Z", "const char*", "ccp_plus_one", "(const char*)", ' "xY" => "Y"', i=(bytearray(b'xY'),), r='Y') # bytearray object |
58 | 152 t(l, "p)p", "const char*", "ccp_plus_one", "(const char*)", ' "xY" => p+1 (~ odd addr)', i=(bytearray(b'xY'),), r=lambda i: type(i) is int and (i%2)==1) # bytearray object |
57 | 153 t(l, "p)p", "const char*", "ccp_plus_one", "(const char*)", ' 0xdeadc0de => 0xdeadc0de+1=3735929055', i=(long_h,), r=3735929055) # handle (integer interpreted as ptr) |
154 t(l, "p)p", "const char*", "ccp_plus_one", "(const char*)", ' 0xdeadc0de => 0xdeadc0de+1=3735929055', i=(long_h,), r=3735929055) # handle (integer interpreted as ptr, long in Python 2) | |
155 t(l, "p)p", "const char*", "ccp_plus_one", "(const char*)", ' NULL => NULL+1=1', i=( None,), r=1) # NULL, adding one will result in 0x1 | |
34 | 156 |
60 | 157 # helper func to test p2Z |
158 t(l, "p)p", "const char*", "ccp_plus_one", "(const char*)", ' "xY" => "Y" (after p2Z())', i=(bytearray(b'xY'),), r=lambda i: type(i) is int and pydc.p2Z(i) == 'Y') | |
159 t(l, "Z)p", "const char*", "ccp_plus_one", "(const char*)", ' "Y" => "" (after p2Z())', i=( 'Y',), r=lambda i: type(i) is int and pydc.p2Z(i) == '') | |
160 t(l, "Z)p", "const char*", "ccp_plus_one", "(const char*)", '"X_unicode" => "_unicode" (after p2Z())', i=( u'X_unicode',), r=lambda i: type(i) is int and pydc.p2Z(i) == '_unicode') | |
161 t(l, "Z)p", "const char*", "ccp_plus_one", "(const char*)", '"1lessbyte" => "lessbyte" (after p2Z())', i=( b'1lessbyte',), r=lambda i: type(i) is int and pydc.p2Z(i) == 'lessbyte') | |
162 t(l, "j)p", "long", "l_plus_one", "(long)", ' -0x1 => "" (after p2Z())', i=( -0x1,), r=lambda i: type(i) is int and pydc.p2Z(i) == None) | |
163 | |
34 | 164 # functions that change buffers |
165 theader('TESTS OF IMMUTABLE AND MUTABLE PYTHON BUFFERS:') | |
57 | 166 t(l, "Z)v", "const char*", "cp_head_incr", "(const char*)", ' "string" => None / arg => "string" (not modified)"', i=( 'string',)) # string object |
167 t(l, "Z)v", "const char*", "cp_head_incr", "(const char*)", ' "UnIcOdE" => None / arg => "UnIcOdE" (not modified)"', i=( u'UnIcOdE',)) # string object (unicode in Python 2) | |
168 t(l, "Z)v", "const char*", "cp_head_incr", "(const char*)", ' "BCssk#" => None / arg => "BCssk#" (not modified)"', i=( b'BCssk#',)) # bytes object | |
169 t(l, "Z)v", "const char*", "cp_head_incr", "(const char*)", ' "xY" => None / arg => "xY" (not modified)"', i=(bytearray(b'xY'),)) # bytearray object | |
170 t(l, "p)v", "const char*", "cp_head_incr", "(const char*)", ' "xY" => None / arg => "yY" (!MODIFIED!)"', i=(bytearray(b'xY'),), p=(bytearray(b'yY'),)) # bytearray object | |
29 | 171 |
172 # tested checked value conversions | |
173 theader('ARG & RET TYPE CONVERSION TESTS FOR RANGE CHECKED TYPES:') | |
63
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
174 t(l, "c)c", "char", "c_plus_one", "(char)", ' "~" => 127', i=( '~',), r=127) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
175 t(l, "c)c", "char", "c_plus_one", "(char)", ' "~" => 127', i=( '~',), r=127) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
176 t(l, "c)c", "char", "c_plus_one", "(char)", ' "" => input exc:', i=( '',), r=Exception) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
177 t(l, "c)c", "char", "c_plus_one", "(char)", ' "" => input exc:', i=( '',), r=Exception) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
178 t(l, "C)C", "unsigned char", "uc_plus_one", "(unsigned char)", ' "ab" => input exc:', i=('ab',), r=Exception) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
179 t(l, "C)C", "unsigned char", "uc_plus_one", "(unsigned char)", ' "ab" => input exc:', i=('ab',), r=Exception) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
180 |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
181 t(l, "c)c", "char", "c_plus_one", "(char)", ' -128 => -127', i=(-128,), r=-127) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
182 t(l, "c)c", "char", "c_plus_one", "(char)", ' 127 => -128 (wrapped)', i=( 127,), r=-128) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
183 t(l, "c)c", "char", "c_plus_one", "(char)", ' -129 => input exc:', i=(-129,), r=Exception) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
184 t(l, "c)c", "char", "c_plus_one", "(char)", ' 128 => input exc:', i=( 128,), r=Exception) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
185 |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
186 t(l, "C)C", "unsigned char", "uc_plus_one", "(unsigned char)", ' 0 => 1', i=( 0,), r=1) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
187 t(l, "C)C", "unsigned char", "uc_plus_one", "(unsigned char)", ' 255 => 0 (wrapped)', i=( 255,), r=0) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
188 t(l, "C)C", "unsigned char", "uc_plus_one", "(unsigned char)", ' -1 => input exc:', i=( -1,), r=Exception) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
189 t(l, "C)C", "unsigned char", "uc_plus_one", "(unsigned char)", ' 256 => input exc:', i=( 256,), r=Exception) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
190 |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
191 t(l, "s)s", "short", "s_plus_one", "(short)", ' -32768 => -32767', i=(-32768,), r=-32767) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
192 t(l, "s)s", "short", "s_plus_one", "(short)", ' 32767 => -32768 (wrapped)', i=( 32767,), r=-32768) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
193 t(l, "s)s", "short", "s_plus_one", "(short)", ' -32769 => input exc:', i=(-32769,), r=Exception) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
194 t(l, "s)s", "short", "s_plus_one", "(short)", ' 32768 => input exc:', i=( 32768,), r=Exception) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
195 |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
196 t(l, "S)S", "unsigned short", "us_plus_one", "(unsigned short)", ' 0 => 1', i=( 0,), r=1) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
197 t(l, "S)S", "unsigned short", "us_plus_one", "(unsigned short)", ' 65535 => 0 (wrapped)', i=(65535,), r=0) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
198 t(l, "S)S", "unsigned short", "us_plus_one", "(unsigned short)", ' -1 => input exc:', i=( -1,), r=Exception) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
199 t(l, "S)S", "unsigned short", "us_plus_one", "(unsigned short)", ' 65536 => input exc:', i=(65536,), r=Exception) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
200 |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
201 t(l, "i)i", "int", "i_plus_one", "(int)", ' -2147483648 => -2147483647', i=(-2147483648,), r=-2147483647) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
202 t(l, "i)i", "int", "i_plus_one", "(int)", ' 2147483647 => -2147483648 (wrapped)', i=( 2147483647,), r=-2147483648) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
203 t(l, "i)i", "int", "i_plus_one", "(int)", ' -2147483649 => input exc:', i=(-2147483649,), r=Exception) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
204 t(l, "i)i", "int", "i_plus_one", "(int)", ' 2147483648 => input exc:', i=( 2147483648,), r=Exception) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
205 |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
206 t(l, "I)I", "unsigned int", "ui_plus_one", "(unsigned int)", ' 0 => 1', i=( 0,), r=1) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
207 t(l, "I)I", "unsigned int", "ui_plus_one", "(unsigned int)", ' 4294967295 => 0 (wrapped)', i=(4294967295,), r=0) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
208 t(l, "I)I", "unsigned int", "ui_plus_one", "(unsigned int)", ' -1 => input exc:', i=( -1,), r=Exception) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
209 t(l, "I)I", "unsigned int", "ui_plus_one", "(unsigned int)", ' 4294967296 => input exc:', i=(4294967296,), r=Exception) |
29 | 210 |
63
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
211 if llp64: |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
212 t(l, "j)j", "long", "l_plus_one", "(long)", ' -2147483648 => -2147483647', i=(-2147483648,), r=-2147483647) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
213 t(l, "j)j", "long", "l_plus_one", "(long)", ' 2147483647 => -2147483648 (wrapped)', i=( 2147483647,), r=-2147483648) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
214 t(l, "j)j", "long", "l_plus_one", "(long)", ' -2147483649 => input exc:', i=(-2147483649,), r=Exception) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
215 t(l, "j)j", "long", "l_plus_one", "(long)", ' 2147483648 => input exc:', i=( 2147483648,), r=Exception) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
216 |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
217 t(l, "J)J", "unsigned long", "ul_plus_one", "(unsigned long)", ' 0 => 1', i=( 0,), r=1) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
218 t(l, "J)J", "unsigned long", "ul_plus_one", "(unsigned long)", ' 4294967295 => 0 (wrapped)', i=(4294967295,), r=0) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
219 t(l, "J)J", "unsigned long", "ul_plus_one", "(unsigned long)", ' -1 => input exc:', i=( -1,), r=Exception) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
220 t(l, "J)J", "unsigned long", "ul_plus_one", "(unsigned long)", ' 4294967296 => input exc:', i=(4294967296,), r=Exception) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
221 |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
222 else: |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
223 t(l, "j)j", "long", "l_plus_one", "(long)", '-9223372036854775808 => -9223372036854775807', i=(-9223372036854775808,), r=-9223372036854775807) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
224 t(l, "j)j", "long", "l_plus_one", "(long)", ' 9223372036854775807 => -9223372036854775808 (wrapped)',i=( 9223372036854775807,), r=-9223372036854775808) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
225 t(l, "j)j", "long", "l_plus_one", "(long)", '-9223372036854775809 => input exc:', i=(-9223372036854775809,), r=Exception) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
226 t(l, "j)j", "long", "l_plus_one", "(long)", ' 9223372036854775808 => input exc:', i=( 9223372036854775808,), r=Exception) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
227 |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
228 t(l, "J)J", "unsigned long", "ul_plus_one", "(unsigned long)", ' 0 => 1', i=( 0,), r=1) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
229 t(l, "J)J", "unsigned long", "ul_plus_one", "(unsigned long)", '18446744073709551615 => 0 (wrapped)', i=(18446744073709551615,), r=0) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
230 t(l, "J)J", "unsigned long", "ul_plus_one", "(unsigned long)", ' -1 => input exc:', i=( -1,), r=Exception) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
231 t(l, "J)J", "unsigned long", "ul_plus_one", "(unsigned long)", '18446744073709551616 => input exc:', i=(18446744073709551616,), r=Exception) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
232 |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
233 |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
234 t(l, "l)l", "long long", "ll_plus_one", "(long long)", '-9223372036854775808 => -9223372036854775807', i=(-9223372036854775808,), r=-9223372036854775807) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
235 t(l, "l)l", "long long", "ll_plus_one", "(long long)", ' 9223372036854775807 => -9223372036854775808 (wrapped)',i=( 9223372036854775807,), r=-9223372036854775808) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
236 t(l, "l)l", "long long", "ll_plus_one", "(long long)", '-9223372036854775809 => input exc:', i=(-9223372036854775809,), r=Exception) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
237 t(l, "l)l", "long long", "ll_plus_one", "(long long)", ' 9223372036854775808 => input exc:', i=( 9223372036854775808,), r=Exception) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
238 |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
239 t(l, "L)L", "unsigned long long", "ull_plus_one", "(unsigned long long)", ' 0 => 1', i=( 0,), r=1) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
240 t(l, "L)L", "unsigned long long", "ull_plus_one", "(unsigned long long)", '18446744073709551615 => 0 (wrapped)', i=(18446744073709551615,), r=0) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
241 t(l, "L)L", "unsigned long long", "ull_plus_one", "(unsigned long long)", ' -1 => input exc:', i=( -1,), r=Exception) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
242 t(l, "L)L", "unsigned long long", "ull_plus_one", "(unsigned long long)", '18446744073709551616 => input exc:', i=(18446744073709551616,), r=Exception) |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
243 |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
244 t(l, "p)Z", "const char*", "ccp_plus_one", "(const char*)", ' "w/pointer" => input exc:', i=( 'w/pointer',), r=Exception) # string object, not passable as 'p'ointer |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
245 t(l, "p)Z", "const char*", "ccp_plus_one", "(const char*)", ' "X_unicode" => input exc:', i=(u'X_unicode',), r=Exception) # string object (unicode in Python 2), not passable as 'p'ointer |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
246 t(l, "p)Z", "const char*", "ccp_plus_one", "(const char*)", ' "1less/ptr" => input exc:', i=(b'1less/ptr',), r=Exception) # bytes object, not passable as 'p'ointer |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
247 t(l, "p)p", "const char*", "ccp_plus_one", "(const char*)", ' "x" => input exc:', i=( 'x',), r=Exception) # string object, not passable as 'p'ointer |
9b6cdffd30dd
- further fixes of inccorect overflow errors for int (and long on LLP64 systems)
Tassilo Philipp
parents:
61
diff
changeset
|
248 |