Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Prev Previous commit
Next Next commit
Use frozenset for EMPTY
  • Loading branch information
VaggelisD committed Feb 25, 2026
commit 5b6c1acef1f2b52af916f6fec32ee4478ef58e4b
6 changes: 3 additions & 3 deletions mypyc/analysis/dataflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import annotations

from abc import abstractmethod
from collections.abc import Iterable, Iterator
from collections.abc import Iterable, Iterator, Set as AbstractSet
from typing import Any, Generic, TypeVar

from mypyc.ir.ops import (
Expand Down Expand Up @@ -174,9 +174,9 @@ def __str__(self) -> str:
return f"before: {self.before}\nafter: {self.after}\n"


GenAndKill = tuple[set[T], set[T]]
GenAndKill = tuple[AbstractSet[T], AbstractSet[T]]

_EMPTY: GenAndKill[Any] = (set(), set())
_EMPTY: tuple[frozenset[Any], frozenset[Any]] = (frozenset(), frozenset())


class BaseAnalysisVisitor(OpVisitor[GenAndKill[T]]):
Expand Down
4 changes: 3 additions & 1 deletion mypyc/analysis/selfleaks.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@
)
from mypyc.ir.rtypes import RInstance

GenAndKill = tuple[set[None], set[None]]
from mypyc.analysis.dataflow import GenAndKill as _DataflowGenAndKill

GenAndKill = _DataflowGenAndKill[None]

CLEAN: GenAndKill = (set(), set())
DIRTY: GenAndKill = ({None}, {None})
Expand Down
Loading