gh-98963: Add a note to the error for property subclasses without __doc__ #99058
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.
Subclasses created using the C API don't get
__dict__
, which means their__doc__
can't be set for each property separately. The__doc__
descriptor fromproperty
itself is shadowed by the subclass's docstring.This edge case isn't really worth mentioning in the docs. This adds a note that should guide anyone encountering the issue to the right fix.
The newfangled
__notes__
mechanism is as non-invasive as it gets -- it even retains the original exception object -- while getting the information to the surprised user.(The message is longer than typical error messages, but IMO it's better to explain here than in the docs, where 99%+ of the readers don't need it.)
property
assumes that its subclasses have __dict__ #98963