diff --git a/Lib/test/test_pow.py b/Lib/test/test_pow.py index 2b3465c7f96..e88a63d08eb 100644 --- a/Lib/test/test_pow.py +++ b/Lib/test/test_pow.py @@ -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. diff --git a/Objects/abstract.c b/Objects/abstract.c index 5f98a4c0bdd..e77cde38a57 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -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;