gh-131649: fix test_string_literals SyntaxWarning#131650
gh-131649: fix test_string_literals SyntaxWarning#131650vstinner merged 1 commit intopython:mainfrom
Conversation
22cee3c to
0c73ffe
Compare
| with warnings.catch_warnings(record=True) as w: | ||
| warnings.simplefilter('always', category=SyntaxWarning) | ||
| eval("\"'''''''''''''''''''''invalid\ Escape\"") | ||
| eval("\"'''''''''''''''''''''invalid\\ Escape\"") |
There was a problem hiding this comment.
Isn't the purpose of the test to emit a SyntaxWarning warning?
There was a problem hiding this comment.
Yes, but only when evaluated (which it still does). The eval here is intended to hide the SyntaxWarning from the interpreter at import, but it wasn't applied correctly
There was a problem hiding this comment.
Oh, that's confusing :-) But you're right, currently the code emits the warning when the code is compiled, not when eval() is called.
| with warnings.catch_warnings(record=True) as w: | ||
| warnings.simplefilter('always', category=SyntaxWarning) | ||
| eval("\"'''''''''''''''''''''invalid\ Escape\"") | ||
| eval("\"'''''''''''''''''''''invalid\\ Escape\"") |
There was a problem hiding this comment.
Oh, that's confusing :-) But you're right, currently the code emits the warning when the code is compiled, not when eval() is called.
|
Thanks @graingert for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13. |
|
Sorry, @graingert and @vstinner, I could not cleanly backport this to |
|
Sorry, @graingert and @vstinner, I could not cleanly backport this to |
|
Merged, thanks for the fix. @graingert: Automated backports to 3.12 and 3.13 failed (with conflicts?). Do you want to attempt to backport your change manually? |
|
I took a look at the conflicts. The test boilerplate changed, but the tests strings are the same, so the backport should be as simple as just adding an extra |
…nGH-131650) (cherry picked from commit 2d83891) Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Thanks that would be great! |
|
GH-131766 is a backport of this pull request to the 3.13 branch. |
…nGH-131650) (pythonGH-131766) (cherry picked from commit 2d83891) (cherry picked from commit 5bcb476) Co-authored-by: Brian Schubert <brianm.schubert@gmail.com> Co-authored-by: Thomas Grainger <tagrain@gmail.com>
|
3.12 is now security-only, so the backport is no longer needed. https://discuss.python.org/t/python-3-12-is-now-security-fix-only/87520 |
Uh oh!
There was an error while loading. Please reload this page.