From 3aeeebaf6285e15791ed1b17ea071f57620875db Mon Sep 17 00:00:00 2001 From: donbarbos Date: Tue, 6 Jan 2026 16:05:02 +0400 Subject: [PATCH] [importlib] Deprecate debug_override parameter in cache_from_source Docs: https://docs.python.org/3.14/library/importlib.html#importlib.util.cache_from_source Source: https://github.com/python/cpython/blob/9f91278412e30ca3daaa427614176b2891bd230a/Lib/importlib/_bootstrap_external.py#L239 --- stdlib/_frozen_importlib_external.pyi | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/stdlib/_frozen_importlib_external.pyi b/stdlib/_frozen_importlib_external.pyi index 4778be3af1f3..660cee6e84ec 100644 --- a/stdlib/_frozen_importlib_external.pyi +++ b/stdlib/_frozen_importlib_external.pyi @@ -9,7 +9,7 @@ from _typeshed.importlib import LoaderProtocol from collections.abc import Callable, Iterable, Iterator, Mapping, MutableSequence, Sequence from importlib.machinery import ModuleSpec from importlib.metadata import DistributionFinder, PathDistribution -from typing import Any, Final, Literal +from typing import Any, Final, Literal, overload from typing_extensions import Self, deprecated if sys.version_info >= (3, 10): @@ -26,7 +26,13 @@ else: MAGIC_NUMBER: Final[bytes] -def cache_from_source(path: StrPath, debug_override: bool | None = None, *, optimization: Any | None = None) -> str: ... +@overload +@deprecated( + "The `debug_override` parameter is deprecated since Python 3.5; will be removed in Python 3.15. Use `optimization` instead." +) +def cache_from_source(path: StrPath, debug_override: bool, *, optimization: None = None) -> str: ... +@overload +def cache_from_source(path: StrPath, debug_override: None = None, *, optimization: Any | None = None) -> str: ... def source_from_cache(path: StrPath) -> str: ... def decode_source(source_bytes: ReadableBuffer) -> str: ... def spec_from_file_location(