diff --git a/stdlib/@tests/stubtest_allowlists/py314.txt b/stdlib/@tests/stubtest_allowlists/py314.txt index f94c84c1ce70..fd106a659486 100644 --- a/stdlib/@tests/stubtest_allowlists/py314.txt +++ b/stdlib/@tests/stubtest_allowlists/py314.txt @@ -43,8 +43,6 @@ builtins.int.__round__ builtins.memoryview.__class_getitem__ builtins.staticmethod.__annotate__ builtins.staticmethod.__class_getitem__ -code.compile_command -codeop.compile_command compression.gzip.GzipFile.readinto compression.gzip.GzipFile.readinto compression.gzip.GzipFile.readinto1 diff --git a/stdlib/code.pyi b/stdlib/code.pyi index 16721927c236..0b13c8a5016d 100644 --- a/stdlib/code.pyi +++ b/stdlib/code.pyi @@ -1,5 +1,5 @@ import sys -from codeop import CommandCompiler +from codeop import CommandCompiler, compile_command as compile_command from collections.abc import Callable from types import CodeType from typing import Any @@ -52,5 +52,3 @@ else: local: dict[str, Any] | None = None, exitmsg: str | None = None, ) -> None: ... - -def compile_command(source: str, filename: str = "", symbol: str = "single") -> CodeType | None: ... diff --git a/stdlib/codeop.pyi b/stdlib/codeop.pyi index cfe52e9b35de..8e311343eb89 100644 --- a/stdlib/codeop.pyi +++ b/stdlib/codeop.pyi @@ -3,7 +3,11 @@ from types import CodeType __all__ = ["compile_command", "Compile", "CommandCompiler"] -def compile_command(source: str, filename: str = "", symbol: str = "single") -> CodeType | None: ... +if sys.version_info >= (3, 14): + def compile_command(source: str, filename: str = "", symbol: str = "single", flags: int = 0) -> CodeType | None: ... + +else: + def compile_command(source: str, filename: str = "", symbol: str = "single") -> CodeType | None: ... class Compile: flags: int