PyO3 / PyO3/pyo3

RFC: Make pyclass immutable by default

Open
#4,369 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Good First Issue refactoring
Dominant language
Rust
Stars
16.2k
Forks
1k
Avg merge
2d 6h
Merged PRs (30d)
66

Description

In https://github.com/PyO3/pyo3/pull/1979#pullrequestreview-803253395 we discussed that we'd like to have #[pyclass(mutable)], making pyclasses immutable by default and mutability opt-in.

Currently we have #[pyclass(frozen)] where this is the other way around; they are mutable by default.

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 by reading the linked pull-request review and the current #[pyclass(frozen)] behavior described in the issue. Define the attribute and compatibility requirements so pyclasses are immutable by default, with mutability explicitly opted into through #[pyclass(mutable)].

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.