gh-116946: add Py_TPFLAGS_IMMUTABLETYPE to several internal types (#138582)

The following types are now immutable:

* `_curses_panel.panel`,
* `[posix,nt].ScandirIterator`, `[posix,nt].DirEntry` (exposed in `os.py`),
* `_remote_debugging.RemoteUnwinder`,
* `_tkinter.Tcl_Obj`, `_tkinter.tkapp`, `_tkinter.tktimertoken`,
* `zlib.Compress`, and `zlib.Decompress`.
This commit is contained in:
Bénédikt Tran 2025-09-11 09:56:20 +02:00 committed by GitHub
parent 859aecc33b
commit 4978bfca10
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 60 additions and 27 deletions

View file

@ -3062,7 +3062,10 @@ static PyType_Slot RemoteUnwinder_slots[] = {
static PyType_Spec RemoteUnwinder_spec = {
.name = "_remote_debugging.RemoteUnwinder",
.basicsize = sizeof(RemoteUnwinderObject),
.flags = Py_TPFLAGS_DEFAULT,
.flags = (
Py_TPFLAGS_DEFAULT
| Py_TPFLAGS_IMMUTABLETYPE
),
.slots = RemoteUnwinder_slots,
};