Skip to content

Commit 3e24974

Browse files
Escapes are only needed for preprocessor code
1 parent 9dbb61a commit 3e24974

File tree

2 files changed

+33
-32
lines changed

2 files changed

+33
-32
lines changed

Lib/test/clinic.test.c

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5537,8 +5537,8 @@ test_deprecate_positional_pos1_len1_optional(PyObject *module, PyObject *const *
55375537
#endif
55385538
if (nargs == 2) {
55395539
if (PyErr_WarnEx(PyExc_DeprecationWarning,
5540-
"Passing 2 positional arguments to " \
5541-
"test_deprecate_positional_pos1_len1_optional() is deprecated. " \
5540+
"Passing 2 positional arguments to "
5541+
"test_deprecate_positional_pos1_len1_optional() is deprecated. "
55425542
"Parameter 'b' will become a keyword-only parameter in Python 3.14.", 1))
55435543
{
55445544
goto exit;
@@ -5562,7 +5562,7 @@ test_deprecate_positional_pos1_len1_optional(PyObject *module, PyObject *const *
55625562
static PyObject *
55635563
test_deprecate_positional_pos1_len1_optional_impl(PyObject *module,
55645564
PyObject *a, PyObject *b)
5565-
/*[clinic end generated code: output=8ff8fda7f3f10aa6 input=89099f3dacd757da]*/
5565+
/*[clinic end generated code: output=862743ccf359e467 input=89099f3dacd757da]*/
55665566

55675567

55685568
/*[clinic input]
@@ -5634,8 +5634,8 @@ test_deprecate_positional_pos1_len1(PyObject *module, PyObject *const *args, Py_
56345634
#endif
56355635
if (nargs == 2) {
56365636
if (PyErr_WarnEx(PyExc_DeprecationWarning,
5637-
"Passing 2 positional arguments to " \
5638-
"test_deprecate_positional_pos1_len1() is deprecated. Parameter 'b' " \
5637+
"Passing 2 positional arguments to "
5638+
"test_deprecate_positional_pos1_len1() is deprecated. Parameter 'b' "
56395639
"will become a keyword-only parameter in Python 3.14.", 1))
56405640
{
56415641
goto exit;
@@ -5655,7 +5655,7 @@ test_deprecate_positional_pos1_len1(PyObject *module, PyObject *const *args, Py_
56555655
static PyObject *
56565656
test_deprecate_positional_pos1_len1_impl(PyObject *module, PyObject *a,
56575657
PyObject *b)
5658-
/*[clinic end generated code: output=170fe98f2d6e2711 input=1702bbab1e9b3b99]*/
5658+
/*[clinic end generated code: output=a2963e60fc291de7 input=1702bbab1e9b3b99]*/
56595659

56605660

56615661
/*[clinic input]
@@ -5733,9 +5733,9 @@ test_deprecate_positional_pos1_len2_with_kwd(PyObject *module, PyObject *const *
57335733
#endif
57345734
if (nargs > 1 && nargs <= 3) {
57355735
if (PyErr_WarnEx(PyExc_DeprecationWarning,
5736-
"Passing more than 1 positional argument to " \
5737-
"test_deprecate_positional_pos1_len2_with_kwd() is deprecated. " \
5738-
"Parameters 'b' and 'c' will become keyword-only parameters in Python " \
5736+
"Passing more than 1 positional argument to "
5737+
"test_deprecate_positional_pos1_len2_with_kwd() is deprecated. "
5738+
"Parameters 'b' and 'c' will become keyword-only parameters in Python "
57395739
"3.14.", 1))
57405740
{
57415741
goto exit;
@@ -5758,7 +5758,7 @@ static PyObject *
57585758
test_deprecate_positional_pos1_len2_with_kwd_impl(PyObject *module,
57595759
PyObject *a, PyObject *b,
57605760
PyObject *c, PyObject *d)
5761-
/*[clinic end generated code: output=b4c0595ec15619a3 input=28cdb885f6c34eab]*/
5761+
/*[clinic end generated code: output=277f633ed6d46e75 input=28cdb885f6c34eab]*/
57625762

57635763

57645764
/*[clinic input]
@@ -5827,8 +5827,8 @@ test_deprecate_positional_pos0_len1(PyObject *module, PyObject *const *args, Py_
58275827
#endif
58285828
if (nargs == 1) {
58295829
if (PyErr_WarnEx(PyExc_DeprecationWarning,
5830-
"Passing positional arguments to test_deprecate_positional_pos0_len1() " \
5831-
"is deprecated. Parameter 'a' will become a keyword-only parameter in " \
5830+
"Passing positional arguments to test_deprecate_positional_pos0_len1() "
5831+
"is deprecated. Parameter 'a' will become a keyword-only parameter in "
58325832
"Python 3.14.", 1))
58335833
{
58345834
goto exit;
@@ -5846,7 +5846,7 @@ test_deprecate_positional_pos0_len1(PyObject *module, PyObject *const *args, Py_
58465846

58475847
static PyObject *
58485848
test_deprecate_positional_pos0_len1_impl(PyObject *module, PyObject *a)
5849-
/*[clinic end generated code: output=e8df4559523e16f4 input=678206db25c0652c]*/
5849+
/*[clinic end generated code: output=05d36044c05396e0 input=678206db25c0652c]*/
58505850

58515851

58525852
/*[clinic input]
@@ -5918,8 +5918,8 @@ test_deprecate_positional_pos0_len2(PyObject *module, PyObject *const *args, Py_
59185918
#endif
59195919
if (nargs > 0 && nargs <= 2) {
59205920
if (PyErr_WarnEx(PyExc_DeprecationWarning,
5921-
"Passing positional arguments to test_deprecate_positional_pos0_len2() " \
5922-
"is deprecated. Parameters 'a' and 'b' will become keyword-only " \
5921+
"Passing positional arguments to test_deprecate_positional_pos0_len2() "
5922+
"is deprecated. Parameters 'a' and 'b' will become keyword-only "
59235923
"parameters in Python 3.14.", 1))
59245924
{
59255925
goto exit;
@@ -5939,7 +5939,7 @@ test_deprecate_positional_pos0_len2(PyObject *module, PyObject *const *args, Py_
59395939
static PyObject *
59405940
test_deprecate_positional_pos0_len2_impl(PyObject *module, PyObject *a,
59415941
PyObject *b)
5942-
/*[clinic end generated code: output=b2c6183a4ba100e3 input=fae0d0b1d480c939]*/
5942+
/*[clinic end generated code: output=a33ee0b9ec8e1d96 input=fae0d0b1d480c939]*/
59435943

59445944

59455945
/*[clinic input]
@@ -6023,9 +6023,9 @@ test_deprecate_positional_pos0_len3_with_kwdonly(PyObject *module, PyObject *con
60236023
#endif
60246024
if (nargs > 0 && nargs <= 3) {
60256025
if (PyErr_WarnEx(PyExc_DeprecationWarning,
6026-
"Passing positional arguments to " \
6027-
"test_deprecate_positional_pos0_len3_with_kwdonly() is deprecated. " \
6028-
"Parameters 'a', 'b' and 'c' will become keyword-only parameters in " \
6026+
"Passing positional arguments to "
6027+
"test_deprecate_positional_pos0_len3_with_kwdonly() is deprecated. "
6028+
"Parameters 'a', 'b' and 'c' will become keyword-only parameters in "
60296029
"Python 3.14.", 1))
60306030
{
60316031
goto exit;
@@ -6050,7 +6050,7 @@ test_deprecate_positional_pos0_len3_with_kwdonly_impl(PyObject *module,
60506050
PyObject *b,
60516051
PyObject *c,
60526052
PyObject *e)
6053-
/*[clinic end generated code: output=2504348d9c03f46c input=1b0121770c0c52e0]*/
6053+
/*[clinic end generated code: output=24d865ef46897afd input=1b0121770c0c52e0]*/
60546054

60556055

60566056
/*[clinic input]
@@ -6124,8 +6124,8 @@ test_deprecate_positional_pos2_len1(PyObject *module, PyObject *const *args, Py_
61246124
#endif
61256125
if (nargs == 3) {
61266126
if (PyErr_WarnEx(PyExc_DeprecationWarning,
6127-
"Passing 3 positional arguments to " \
6128-
"test_deprecate_positional_pos2_len1() is deprecated. Parameter 'c' " \
6127+
"Passing 3 positional arguments to "
6128+
"test_deprecate_positional_pos2_len1() is deprecated. Parameter 'c' "
61296129
"will become a keyword-only parameter in Python 3.14.", 1))
61306130
{
61316131
goto exit;
@@ -6146,7 +6146,7 @@ test_deprecate_positional_pos2_len1(PyObject *module, PyObject *const *args, Py_
61466146
static PyObject *
61476147
test_deprecate_positional_pos2_len1_impl(PyObject *module, PyObject *a,
61486148
PyObject *b, PyObject *c)
6149-
/*[clinic end generated code: output=8b90a7f6031698a5 input=e1d129689e69ec7c]*/
6149+
/*[clinic end generated code: output=58e71c08abc28074 input=e1d129689e69ec7c]*/
61506150

61516151

61526152
/*[clinic input]
@@ -6223,8 +6223,8 @@ test_deprecate_positional_pos2_len2(PyObject *module, PyObject *const *args, Py_
62236223
#endif
62246224
if (nargs > 2 && nargs <= 4) {
62256225
if (PyErr_WarnEx(PyExc_DeprecationWarning,
6226-
"Passing more than 2 positional arguments to " \
6227-
"test_deprecate_positional_pos2_len2() is deprecated. Parameters 'c' " \
6226+
"Passing more than 2 positional arguments to "
6227+
"test_deprecate_positional_pos2_len2() is deprecated. Parameters 'c' "
62286228
"and 'd' will become keyword-only parameters in Python 3.14.", 1))
62296229
{
62306230
goto exit;
@@ -6247,7 +6247,7 @@ static PyObject *
62476247
test_deprecate_positional_pos2_len2_impl(PyObject *module, PyObject *a,
62486248
PyObject *b, PyObject *c,
62496249
PyObject *d)
6250-
/*[clinic end generated code: output=2e7da298a880b499 input=0d53533463a12792]*/
6250+
/*[clinic end generated code: output=0717b6f995cb8eb9 input=0d53533463a12792]*/
62516251

62526252

62536253
/*[clinic input]
@@ -6334,9 +6334,9 @@ test_deprecate_positional_pos2_len3_with_kwdonly(PyObject *module, PyObject *con
63346334
#endif
63356335
if (nargs > 2 && nargs <= 4) {
63366336
if (PyErr_WarnEx(PyExc_DeprecationWarning,
6337-
"Passing more than 2 positional arguments to " \
6338-
"test_deprecate_positional_pos2_len3_with_kwdonly() is deprecated. " \
6339-
"Parameters 'c' and 'd' will become keyword-only parameters in Python " \
6337+
"Passing more than 2 positional arguments to "
6338+
"test_deprecate_positional_pos2_len3_with_kwdonly() is deprecated. "
6339+
"Parameters 'c' and 'd' will become keyword-only parameters in Python "
63406340
"3.14.", 1))
63416341
{
63426342
goto exit;
@@ -6363,4 +6363,4 @@ test_deprecate_positional_pos2_len3_with_kwdonly_impl(PyObject *module,
63636363
PyObject *c,
63646364
PyObject *d,
63656365
PyObject *e)
6366-
/*[clinic end generated code: output=c6962f8980227a21 input=154fd450448d8935]*/
6366+
/*[clinic end generated code: output=2dd67e54b0fb59a2 input=154fd450448d8935]*/

Tools/clinic/clinic.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ def wrapped_c_string_literal(
225225
line: str,
226226
width: int = 72,
227227
indent: int = 0,
228+
suffix: str = '',
228229
subsequent_indent: int = 4
229230
) -> str:
230231
add, out = text_accumulator()
@@ -252,7 +253,7 @@ def wrapped_c_string_literal(
252253
if words:
253254
add(' ')
254255
add('"')
255-
add(' \\')
256+
add(suffix)
256257
add('\n')
257258

258259

@@ -966,7 +967,7 @@ def deprecate_positional_use(
966967
condition=condition,
967968
major=major,
968969
minor=minor,
969-
cpp_message=wrapped_c_string_literal(cpp_message,
970+
cpp_message=wrapped_c_string_literal(cpp_message, suffix=" \\",
970971
subsequent_indent=16),
971972
depr_message=wrapped_c_string_literal(depr_message,
972973
subsequent_indent=29),

0 commit comments

Comments
 (0)