Skip to content

Commit 3a8bdaf

Browse files
[3.13] gh-128083: Fix macro redefinition warning in clinic. (GH-127950) (#128102)
(cherry picked from commit b5d1e45) Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
1 parent a0f1f12 commit 3a8bdaf

File tree

4 files changed

+131
-2
lines changed

4 files changed

+131
-2
lines changed

Lib/test/clinic.test.c

+69
Original file line numberDiff line numberDiff line change
@@ -5011,6 +5011,75 @@ static int
50115011
Test_property_set_impl(TestObj *self, PyObject *value)
50125012
/*[clinic end generated code: output=e4342fe9bb1d7817 input=3bc3f46a23c83a88]*/
50135013

5014+
/*[clinic input]
5015+
@setter
5016+
Test.setter_first_with_docstr
5017+
[clinic start generated code]*/
5018+
5019+
#if !defined(Test_setter_first_with_docstr_DOCSTR)
5020+
# define Test_setter_first_with_docstr_DOCSTR NULL
5021+
#endif
5022+
#if defined(TEST_SETTER_FIRST_WITH_DOCSTR_GETSETDEF)
5023+
# undef TEST_SETTER_FIRST_WITH_DOCSTR_GETSETDEF
5024+
# define TEST_SETTER_FIRST_WITH_DOCSTR_GETSETDEF {"setter_first_with_docstr", (getter)Test_setter_first_with_docstr_get, (setter)Test_setter_first_with_docstr_set, Test_setter_first_with_docstr_DOCSTR},
5025+
#else
5026+
# define TEST_SETTER_FIRST_WITH_DOCSTR_GETSETDEF {"setter_first_with_docstr", NULL, (setter)Test_setter_first_with_docstr_set, NULL},
5027+
#endif
5028+
5029+
static int
5030+
Test_setter_first_with_docstr_set_impl(TestObj *self, PyObject *value);
5031+
5032+
static int
5033+
Test_setter_first_with_docstr_set(TestObj *self, PyObject *value, void *Py_UNUSED(context))
5034+
{
5035+
int return_value;
5036+
5037+
return_value = Test_setter_first_with_docstr_set_impl(self, value);
5038+
5039+
return return_value;
5040+
}
5041+
5042+
static int
5043+
Test_setter_first_with_docstr_set_impl(TestObj *self, PyObject *value)
5044+
/*[clinic end generated code: output=e4d76b558a4061db input=31a045ce11bbe961]*/
5045+
5046+
/*[clinic input]
5047+
@getter
5048+
Test.setter_first_with_docstr
5049+
5050+
my silly docstring
5051+
[clinic start generated code]*/
5052+
5053+
PyDoc_STRVAR(Test_setter_first_with_docstr__doc__,
5054+
"my silly docstring");
5055+
#if defined(Test_setter_first_with_docstr_DOCSTR)
5056+
# undef Test_setter_first_with_docstr_DOCSTR
5057+
#endif
5058+
#define Test_setter_first_with_docstr_DOCSTR Test_setter_first_with_docstr__doc__
5059+
5060+
#if !defined(Test_setter_first_with_docstr_DOCSTR)
5061+
# define Test_setter_first_with_docstr_DOCSTR NULL
5062+
#endif
5063+
#if defined(TEST_SETTER_FIRST_WITH_DOCSTR_GETSETDEF)
5064+
# undef TEST_SETTER_FIRST_WITH_DOCSTR_GETSETDEF
5065+
# define TEST_SETTER_FIRST_WITH_DOCSTR_GETSETDEF {"setter_first_with_docstr", (getter)Test_setter_first_with_docstr_get, (setter)Test_setter_first_with_docstr_set, Test_setter_first_with_docstr_DOCSTR},
5066+
#else
5067+
# define TEST_SETTER_FIRST_WITH_DOCSTR_GETSETDEF {"setter_first_with_docstr", (getter)Test_setter_first_with_docstr_get, NULL, Test_setter_first_with_docstr_DOCSTR},
5068+
#endif
5069+
5070+
static PyObject *
5071+
Test_setter_first_with_docstr_get_impl(TestObj *self);
5072+
5073+
static PyObject *
5074+
Test_setter_first_with_docstr_get(TestObj *self, void *Py_UNUSED(context))
5075+
{
5076+
return Test_setter_first_with_docstr_get_impl(self);
5077+
}
5078+
5079+
static PyObject *
5080+
Test_setter_first_with_docstr_get_impl(TestObj *self)
5081+
/*[clinic end generated code: output=749a30266f9fb443 input=10af4e43b3cb34dc]*/
5082+
50145083
/*[clinic input]
50155084
output push
50165085
output preset buffer

Modules/_io/clinic/textio.c.h

+10-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/clinic/_ssl.c.h

+49-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tools/clinic/libclinic/parse_args.py

+3
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ def declare_parser(
146146
GETSET_DOCSTRING_PROTOTYPE_STRVAR: Final[str] = libclinic.normalize_snippet("""
147147
PyDoc_STRVAR({getset_basename}__doc__,
148148
{docstring});
149+
#if defined({getset_basename}_DOCSTR)
150+
# undef {getset_basename}_DOCSTR
151+
#endif
149152
#define {getset_basename}_DOCSTR {getset_basename}__doc__
150153
""")
151154
IMPL_DEFINITION_PROTOTYPE: Final[str] = libclinic.normalize_snippet("""

0 commit comments

Comments
 (0)