summaryrefslogtreecommitdiff
path: root/Objects/structseq.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-01-21 03:30:20 +0100
committerGitHub <noreply@github.com>2022-01-21 03:30:20 +0100
commit1781d55eb34f94029e50970232635fc5082378cb (patch)
tree613d5c847480facfe411345b4a61ee3239950e53 /Objects/structseq.c
parent17f268a4ae6190b2659c89c6f32ad2d006e0e3c8 (diff)
downloadcpython-git-1781d55eb34f94029e50970232635fc5082378cb.tar.gz
bpo-46417: _curses uses PyStructSequence_NewType() (GH-30736)
The _curses module now creates its ncurses_version type as a heap type using PyStructSequence_NewType(), rather than using a static type. * Move _PyStructSequence_FiniType() definition to pycore_structseq.h. * test.pythoninfo: log curses.ncurses_version.
Diffstat (limited to 'Objects/structseq.c')
-rw-r--r--Objects/structseq.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/Objects/structseq.c b/Objects/structseq.c
index f8bf9477f2..dfefae8928 100644
--- a/Objects/structseq.c
+++ b/Objects/structseq.c
@@ -563,7 +563,7 @@ _PyStructSequence_FiniType(PyTypeObject *type)
PyTypeObject *
-PyStructSequence_NewType(PyStructSequence_Desc *desc)
+_PyStructSequence_NewType(PyStructSequence_Desc *desc, unsigned long tp_flags)
{
PyMemberDef *members;
PyTypeObject *type;
@@ -596,7 +596,7 @@ PyStructSequence_NewType(PyStructSequence_Desc *desc)
spec.name = desc->name;
spec.basicsize = sizeof(PyStructSequence) - sizeof(PyObject *);
spec.itemsize = sizeof(PyObject *);
- spec.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC;
+ spec.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | tp_flags;
spec.slots = slots;
type = (PyTypeObject *)PyType_FromSpecWithBases(&spec, (PyObject *)&PyTuple_Type);
@@ -615,6 +615,13 @@ PyStructSequence_NewType(PyStructSequence_Desc *desc)
}
+PyTypeObject *
+PyStructSequence_NewType(PyStructSequence_Desc *desc)
+{
+ return _PyStructSequence_NewType(desc, 0);
+}
+
+
/* runtime lifecycle */
PyStatus _PyStructSequence_InitState(PyInterpreterState *interp)