-
-
Notifications
You must be signed in to change notification settings - Fork 32k
Incorrect message: "Invalid decimal literal" (python 3.10) #88943
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Consider the following:
Using Python 3.9 (and earlier), we get the following correct information >>> a = (1‚ 2)
File "<stdin>", line 1
a = (1‚ 2)
^
SyntaxError: invalid character '‚' (U+201A) Using Python 3.10, we get the following incorrect information instead: >>> a = (1‚ 2)
File "<stdin>", line 1
a = (1‚ 2)
^
SyntaxError: invalid decimal literal |
Here's another related case. Python 3.9: >>> a = 1½
File "<stdin>", line 1
a = 1½
^
SyntaxError: invalid character '½' (U+00BD)
Python 3.10
>>> a = 1½
File "<stdin>", line 1
a = 1½
^
SyntaxError: invalid decimal literal |
Third case. Showing only the output for Python 3.10 >>> a = 3 ⁄ 7 # entered with a space around ⁄
File "<stdin>", line 1
a = 3 ⁄ 7
^
SyntaxError: invalid character '⁄' (U+2044)
>>> a = 3⁄7 # no added space
File "<stdin>", line 1
a = 3⁄7
^
SyntaxError: invalid decimal literal = = |
The last of these three cases (with FRACTION SLASH) is fixed 3.10.1. The other two are still present in 3.10.1 and in 3.11.0a3 |
another case - item1_name = input('Enter food item name:\n') item1_price = float(input('Enter item price:\n')) item1_quantity = int(input('Enter item quantity:\n')) item2_name = input('Enter second food item name:\n') item2_price = float(input('Enter second item price:\n')) item2_quantity = input('Enter second item quantity:\n') #assigning variable for calculations of item1 and item2 item1_total = item1_quantity * item1_price #began with print statement of receipt header print(f'{item1_quantity} {item1_name} @ ${item1_price.2f} = ${item1_total:.2f}') |
@CC-Kitten, I do not see how your problem is related to this issue. Please open a new issue. Also, it would help if you explain how it "is not working correctly": what is the difference in the behavior between different Python versions, what exactly versions. |
…lows a numerical literal It now points on the invalid non-ASCII character, not on the valid numerical literal.
… numerical literal (GH-109081) It now points on the invalid non-ASCII character, not on the valid numerical literal.
…lows a numerical literal (pythonGH-109081) It now points on the invalid non-ASCII character, not on the valid numerical literal. (cherry picked from commit b2729e9) Co-authored-by: Serhiy Storchaka <[email protected]>
…hat follows a numerical literal (pythonGH-109081) It now points on the invalid non-ASCII character, not on the valid numerical literal.. (cherry picked from commit b2729e9) Co-authored-by: Serhiy Storchaka <[email protected]>
…llows a numerical literal (GH-109081) (#109090) gh-88943: Improve syntax error for non-ASCII character that follows a numerical literal (GH-109081) It now points on the invalid non-ASCII character, not on the valid numerical literal. (cherry picked from commit b2729e9) Co-authored-by: Serhiy Storchaka <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
Linked PRs
The text was updated successfully, but these errors were encountered: