Skip to content

Commit f4bc64d

Browse files
[3.12] gh-125761: Clarify repeated warning suppression criteria in warnings module (gh-126331)
(cherry picked from commit 10eeec2) Co-authored-by: 고병찬 <[email protected]>
1 parent eecea8f commit f4bc64d

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
@@ -178,6 +178,19 @@ If a warning is reported and doesn't match any registered filter then the
178178
"default" action is applied (hence its name).
179179

180180

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

183196
Describing Warning Filters

0 commit comments

Comments
 (0)