[issue29160] pow with three int arguments works like it had two arguments

2017-01-20 Thread Mark Dickinson

Changes by Mark Dickinson :


--
resolution: not a bug -> third party

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29160] pow with three int arguments works like it had two arguments

2017-01-05 Thread Mark Dickinson

Mark Dickinson added the comment:

> shall we make a report for 'numpy guys' directly?

Yes, please! I'll close here, since this isn't a core Python issue: what 3rd 
party libraries choose to do in their `__pow__` methods is out of the control 
of the core language.

--
nosy: +mark.dickinson
resolution:  -> not a bug
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29160] pow with three int arguments works like it had two arguments

2017-01-04 Thread Pavel Chuvakhov

Pavel Chuvakhov added the comment:

Sorry about script, n1 should be n, and n2 should be m. Updated script is 
attached.

Ofc mpz is a way out. One also could cast int( np.int32 ) explicitly. I just 
wanted to underline that the best way is to hide all this stuff from a user and 
not make the user think what kind of int subtypes he should use. Python is a 
pretty language, isn't it? =)

Ones this is bug/limitation of numpy, shall we make a report for 'numpy guys' 
directly?

--
components: +Distutils -Interpreter Core
Added file: http://bugs.python.org/file46148/pow-bug_repor-upd.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29160] pow with three int arguments works like it had two arguments

2017-01-04 Thread Case Van Horsen

Case Van Horsen added the comment:

This is a bug/limitation in numpy. If x and y are Python integers, and type(z) 
is of another numeric type, pow calls the nb_power slot of the underlying type. 
Here a quick example using numpy.int32 and gmpy2.mpz:

>>> import numpy, gmpy2
>>> pow(11,13,7)
4
>>> pow(11,13,numpy.int32(7))
34522712143931
>>> pow(11,13,gmpy2.mpz(7))
mpz(4)


>>> (11).__pow__(13,7)
4
>>> numpy.int32(11).__pow__(13,7)
34522712143931
>>> gmpy2.mpz(11).__pow__(13,7)
mpz(4)


casevh

--
nosy: +casevh

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29160] pow with three int arguments works like it had two arguments

2017-01-04 Thread Jim Fasarakis-Hilliard

Changes by Jim Fasarakis-Hilliard :


--
components: +Interpreter Core -Distutils
title: `pow` with three int arguments works like it had two arguments -> pow 
with three int arguments works like it had two arguments

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29160] `pow` with three int arguments works like it had two arguments

2017-01-04 Thread Benjamin Pollak

Benjamin Pollak added the comment:

I tried running your script, but it crashes on the last two lines (variables n2 
and n1 appear to be undefined). Could you please update that script so we can 
have a better idea of the behavior of your bug?

Thanks,
BP

--
nosy: +Benjamin Pollak

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29160] `pow` with three int arguments works like it had two arguments

2017-01-04 Thread Pavel Chuvakhov

New submission from Pavel Chuvakhov:

Standard `pow` function of three integer arguments should result in a reminder 
`(x**y) % z`. It seems that `pow(x,y,z)` ignores `%z` operation if type(z) is 
not `int`. This happens also in the cases when `z` has type numpy.int32, 
numpy.int64, etc. I consider such a behavior of `pow` as a bug to be fixed.

Thank you for your attantion, guys!
Best wishes, Pavel.

--
components: Distutils
files: pow-bug_report.py
messages: 284675
nosy: dstufft, eric.araujo, pch
priority: normal
severity: normal
status: open
title: `pow` with three int arguments works like it had two arguments
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file46146/pow-bug_report.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com