馃摑 docs: say that mode is read-only in the thread-local section - #716
Merged
Conversation
The thread-local documentation added in #543 lists mode among the per-thread context fields and then says "Setting one of these properties from one thread does not change the value seen by another thread". mode has no setter, so assigning it raises AttributeError; the sentence describes an operation that does not exist. mode genuinely is stored per-thread in the context, so it stays in the list of per-thread fields. The "setting" sentence in both the _api.py and asyncio.py docstrings and in docs/concepts.rst now names the writable properties (poll_interval, timeout, blocking, lifetime) and notes that mode is read-only and fixed at construction. Adds test_mode_is_read_only pinning the contract: mode assignment raises, and the four writable properties each expose a setter, so the docs and the code cannot drift again.
The nested parenthetical made the thread-local bullet hard to read and used a hyphen as a dash, which nothing else in the docs does. Restore the original sentence and state mode's read-only contract in a bullet of its own; the same sentence goes into both thread_local docstrings. test_mode_is_read_only asserted `.fset is not None` on the property objects, which passes even when a setter is broken, and it repeated coverage that test_thread_local_setter_visibility, test_subclass_compatibility and test_lifetime_property_getter_setter already give. Drop that half and read mode back instead, so a removed attribute cannot pass for a read-only one.
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.
The thread-local section from #543 lists
modeamong the per-thread configuration values and then says that setting one of these properties from one thread leaves the value other threads see alone. 馃摑modehas no setter, solock.mode = ...raisesAttributeError, and the sentence promises an operation the API does not offer.modestays in the list, because the context does hold it per thread. What changes is one added sentence naming the missing setter, in thethread_localparameter docs ofBaseFileLockandBaseAsyncFileLockand as its own bullet indocs/concepts.rst. Splitting it into a separate bullet keeps the surrounding sentence about property setters reading the way it did before.No behaviour change.