Skip to content

Objects satisfying the core.types.Lock interface should also be hashable#11333

Merged
dcherian merged 4 commits into
pydata:mainfrom
jonathandung:main
May 20, 2026
Merged

Objects satisfying the core.types.Lock interface should also be hashable#11333
dcherian merged 4 commits into
pydata:mainfrom
jonathandung:main

Conversation

@jonathandung
Copy link
Copy Markdown
Contributor

@jonathandung jonathandung commented May 12, 2026

Description

Parent: python/typeshed#15754.

Basically, because backends.locks.CombinedLock.__init__ uses set to remove duplicates from a sequence of instances of classes implementing the Lock interface, all locks must be hashable in addition to implementing the current methods.

Checklist

N/A

@jonathandung jonathandung changed the title Objects satisfying the core.types.Lock interface should also be hashable Objects satisfying the core.types.Lock interface should also be hashable May 15, 2026
@dcherian
Copy link
Copy Markdown
Contributor

Failures appear unrelated.

@dcherian dcherian merged commit adc4ebd into pydata:main May 20, 2026
33 of 43 checks passed
@welcome
Copy link
Copy Markdown

welcome Bot commented May 20, 2026

Congratulations on completing your first pull request! Welcome to Xarray! We are proud of you, and hope to see you again! celebration gif

maxrjones pushed a commit to maxrjones/xarray that referenced this pull request May 21, 2026
…hable (pydata#11333)

* Add __hash__ to core.types.Lock protocol

* Implement hash in `Lock` protocol

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants