From 3e76afe9094ab5de384f7da6ed6da7996d0703d6 Mon Sep 17 00:00:00 2001 From: Semyon Moroz Date: Thu, 24 Jul 2025 22:32:33 +0000 Subject: [PATCH] [tempfile] Deprecate `mktemp` function (#14433) --- stdlib/tempfile.pyi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stdlib/tempfile.pyi b/stdlib/tempfile.pyi index ea6e057e4..6b2abe439 100644 --- a/stdlib/tempfile.pyi +++ b/stdlib/tempfile.pyi @@ -15,7 +15,7 @@ from _typeshed import ( from collections.abc import Iterable, Iterator from types import GenericAlias, TracebackType from typing import IO, Any, AnyStr, Generic, Literal, overload -from typing_extensions import Self +from typing_extensions import Self, deprecated __all__ = [ "NamedTemporaryFile", @@ -471,6 +471,7 @@ def mkstemp( def mkdtemp(suffix: str | None = None, prefix: str | None = None, dir: StrPath | None = None) -> str: ... @overload def mkdtemp(suffix: bytes | None = None, prefix: bytes | None = None, dir: BytesPath | None = None) -> bytes: ... +@deprecated("Deprecated since Python 2.3. Use `mkstemp()` or `NamedTemporaryFile(delete=False)` instead.") def mktemp(suffix: str = "", prefix: str = "tmp", dir: StrPath | None = None) -> str: ... def gettempdirb() -> bytes: ... def gettempprefixb() -> bytes: ...