From d0ab3a369fe39f7b9b6169684636bd47e75b348e Mon Sep 17 00:00:00 2001 From: donbarbos Date: Tue, 6 Jan 2026 21:44:30 +0400 Subject: [PATCH] [random] Deprecate random parameter in shuffle function Docs: https://docs.python.org/3.10/library/random.html#random.shuffle --- stdlib/random.pyi | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/stdlib/random.pyi b/stdlib/random.pyi index a797794b8050..08619bf66351 100644 --- a/stdlib/random.pyi +++ b/stdlib/random.pyi @@ -3,8 +3,8 @@ import sys from _typeshed import SupportsLenAndGetItem from collections.abc import Callable, Iterable, MutableSequence, Sequence, Set as AbstractSet from fractions import Fraction -from typing import Any, ClassVar, NoReturn, TypeVar -from typing_extensions import Self +from typing import Any, ClassVar, NoReturn, TypeVar, overload +from typing_extensions import Self, deprecated __all__ = [ "Random", @@ -67,6 +67,10 @@ class Random(_random.Random): if sys.version_info >= (3, 11): def shuffle(self, x: MutableSequence[Any]) -> None: ... else: + @overload + def shuffle(self, x: MutableSequence[Any]) -> None: ... + @overload + @deprecated("The `random` parameter is deprecated since Python 3.9; removed in Python 3.11.") def shuffle(self, x: MutableSequence[Any], random: Callable[[], float] | None = None) -> None: ... if sys.version_info >= (3, 11): def sample(self, population: Sequence[_T], k: int, *, counts: Iterable[int] | None = None) -> list[_T]: ...