Python code generated with '-builtin -modernargs' segfaults for any method taking zero arguments.
Also fixes: "SystemError: error return without exception set" during error checking when using just -builtin and the incorrect number of arguments is passed to a class method expecting zero arguments. Closes #256 Closes #382
This commit is contained in:
parent
e4d02d20ad
commit
416277b3a5
4 changed files with 61 additions and 8 deletions
44
Examples/test-suite/python/template_classes_runme.py
Normal file
44
Examples/test-suite/python/template_classes_runme.py
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
from template_classes import *
|
||||
|
||||
# This test is just testing incorrect number of arguments/parameters checking
|
||||
|
||||
point = PointInt()
|
||||
|
||||
rectangle = RectangleInt()
|
||||
rectangle.setPoint(point)
|
||||
rectangle.getPoint()
|
||||
RectangleInt.static_noargs()
|
||||
RectangleInt.static_onearg(1)
|
||||
|
||||
fail = True
|
||||
try:
|
||||
rectangle.setPoint()
|
||||
except TypeError, e:
|
||||
fail = False
|
||||
if fail:
|
||||
raise RuntimeError("argument count check failed")
|
||||
|
||||
|
||||
fail = True
|
||||
try:
|
||||
rectangle.getPoint(0)
|
||||
except TypeError, e:
|
||||
fail = False
|
||||
if fail:
|
||||
raise RuntimeError("argument count check failed")
|
||||
|
||||
fail = True
|
||||
try:
|
||||
RectangleInt.static_noargs(0)
|
||||
except TypeError, e:
|
||||
fail = False
|
||||
if fail:
|
||||
raise RuntimeError("argument count check failed")
|
||||
|
||||
fail = True
|
||||
try:
|
||||
RectangleInt.static_onearg()
|
||||
except TypeError, e:
|
||||
fail = False
|
||||
if fail:
|
||||
raise RuntimeError("argument count check failed")
|
||||
Loading…
Add table
Add a link
Reference in a new issue