Fix protected constructor issues.

This commit is contained in:
Gustavo J. A. M. Carneiro committed 2008-07-06 15:53:04 +01:00
1 parent 3ee54f6ed8
commit bfbfcbdefe
2 files changed
+6 -5

No files matched your search

+3 -2
View File
@@ -396,9 +396,10 @@ class CppConstructor(ForwardWrapperBase):
self.before_call.write_code("} else {")
self.before_call.indent()
self.before_call.write_code("// visibility: %r" % self.visibility)
try:
if self.visibility not in ['public', 'protected']:
raise CodeGenerationError("private constructor")
if self.visibility not in ['public']:
raise CodeGenerationError("private/protected constructor")
class_.get_construct_name()
except CodeGenerationError:
self.before_call.write_code('PyErr_SetString(PyExc_TypeError, "class \'%s\' '