-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
gh-127341: Argument Clinic: fix compiler warnings for getters with docstrings #127310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-127341: Argument Clinic: fix compiler warnings for getters with docstrings #127310
Conversation
It seems you forgot |
Yeah, that would be it. Fixed! |
I don't like the original approach that was taken when the diff --git a/Tools/clinic/libclinic/parse_args.py b/Tools/clinic/libclinic/parse_args.py
index fc2d9fe9870..a57d729bec5 100644
--- a/Tools/clinic/libclinic/parse_args.py
+++ b/Tools/clinic/libclinic/parse_args.py
@@ -146,7 +146,7 @@ def declare_parser(
GETSET_DOCSTRING_PROTOTYPE_STRVAR: Final[str] = libclinic.normalize_snippet("""
PyDoc_STRVAR({getset_basename}__doc__,
{docstring});
- #define {getset_basename}_HAS_DOCSTR
+ #define {getset_basename}_DOCSTR {getset_basename}__doc__
""")
IMPL_DEFINITION_PROTOTYPE: Final[str] = libclinic.normalize_snippet("""
static {impl_return_type}
@@ -157,9 +157,7 @@ def declare_parser(
{{"{name}", {methoddef_cast}{c_basename}{methoddef_cast_end}, {methoddef_flags}, {c_basename}__doc__}},
""")
GETTERDEF_PROTOTYPE_DEFINE: Final[str] = libclinic.normalize_snippet(r"""
- #if defined({getset_basename}_HAS_DOCSTR)
- # define {getset_basename}_DOCSTR {getset_basename}__doc__
- #else
+ #if !defined({getset_basename}_DOCSTR)
# define {getset_basename}_DOCSTR NULL
#endif
#if defined({getset_name}_GETSETDEF)
@@ -170,9 +168,7 @@ def declare_parser(
#endif
""")
SETTERDEF_PROTOTYPE_DEFINE: Final[str] = libclinic.normalize_snippet(r"""
- #if defined({getset_name}_HAS_DOCSTR)
- # define {getset_basename}_DOCSTR {getset_basename}__doc__
- #else
+ #if !defined({getset_basename}_DOCSTR)
# define {getset_basename}_DOCSTR NULL
#endif
#if defined({getset_name}_GETSETDEF) |
BTW, I think we should record why this was a bug in an issue, and then link this PR to that issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for identifying and fixing this!
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, @ZeroIntensity and @erlend-aasland, I could not cleanly backport this to
|
I'll deal with backporting. |
…tters with docstrings (pythonGH-127310) (cherry picked from commit 9949091) Co-authored-by: Peter Bierma <zintensitydev@gmail.com> Co-authored-by: Erlend E. Aasland <erlend@python.org>
GH-127431 is a backport of this pull request to the 3.13 branch. |
…ith docstrings (python#127310) Co-authored-by: Erlend E. Aasland <erlend@python.org>
…ith docstrings (python#127310) Co-authored-by: Erlend E. Aasland <erlend@python.org>
Finally got enough connection to submit a PR 😄
Co-authored-by: Erlend E. Aasland erlend.aasland@protonmail.com