Repository navigation
Conversation
This branch has not been deployed
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.
Why
_Registry.__setitem__only cleared theget_upath_class()cache when the protocol was already registered. A protocol looked up before it was registered stays cached asNone:What changes
upath/registry.py:__setitem__now always clears theget_upath_classand_get_implementation_protocolscaches after storing the value. Registrations are rare, so clearing every time costs nothing noticeable.upath/tests/test_registry.py:test_register_implementation_after_failed_lookuplooks a protocol up, registers it, and looks it up again.CHANGELOG.md: entry under Unreleased / Fixed.This does not touch the concurrent
register_implementation(..., clobber=True)race in #613.Tests
main:1 failed, 38 passed(assert None is <class ...LateProtoPath>); with the fix:39 passedinupath/tests/test_registry.py.pytest upath(Python 3.11): 4769 passed and 49 failed onmain, 4770 passed and the same 49 failed with the fix. The failures are network-dependent cases (test_github.pyand a few others) that fail the same way onmain;test_pydantic.pywas left out becausepydanticis not installed here.ruff format --checkandmypy upath/registry.py: clean.Closes #612