Skip to content

Commit b40e98a

Browse files
committed
Move one type back to static so both static and heap are tested
1 parent 278c998 commit b40e98a

2 files changed

Lines changed: 16 additions & 15 deletions

File tree

‎Modules/_testclinic.c‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -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

25422544
static PyObject *
25432545
vc_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

‎Tools/c-analyzer/cpython/globals-to-fix.tsv‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ Modules/_testcapi/vectorcall.c - MethodDescriptorBase_Type -
348348
Modules/_testcapi/vectorcall.c - MethodDescriptorDerived_Type -
349349
Modules/_testcapi/vectorcall.c - MethodDescriptorNopGet_Type -
350350
Modules/_testcapi/vectorcall.c - MethodDescriptor2_Type -
351+
Modules/_testclinic.c - VcNew_Type -
351352

352353

353354
##################################

0 commit comments

Comments
 (0)