This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Python 3.6.0rc1 breaks NumPy tests.
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.6
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: charris44, mdk, ncoghlan, ned.deily, pitrou, serhiy.storchaka, vstinner
Priority: Keywords: 3.6regression

Created on 2016-12-07 16:54 by charris44, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (20)
msg282633 - (view) Author: Charles Harris (charris44) Date: 2016-12-07 16:54
The lastest Python 3.6 pre-release broke a number of NumPy tests. The failing tests are of the sort

    with warnings.catch_warnings(record=True) as w:
        warnings.simplefilter('always')
        ...

And the failure seems to be that nothing is recorded in w. None of the beta releases caused problems. It is possible that the testing environment (Travis CI) messed up, but reporting this here just in case.
msg282634 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2016-12-07 17:11
Serhiy, Victor, can you look at this please?
msg282636 - (view) Author: Charles Harris (charris44) Date: 2016-12-07 17:24
Probably this commit: https://hg.python.org/cpython/rev/aaee06743c61 .
msg282639 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-12-07 17:32
Could you please show an example of failing test?
msg282645 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-12-07 17:56
See also msg278976.
msg282655 - (view) Author: Charles Harris (charris44) Date: 2016-12-07 19:30
The failing tests don't use the context manager mentioned in msg278976 and which was fixed. In any case, the failures are new an appeared today. A failing test may be viewed at: https://github.com/numpy/numpy/blob/master/numpy/lib/tests/test_nanfunctions.py#L546
msg282662 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2016-12-07 20:33
So `warnings.catch_warnings` doesn't work anymore in 3.6?
msg282664 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-12-07 20:50
It works in usual circumstances.

>>> import warnings
>>> with warnings.catch_warnings(record=True) as w:
...     warnings.simplefilter('always')
...     warnings.warn('a test warning', DeprecationWarning)
...     print(w)
... 
[<warnings.WarningMessage object at 0xb6f1714c>]
msg282665 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2016-12-07 20:51
What is Numpy doing that is breaking it?
msg282666 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-12-07 20:54
I have installed NumPy 1.11.2 and ran tests. Tests are passes successfully.
msg282669 - (view) Author: Charles Harris (charris44) Date: 2016-12-07 21:24
I downloaded the tarball and installed the release here and got the same errors. We setup the tests in developement mode by turning some warnings into errors, in particular DeprecationWarnings and RuntimeWarnings, and suppressing others. The tests that are failing are checking for warnings turn the errors back into warnings. The latter seems to be failing.

There could be an interaction between the setup and recent changes in Python 3.6.0rc1. What exactly was changed in the warnings module after the last beta?
msg282670 - (view) Author: Charles Harris (charris44) Date: 2016-12-07 21:29
You probably need to run NumPy 1.12 to see the problem. Tt looks like the new suppress_warnings context manager is what has been broken. Note that is was broken by 3.6 before, fixed, and now seems to be broken again.
msg282671 - (view) Author: Charles Harris (charris44) Date: 2016-12-07 21:30
The NumPy 1.12.0b1 tarball is available on PyPI if you want to download it.
msg282674 - (view) Author: Julien Palard (mdk) * (Python committer) Date: 2016-12-07 22:14
Tried to run the test_nanfunctions.py on tip and Python 3.6.0b4+, on numpy 1.11 and 1.12.0b1, can't make it fail.

Installed numpy 1.12.0b1 using: ./python -m pip install --user numpy==1.12.0b1

I suspect Charles tested using Python 3.6.0b3 (can you confirm?), which was released before the latest patches (commited yesterday) from http://bugs.python.org/issue28835.
msg282676 - (view) Author: Charles Harris (charris44) Date: 2016-12-07 23:03
I ran with Python 3.6.0rc1 (default, Dec  7 2016, 14:00:51) and get the same errors in both NumPy 1.13.0-dev and 1.12. But I gave you a wrong suggestion, we disable some test errors for releases, which is what is on PyPI, and that is doubtless why you don't see them. My fault, and I apologize. You will probably need to clone the github repo (https://github.com/numpy/numpy) and do a `python3.6 runtests.py` in the master branch to see the problem. 

