Mailing List Archive

[issue41520] 3.8.5 regression, warnings.simplefilter('error', SyntaxWarning) does not raise.
New submission from Matthias Bussonnier <bussonniermatthias@gmail.com>:

assuming

$ cat foo.py
import warnings
from codeop import compile_command

warnings.simplefilter('error', SyntaxWarning)
res = compile_command('1 is 1\n', symbol='exec')
print('Res', res)

On 3.8.0...3.8.4 this correctly raises a SyntaxError:

python foo.py
Traceback (most recent call last):
File "foo.py", line 5, in <module>
res = compile_command('1 is 1\n', symbol='exec')
File "/Users/bussonniermatthias/miniconda3/envs/38/lib/python3.8/codeop.py", line 122, in compile_command
return _maybe_compile(_compile, source, filename, symbol)
File "/Users/bussonniermatthias/miniconda3/envs/38/lib/python3.8/codeop.py", line 99, in _maybe_compile
raise err1
File "/Users/bussonniermatthias/miniconda3/envs/38/lib/python3.8/codeop.py", line 87, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "/Users/bussonniermatthias/miniconda3/envs/38/lib/python3.8/codeop.py", line 102, in _compile
return compile(source, filename, symbol, PyCF_DONT_IMPLY_DEDENT)
File "<input>", line 1
SyntaxError: "is" with a literal. Did you mean "=="?



But will silently return None on 3.8.5

$ python foo.py
Res None

----------
components: Interpreter Core
messages: 375152
nosy: mbussonn
priority: normal
severity: normal
status: open
title: 3.8.5 regression, warnings.simplefilter('error', SyntaxWarning) does not raise.
type: behavior
versions: Python 3.8

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue41520>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue41520] 3.8.5 regression, warnings.simplefilter('error', SyntaxWarning) does not raise. [ In reply to ]
Matthias Bussonnier <bussonniermatthias@gmail.com> added the comment:

seem to affect 3.8.4 as well.

----------

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue41520>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue41520] 3.8.5 regression, warnings.simplefilter('error', SyntaxWarning) does not raise. [ In reply to ]
Matthias Bussonnier <bussonniermatthias@gmail.com> added the comment:

Potentially due to

https://bugs.python.org/issue40807
https://github.com/python/cpython/pull/20486

----------

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue41520>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue41520] 3.8.5 regression, warnings.simplefilter('error', SyntaxWarning) does not raise. [ In reply to ]
Change by Matthias Bussonnier <bussonniermatthias@gmail.com>:


----------
versions: +Python 3.10, Python 3.9

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue41520>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue41520] 3.8.5 regression, warnings.simplefilter('error', SyntaxWarning) does not raise. [ In reply to ]
Thomas Caswell <tcaswell@gmail.com> added the comment:

bisecting agrees with Matthias:

# first bad commit: [c067183605cf84bb1a246635f52827251d0476f8] bpo-40807: Show warnings once from codeop._maybe_compile (GH-20486)

----------
nosy: +tcaswell

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue41520>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue41520] 3.8.5 regression, warnings.simplefilter('error', SyntaxWarning) does not raise. [ In reply to ]
Change by Karthikeyan Singaravelan <tir.karthi@gmail.com>:


----------
nosy: +lukasz.langa

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue41520>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue41520] 3.8.5 regression, warnings.simplefilter('error', SyntaxWarning) does not raise. [ In reply to ]
Change by STINNER Victor <vstinner@python.org>:


----------
priority: normal -> release blocker

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue41520>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com