Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

PEP 795: Deep Immutability in Python#4468

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
TobiasWrigstad wants to merge4 commits intopython:main
base:main
Choose a base branch
Loading
fromTobiasWrigstad:pep795

Conversation

@TobiasWrigstad
Copy link

@TobiasWrigstadTobiasWrigstad commentedJun 19, 2025
edited by github-actionsbot
Loading

Basic requirements (all PEP Types)

  • Read and followedPEP 1 &PEP 12
  • File created from thelatest PEP template
  • PEP has next available number, & set in filename (pep-NNNN.rst), PR title (PEP 123: <Title of PEP>) andPEP header
  • Title clearly, accurately and concisely describes the content in 79 characters or less
  • Core dev/PEP editor listed asAuthor orSponsor, and formally confirmed their approval
  • Author,Status (Draft),Type andCreated headers filled out correctly
  • PEP-Delegate,Topic,Requires andReplaces headers completed if appropriate
  • Required sections included
    • Abstract (first section)
    • Copyright (last section; exact wording from template required)
  • Code is well-formatted (PEP 7/PEP 8) and is incode blocks, with the right lexer names if non-Python
  • PEP builds with no warnings, pre-commit checks pass and content displays as intended in the rendered HTML
  • Authors/sponsor added to.github/CODEOWNERS for the PEP

Standards Track requirements

  • PEP topicdiscussed in a suitable venue with general agreement that a PEP is appropriate
  • Suggested sections included (unless not applicable)
    • Motivation
    • Rationale
    • Specification
    • Backwards Compatibility
    • Security Implications
    • How to Teach This
    • Reference Implementation
    • Rejected Ideas
    • Open Issues
  • Python-Version set to valid (pre-beta) future Python version, if relevant
  • Any project stated in the PEP as supporting/endorsing/benefiting from the PEP formally confirmed such
  • Right before or after initial merging,PEP discussion thread created and linked to inDiscussions-To andPost-History

📚 Documentation preview 📚:https://pep-previews--4468.org.readthedocs.build/

xFrednet reacted with heart emoji
@TobiasWrigstadTobiasWrigstad requested a review froma team as acode ownerJune 19, 2025 06:16
@python-cla-bot
Copy link

python-cla-botbot commentedJun 19, 2025
edited
Loading

All commit authors signed the Contributor License Agreement.

CLA signed

@TobiasWrigstadTobiasWrigstadforce-pushed thepep795 branch 3 times, most recently fromb2bf4aa to7cedb55CompareJune 19, 2025 06:38
@AA-TurnerAA-Turner changed the titlePEP 795: Add deep immutability to PythonPEP 795: Deep Immutability in PythonJun 19, 2025
@AA-TurnerAA-Turner added the new-pepA new draft PEP submitted for initial review labelJun 19, 2025
Copy link
Member

Choose a reason for hiding this comment

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

Is there a programmatic/text source that this file was created from? If so, it would be useful to include that, and also consider using an SVG file rather than a PNG.

Choose a reason for hiding this comment

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

Hmm. We followed PEP12 which says:

peps/peps/pep-0012.rst

Lines 604 to 605 inb5ae2b1

Currently, SVG must be avoided due to compatibility issues with the
PEP build system.

Maybe this is outdated instructions?

Currently the file was extracted from Keynote which is macOS-only. We could redraw this in a more accessible format perhaps.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, we can now support & prefer SVG files. If Keynote will export an SVG, that should be fine? I had wondered if you'd used e.g. TikZ or graphviz to make the image.

@AA-Turner
Copy link
Member

Please avoid force pushing, we squash-merge all PRs.

TobiasWrigstad reacted with thumbs up emoji

@hugovk
Copy link
Member

For the next PEP, please wait until the initial PR is merged before opening thePEP discussion, because we want to share the official peps.python.org URL and not the PR preview that will be deleted at some POINT. (Pre-PEP discussions can be opened at any time.)

And especially please wait until the sponsor had confirmed sponsorship, as we the PEP number only gets officially assigned then and it can cause confusion to re-assign numbers later.

Please see PEP 1 for more details.

https://peps.python.org/pep-0001/#submitting-a-pep

Thank you!

AA-Turner and xFrednet reacted with thumbs up emoji

Co-authored-by: Michael Droettboom <mdboom@gmail.com>
=============

Note: our current prototype implementation was authored on-top of
Python 3.12. To avoid blocking on rebasing on 3.14 to force

Choose a reason for hiding this comment

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

This would be for 3.15 at this point.

auvipy reacted with thumbs up emoji
themselves using ``register_freezable(type)``. Example:

.. code-block:: Python

Choose a reason for hiding this comment

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

Should probably add a C API function for this too.

x = 0
def foo(a = False):
nonlocal x
if a:

Choose a reason for hiding this comment

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

Suggested change
if a:
if a:

single reference count could be used to track the lifetimes of
all the objects in such a strongly connected component (SCC).

We plan to extend the freeze logic with a SCC analysis that

Choose a reason for hiding this comment

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

Suggested change
We plan to extend the freeze logic witha SCC analysis that
We plan to extend the freeze logic withan SCC analysis that

``ob_tid`` would allow for standard mutable thread local objects to
remain the fast path, and is our preferred alternative.

The extensions use use SCC calculations to detect cycles in

Choose a reason for hiding this comment

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

Suggested change
The extensionsuse use SCC calculations to detect cycles in
The extensionsto use SCC calculations to detect cycles in


3. The type ``NotFreezable`` which is an empty type which cannot be made immutable and can be used as a super class to classes whose instances should not be possible to freeze

4. The type ``NotFreezableError`` which is raised on an attempt to mutate an immutable object
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this for an attempt to freeze and unfreezable object? Below, it says it raises aTypeError when trying to mutate an immutable object.

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

Reviewers

@mdboommdboommdboom left review comments

@JelleZijlstraJelleZijlstraJelleZijlstra left review comments

@AA-TurnerAA-TurnerAA-Turner left review comments

Assignees

No one assigned

Labels

new-pepA new draft PEP submitted for initial review

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@TobiasWrigstad@AA-Turner@hugovk@mdboom@JelleZijlstra

[8]ページ先頭

©2009-2025 Movatter.jp