Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 10eeec2

Browse files
gh-125761: Clarify repeated warning suppression criteria in warnings module (gh-126326)
1 parent cfb1b2f commit 10eeec2

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Doc/library/warnings.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,19 @@ If a warning is reported and doesn't match any registered filter then the
180180
"default" action is applied (hence its name).
181181

182182

183+
184+
.. _repeated-warning-suppression-criteria:
185+
186+
Repeated Warning Suppression Criteria
187+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
188+
189+
The filters that suppress repeated warnings apply the following criteria to determine if a warning is considered a repeat:
190+
191+
- ``"default"``: A warning is considered a repeat only if the (*message*, *category*, *module*, *lineno*) are all the same.
192+
- ``"module"``: A warning is considered a repeat if the (*message*, *category*, *module*) are the same, ignoring the line number.
193+
- ``"once"``: A warning is considered a repeat if the (*message*, *category*) are the same, ignoring the module and line number.
194+
195+
183196
.. _describing-warning-filters:
184197

185198
Describing Warning Filters

0 commit comments

Comments
 (0)