Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34.3k
Open
Description
Bug report
Bug description:
Consider the following code snippet as a MWE
importloggingimportwarningsdefemit_user_warning()->None:"""Trigger the warning that we expect pytest-style helpers to see."""warnings.warn('MWE warning',UserWarning)defmain()->None:"""Log the warning while capturing it via ``warnings.catch_warnings``."""logging.captureWarnings(True)warnings.simplefilter('always',UserWarning)withwarnings.catch_warnings(record=True)asrecorded:emit_user_warning()print('warnings captured inside catch_warnings:',len(recorded))forentryinrecorded: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 warningwhile the output on python3.14t will be:
$ `uv python find 3.14t` nogil_warning_capture.py warnings captured inside catch_warnings: 0I am actually expecting the behavior of 3.14 to be the correct one.
CPython versions tested on:
3.14
Operating systems tested on:
Linux