diff --git a/mypy/build.py b/mypy/build.py index 1dbbc86fea7f7..a9718722d3ded 100644 --- a/mypy/build.py +++ b/mypy/build.py @@ -53,6 +53,7 @@ write_str as write_str_bare, write_tag, ) +from mypy_extensions import mypyc_attr import mypy.semanal_main from mypy.cache import ( @@ -194,6 +195,7 @@ Graph: _TypeAlias = dict[str, "State"] +@mypyc_attr(acyclic=True) class SCC: """A simple class that represents a strongly connected component (import cycle).""" diff --git a/mypy/cache.py b/mypy/cache.py index ef72ed89a0b60..118e1143f0bbf 100644 --- a/mypy/cache.py +++ b/mypy/cache.py @@ -66,7 +66,7 @@ write_str as write_str_bare, write_tag as write_tag, ) -from mypy_extensions import u8 +from mypy_extensions import mypyc_attr, u8 # High-level cache layout format CACHE_VERSION: Final = 4 @@ -74,6 +74,7 @@ SerializedError: _TypeAlias = tuple[str | None, int | str, int, int, int, str, str, str | None] +@mypyc_attr(acyclic=True) class CacheMeta: """Class representing cache metadata for a module.""" diff --git a/mypy/options.py b/mypy/options.py index 3501b8bb24346..982b5ab525ada 100644 --- a/mypy/options.py +++ b/mypy/options.py @@ -8,6 +8,8 @@ from re import Pattern from typing import Any, Final +from mypy_extensions import mypyc_attr + from mypy import defaults from mypy.errorcodes import ErrorCode, error_codes from mypy.util import get_class_descriptors, replace_object_state @@ -92,6 +94,7 @@ class BuildType: COMPLETE_FEATURES: Final = frozenset((TYPE_VAR_TUPLE, UNPACK, NEW_GENERIC_SYNTAX)) +@mypyc_attr(acyclic=True) class Options: """Options collected from flags.""" diff --git a/mypy/types.py b/mypy/types.py index db8fd4605659c..2d8d49a00ca20 100644 --- a/mypy/types.py +++ b/mypy/types.py @@ -25,6 +25,7 @@ write_int as write_int_bare, write_str as write_str_bare, ) +from mypy_extensions import mypyc_attr import mypy.nodes from mypy.bogus_type import Bogus @@ -1273,6 +1274,7 @@ def __eq__(self, other: object) -> bool: return isinstance(other, UnpackType) and self.type == other.type +@mypyc_attr(acyclic=True) class AnyType(ProperType): """The type 'Any'.""" @@ -1381,6 +1383,7 @@ def read(cls, data: ReadBuffer) -> AnyType: return ret +@mypyc_attr(acyclic=True) class UninhabitedType(ProperType): """This type has no members. @@ -1436,6 +1439,7 @@ def read(cls, data: ReadBuffer) -> UninhabitedType: return UninhabitedType() +@mypyc_attr(acyclic=True) class NoneType(ProperType): """The type of 'None'.