Commit 8e3775b8 authored by Stefan Behnel's avatar Stefan Behnel

Revert "Add support for pow operator."

This reverts commit d849fb23.
parent a442b59d
...@@ -1906,13 +1906,6 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -1906,13 +1906,6 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
if scope.directives['c_api_binop_methods']: if scope.directives['c_api_binop_methods']:
code.putln('#define %s %s' % (func_name, slot.left_slot.slot_code(scope))) code.putln('#define %s %s' % (func_name, slot.left_slot.slot_code(scope)))
else: else:
if slot.left_slot.signature == TypeSlots.binaryfunc:
extra_arg = extra_arg_decl = ''
elif slot.left_slot.signature == TypeSlots.ternaryfunc:
extra_arg = ', extra_arg'
extra_arg_decl = ', PyObject* extra_arg'
else:
error(entry.pos, "Unexpected type lost signature: %s" % slot)
def has_slot_method(method_name): def has_slot_method(method_name):
entry = scope.lookup(method_name) entry = scope.lookup(method_name)
return bool(entry and entry.is_special and entry.func_cname) return bool(entry and entry.is_special and entry.func_cname)
...@@ -1923,7 +1916,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -1923,7 +1916,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
else: else:
operands = "left, right" operands = "left, right"
if entry and entry.is_special and entry.func_cname: if entry and entry.is_special and entry.func_cname:
return "%s(%s%s)" % (entry.func_cname, operands, extra_arg) return "%s(%s)" % (entry.func_cname, operands)
else: else:
py_ident = code.intern_identifier(EncodedString(method_name)) py_ident = code.intern_identifier(EncodedString(method_name))
return "%s_maybe_call_super(%s, %s)" % (func_name, operands, py_ident) return "%s_maybe_call_super(%s, %s)" % (func_name, operands, py_ident)
...@@ -1937,8 +1930,6 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -1937,8 +1930,6 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
"call_left": call_slot_method(slot.left_slot.method_name, reverse=False), "call_left": call_slot_method(slot.left_slot.method_name, reverse=False),
"call_right": call_slot_method(slot.right_slot.method_name, reverse=True), "call_right": call_slot_method(slot.right_slot.method_name, reverse=True),
"type_cname": '((PyTypeObject*) %s)' % scope.namespace_cname, "type_cname": '((PyTypeObject*) %s)' % scope.namespace_cname,
"extra_arg": extra_arg,
"extra_arg_decl": extra_arg_decl,
}).impl.strip()) }).impl.strip())
code.putln() code.putln()
if preprocessor_guard: if preprocessor_guard:
......
...@@ -281,7 +281,7 @@ __PYX_GOOD: ...@@ -281,7 +281,7 @@ __PYX_GOOD:
/////////////// BinopSlot /////////////// /////////////// BinopSlot ///////////////
static CYTHON_INLINE PyObject *{{func_name}}_maybe_call_super(PyObject *self, PyObject *other, PyObject* name {{extra_arg_decl}}) { static CYTHON_INLINE PyObject *{{func_name}}_maybe_call_super(PyObject *self, PyObject *other, PyObject* name) {
PyObject *res; PyObject *res;
PyObject *method; PyObject *method;
if (!Py_TYPE(self)->tp_base) { if (!Py_TYPE(self)->tp_base) {
...@@ -293,11 +293,7 @@ static CYTHON_INLINE PyObject *{{func_name}}_maybe_call_super(PyObject *self, Py ...@@ -293,11 +293,7 @@ static CYTHON_INLINE PyObject *{{func_name}}_maybe_call_super(PyObject *self, Py
PyErr_Clear(); PyErr_Clear();
return Py_INCREF(Py_NotImplemented), Py_NotImplemented; return Py_INCREF(Py_NotImplemented), Py_NotImplemented;
} }
#if {{int(not extra_arg)}}
res = __Pyx_PyObject_Call2Args(method, self, other); res = __Pyx_PyObject_Call2Args(method, self, other);
#else
res = PyObject_CallFunctionObjArgs(method, self, other {{extra_arg}}, NULL);
#endif
Py_DECREF(method); Py_DECREF(method);
if (!res) { if (!res) {
return Py_INCREF(Py_NotImplemented), Py_NotImplemented; return Py_INCREF(Py_NotImplemented), Py_NotImplemented;
...@@ -305,7 +301,7 @@ static CYTHON_INLINE PyObject *{{func_name}}_maybe_call_super(PyObject *self, Py ...@@ -305,7 +301,7 @@ static CYTHON_INLINE PyObject *{{func_name}}_maybe_call_super(PyObject *self, Py
return res; return res;
} }
static PyObject *{{func_name}}(PyObject *left, PyObject *right {{extra_arg_decl}}) { static PyObject *{{func_name}}(PyObject *left, PyObject *right) {
PyObject *res; 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)
......
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