Message 261718 - Python tracker

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.

Content
The context manager errors if *nothing* matches, not if *everything* matches, which is very different to catch_warnings because the filters are used to *exclude* warnings, and excess warnings are errors there.

Because of that, there's little if any reason to add support for multiple regexes - just nest two context managers.

That said...

The lineno is already not-fully-informative - its the first matching warnings lineno.

Right now, the definition in the code is:

for warnings in (the warning item-or-tuple)
 if the regex matches, done

if none of the warnings match, error.

If we allow the tuple of warnings to be a tuple of (warning, regex) items, we could do that compatibly, with some introspection.

If the patch is fairly small, It might be ok, for all that I don't see a need for it.