Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Dec 28, 2024

Conversation

tungol
Copy link
Contributor

@tungol tungol commented Nov 6, 2024

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

This comment has been minimized.

@tungol tungol changed the title accurately represent threading.Lock improve identity of threading.Lock Nov 6, 2024

This comment has been minimized.

@tungol
Copy link
Contributor Author

tungol commented Nov 6, 2024

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
@tungol tungol changed the title improve identity of threading.Lock improve identity of threading module's Lock and RLock Nov 28, 2024

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

Copy link
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:main Dec 28, 2024
64 checks passed
@tungol tungol deleted the thread branch December 28, 2024 21:21
@cdce8p cdce8p 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 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.

2 participants