@@ -3860,6 +3860,25 @@ test_structseq_newtype_doesnt_leak(PyObject *Py_UNUSED(self),
38603860 Py_RETURN_NONE ;
38613861}
38623862
3863+ static PyObject *
3864+ test_structseq_newtype_null_descr_doc (PyObject * Py_UNUSED (self ),
3865+ PyObject * Py_UNUSED (args ))
3866+ {
3867+ PyStructSequence_Field descr_fields [1 ] = {
3868+ (PyStructSequence_Field ){NULL , NULL }
3869+ };
3870+ // Test specifically for NULL .doc field.
3871+ PyStructSequence_Desc descr = {"_testcapi.test_descr" , NULL , & descr_fields [0 ], 0 };
3872+
3873+ PyTypeObject * structseq_type = PyStructSequence_NewType (& descr );
3874+ assert (structseq_type != NULL );
3875+ assert (PyType_Check (structseq_type ));
3876+ assert (PyType_FastSubclass (structseq_type , Py_TPFLAGS_TUPLE_SUBCLASS ));
3877+ Py_DECREF (structseq_type );
3878+
3879+ Py_RETURN_NONE ;
3880+ }
3881+
38633882static PyObject *
38643883test_incref_decref_API (PyObject * ob , PyObject * Py_UNUSED (ignored ))
38653884{
@@ -5618,6 +5637,8 @@ static PyMethodDef TestMethods[] = {
56185637 {"test_decref_doesnt_leak" , test_decref_doesnt_leak , METH_NOARGS },
56195638 {"test_structseq_newtype_doesnt_leak" ,
56205639 test_structseq_newtype_doesnt_leak , METH_NOARGS },
5640+ {"test_structseq_newtype_null_descr_doc" ,
5641+ test_structseq_newtype_null_descr_doc , METH_NOARGS },
56215642 {"test_incref_decref_API" , test_incref_decref_API , METH_NOARGS },
56225643 {"test_long_and_overflow" , test_long_and_overflow , METH_NOARGS },
56235644 {"test_long_as_double" , test_long_as_double , METH_NOARGS },
0 commit comments