Skip to content

Commit 735ffb0

Browse files
committed
Add Petr and Christian's comments.
1 parent 2c4cc7b commit 735ffb0

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

Doc/c-api/tuple.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ type.
123123
124124
Create and return a new struct sequence type from the *desc*.
125125
This function is similar to :c:func:`PyStructSequence_NewType`.
126+
The *module* argument is associated with the new type and can be retrieved
127+
with :c:func:`PyType_GetModule`. It must be a module object or ``NULL``.
128+
The *tp_flags* argument is used to set :c:member:`PyTypeObject.tp_flags`.
126129
127130
.. versionadded:: 3.11
128131
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
Add a new :c:func:`PyStructSequence_FromModuleAndDesc` function to create a new
2-
struct sequence type in heap.
2+
struct sequence type on the heap.

Objects/structseq.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,13 +570,12 @@ PyStructSequence_FromModuleAndDesc(PyObject *module,
570570
spec.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | tp_flags;
571571
spec.slots = slots;
572572

573-
type = (PyTypeObject *)PyType_FromSpecWithBases(&spec,
573+
type = (PyTypeObject *)PyType_FromModuleAndSpec(module, &spec,
574574
(PyObject *)&PyTuple_Type);
575575
PyMem_Free(members);
576576
if (type == NULL) {
577577
return NULL;
578578
}
579-
((PyHeapTypeObject *)type)->ht_module = Py_XNewRef(module);
580579

581580
if (initialize_structseq_dict(
582581
desc, type->tp_dict, n_members, n_unnamed_members) < 0) {

0 commit comments

Comments
 (0)