Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b383c7d
Issue #gh-139122: Reimplement base UUID type, uuid4(), and uuid7() in C
1st1 Sep 17, 2025
325ded0
Address @picnixz's review
1st1 Sep 19, 2025
f9b1b0a
Regen the clinic files
1st1 Sep 19, 2025
44c9a58
Clarify the type name
1st1 Sep 19, 2025
70ec40c
Fix news
1st1 Sep 19, 2025
fffb329
Trim the NEWS file down
1st1 Sep 19, 2025
55c781c
Use PyObject* in getters
1st1 Sep 19, 2025
0dd56dd
Codegen string literals and use them
1st1 Sep 19, 2025
0ec891b
Ensure total compatibility of C/Python implementations of uuid4 / uuid7
1st1 Sep 21, 2025
39360c1
Stop importing unused SafeUUID members
1st1 Sep 21, 2025
9c31cf7
Drop SafeUUID.unknown
1st1 Sep 21, 2025
fe8ce01
Drop more things that can be imported dynamically
1st1 Sep 21, 2025
01bb137
Remove circular import; import 'uuid' from '_uuid' lazily
1st1 Sep 21, 2025
dff1e4f
Regen files
1st1 Sep 22, 2025
5b8f47f
Get module state assuming there could be subclasses of UUID
1st1 Sep 22, 2025
cbf7226
More ergonomic int cast code
1st1 Sep 22, 2025
d43cb28
gh-139122: Fix UUID subclass allocation and freelist type ownership
1st1 Oct 19, 2026
436e39d
gh-139122: Match UUID state restoration mapping semantics
1st1 Oct 19, 2026
0c8c3a0
gh-139122: Fix UUID time hook error handling and reference updates
1st1 Oct 19, 2026
4e0388f
gh-139122: Align C UUID constructor inputs with Python
1st1 Oct 19, 2026
e543a0c
gh-139122: Make UUID narrowing and entropy lock requirements explicit
1st1 Oct 19, 2026
d09404a
gh-139122: Preserve UUID fields length errors
1st1 Oct 20, 2026
68e41aa
gh-139122: Clarify version-specific UUID layouts
1st1 Oct 20, 2026
404ce3b
gh-139122: Apply UUID review cleanup
1st1 Oct 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Doc/library/uuid.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ which relays any information about the UUID's safety, using this enumeration:
variant and version number set according to :rfc:`9562`, overriding bits in the
given *hex*, *bytes*, *bytes_le*, *fields*, or *int*.

.. versionchanged:: 3.16
Passing an object other than :class:`bytes` as *bytes* or *bytes_le*
now consistently raises :exc:`TypeError`. Previously, some invalid inputs
raised :exc:`AssertionError` or :exc:`ValueError`.

Comparison of UUID objects are made by way of comparing their
:attr:`UUID.int` attributes. Comparison with a non-UUID object
raises a :exc:`TypeError`.
Expand Down
6 changes: 6 additions & 0 deletions Doc/whatsnew/3.16.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1081,6 +1081,12 @@ that may require changes to your code.
:exc:`TypeError`.
(Contributed by Serhiy Storchaka in :gh:`152587`.)

* :class:`uuid.UUID` now consistently raises :exc:`TypeError` when the

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The performance improvement also deserves to be mentioned. Either here or in the optimization section.

*bytes* or *bytes_le* argument is not a :class:`bytes` object.
Previously, some invalid inputs raised :exc:`AssertionError` or
:exc:`ValueError`.
(Contributed by Yury Selivanov in :gh:`139123`.)

* :mod:`xml.dom.minidom` now raises :exc:`~xml.dom.InvalidCharacterErr`
for a name which is not a valid XML name,
:exc:`~xml.dom.WrongDocumentErr`
Expand Down
6 changes: 6 additions & 0 deletions Include/internal/pycore_global_objects_fini_generated.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Include/internal/pycore_global_strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ struct _Py_global_strings {
STRUCT_FOR_ID(byte_size)
STRUCT_FOR_ID(byteorder)
STRUCT_FOR_ID(bytes)
STRUCT_FOR_ID(bytes_le)
STRUCT_FOR_ID(bytes_per_sep)
STRUCT_FOR_ID(c_call)
STRUCT_FOR_ID(c_exception)
Expand Down Expand Up @@ -543,6 +544,7 @@ struct _Py_global_strings {
STRUCT_FOR_ID(hash_name)
STRUCT_FOR_ID(header)
STRUCT_FOR_ID(headers)
STRUCT_FOR_ID(hex)
STRUCT_FOR_ID(hi)
STRUCT_FOR_ID(hook)
STRUCT_FOR_ID(host)
Expand Down Expand Up @@ -576,13 +578,15 @@ struct _Py_global_strings {
STRUCT_FOR_ID(insert_comments)
STRUCT_FOR_ID(insert_pis)
STRUCT_FOR_ID(instructions)
STRUCT_FOR_ID(int)
STRUCT_FOR_ID(intern)
STRUCT_FOR_ID(intersection)
STRUCT_FOR_ID(interval)
STRUCT_FOR_ID(io)
STRUCT_FOR_ID(is_compress)
STRUCT_FOR_ID(is_raw)
STRUCT_FOR_ID(is_running)
STRUCT_FOR_ID(is_safe)
STRUCT_FOR_ID(is_struct)
STRUCT_FOR_ID(isatty)
STRUCT_FOR_ID(isinstance)
Expand Down Expand Up @@ -756,6 +760,7 @@ struct _Py_global_strings {
STRUCT_FOR_ID(query)
STRUCT_FOR_ID(queuetype)
STRUCT_FOR_ID(quotetabs)
STRUCT_FOR_ID(random_func)
STRUCT_FOR_ID(raw)
STRUCT_FOR_ID(read)
STRUCT_FOR_ID(read1)
Expand Down Expand Up @@ -870,6 +875,7 @@ struct _Py_global_strings {
STRUCT_FOR_ID(threading)
STRUCT_FOR_ID(throw)
STRUCT_FOR_ID(time)
STRUCT_FOR_ID(time_func)
STRUCT_FOR_ID(timeout)
STRUCT_FOR_ID(timer)
STRUCT_FOR_ID(times)
Expand Down
4 changes: 2 additions & 2 deletions Include/internal/pycore_pylifecycle.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ extern const char* _Py_gitversion(void);
// Export for '_asyncio' shared extension
PyAPI_FUNC(int) _Py_IsInterpreterFinalizing(PyInterpreterState *interp);

/* Random */
extern int _PyOS_URandom(void *buffer, Py_ssize_t size);
// Export for '_uuid' shared extension
PyAPI_FUNC(int) _PyOS_URandom(void *buffer, Py_ssize_t size);

// Export for '_random' shared extension
PyAPI_FUNC(int) _PyOS_URandomNonblock(void *buffer, Py_ssize_t size);
Expand Down
6 changes: 6 additions & 0 deletions Include/internal/pycore_runtime_init_generated.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Include/internal/pycore_unicodeobject_generated.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading