[stdlib] add importlib.util._incompatible_extension_module_restrictions (#15013)

This commit is contained in:
Guo Ci
2025-11-14 16:22:41 -05:00
committed by GitHub
parent 0d05183d9b
commit 684c0a6007
+15 -1
View File
@@ -12,7 +12,9 @@ from importlib._bootstrap_external import (
spec_from_file_location as spec_from_file_location,
)
from importlib.abc import Loader
from typing_extensions import ParamSpec, deprecated
from types import TracebackType
from typing import Literal
from typing_extensions import ParamSpec, Self, deprecated
_P = ParamSpec("_P")
@@ -44,6 +46,18 @@ class LazyLoader(Loader):
def source_hash(source_bytes: ReadableBuffer) -> bytes: ...
if sys.version_info >= (3, 12):
class _incompatible_extension_module_restrictions:
def __init__(self, *, disable_check: bool) -> None: ...
disable_check: bool
old: Literal[-1, 0, 1] # exists only while entered
def __enter__(self) -> Self: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
@property
def override(self) -> Literal[-1, 1]: ... # undocumented
if sys.version_info >= (3, 14):
__all__ = [
"LazyLoader",