diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2020-06-17 13:10:30 +0200 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2020-06-17 13:10:30 +0200 |
commit | 8e3775b8e708c593d3803276288e34e859c31b26 (patch) | |
tree | 25e8f12dbc81d6f2b623b9c42759807d7648db83 | |
parent | a442b59d9091f03740fe455f68cd3fd40a4b7c23 (diff) | |
download | cython-8e3775b8e708c593d3803276288e34e859c31b26.tar.gz |
Revert "Add support for pow operator."
This reverts commit d849fb2379f4f892c8374b52385991c399c31a49.
-rw-r--r-- | Cython/Compiler/ModuleNode.py | 11 | ||||
-rw-r--r-- | Cython/Utility/ExtensionTypes.c | 8 |
2 files changed, 3 insertions, 16 deletions
diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py index 0f1986097..6437038b5 100644 --- a/Cython/Compiler/ModuleNode.py +++ b/Cython/Compiler/ModuleNode.py @@ -1906,13 +1906,6 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): if scope.directives['c_api_binop_methods']: code.putln('#define %s %s' % (func_name, slot.left_slot.slot_code(scope))) 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): entry = scope.lookup(method_name) return bool(entry and entry.is_special and entry.func_cname) @@ -1923,7 +1916,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): else: operands = "left, right" 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: py_ident = code.intern_identifier(EncodedString(method_name)) return "%s_maybe_call_super(%s, %s)" % (func_name, operands, py_ident) @@ -1937,8 +1930,6 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): "call_left": call_slot_method(slot.left_slot.method_name, reverse=False), "call_right": call_slot_method(slot.right_slot.method_name, reverse=True), "type_cname": '((PyTypeObject*) %s)' % scope.namespace_cname, - "extra_arg": extra_arg, - "extra_arg_decl": extra_arg_decl, }).impl.strip()) code.putln() if preprocessor_guard: diff --git a/Cython/Utility/ExtensionTypes.c b/Cython/Utility/ExtensionTypes.c index a60d73d0d..d34916642 100644 --- a/Cython/Utility/ExtensionTypes.c +++ b/Cython/Utility/ExtensionTypes.c @@ -281,7 +281,7 @@ __PYX_GOOD: /////////////// 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 *method; if (!Py_TYPE(self)->tp_base) { @@ -293,11 +293,7 @@ static CYTHON_INLINE PyObject *{{func_name}}_maybe_call_super(PyObject *self, Py PyErr_Clear(); return Py_INCREF(Py_NotImplemented), Py_NotImplemented; } - #if {{int(not extra_arg)}} res = __Pyx_PyObject_Call2Args(method, self, other); - #else - res = PyObject_CallFunctionObjArgs(method, self, other {{extra_arg}}, NULL); - #endif Py_DECREF(method); if (!res) { return Py_INCREF(Py_NotImplemented), Py_NotImplemented; @@ -305,7 +301,7 @@ static CYTHON_INLINE PyObject *{{func_name}}_maybe_call_super(PyObject *self, Py return res; } -static PyObject *{{func_name}}(PyObject *left, PyObject *right {{extra_arg_decl}}) { +static PyObject *{{func_name}}(PyObject *left, PyObject *right) { PyObject *res; int maybe_self_is_left, maybe_self_is_right = 0; maybe_self_is_left = Py_TYPE(left) == Py_TYPE(right) |