Skip to content

Commit 684c0a6

Browse files
authored
[stdlib] add importlib.util._incompatible_extension_module_restrictions (#15013)
1 parent 0d05183 commit 684c0a6

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

stdlib/importlib/util.pyi

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ from importlib._bootstrap_external import (
1212
spec_from_file_location as spec_from_file_location,
1313
)
1414
from importlib.abc import Loader
15-
from typing_extensions import ParamSpec, deprecated
15+
from types import TracebackType
16+
from typing import Literal
17+
from typing_extensions import ParamSpec, Self, deprecated
1618

1719
_P = ParamSpec("_P")
1820

@@ -44,6 +46,18 @@ class LazyLoader(Loader):
4446

4547
def source_hash(source_bytes: ReadableBuffer) -> bytes: ...
4648

49+
if sys.version_info >= (3, 12):
50+
class _incompatible_extension_module_restrictions:
51+
def __init__(self, *, disable_check: bool) -> None: ...
52+
disable_check: bool
53+
old: Literal[-1, 0, 1] # exists only while entered
54+
def __enter__(self) -> Self: ...
55+
def __exit__(
56+
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
57+
) -> None: ...
58+
@property
59+
def override(self) -> Literal[-1, 1]: ... # undocumented
60+
4761
if sys.version_info >= (3, 14):
4862
__all__ = [
4963
"LazyLoader",

0 commit comments

Comments
 (0)