[issue41903] PyNumber_InPlacePower ignores o3 if o1 implements __ipow__

2020-10-01 Thread Ammar Askar
Ammar Askar added the comment: Whoops, forgot the numpy link: https://github.com/numpy/numpy/blob/33e1dbee8d9e11a3e96efaae822ff6f3c44e3cef/numpy/core/src/multiarray/number.c#L729-L741 -- ___ Python tracker

[issue41903] PyNumber_InPlacePower ignores o3 if o1 implements __ipow__

2020-10-01 Thread Ammar Askar
Ammar Askar added the comment: Also of note, there is actually no way to call `PyNumber_InPlacePower` from pure python from what I can tell. Even libraries like numpy don't implement the three-argument version of the nb_inplace_power slot. -- ___

[issue41903] PyNumber_InPlacePower ignores o3 if o1 implements __ipow__

2020-10-01 Thread Ammar Askar
Change by Ammar Askar : -- nosy: +brett.cannon ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue41903] PyNumber_InPlacePower ignores o3 if o1 implements __ipow__

2020-10-01 Thread Ammar Askar
Ammar Askar added the comment: Huh, this is weird. I wonder why the data model provides the signature object.__ipow__(self, other[, modulo]) if the slot always seems to drop the third argument. Adding Brett to the nosy who found another issue around the special casing of pow/** recently.

[issue41903] PyNumber_InPlacePower ignores o3 if o1 implements __ipow__

2020-10-01 Thread Simon Cross
Simon Cross added the comment: The documentation for __ipow__ [4] suggests that the intention was to support the modulus argument, so perhaps that argues for fixing the behaviour of PyNumber_InPlacePower. [4] https://docs.python.org/3/reference/datamodel.html#object.__ipow__ --

[issue41903] PyNumber_InPlacePower ignores o3 if o1 implements __ipow__

2020-10-01 Thread Simon Cross
New submission from Simon Cross : The documentation for PyNumber_InPlacePower [1] reads: This is the equivalent of the Python statement o1 **= o2 when o3 is Py_None, or an in-place variant of pow(o1, o2, o3) otherwise. If o3 is to be ignored, pass Py_None in its place (passing NULL for o3