garyaviv · GitHub

Bug report

Bug description:

When the PYTHONWARNINGS message field contains a special character such as . or * it gets quoted as \. or \* so it looses it's regex meaning and never matches. I tested this in 3.8 and 3.13.

PYTHONWARNINGS='ignore:This.*deadlocks:DeprecationWarning' python -c 'import warnings; print(warnings.filters[0])'

yields:

('ignore', re.compile('This\\.\\*deadlocks', re.IGNORECASE), <class 'DeprecationWarning'>, None, 0)

(note the extra backslash is a result of the print statement, doing a repr.)

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Linked PRs

Read the original on github.com ↗