<div dir="auto">It's possible we should back off to just issuing a deprecation warning in 1.12?</div><div class="gmail_extra"><br><div class="gmail_quote">On Jan 3, 2017 1:47 PM, "Yaroslav Halchenko" <<a href="mailto:lists@onerussian.com">lists@onerussian.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
On Tue, 03 Jan 2017, Stephan Hoyer wrote:<br>
<br>
>    On Tue, Jan 3, 2017 at 9:00 AM, Yaroslav Halchenko <<a href="mailto:lists@onerussian.com">lists@onerussian.com</a>><br>
>    wrote:<br>
<br>
>      Sorry for coming too late to the discussion and after PR "addressing"<br>
>      the issue by issuing an error was merged [1].A  I got burnt by new<br>
>      behavior while trying to build fresh pandas release on Debian (we are<br>
>      freezing for release way too soon ;) ) -- some pandas tests failed since<br>
>      they rely on previous non-erroring behavior and we gotA  numpy 1.12.0~b1<br>
>      which included [1] in unstable/testing (candidate release) now.<br>
<br>
>      I quickly glanced over the discussion but I guess I have missed<br>
>      actual description of the problem being fixed here...A  what was it??<br>
<br>
>      previous behavior, int**int->int made sense to me as it seemed to be<br>
>      consistent with casting Python's pow result to int, somewhat fulfilling<br>
>      desired promise for in-place operations and being inline with built-in<br>
>      pow results as far as I see it (up to casting).<br>
<br>
>    I believe this is exactly the behavior we preserved. Rather, we turned<br>
>    some cases that previously often gave wrong results (involving negative<br>
>    integer powers) into errors.<br>
<br>
hm... testing on current master (first result is from python's pow)<br>
<br>
$> python -c "import numpy; print('numpy version: ', numpy.__version__); a=2; b=-2;  print(pow(a,b)); print(pow(numpy.array(a), b))"<br>
('numpy version: ', '1.13.0.dev0+02e2ea8')<br>
0.25<br>
Traceback (most recent call last):<br>
  File "<string>", line 1, in <module><br>
ValueError: Integers to negative integer powers are not allowed.<br>
<br>
<br>
testing on Debian's packaged beta<br>
<br>
$> python -c "import numpy; print('numpy version: ', numpy.__version__); a=2; b=-2;  print(pow(a,b)); print(pow(numpy.array(a), b))"<br>
('numpy version: ', '1.12.0b1')<br>
0.25<br>
Traceback (most recent call last):<br>
  File "<string>", line 1, in <module><br>
ValueError: Integers to negative integer powers are not allowed.<br>
<br>
<br>
testing on stable debian box with elderly numpy, where it does behave sensibly:<br>
<br>
$> python -c "import numpy; print('numpy version: ', numpy.__version__); a=2; b=-2;  print(pow(a,b)); print(pow(numpy.array(a), b))"<br>
('numpy version: ', '1.8.2')<br>
0.25<br>
0<br>
<br>
what am I missing?<br>
<br>
>    The pandas test suite triggered this behavior, but not intentionally, and<br>
>    should be fixed in the next release:<br>
>    <a href="https://github.com/pandas-dev/pandas/pull/14498" rel="noreferrer" target="_blank">https://github.com/pandas-dev/<wbr>pandas/pull/14498</a><br>
<br>
I don't think that was the full set of cases, e.g.<br>
<br>
(git)hopa/sid-i386:~exppsy/<wbr>pandas[bf-i386]<br>
$> nosetests -s -v pandas/tests/test_expressions.<wbr>py:TestExpressions.test_mixed_<wbr>arithmetic_series<br>
test_mixed_arithmetic_series (pandas.tests.test_<wbr>expressions.TestExpressions) ... ERROR<br>
<br>
==============================<wbr>==============================<wbr>==========<br>
ERROR: test_mixed_arithmetic_series (pandas.tests.test_<wbr>expressions.TestExpressions)<br>
------------------------------<wbr>------------------------------<wbr>----------<br>
Traceback (most recent call last):<br>
  File "/home/yoh/deb/gits/pkg-<wbr>exppsy/pandas/pandas/tests/<wbr>test_expressions.py", line 223, in test_mixed_arithmetic_series<br>
    self.run_series(self.mixed2[<wbr>col], self.mixed2[col], binary_comp=4)<br>
  File "/home/yoh/deb/gits/pkg-<wbr>exppsy/pandas/pandas/tests/<wbr>test_expressions.py", line 164, in run_series<br>
    test_flex=False, **kwargs)<br>
  File "/home/yoh/deb/gits/pkg-<wbr>exppsy/pandas/pandas/tests/<wbr>test_expressions.py", line 93, in run_arithmetic_test<br>
    expected = op(df, other)<br>
  File "/home/yoh/deb/gits/pkg-<wbr>exppsy/pandas/pandas/core/ops.<wbr>py", line 715, in wrapper<br>
    result = wrap_results(safe_na_op(<wbr>lvalues, rvalues))<br>
  File "/home/yoh/deb/gits/pkg-<wbr>exppsy/pandas/pandas/core/ops.<wbr>py", line 676, in safe_na_op<br>
    return na_op(lvalues, rvalues)<br>
  File "/home/yoh/deb/gits/pkg-<wbr>exppsy/pandas/pandas/core/ops.<wbr>py", line 652, in na_op<br>
    raise_on_error=True, **eval_kwargs)<br>
  File "/home/yoh/deb/gits/pkg-<wbr>exppsy/pandas/pandas/<wbr>computation/expressions.py", line 210, in evaluate<br>
    **eval_kwargs)<br>
  File "/home/yoh/deb/gits/pkg-<wbr>exppsy/pandas/pandas/<wbr>computation/expressions.py", line 63, in _evaluate_standard<br>
    return op(a, b)<br>
