Commit bc581d03 authored by Stefan Behnel's avatar Stefan Behnel

Limit the scope of a local variable in a helper function.

parent 7ac25eea
...@@ -340,7 +340,6 @@ static CYTHON_INLINE PyObject *{{func_name}}_maybe_call_slot(PyTypeObject* type, ...@@ -340,7 +340,6 @@ static CYTHON_INLINE PyObject *{{func_name}}_maybe_call_slot(PyTypeObject* type,
} }
static PyObject *{{func_name}}(PyObject *left, PyObject *right {{extra_arg_decl}}) { static PyObject *{{func_name}}(PyObject *left, PyObject *right {{extra_arg_decl}}) {
PyObject *res;
int maybe_self_is_left, maybe_self_is_right = 0; int maybe_self_is_left, maybe_self_is_right = 0;
maybe_self_is_left = Py_TYPE(left) == Py_TYPE(right) maybe_self_is_left = Py_TYPE(left) == Py_TYPE(right)
#if CYTHON_USE_TYPE_SLOTS #if CYTHON_USE_TYPE_SLOTS
...@@ -356,6 +355,7 @@ static PyObject *{{func_name}}(PyObject *left, PyObject *right {{extra_arg_decl} ...@@ -356,6 +355,7 @@ static PyObject *{{func_name}}(PyObject *left, PyObject *right {{extra_arg_decl}
|| __Pyx_TypeCheck(right, {{type_cname}}); || __Pyx_TypeCheck(right, {{type_cname}});
} }
if (maybe_self_is_left) { if (maybe_self_is_left) {
PyObject *res;
if (maybe_self_is_right && !{{overloads_left}}) { if (maybe_self_is_right && !{{overloads_left}}) {
res = {{call_right}}; res = {{call_right}};
if (res != Py_NotImplemented) return res; if (res != Py_NotImplemented) return res;
......
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