Skip to content

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

Description

@ZeroIntensity

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

3.13bugs and security fixes3.14bugs and security fixestopic-argument-clinictype-bugAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions