Skip to content

Commit 36afde9

Browse files
authored
random: match seed type in __init__ (#11942)
1 parent 459c328 commit 36afde9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

stdlib/random.pyi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ _T = TypeVar("_T")
4141

4242
class Random(_random.Random):
4343
VERSION: ClassVar[int]
44-
def __init__(self, x: Any = None) -> None: ...
44+
if sys.version_info >= (3, 9):
45+
def __init__(self, x: int | float | str | bytes | bytearray | None = None) -> None: ... # noqa: Y041
46+
else:
47+
def __init__(self, x: Any = None) -> None: ...
4548
# Using other `seed` types is deprecated since 3.9 and removed in 3.11
4649
# Ignore Y041, since random.seed doesn't treat int like a float subtype. Having an explicit
4750
# int better documents conventional usage of random.seed.

0 commit comments

Comments
 (0)