From bacb8f7f40fe52db27b6151cdcdc01703410565d Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Fri, 24 Mar 2023 15:03:41 +0300 Subject: [PATCH] `uuid.uuid{3,5}` accept bytes in 3.12 (#9936) --- stdlib/uuid.pyi | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/stdlib/uuid.pyi b/stdlib/uuid.pyi index 249257783..935e44e80 100644 --- a/stdlib/uuid.pyi +++ b/stdlib/uuid.pyi @@ -73,9 +73,20 @@ else: def getnode(*, getters: Unused = None) -> int: ... # undocumented def uuid1(node: _Int | None = None, clock_seq: _Int | None = None) -> UUID: ... -def uuid3(namespace: UUID, name: str) -> UUID: ... + +if sys.version_info >= (3, 12): + def uuid3(namespace: UUID, name: str | bytes) -> UUID: ... + +else: + def uuid3(namespace: UUID, name: str) -> UUID: ... + def uuid4() -> UUID: ... -def uuid5(namespace: UUID, name: str) -> UUID: ... + +if sys.version_info >= (3, 12): + def uuid5(namespace: UUID, name: str | bytes) -> UUID: ... + +else: + def uuid5(namespace: UUID, name: str) -> UUID: ... NAMESPACE_DNS: UUID NAMESPACE_URL: UUID