code.error_goto_if_null(self.result(), self.pos)))
code.put_gotref(self.py_result())
-class PyCFunctionNode(AtomicExprNode):
+
+class PyCFunctionNode(ExprNode):
# Helper class used in the implementation of Python
# class definitions. Constructs a PyCFunction object
# from a PyMethodDef struct.
import Naming
import PyrexTypes
import TypeSlots
- from PyrexTypes import py_object_type, error_type, CTypedefType, CFuncType
+ from PyrexTypes import py_object_type, error_type, CFuncType
-from Symtab import ModuleScope, LocalScope, GeneratorLocalScope, \
+from Symtab import ModuleScope, LocalScope, ClosureScope, \
- StructOrUnionScope, PyClassScope, CClassScope
+ StructOrUnionScope, PyClassScope, CClassScope, CppClassScope
from Cython.Utils import open_new_file, replace_suffix
from Code import UtilityCode
- from StringEncoding import EncodedString, escape_byte_string, split_docstring
+ from StringEncoding import EncodedString, escape_byte_string, split_string_literal
import Options
import ControlFlow
import DebugFlags
cname = name
else:
cname = self.mangle(Naming.var_prefix, name)
+ if type.is_cpp_class and visibility != 'extern':
+ constructor = type.scope.lookup(u'<init>')
+ if constructor is not None and PyrexTypes.best_match([], constructor.all_alternatives()) is None:
+ error(pos, "C++ class must have an empty constructor to be stack allocated")
entry = self.declare(name, cname, type, pos, visibility)
entry.is_variable = 1
- self.control_flow.set_state((), (name, 'initalized'), False)
+ self.control_flow.set_state((), (name, 'initialized'), False)
return entry
def declare_builtin(self, name, pos):