Skip to content

Conversation

picnixz
Copy link
Member

@picnixz picnixz commented Sep 6, 2025

This only adds the Py_TPFLAGS_IMMUTABLETYPE flag and assumes that other GC-related issues are solved (not all types are actually empty). I've added NEWS entries just because we also mention transforming extension modules from single-phase to multi-phase. It doesn't hurt mentioning this if a type can be observed with obj = public_func(); print(type(obj)).

@serhiy-storchaka Can I split the PR for immutable types into those that are in _test*api and xxlimited* with those that are used in release builds? There is just one type _interpreters.CrossInterpreterBufferView that I'm unsure of.

@pablogsal Am I correct to assume that _remote_debugging.RemoteUnwinder should be immutable and is really internal? It's only "publicly" accessible through profiling.sampling.SampleProfiler.unwinder but I don't know if it's meant to be used externally.

@picnixz picnixz force-pushed the feat/gc/immutable-heap-types-116946 branch from 970baf2 to 6405c1c Compare September 6, 2025 13:59
@pablogsal
Copy link
Member

pablogsal commented Sep 6, 2025

@pablogsal Am I correct to assume that _remote_debugging.RemoteUnwinder should be immutable and is really internal?

Yes 👍

It's only "publicly" accessible through profiling.sampling.SampleProfiler.unwinder but I don't know if it's meant to be used externally.

Is also accessible via Lib/asyncio/tools.py. What do you mean with externally? By end users?

@picnixz
Copy link
Member Author

picnixz commented Sep 6, 2025

By end users?

Yes. I wondered whether a NEWS entry was needed or not but considering it's (1) a really internal type (2) the RemoteUnwinder type and its instances are not directly accessible by the end user (or would it be possible later?), I will not write a NEWS entry for the unwinder type.

The rationale why the other types were documented is because I can access them with public functions directly, e.g., zlib.Compress is obtained by zlib.compressobj(). But for RemoteUnwinder, you need a bit more work to access an instance of that type.

@pablogsal
Copy link
Member

Yes. I wondered whether a NEWS entry was needed or not but considering it's (1) a really internal type (2) the RemoteUnwinder type and its instances are not directly accessible by the end user (or would it be possible later?), I will not write a NEWS entry for the unwinder type.

For now is strictly private and not intented for direct usage, just via different parts of the standard library that are in turn user visible.

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

LGTM. 👍

@serhiy-storchaka
Copy link
Member

Can I split the PR for immutable types into those that are in _test*api and xxlimited* with those that are used in release builds?

This is up to you.

@picnixz picnixz merged commit 4978bfc into python:main Sep 11, 2025
49 checks passed
@picnixz picnixz deleted the feat/gc/immutable-heap-types-116946 branch September 11, 2025 07:56
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.

4 participants