Skip to content

Commit 9888f17

Browse files
authored
gh-131652: remove duplicated bits in Lib/test/clinic.test.c (#131653)
1 parent ecd0373 commit 9888f17

File tree

1 file changed

+0
-174
lines changed

1 file changed

+0
-174
lines changed

Lib/test/clinic.test.c

Lines changed: 0 additions & 174 deletions
Original file line numberDiff line numberDiff line change
@@ -4238,44 +4238,6 @@ static PyObject *
42384238
test_vararg_and_posonly_impl(PyObject *module, PyObject *a, PyObject *args)
42394239
/*[clinic end generated code: output=0c11c475e240869e input=2c49a482f68545c0]*/
42404240

4241-
PyDoc_STRVAR(test_vararg_and_posonly__doc__,
4242-
"test_vararg_and_posonly($module, a, /, *args)\n"
4243-
"--\n"
4244-
"\n");
4245-
4246-
#define TEST_VARARG_AND_POSONLY_METHODDEF \
4247-
{"test_vararg_and_posonly", _PyCFunction_CAST(test_vararg_and_posonly), METH_FASTCALL, test_vararg_and_posonly__doc__},
4248-
4249-
static PyObject *
4250-
test_vararg_and_posonly_impl(PyObject *module, PyObject *a, Py_ssize_t nargs,
4251-
PyObject *const *args);
4252-
4253-
static PyObject *
4254-
test_vararg_and_posonly(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
4255-
{
4256-
PyObject *return_value = NULL;
4257-
Py_ssize_t nvararg = nargs - 1;
4258-
PyObject *a;
4259-
PyObject *const *__clinic_args = NULL;
4260-
4261-
if (!_PyArg_CheckPositional("test_vararg_and_posonly", nargs, 1, PY_SSIZE_T_MAX)) {
4262-
goto exit;
4263-
}
4264-
a = args[0];
4265-
__clinic_args = _PyTuple_FromArray(args + 1, nargs - 1);
4266-
if (__clinic_args == NULL) {
4267-
goto exit;
4268-
}
4269-
return_value = test_vararg_and_posonly_impl(module, a, nvararg, __clinic_args);
4270-
4271-
exit:
4272-
/* Cleanup for args */
4273-
Py_XDECREF(__clinic_args);
4274-
4275-
return return_value;
4276-
}
4277-
4278-
42794241
/*[clinic input]
42804242
test_vararg
42814243
@@ -5099,39 +5061,6 @@ static int
50995061
Test___init___impl(TestObj *self, PyObject *args)
51005062
/*[clinic end generated code: output=f172425cec373cd6 input=4b8388c4e6baab6f]*/
51015063

5102-
PyDoc_STRVAR(Test___init____doc__,
5103-
"Test(*args)\n"
5104-
"--\n"
5105-
"\n"
5106-
"Varargs init method. For example, nargs is translated to PyTuple_GET_SIZE.");
5107-
5108-
static int
5109-
Test___init___impl(TestObj *self, Py_ssize_t nargs, PyObject *const *args);
5110-
5111-
static int
5112-
Test___init__(PyObject *self, PyObject *args, PyObject *kwargs)
5113-
{
5114-
int return_value = -1;
5115-
PyTypeObject *base_tp = TestType;
5116-
PyObject *const *__clinic_args = NULL;
5117-
5118-
if ((Py_IS_TYPE(self, base_tp) ||
5119-
Py_TYPE(self)->tp_new == base_tp->tp_new) &&
5120-
!_PyArg_NoKeywords("Test", kwargs)) {
5121-
goto exit;
5122-
}
5123-
__clinic_args = Py_NewRef(args);
5124-
return_value = Test___init___impl((TestObj *)self, nvararg, __clinic_args);
5125-
5126-
exit:
5127-
/* Cleanup for args */
5128-
Py_XDECREF(__clinic_args);
5129-
5130-
return return_value;
5131-
}
5132-
5133-
5134-
51355064
/*[clinic input]
51365065
@classmethod
51375066
Test.__new__
@@ -5174,37 +5103,6 @@ static PyObject *
51745103
Test_impl(PyTypeObject *type, PyObject *args)
51755104
/*[clinic end generated code: output=ee1e8892a67abd4a input=a8259521129cad20]*/
51765105

5177-
PyDoc_STRVAR(Test__doc__,
5178-
"Test(*args)\n"
5179-
"--\n"
5180-
"\n"
5181-
"Varargs new method. For example, nargs is translated to PyTuple_GET_SIZE.");
5182-
5183-
static PyObject *
5184-
Test_impl(PyTypeObject *type, Py_ssize_t nargs, PyObject *const *args);
5185-
5186-
static PyObject *
5187-
Test(PyTypeObject *type, PyObject *args, PyObject *kwargs)
5188-
{
5189-
PyObject *return_value = NULL;
5190-
PyTypeObject *base_tp = TestType;
5191-
PyObject *const *__clinic_args = NULL;
5192-
5193-
if ((type == base_tp || type->tp_init == base_tp->tp_init) &&
5194-
!_PyArg_NoKeywords("Test", kwargs)) {
5195-
goto exit;
5196-
}
5197-
__clinic_args = Py_NewRef(args);
5198-
return_value = Test_impl(type, nvararg, __clinic_args);
5199-
5200-
exit:
5201-
/* Cleanup for args */
5202-
Py_XDECREF(__clinic_args);
5203-
5204-
return return_value;
5205-
}
5206-
5207-
52085106

52095107
/*[clinic input]
52105108
Test.__init__
@@ -6080,37 +5978,6 @@ static PyObject *
60805978
test_critical_section_object_impl(PyObject *module, PyObject *a)
60815979
/*[clinic end generated code: output=ec06df92232b0fb5 input=6f67f91b523c875f]*/
60825980

6083-
PyDoc_STRVAR(test_critical_section_object__doc__,
6084-
"test_critical_section_object($module, a, /)\n"
6085-
"--\n"
6086-
"\n"
6087-
"test_critical_section_object");
6088-
6089-
#define TEST_CRITICAL_SECTION_OBJECT_METHODDEF \
6090-
{"test_critical_section_object", (PyCFunction)test_critical_section_object, METH_O, test_critical_section_object__doc__},
6091-
6092-
static PyObject *
6093-
test_critical_section_object_impl(PyObject *module, PyObject *a);
6094-
6095-
static PyObject *
6096-
test_critical_section_object(PyObject *module, PyObject *arg)
6097-
{
6098-
PyObject *return_value = NULL;
6099-
PyObject *a;
6100-
6101-
if (!PyUnicode_Check(arg)) {
6102-
_PyArg_BadArgument("test_critical_section_object", "argument", "str", arg);
6103-
goto exit;
6104-
}
6105-
a = arg;
6106-
Py_BEGIN_CRITICAL_SECTION(a);
6107-
return_value = test_critical_section_object_impl(module, a);
6108-
Py_END_CRITICAL_SECTION();
6109-
6110-
exit:
6111-
return return_value;
6112-
}
6113-
61145981
/*[clinic input]
61155982
@critical_section a b
61165983
test_critical_section_object2
@@ -6165,44 +6032,3 @@ static PyObject *
61656032
test_critical_section_object2_impl(PyObject *module, PyObject *a,
61666033
PyObject *b)
61676034
/*[clinic end generated code: output=d73a1657c18df17a input=638824e41419a466]*/
6168-
6169-
PyDoc_STRVAR(test_critical_section_object2__doc__,
6170-
"test_critical_section_object2($module, a, b, /)\n"
6171-
"--\n"
6172-
"\n"
6173-
"test_critical_section_object2");
6174-
6175-
#define TEST_CRITICAL_SECTION_OBJECT2_METHODDEF \
6176-
{"test_critical_section_object2", _PyCFunction_CAST(test_critical_section_object2), METH_FASTCALL, test_critical_section_object2__doc__},
6177-
6178-
static PyObject *
6179-
test_critical_section_object2_impl(PyObject *module, PyObject *a,
6180-
PyObject *b);
6181-
6182-
static PyObject *
6183-
test_critical_section_object2(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
6184-
{
6185-
PyObject *return_value = NULL;
6186-
PyObject *a;
6187-
PyObject *b;
6188-
6189-
if (!_PyArg_CheckPositional("test_critical_section_object2", nargs, 2, 2)) {
6190-
goto exit;
6191-
}
6192-
if (!PyUnicode_Check(args[0])) {
6193-
_PyArg_BadArgument("test_critical_section_object2", "argument 1", "str", args[0]);
6194-
goto exit;
6195-
}
6196-
a = args[0];
6197-
if (!PyUnicode_Check(args[1])) {
6198-
_PyArg_BadArgument("test_critical_section_object2", "argument 2", "str", args[1]);
6199-
goto exit;
6200-
}
6201-
b = args[1];
6202-
Py_BEGIN_CRITICAL_SECTION2(a, b);
6203-
return_value = test_critical_section_object2_impl(module, a, b);
6204-
Py_END_CRITICAL_SECTION2();
6205-
6206-
exit:
6207-
return return_value;
6208-
}

0 commit comments

Comments
 (0)