From: Michael R. Crusoe <crusoe@debian.org>
Subject: turn off native parsing
Forwarded: not-needed

The Python package ast_serialize is not available in Debian yet.
--- mypy.orig/mypy/main.py
+++ mypy/mypy/main.py
@@ -99,7 +99,6 @@
 
     if options.num_workers:
         # Supporting both parsers would be really tricky, so just support the new one.
-        options.native_parser = True
         if options.num_workers < 0:
             fail("error: Number of workers cannot be negative", stderr, options)
         if options.cache_dir == os.devnull:
@@ -113,6 +112,8 @@
                 stderr,
                 options,
             )
+        options.num_workers = 0
+        # native parser is not yet supported in Debian
 
     if options.allow_redefinition and not options.local_partial_types:
         fail(
@@ -1179,11 +1180,7 @@
 
     # Experimental parallel type-checking support.
     internals_group.add_argument(
-        "-n",
-        "--num-workers",
-        type=int,
-        default=0,
-        help="Number of separate mypy worker processes (experimental)",
+        "-n", "--num-workers", type=int, default=0, help=argparse.SUPPRESS
     )
 
     report_group = parser.add_argument_group(
@@ -1296,10 +1293,15 @@
         help=argparse.SUPPRESS,
     )
     # --native-parser enables the native parser (experimental)
-    add_invertible_flag(
-        "--native-parser",
+    np_arg = parser.add_argument(
+        "--native-parser", default=False, action="store_false", help=argparse.SUPPRESS
+    )
+    parser.add_argument(
+        invert_flag_name("--native-parser"),
         default=False,
-        help="Enable faster parser that parses directly to mypy AST",
+        dest=np_arg.dest,
+        action="store_false",
+        help=argparse.SUPPRESS,
     )
     # --logical-deps adds some more dependencies that are not semantically needed, but
     # may be helpful to determine relative importance of classes and functions for overall
--- mypy.orig/mypy/nativeparse.py
+++ mypy/mypy/nativeparse.py
@@ -22,7 +22,7 @@
 import time
 from typing import Final, cast
 
-import ast_serialize
+import ast_serialize  # type: ignore[import-not-found, unused-ignore]
 from librt.internal import (
     read_float as read_float_bare,
     read_int as read_int_bare,
@@ -254,7 +254,7 @@
     # module may be not ready in a thread sometimes.
     t0 = time.time()
     while ast_serialize is None:
-        time.sleep(0.0001)  # type: ignore[unreachable]
+        time.sleep(0.0001)
         if time.time() - t0 > 10.0:
             raise ImportError("Cannot import ast_serialize")
     ast_bytes, errors, ignores, import_bytes, ast_data = ast_serialize.parse(
--- mypy.orig/PKG-INFO
+++ mypy/PKG-INFO
@@ -30,7 +30,6 @@
 Requires-Dist: pathspec>=1.0.0
 Requires-Dist: tomli>=1.1.0; python_version < "3.11"
 Requires-Dist: librt>=0.10.0; platform_python_implementation != "PyPy"
-Requires-Dist: ast-serialize<1.0.0,>=0.3.0
 Provides-Extra: dmypy
 Requires-Dist: psutil>=4.0; extra == "dmypy"
 Provides-Extra: mypyc
--- mypy.orig/pyproject.toml
+++ mypy/pyproject.toml
@@ -14,8 +14,6 @@
     # the following is from build-requirements.txt
     "types-psutil",
     "types-setuptools",
-    # required to work around a mypyc import bug
-    "ast-serialize>=0.3.0,<1.0.0",
 ]
 build-backend = "setuptools.build_meta"
 
--- mypy.orig/mypy.egg-info/PKG-INFO
+++ mypy/mypy.egg-info/PKG-INFO
@@ -30,7 +30,6 @@
 Requires-Dist: pathspec>=1.0.0
 Requires-Dist: tomli>=1.1.0; python_version < "3.11"
 Requires-Dist: librt>=0.10.0; platform_python_implementation != "PyPy"
-Requires-Dist: ast-serialize<1.0.0,>=0.3.0
 Provides-Extra: dmypy
 Requires-Dist: psutil>=4.0; extra == "dmypy"
 Provides-Extra: mypyc
--- mypy.orig/mypy.egg-info/requires.txt
+++ mypy/mypy.egg-info/requires.txt
@@ -1,6 +1,5 @@
 mypy_extensions>=1.0.0
 pathspec>=1.0.0
-ast-serialize<1.0.0,>=0.3.0
 
 [:platform_python_implementation != "PyPy"]
 librt>=0.10.0
