mirror of https://github.com/python/cpython
gh-95065: Argument Clinic: Add functional tests of deprecated positionals (#107768)
Move the "deprecated positinal" tests from clinic.test.c to _testclinic.c. Mock PY_VERSION_HEX in order to prevent generated compiler warnings/errors to trigger. Put clinic code for deprecated positionals in Modules/clinic/_testclinic_depr_star.c.h for easy inspection of the generated code. Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
4845b9712f
commit
39ef93edb9
File diff suppressed because it is too large
Load Diff
|
@ -2,6 +2,7 @@
|
|||
# Copyright 2012-2013 by Larry Hastings.
|
||||
# Licensed to the PSF under a contributor agreement.
|
||||
|
||||
from functools import partial
|
||||
from test import support, test_tools
|
||||
from test.support import os_helper
|
||||
from test.support.os_helper import TESTFN, unlink
|
||||
|
@ -2431,6 +2432,19 @@ class ClinicFunctionalTest(unittest.TestCase):
|
|||
locals().update((name, getattr(ac_tester, name))
|
||||
for name in dir(ac_tester) if name.startswith('test_'))
|
||||
|
||||
def check_depr_star(self, pnames, fn, *args, **kwds):
|
||||
regex = (
|
||||
fr"Passing( more than)?( [0-9]+)? positional argument(s)? to "
|
||||
fr"{fn.__name__}\(\) is deprecated. Parameter(s)? {pnames} will "
|
||||
fr"become( a)? keyword-only parameter(s)? in Python 3\.14"
|
||||
)
|
||||
with self.assertWarnsRegex(DeprecationWarning, regex) as cm:
|
||||
# Record the line number, so we're sure we've got the correct stack
|
||||
# level on the deprecation warning.
|
||||
_, lineno = fn(*args, **kwds), sys._getframe().f_lineno
|
||||
self.assertEqual(cm.filename, __file__)
|
||||
self.assertEqual(cm.lineno, lineno)
|
||||
|
||||
def test_objects_converter(self):
|
||||
with self.assertRaises(TypeError):
|
||||
ac_tester.objects_converter()
|
||||
|
@ -2895,6 +2909,95 @@ class ClinicFunctionalTest(unittest.TestCase):
|
|||
func = getattr(ac_tester, name)
|
||||
self.assertEqual(func(), name)
|
||||
|
||||
def test_depr_star_new(self):
|
||||
regex = re.escape(
|
||||
"Passing positional arguments to _testclinic.DeprStarNew() is "
|
||||
"deprecated. Parameter 'a' will become a keyword-only parameter "
|
||||
"in Python 3.14."
|
||||
)
|
||||
with self.assertWarnsRegex(DeprecationWarning, regex) as cm:
|
||||
ac_tester.DeprStarNew(None)
|
||||
self.assertEqual(cm.filename, __file__)
|
||||
|
||||
def test_depr_star_init(self):
|
||||
regex = re.escape(
|
||||
"Passing positional arguments to _testclinic.DeprStarInit() is "
|
||||
"deprecated. Parameter 'a' will become a keyword-only parameter "
|
||||
"in Python 3.14."
|
||||
)
|
||||
with self.assertWarnsRegex(DeprecationWarning, regex) as cm:
|
||||
ac_tester.DeprStarInit(None)
|
||||
self.assertEqual(cm.filename, __file__)
|
||||
|
||||
def test_depr_star_pos0_len1(self):
|
||||
fn = ac_tester.depr_star_pos0_len1
|
||||
fn(a=None)
|
||||
self.check_depr_star("'a'", fn, "a")
|
||||
|
||||
def test_depr_star_pos0_len2(self):
|
||||
fn = ac_tester.depr_star_pos0_len2
|
||||
fn(a=0, b=0)
|
||||
check = partial(self.check_depr_star, "'a' and 'b'", fn)
|
||||
check("a", b=0)
|
||||
check("a", "b")
|
||||
|
||||
def test_depr_star_pos0_len3_with_kwd(self):
|
||||
fn = ac_tester.depr_star_pos0_len3_with_kwd
|
||||
fn(a=0, b=0, c=0, d=0)
|
||||
check = partial(self.check_depr_star, "'a', 'b' and 'c'", fn)
|
||||
check("a", b=0, c=0, d=0)
|
||||
check("a", "b", c=0, d=0)
|
||||
check("a", "b", "c", d=0)
|
||||
|
||||
def test_depr_star_pos1_len1_opt(self):
|
||||
fn = ac_tester.depr_star_pos1_len1_opt
|
||||
fn(a=0, b=0)
|
||||
fn("a", b=0)
|
||||
fn(a=0) # b is optional
|
||||
check = partial(self.check_depr_star, "'b'", fn)
|
||||
check("a", "b")
|
||||
|
||||
def test_depr_star_pos1_len1(self):
|
||||
fn = ac_tester.depr_star_pos1_len1
|
||||
fn(a=0, b=0)
|
||||
fn("a", b=0)
|
||||
check = partial(self.check_depr_star, "'b'", fn)
|
||||
check("a", "b")
|
||||
|
||||
def test_depr_star_pos1_len2_with_kwd(self):
|
||||
fn = ac_tester.depr_star_pos1_len2_with_kwd
|
||||
fn(a=0, b=0, c=0, d=0),
|
||||
fn("a", b=0, c=0, d=0),
|
||||
check = partial(self.check_depr_star, "'b' and 'c'", fn)
|
||||
check("a", "b", c=0, d=0),
|
||||
check("a", "b", "c", d=0),
|
||||
|
||||
def test_depr_star_pos2_len1(self):
|
||||
fn = ac_tester.depr_star_pos2_len1
|
||||
fn(a=0, b=0, c=0)
|
||||
fn("a", b=0, c=0)
|
||||
fn("a", "b", c=0)
|
||||
check = partial(self.check_depr_star, "'c'", fn)
|
||||
check("a", "b", "c")
|
||||
|
||||
def test_depr_star_pos2_len2(self):
|
||||
fn = ac_tester.depr_star_pos2_len2
|
||||
fn(a=0, b=0, c=0, d=0)
|
||||
fn("a", b=0, c=0, d=0)
|
||||
fn("a", "b", c=0, d=0)
|
||||
check = partial(self.check_depr_star, "'c' and 'd'", fn)
|
||||
check("a", "b", "c", d=0)
|
||||
check("a", "b", "c", "d")
|
||||
|
||||
def test_depr_star_pos2_len2_with_kwd(self):
|
||||
fn = ac_tester.depr_star_pos2_len2_with_kwd
|
||||
fn(a=0, b=0, c=0, d=0, e=0)
|
||||
fn("a", b=0, c=0, d=0, e=0)
|
||||
fn("a", "b", c=0, d=0, e=0)
|
||||
check = partial(self.check_depr_star, "'c' and 'd'", fn)
|
||||
check("a", "b", "c", d=0, e=0)
|
||||
check("a", "b", "c", "d", e=0)
|
||||
|
||||
|
||||
class PermutationTests(unittest.TestCase):
|
||||
"""Test permutation support functions."""
|
||||
|
|
|
@ -1193,6 +1193,240 @@ clone_with_conv_f2_impl(PyObject *module, custom_t path)
|
|||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
output push
|
||||
destination deprstar new file '{dirname}/clinic/_testclinic_depr_star.c.h'
|
||||
output everything deprstar
|
||||
#output methoddef_ifndef buffer 1
|
||||
output docstring_prototype suppress
|
||||
output parser_prototype suppress
|
||||
output impl_definition block
|
||||
[clinic start generated code]*/
|
||||
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=f88f37038e00fb0a]*/
|
||||
|
||||
|
||||
// Mock Python version 3.8
|
||||
#define _SAVED_PY_VERSION PY_VERSION_HEX
|
||||
#undef PY_VERSION_HEX
|
||||
#define PY_VERSION_HEX 0x03080000
|
||||
|
||||
|
||||
#include "clinic/_testclinic_depr_star.c.h"
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
class _testclinic.DeprStarNew "PyObject *" "PyObject"
|
||||
@classmethod
|
||||
_testclinic.DeprStarNew.__new__ as depr_star_new
|
||||
* [from 3.14]
|
||||
a: object
|
||||
The deprecation message should use the class name instead of __new__.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
depr_star_new_impl(PyTypeObject *type, PyObject *a)
|
||||
/*[clinic end generated code: output=bdbb36244f90cf46 input=f4ae7dafbc23c378]*/
|
||||
{
|
||||
return type->tp_alloc(type, 0);
|
||||
}
|
||||
|
||||
static PyTypeObject DeprStarNew = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "_testclinic.DeprStarNew",
|
||||
.tp_basicsize = sizeof(PyObject),
|
||||
.tp_new = depr_star_new,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
};
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
class _testclinic.DeprStarInit "PyObject *" "PyObject"
|
||||
_testclinic.DeprStarInit.__init__ as depr_star_init
|
||||
* [from 3.14]
|
||||
a: object
|
||||
The deprecation message should use the class name instead of __init__.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static int
|
||||
depr_star_init_impl(PyObject *self, PyObject *a)
|
||||
/*[clinic end generated code: output=8d27b43c286d3ecc input=659ebc748d87fa86]*/
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static PyTypeObject DeprStarInit = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
.tp_name = "_testclinic.DeprStarInit",
|
||||
.tp_basicsize = sizeof(PyObject),
|
||||
.tp_new = PyType_GenericNew,
|
||||
.tp_init = depr_star_init,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
};
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
depr_star_pos0_len1
|
||||
* [from 3.14]
|
||||
a: object
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
depr_star_pos0_len1_impl(PyObject *module, PyObject *a)
|
||||
/*[clinic end generated code: output=e1c6c2b423129499 input=089b9aee25381b69]*/
|
||||
{
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
depr_star_pos0_len2
|
||||
* [from 3.14]
|
||||
a: object
|
||||
b: object
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
depr_star_pos0_len2_impl(PyObject *module, PyObject *a, PyObject *b)
|
||||
/*[clinic end generated code: output=96df9be39859c7e4 input=65c83a32e01495c6]*/
|
||||
{
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
depr_star_pos0_len3_with_kwd
|
||||
* [from 3.14]
|
||||
a: object
|
||||
b: object
|
||||
c: object
|
||||
*
|
||||
d: object
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
depr_star_pos0_len3_with_kwd_impl(PyObject *module, PyObject *a, PyObject *b,
|
||||
PyObject *c, PyObject *d)
|
||||
/*[clinic end generated code: output=7f2531eda837052f input=b33f620f57d9270f]*/
|
||||
{
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
depr_star_pos1_len1_opt
|
||||
a: object
|
||||
* [from 3.14]
|
||||
b: object = None
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
depr_star_pos1_len1_opt_impl(PyObject *module, PyObject *a, PyObject *b)
|
||||
/*[clinic end generated code: output=b5b4e326ee3b216f input=4a4b8ff72eae9ff7]*/
|
||||
{
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
depr_star_pos1_len1
|
||||
a: object
|
||||
* [from 3.14]
|
||||
b: object
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
depr_star_pos1_len1_impl(PyObject *module, PyObject *a, PyObject *b)
|
||||
/*[clinic end generated code: output=eab92e37d5b0a480 input=1e7787a9fe5f62a0]*/
|
||||
{
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
depr_star_pos1_len2_with_kwd
|
||||
a: object
|
||||
* [from 3.14]
|
||||
b: object
|
||||
c: object
|
||||
*
|
||||
d: object
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
depr_star_pos1_len2_with_kwd_impl(PyObject *module, PyObject *a, PyObject *b,
|
||||
PyObject *c, PyObject *d)
|
||||
/*[clinic end generated code: output=3bccab672b7cfbb8 input=6bc7bd742fa8be15]*/
|
||||
{
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
depr_star_pos2_len1
|
||||
a: object
|
||||
b: object
|
||||
* [from 3.14]
|
||||
c: object
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
depr_star_pos2_len1_impl(PyObject *module, PyObject *a, PyObject *b,
|
||||
PyObject *c)
|
||||
/*[clinic end generated code: output=20f5b230e9beeb70 input=5fc3e1790dec00d5]*/
|
||||
{
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
depr_star_pos2_len2
|
||||
a: object
|
||||
b: object
|
||||
* [from 3.14]
|
||||
c: object
|
||||
d: object
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
depr_star_pos2_len2_impl(PyObject *module, PyObject *a, PyObject *b,
|
||||
PyObject *c, PyObject *d)
|
||||
/*[clinic end generated code: output=9f90ed8fbce27d7a input=9cc8003b89d38779]*/
|
||||
{
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
depr_star_pos2_len2_with_kwd
|
||||
a: object
|
||||
b: object
|
||||
* [from 3.14]
|
||||
c: object
|
||||
d: object
|
||||
*
|
||||
e: object
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
depr_star_pos2_len2_with_kwd_impl(PyObject *module, PyObject *a, PyObject *b,
|
||||
PyObject *c, PyObject *d, PyObject *e)
|
||||
/*[clinic end generated code: output=05432c4f20527215 input=831832d90534da91]*/
|
||||
{
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
// Reset PY_VERSION_HEX
|
||||
#undef PY_VERSION_HEX
|
||||
#define PY_VERSION_HEX _SAVED_PY_VERSION
|
||||
#undef _SAVED_PY_VERSION
|
||||
|
||||
|
||||
/*[clinic input]
|
||||
output pop
|
||||
[clinic start generated code]*/
|
||||
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=e7c7c42daced52b0]*/
|
||||
|
||||
static PyMethodDef tester_methods[] = {
|
||||
TEST_EMPTY_FUNCTION_METHODDEF
|
||||
OBJECTS_CONVERTER_METHODDEF
|
||||
|
@ -1248,6 +1482,16 @@ static PyMethodDef tester_methods[] = {
|
|||
CLONE_F2_METHODDEF
|
||||
CLONE_WITH_CONV_F1_METHODDEF
|
||||
CLONE_WITH_CONV_F2_METHODDEF
|
||||
|
||||
DEPR_STAR_POS0_LEN1_METHODDEF
|
||||
DEPR_STAR_POS0_LEN2_METHODDEF
|
||||
DEPR_STAR_POS0_LEN3_WITH_KWD_METHODDEF
|
||||
DEPR_STAR_POS1_LEN1_OPT_METHODDEF
|
||||
DEPR_STAR_POS1_LEN1_METHODDEF
|
||||
DEPR_STAR_POS1_LEN2_WITH_KWD_METHODDEF
|
||||
DEPR_STAR_POS2_LEN1_METHODDEF
|
||||
DEPR_STAR_POS2_LEN2_METHODDEF
|
||||
DEPR_STAR_POS2_LEN2_WITH_KWD_METHODDEF
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
@ -1261,7 +1505,21 @@ static struct PyModuleDef _testclinic_module = {
|
|||
PyMODINIT_FUNC
|
||||
PyInit__testclinic(void)
|
||||
{
|
||||
return PyModule_Create(&_testclinic_module);
|
||||
PyObject *m = PyModule_Create(&_testclinic_module);
|
||||
if (m == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
if (PyModule_AddType(m, &DeprStarNew) < 0) {
|
||||
goto error;
|
||||
}
|
||||
if (PyModule_AddType(m, &DeprStarInit) < 0) {
|
||||
goto error;
|
||||
}
|
||||
return m;
|
||||
|
||||
error:
|
||||
Py_DECREF(m);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#undef RETURN_PACKED_ARGS
|
||||
|
|
|
@ -0,0 +1,974 @@
|
|||
/*[clinic input]
|
||||
preserve
|
||||
[clinic start generated code]*/
|
||||
|
||||
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
|
||||
# include "pycore_gc.h" // PyGC_Head
|
||||
# include "pycore_runtime.h" // _Py_ID()
|
||||
#endif
|
||||
|
||||
|
||||
PyDoc_STRVAR(depr_star_new__doc__,
|
||||
"DeprStarNew(a)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"The deprecation message should use the class name instead of __new__.\n"
|
||||
"\n"
|
||||
"Note: Passing positional arguments to _testclinic.DeprStarNew() is\n"
|
||||
"deprecated. Parameter \'a\' will become a keyword-only parameter in\n"
|
||||
"Python 3.14.\n"
|
||||
"");
|
||||
|
||||
static PyObject *
|
||||
depr_star_new_impl(PyTypeObject *type, PyObject *a);
|
||||
|
||||
static PyObject *
|
||||
depr_star_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
|
||||
|
||||
#define NUM_KEYWORDS 1
|
||||
static struct {
|
||||
PyGC_Head _this_is_not_used;
|
||||
PyObject_VAR_HEAD
|
||||
PyObject *ob_item[NUM_KEYWORDS];
|
||||
} _kwtuple = {
|
||||
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
|
||||
.ob_item = { &_Py_ID(a), },
|
||||
};
|
||||
#undef NUM_KEYWORDS
|
||||
#define KWTUPLE (&_kwtuple.ob_base.ob_base)
|
||||
|
||||
#else // !Py_BUILD_CORE
|
||||
# define KWTUPLE NULL
|
||||
#endif // !Py_BUILD_CORE
|
||||
|
||||
static const char * const _keywords[] = {"a", NULL};
|
||||
static _PyArg_Parser _parser = {
|
||||
.keywords = _keywords,
|
||||
.fname = "DeprStarNew",
|
||||
.kwtuple = KWTUPLE,
|
||||
};
|
||||
#undef KWTUPLE
|
||||
PyObject *argsbuf[1];
|
||||
PyObject * const *fastargs;
|
||||
Py_ssize_t nargs = PyTuple_GET_SIZE(args);
|
||||
PyObject *a;
|
||||
|
||||
// Emit compiler warnings when we get to Python 3.14.
|
||||
#if PY_VERSION_HEX >= 0x030e00C0
|
||||
# error \
|
||||
"In _testclinic.c, update parameter(s) 'a' in the clinic input of" \
|
||||
" '_testclinic.DeprStarNew.__new__' to be keyword-only."
|
||||
#elif PY_VERSION_HEX >= 0x030e00A0
|
||||
# ifdef _MSC_VER
|
||||
# pragma message ( \
|
||||
"In _testclinic.c, update parameter(s) 'a' in the clinic input of" \
|
||||
" '_testclinic.DeprStarNew.__new__' to be keyword-only.")
|
||||
# else
|
||||
# warning \
|
||||
"In _testclinic.c, update parameter(s) 'a' in the clinic input of" \
|
||||
" '_testclinic.DeprStarNew.__new__' to be keyword-only."
|
||||
# endif
|
||||
#endif
|
||||
if (nargs == 1) {
|
||||
if (PyErr_WarnEx(PyExc_DeprecationWarning,
|
||||
"Passing positional arguments to _testclinic.DeprStarNew() is "
|
||||
"deprecated. Parameter 'a' will become a keyword-only parameter "
|
||||
"in Python 3.14.", 1))
|
||||
{
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 1, 0, argsbuf);
|
||||
if (!fastargs) {
|
||||
goto exit;
|
||||
}
|
||||
a = fastargs[0];
|
||||
return_value = depr_star_new_impl(type, a);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(depr_star_init__doc__,
|
||||
"DeprStarInit(a)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"The deprecation message should use the class name instead of __init__.\n"
|
||||
"\n"
|
||||
"Note: Passing positional arguments to _testclinic.DeprStarInit() is\n"
|
||||
"deprecated. Parameter \'a\' will become a keyword-only parameter in\n"
|
||||
"Python 3.14.\n"
|
||||
"");
|
||||
|
||||
static int
|
||||
depr_star_init_impl(PyObject *self, PyObject *a);
|
||||
|
||||
static int
|
||||
depr_star_init(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
int return_value = -1;
|
||||
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
|
||||
|
||||
#define NUM_KEYWORDS 1
|
||||
static struct {
|
||||
PyGC_Head _this_is_not_used;
|
||||
PyObject_VAR_HEAD
|
||||
PyObject *ob_item[NUM_KEYWORDS];
|
||||
} _kwtuple = {
|
||||
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
|
||||
.ob_item = { &_Py_ID(a), },
|
||||
};
|
||||
#undef NUM_KEYWORDS
|
||||
#define KWTUPLE (&_kwtuple.ob_base.ob_base)
|
||||
|
||||
#else // !Py_BUILD_CORE
|
||||
# define KWTUPLE NULL
|
||||
#endif // !Py_BUILD_CORE
|
||||
|
||||
static const char * const _keywords[] = {"a", NULL};
|
||||
static _PyArg_Parser _parser = {
|
||||
.keywords = _keywords,
|
||||
.fname = "DeprStarInit",
|
||||
.kwtuple = KWTUPLE,
|
||||
};
|
||||
#undef KWTUPLE
|
||||
PyObject *argsbuf[1];
|
||||
PyObject * const *fastargs;
|
||||
Py_ssize_t nargs = PyTuple_GET_SIZE(args);
|
||||
PyObject *a;
|
||||
|
||||
// Emit compiler warnings when we get to Python 3.14.
|
||||
#if PY_VERSION_HEX >= 0x030e00C0
|
||||
# error \
|
||||
"In _testclinic.c, update parameter(s) 'a' in the clinic input of" \
|
||||
" '_testclinic.DeprStarInit.__init__' to be keyword-only."
|
||||
#elif PY_VERSION_HEX >= 0x030e00A0
|
||||
# ifdef _MSC_VER
|
||||
# pragma message ( \
|
||||
"In _testclinic.c, update parameter(s) 'a' in the clinic input of" \
|
||||
" '_testclinic.DeprStarInit.__init__' to be keyword-only.")
|
||||
# else
|
||||
# warning \
|
||||
"In _testclinic.c, update parameter(s) 'a' in the clinic input of" \
|
||||
" '_testclinic.DeprStarInit.__init__' to be keyword-only."
|
||||
# endif
|
||||
#endif
|
||||
if (nargs == 1) {
|
||||
if (PyErr_WarnEx(PyExc_DeprecationWarning,
|
||||
"Passing positional arguments to _testclinic.DeprStarInit() is "
|
||||
"deprecated. Parameter 'a' will become a keyword-only parameter "
|
||||
"in Python 3.14.", 1))
|
||||
{
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 1, 0, argsbuf);
|
||||
if (!fastargs) {
|
||||
goto exit;
|
||||
}
|
||||
a = fastargs[0];
|
||||
return_value = depr_star_init_impl(self, a);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(depr_star_pos0_len1__doc__,
|
||||
"depr_star_pos0_len1($module, /, a)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"Note: Passing positional arguments to depr_star_pos0_len1() is\n"
|
||||
"deprecated. Parameter \'a\' will become a keyword-only parameter in\n"
|
||||
"Python 3.14.\n"
|
||||
"");
|
||||
|
||||
#define DEPR_STAR_POS0_LEN1_METHODDEF \
|
||||
{"depr_star_pos0_len1", _PyCFunction_CAST(depr_star_pos0_len1), METH_FASTCALL|METH_KEYWORDS, depr_star_pos0_len1__doc__},
|
||||
|
||||
static PyObject *
|
||||
depr_star_pos0_len1_impl(PyObject *module, PyObject *a);
|
||||
|
||||
static PyObject *
|
||||
depr_star_pos0_len1(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
|
||||
|
||||
#define NUM_KEYWORDS 1
|
||||
static struct {
|
||||
PyGC_Head _this_is_not_used;
|
||||
PyObject_VAR_HEAD
|
||||
PyObject *ob_item[NUM_KEYWORDS];
|
||||
} _kwtuple = {
|
||||
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
|
||||
.ob_item = { &_Py_ID(a), },
|
||||
};
|
||||
#undef NUM_KEYWORDS
|
||||
#define KWTUPLE (&_kwtuple.ob_base.ob_base)
|
||||
|
||||
#else // !Py_BUILD_CORE
|
||||
# define KWTUPLE NULL
|
||||
#endif // !Py_BUILD_CORE
|
||||
|
||||
static const char * const _keywords[] = {"a", NULL};
|
||||
static _PyArg_Parser _parser = {
|
||||
.keywords = _keywords,
|
||||
.fname = "depr_star_pos0_len1",
|
||||
.kwtuple = KWTUPLE,
|
||||
};
|
||||
#undef KWTUPLE
|
||||
PyObject *argsbuf[1];
|
||||
PyObject *a;
|
||||
|
||||
// Emit compiler warnings when we get to Python 3.14.
|
||||
#if PY_VERSION_HEX >= 0x030e00C0
|
||||
# error \
|
||||
"In _testclinic.c, update parameter(s) 'a' in the clinic input of" \
|
||||
" 'depr_star_pos0_len1' to be keyword-only."
|
||||
#elif PY_VERSION_HEX >= 0x030e00A0
|
||||
# ifdef _MSC_VER
|
||||
# pragma message ( \
|
||||
"In _testclinic.c, update parameter(s) 'a' in the clinic input of" \
|
||||
" 'depr_star_pos0_len1' to be keyword-only.")
|
||||
# else
|
||||
# warning \
|
||||
"In _testclinic.c, update parameter(s) 'a' in the clinic input of" \
|
||||
" 'depr_star_pos0_len1' to be keyword-only."
|
||||
# endif
|
||||
#endif
|
||||
if (nargs == 1) {
|
||||
if (PyErr_WarnEx(PyExc_DeprecationWarning,
|
||||
"Passing positional arguments to depr_star_pos0_len1() is "
|
||||
"deprecated. Parameter 'a' will become a keyword-only parameter "
|
||||
"in Python 3.14.", 1))
|
||||
{
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
|
||||
if (!args) {
|
||||
goto exit;
|
||||
}
|
||||
a = args[0];
|
||||
return_value = depr_star_pos0_len1_impl(module, a);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(depr_star_pos0_len2__doc__,
|
||||
"depr_star_pos0_len2($module, /, a, b)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"Note: Passing positional arguments to depr_star_pos0_len2() is\n"
|
||||
"deprecated. Parameters \'a\' and \'b\' will become keyword-only parameters\n"
|
||||
"in Python 3.14.\n"
|
||||
"");
|
||||
|
||||
#define DEPR_STAR_POS0_LEN2_METHODDEF \
|
||||
{"depr_star_pos0_len2", _PyCFunction_CAST(depr_star_pos0_len2), METH_FASTCALL|METH_KEYWORDS, depr_star_pos0_len2__doc__},
|
||||
|
||||
static PyObject *
|
||||
depr_star_pos0_len2_impl(PyObject *module, PyObject *a, PyObject *b);
|
||||
|
||||
static PyObject *
|
||||
depr_star_pos0_len2(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
|
||||
|
||||
#define NUM_KEYWORDS 2
|
||||
static struct {
|
||||
PyGC_Head _this_is_not_used;
|
||||
PyObject_VAR_HEAD
|
||||
PyObject *ob_item[NUM_KEYWORDS];
|
||||
} _kwtuple = {
|
||||
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
|
||||
.ob_item = { &_Py_ID(a), &_Py_ID(b), },
|
||||
};
|
||||
#undef NUM_KEYWORDS
|
||||
#define KWTUPLE (&_kwtuple.ob_base.ob_base)
|
||||
|
||||
#else // !Py_BUILD_CORE
|
||||
# define KWTUPLE NULL
|
||||
#endif // !Py_BUILD_CORE
|
||||
|
||||
static const char * const _keywords[] = {"a", "b", NULL};
|
||||
static _PyArg_Parser _parser = {
|
||||
.keywords = _keywords,
|
||||
.fname = "depr_star_pos0_len2",
|
||||
.kwtuple = KWTUPLE,
|
||||
};
|
||||
#undef KWTUPLE
|
||||
PyObject *argsbuf[2];
|
||||
PyObject *a;
|
||||
PyObject *b;
|
||||
|
||||
// Emit compiler warnings when we get to Python 3.14.
|
||||
#if PY_VERSION_HEX >= 0x030e00C0
|
||||
# error \
|
||||
"In _testclinic.c, update parameter(s) 'a' and 'b' in the clinic " \
|
||||
"input of 'depr_star_pos0_len2' to be keyword-only."
|
||||
#elif PY_VERSION_HEX >= 0x030e00A0
|
||||
# ifdef _MSC_VER
|
||||
# pragma message ( \
|
||||
"In _testclinic.c, update parameter(s) 'a' and 'b' in the clinic " \
|
||||
"input of 'depr_star_pos0_len2' to be keyword-only.")
|
||||
# else
|
||||
# warning \
|
||||
"In _testclinic.c, update parameter(s) 'a' and 'b' in the clinic " \
|
||||
"input of 'depr_star_pos0_len2' to be keyword-only."
|
||||
# endif
|
||||
#endif
|
||||
if (nargs > 0 && nargs <= 2) {
|
||||
if (PyErr_WarnEx(PyExc_DeprecationWarning,
|
||||
"Passing positional arguments to depr_star_pos0_len2() is "
|
||||
"deprecated. Parameters 'a' and 'b' will become keyword-only "
|
||||
"parameters in Python 3.14.", 1))
|
||||
{
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
|
||||
if (!args) {
|
||||
goto exit;
|
||||
}
|
||||
a = args[0];
|
||||
b = args[1];
|
||||
return_value = depr_star_pos0_len2_impl(module, a, b);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(depr_star_pos0_len3_with_kwd__doc__,
|
||||
"depr_star_pos0_len3_with_kwd($module, /, a, b, c, *, d)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"Note: Passing positional arguments to depr_star_pos0_len3_with_kwd()\n"
|
||||
"is deprecated. Parameters \'a\', \'b\' and \'c\' will become keyword-only\n"
|
||||
"parameters in Python 3.14.\n"
|
||||
"");
|
||||
|
||||
#define DEPR_STAR_POS0_LEN3_WITH_KWD_METHODDEF \
|
||||
{"depr_star_pos0_len3_with_kwd", _PyCFunction_CAST(depr_star_pos0_len3_with_kwd), METH_FASTCALL|METH_KEYWORDS, depr_star_pos0_len3_with_kwd__doc__},
|
||||
|
||||
static PyObject *
|
||||
depr_star_pos0_len3_with_kwd_impl(PyObject *module, PyObject *a, PyObject *b,
|
||||
PyObject *c, PyObject *d);
|
||||
|
||||
static PyObject *
|
||||
depr_star_pos0_len3_with_kwd(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
|
||||
|
||||
#define NUM_KEYWORDS 4
|
||||
static struct {
|
||||
PyGC_Head _this_is_not_used;
|
||||
PyObject_VAR_HEAD
|
||||
PyObject *ob_item[NUM_KEYWORDS];
|
||||
} _kwtuple = {
|
||||
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
|
||||
.ob_item = { &_Py_ID(a), &_Py_ID(b), &_Py_ID(c), &_Py_ID(d), },
|
||||
};
|
||||
#undef NUM_KEYWORDS
|
||||
#define KWTUPLE (&_kwtuple.ob_base.ob_base)
|
||||
|
||||
#else // !Py_BUILD_CORE
|
||||
# define KWTUPLE NULL
|
||||
#endif // !Py_BUILD_CORE
|
||||
|
||||
static const char * const _keywords[] = {"a", "b", "c", "d", NULL};
|
||||
static _PyArg_Parser _parser = {
|
||||
.keywords = _keywords,
|
||||
.fname = "depr_star_pos0_len3_with_kwd",
|
||||
.kwtuple = KWTUPLE,
|
||||
};
|
||||
#undef KWTUPLE
|
||||
PyObject *argsbuf[4];
|
||||
PyObject *a;
|
||||
PyObject *b;
|
||||
PyObject *c;
|
||||
PyObject *d;
|
||||
|
||||
// Emit compiler warnings when we get to Python 3.14.
|
||||
#if PY_VERSION_HEX >= 0x030e00C0
|
||||
# error \
|
||||
"In _testclinic.c, update parameter(s) 'a', 'b' and 'c' in the " \
|
||||
"clinic input of 'depr_star_pos0_len3_with_kwd' to be " \
|
||||
"keyword-only."
|
||||
#elif PY_VERSION_HEX >= 0x030e00A0
|
||||
# ifdef _MSC_VER
|
||||
# pragma message ( \
|
||||
"In _testclinic.c, update parameter(s) 'a', 'b' and 'c' in the " \
|
||||
"clinic input of 'depr_star_pos0_len3_with_kwd' to be " \
|
||||
"keyword-only.")
|
||||
# else
|
||||
# warning \
|
||||
"In _testclinic.c, update parameter(s) 'a', 'b' and 'c' in the " \
|
||||
"clinic input of 'depr_star_pos0_len3_with_kwd' to be " \
|
||||
"keyword-only."
|
||||
# endif
|
||||
#endif
|
||||
if (nargs > 0 && nargs <= 3) {
|
||||
if (PyErr_WarnEx(PyExc_DeprecationWarning,
|
||||
"Passing positional arguments to depr_star_pos0_len3_with_kwd() "
|
||||
"is deprecated. Parameters 'a', 'b' and 'c' will become "
|
||||
"keyword-only parameters in Python 3.14.", 1))
|
||||
{
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 3, 1, argsbuf);
|
||||
if (!args) {
|
||||
goto exit;
|
||||
}
|
||||
a = args[0];
|
||||
b = args[1];
|
||||
c = args[2];
|
||||
d = args[3];
|
||||
return_value = depr_star_pos0_len3_with_kwd_impl(module, a, b, c, d);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(depr_star_pos1_len1_opt__doc__,
|
||||
"depr_star_pos1_len1_opt($module, /, a, b=None)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"Note: Passing 2 positional arguments to depr_star_pos1_len1_opt() is\n"
|
||||
"deprecated. Parameter \'b\' will become a keyword-only parameter in\n"
|
||||
"Python 3.14.\n"
|
||||
"");
|
||||
|
||||
#define DEPR_STAR_POS1_LEN1_OPT_METHODDEF \
|
||||
{"depr_star_pos1_len1_opt", _PyCFunction_CAST(depr_star_pos1_len1_opt), METH_FASTCALL|METH_KEYWORDS, depr_star_pos1_len1_opt__doc__},
|
||||
|
||||
static PyObject *
|
||||
depr_star_pos1_len1_opt_impl(PyObject *module, PyObject *a, PyObject *b);
|
||||
|
||||
static PyObject *
|
||||
depr_star_pos1_len1_opt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
|
||||
|
||||
#define NUM_KEYWORDS 2
|
||||
static struct {
|
||||
PyGC_Head _this_is_not_used;
|
||||
PyObject_VAR_HEAD
|
||||
PyObject *ob_item[NUM_KEYWORDS];
|
||||
} _kwtuple = {
|
||||
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
|
||||
.ob_item = { &_Py_ID(a), &_Py_ID(b), },
|
||||
};
|
||||
#undef NUM_KEYWORDS
|
||||
#define KWTUPLE (&_kwtuple.ob_base.ob_base)
|
||||
|
||||
#else // !Py_BUILD_CORE
|
||||
# define KWTUPLE NULL
|
||||
#endif // !Py_BUILD_CORE
|
||||
|
||||
static const char * const _keywords[] = {"a", "b", NULL};
|
||||
static _PyArg_Parser _parser = {
|
||||
.keywords = _keywords,
|
||||
.fname = "depr_star_pos1_len1_opt",
|
||||
.kwtuple = KWTUPLE,
|
||||
};
|
||||
#undef KWTUPLE
|
||||
PyObject *argsbuf[2];
|
||||
Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
|
||||
PyObject *a;
|
||||
PyObject *b = Py_None;
|
||||
|
||||
// Emit compiler warnings when we get to Python 3.14.
|
||||
#if PY_VERSION_HEX >= 0x030e00C0
|
||||
# error \
|
||||
"In _testclinic.c, update parameter(s) 'b' in the clinic input of" \
|
||||
" 'depr_star_pos1_len1_opt' to be keyword-only."
|
||||
#elif PY_VERSION_HEX >= 0x030e00A0
|
||||
# ifdef _MSC_VER
|
||||
# pragma message ( \
|
||||
"In _testclinic.c, update parameter(s) 'b' in the clinic input of" \
|
||||
" 'depr_star_pos1_len1_opt' to be keyword-only.")
|
||||
# else
|
||||
# warning \
|
||||
"In _testclinic.c, update parameter(s) 'b' in the clinic input of" \
|
||||
" 'depr_star_pos1_len1_opt' to be keyword-only."
|
||||
# endif
|
||||
#endif
|
||||
if (nargs == 2) {
|
||||
if (PyErr_WarnEx(PyExc_DeprecationWarning,
|
||||
"Passing 2 positional arguments to depr_star_pos1_len1_opt() is "
|
||||
"deprecated. Parameter 'b' will become a keyword-only parameter "
|
||||
"in Python 3.14.", 1))
|
||||
{
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
|
||||
if (!args) {
|
||||
goto exit;
|
||||
}
|
||||
a = args[0];
|
||||
if (!noptargs) {
|
||||
goto skip_optional_pos;
|
||||
}
|
||||
b = args[1];
|
||||
skip_optional_pos:
|
||||
return_value = depr_star_pos1_len1_opt_impl(module, a, b);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(depr_star_pos1_len1__doc__,
|
||||
"depr_star_pos1_len1($module, /, a, b)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"Note: Passing 2 positional arguments to depr_star_pos1_len1() is\n"
|
||||
"deprecated. Parameter \'b\' will become a keyword-only parameter in\n"
|
||||
"Python 3.14.\n"
|
||||
"");
|
||||
|
||||
#define DEPR_STAR_POS1_LEN1_METHODDEF \
|
||||
{"depr_star_pos1_len1", _PyCFunction_CAST(depr_star_pos1_len1), METH_FASTCALL|METH_KEYWORDS, depr_star_pos1_len1__doc__},
|
||||
|
||||
static PyObject *
|
||||
depr_star_pos1_len1_impl(PyObject *module, PyObject *a, PyObject *b);
|
||||
|
||||
static PyObject *
|
||||
depr_star_pos1_len1(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
|
||||
|
||||
#define NUM_KEYWORDS 2
|
||||
static struct {
|
||||
PyGC_Head _this_is_not_used;
|
||||
PyObject_VAR_HEAD
|
||||
PyObject *ob_item[NUM_KEYWORDS];
|
||||
} _kwtuple = {
|
||||
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
|
||||
.ob_item = { &_Py_ID(a), &_Py_ID(b), },
|
||||
};
|
||||
#undef NUM_KEYWORDS
|
||||
#define KWTUPLE (&_kwtuple.ob_base.ob_base)
|
||||
|
||||
#else // !Py_BUILD_CORE
|
||||
# define KWTUPLE NULL
|
||||
#endif // !Py_BUILD_CORE
|
||||
|
||||
static const char * const _keywords[] = {"a", "b", NULL};
|
||||
static _PyArg_Parser _parser = {
|
||||
.keywords = _keywords,
|
||||
.fname = "depr_star_pos1_len1",
|
||||
.kwtuple = KWTUPLE,
|
||||
};
|
||||
#undef KWTUPLE
|
||||
PyObject *argsbuf[2];
|
||||
PyObject *a;
|
||||
PyObject *b;
|
||||
|
||||
// Emit compiler warnings when we get to Python 3.14.
|
||||
#if PY_VERSION_HEX >= 0x030e00C0
|
||||
# error \
|
||||
"In _testclinic.c, update parameter(s) 'b' in the clinic input of" \
|
||||
" 'depr_star_pos1_len1' to be keyword-only."
|
||||
#elif PY_VERSION_HEX >= 0x030e00A0
|
||||
# ifdef _MSC_VER
|
||||
# pragma message ( \
|
||||
"In _testclinic.c, update parameter(s) 'b' in the clinic input of" \
|
||||
" 'depr_star_pos1_len1' to be keyword-only.")
|
||||
# else
|
||||
# warning \
|
||||
"In _testclinic.c, update parameter(s) 'b' in the clinic input of" \
|
||||
" 'depr_star_pos1_len1' to be keyword-only."
|
||||
# endif
|
||||
#endif
|
||||
if (nargs == 2) {
|
||||
if (PyErr_WarnEx(PyExc_DeprecationWarning,
|
||||
"Passing 2 positional arguments to depr_star_pos1_len1() is "
|
||||
"deprecated. Parameter 'b' will become a keyword-only parameter "
|
||||
"in Python 3.14.", 1))
|
||||
{
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
|
||||
if (!args) {
|
||||
goto exit;
|
||||
}
|
||||
a = args[0];
|
||||
b = args[1];
|
||||
return_value = depr_star_pos1_len1_impl(module, a, b);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(depr_star_pos1_len2_with_kwd__doc__,
|
||||
"depr_star_pos1_len2_with_kwd($module, /, a, b, c, *, d)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"Note: Passing more than 1 positional argument to\n"
|
||||
"depr_star_pos1_len2_with_kwd() is deprecated. Parameters \'b\' and \'c\'\n"
|
||||
"will become keyword-only parameters in Python 3.14.\n"
|
||||
"");
|
||||
|
||||
#define DEPR_STAR_POS1_LEN2_WITH_KWD_METHODDEF \
|
||||
{"depr_star_pos1_len2_with_kwd", _PyCFunction_CAST(depr_star_pos1_len2_with_kwd), METH_FASTCALL|METH_KEYWORDS, depr_star_pos1_len2_with_kwd__doc__},
|
||||
|
||||
static PyObject *
|
||||
depr_star_pos1_len2_with_kwd_impl(PyObject *module, PyObject *a, PyObject *b,
|
||||
PyObject *c, PyObject *d);
|
||||
|
||||
static PyObject *
|
||||
depr_star_pos1_len2_with_kwd(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
|
||||
|
||||
#define NUM_KEYWORDS 4
|
||||
static struct {
|
||||
PyGC_Head _this_is_not_used;
|
||||
PyObject_VAR_HEAD
|
||||
PyObject *ob_item[NUM_KEYWORDS];
|
||||
} _kwtuple = {
|
||||
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
|
||||
.ob_item = { &_Py_ID(a), &_Py_ID(b), &_Py_ID(c), &_Py_ID(d), },
|
||||
};
|
||||
#undef NUM_KEYWORDS
|
||||
#define KWTUPLE (&_kwtuple.ob_base.ob_base)
|
||||
|
||||
#else // !Py_BUILD_CORE
|
||||
# define KWTUPLE NULL
|
||||
#endif // !Py_BUILD_CORE
|
||||
|
||||
static const char * const _keywords[] = {"a", "b", "c", "d", NULL};
|
||||
static _PyArg_Parser _parser = {
|
||||
.keywords = _keywords,
|
||||
.fname = "depr_star_pos1_len2_with_kwd",
|
||||
.kwtuple = KWTUPLE,
|
||||
};
|
||||
#undef KWTUPLE
|
||||
PyObject *argsbuf[4];
|
||||
PyObject *a;
|
||||
PyObject *b;
|
||||
PyObject *c;
|
||||
PyObject *d;
|
||||
|
||||
// Emit compiler warnings when we get to Python 3.14.
|
||||
#if PY_VERSION_HEX >= 0x030e00C0
|
||||
# error \
|
||||
"In _testclinic.c, update parameter(s) 'b' and 'c' in the clinic " \
|
||||
"input of 'depr_star_pos1_len2_with_kwd' to be keyword-only."
|
||||
#elif PY_VERSION_HEX >= 0x030e00A0
|
||||
# ifdef _MSC_VER
|
||||
# pragma message ( \
|
||||
"In _testclinic.c, update parameter(s) 'b' and 'c' in the clinic " \
|
||||
"input of 'depr_star_pos1_len2_with_kwd' to be keyword-only.")
|
||||
# else
|
||||
# warning \
|
||||
"In _testclinic.c, update parameter(s) 'b' and 'c' in the clinic " \
|
||||
"input of 'depr_star_pos1_len2_with_kwd' to be keyword-only."
|
||||
# endif
|
||||
#endif
|
||||
if (nargs > 1 && nargs <= 3) {
|
||||
if (PyErr_WarnEx(PyExc_DeprecationWarning,
|
||||
"Passing more than 1 positional argument to "
|
||||
"depr_star_pos1_len2_with_kwd() is deprecated. Parameters 'b' and"
|
||||
" 'c' will become keyword-only parameters in Python 3.14.", 1))
|
||||
{
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 3, 1, argsbuf);
|
||||
if (!args) {
|
||||
goto exit;
|
||||
}
|
||||
a = args[0];
|
||||
b = args[1];
|
||||
c = args[2];
|
||||
d = args[3];
|
||||
return_value = depr_star_pos1_len2_with_kwd_impl(module, a, b, c, d);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(depr_star_pos2_len1__doc__,
|
||||
"depr_star_pos2_len1($module, /, a, b, c)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"Note: Passing 3 positional arguments to depr_star_pos2_len1() is\n"
|
||||
"deprecated. Parameter \'c\' will become a keyword-only parameter in\n"
|
||||
"Python 3.14.\n"
|
||||
"");
|
||||
|
||||
#define DEPR_STAR_POS2_LEN1_METHODDEF \
|
||||
{"depr_star_pos2_len1", _PyCFunction_CAST(depr_star_pos2_len1), METH_FASTCALL|METH_KEYWORDS, depr_star_pos2_len1__doc__},
|
||||
|
||||
static PyObject *
|
||||
depr_star_pos2_len1_impl(PyObject *module, PyObject *a, PyObject *b,
|
||||
PyObject *c);
|
||||
|
||||
static PyObject *
|
||||
depr_star_pos2_len1(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
|
||||
|
||||
#define NUM_KEYWORDS 3
|
||||
static struct {
|
||||
PyGC_Head _this_is_not_used;
|
||||
PyObject_VAR_HEAD
|
||||
PyObject *ob_item[NUM_KEYWORDS];
|
||||
} _kwtuple = {
|
||||
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
|
||||
.ob_item = { &_Py_ID(a), &_Py_ID(b), &_Py_ID(c), },
|
||||
};
|
||||
#undef NUM_KEYWORDS
|
||||
#define KWTUPLE (&_kwtuple.ob_base.ob_base)
|
||||
|
||||
#else // !Py_BUILD_CORE
|
||||
# define KWTUPLE NULL
|
||||
#endif // !Py_BUILD_CORE
|
||||
|
||||
static const char * const _keywords[] = {"a", "b", "c", NULL};
|
||||
static _PyArg_Parser _parser = {
|
||||
.keywords = _keywords,
|
||||
.fname = "depr_star_pos2_len1",
|
||||
.kwtuple = KWTUPLE,
|
||||
};
|
||||
#undef KWTUPLE
|
||||
PyObject *argsbuf[3];
|
||||
PyObject *a;
|
||||
PyObject *b;
|
||||
PyObject *c;
|
||||
|
||||
// Emit compiler warnings when we get to Python 3.14.
|
||||
#if PY_VERSION_HEX >= 0x030e00C0
|
||||
# error \
|
||||
"In _testclinic.c, update parameter(s) 'c' in the clinic input of" \
|
||||
" 'depr_star_pos2_len1' to be keyword-only."
|
||||
#elif PY_VERSION_HEX >= 0x030e00A0
|
||||
# ifdef _MSC_VER
|
||||
# pragma message ( \
|
||||
"In _testclinic.c, update parameter(s) 'c' in the clinic input of" \
|
||||
" 'depr_star_pos2_len1' to be keyword-only.")
|
||||
# else
|
||||
# warning \
|
||||
"In _testclinic.c, update parameter(s) 'c' in the clinic input of" \
|
||||
" 'depr_star_pos2_len1' to be keyword-only."
|
||||
# endif
|
||||
#endif
|
||||
if (nargs == 3) {
|
||||
if (PyErr_WarnEx(PyExc_DeprecationWarning,
|
||||
"Passing 3 positional arguments to depr_star_pos2_len1() is "
|
||||
"deprecated. Parameter 'c' will become a keyword-only parameter "
|
||||
"in Python 3.14.", 1))
|
||||
{
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 3, 0, argsbuf);
|
||||
if (!args) {
|
||||
goto exit;
|
||||
}
|
||||
a = args[0];
|
||||
b = args[1];
|
||||
c = args[2];
|
||||
return_value = depr_star_pos2_len1_impl(module, a, b, c);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(depr_star_pos2_len2__doc__,
|
||||
"depr_star_pos2_len2($module, /, a, b, c, d)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"Note: Passing more than 2 positional arguments to\n"
|
||||
"depr_star_pos2_len2() is deprecated. Parameters \'c\' and \'d\' will\n"
|
||||
"become keyword-only parameters in Python 3.14.\n"
|
||||
"");
|
||||
|
||||
#define DEPR_STAR_POS2_LEN2_METHODDEF \
|
||||
{"depr_star_pos2_len2", _PyCFunction_CAST(depr_star_pos2_len2), METH_FASTCALL|METH_KEYWORDS, depr_star_pos2_len2__doc__},
|
||||
|
||||
static PyObject *
|
||||
depr_star_pos2_len2_impl(PyObject *module, PyObject *a, PyObject *b,
|
||||
PyObject *c, PyObject *d);
|
||||
|
||||
static PyObject *
|
||||
depr_star_pos2_len2(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
|
||||
|
||||
#define NUM_KEYWORDS 4
|
||||
static struct {
|
||||
PyGC_Head _this_is_not_used;
|
||||
PyObject_VAR_HEAD
|
||||
PyObject *ob_item[NUM_KEYWORDS];
|
||||
} _kwtuple = {
|
||||
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
|
||||
.ob_item = { &_Py_ID(a), &_Py_ID(b), &_Py_ID(c), &_Py_ID(d), },
|
||||
};
|
||||
#undef NUM_KEYWORDS
|
||||
#define KWTUPLE (&_kwtuple.ob_base.ob_base)
|
||||
|
||||
#else // !Py_BUILD_CORE
|
||||
# define KWTUPLE NULL
|
||||
#endif // !Py_BUILD_CORE
|
||||
|
||||
static const char * const _keywords[] = {"a", "b", "c", "d", NULL};
|
||||
static _PyArg_Parser _parser = {
|
||||
.keywords = _keywords,
|
||||
.fname = "depr_star_pos2_len2",
|
||||
.kwtuple = KWTUPLE,
|
||||
};
|
||||
#undef KWTUPLE
|
||||
PyObject *argsbuf[4];
|
||||
PyObject *a;
|
||||
PyObject *b;
|
||||
PyObject *c;
|
||||
PyObject *d;
|
||||
|
||||
// Emit compiler warnings when we get to Python 3.14.
|
||||
#if PY_VERSION_HEX >= 0x030e00C0
|
||||
# error \
|
||||
"In _testclinic.c, update parameter(s) 'c' and 'd' in the clinic " \
|
||||
"input of 'depr_star_pos2_len2' to be keyword-only."
|
||||
#elif PY_VERSION_HEX >= 0x030e00A0
|
||||
# ifdef _MSC_VER
|
||||
# pragma message ( \
|
||||
"In _testclinic.c, update parameter(s) 'c' and 'd' in the clinic " \
|
||||
"input of 'depr_star_pos2_len2' to be keyword-only.")
|
||||
# else
|
||||
# warning \
|
||||
"In _testclinic.c, update parameter(s) 'c' and 'd' in the clinic " \
|
||||
"input of 'depr_star_pos2_len2' to be keyword-only."
|
||||
# endif
|
||||
#endif
|
||||
if (nargs > 2 && nargs <= 4) {
|
||||
if (PyErr_WarnEx(PyExc_DeprecationWarning,
|
||||
"Passing more than 2 positional arguments to "
|
||||
"depr_star_pos2_len2() is deprecated. Parameters 'c' and 'd' will"
|
||||
" become keyword-only parameters in Python 3.14.", 1))
|
||||
{
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 4, 4, 0, argsbuf);
|
||||
if (!args) {
|
||||
goto exit;
|
||||
}
|
||||
a = args[0];
|
||||
b = args[1];
|
||||
c = args[2];
|
||||
d = args[3];
|
||||
return_value = depr_star_pos2_len2_impl(module, a, b, c, d);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(depr_star_pos2_len2_with_kwd__doc__,
|
||||
"depr_star_pos2_len2_with_kwd($module, /, a, b, c, d, *, e)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"Note: Passing more than 2 positional arguments to\n"
|
||||
"depr_star_pos2_len2_with_kwd() is deprecated. Parameters \'c\' and \'d\'\n"
|
||||
"will become keyword-only parameters in Python 3.14.\n"
|
||||
"");
|
||||
|
||||
#define DEPR_STAR_POS2_LEN2_WITH_KWD_METHODDEF \
|
||||
{"depr_star_pos2_len2_with_kwd", _PyCFunction_CAST(depr_star_pos2_len2_with_kwd), METH_FASTCALL|METH_KEYWORDS, depr_star_pos2_len2_with_kwd__doc__},
|
||||
|
||||
static PyObject *
|
||||
depr_star_pos2_len2_with_kwd_impl(PyObject *module, PyObject *a, PyObject *b,
|
||||
PyObject *c, PyObject *d, PyObject *e);
|
||||
|
||||
static PyObject *
|
||||
depr_star_pos2_len2_with_kwd(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
|
||||
|
||||
#define NUM_KEYWORDS 5
|
||||
static struct {
|
||||
PyGC_Head _this_is_not_used;
|
||||
PyObject_VAR_HEAD
|
||||
PyObject *ob_item[NUM_KEYWORDS];
|
||||
} _kwtuple = {
|
||||
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
|
||||
.ob_item = { &_Py_ID(a), &_Py_ID(b), &_Py_ID(c), &_Py_ID(d), &_Py_ID(e), },
|
||||
};
|
||||
#undef NUM_KEYWORDS
|
||||
#define KWTUPLE (&_kwtuple.ob_base.ob_base)
|
||||
|
||||
#else // !Py_BUILD_CORE
|
||||
# define KWTUPLE NULL
|
||||
#endif // !Py_BUILD_CORE
|
||||
|
||||
static const char * const _keywords[] = {"a", "b", "c", "d", "e", NULL};
|
||||
static _PyArg_Parser _parser = {
|
||||
.keywords = _keywords,
|
||||
.fname = "depr_star_pos2_len2_with_kwd",
|
||||
.kwtuple = KWTUPLE,
|
||||
};
|
||||
#undef KWTUPLE
|
||||
PyObject *argsbuf[5];
|
||||
PyObject *a;
|
||||
PyObject *b;
|
||||
PyObject *c;
|
||||
PyObject *d;
|
||||
PyObject *e;
|
||||
|
||||
// Emit compiler warnings when we get to Python 3.14.
|
||||
#if PY_VERSION_HEX >= 0x030e00C0
|
||||
# error \
|
||||
"In _testclinic.c, update parameter(s) 'c' and 'd' in the clinic " \
|
||||
"input of 'depr_star_pos2_len2_with_kwd' to be keyword-only."
|
||||
#elif PY_VERSION_HEX >= 0x030e00A0
|
||||
# ifdef _MSC_VER
|
||||
# pragma message ( \
|
||||
"In _testclinic.c, update parameter(s) 'c' and 'd' in the clinic " \
|
||||
"input of 'depr_star_pos2_len2_with_kwd' to be keyword-only.")
|
||||
# else
|
||||
# warning \
|
||||
"In _testclinic.c, update parameter(s) 'c' and 'd' in the clinic " \
|
||||
"input of 'depr_star_pos2_len2_with_kwd' to be keyword-only."
|
||||
# endif
|
||||
#endif
|
||||
if (nargs > 2 && nargs <= 4) {
|
||||
if (PyErr_WarnEx(PyExc_DeprecationWarning,
|
||||
"Passing more than 2 positional arguments to "
|
||||
"depr_star_pos2_len2_with_kwd() is deprecated. Parameters 'c' and"
|
||||
" 'd' will become keyword-only parameters in Python 3.14.", 1))
|
||||
{
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 4, 4, 1, argsbuf);
|
||||
if (!args) {
|
||||
goto exit;
|
||||
}
|
||||
a = args[0];
|
||||
b = args[1];
|
||||
c = args[2];
|
||||
d = args[3];
|
||||
e = args[4];
|
||||
return_value = depr_star_pos2_len2_with_kwd_impl(module, a, b, c, d, e);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=18ab056f6cc06d7e input=a9049054013a1b77]*/
|
|
@ -322,6 +322,8 @@ Modules/_testcapi/vectorcall.c - MethodDescriptorBase_Type -
|
|||
Modules/_testcapi/vectorcall.c - MethodDescriptorDerived_Type -
|
||||
Modules/_testcapi/vectorcall.c - MethodDescriptorNopGet_Type -
|
||||
Modules/_testcapi/vectorcall.c - MethodDescriptor2_Type -
|
||||
Modules/_testclinic.c - DeprStarInit -
|
||||
Modules/_testclinic.c - DeprStarNew -
|
||||
|
||||
|
||||
##################################
|
||||
|
|
Can't render this file because it has a wrong number of fields in line 4.
|
Loading…
Reference in New Issue