python / python/cpython

Support copy.replace() for email.policy.Policy

Open
#155,042 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stdlib topic-email type-feature
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Feature or enhancement

email.policy.Policy.clone() already has the semantics of copy.replace(), but the class does not support the protocol.

I propose to add __replace__ = clone, so that copy.replace(policy, max_line_length=100) works like policy.clone(max_line_length=100).

Linked PRs
  • gh-155048

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 email.policy.Policy.clone and the copy.replace protocol described in the issue. Confirm that copy.replace(policy, max_line_length=100) behaves like policy.clone(max_line_length=100), and add or update coverage for that call before verifying the relevant tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.