From: Raymond Hettinger Date: Sat, 7 Dec 2002 10:05:27 +0000 (+0000) Subject: Fix typo in abstract.c which caused __rpow__ to not be invoked. X-Git-Tag: v2.3c1~3098 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c2e095f6f4bc7234442c704919429bfbe39b00c3;p=python Fix typo in abstract.c which caused __rpow__ to not be invoked. Added related testcase. Closes SF bug #643260. --- diff --git a/Lib/test/test_pow.py b/Lib/test/test_pow.py index 2b3465c7f9..e88a63d08e 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 5f98a4c0bd..e77cde38a5 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;