Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions stdlib/@tests/stubtest_allowlists/py314.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ importlib.metadata.DeprecatedNonAbstract.__new__
importlib.resources._common.files

sys._monitoring # Doesn't really exist. See comments in the stub.
sys.__jit # Similar to sys._monitoring
sys.last_exc # not always defined

# These only exist to give a better error message if you try to subclass an instance
Expand Down
12 changes: 12 additions & 0 deletions stdlib/@tests/test_cases/sys/check_jit.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import sys
from typing_extensions import assert_type

if sys.version_info >= (3, 14):
assert_type(sys._jit.is_available(), bool)
assert_type(sys._jit.is_enabled(), bool)
assert_type(sys._jit.is_active(), bool)

def sys_is_not_a_package() -> None:
# This has to be put into a function, because otherwise the presence
# of this import statement causes errors on the above usages of `sys._jit`.
import sys._jit # type: ignore
1 change: 1 addition & 0 deletions stdlib/VERSIONS
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ sunau: 3.0-3.12
symbol: 3.0-3.9
symtable: 3.0-
sys: 3.0-
sys.__jit: 3.14- # Similar to sys._monitoring
sys._monitoring: 3.12- # Doesn't actually exist. See comments in the stub.
sysconfig: 3.0-
syslog: 3.0-
Expand Down
4 changes: 4 additions & 0 deletions stdlib/sys/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -518,3 +518,7 @@ if sys.version_info >= (3, 14):
def is_remote_debug_enabled() -> bool: ...
def remote_exec(pid: int, script: StrOrBytesPath) -> None: ...
def _is_immortal(op: object, /) -> bool: ...

from . import __jit

_jit = __jit
11 changes: 11 additions & 0 deletions stdlib/sys/__jit.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This py314+ module provides annotations for `sys._jit`.
# It's named `sys.__jit` in typeshed,
# because trying to import `sys._jit` will fail at runtime!
# At runtime, `sys._jit` has the unusual status
# of being a `types.ModuleType` instance that cannot be directly imported,
# (same as sys.monitoring)
# and exists in the `sys`-module namespace despite `sys` not being a package.

def is_available() -> bool: ...
def is_enabled() -> bool: ...
def is_active() -> bool: ...
3 changes: 2 additions & 1 deletion stdlib/sys/_monitoring.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# This py312+ module provides annotations for `sys.monitoring`.
# It's named `sys._monitoring` in typeshed,
# because trying to import `sys.monitoring` will fail at runtime!
# At runtime, `sys.monitoring` has the unique status
# At runtime, `sys.monitoring` has the unusual status
# of being a `types.ModuleType` instance that cannot be directly imported,
# (same as sys._jit)
# and exists in the `sys`-module namespace despite `sys` not being a package.

import sys
Expand Down
Loading