Skip to content

Clinic causes compiler warnings when a setter is defined before a getter with a docstring #128083

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

Closed
ZeroIntensity opened this issue Dec 18, 2024 · 1 comment
Assignees
Labels
3.13 bugs and security fixes 3.14 bugs and security fixes topic-argument-clinic type-bug An unexpected behavior, bug, or error

Comments

@ZeroIntensity
Copy link
Member

ZeroIntensity commented Dec 18, 2024

Bug report

Bug description:

Found while working on #127946

This is sort of an extension to #127341, but not the exact same issue. If you define a setter before a getter, and then that getter has a docstring, a macro redefinition warning will occur, because the setter code sets the docstring to NULL.

Quick repro:

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

/*[clinic input]
@getter
Test.test

my silly docstring
[clinic start generated code]*/

The simplest fix is to just #undef the DOCSTR macro in the getter if it's been defined already. I have a PR at #127950.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

@ZeroIntensity ZeroIntensity added type-bug An unexpected behavior, bug, or error topic-argument-clinic 3.13 bugs and security fixes 3.14 bugs and security fixes labels Dec 18, 2024
@ZeroIntensity ZeroIntensity self-assigned this Dec 18, 2024
@erlend-aasland
Copy link
Contributor

Thanks for the report and the fix, Peter!

ZeroIntensity added a commit to ZeroIntensity/cpython that referenced this issue Dec 19, 2024
…thonGH-127950)

(cherry picked from commit b5d1e45)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
erlend-aasland pushed a commit that referenced this issue Dec 19, 2024
… (#128102)

(cherry picked from commit b5d1e45)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.13 bugs and security fixes 3.14 bugs and security fixes topic-argument-clinic type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants