diff --git a/Lib/test/clinic.test.c b/Lib/test/clinic.test.c index 1b007eeaf9a5c0b..776411844da89e6 100644 --- a/Lib/test/clinic.test.c +++ b/Lib/test/clinic.test.c @@ -5520,33 +5520,29 @@ test_deprecate_positional_pos1_len1_optional(PyObject *module, PyObject *const * PyObject *a; PyObject *b = Py_None; - #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." \ - - #elif PY_VERSION_HEX >= 0x030e00A0 - # 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." \ - ) - # 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." \ - - # endif - #endif - 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)) - { - goto exit; - } + #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." + #elif PY_VERSION_HEX >= 0x030e00A0 + # 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.") + # 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." + # endif + #endif + 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)) + { + goto exit; + } args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf); if (!args) { goto exit; @@ -5566,7 +5562,7 @@ test_deprecate_positional_pos1_len1_optional(PyObject *module, PyObject *const * static PyObject * test_deprecate_positional_pos1_len1_optional_impl(PyObject *module, PyObject *a, PyObject *b) -/*[clinic end generated code: output=ca647c9f73c7870c input=89099f3dacd757da]*/ +/*[clinic end generated code: output=862743ccf359e467 input=89099f3dacd757da]*/ /*[clinic input] @@ -5621,33 +5617,29 @@ test_deprecate_positional_pos1_len1(PyObject *module, PyObject *const *args, Py_ PyObject *a; PyObject *b; - #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." \ - - #elif PY_VERSION_HEX >= 0x030e00A0 - # 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." \ - ) - # else - # 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 - 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)) - { - goto exit; - } + #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." + #elif PY_VERSION_HEX >= 0x030e00A0 + # 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.") + # else + # 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 + 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)) + { + goto exit; + } args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf); if (!args) { goto exit; @@ -5663,7 +5655,7 @@ test_deprecate_positional_pos1_len1(PyObject *module, PyObject *const *args, Py_ static PyObject * test_deprecate_positional_pos1_len1_impl(PyObject *module, PyObject *a, PyObject *b) -/*[clinic end generated code: output=c6766cd75c7eafc3 input=1702bbab1e9b3b99]*/ +/*[clinic end generated code: output=a2963e60fc291de7 input=1702bbab1e9b3b99]*/ /*[clinic input] @@ -5724,33 +5716,30 @@ test_deprecate_positional_pos1_len2_with_kwd(PyObject *module, PyObject *const * PyObject *c; PyObject *d; - #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." \ - - #elif PY_VERSION_HEX >= 0x030e00A0 - # 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." \ - ) - # 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." \ - - # endif - #endif - 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)) - { - goto exit; - } + #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." + #elif PY_VERSION_HEX >= 0x030e00A0 + # 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.") + # 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." + # endif + #endif + 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)) + { + goto exit; + } args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 3, 1, argsbuf); if (!args) { goto exit; @@ -5769,7 +5758,7 @@ static PyObject * test_deprecate_positional_pos1_len2_with_kwd_impl(PyObject *module, PyObject *a, PyObject *b, PyObject *c, PyObject *d) -/*[clinic end generated code: output=f1b8a8485a91897b input=28cdb885f6c34eab]*/ +/*[clinic end generated code: output=277f633ed6d46e75 input=28cdb885f6c34eab]*/ /*[clinic input] @@ -5821,33 +5810,29 @@ test_deprecate_positional_pos0_len1(PyObject *module, PyObject *const *args, Py_ PyObject *argsbuf[1]; PyObject *a; - #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." \ - - #elif PY_VERSION_HEX >= 0x030e00A0 - # 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." \ - ) - # else - # 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 - 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)) - { - goto exit; - } + #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." + #elif PY_VERSION_HEX >= 0x030e00A0 + # 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.") + # else + # 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 + 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)) + { + goto exit; + } args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf); if (!args) { goto exit; @@ -5861,7 +5846,7 @@ test_deprecate_positional_pos0_len1(PyObject *module, PyObject *const *args, Py_ static PyObject * test_deprecate_positional_pos0_len1_impl(PyObject *module, PyObject *a) -/*[clinic end generated code: output=1c4e221147db729e input=678206db25c0652c]*/ +/*[clinic end generated code: output=05d36044c05396e0 input=678206db25c0652c]*/ /*[clinic input] @@ -5916,33 +5901,29 @@ test_deprecate_positional_pos0_len2(PyObject *module, PyObject *const *args, Py_ PyObject *a; PyObject *b; - #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." \ - - #elif PY_VERSION_HEX >= 0x030e00A0 - # 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." \ - ) - # 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." \ - - # endif - #endif - 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)) - { - goto exit; - } + #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." + #elif PY_VERSION_HEX >= 0x030e00A0 + # 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.") + # 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." + # endif + #endif + 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)) + { + goto exit; + } args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf); if (!args) { goto exit; @@ -5958,7 +5939,7 @@ test_deprecate_positional_pos0_len2(PyObject *module, PyObject *const *args, Py_ static PyObject * test_deprecate_positional_pos0_len2_impl(PyObject *module, PyObject *a, PyObject *b) -/*[clinic end generated code: output=98d0f21d5ea92dcf input=fae0d0b1d480c939]*/ +/*[clinic end generated code: output=a33ee0b9ec8e1d96 input=fae0d0b1d480c939]*/ /*[clinic input] @@ -6022,37 +6003,33 @@ test_deprecate_positional_pos0_len3_with_kwdonly(PyObject *module, PyObject *con PyObject *c; PyObject *e; - #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." \ - - #elif PY_VERSION_HEX >= 0x030e00A0 - # 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." \ - ) - # 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." \ - - # endif - #endif - 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)) - { - goto exit; - } + #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." + #elif PY_VERSION_HEX >= 0x030e00A0 + # 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.") + # 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." + # endif + #endif + 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)) + { + goto exit; + } args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 3, 1, argsbuf); if (!args) { goto exit; @@ -6073,7 +6050,7 @@ test_deprecate_positional_pos0_len3_with_kwdonly_impl(PyObject *module, PyObject *b, PyObject *c, PyObject *e) -/*[clinic end generated code: output=71d935160262f8d0 input=1b0121770c0c52e0]*/ +/*[clinic end generated code: output=24d865ef46897afd input=1b0121770c0c52e0]*/ /*[clinic input] @@ -6130,33 +6107,29 @@ test_deprecate_positional_pos2_len1(PyObject *module, PyObject *const *args, Py_ PyObject *b; PyObject *c; - #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." \ - - #elif PY_VERSION_HEX >= 0x030e00A0 - # 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." \ - ) - # else - # 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 - 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)) - { - goto exit; - } + #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." + #elif PY_VERSION_HEX >= 0x030e00A0 + # 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.") + # else + # 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 + 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)) + { + goto exit; + } args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 3, 3, 0, argsbuf); if (!args) { goto exit; @@ -6173,7 +6146,7 @@ test_deprecate_positional_pos2_len1(PyObject *module, PyObject *const *args, Py_ static PyObject * test_deprecate_positional_pos2_len1_impl(PyObject *module, PyObject *a, PyObject *b, PyObject *c) -/*[clinic end generated code: output=af96b85e688b2c50 input=e1d129689e69ec7c]*/ +/*[clinic end generated code: output=58e71c08abc28074 input=e1d129689e69ec7c]*/ /*[clinic input] @@ -6233,33 +6206,29 @@ test_deprecate_positional_pos2_len2(PyObject *module, PyObject *const *args, Py_ PyObject *c; PyObject *d; - #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." \ - - #elif PY_VERSION_HEX >= 0x030e00A0 - # 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." \ - ) - # 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." \ - - # endif - #endif - 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)) - { - goto exit; - } + #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." + #elif PY_VERSION_HEX >= 0x030e00A0 + # 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.") + # 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." + # endif + #endif + 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)) + { + goto exit; + } args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 4, 4, 0, argsbuf); if (!args) { goto exit; @@ -6278,7 +6247,7 @@ static PyObject * test_deprecate_positional_pos2_len2_impl(PyObject *module, PyObject *a, PyObject *b, PyObject *c, PyObject *d) -/*[clinic end generated code: output=8d47aa441ff45caf input=0d53533463a12792]*/ +/*[clinic end generated code: output=0717b6f995cb8eb9 input=0d53533463a12792]*/ /*[clinic input] @@ -6345,34 +6314,33 @@ test_deprecate_positional_pos2_len3_with_kwdonly(PyObject *module, PyObject *con PyObject *d; PyObject *e; - #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." \ - - #elif PY_VERSION_HEX >= 0x030e00A0 - # 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." \ - ) - # 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." \ - - # endif - #endif - 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)) - { - goto exit; - } + #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." + #elif PY_VERSION_HEX >= 0x030e00A0 + # 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.") + # 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." + # endif + #endif + 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)) + { + goto exit; + } args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 4, 4, 1, argsbuf); if (!args) { goto exit; @@ -6395,4 +6363,4 @@ test_deprecate_positional_pos2_len3_with_kwdonly_impl(PyObject *module, PyObject *c, PyObject *d, PyObject *e) -/*[clinic end generated code: output=ccd48b38217fcac6 input=154fd450448d8935]*/ +/*[clinic end generated code: output=2dd67e54b0fb59a2 input=154fd450448d8935]*/ diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py index c1e53d1c89c3924..d53b07e1e53d92f 100755 --- a/Tools/clinic/clinic.py +++ b/Tools/clinic/clinic.py @@ -223,24 +223,38 @@ def c_repr(s: str) -> str: def wrapped_c_string_literal( line: str, - *, width: int = 72, + indent: int = 0, suffix: str = '', - initial_indent: int = 0, subsequent_indent: int = 4 ) -> str: - wrapped = textwrap.wrap(line, replace_whitespace=False, - drop_whitespace=False, width=width) add, out = text_accumulator() + words = line.split(' ') first = True - for line in wrapped: + while True: if first: - add(' ' * initial_indent) + add(' ' * indent) first = False else: add(' ' * subsequent_indent) - add(f'"{line}"{suffix}\n') - return out() + add('"') + sz = indent + 1 + while True: + try: + word = words[0] + except IndexError: + add('"') + return out() + sz += len(word) + 1 + if sz > width: + break + add(word) + del words[0] + if words: + add(' ') + add('"') + add(suffix) + add('\n') is_legal_c_identifier = re.compile('^[A-Za-z_][A-Za-z0-9_]*$').match