Skip to content

Conversation

@srittau
Copy link
Collaborator

@srittau srittau commented Nov 2, 2025

Add UUID.__setattr__

Closes: #14964

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@srittau srittau marked this pull request as ready for review November 2, 2025 18:28
@srittau
Copy link
Collaborator Author

srittau commented Nov 2, 2025

psycopg is doing evil things, so I think the primer warning is acceptable:

https://github.com/psycopg/psycopg/blob/bc00e70457f31c48915ea5dce795c60fad57003c/psycopg_c/psycopg_c/_uuid.py#L28

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

I understand the motivation of changing UUID.int and UUID.is_safe, since these are not actually properties at runtime and are included in __slots__. But what's the motivation of changing the other properties? Most of these actually are properties at runtime, and are not included in __slots__ (so are unrelated to the issue Eric reported):

>>> from uuid import UUID
>>> UUID.__slots__
('int', 'is_safe', '__weakref__')
>>> UUID.int
<member 'int' of 'UUID' objects>
>>> UUID.is_safe
<member 'is_safe' of 'UUID' objects>
>>> UUID.bytes_le
<property object at 0x1034cb470>
>>> UUID.clock_seq
<property object at 0x1034dc220>

@github-actions
Copy link
Contributor

github-actions bot commented Nov 5, 2025

Diff from mypy_primer, showing the effect of this PR on open source code:

psycopg (https://github.com/psycopg/psycopg)
+ psycopg_c/psycopg_c/_uuid.py:28: error: Incompatible types in assignment (expression has type "Callable[[str, Any], None]", base class "UUID" defined the type as "Callable[[object, object], Never]")  [assignment]

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

Thanks!

@srittau srittau merged commit 07b69ab into python:main Nov 5, 2025
63 checks passed
@srittau srittau deleted the fix-uuid branch November 5, 2025 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression in definition of UUID.int

2 participants