Skip to content

Commit 45f01a1

Browse files
ilevkivskyigvanrossum
authored andcommitted
Minor change requested by David (+ a hex test) (#2379)
1 parent 8a5f463 commit 45f01a1

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

mypy/fastparse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ def is_star2arg(k: ast35.keyword) -> bool:
736736
# Num(object n) -- a number as a PyObject.
737737
@with_line
738738
def visit_Num(self, n: ast35.Num) -> Union[IntExpr, FloatExpr, ComplexExpr]:
739-
if getattr(n, 'underscores', None) and self.pyversion < (3, 6):
739+
if getattr(n, 'contains_underscores', None) and self.pyversion < (3, 6):
740740
raise FastParserError('Underscores in numeric literals are only '
741741
'supported in Python 3.6', n.lineno, n.col_offset)
742742
if isinstance(n.n, int):

mypy/test/testcheck.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
if 'annotation' in typed_ast.ast35.Assign._fields:
7575
files.append('check-newsyntax.test')
7676

77-
if 'underscores' in typed_ast.ast35.Num._fields:
77+
if 'contains_underscores' in typed_ast.ast35.Num._fields:
7878
files.append('check-underscores.test')
7979

8080

test-data/unit/check-underscores.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ x = 1000_000_ # E: invalid token
1212
# flags: --fast-parser --python-version 3.6
1313
x: int
1414
x = 1000_000
15+
x = 0x_FF_FF_FF_FF
1516
y: str = 1000_000.000_001 # E: Incompatible types in assignment (expression has type "float", variable has type "str")

0 commit comments

Comments
 (0)