]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix typo in abstract.c which caused __rpow__ to not be invoked.
authorRaymond Hettinger <python@rcn.com>
Sat, 7 Dec 2002 10:15:38 +0000 (10:15 +0000)
committerRaymond Hettinger <python@rcn.com>
Sat, 7 Dec 2002 10:15:38 +0000 (10:15 +0000)
Added related testcase.
Closes SF bug #643260.

Lib/test/test_pow.py
Objects/abstract.c

index 64c58900504420ebad018b8b81db13c917cbfe5d..7b067c3a4147f4dd5ab37487bfca44ce8ed50043 100644 (file)
@@ -118,3 +118,8 @@ for i in range(-10, 11):
                 o = pow(long(i),j) % k
                 n = pow(long(i),j,k)
                 if o != n: print 'Integer mismatch:', i,j,k
+
+class TestRpow:
+    def __rpow__(self, other):
+        return None
+None ** TestRpow()      # Won't fail when __rpow__ invoked.  SF bug #643260.
index 1d574da6575f96a95aacdc6bd9731d97d2389fb5..8aee6ac124f45808609e488787e2043340d91e0a 100644 (file)
@@ -468,7 +468,7 @@ ternary_op(PyObject *v,
        if (mv != NULL && NEW_STYLE_NUMBER(v))
                slotv = *NB_TERNOP(mv, op_slot);
        if (w->ob_type != v->ob_type &&
-           mv != NULL && NEW_STYLE_NUMBER(w)) {
+            mw != NULL && NEW_STYLE_NUMBER(w)) {
                slotw = *NB_TERNOP(mw, op_slot);
                if (slotw == slotv)
                        slotw = NULL;