Skip to content

πŸ› fix(api): treat Windows drive letter case as one lock path - #929

Merged
gaborbernat merged 2 commits into
tox-dev:mainfrom
subotac:fix/windows-drive-lock-identity
Nov 17, 2026
Merged

gaborbernat merged 2 commits into
tox-dev:mainfrom
subotac:fix/windows-drive-lock-identity

Conversation

@subotac

@subotac subotac commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

On Windows, C:\work.lock and c:\work.lock name the same file, but filelock treated them as two locks. With is_singleton=True each spelling got its own instance, so code sharing one lock by path held two independent ones. With or without singletons, a same-thread acquire through the other spelling waited forever instead of raising the RuntimeError that reports a deadlock. πŸͺŸ Both spellings now share one singleton and trip the deadlock check.

Every place that keys a lock by path now ignores the case of the drive letter or the UNC \\server\share prefix: the FileLock and SoftReadWriteLock singleton caches and the same-thread deadlock registry. The rest of the path keeps its case, because Windows directories can opt into case-sensitive names, so C:\Work.lock and C:\work.lock remain two locks as the docs already advise. Each lock still opens and reports the path it was created with. On POSIX the drive prefix is always empty, so nothing changes there. The SQLite-backed ReadWriteLock already compared whole Windows paths without regard to case and is unchanged.

@gaborbernat
gaborbernat force-pushed the fix/windows-drive-lock-identity branch from 399fb9b to 69176eb Compare November 16, 2026 21:26
@gaborbernat
gaborbernat force-pushed the fix/windows-drive-lock-identity branch from 69176eb to f63bc66 Compare November 16, 2026 22:04
The concepts page said every spelling difference splits a lock, which
the drive-prefix fold made untrue on Windows. Name the exception, reword
the changelog entry for users, and pass a plain cancel_check in the
deadlock test.
@gaborbernat gaborbernat changed the title πŸ› fix(api): normalize Windows drive letters in lock identity πŸ› fix(api): treat Windows drive letter case as one lock path Nov 16, 2026
@gaborbernat
gaborbernat merged commit 390f53a into tox-dev:main Nov 17, 2026
50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants