From f0cc920185e0c970c2571bb204b2eece6f4484e6 Mon Sep 17 00:00:00 2001 From: wyattscarpenter Date: Wed, 7 May 2025 18:45:29 -0700 Subject: [PATCH 1/4] [refactor] Remove code that "disables deprecation warnings about \u" Probably now useless: it doesn't seem to do anything anymore as far as I can tell. And I checked a couple of things, and old documentation. This is essentially a revert of https://github.com/python/mypy/pull/7635 aka https://github.com/python/mypy/commit/bd00106aee988dc24b0f39ff89f1b77e4edbb57d, although not 100% exactly. --- mypy/fastparse.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/mypy/fastparse.py b/mypy/fastparse.py index 0e1b66f0db59..e86b73deafac 100644 --- a/mypy/fastparse.py +++ b/mypy/fastparse.py @@ -2,7 +2,6 @@ import re import sys -import warnings from collections.abc import Sequence from typing import Any, Callable, Final, Literal, Optional, TypeVar, Union, cast, overload @@ -227,11 +226,7 @@ def parse( assert options.python_version[0] >= 3 feature_version = options.python_version[1] try: - # Disable deprecation warnings about \u - with warnings.catch_warnings(): - warnings.filterwarnings("ignore", category=DeprecationWarning) - ast = ast3_parse(source, fnam, "exec", feature_version=feature_version) - + ast = ast3_parse(source, fnam, "exec", feature_version=feature_version) tree = ASTConverter( options=options, is_stub=is_stub_file, From 8270d52891bb2b92742e2365dd881df0a3aec15d Mon Sep 17 00:00:00 2001 From: wyattscarpenter Date: Thu, 14 Aug 2025 19:16:19 -0400 Subject: [PATCH 2/4] Update testparse.py: tentatively change default parser python version --- mypy/test/testparse.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mypy/test/testparse.py b/mypy/test/testparse.py index 027ca4dd2887..29d37874b2bf 100644 --- a/mypy/test/testparse.py +++ b/mypy/test/testparse.py @@ -47,7 +47,7 @@ def test_parser(testcase: DataDrivenTestCase) -> None: elif testcase.file.endswith("python313.test"): options.python_version = (3, 13) else: - options.python_version = defaults.PYTHON3_VERSION + options.python_version = sys.version_info source = "\n".join(testcase.input) From 406ceed9586ca67421fb820657e34ea45393c371 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 14 Aug 2025 23:17:43 +0000 Subject: [PATCH 3/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- mypy/test/testparse.py | 1 - 1 file changed, 1 deletion(-) diff --git a/mypy/test/testparse.py b/mypy/test/testparse.py index 29d37874b2bf..7c366cfb6eee 100644 --- a/mypy/test/testparse.py +++ b/mypy/test/testparse.py @@ -6,7 +6,6 @@ from pytest import skip -from mypy import defaults from mypy.config_parser import parse_mypy_comments from mypy.errors import CompileError, Errors from mypy.options import Options From 47b06fc65a16fcae0b5a06e7d4f064301335f679 Mon Sep 17 00:00:00 2001 From: wyattscarpenter Date: Fri, 15 Aug 2025 16:34:48 -0400 Subject: [PATCH 4/4] Use the right format for options.python_version --- mypy/test/testparse.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mypy/test/testparse.py b/mypy/test/testparse.py index 7c366cfb6eee..b7b26c689c5e 100644 --- a/mypy/test/testparse.py +++ b/mypy/test/testparse.py @@ -46,7 +46,7 @@ def test_parser(testcase: DataDrivenTestCase) -> None: elif testcase.file.endswith("python313.test"): options.python_version = (3, 13) else: - options.python_version = sys.version_info + options.python_version = sys.version_info[:2] source = "\n".join(testcase.input)