Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
:mod:`tkinter`: the types :class:`!_tkinter.Tcl_Obj` (wrapper for Tcl objects),
:class:`!_tkinter.tktimertoken` (obtained by calling ``createtimerhandler()``
on a :attr:`Tk <tkinter.Tk.tk>` application) and :class:`!_tkinter.tkapp`
(the runtime type of Tk applications) are now immutable.
Patch by Bénédikt Tran.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
:mod:`os`: the :class:`os.DirEntry` type and the type of :func:`os.scandir`
are now immutable. Patch by Bénédikt Tran.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:mod:`zlib`: the types of :func:`zlib.compressobj`
and :func:`zlib.decompressobj` are now immutable.
Patch by Bénédikt Tran.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
:mod:`curses.panel`: the type of :func:`curses.panel.new_panel` is now
immutable. Patch by Bénédikt Tran.
1 change: 1 addition & 0 deletions Modules/_curses_panel.c
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,7 @@ static PyType_Spec PyCursesPanel_Type_spec = {
.flags = (
Py_TPFLAGS_DEFAULT
| Py_TPFLAGS_DISALLOW_INSTANTIATION
| Py_TPFLAGS_IMMUTABLETYPE
| Py_TPFLAGS_HAVE_GC
),
.slots = PyCursesPanel_Type_slots
Expand Down
5 changes: 4 additions & 1 deletion Modules/_remote_debugging_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -2994,7 +2994,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,
};

Expand Down
39 changes: 24 additions & 15 deletions Modules/_tkinter.c
Original file line number Diff line number Diff line change
Expand Up @@ -906,11 +906,14 @@ static PyType_Slot PyTclObject_Type_slots[] = {
};

static PyType_Spec PyTclObject_Type_spec = {
"_tkinter.Tcl_Obj",
sizeof(PyTclObject),
0,
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION,
PyTclObject_Type_slots,
.name = "_tkinter.Tcl_Obj",
.basicsize = sizeof(PyTclObject),
.flags = (
Py_TPFLAGS_DEFAULT
| Py_TPFLAGS_DISALLOW_INSTANTIATION
| Py_TPFLAGS_IMMUTABLETYPE
),
.slots = PyTclObject_Type_slots,
};


Expand Down Expand Up @@ -3267,11 +3270,14 @@ static PyType_Slot Tktt_Type_slots[] = {
};

static PyType_Spec Tktt_Type_spec = {
"_tkinter.tktimertoken",
sizeof(TkttObject),
0,
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION,
Tktt_Type_slots,
.name = "_tkinter.tktimertoken",
.basicsize = sizeof(TkttObject),
.flags = (
Py_TPFLAGS_DEFAULT
| Py_TPFLAGS_DISALLOW_INSTANTIATION
| Py_TPFLAGS_IMMUTABLETYPE
),
.slots = Tktt_Type_slots,
};


Expand Down Expand Up @@ -3323,11 +3329,14 @@ static PyType_Slot Tkapp_Type_slots[] = {


static PyType_Spec Tkapp_Type_spec = {
"_tkinter.tkapp",
sizeof(TkappObject),
0,
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION,
Tkapp_Type_slots,
.name = "_tkinter.tkapp",
.basicsize = sizeof(TkappObject),
.flags = (
Py_TPFLAGS_DEFAULT
| Py_TPFLAGS_DISALLOW_INSTANTIATION
| Py_TPFLAGS_IMMUTABLETYPE
),
.slots = Tkapp_Type_slots,
};

static PyMethodDef moduleMethods[] =
Expand Down
28 changes: 17 additions & 11 deletions Modules/posixmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -16035,11 +16035,14 @@ static PyType_Slot DirEntryType_slots[] = {
};

static PyType_Spec DirEntryType_spec = {
MODNAME ".DirEntry",
sizeof(DirEntry),
0,
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION,
DirEntryType_slots
.name = MODNAME ".DirEntry",
.basicsize = sizeof(DirEntry),
.flags = (
Py_TPFLAGS_DEFAULT
| Py_TPFLAGS_DISALLOW_INSTANTIATION
| Py_TPFLAGS_IMMUTABLETYPE
),
.slots = DirEntryType_slots
};


Expand Down Expand Up @@ -16477,14 +16480,17 @@ static PyType_Slot ScandirIteratorType_slots[] = {
};

static PyType_Spec ScandirIteratorType_spec = {
MODNAME ".ScandirIterator",
sizeof(ScandirIterator),
0,
.name = MODNAME ".ScandirIterator",
.basicsize = sizeof(ScandirIterator),
// bpo-40549: Py_TPFLAGS_BASETYPE should not be used, since
// PyType_GetModule(Py_TYPE(self)) doesn't work on a subclass instance.
(Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_FINALIZE
| Py_TPFLAGS_DISALLOW_INSTANTIATION),
ScandirIteratorType_slots
.flags = (
Py_TPFLAGS_DEFAULT
| Py_TPFLAGS_HAVE_FINALIZE
| Py_TPFLAGS_DISALLOW_INSTANTIATION
| Py_TPFLAGS_IMMUTABLETYPE
),
.slots = ScandirIteratorType_slots
};

/*[clinic input]
Expand Down
2 changes: 2 additions & 0 deletions Modules/zlibmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2043,6 +2043,7 @@ static PyType_Spec Comptype_spec = {
.flags = (
Py_TPFLAGS_DEFAULT
| Py_TPFLAGS_DISALLOW_INSTANTIATION
| Py_TPFLAGS_IMMUTABLETYPE
| Py_TPFLAGS_HAVE_GC
),
.slots= Comptype_slots,
Expand All @@ -2062,6 +2063,7 @@ static PyType_Spec Decomptype_spec = {
.flags = (
Py_TPFLAGS_DEFAULT
| Py_TPFLAGS_DISALLOW_INSTANTIATION
| Py_TPFLAGS_IMMUTABLETYPE
| Py_TPFLAGS_HAVE_GC
),
.slots = Decomptype_slots,
Expand Down
Loading