Don't even try to generate code for CppDummyMethod's, they were never meant to generate code.

This commit is contained in:
Gustavo J. A. M. Carneiro committed 2008-07-06 14:54:23 +01:00
1 parent e1f813d97e
commit b809e6c15a
2 files changed
+19 -15

No files matched your search

+13 -9
View File
@@ -83,16 +83,20 @@ class CppHelperClass(object):
if method.matches_signature(existing):
return # don't re-add already existing method
self.virtual_methods.append(method)
if not method.is_pure_virtual:
if method.visibility in ['public', 'protected']:
parent_caller = CppVirtualMethodParentCaller(method)
parent_caller.main_wrapper = method
self.add_virtual_parent_caller(parent_caller)
if isinstance(method, CppDummyMethod):
if method.is_pure_virtual:
self.cannot_be_constructed = True
else:
self.virtual_methods.append(method)
if not method.is_pure_virtual:
if method.visibility in ['public', 'protected']:
parent_caller = CppVirtualMethodParentCaller(method)
parent_caller.main_wrapper = method
self.add_virtual_parent_caller(parent_caller)
proxy = CppVirtualMethodProxy(method)
proxy.main_wrapper = method
self.add_virtual_proxy(proxy)
proxy = CppVirtualMethodProxy(method)
proxy.main_wrapper = method
self.add_virtual_proxy(proxy)
def add_virtual_parent_caller(self, parent_caller):
+6 -6
View File
@@ -281,9 +281,9 @@ class DummyReturnValue(ReturnValue):
args, kwargs = utils.parse_retval_spec(arg)
super(DummyReturnValue, self).__init__(args[0])
def convert_c_to_python(self, wrapper):
raise CodeGenerationError
raise TypeError("this is a DummyReturnValue")
def convert_python_to_c(self, wrapper):
raise CodeGenerationError
raise TypeError("this is a DummyReturnValue")
def get_c_error_return(self):
return ''
@@ -308,9 +308,9 @@ class DummyParameter(Parameter):
super(DummyParameter, self).__init__(args[0], args[1])
def convert_c_to_python(self, wrapper):
raise CodeGenerationError
raise TypeError("this is a DummyParameter")
def convert_python_to_c(self, wrapper):
raise CodeGenerationError
raise TypeError("this is a DummyParameter")
class CppDummyMethod(CppMethod):
@@ -397,8 +397,8 @@ class CppConstructor(ForwardWrapperBase):
self.before_call.indent()
try:
if self.visibility != 'public':
raise CodeGenerationError
if self.visibility not in ['public', 'protected']:
raise CodeGenerationError("private constructor")
class_.get_construct_name()
except CodeGenerationError:
self.before_call.write_code('PyErr_SetString(PyExc_TypeError, "class \'%s\' '