mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
bpo-43833: Emit warnings for numeric literals followed by keyword (GH-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 2ea6d89028)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
2cfe0e7061
commit
eeefa7f6c0
5 changed files with 246 additions and 3 deletions
|
|
@ -162,7 +162,7 @@ def test_literals_with_leading_zeroes(self):
|
|||
for arg in ["077787", "0xj", "0x.", "0e", "090000000000000",
|
||||
"080000000000000", "000000000000009", "000000000000008",
|
||||
"0b42", "0BADCAFE", "0o123456789", "0b1.1", "0o4.2",
|
||||
"0b101j2", "0o153j2", "0b100e1", "0o777e1", "0777",
|
||||
"0b101j", "0o153j", "0b100e1", "0o777e1", "0777",
|
||||
"000777", "000000000000007"]:
|
||||
self.assertRaises(SyntaxError, eval, arg)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue