Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions mypy/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -194,6 +195,7 @@
Graph: _TypeAlias = dict[str, "State"]


@mypyc_attr(acyclic=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is true, because of direct_dependents that points back to SCC that depends on the current one. This is used to notify dependents when they are ready to be processed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually ignore this one, we refer to direct dependents by id, so we should be good here.

class SCC:
"""A simple class that represents a strongly connected component (import cycle)."""

Expand Down
3 changes: 2 additions & 1 deletion mypy/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,15 @@
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

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."""

Expand Down
3 changes: 3 additions & 0 deletions mypy/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -92,6 +94,7 @@ class BuildType:
COMPLETE_FEATURES: Final = frozenset((TYPE_VAR_TUPLE, UNPACK, NEW_GENERIC_SYNTAX))


@mypyc_attr(acyclic=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, _per_module_cache can cause problems in theory. Not sure how dangerous it is.

class Options:
"""Options collected from flags."""

Expand Down
4 changes: 4 additions & 0 deletions mypy/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1273,6 +1274,7 @@ def __eq__(self, other: object) -> bool:
return isinstance(other, UnpackType) and self.type == other.type


@mypyc_attr(acyclic=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure we can actually guarantee this. There is source_any that can refer to itself because of a flaw in type inference logic somewhere.

class AnyType(ProperType):
"""The type 'Any'."""

Expand Down Expand Up @@ -1381,6 +1383,7 @@ def read(cls, data: ReadBuffer) -> AnyType:
return ret


@mypyc_attr(acyclic=True)
class UninhabitedType(ProperType):
"""This type has no members.

Expand Down Expand Up @@ -1436,6 +1439,7 @@ def read(cls, data: ReadBuffer) -> UninhabitedType:
return UninhabitedType()


@mypyc_attr(acyclic=True)
class NoneType(ProperType):
"""The type of 'None'.

Expand Down