Skip to content

Commit 60efdbd

Browse files
cmaloneyclaude
andcommitted
gh-87613: Make _testclinic.VcKwds a heap type
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent f15f969 commit 60efdbd

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

‎Modules/_testclinic.c‎

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ custom_converter(PyObject *obj, custom_t *val)
2626
static PyTypeObject VcNew_Type;
2727
static PyTypeObject VcNewBase_Type;
2828
static PyTypeObject VcKwOnly_Type;
29-
static PyTypeObject VcKwds_Type;
3029
#include "clinic/_testclinic.c.h"
3130

3231

@@ -2675,7 +2674,7 @@ static PyTypeObject VcKwOnly_Type = {
26752674
/* VcKwds: @vectorcall + **kwargs. __new__ returns the parsed arguments. */
26762675

26772676
/*[clinic input]
2678-
class _testclinic.VcKwds "PyObject *" "&VcKwds_Type"
2677+
class _testclinic.VcKwds "PyObject *" ""
26792678
@classmethod
26802679
@vectorcall
26812680
_testclinic.VcKwds.__new__ as vc_kwds_new
@@ -2688,18 +2687,21 @@ _testclinic.VcKwds.__new__ as vc_kwds_new
26882687
static PyObject *
26892688
vc_kwds_new_impl(PyTypeObject *type, PyObject *a, PyObject *b,
26902689
PyObject *kwds)
2691-
/*[clinic end generated code: output=481e680d2e76fdbd input=1c27337c5efd9a79]*/
2690+
/*[clinic end generated code: output=481e680d2e76fdbd input=3d8e5218fd593383]*/
26922691
{
26932692
return pack_arguments_newref(3, a, b, kwds);
26942693
}
26952694

2696-
static PyTypeObject VcKwds_Type = {
2697-
PyVarObject_HEAD_INIT(NULL, 0)
2698-
.tp_name = "_testclinic.VcKwds",
2699-
.tp_basicsize = sizeof(PyObject),
2700-
.tp_flags = Py_TPFLAGS_DEFAULT,
2701-
.tp_new = vc_kwds_new,
2702-
.tp_vectorcall = vc_kwds_vectorcall,
2695+
static PyType_Slot VcKwds_slots[] = {
2696+
{Py_tp_new, vc_kwds_new},
2697+
{Py_tp_vectorcall, vc_kwds_vectorcall},
2698+
{0, NULL},
2699+
};
2700+
static PyType_Spec VcKwds_spec = {
2701+
.name = "_testclinic.VcKwds",
2702+
.basicsize = sizeof(PyObject),
2703+
.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE,
2704+
.slots = VcKwds_slots,
27032705
};
27042706

27052707

@@ -2918,7 +2920,6 @@ _testclinic_exec(PyObject *m)
29182920
{
29192921
PyTypeObject *static_types[] = {
29202922
&TestClass, &VcNew_Type, &VcNewBase_Type, &VcKwOnly_Type,
2921-
&VcKwds_Type,
29222923
};
29232924
for (size_t i = 0; i < Py_ARRAY_LENGTH(static_types); i++) {
29242925
if (PyModule_AddType(m, static_types[i]) < 0) {
@@ -2930,7 +2931,7 @@ _testclinic_exec(PyObject *m)
29302931
&HeapTestClass_spec,
29312932
&DeprStarNew_spec, &DeprStarInit_spec, &DeprStarInitNoInline_spec,
29322933
&DeprKwdNew_spec, &DeprKwdInit_spec, &DeprKwdInitNoInline_spec,
2933-
&VcInit_spec,
2934+
&VcInit_spec, &VcKwds_spec,
29342935
};
29352936
for (size_t i = 0; i < Py_ARRAY_LENGTH(heap_specs); i++) {
29362937
PyObject *type = PyType_FromModuleAndSpec(m, heap_specs[i], NULL);

0 commit comments

Comments
 (0)