Bug report
Bug description:
Consider the following code snippet as a MWE
import logging
import warnings
def emit_user_warning() -> None:
"""Trigger the warning that we expect pytest-style helpers to see."""
warnings.warn('MWE warning', UserWarning)
def main() -> None:
"""Log the warning while capturing it via ``warnings.catch_warnings``."""
logging.captureWarnings(True)
warnings.simplefilter('always', UserWarning)
with warnings.catch_warnings(record=True) as recorded:
emit_user_warning()
print('warnings captured inside catch_warnings:', len(recorded))
for entry in recorded:
print(' captured message:', entry.message)
if __name__ == '__main__':
main()
Executing this script with python3.14 will generate the following output:
$ `uv python find 3.14` nogil_warning_capture.py
warnings captured inside catch_warnings: 1
captured message: MWE warning
while the output on python3.14t will be:
$ `uv python find 3.14t` nogil_warning_capture.py
warnings captured inside catch_warnings: 0
I am actually expecting the behavior of 3.14 to be the correct one.
CPython versions tested on:
3.14
Operating systems tested on:
Linux
Linked PRs
Bug report
Bug description:
Consider the following code snippet as a MWE
Executing this script with python3.14 will generate the following output:
$ `uv python find 3.14` nogil_warning_capture.py warnings captured inside catch_warnings: 1 captured message: MWE warningwhile the output on python3.14t will be:
I am actually expecting the behavior of 3.14 to be the correct one.
CPython versions tested on:
3.14
Operating systems tested on:
Linux
Linked PRs