Skip to content

Commit

Permalink
[3.13] pythongh-128083: Fix macro redefinition warning in clinic. (py…
Browse files Browse the repository at this point in the history
…thonGH-127950) (python#128102)

(cherry picked from commit b5d1e45)

Co-authored-by: Peter Bierma <[email protected]>
  • Loading branch information
ZeroIntensity authored Dec 19, 2024
1 parent a0f1f12 commit 3a8bdaf
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 2 deletions.
69 changes: 69 additions & 0 deletions Lib/test/clinic.test.c
Original file line number Diff line number Diff line change
Expand Up @@ -5011,6 +5011,75 @@ static int
Test_property_set_impl(TestObj *self, PyObject *value)
/*[clinic end generated code: output=e4342fe9bb1d7817 input=3bc3f46a23c83a88]*/

/*[clinic input]
@setter
Test.setter_first_with_docstr
[clinic start generated code]*/

#if !defined(Test_setter_first_with_docstr_DOCSTR)
# define Test_setter_first_with_docstr_DOCSTR NULL
#endif
#if defined(TEST_SETTER_FIRST_WITH_DOCSTR_GETSETDEF)
# undef TEST_SETTER_FIRST_WITH_DOCSTR_GETSETDEF
# 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},
#else
# define TEST_SETTER_FIRST_WITH_DOCSTR_GETSETDEF {"setter_first_with_docstr", NULL, (setter)Test_setter_first_with_docstr_set, NULL},
#endif

static int
Test_setter_first_with_docstr_set_impl(TestObj *self, PyObject *value);

static int
Test_setter_first_with_docstr_set(TestObj *self, PyObject *value, void *Py_UNUSED(context))
{
int return_value;

return_value = Test_setter_first_with_docstr_set_impl(self, value);

return return_value;
}

static int
Test_setter_first_with_docstr_set_impl(TestObj *self, PyObject *value)
/*[clinic end generated code: output=e4d76b558a4061db input=31a045ce11bbe961]*/

/*[clinic input]
@getter
Test.setter_first_with_docstr
my silly docstring
[clinic start generated code]*/

PyDoc_STRVAR(Test_setter_first_with_docstr__doc__,
"my silly docstring");
#if defined(Test_setter_first_with_docstr_DOCSTR)
# undef Test_setter_first_with_docstr_DOCSTR
#endif
#define Test_setter_first_with_docstr_DOCSTR Test_setter_first_with_docstr__doc__

#if !defined(Test_setter_first_with_docstr_DOCSTR)
# define Test_setter_first_with_docstr_DOCSTR NULL
#endif
#if defined(TEST_SETTER_FIRST_WITH_DOCSTR_GETSETDEF)
# undef TEST_SETTER_FIRST_WITH_DOCSTR_GETSETDEF
# 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},
#else
# 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},
#endif

static PyObject *
Test_setter_first_with_docstr_get_impl(TestObj *self);

static PyObject *
Test_setter_first_with_docstr_get(TestObj *self, void *Py_UNUSED(context))
{
return Test_setter_first_with_docstr_get_impl(self);
}

static PyObject *
Test_setter_first_with_docstr_get_impl(TestObj *self)
/*[clinic end generated code: output=749a30266f9fb443 input=10af4e43b3cb34dc]*/

/*[clinic input]
output push
output preset buffer
Expand Down
11 changes: 10 additions & 1 deletion Modules/_io/clinic/textio.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 49 additions & 1 deletion Modules/clinic/_ssl.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Tools/clinic/libclinic/parse_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ def declare_parser(
GETSET_DOCSTRING_PROTOTYPE_STRVAR: Final[str] = libclinic.normalize_snippet("""
PyDoc_STRVAR({getset_basename}__doc__,
{docstring});
#if defined({getset_basename}_DOCSTR)
# undef {getset_basename}_DOCSTR
#endif
#define {getset_basename}_DOCSTR {getset_basename}__doc__
""")
IMPL_DEFINITION_PROTOTYPE: Final[str] = libclinic.normalize_snippet("""
Expand Down

0 comments on commit 3a8bdaf

Please sign in to comment.