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: 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, danielnoord, nanjekyejoannah, python-dev, seberg, vajrasky
Priority: normal Keywords: easy, patch

Created on 2013-01-03 00:42 by seberg, last changed 2022-04-11 14:57 by admin.

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
PR 31983 open python-dev, 2022-03-18 19:51
Messages (5)
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.
msg415522 - (view) Author: Daniël van Noord (danielnoord) * Date: 2022-03-18 19:52
I have submitted the path by @berker.peksag with one additional test case in a new PR.

@nanjekyejoannah I saw you responded to the other PR, but that died down. Would you mind taking a look at mine? I'm happy to help land this :)
History
Date User Action Args
2022-04-11 14:57:40adminsetgithub: 61049
2022-03-18 19:52:15danielnoordsetnosy: + danielnoord
messages: + msg415522
2022-03-18 19:51:20python-devsetnosy: + python-dev
pull_requests: + pull_request30073
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