Skip to content

Add deprecation warnings for deprecated items in ast.py #140344

Closed

Description

@jepler

Feature or enhancement

Proposal:

Actually remove the following classes, which were marked as deprecated in Python 3.9:

class Suite(mod):
    """Deprecated AST node class.  Unused in Python 3."""

class AugLoad(expr_context):
    """Deprecated AST node class.  Unused in Python 3."""

class AugStore(expr_context):
    """Deprecated AST node class.  Unused in Python 3."""

These were previously removed but then restored in GH-19056 (Python 3.9)

If it's not feasible to remove them in 3.15 (for instance, as there was never been a runtime deprecation warning added) then add the runtime deprecation instead.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

Activity

  1. added 2 commits that reference this issue on Oct 20, 2025
  2. changed the title [-]Actually reomve deprecated classes from ast.py[/-] [+]Actually remove deprecated classes from ast.py[/+] on Oct 20, 2025
  3. added a commit that references this issue on Oct 20, 2025
  4. hugovk commented on Oct 20, 2025

    @hugovk
    Member

    We should follow PEP 387 and add deprecation warnings for a few releases first.

    #19056 (comment) says why we didn't do that before, but let's do that now.

  5. added
    stdlibStandard Library Python modules in the Lib/ directory
    on Oct 20, 2025
  6. jepler commented on Oct 20, 2025

    @jepler
    ContributorAuthor

    Thanks for the feedback.

    I'll close the first PR I made and open a fresh one that adds deprecation notices. Is warnings.deprecated decorator an appropriate way to do that? I'll have a gander at how this is being done elsewhere.

  7. hugovk commented on Oct 20, 2025

    @hugovk
    Member

    I usually use warnings._deprecated: https://discuss.python.org/t/introducing-warnings-deprecated/14856

    For example:

    cpython/Lib/imaplib.py

    Lines 1969 to 1971 in e4f6445

    from warnings import _deprecated
    _deprecated("__version__", remove=(3, 20))

  8. hugovk commented on Oct 20, 2025

    @hugovk
    Member

    If you want, we can re-use this issue and just change the title/description?

  9. added a commit that references this issue on Oct 20, 2025
  10. jepler commented on Oct 20, 2025

    @jepler
    ContributorAuthor

    Oops, my mistake -- I closed the issue instead of the PR. If you re-open this, that would be excellent.

  11. changed the title [-]Actually remove deprecated classes from ast.py[/-] [+]Add deprecation warnings for deprecated items in ast.py[/+] on Oct 20, 2025
  12. reopened this on Oct 20, 2025
  13. added 2 commits that reference this issue on May 18, 2026
  14. added a commit that references this issue on May 18, 2026
  15. hugovk commented on May 18, 2026

    @hugovk
    Member

    Thank you for the PR! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions