mirror of https://github.com/python/cpython
gh-95065: Argument Clinic: Pretty-print long C strings in generated code (#107712)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
8fcee6b279
commit
835e388915
|
@ -5521,17 +5521,31 @@ test_deprecate_positional_pos1_len1_optional(PyObject *module, PyObject *const *
|
||||||
PyObject *b = Py_None;
|
PyObject *b = Py_None;
|
||||||
|
|
||||||
#if PY_VERSION_HEX >= 0x030e00C0
|
#if PY_VERSION_HEX >= 0x030e00C0
|
||||||
# error "In clinic.test.c, update parameter(s) 'b' in the clinic input of 'test_deprecate_positional_pos1_len1_optional' to be keyword-only."
|
# error \
|
||||||
|
"In clinic.test.c, update parameter(s) 'b' in the clinic input of" \
|
||||||
|
" 'test_deprecate_positional_pos1_len1_optional' to be " \
|
||||||
|
"keyword-only."
|
||||||
#elif PY_VERSION_HEX >= 0x030e00A0
|
#elif PY_VERSION_HEX >= 0x030e00A0
|
||||||
# ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
# pragma message ("In clinic.test.c, update parameter(s) 'b' in the clinic input of 'test_deprecate_positional_pos1_len1_optional' to be keyword-only.")
|
# pragma message ( \
|
||||||
|
"In clinic.test.c, update parameter(s) 'b' in the clinic input of" \
|
||||||
|
" 'test_deprecate_positional_pos1_len1_optional' to be " \
|
||||||
|
"keyword-only.")
|
||||||
# else
|
# else
|
||||||
# warning "In clinic.test.c, update parameter(s) 'b' in the clinic input of 'test_deprecate_positional_pos1_len1_optional' to be keyword-only."
|
# warning \
|
||||||
|
"In clinic.test.c, update parameter(s) 'b' in the clinic input of" \
|
||||||
|
" 'test_deprecate_positional_pos1_len1_optional' to be " \
|
||||||
|
"keyword-only."
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
if (nargs == 2) {
|
if (nargs == 2) {
|
||||||
if (PyErr_WarnEx(PyExc_DeprecationWarning, "Passing 2 positional arguments to test_deprecate_positional_pos1_len1_optional() is deprecated. Parameter 'b' will become a keyword-only parameter in Python 3.14.", 1)) {
|
if (PyErr_WarnEx(PyExc_DeprecationWarning,
|
||||||
goto exit;
|
"Passing 2 positional arguments to "
|
||||||
|
"test_deprecate_positional_pos1_len1_optional() 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);
|
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
|
||||||
|
@ -5553,7 +5567,7 @@ exit:
|
||||||
static PyObject *
|
static PyObject *
|
||||||
test_deprecate_positional_pos1_len1_optional_impl(PyObject *module,
|
test_deprecate_positional_pos1_len1_optional_impl(PyObject *module,
|
||||||
PyObject *a, PyObject *b)
|
PyObject *a, PyObject *b)
|
||||||
/*[clinic end generated code: output=20bdea6a2960ddf3 input=89099f3dacd757da]*/
|
/*[clinic end generated code: output=09a6edec1ddcd469 input=89099f3dacd757da]*/
|
||||||
|
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
|
@ -5609,17 +5623,27 @@ test_deprecate_positional_pos1_len1(PyObject *module, PyObject *const *args, Py_
|
||||||
PyObject *b;
|
PyObject *b;
|
||||||
|
|
||||||
#if PY_VERSION_HEX >= 0x030e00C0
|
#if PY_VERSION_HEX >= 0x030e00C0
|
||||||
# error "In clinic.test.c, update parameter(s) 'b' in the clinic input of 'test_deprecate_positional_pos1_len1' to be keyword-only."
|
# error \
|
||||||
|
"In clinic.test.c, update parameter(s) 'b' in the clinic input of" \
|
||||||
|
" 'test_deprecate_positional_pos1_len1' to be keyword-only."
|
||||||
#elif PY_VERSION_HEX >= 0x030e00A0
|
#elif PY_VERSION_HEX >= 0x030e00A0
|
||||||
# ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
# pragma message ("In clinic.test.c, update parameter(s) 'b' in the clinic input of 'test_deprecate_positional_pos1_len1' to be keyword-only.")
|
# pragma message ( \
|
||||||
|
"In clinic.test.c, update parameter(s) 'b' in the clinic input of" \
|
||||||
|
" 'test_deprecate_positional_pos1_len1' to be keyword-only.")
|
||||||
# else
|
# else
|
||||||
# warning "In clinic.test.c, update parameter(s) 'b' in the clinic input of 'test_deprecate_positional_pos1_len1' to be keyword-only."
|
# warning \
|
||||||
|
"In clinic.test.c, update parameter(s) 'b' in the clinic input of" \
|
||||||
|
" 'test_deprecate_positional_pos1_len1' to be keyword-only."
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
if (nargs == 2) {
|
if (nargs == 2) {
|
||||||
if (PyErr_WarnEx(PyExc_DeprecationWarning, "Passing 2 positional arguments to test_deprecate_positional_pos1_len1() is deprecated. Parameter 'b' will become a keyword-only parameter in Python 3.14.", 1)) {
|
if (PyErr_WarnEx(PyExc_DeprecationWarning,
|
||||||
goto exit;
|
"Passing 2 positional arguments to "
|
||||||
|
"test_deprecate_positional_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);
|
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
|
||||||
|
@ -5637,7 +5661,7 @@ exit:
|
||||||
static PyObject *
|
static PyObject *
|
||||||
test_deprecate_positional_pos1_len1_impl(PyObject *module, PyObject *a,
|
test_deprecate_positional_pos1_len1_impl(PyObject *module, PyObject *a,
|
||||||
PyObject *b)
|
PyObject *b)
|
||||||
/*[clinic end generated code: output=22c70f8b36085758 input=1702bbab1e9b3b99]*/
|
/*[clinic end generated code: output=52a2618293df747d input=1702bbab1e9b3b99]*/
|
||||||
|
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
|
@ -5699,17 +5723,31 @@ test_deprecate_positional_pos1_len2_with_kwd(PyObject *module, PyObject *const *
|
||||||
PyObject *d;
|
PyObject *d;
|
||||||
|
|
||||||
#if PY_VERSION_HEX >= 0x030e00C0
|
#if PY_VERSION_HEX >= 0x030e00C0
|
||||||
# error "In clinic.test.c, update parameter(s) 'b' and 'c' in the clinic input of 'test_deprecate_positional_pos1_len2_with_kwd' to be keyword-only."
|
# error \
|
||||||
|
"In clinic.test.c, update parameter(s) 'b' and 'c' in the clinic " \
|
||||||
|
"input of 'test_deprecate_positional_pos1_len2_with_kwd' to be " \
|
||||||
|
"keyword-only."
|
||||||
#elif PY_VERSION_HEX >= 0x030e00A0
|
#elif PY_VERSION_HEX >= 0x030e00A0
|
||||||
# ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
# pragma message ("In clinic.test.c, update parameter(s) 'b' and 'c' in the clinic input of 'test_deprecate_positional_pos1_len2_with_kwd' to be keyword-only.")
|
# pragma message ( \
|
||||||
|
"In clinic.test.c, update parameter(s) 'b' and 'c' in the clinic " \
|
||||||
|
"input of 'test_deprecate_positional_pos1_len2_with_kwd' to be " \
|
||||||
|
"keyword-only.")
|
||||||
# else
|
# else
|
||||||
# warning "In clinic.test.c, update parameter(s) 'b' and 'c' in the clinic input of 'test_deprecate_positional_pos1_len2_with_kwd' to be keyword-only."
|
# warning \
|
||||||
|
"In clinic.test.c, update parameter(s) 'b' and 'c' in the clinic " \
|
||||||
|
"input of 'test_deprecate_positional_pos1_len2_with_kwd' to be " \
|
||||||
|
"keyword-only."
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
if (nargs > 1 && nargs <= 3) {
|
if (nargs > 1 && nargs <= 3) {
|
||||||
if (PyErr_WarnEx(PyExc_DeprecationWarning, "Passing more than 1 positional argument to test_deprecate_positional_pos1_len2_with_kwd() is deprecated. Parameters 'b' and 'c' will become keyword-only parameters in Python 3.14.", 1)) {
|
if (PyErr_WarnEx(PyExc_DeprecationWarning,
|
||||||
goto exit;
|
"Passing more than 1 positional argument to "
|
||||||
|
"test_deprecate_positional_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);
|
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 3, 1, argsbuf);
|
||||||
|
@ -5730,7 +5768,7 @@ static PyObject *
|
||||||
test_deprecate_positional_pos1_len2_with_kwd_impl(PyObject *module,
|
test_deprecate_positional_pos1_len2_with_kwd_impl(PyObject *module,
|
||||||
PyObject *a, PyObject *b,
|
PyObject *a, PyObject *b,
|
||||||
PyObject *c, PyObject *d)
|
PyObject *c, PyObject *d)
|
||||||
/*[clinic end generated code: output=79c5f04220a1f3aa input=28cdb885f6c34eab]*/
|
/*[clinic end generated code: output=550aabea548589b4 input=28cdb885f6c34eab]*/
|
||||||
|
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
|
@ -5783,17 +5821,27 @@ test_deprecate_positional_pos0_len1(PyObject *module, PyObject *const *args, Py_
|
||||||
PyObject *a;
|
PyObject *a;
|
||||||
|
|
||||||
#if PY_VERSION_HEX >= 0x030e00C0
|
#if PY_VERSION_HEX >= 0x030e00C0
|
||||||
# error "In clinic.test.c, update parameter(s) 'a' in the clinic input of 'test_deprecate_positional_pos0_len1' to be keyword-only."
|
# error \
|
||||||
|
"In clinic.test.c, update parameter(s) 'a' in the clinic input of" \
|
||||||
|
" 'test_deprecate_positional_pos0_len1' to be keyword-only."
|
||||||
#elif PY_VERSION_HEX >= 0x030e00A0
|
#elif PY_VERSION_HEX >= 0x030e00A0
|
||||||
# ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
# pragma message ("In clinic.test.c, update parameter(s) 'a' in the clinic input of 'test_deprecate_positional_pos0_len1' to be keyword-only.")
|
# pragma message ( \
|
||||||
|
"In clinic.test.c, update parameter(s) 'a' in the clinic input of" \
|
||||||
|
" 'test_deprecate_positional_pos0_len1' to be keyword-only.")
|
||||||
# else
|
# else
|
||||||
# warning "In clinic.test.c, update parameter(s) 'a' in the clinic input of 'test_deprecate_positional_pos0_len1' to be keyword-only."
|
# warning \
|
||||||
|
"In clinic.test.c, update parameter(s) 'a' in the clinic input of" \
|
||||||
|
" 'test_deprecate_positional_pos0_len1' to be keyword-only."
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
if (nargs == 1) {
|
if (nargs == 1) {
|
||||||
if (PyErr_WarnEx(PyExc_DeprecationWarning, "Passing positional arguments to test_deprecate_positional_pos0_len1() is deprecated. Parameter 'a' will become a keyword-only parameter in Python 3.14.", 1)) {
|
if (PyErr_WarnEx(PyExc_DeprecationWarning,
|
||||||
goto exit;
|
"Passing positional arguments to "
|
||||||
|
"test_deprecate_positional_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);
|
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
|
||||||
|
@ -5809,7 +5857,7 @@ exit:
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
test_deprecate_positional_pos0_len1_impl(PyObject *module, PyObject *a)
|
test_deprecate_positional_pos0_len1_impl(PyObject *module, PyObject *a)
|
||||||
/*[clinic end generated code: output=1b7f23b9ffca431b input=678206db25c0652c]*/
|
/*[clinic end generated code: output=66c63ec8d6903bde input=678206db25c0652c]*/
|
||||||
|
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
|
@ -5865,17 +5913,30 @@ test_deprecate_positional_pos0_len2(PyObject *module, PyObject *const *args, Py_
|
||||||
PyObject *b;
|
PyObject *b;
|
||||||
|
|
||||||
#if PY_VERSION_HEX >= 0x030e00C0
|
#if PY_VERSION_HEX >= 0x030e00C0
|
||||||
# error "In clinic.test.c, update parameter(s) 'a' and 'b' in the clinic input of 'test_deprecate_positional_pos0_len2' to be keyword-only."
|
# error \
|
||||||
|
"In clinic.test.c, update parameter(s) 'a' and 'b' in the clinic " \
|
||||||
|
"input of 'test_deprecate_positional_pos0_len2' to be " \
|
||||||
|
"keyword-only."
|
||||||
#elif PY_VERSION_HEX >= 0x030e00A0
|
#elif PY_VERSION_HEX >= 0x030e00A0
|
||||||
# ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
# pragma message ("In clinic.test.c, update parameter(s) 'a' and 'b' in the clinic input of 'test_deprecate_positional_pos0_len2' to be keyword-only.")
|
# pragma message ( \
|
||||||
|
"In clinic.test.c, update parameter(s) 'a' and 'b' in the clinic " \
|
||||||
|
"input of 'test_deprecate_positional_pos0_len2' to be " \
|
||||||
|
"keyword-only.")
|
||||||
# else
|
# else
|
||||||
# warning "In clinic.test.c, update parameter(s) 'a' and 'b' in the clinic input of 'test_deprecate_positional_pos0_len2' to be keyword-only."
|
# warning \
|
||||||
|
"In clinic.test.c, update parameter(s) 'a' and 'b' in the clinic " \
|
||||||
|
"input of 'test_deprecate_positional_pos0_len2' to be " \
|
||||||
|
"keyword-only."
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
if (nargs > 0 && nargs <= 2) {
|
if (nargs > 0 && nargs <= 2) {
|
||||||
if (PyErr_WarnEx(PyExc_DeprecationWarning, "Passing positional arguments to test_deprecate_positional_pos0_len2() is deprecated. Parameters 'a' and 'b' will become keyword-only parameters in Python 3.14.", 1)) {
|
if (PyErr_WarnEx(PyExc_DeprecationWarning,
|
||||||
goto exit;
|
"Passing positional arguments to "
|
||||||
|
"test_deprecate_positional_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);
|
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
|
||||||
|
@ -5893,7 +5954,7 @@ exit:
|
||||||
static PyObject *
|
static PyObject *
|
||||||
test_deprecate_positional_pos0_len2_impl(PyObject *module, PyObject *a,
|
test_deprecate_positional_pos0_len2_impl(PyObject *module, PyObject *a,
|
||||||
PyObject *b)
|
PyObject *b)
|
||||||
/*[clinic end generated code: output=31b494f2dcc016af input=fae0d0b1d480c939]*/
|
/*[clinic end generated code: output=6b6df40aaf751b2e input=fae0d0b1d480c939]*/
|
||||||
|
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
|
@ -5958,17 +6019,34 @@ test_deprecate_positional_pos0_len3_with_kwdonly(PyObject *module, PyObject *con
|
||||||
PyObject *e;
|
PyObject *e;
|
||||||
|
|
||||||
#if PY_VERSION_HEX >= 0x030e00C0
|
#if PY_VERSION_HEX >= 0x030e00C0
|
||||||
# error "In clinic.test.c, update parameter(s) 'a', 'b' and 'c' in the clinic input of 'test_deprecate_positional_pos0_len3_with_kwdonly' to be keyword-only."
|
# error \
|
||||||
|
"In clinic.test.c, update parameter(s) 'a', 'b' and 'c' in the " \
|
||||||
|
"clinic input of " \
|
||||||
|
"'test_deprecate_positional_pos0_len3_with_kwdonly' to be " \
|
||||||
|
"keyword-only."
|
||||||
#elif PY_VERSION_HEX >= 0x030e00A0
|
#elif PY_VERSION_HEX >= 0x030e00A0
|
||||||
# ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
# pragma message ("In clinic.test.c, update parameter(s) 'a', 'b' and 'c' in the clinic input of 'test_deprecate_positional_pos0_len3_with_kwdonly' to be keyword-only.")
|
# pragma message ( \
|
||||||
|
"In clinic.test.c, update parameter(s) 'a', 'b' and 'c' in the " \
|
||||||
|
"clinic input of " \
|
||||||
|
"'test_deprecate_positional_pos0_len3_with_kwdonly' to be " \
|
||||||
|
"keyword-only.")
|
||||||
# else
|
# else
|
||||||
# warning "In clinic.test.c, update parameter(s) 'a', 'b' and 'c' in the clinic input of 'test_deprecate_positional_pos0_len3_with_kwdonly' to be keyword-only."
|
# warning \
|
||||||
|
"In clinic.test.c, update parameter(s) 'a', 'b' and 'c' in the " \
|
||||||
|
"clinic input of " \
|
||||||
|
"'test_deprecate_positional_pos0_len3_with_kwdonly' to be " \
|
||||||
|
"keyword-only."
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
if (nargs > 0 && nargs <= 3) {
|
if (nargs > 0 && nargs <= 3) {
|
||||||
if (PyErr_WarnEx(PyExc_DeprecationWarning, "Passing positional arguments to test_deprecate_positional_pos0_len3_with_kwdonly() is deprecated. Parameters 'a', 'b' and 'c' will become keyword-only parameters in Python 3.14.", 1)) {
|
if (PyErr_WarnEx(PyExc_DeprecationWarning,
|
||||||
goto exit;
|
"Passing positional arguments to "
|
||||||
|
"test_deprecate_positional_pos0_len3_with_kwdonly() 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);
|
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 3, 1, argsbuf);
|
||||||
|
@ -5991,7 +6069,7 @@ test_deprecate_positional_pos0_len3_with_kwdonly_impl(PyObject *module,
|
||||||
PyObject *b,
|
PyObject *b,
|
||||||
PyObject *c,
|
PyObject *c,
|
||||||
PyObject *e)
|
PyObject *e)
|
||||||
/*[clinic end generated code: output=96978e786acfbc7b input=1b0121770c0c52e0]*/
|
/*[clinic end generated code: output=5c936993846d01a3 input=1b0121770c0c52e0]*/
|
||||||
|
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
|
@ -6049,17 +6127,27 @@ test_deprecate_positional_pos2_len1(PyObject *module, PyObject *const *args, Py_
|
||||||
PyObject *c;
|
PyObject *c;
|
||||||
|
|
||||||
#if PY_VERSION_HEX >= 0x030e00C0
|
#if PY_VERSION_HEX >= 0x030e00C0
|
||||||
# error "In clinic.test.c, update parameter(s) 'c' in the clinic input of 'test_deprecate_positional_pos2_len1' to be keyword-only."
|
# error \
|
||||||
|
"In clinic.test.c, update parameter(s) 'c' in the clinic input of" \
|
||||||
|
" 'test_deprecate_positional_pos2_len1' to be keyword-only."
|
||||||
#elif PY_VERSION_HEX >= 0x030e00A0
|
#elif PY_VERSION_HEX >= 0x030e00A0
|
||||||
# ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
# pragma message ("In clinic.test.c, update parameter(s) 'c' in the clinic input of 'test_deprecate_positional_pos2_len1' to be keyword-only.")
|
# pragma message ( \
|
||||||
|
"In clinic.test.c, update parameter(s) 'c' in the clinic input of" \
|
||||||
|
" 'test_deprecate_positional_pos2_len1' to be keyword-only.")
|
||||||
# else
|
# else
|
||||||
# warning "In clinic.test.c, update parameter(s) 'c' in the clinic input of 'test_deprecate_positional_pos2_len1' to be keyword-only."
|
# warning \
|
||||||
|
"In clinic.test.c, update parameter(s) 'c' in the clinic input of" \
|
||||||
|
" 'test_deprecate_positional_pos2_len1' to be keyword-only."
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
if (nargs == 3) {
|
if (nargs == 3) {
|
||||||
if (PyErr_WarnEx(PyExc_DeprecationWarning, "Passing 3 positional arguments to test_deprecate_positional_pos2_len1() is deprecated. Parameter 'c' will become a keyword-only parameter in Python 3.14.", 1)) {
|
if (PyErr_WarnEx(PyExc_DeprecationWarning,
|
||||||
goto exit;
|
"Passing 3 positional arguments to "
|
||||||
|
"test_deprecate_positional_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);
|
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 3, 0, argsbuf);
|
||||||
|
@ -6078,7 +6166,7 @@ exit:
|
||||||
static PyObject *
|
static PyObject *
|
||||||
test_deprecate_positional_pos2_len1_impl(PyObject *module, PyObject *a,
|
test_deprecate_positional_pos2_len1_impl(PyObject *module, PyObject *a,
|
||||||
PyObject *b, PyObject *c)
|
PyObject *b, PyObject *c)
|
||||||
/*[clinic end generated code: output=ceadd05f11f7f491 input=e1d129689e69ec7c]*/
|
/*[clinic end generated code: output=2641e037296e3b61 input=e1d129689e69ec7c]*/
|
||||||
|
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
|
@ -6139,17 +6227,30 @@ test_deprecate_positional_pos2_len2(PyObject *module, PyObject *const *args, Py_
|
||||||
PyObject *d;
|
PyObject *d;
|
||||||
|
|
||||||
#if PY_VERSION_HEX >= 0x030e00C0
|
#if PY_VERSION_HEX >= 0x030e00C0
|
||||||
# error "In clinic.test.c, update parameter(s) 'c' and 'd' in the clinic input of 'test_deprecate_positional_pos2_len2' to be keyword-only."
|
# error \
|
||||||
|
"In clinic.test.c, update parameter(s) 'c' and 'd' in the clinic " \
|
||||||
|
"input of 'test_deprecate_positional_pos2_len2' to be " \
|
||||||
|
"keyword-only."
|
||||||
#elif PY_VERSION_HEX >= 0x030e00A0
|
#elif PY_VERSION_HEX >= 0x030e00A0
|
||||||
# ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
# pragma message ("In clinic.test.c, update parameter(s) 'c' and 'd' in the clinic input of 'test_deprecate_positional_pos2_len2' to be keyword-only.")
|
# pragma message ( \
|
||||||
|
"In clinic.test.c, update parameter(s) 'c' and 'd' in the clinic " \
|
||||||
|
"input of 'test_deprecate_positional_pos2_len2' to be " \
|
||||||
|
"keyword-only.")
|
||||||
# else
|
# else
|
||||||
# warning "In clinic.test.c, update parameter(s) 'c' and 'd' in the clinic input of 'test_deprecate_positional_pos2_len2' to be keyword-only."
|
# warning \
|
||||||
|
"In clinic.test.c, update parameter(s) 'c' and 'd' in the clinic " \
|
||||||
|
"input of 'test_deprecate_positional_pos2_len2' to be " \
|
||||||
|
"keyword-only."
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
if (nargs > 2 && nargs <= 4) {
|
if (nargs > 2 && nargs <= 4) {
|
||||||
if (PyErr_WarnEx(PyExc_DeprecationWarning, "Passing more than 2 positional arguments to test_deprecate_positional_pos2_len2() is deprecated. Parameters 'c' and 'd' will become keyword-only parameters in Python 3.14.", 1)) {
|
if (PyErr_WarnEx(PyExc_DeprecationWarning,
|
||||||
goto exit;
|
"Passing more than 2 positional arguments to "
|
||||||
|
"test_deprecate_positional_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);
|
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 4, 4, 0, argsbuf);
|
||||||
|
@ -6170,7 +6271,7 @@ static PyObject *
|
||||||
test_deprecate_positional_pos2_len2_impl(PyObject *module, PyObject *a,
|
test_deprecate_positional_pos2_len2_impl(PyObject *module, PyObject *a,
|
||||||
PyObject *b, PyObject *c,
|
PyObject *b, PyObject *c,
|
||||||
PyObject *d)
|
PyObject *d)
|
||||||
/*[clinic end generated code: output=5693682e3fa1188b input=0d53533463a12792]*/
|
/*[clinic end generated code: output=4a9068ef8fee61f6 input=0d53533463a12792]*/
|
||||||
|
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
|
@ -6238,17 +6339,31 @@ test_deprecate_positional_pos2_len3_with_kwdonly(PyObject *module, PyObject *con
|
||||||
PyObject *e;
|
PyObject *e;
|
||||||
|
|
||||||
#if PY_VERSION_HEX >= 0x030e00C0
|
#if PY_VERSION_HEX >= 0x030e00C0
|
||||||
# error "In clinic.test.c, update parameter(s) 'c' and 'd' in the clinic input of 'test_deprecate_positional_pos2_len3_with_kwdonly' to be keyword-only."
|
# error \
|
||||||
|
"In clinic.test.c, update parameter(s) 'c' and 'd' in the clinic " \
|
||||||
|
"input of 'test_deprecate_positional_pos2_len3_with_kwdonly' to " \
|
||||||
|
"be keyword-only."
|
||||||
#elif PY_VERSION_HEX >= 0x030e00A0
|
#elif PY_VERSION_HEX >= 0x030e00A0
|
||||||
# ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
# pragma message ("In clinic.test.c, update parameter(s) 'c' and 'd' in the clinic input of 'test_deprecate_positional_pos2_len3_with_kwdonly' to be keyword-only.")
|
# pragma message ( \
|
||||||
|
"In clinic.test.c, update parameter(s) 'c' and 'd' in the clinic " \
|
||||||
|
"input of 'test_deprecate_positional_pos2_len3_with_kwdonly' to " \
|
||||||
|
"be keyword-only.")
|
||||||
# else
|
# else
|
||||||
# warning "In clinic.test.c, update parameter(s) 'c' and 'd' in the clinic input of 'test_deprecate_positional_pos2_len3_with_kwdonly' to be keyword-only."
|
# warning \
|
||||||
|
"In clinic.test.c, update parameter(s) 'c' and 'd' in the clinic " \
|
||||||
|
"input of 'test_deprecate_positional_pos2_len3_with_kwdonly' to " \
|
||||||
|
"be keyword-only."
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
if (nargs > 2 && nargs <= 4) {
|
if (nargs > 2 && nargs <= 4) {
|
||||||
if (PyErr_WarnEx(PyExc_DeprecationWarning, "Passing more than 2 positional arguments to test_deprecate_positional_pos2_len3_with_kwdonly() is deprecated. Parameters 'c' and 'd' will become keyword-only parameters in Python 3.14.", 1)) {
|
if (PyErr_WarnEx(PyExc_DeprecationWarning,
|
||||||
goto exit;
|
"Passing more than 2 positional arguments to "
|
||||||
|
"test_deprecate_positional_pos2_len3_with_kwdonly() 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);
|
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 4, 4, 1, argsbuf);
|
||||||
|
@ -6273,4 +6388,4 @@ test_deprecate_positional_pos2_len3_with_kwdonly_impl(PyObject *module,
|
||||||
PyObject *c,
|
PyObject *c,
|
||||||
PyObject *d,
|
PyObject *d,
|
||||||
PyObject *e)
|
PyObject *e)
|
||||||
/*[clinic end generated code: output=00d436de747a00f3 input=154fd450448d8935]*/
|
/*[clinic end generated code: output=1154c2e3e798948c input=154fd450448d8935]*/
|
||||||
|
|
|
@ -221,6 +221,20 @@ def c_repr(s: str) -> str:
|
||||||
return '"' + s + '"'
|
return '"' + s + '"'
|
||||||
|
|
||||||
|
|
||||||
|
def wrapped_c_string_literal(
|
||||||
|
text: str,
|
||||||
|
*,
|
||||||
|
width: int = 72,
|
||||||
|
suffix: str = '',
|
||||||
|
initial_indent: int = 0,
|
||||||
|
subsequent_indent: int = 4
|
||||||
|
) -> str:
|
||||||
|
wrapped = textwrap.wrap(text, width=width, replace_whitespace=False,
|
||||||
|
drop_whitespace=False, break_on_hyphens=False)
|
||||||
|
separator = '"' + suffix + '\n' + subsequent_indent * ' ' + '"'
|
||||||
|
return initial_indent * ' ' + '"' + separator.join(wrapped) + '"'
|
||||||
|
|
||||||
|
|
||||||
is_legal_c_identifier = re.compile('^[A-Za-z_][A-Za-z0-9_]*$').match
|
is_legal_c_identifier = re.compile('^[A-Za-z_][A-Za-z0-9_]*$').match
|
||||||
|
|
||||||
def is_legal_py_identifier(s: str) -> bool:
|
def is_legal_py_identifier(s: str) -> bool:
|
||||||
|
@ -837,17 +851,22 @@ class CLanguage(Language):
|
||||||
""")
|
""")
|
||||||
DEPRECATED_POSITIONAL_PROTOTYPE: Final[str] = r"""
|
DEPRECATED_POSITIONAL_PROTOTYPE: Final[str] = r"""
|
||||||
#if PY_VERSION_HEX >= 0x{major:02x}{minor:02x}00C0
|
#if PY_VERSION_HEX >= 0x{major:02x}{minor:02x}00C0
|
||||||
# error "{cpp_message}"
|
# error \
|
||||||
|
{cpp_message}
|
||||||
#elif PY_VERSION_HEX >= 0x{major:02x}{minor:02x}00A0
|
#elif PY_VERSION_HEX >= 0x{major:02x}{minor:02x}00A0
|
||||||
# ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
# pragma message ("{cpp_message}")
|
# pragma message ( \
|
||||||
|
{cpp_message})
|
||||||
# else
|
# else
|
||||||
# warning "{cpp_message}"
|
# warning \
|
||||||
|
{cpp_message}
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
if ({condition}) {{{{
|
if ({condition}) {{{{
|
||||||
if (PyErr_WarnEx(PyExc_DeprecationWarning, "{depr_message}", 1)) {{{{
|
if (PyErr_WarnEx(PyExc_DeprecationWarning,
|
||||||
goto exit;
|
{depr_message}, 1))
|
||||||
|
{{{{
|
||||||
|
goto exit;
|
||||||
}}}}
|
}}}}
|
||||||
}}}}
|
}}}}
|
||||||
"""
|
"""
|
||||||
|
@ -899,6 +918,7 @@ class CLanguage(Language):
|
||||||
f"In {source}, update parameter(s) {pstr} in the clinic "
|
f"In {source}, update parameter(s) {pstr} in the clinic "
|
||||||
f"input of {func.full_name!r} to be keyword-only."
|
f"input of {func.full_name!r} to be keyword-only."
|
||||||
)
|
)
|
||||||
|
|
||||||
# Format the deprecation message.
|
# Format the deprecation message.
|
||||||
if first_pos == 0:
|
if first_pos == 0:
|
||||||
preamble = "Passing positional arguments to "
|
preamble = "Passing positional arguments to "
|
||||||
|
@ -926,8 +946,11 @@ class CLanguage(Language):
|
||||||
condition=condition,
|
condition=condition,
|
||||||
major=major,
|
major=major,
|
||||||
minor=minor,
|
minor=minor,
|
||||||
cpp_message=cpp_message,
|
cpp_message=wrapped_c_string_literal(cpp_message, suffix=" \\",
|
||||||
depr_message=depr_message,
|
width=64,
|
||||||
|
subsequent_indent=16),
|
||||||
|
depr_message=wrapped_c_string_literal(depr_message, width=64,
|
||||||
|
subsequent_indent=20),
|
||||||
)
|
)
|
||||||
return normalize_snippet(code, indent=4)
|
return normalize_snippet(code, indent=4)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue