# Pyrex - Types
#
+from Cython.Utils import UtilityCode
import StringEncoding
import Naming
import copy
entry = env.lookup(self.name)
if entry.visibility != 'extern':
proto = self.declaration_code('') + ';\n' + proto
- self._convert_code = proto, code.buffer.getvalue()
+ self._convert_code = UtilityCode(proto=proto, impl=code.buffer.getvalue())
env.use_utility_code(self._convert_code)
return True
# doc string Module doc string
# doc_cname string C name of module doc string
# const_counter integer Counter for naming constants (PS: MOVED TO GLOBAL)
- # utility_code_list [((string, string), string)] Queuing utility codes for forwarding to Code.py
+ # utility_code_list [(UtilityCode, string)] Queuing utility codes for forwarding to Code.py
# default_entries [Entry] Function argument default entries
# python_include_files [string] Standard Python headers to be included
# include_files [string] Other C headers to be included
# Should this go elsewhere (and then get imported)?
#------------------------------------------------------------------------------------
-classmethod_utility_code = [
-"""
+classmethod_utility_code = Utils.UtilityCode(
+proto = """
#include "descrobject.h"
static PyObject* __Pyx_Method_ClassMethod(PyObject *method); /*proto*/
-""","""
+""",
+impl = """
static PyObject* __Pyx_Method_ClassMethod(PyObject *method) {
/* It appears that PyMethodDescr_Type is not anywhere exposed in the Python/C API */
/* if (!PyObject_TypeCheck(method, &PyMethodDescr_Type)) { */
PyErr_Format(PyExc_TypeError, "Class-level classmethod() can only be called on a method_descriptor or instance method.");
return NULL;
}
-"""
-]
+""")