python / python/cpython

Clarify `warnings.deprecated` public API

Open
#150,076 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

docs
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Documentation

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:

  1. Is that safe or might deprecated get e.g. refactored into a function at some point?
  2. Can we subclass it and add parameters? Will type checkers understand this and still mark a @our_deprecated_subclass(...) def ... as deprecated? See https://github.com/python/typing/issues/2256

maybe related to #138165

Linked PRs
  • gh-153879
  • gh-154487
  • gh-154488
  • gh-154489

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the current documentation for warnings.deprecated, then read linked PRs 153879, 154487, 154488, and 154489 alongside related issue 138165. Done means documenting the public class, instance attributes, subclassing behavior, and type-checker expectations, or recording the agreed answers.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.