summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2007-02-09 12:19:32 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2007-02-09 12:19:32 (GMT)
commitfd963265e21686fb306eaa3f0e63c15bfdbcc9ba (patch)
treebebc35e7c6041ccb76c6b3fc76b34b8ee1d5a086
parent209de1f6ca1beaaa6b5eeb413f02e9c8c334ee50 (diff)
downloadcpython-fd963265e21686fb306eaa3f0e63c15bfdbcc9ba.zip
cpython-fd963265e21686fb306eaa3f0e63c15bfdbcc9ba.tar.gz
cpython-fd963265e21686fb306eaa3f0e63c15bfdbcc9ba.tar.bz2
Bug #1653736: Properly discard third argument to slot_nb_inplace_power.
Will backport.
-rw-r--r--Misc/NEWS2
-rw-r--r--Objects/typeobject.c8
2 files changed, 9 insertions, 1 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 25b72c2..faf7d2d 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,8 @@ What's New in Python 2.6 alpha 1?
Core and builtins
-----------------
+- Bug #1653736: Properly discard third argument to slot_nb_inplace_power.
+
- PEP 352: Raising a string exception now triggers a TypeError. Attempting to
catch a string exception raises DeprecationWarning.
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 6ea489a..20b530c 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -4427,7 +4427,13 @@ SLOT1(slot_nb_inplace_subtract, "__isub__", PyObject *, "O")
SLOT1(slot_nb_inplace_multiply, "__imul__", PyObject *, "O")
SLOT1(slot_nb_inplace_divide, "__idiv__", PyObject *, "O")
SLOT1(slot_nb_inplace_remainder, "__imod__", PyObject *, "O")
-SLOT1(slot_nb_inplace_power, "__ipow__", PyObject *, "O")
+/* Can't use SLOT1 here, because nb_inplace_power is ternary */
+static PyObject *
+slot_nb_inplace_power(PyObject *self, PyObject * arg1, PyObject *arg2)
+{
+ static PyObject *cache_str;
+ return call_method(self, "__ipow__", &cache_str, "(" "O" ")", arg1);
+}
SLOT1(slot_nb_inplace_lshift, "__ilshift__", PyObject *, "O")
SLOT1(slot_nb_inplace_rshift, "__irshift__", PyObject *, "O")
SLOT1(slot_nb_inplace_and, "__iand__", PyObject *, "O")