Skip to content

improve identity of threading module's Lock and RLock - #12966

Merged
JelleZijlstra merged 8 commits into
python:mainfrom
tungol:thread
Dec 28, 2024
Merged

improve identity of threading module's Lock and RLock#12966
JelleZijlstra merged 8 commits into
python:mainfrom
tungol:thread

Conversation

@tungol

@tungoltungol commented Nov 6, 2024

Copy link
Copy Markdown
Contributor

Removes extra copy of the type, although I did immediately add back a different extra copy for the minor benefit of getting the name _thread.lock correct on 3.13+. We can call it even, I guess.

@tungol
tungol marked this pull request as draft November 6, 2024 23:38
@github-actions

This comment has been minimized.

@tungoltungol changed the title accurately represent threading.Lockimprove identity of threading.LockNov 6, 2024
@github-actions

This comment has been minimized.

@tungol

Copy link
Copy Markdown
ContributorAuthor

The unused ignore is from threading.Lock = value producing the error error: Cannot assign to a type [misc].

@tungol
tungol marked this pull request as ready for review November 6, 2024 23:57
@tungoltungol changed the title improve identity of threading.Lockimprove identity of threading module's Lock and RLockNov 28, 2024
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

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

discord.py (https://github.com/Rapptz/discord.py)
- discord/webhook/sync.py:153: error: Incompatible types in assignment (expression has type "DeferredLock", variable has type "Lock") [assignment]+ discord/webhook/sync.py:153: error: Incompatible types in assignment (expression has type "DeferredLock", variable has type "LockType") [assignment]- discord/webhook/sync.py:197: error: "Lock" has no attribute "delay_by" [attr-defined]+ discord/webhook/sync.py:197: error: "LockType" has no attribute "delay_by" [attr-defined]
dd-trace-py (https://github.com/DataDog/dd-trace-py)
+ ddtrace/profiling/collector/threading.py:43: error: Unused "type: ignore" comment [unused-ignore]

@JelleZijlstra
JelleZijlstra merged commit 801c5c9 into python:mainDec 28, 2024
@tungol
tungol deleted the thread branch December 28, 2024 21:21
@cdce8pcdce8p mentioned this pull request Jan 1, 2025
hoel-bagard pushed a commit to hoel-bagard/typeshed that referenced this pull request Jan 5, 2025
Sign up for freeto 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.

2 participants

@tungol@JelleZijlstra