Repository navigation
Conversation
emmatyping
approved these changes
Oct 22, 2026
picnixz
reviewed
Oct 22, 2026
Member
|
Ok that's weird: I deleted the file from your branch (and it shows as deleted) but GH is still showing it here. I will wait a bit (or maybe you should force push again). Sorry for the mess though (otherwise LGTM!) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pydantic constructs UUIDs by calling the type's
tp_newand settingintandis_safethroughPyObject_GenericSetAttr. The C UUID implementation made these descriptors read-only, so that construction path fails after #139123.Add setters for both descriptors, restoring construction through
object.__setattr__andPyObject_GenericSetAttr. Ordinary assignment still raisesTypeError, matching the Python UUID implementation. The integer setter validates the value and converts it into a temporary 16-byte, big-endian buffer before updating the UUID, so failed conversions leave the object unchanged. Successful replacement invalidates the cached hash.Tests cover construction without
__init__, subclasses, 128-bit boundary values, integer subclasses, hash invalidation, and rejected assignments preserving the original value and hash.Validation: the full
test_uuidsuite passed (165 tests, 22 skipped), including-R 3:3reference leak checks. A directPyObject_GenericSetAttrsmoke test reproduced Pydantic's construction sequence successfully. Ruff andgit diff --checkpassed.Refs #139122.