GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||
GeezerVison is showing github.com — bpo-43833: Emit warnings for numeric literals followed by keyword by serhiy-storchaka · Pull Request #25466 · python/cpython Conversation
|
|
I am not a fan of this solution as this is coupling the tokenizer and the grammar, which is a known problematic behaviour. In particular, I don't like the fact that we need to manually check against every keyword explicitly. Cannot we just error if we find any character that is not a whitespace or a valid numeric literal? We should try to fix this in a way they is keyword-agnostic |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Checking against the list of valid keywords is a temporary code. It is because we want to do gradual deprecation and only emit a warning for currently valid code. At the end, there will be only syntax error and no list of keywords. If emit a warning unconditionally, this will break some tests for invalid numeric literals ( |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Thanks for the clarification. Could you add some comments regarding this plans to the source code of the change to make sure this context is there when reading the code? In that case I assume that the main thing to do here is to all agree on the plan. I personally find the plan reasonable so I'm on board, but I would go directly to SyntaxWarning and in 1 or 2 releases making it a SyntaxError. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sure. I added a comment in As for SyntaxWarning vs DeprecationWarning, we still emit DeprecationWarning for invalid character escapes (like in |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@pablogsal, do you want to add these warnings in 3.10 or 3.11 if add them at all? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I would like them to be included in Python 3.10 so we can make them illegal sooner. What do you think? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@serhiy-storchaka: Status check is done, and it's a success ✅ . |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…thonGH-25466) Emit a deprecation warning if the numeric literal is immediately followed by one of keywords: and, else, for, if, in, is, or. Raise a syntax error with more informative message if it is immediately followed by other keyword or identifier. Automerge-Triggered-By: GH:pablogsal (cherry picked from commit 2ea6d89) Co-authored-by: Serhiy Storchaka <[email protected]>
|
GH-26614 is a backport of this pull request to the 3.10 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…-25466) Emit a deprecation warning if the numeric literal is immediately followed by one of keywords: and, else, for, if, in, is, or. Raise a syntax error with more informative message if it is immediately followed by other keyword or identifier. Automerge-Triggered-By: GH:pablogsal (cherry picked from commit 2ea6d89) Co-authored-by: Serhiy Storchaka <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.