Fix Python 3 inconsistency handling -ve numbers for unsigned C types.
An OverFlow error is now consistently thrown instead of a TypeError. Fixes primitive_types testcase for Python 3
This commit is contained in:
parent
3e188e508d
commit
5481270c2a
3 changed files with 56 additions and 3 deletions
|
|
@ -275,10 +275,22 @@ try:
|
|||
except TypeError:
|
||||
if a != t.var_char:
|
||||
error = 1
|
||||
pass
|
||||
pass
|
||||
if error:
|
||||
raise RuntimeError, "bad char typemap"
|
||||
|
||||
try:
|
||||
error = 0
|
||||
a = t.var_ushort
|
||||
t.var_ushort = -1
|
||||
error = 1
|
||||
except OverflowError:
|
||||
if a != t.var_ushort:
|
||||
error = 1
|
||||
pass
|
||||
if error:
|
||||
raise RuntimeError, "bad ushort typemap"
|
||||
|
||||
try:
|
||||
error = 0
|
||||
a = t.var_uint
|
||||
|
|
@ -287,10 +299,34 @@ try:
|
|||
except OverflowError:
|
||||
if a != t.var_uint:
|
||||
error = 1
|
||||
pass
|
||||
pass
|
||||
if error:
|
||||
raise RuntimeError, "bad uint typemap"
|
||||
|
||||
try:
|
||||
error = 0
|
||||
a = t.var_sizet
|
||||
t.var_sizet = -1
|
||||
error = 1
|
||||
except OverflowError:
|
||||
if a != t.var_sizet:
|
||||
error = 1
|
||||
pass
|
||||
if error:
|
||||
raise RuntimeError, "bad sizet typemap"
|
||||
|
||||
try:
|
||||
error = 0
|
||||
a = t.var_ulong
|
||||
t.var_ulong = -1
|
||||
error = 1
|
||||
except OverflowError:
|
||||
if a != t.var_ulong:
|
||||
error = 1
|
||||
pass
|
||||
if error:
|
||||
raise RuntimeError, "bad ulong typemap"
|
||||
|
||||
#
|
||||
#
|
||||
try:
|
||||
|
|
@ -301,7 +337,7 @@ try:
|
|||
except TypeError:
|
||||
if a != t.var_namet:
|
||||
error = 1
|
||||
pass
|
||||
pass
|
||||
if error:
|
||||
raise RuntimeError, "bad namet typemap"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue