[New-bugs-announce] [issue38302] __rpow__ not reached when __ipow__ returns NotImplemented
Adi
report at bugs.python.org
Fri Sep 27 17:55:15 EDT 2019
New submission from Adi <deepspace2 at gmail.com>:
Due to shared code between the 2 and 3 forms of pow, the following code causes a TypeError:
class A:
def __init__(self, val):
self.val = val
def __ipow__(self, other):
return NotImplemented
class B:
def __init__(self, val):
self.val = val
def __rpow__(self, other):
return A(other.val ** self.val)
a = A(2)
b = B(2)
a **= b
(https://stackoverflow.com/questions/58141475/ipow-raising-typeerror-when-left-hand-side-object-returns-notimplemented)
----------
components: Interpreter Core
messages: 353419
nosy: DeepSpace
priority: normal
severity: normal
status: open
title: __rpow__ not reached when __ipow__ returns NotImplemented
versions: Python 3.6, Python 3.7
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38302>
_______________________________________
More information about the New-bugs-announce
mailing list