From d883088aa54590d47b6fbf032031993340c6e9f5 Mon Sep 17 00:00:00 2001 From: Vitja Makarov Date: Sun, 12 Dec 2010 18:31:50 +0300 Subject: [PATCH] Rename stuff from CyGenerator to __Pyx_Generator --- Cython/Compiler/ExprNodes.py | 32 +++++++++++++------------- Cython/Compiler/ParseTreeTransforms.py | 18 +++++++-------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 79f09966..afd550d5 100755 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -8302,15 +8302,15 @@ int %(binding_cfunc)s_init(void) { generator_utility_code = UtilityCode( proto=""" -static PyObject *__CyGenerator_Next(PyObject *self); -static PyObject *__CyGenerator_Send(PyObject *self, PyObject *value); -static PyObject *__CyGenerator_Close(PyObject *self); -static PyObject *__CyGenerator_Throw(PyObject *gen, PyObject *args, CYTHON_UNUSED PyObject *kwds); +static PyObject *__Pyx_Generator_Next(PyObject *self); +static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value); +static PyObject *__Pyx_Generator_Close(PyObject *self); +static PyObject *__Pyx_Generator_Throw(PyObject *gen, PyObject *args, CYTHON_UNUSED PyObject *kwds); -typedef PyObject *(*__cygenerator_body_t)(PyObject *, PyObject *); +typedef PyObject *(*__pyx_generator_body_t)(PyObject *, PyObject *); """, impl=""" -static CYTHON_INLINE PyObject *__CyGenerator_SendEx(struct __CyGenerator *self, PyObject *value) +static CYTHON_INLINE PyObject *__Pyx_Generator_SendEx(struct __pyx_Generator_object *self, PyObject *value) { PyObject *retval; @@ -8341,22 +8341,22 @@ static CYTHON_INLINE PyObject *__CyGenerator_SendEx(struct __CyGenerator *self, return retval; } -static PyObject *__CyGenerator_Next(PyObject *self) +static PyObject *__Pyx_Generator_Next(PyObject *self) { - return __CyGenerator_SendEx((struct __CyGenerator *) self, Py_None); + return __Pyx_Generator_SendEx((struct __pyx_Generator_object *) self, Py_None); } -static PyObject *__CyGenerator_Send(PyObject *self, PyObject *value) +static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value) { - return __CyGenerator_SendEx((struct __CyGenerator *) self, value); + return __Pyx_Generator_SendEx((struct __pyx_Generator_object *) self, value); } -static PyObject *__CyGenerator_Close(PyObject *self) +static PyObject *__Pyx_Generator_Close(PyObject *self) { - struct __CyGenerator *generator = (struct __CyGenerator *) self; + struct __pyx_Generator_object *generator = (struct __pyx_Generator_object *) self; PyObject *retval; PyErr_SetNone(PyExc_GeneratorExit); - retval = __CyGenerator_SendEx(generator, NULL); + retval = __Pyx_Generator_SendEx(generator, NULL); if (retval) { Py_DECREF(retval); PyErr_SetString(PyExc_RuntimeError, @@ -8373,9 +8373,9 @@ static PyObject *__CyGenerator_Close(PyObject *self) return NULL; } -static PyObject *__CyGenerator_Throw(PyObject *self, PyObject *args, CYTHON_UNUSED PyObject *kwds) +static PyObject *__Pyx_Generator_Throw(PyObject *self, PyObject *args, CYTHON_UNUSED PyObject *kwds) { - struct __CyGenerator *generator = (struct __CyGenerator *) self; + struct __pyx_Generator_object *generator = (struct __pyx_Generator_object *) self; PyObject *typ; PyObject *tb = NULL; PyObject *val = NULL; @@ -8383,7 +8383,7 @@ static PyObject *__CyGenerator_Throw(PyObject *self, PyObject *args, CYTHON_UNUS if (!PyArg_UnpackTuple(args, "throw", 1, 3, &typ, &val, &tb)) return NULL; __Pyx_Raise(typ, val, tb); - return __CyGenerator_SendEx(generator, NULL); + return __Pyx_Generator_SendEx(generator, NULL); } """, proto_block='utility_code_proto_before_types', diff --git a/Cython/Compiler/ParseTreeTransforms.py b/Cython/Compiler/ParseTreeTransforms.py index d0e4da9c..777968e6 100644 --- a/Cython/Compiler/ParseTreeTransforms.py +++ b/Cython/Compiler/ParseTreeTransforms.py @@ -1433,18 +1433,18 @@ class CreateClosureClasses(CythonTransform): if self.generator_class: return self.generator_class # XXX: make generator class creation cleaner - entry = target_module_scope.declare_c_class(name='__CyGenerator', - objstruct_cname='__CyGenerator', - typeobj_cname='__CyGeneratorType', + entry = target_module_scope.declare_c_class(name='__pyx_Generator', + objstruct_cname='__pyx_Generator_object', + typeobj_cname='__pyx_Generator_type', pos=pos, defining=True, implementing=True) - entry.cname = 'CyGenerator' + entry.cname = 'Generator' klass = entry.type.scope klass.is_internal = True klass.directives = {'final': True} body_type = PyrexTypes.create_typedef_type('generator_body', PyrexTypes.c_void_ptr_type, - '__cygenerator_body_t') + '__pyx_generator_body_t') klass.declare_var(pos=pos, name='body', cname='body', type=body_type, is_cdef=True) klass.declare_var(pos=pos, name='is_running', cname='is_running', type=PyrexTypes.c_int_type, @@ -1454,22 +1454,22 @@ class CreateClosureClasses(CythonTransform): import TypeSlots e = klass.declare_pyfunction('send', pos) - e.func_cname = '__CyGenerator_Send' + e.func_cname = '__Pyx_Generator_Send' e.signature = TypeSlots.binaryfunc e = klass.declare_pyfunction('close', pos) - e.func_cname = '__CyGenerator_Close' + e.func_cname = '__Pyx_Generator_Close' e.signature = TypeSlots.unaryfunc e = klass.declare_pyfunction('throw', pos) - e.func_cname = '__CyGenerator_Throw' + e.func_cname = '__Pyx_Generator_Throw' e.signature = TypeSlots.pyfunction_signature e = klass.declare_var('__iter__', PyrexTypes.py_object_type, pos, visibility='public') e.func_cname = 'PyObject_SelfIter' e = klass.declare_var('__next__', PyrexTypes.py_object_type, pos, visibility='public') - e.func_cname = '__CyGenerator_Next' + e.func_cname = '__Pyx_Generator_Next' self.generator_class = entry.type return self.generator_class -- 2.26.2