@@ -6215,6 +6215,47 @@ static PyTypeObject MethodDescriptor2_Type = {
6215
6215
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_VECTORCALL ,
6216
6216
};
6217
6217
6218
+ PyDoc_STRVAR (heapdocctype__doc__ ,
6219
+ "HeapDocCType(arg1, arg2)\n"
6220
+ "--\n"
6221
+ "\n"
6222
+ "somedoc" );
6223
+
6224
+ typedef struct {
6225
+ PyObject_HEAD
6226
+ } HeapDocCTypeObject ;
6227
+
6228
+ static PyType_Slot HeapDocCType_slots [] = {
6229
+ {Py_tp_doc , (char * )heapdocctype__doc__ },
6230
+ {0 },
6231
+ };
6232
+
6233
+ static PyType_Spec HeapDocCType_spec = {
6234
+ "_testcapi.HeapDocCType" ,
6235
+ sizeof (HeapDocCTypeObject ),
6236
+ 0 ,
6237
+ Py_TPFLAGS_DEFAULT ,
6238
+ HeapDocCType_slots
6239
+ };
6240
+
6241
+ typedef struct {
6242
+ PyObject_HEAD
6243
+ } NullTpDocTypeObject ;
6244
+
6245
+ static PyType_Slot NullTpDocType_slots [] = {
6246
+ {Py_tp_doc , NULL },
6247
+ {0 , 0 },
6248
+ };
6249
+
6250
+ static PyType_Spec NullTpDocType_spec = {
6251
+ "_testcapi.NullTpDocType" ,
6252
+ sizeof (NullTpDocTypeObject ),
6253
+ 0 ,
6254
+ Py_TPFLAGS_DEFAULT ,
6255
+ NullTpDocType_slots
6256
+ };
6257
+
6258
+
6218
6259
PyDoc_STRVAR (heapgctype__doc__ ,
6219
6260
"A heap type with GC, and with overridden dealloc.\n\n"
6220
6261
"The 'value' attribute is set to 10 in __init__." );
@@ -6883,6 +6924,20 @@ PyInit__testcapi(void)
6883
6924
Py_INCREF (TestError );
6884
6925
PyModule_AddObject (m , "error" , TestError );
6885
6926
6927
+ PyObject * HeapDocCType = PyType_FromSpec (& HeapDocCType_spec );
6928
+ if (HeapDocCType == NULL ) {
6929
+ return NULL ;
6930
+ }
6931
+ PyModule_AddObject (m , "HeapDocCType" , HeapDocCType );
6932
+
6933
+ /* bpo-41832: Add a new type to test PyType_FromSpec()
6934
+ now can accept a NULL tp_doc slot. */
6935
+ PyObject * NullTpDocType = PyType_FromSpec (& NullTpDocType_spec );
6936
+ if (NullTpDocType == NULL ) {
6937
+ return NULL ;
6938
+ }
6939
+ PyModule_AddObject (m , "NullTpDocType" , NullTpDocType );
6940
+
6886
6941
PyObject * HeapGcCType = PyType_FromSpec (& HeapGcCType_spec );
6887
6942
if (HeapGcCType == NULL ) {
6888
6943
return NULL ;
0 commit comments