You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current docs only specify that it sets the __deprecated__ attribute on the deprecated item.
Pydantic relies on its full API: the fact that it’s a class, and that its instances have all passed parameters in attributes: deprecated(**kw).__dict__ == kw basically.
Two questions:
Is that safe or might deprecated get e.g. refactored into a function at some point?
Can we subclass it and add parameters? Will type checkers understand this and still mark a @our_deprecated_subclass(...) def ... as deprecated? See How to extend warnings.deprecated? typing#2256
For context, this was discussed here during the implementation: #104004 (comment). It would maybe make sense to explicitly document it. For reference, typeshed already documents it as a class.
Activity
Viicos commentedon May 19, 2026
For context, this was discussed here during the implementation: #104004 (comment). It would maybe make sense to explicitly document it. For reference,
typeshedalready documents it as a class.Merge branch 'main' into fix-pythongh-150076-warnings-deprecated-api
pythongh-150076: Don't document warnings.deprecated internals as publ…
Merge branch 'main' into fix-pythongh-150076-warnings-deprecated-api
Merge branch 'main' into fix-pythongh-150076-warnings-deprecated-api
Merge branch 'main' into fix-pythongh-150076-warnings-deprecated-api
gh-150076: Fix the documented signature of warnings.deprecated (#153879)
[3.13] gh-150076: Fix the documented signature of warnings.deprecated (…
[3.14] gh-150076: Fix the documented signature of warnings.deprecated (…
[3.15] gh-150076: Fix the documented signature of warnings.deprecated (…
Viicos commentedon Jul 26, 2026
I don't think #153879 really fixes this issue.