Skip to content

Commit 7c9cc3b

Browse files
[stdlib] Update _interpreters (python#14615)
Related python#14588 Co-authored-by: Jelle Zijlstra <[email protected]>
1 parent aeb9aa3 commit 7c9cc3b

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

stdlib/_interpreters.pyi

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import types
22
from collections.abc import Callable
3-
from typing import Any, Final, Literal, SupportsIndex, TypeVar
3+
from typing import Any, Final, Literal, SupportsIndex, TypeVar, overload
44
from typing_extensions import TypeAlias
55

66
_R = TypeVar("_R")
@@ -18,42 +18,38 @@ class CrossInterpreterBufferView:
1818
def new_config(name: _Configs = "isolated", /, **overides: object) -> types.SimpleNamespace: ...
1919
def create(config: types.SimpleNamespace | _Configs | None = "isolated", *, reqrefs: bool = False) -> int: ...
2020
def destroy(id: SupportsIndex, *, restrict: bool = False) -> None: ...
21-
def list_all(*, require_ready: bool) -> list[tuple[int, int]]: ...
22-
def get_current() -> tuple[int, int]: ...
23-
def get_main() -> tuple[int, int]: ...
21+
def list_all(*, require_ready: bool = False) -> list[tuple[int, _Whence]]: ...
22+
def get_current() -> tuple[int, _Whence]: ...
23+
def get_main() -> tuple[int, _Whence]: ...
2424
def is_running(id: SupportsIndex, *, restrict: bool = False) -> bool: ...
2525
def get_config(id: SupportsIndex, *, restrict: bool = False) -> types.SimpleNamespace: ...
2626
def whence(id: SupportsIndex) -> _Whence: ...
2727
def exec(
28-
id: SupportsIndex,
29-
code: str | types.CodeType | Callable[[], object],
30-
shared: _SharedDict | None = None,
31-
*,
32-
restrict: bool = False,
28+
id: SupportsIndex, code: str | types.CodeType | Callable[[], object], shared: _SharedDict = {}, *, restrict: bool = False
3329
) -> None | types.SimpleNamespace: ...
3430
def call(
3531
id: SupportsIndex,
3632
callable: Callable[..., _R],
37-
args: tuple[Any, ...] | None = None,
38-
kwargs: dict[str, Any] | None = None,
33+
args: tuple[Any, ...] = (),
34+
kwargs: dict[str, Any] = {},
3935
*,
36+
preserve_exc: bool = False,
4037
restrict: bool = False,
4138
) -> tuple[_R, types.SimpleNamespace]: ...
4239
def run_string(
43-
id: SupportsIndex,
44-
script: str | types.CodeType | Callable[[], object],
45-
shared: _SharedDict | None = None,
46-
*,
47-
restrict: bool = False,
40+
id: SupportsIndex, script: str | types.CodeType | Callable[[], object], shared: _SharedDict = {}, *, restrict: bool = False
4841
) -> None: ...
4942
def run_func(
50-
id: SupportsIndex, func: types.CodeType | Callable[[], object], shared: _SharedDict | None = None, *, restrict: bool = False
43+
id: SupportsIndex, func: types.CodeType | Callable[[], object], shared: _SharedDict = {}, *, restrict: bool = False
5144
) -> None: ...
5245
def set___main___attrs(id: SupportsIndex, updates: _SharedDict, *, restrict: bool = False) -> None: ...
5346
def incref(id: SupportsIndex, *, implieslink: bool = False, restrict: bool = False) -> None: ...
5447
def decref(id: SupportsIndex, *, restrict: bool = False) -> None: ...
5548
def is_shareable(obj: object) -> bool: ...
56-
def capture_exception(exc: BaseException | None = None) -> types.SimpleNamespace: ...
49+
@overload
50+
def capture_exception(exc: BaseException) -> types.SimpleNamespace: ...
51+
@overload
52+
def capture_exception(exc: None = None) -> types.SimpleNamespace | None: ...
5753

5854
_Whence: TypeAlias = Literal[0, 1, 2, 3, 4, 5]
5955
WHENCE_UNKNOWN: Final = 0

0 commit comments

Comments
 (0)