Fix shared type in _interpreters (#14328)

This commit is contained in:
sobolevn
2025-07-07 15:15:15 +03:00
committed by GitHub
parent b532f6be86
commit 4ceebbcd24
+15 -6
View File
@@ -1,9 +1,10 @@
import types
from collections.abc import Callable, Mapping
from typing import Final, Literal, SupportsIndex
from collections.abc import Callable
from typing import Any, Final, Literal, SupportsIndex
from typing_extensions import TypeAlias
_Configs: TypeAlias = Literal["default", "isolated", "legacy", "empty", ""]
_SharedDict: TypeAlias = dict[str, Any] # many objects can be shared
class InterpreterError(Exception): ...
class InterpreterNotFoundError(InterpreterError): ...
@@ -22,7 +23,11 @@ def is_running(id: SupportsIndex, *, restrict: bool = False) -> bool: ...
def get_config(id: SupportsIndex, *, restrict: bool = False) -> types.SimpleNamespace: ...
def whence(id: SupportsIndex) -> int: ...
def exec(
id: SupportsIndex, code: str | types.CodeType | Callable[[], object], shared: bool | None = None, *, restrict: bool = False
id: SupportsIndex,
code: str | types.CodeType | Callable[[], object],
shared: _SharedDict | None = None,
*,
restrict: bool = False,
) -> None | types.SimpleNamespace: ...
def call(
id: SupportsIndex,
@@ -33,12 +38,16 @@ def call(
restrict: bool = False,
) -> object: ...
def run_string(
id: SupportsIndex, script: str | types.CodeType | Callable[[], object], shared: bool | None = None, *, restrict: bool = False
id: SupportsIndex,
script: str | types.CodeType | Callable[[], object],
shared: _SharedDict | None = None,
*,
restrict: bool = False,
) -> None: ...
def run_func(
id: SupportsIndex, func: types.CodeType | Callable[[], object], shared: bool | None = None, *, restrict: bool = False
id: SupportsIndex, func: types.CodeType | Callable[[], object], shared: _SharedDict | None = None, *, restrict: bool = False
) -> None: ...
def set___main___attrs(id: SupportsIndex, updates: Mapping[str, object], *, restrict: bool = False) -> None: ...
def set___main___attrs(id: SupportsIndex, updates: _SharedDict, *, restrict: bool = False) -> None: ...
def incref(id: SupportsIndex, *, implieslink: bool = False, restrict: bool = False) -> None: ...
def decref(id: SupportsIndex, *, restrict: bool = False) -> None: ...
def is_shareable(obj: object) -> bool: ...