From 33b982f7b3ad9f3526b25c44668a96f27990adcb Mon Sep 17 00:00:00 2001 From: donBarbos Date: Tue, 13 May 2025 15:56:58 +0400 Subject: [PATCH] Update {code,codop}.compile_command in 3.14 --- stdlib/@tests/stubtest_allowlists/py314.txt | 2 -- stdlib/code.pyi | 4 +--- stdlib/codeop.pyi | 6 +++++- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/stdlib/@tests/stubtest_allowlists/py314.txt b/stdlib/@tests/stubtest_allowlists/py314.txt index 9697fef404e9..b178b18b7b92 100644 --- a/stdlib/@tests/stubtest_allowlists/py314.txt +++ b/stdlib/@tests/stubtest_allowlists/py314.txt @@ -46,8 +46,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