Why do we discard (repeatedly) all warning filters?

60 views
Skip to first unread message

Andrey Novoseltsev

unread,
May 22, 2016, 6:03:11 PM5/22/16
to sage-devel
At the moment any time a deprecation warning is issued all warning filters are thrown away:
https://github.com/sagemath/sage/blob/master/src/sage/misc/superseded.py#L138
which means that Python functionality for tuning warnings is completely useless. Why??? If the point is to change the default behaviour of not showing deprecation warnings, how about just adjusting that particular filter and only once when Sage starts?

Johan S. R. Nielsen

unread,
May 23, 2016, 3:38:27 AM5/23/16
to sage-...@googlegroups.com
I asked a similar question recently:
https://groups.google.com/forum/#!topic/sage-devel/RxMNjVWBeI0

There seems to be some code outside sage/misc/superseded.py which
removes some warnings so they will be issued only once. I have no idea
how or where, or if it's just because I can't read the warning code in
superseded.py right...

I ended up monkey-patching the one type of warning I was interested in
at the time: http://trac.sagemath.org/ticket/20601

Best,
Johan

Jeroen Demeyer

unread,
May 23, 2016, 4:30:51 AM5/23/16
to sage-...@googlegroups.com
On 2016-05-23 00:03, Andrey Novoseltsev wrote:
> Why???

I think it's safe to assume that there is a good reason, it's just the
way it was done historically.

Jeroen Demeyer

unread,
May 23, 2016, 4:32:19 AM5/23/16
to sage-...@googlegroups.com
Sorry, I meant to say "I think it's safe to assume that there is *no*
good reason"...

Andrey Novoseltsev

unread,
May 23, 2016, 10:14:38 PM5/23/16
to sage-devel
Getting rid of resetwarnings in all places is ready for review at http://trac.sagemath.org/ticket/20667
Reply all
Reply to author
Forward
0 new messages