classification
Title: warnings.simplefilter should validate input
Type: enhancement Stage: patch review
Components: Library (Lib) Versions: Python 3.10
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Bonifacio2, berker.peksag, nanjekyejoannah, seberg, vajrasky
Priority: normal Keywords: easy, patch

Created on 2013-01-03 00:42 by seberg, last changed 2021-06-13 13:17 by nanjekyejoannah.

Files
File name Uploaded Description Edit
add_assert_in_simplefilter.patch vajrasky, 2013-10-15 08:58 review
issue16845.diff berker.peksag, 2014-06-24 19:09 review
Pull Requests
URL Status Linked Edit
PR 26696 open Bonifacio2, 2021-06-12 20:16
Messages (4)
msg178867 - (view) Author: Sebastian Berg (seberg) * Date: 2013-01-03 00:42
`warnings.simplefilter` does not validate that the category passed in is actually a class. This means that an invalid category leads to a `TypeError` whenever a warning would otherwise occur due to `issubclass` check failing.

It is a very small thing, but for usability it would be clearer if this was checked right away.
msg199985 - (view) Author: Vajrasky Kok (vajrasky) * Date: 2013-10-15 08:58
Here is the patch to add the validation in simplefilter with the test.
msg221480 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2014-06-24 19:09
Here's a patch that uses the same approach as in issue 16382.
msg395747 - (view) Author: Joannah Nanjekye (nanjekyejoannah) * (Python committer) Date: 2021-06-13 13:17
@Bonifacio2, As commented on the PR, I think opening a PR with a patch close to what @berker.peksag suggested looks more elaborate, IMHO.

Thanks for your contribution.
History
Date User Action Args
2021-06-13 13:17:57nanjekyejoannahsetnosy: + nanjekyejoannah
messages: + msg395747
2021-06-12 20:16:38Bonifacio2setkeywords: + patch
nosy: + Bonifacio2
pull_requests: + pull_request25281
2021-01-11 23:25:12iritkatrielsetkeywords: + easy, - patch
versions: + Python 3.10, - Python 3.5
2020-03-06 19:40:53brett.cannonsetnosy: - brett.cannon
2014-06-24 19:09:44berker.peksagsetfiles: + issue16845.diff

components: + Library (Lib)
versions: + Python 3.5
nosy: + berker.peksag

messages: + msg221480
stage: patch review
2013-10-15 08:58:30vajraskysetfiles: + add_assert_in_simplefilter.patch

nosy: + vajrasky
messages: + msg199985

keywords: + patch
2013-10-14 14:15:56georg.brandlsetnosy: + brett.cannon
2013-01-03 00:42:06sebergcreate