Terry Reedy <tjreedy <at> udel.edu> writes:
> 
> 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.


Thanks for taking time to answer.
Please notice that OP already tried
warnings.simplefilter(action='error', category=ResourceWarning)
with no luck.

Also, in the answer, Daniel states the following:
"The ResourceWarning is indeed being generated during garbage collection,
and Python prints a message because it doesn't have a way to raise an
exception at that point."

If it were true that would have been rather unfortunate as I guess most
ResourceWarnings are being generated during garbage collection. In that case
to let users get hold on such warnings there would need to be created new
mechanism for gathering warnings (not based on exceptions as a mean of
transport).


-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to