Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Propose a less error-prone helper for module-level getattrs.#20857
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Does this method correctly distinguish between |
Yes. (In fact, that's the reason why I switched to a class-based approach, as a function-based approach would have trouble distinguishing either between missing globals and globals set to None, or between genuine AttributeErrors and AttributeErrors arising because of a bug in the calculation of the dynamically generated value.) |
Uh oh!
There was an error while loading.Please reload this page.
5d30b57
to87392d8
CompareApparently we always forget to generate the fallback AttributeError, sointroduce a helper to do so instead.The changes in `deprecation.py` are (a) so that one can correctlysuppress the inferred type when deprecating properties (the new check iscoherent with the `if isinstance(obj, type)` and other cases) and (b) tomake single-argument `__get__` work on deprecated properties(consistently with standard properties).
I don't know that it replaces it --- that PR simply adds a unit test. |
Uh oh!
There was an error while loading.Please reload this page.
Apparently we always forget to generate the fallback AttributeError (#20822,#20855), so
introduce a helper to do so instead. (I'm not wedded to the exact API...)
The changes in
deprecation.py
are (a) so that one can correctlysuppress the inferred type when deprecating properties (the new check is
coherent with the
if isinstance(obj, type)
and other cases) and (b) tomake single-argument
__get__
work on deprecated properties(consistently with standard properties).
Would replace#20856.
PR Summary
PR Checklist
pytest
passes).flake8
on changed files to check).flake8-docstrings
and runflake8 --docstring-convention=all
).doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).