ValueError: Integers to negative integer powers are not allowed.<br>
<br>
<br>
and being paranoid, I have rebuilt exact current master  of pandas with<br>
master numpy in PYTHONPATH:<br>
<br>
(git)hopa:~exppsy/pandas[<wbr>master]git<br>
$> PYTHONPATH=/home/yoh/proj/<wbr>numpy nosetests -s -v pandas/tests/test_expressions.<wbr>py:TestExpressions.test_mixed_<wbr>arithmetic_series<br>
test_mixed_arithmetic_series (pandas.tests.test_<wbr>expressions.TestExpressions) ... ERROR<br>
<br>
==============================<wbr>==============================<wbr>==========<br>
ERROR: test_mixed_arithmetic_series (pandas.tests.test_<wbr>expressions.TestExpressions)<br>
------------------------------<wbr>------------------------------<wbr>----------<br>
Traceback (most recent call last):<br>
  File "/home/yoh/deb/gits/pkg-<wbr>exppsy/pandas/pandas/tests/<wbr>test_expressions.py", line 223, in test_mixed_arithmetic_series<br>
    self.run_series(self.mixed2[<wbr>col], self.mixed2[col], binary_comp=4)<br>
  File "/home/yoh/deb/gits/pkg-<wbr>exppsy/pandas/pandas/tests/<wbr>test_expressions.py", line 164, in run_series<br>
    test_flex=False, **kwargs)<br>
  File "/home/yoh/deb/gits/pkg-<wbr>exppsy/pandas/pandas/tests/<wbr>test_expressions.py", line 93, in run_arithmetic_test<br>
    expected = op(df, other)<br>
  File "/home/yoh/deb/gits/pkg-<wbr>exppsy/pandas/pandas/core/ops.<wbr>py", line 715, in wrapper<br>
    result = wrap_results(safe_na_op(<wbr>lvalues, rvalues))<br>
  File "/home/yoh/deb/gits/pkg-<wbr>exppsy/pandas/pandas/core/ops.<wbr>py", line 676, in safe_na_op<br>
    return na_op(lvalues, rvalues)<br>
  File "/home/yoh/deb/gits/pkg-<wbr>exppsy/pandas/pandas/core/ops.<wbr>py", line 652, in na_op<br>
    raise_on_error=True, **eval_kwargs)<br>
  File "/home/yoh/deb/gits/pkg-<wbr>exppsy/pandas/pandas/<wbr>computation/expressions.py", line 210, in evaluate<br>
    **eval_kwargs)<br>
  File "/home/yoh/deb/gits/pkg-<wbr>exppsy/pandas/pandas/<wbr>computation/expressions.py", line 63, in _evaluate_standard<br>
    return op(a, b)<br>
ValueError: Integers to negative integer powers are not allowed.<br>
<br>
------------------------------<wbr>------------------------------<wbr>----------<br>
Ran 1 test in 0.015s<br>
<br>
FAILED (errors=1)<br>
<br>
$> git describe --tags<br>
v0.19.0-303-gb957f6f<br>
<br>
$> PYTHONPATH=/home/yoh/proj/<wbr>numpy python -c "import numpy; print('numpy version: ', numpy.__version__); a=2; b=-2;  print(pow(a,b)); print(pow(numpy.array(a), b))"                                                                                                                                            ('numpy version: ', '1.13.0.dev0+02e2ea8')<br>
0.25<br>
Traceback (most recent call last):<br>
  File "<string>", line 1, in <module><br>
ValueError: Integers to negative integer powers are not allowed.<br>
<br>
<br>
--<br>
Yaroslav O. Halchenko<br>
Center for Open Neuroscience     <a href="http://centerforopenneuroscience.org" rel="noreferrer" target="_blank">http://<wbr>centerforopenneuroscience.org</a><br>
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755<br>
Phone: <a href="tel:%2B1%20%28603%29%20646-9834" value="+16036469834">+1 (603) 646-9834</a>                       Fax: <a href="tel:%2B1%20%28603%29%20646-1419" value="+16036461419">+1 (603) 646-1419</a><br>
WWW:   <a href="http://www.linkedin.com/in/yarik" rel="noreferrer" target="_blank">http://www.linkedin.com/in/<wbr>yarik</a><br>
______________________________<wbr>_________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a><br>
<a href="https://mail.scipy.org/mailman/listinfo/numpy-discussion" rel="noreferrer" target="_blank">https://mail.scipy.org/<wbr>mailman/listinfo/numpy-<wbr>discussion</a><br>
</blockquote></div></div>