Skip to content

Commit b29a433

Browse files
authored
Fix the mypy self check under 3.8 (#6756)
1 parent 70a4c98 commit b29a433

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

mypy/fastparse.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1384,7 +1384,12 @@ def visit_Str(self, n: Str) -> Type:
13841384
# If we're analyzing Python 3, that function will translate 'builtins.unicode'
13851385
# into 'builtins.str'. In contrast, if we're analyzing Python 2 code, we'll
13861386
# translate 'builtins.bytes' in the method below into 'builtins.str'.
1387-
if 'u' in n.kind or self.assume_str_is_unicode:
1387+
1388+
# Do an ignore because the field doesn't exist in 3.8 (where
1389+
# this method doesn't actually ever run.)
1390+
kind = n.kind # type: str # type: ignore
1391+
1392+
if 'u' in kind or self.assume_str_is_unicode:
13881393
return parse_type_string(n.s, 'builtins.unicode', self.line, n.col_offset,
13891394
assume_str_is_unicode=self.assume_str_is_unicode)
13901395
else:

0 commit comments

Comments
 (0)