Issue2171
Created on 2014-06-21.23:18:03 by nneonneo, last changed 2015-04-14.14:20:55 by alex.gronholm.
msg8780 (view) |
Author: Robert Xiao (nneonneo) |
Date: 2014-06-21.23:18:03 |
|
`int.__pow__(x, y, None)` returns NotImplemented, whereas `pow(x, y, None)` gives the correct result.
Sample session:
Jython 2.7b2 (default:a5bc0032cf79+, Apr 22 2014, 21:20:17)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_05
Type "help", "copyright", "credits" or "license" for more information.
>>> pow(10,10,None)
10000000000L
>>> int.__pow__(10,10,None)
NotImplemented
>>> (10).__pow__(10, None)
NotImplemented
|
msg8786 (view) |
Author: Santoso Wijaya (santa4nt) |
Date: 2014-06-22.17:37:36 |
|
Caused by not checking for Py.None in PyInteger#___pow__(). Attaching patch.
Also, why are there two different implementations of pow()? __builtin__.pow() and PyInteger#pow(). Seems redundant to me.
|
msg9835 (view) |
Author: Alex Grönholm (alex.gronholm) |
Date: 2015-04-14.14:20:55 |
|
Thanks for the patch!
__builtin__.pow() provides the builtin pow() function, while PyInteger.__pow__() provides the specific implementation for PyInteger, so both are needed.
I applied your patch with one change worthy of notice: (10).__pow__(10L, None) returns NotImplemented on CPython 2.7.9 as well as Jython so I dropped the test for that.
|
|
Date |
User |
Action |
Args |
2015-04-14 14:20:55 | alex.gronholm | set | status: open -> closed resolution: fixed messages:
+ msg9835 |
2015-04-14 05:27:25 | alex.gronholm | set | assignee: alex.gronholm nosy:
+ alex.gronholm |
2014-06-23 15:38:10 | santa4nt | set | files:
+ issue2171.patch |
2014-06-22 17:37:37 | santa4nt | set | files:
+ issue2171.patch keywords:
+ patch messages:
+ msg8786 |
2014-06-22 05:29:54 | santa4nt | set | nosy:
+ santa4nt type: behaviour |
2014-06-21 23:18:03 | nneonneo | create | |
|