[3.15] gh-154389: Do not use uuid_create() on OpenBSD (GH-154390) (GH-154391)

serhiy-storchaka <[email protected]>
Newsgroups gmane.comp.python.cvs
Message-ID <[email protected]>
https://github.com/python/cpython/commit/fe66754f245d2ff3e80680429806b016992519dc
commit: fe66754f245d2ff3e80680429806b016992519dc
branch: 3.15
author: Miss Islington (bot) <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2026-07-21T20:02:34Z
summary:

[3.15] gh-154389: Do not use uuid_create() on OpenBSD (GH-154390) (GH-154391)

Like NetBSD, OpenBSD generates version 4 UUIDs in uuid_create(), so it
cannot be used for uuid.uuid1().
(cherry picked from commit c76fb912070389e0fbad3bf4eab066cd5da931b9)

Co-authored-by: Serhiy Storchaka <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>

files:
A Misc/NEWS.d/next/Library/2026-07-21-20-34-05.gh-issue-154389.DlTiii.rst
M configure
M configure.ac

diff --git a/Misc/NEWS.d/next/Library/2026-07-21-20-34-05.gh-issue-154389.DlTiii.rst b/Misc/NEWS.d/next/Library/2026-07-21-20-34-05.gh-issue-154389.DlTiii.rst
new file mode 100644
index 00000000000000..eb2e2edc2d720e
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2026-07-21-20-34-05.gh-issue-154389.DlTiii.rst
@@ -0,0 +1,3 @@
+Fix :func:`uuid.uuid1` on OpenBSD:
+it returned a version 4 UUID,
+because ``uuid_create()`` generates random UUIDs on this platform.
diff --git a/configure b/configure
index af350fbb132d78..dd506e6899515b 100755
--- a/configure
+++ b/configure
@@ -15162,9 +15162,10 @@ then :
 
 fi
 
-# gh-124228: While the libuuid library is available on NetBSD, it supports only UUID version 4.
+# gh-124228: While the libuuid library is available on NetBSD and OpenBSD,
+# it supports only UUID version 4.
 # This restriction inhibits the proper generation of time-based UUIDs.
-if test "$ac_sys_system" = "NetBSD"; then
+if test "$ac_sys_system" = "NetBSD" || test "$ac_sys_system" = "OpenBSD"; then
   have_uuid=missing
   printf "%s\n" "#define HAVE_UUID_H 0" >>confdefs.h
 
diff --git a/configure.ac b/configure.ac
index a8bd6b884a131c..73d0bb48ea8f4f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4003,9 +4003,10 @@ AS_VAR_IF([ac_cv_have_uuid_generate_time_safe], [yes], [
   AC_DEFINE([HAVE_UUID_GENERATE_TIME_SAFE], [1])
 ])
 
-# gh-124228: While the libuuid library is available on NetBSD, it supports only UUID version 4.
+# gh-124228: While the libuuid library is available on NetBSD and OpenBSD,
+# it supports only UUID version 4.
 # This restriction inhibits the proper generation of time-based UUIDs.
-if test "$ac_sys_system" = "NetBSD"; then
+if test "$ac_sys_system" = "NetBSD" || test "$ac_sys_system" = "OpenBSD"; then
   have_uuid=missing
   AC_DEFINE([HAVE_UUID_H], [0])
 fi

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.