mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-04 19:10:09 +01:00
Add the ability to raise a wx.PyAssertionError when a wxASSERT (or other similar debug macros) fail. To do this support for the /RaisesPyException/ annotation is added, but it defaults to turned on for every function or non-ctor method.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@69723 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -619,6 +619,7 @@ from %s import *
|
||||
if method.isCtor:
|
||||
stream.write('sipCpp = %s(%s);\n' % (fname, pnames))
|
||||
else:
|
||||
stream.write('%sPyErr_Clear();\n' % indent+' '*4)
|
||||
if method.type != 'void':
|
||||
stream.write('sipRes = ')
|
||||
if klass:
|
||||
@@ -632,8 +633,7 @@ from %s import *
|
||||
stream.write('%s(sipCpp%s);\n' % (fname, pnames))
|
||||
else:
|
||||
stream.write('%s(%s);\n' % (fname, pnames))
|
||||
stream.write(indent+' '*4)
|
||||
stream.write('if (PyErr_Occurred()) sipIsErr = 1;\n')
|
||||
stream.write('%sif (PyErr_Occurred()) sipIsErr = 1;\n' % indent+' '*4)
|
||||
stream.write('%s%%End\n' % indent)
|
||||
|
||||
# and finally, add the new function itself
|
||||
@@ -753,6 +753,15 @@ from %s import *
|
||||
annotations.append('ReleaseGIL')
|
||||
if item.noCopy:
|
||||
annotations.append('NoCopy')
|
||||
if item.pyRaisesException:
|
||||
# is it a class method?
|
||||
if isinstance(item, extractors.MethodDef):
|
||||
if not item.isCtor and not item.isDtor:
|
||||
annotations.append('RaisesPyException')
|
||||
# otherwise it's a plain function so no additional conditions
|
||||
# need to be checked
|
||||
else:
|
||||
annotations.append('RaisesPyException')
|
||||
|
||||
if isinstance(item, extractors.MethodDef):
|
||||
if item.defaultCtor:
|
||||
|
||||
Reference in New Issue
Block a user