@@ -2529,10 +2529,12 @@ output pop
25292529
25302530/* @vectorcall test types. Multiple types as tp_vectorcall is a single slot. */
25312531
2532- /* VcNew: __new__ with one optional positional-or-keyword arg */
2532+ /* VcNew: __new__ with one optional positional-or-keyword arg. A static
2533+ * type, so the generated vectorcall is exercised on both static and heap
2534+ * types. */
25332535
25342536/*[clinic input]
2535- class _testclinic.VcNew "PyObject *" ""
2537+ class _testclinic.VcNew "PyObject *" "&VcNew_Type "
25362538@classmethod
25372539@vectorcall
25382540_testclinic.VcNew.__new__ as vc_plain_new
@@ -2541,22 +2543,18 @@ _testclinic.VcNew.__new__ as vc_plain_new
25412543
25422544static PyObject *
25432545vc_plain_new_impl (PyTypeObject * type , PyObject * a )
2544- /*[clinic end generated code: output=55b273e9797a3013 input=459ce1ed0393de54 ]*/
2546+ /*[clinic end generated code: output=55b273e9797a3013 input=e15d88606280badc ]*/
25452547{
25462548 return type -> tp_alloc (type , 0 );
25472549}
25482550
2549- static PyType_Slot VcNew_slots [] = {
2550- {Py_tp_new , vc_plain_new },
2551- {Py_tp_vectorcall , vc_plain_vectorcall },
2552- {0 , NULL },
2553- };
2554-
2555- static PyType_Spec VcNew_spec = {
2556- .name = "_testclinic.VcNew" ,
2557- .basicsize = sizeof (PyObject ),
2558- .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE ,
2559- .slots = VcNew_slots ,
2551+ static PyTypeObject VcNew_Type = {
2552+ PyVarObject_HEAD_INIT (NULL , 0 )
2553+ .tp_name = "_testclinic.VcNew" ,
2554+ .tp_basicsize = sizeof (PyObject ),
2555+ .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE ,
2556+ .tp_new = vc_plain_new ,
2557+ .tp_vectorcall = vc_plain_vectorcall ,
25602558};
25612559
25622560
@@ -2901,7 +2899,6 @@ _testclinic_exec(PyObject *module)
29012899 & DeprKwdNew_spec ,
29022900 & DeprKwdInit_spec ,
29032901 & DeprKwdInitNoInline_spec ,
2904- & VcNew_spec ,
29052902 & VcInit_spec ,
29062903 & VcNewBase_spec ,
29072904 & VcKwOnly_spec ,
@@ -2911,6 +2908,9 @@ _testclinic_exec(PyObject *module)
29112908 return -1 ;
29122909 }
29132910 }
2911+ if (PyModule_AddType (module , & VcNew_Type ) < 0 ) {
2912+ return -1 ;
2913+ }
29142914 return 0 ;
29152915}
29162916
0 commit comments