Skip to content

Preserve wrapped converter return annotations in pipe - #1631

Open
Boulea7 wants to merge 2 commits into
python-attrs:mainfrom
Boulea7:ln-cx/attrs-pipe-annotation-311
Open

Boulea7 wants to merge 2 commits into
python-attrs:mainfrom
Boulea7:ln-cx/attrs-pipe-annotation-311

Conversation

@Boulea7

@Boulea7 Boulea7 commented Sep 29, 2026 •

Copy link
Copy Markdown

Summary

On early Python 3.11 releases, pipe() loses the return annotation of a final Converter because the instance signature cannot be inspected. Reading its annotated __call__ preserves the annotation without changing conversion behavior.

The regression passes on Python 3.11.2. The Python 3.14 suite and documentation checks pass, with combined Python 3.12/3.14 coverage at 100%. The full tox matrix has not been run locally.

Pull Request Checklist

  • I acknowledge this project's AI policy.
  • This pull request is not from my main branch.
  • There's tests for all new and changed code.
  • Changes or additions to public APIs are reflected in our type stubs (files ending in .pyi).
    • ...and used in the stub test file typing_tests/baseline.py or, if necessary, typing_tests/mypy.py.
    • If they've been added to attr/__init__.pyi, they've also been re-imported in attrs/__init__.pyi.
  • The documentation has been updated.
    • New functions/classes have to be added to docs/api.rst by hand.
    • Changes to the signatures of @attr.s() and @attrs.define() have to be added by hand too.
    • Changed/added classes/methods/functions have appropriate versionadded, versionchanged, or deprecated directives.
      The next version is the second number in the current release + 1.
      The first number represents the current year.
      So if the current version on PyPI is 26.2.0, the next version is gonna be 26.3.0.
      If the next version is the first in the new year, it'll be 27.1.0.
    • Documentation in .rst and .md files is written using semantic newlines.
  • Changes have news fragments in changelog.d.

@Boulea7
Boulea7 marked this pull request as ready for review September 29, 2026 19:15
Copilot AI balanced review requested due to automatic review settings September 29, 2026 19:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants