Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #75380

Re: Convert Python 3 ResourceWarnings into exception

From Terry Reedy <tjreedy@udel.edu>
Subject Re: Convert Python 3 ResourceWarnings into exception
Date 2014-07-30 15:50 -0400
References <loom.20140730T151414-276@post.gmane.org>
Newsgroups comp.lang.python
Message-ID <mailman.12441.1406749861.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 7/30/2014 9:24 AM, Piotr Dobrogost wrote:
> Hi!
>
> Recently A. Jesse Jiryu Davis asked at Stackoverflow
> (http://stackoverflow.com/q/24717027/95735) if there is "a way to force a
> Python 3 unittest to fail, rather than simply print a warning to stderr, if
> it causes any ResourceWarning?" Daniel Harding, in the accepted answer,
> states it's not possible.
>
> Is it really the case?
>
> For sake of context, here I believe is the place, where
> PyErr_WriteUnraisable is being called in this case –
> http://hg.python.org/cpython/annotate/c0e311e010fc/Modules/socketmodule.c#l3857

python -W error ...
"Raise an exception instead of printing a warning message."

You can also turn this on with the warnings module. Assuming that this 
works for ResourceWarning, which is should, please correct the SO record.

-- 
Terry Jan Reedy

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Convert Python 3 ResourceWarnings into exception Terry Reedy <tjreedy@udel.edu> - 2014-07-30 15:50 -0400

csiph-web