@@ -3860,6 +3860,25 @@ test_structseq_newtype_doesnt_leak(PyObject *Py_UNUSED(self),
3860
3860
Py_RETURN_NONE ;
3861
3861
}
3862
3862
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
+
3863
3882
static PyObject *
3864
3883
test_incref_decref_API (PyObject * ob , PyObject * Py_UNUSED (ignored ))
3865
3884
{
@@ -5618,6 +5637,8 @@ static PyMethodDef TestMethods[] = {
5618
5637
{"test_decref_doesnt_leak" , test_decref_doesnt_leak , METH_NOARGS },
5619
5638
{"test_structseq_newtype_doesnt_leak" ,
5620
5639
test_structseq_newtype_doesnt_leak , METH_NOARGS },
5640
+ {"test_structseq_newtype_null_descr_doc" ,
5641
+ test_structseq_newtype_null_descr_doc , METH_NOARGS },
5621
5642
{"test_incref_decref_API" , test_incref_decref_API , METH_NOARGS },
5622
5643
{"test_long_and_overflow" , test_long_and_overflow , METH_NOARGS },
5623
5644
{"test_long_as_double" , test_long_as_double , METH_NOARGS },
0 commit comments