I'm suspecting the problem needs to be fixed on the numpy end, but need to know what the changes were made to get an idea of a fix. We do some odd stuff with the warnings queue in order to make sure no warnings are inadvertently disabled in the tests.
msg282677 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2016-12-07 23:29
Charles, these are the two changes that went into Lib/warnings.py between b4 and rc1:

changeset:   105490:aaee06743c61
branch:      3.6
parent:      105488:c0f59410ccfc
user:        Ned Deily <nad@python.org>
date:        Tue Dec 06 17:12:47 2016 -0500
files:       Lib/warnings.py
description:
Issue #28835: Tidy previous showwarning changes based on review comments.
Patch by Serhiy Storchaka.


changeset:   105474:726308cfe3b5
branch:      3.6
parent:      105472:ab66423c3581
user:        Victor Stinner <victor.stinner@gmail.com>
date:        Tue Dec 06 10:53:52 2016 +0100
files:       Lib/test/test_warnings/__init__.py Lib/warnings.py Misc/NEWS
description:
catch_warnings() calls showwarning() if overriden

Issue #28089: Fix a regression introduced in warnings.catch_warnings(): call
warnings.showwarning() if it was overriden inside the context manager.
msg282678 - (view) Author: Charles Harris (charris44) Date: 2016-12-08 00:16
OK, you fixed what broke us before. If I revert our fixes the problem goes away. So, thanks I guess ;)

You can close this.
msg282680 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2016-12-08 01:35
Closing as not a bug as Charles suggested, since the problem was due to a workaround NumPy introduced for a regression in the beta releases that was fixed for rc1.
msg282681 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2016-12-08 01:54
Yes, thanks, Charles, and thanks everyone else. Sorry about the confusion with the changes in rc1.
msg282700 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-12-08 09:47
Charles: "OK, you fixed what broke us before. If I revert our fixes
the problem goes away. So, thanks I guess ;) You can close this."

Cool, happy to read that the issue was fixed :-)

If you missed it, the whole mess were backward compatibility when I
extended the warnings API (only internally currently) to implement a
new feature:
https://docs.python.org/dev/whatsnew/3.6.html#warnings

ResourceWarning are now displayed with a traceback where the object
was allocated when tracemalloc is enabled.
History
Date User Action Args
2022-04-11 14:58:40adminsetgithub: 73083
2016-12-08 09:47:48vstinnersetmessages: + msg282700
2016-12-08 01:54:35ned.deilysetpriority: release blocker ->

messages: + msg282681
2016-12-08 01:35:27ncoghlansetstatus: open -> closed

nosy: + ncoghlan
messages: + msg282680

resolution: not a bug
stage: resolved
2016-12-08 00:16:36charris44setmessages: + msg282678
2016-12-07 23:29:30ned.deilysetmessages: + msg282677
2016-12-07 23:03:09charris44setmessages: + msg282676
2016-12-07 22:14:21mdksetnosy: + mdk
messages: + msg282674
2016-12-07 21:30:43charris44setmessages: + msg282671
2016-12-07 21:29:10charris44setmessages: + msg282670
2016-12-07 21:24:17charris44setmessages: + msg282669
2016-12-07 20:54:55serhiy.storchakasetmessages: + msg282666
2016-12-07 20:51:13pitrousetmessages: + msg282665
2016-12-07 20:50:20serhiy.storchakasetmessages: + msg282664
2016-12-07 20:33:33pitrousetnosy: + pitrou
messages: + msg282662
2016-12-07 20:25:54ned.deilysetkeywords: + 3.6regression
2016-12-07 19:30:30charris44setmessages: + msg282655
2016-12-07 17:56:39serhiy.storchakasetmessages: + msg282645
2016-12-07 17:32:54serhiy.storchakasetmessages: + msg282639
2016-12-07 17:24:12charris44setmessages: + msg282636
2016-12-07 17:11:36ned.deilysetpriority: normal -> release blocker
nosy: + vstinner, serhiy.storchaka, ned.deily
messages: + msg282634

2016-12-07 16:54:01charris44create