Issue 33912: [EASY] test_warnings: test_exec_filename() fails when run with -Werror (original) (raw)

vstinner@apu$ ./python -W error -m test -v test_warnings

====================================================================== ERROR: test_exec_filename (test.test_warnings.CWarnTests)

Traceback (most recent call last): File "/home/vstinner/prog/python/master/Lib/test/test_warnings/init.py", line 450, in test_exec_filename exec(codeobj) File "", line 2, in UserWarning: hello

====================================================================== ERROR: test_exec_filename (test.test_warnings.PyWarnTests)

Traceback (most recent call last): File "/home/vstinner/prog/python/master/Lib/test/test_warnings/init.py", line 450, in test_exec_filename exec(codeobj) File "", line 2, in File "/home/vstinner/prog/python/master/Lib/warnings.py", line 318, in warn globals, source) File "/home/vstinner/prog/python/master/Lib/warnings.py", line 363, in warn_explicit raise message UserWarning: hello

It seems to be a regression introduced by bpo-33375: commit 11a896652ee98aa44e59ed25237f9efb56635dcf.