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

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

index 2b3465c7f96b316e6a8d0ae9ed17b28df4bc3897..e88a63d08ebc0f204c6a84ec29c65422450972b2 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 5f98a4c0bdd5101ac65001d51d6f19d1d0e869b4..e77cde38a5780dc659f85eef131165cfe92097f1 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;