Skip to content

docs: clarify per-thread scope of FileLock configuration#543

Merged
gaborbernat merged 1 commit into
tox-dev:mainfrom
Gares95:docs/clarify-thread-local-context-fields
May 23, 2026
Merged

docs: clarify per-thread scope of FileLock configuration#543
gaborbernat merged 1 commit into
tox-dev:mainfrom
Gares95:docs/clarify-thread-local-context-fields

Conversation

@Gares95
Copy link
Copy Markdown
Contributor

@Gares95 Gares95 commented May 22, 2026

Clarifies that when thread_local=True (the default for sync FileLock/ SoftFileLock), every field of the internal FileLockContext lives on threading.local, including the configuration values poll_interval, timeout, blocking, mode, and lifetime — not only the lock counter and file descriptor that the existing docs name.

Updates:

  • BaseFileLock.__init__ and BaseAsyncFileLock.__init__ docstrings.
  • docs/concepts.rst "Thread-local vs shared state" section.
  • Two behaviour-pinning tests in tests/test_filelock.py covering setter visibility under both thread_local=True and thread_local=False.

No behaviour change; documentation and tests only.

Test plan

  • tox run / pytest tests/ passes locally (440 passed, 25 skipped on Python 3.12 / Linux).
  • pre-commit run --all-files passes.
  • New tests test_thread_local_setter_visibility and test_non_thread_local_setter_visibility pass for both FileLock and SoftFileLock.

…local=True

When thread_local=True (the default for sync locks), every field of
FileLockContext lives on threading.local — not only the lock counter
and file descriptor that the existing docs call out. This change makes
that explicit in the BaseFileLock/BaseAsyncFileLock docstrings and in
docs/concepts.rst, and adds behaviour-pinning tests for the per-thread
setter visibility under thread_local=True and the cross-thread
visibility under thread_local=False.

No behaviour change; documentation and tests only.
@Gares95 Gares95 force-pushed the docs/clarify-thread-local-context-fields branch from 908ef0a to a94d6d0 Compare May 22, 2026 23:23
@gaborbernat gaborbernat enabled auto-merge (squash) May 23, 2026 03:49
@gaborbernat gaborbernat merged commit 9200f1f into tox-dev:main May 23, 2026
32 checks passed
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