Commit d883088a authored by Vitja Makarov's avatar Vitja Makarov

Rename stuff from CyGenerator to __Pyx_Generator

parent fd94a2bd
......@@ -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',
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment