Skip to content

Commit bd00106

Browse files
authored
Silence the deprecation warning about \u (#7635)
We were doing this for Python 2 parsing. Do it for Python 3 also.
1 parent 61e08cc commit bd00106

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

mypy/fastparse.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import re
22
import sys
3+
import warnings
34

45
import typing # for typing.Type, which conflicts with types.Type
56
from typing import (
@@ -154,7 +155,10 @@ def parse(source: Union[str, bytes],
154155
else:
155156
assert options.python_version[0] >= 3
156157
feature_version = options.python_version[1]
157-
ast = ast3_parse(source, fnam, 'exec', feature_version=feature_version)
158+
# Disable deprecation warnings about \u
159+
with warnings.catch_warnings():
160+
warnings.filterwarnings("ignore", category=DeprecationWarning)
161+
ast = ast3_parse(source, fnam, 'exec', feature_version=feature_version)
158162

159163
tree = ASTConverter(options=options,
160164
is_stub=is_stub_file,

0 commit comments

Comments
 (0)