From c050817daa1b73ee17a7c891770f518173eb77b5 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Sat, 25 Oct 2008 14:44:10 +0200 Subject: [PATCH] fixes after last commit --- Cython/Compiler/PyrexTypes.py | 3 ++- Cython/Compiler/Symtab.py | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Cython/Compiler/PyrexTypes.py b/Cython/Compiler/PyrexTypes.py index 9e4a3c20..d0b9ab5c 100644 --- a/Cython/Compiler/PyrexTypes.py +++ b/Cython/Compiler/PyrexTypes.py @@ -2,6 +2,7 @@ # Pyrex - Types # +from Cython.Utils import UtilityCode import StringEncoding import Naming import copy @@ -982,7 +983,7 @@ class CStructOrUnionType(CType): 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 diff --git a/Cython/Compiler/Symtab.py b/Cython/Compiler/Symtab.py index 6700807e..a7f58560 100644 --- a/Cython/Compiler/Symtab.py +++ b/Cython/Compiler/Symtab.py @@ -766,7 +766,7 @@ class ModuleScope(Scope): # 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 @@ -1512,11 +1512,12 @@ class PropertyScope(Scope): # 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)) { */ @@ -1533,5 +1534,4 @@ static PyObject* __Pyx_Method_ClassMethod(PyObject *method) { PyErr_Format(PyExc_TypeError, "Class-level classmethod() can only be called on a method_descriptor or instance method."); return NULL; } -""" -] +""") -- 2.26.2