You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support getters and setters in Argument Clinic #112205
In the C API, getters and setters are implemented using PyGetSetDef. Argument Clinic doesn't currently support writing getters and setters, probably because they are pretty straightforward to write manually -- there's not much argument parsing to be done.
Argument Clinic now supports the @critical_section directive, which avoids a bunch of boilerplate code when making things thread-safe with the --disable-gil builds. It would be helpful if Argument Clinic supported getters/setters so that we could avoid the critical section boilerplate in getters and setters as well.
@colesbury@erlend-aasland@AlexWaygood
(Just for example)
What about following DSL for name setter / getter case?
It looks similar to Java lombok annotation :(
I am working on supporting @setterwith the co-existence case of @getter.
Separating clinic input is more straightforward and cleaner than declaring with a single input.
Separating clinic input is more straightforward and cleaner than declaring with a single input.
I think it looks nicer as well — having the three stacked decorators kinda looked ugly to me. Moreover, the slightly more verbose syntax of having the two inputs separated is closer to how you'd implement a Python property with a setter. In short: good choice, IMO :-)
Activity
colesbury commentedon Nov 17, 2023
cc @aisk (who brought up this issue in #112116 (comment)) and @erlend-aasland for feedback
corona10 commentedon Nov 22, 2023
Another example that needs this feature: #112298
corona10 commentedon Nov 22, 2023
@colesbury @erlend-aasland @AlexWaygood
(Just for example)
What about following DSL for
namesetter / getter case?It looks similar to Java lombok annotation :(
pythongh-112205: Support @Getter annotation from AC
gh-112205: Support @Getter annotation from AC (gh-112396)
pythongh-112205: Update stringio module to use AC for the thread-safe
gh-112205: Update stringio module to use AC for the thread-safe (gh-1…
corona10 commentedon Dec 2, 2023
I am working on supporting
@setterwith the co-existence case of@getter.Separating clinic input is more straightforward and cleaner than declaring with a single input.
AlexWaygood commentedon Dec 2, 2023
I think it looks nicer as well — having the three stacked decorators kinda looked ugly to me. Moreover, the slightly more verbose syntax of having the two inputs separated is closer to how you'd implement a Python property with a setter. In short: good choice, IMO :-)
pythongh-112205: Support `@setter` annotation from AC
13 remaining items
pythongh-112205: Require @Getter and @Setter to be methods (python#11…
pythongh-112205: Support docstring for `@getter` (python#113160)
pythongh-112205: Support @Getter annotation from AC (pythongh-112396)
pythongh-112205: Update stringio module to use AC for the thread-safe (…
pythongh-112205: Support `@setter` annotation from AC (pythongh-112922)
pythongh-112205: Update textio module to use `@getter` as possible. (p…
pythongh-112205: Require @Getter and @Setter to be methods (python#11…
pythongh-112205: Support docstring for `@getter` (python#113160)
pythongh-112205: Support @Getter annotation from AC (pythongh-112396)
pythongh-112205: Update stringio module to use AC for the thread-safe (…
pythongh-112205: Support `@setter` annotation from AC (pythongh-112922)
pythongh-112205: Update textio module to use `@getter` as possible. (p…
pythongh-112205: Require @Getter and @Setter to be methods (python#11…
pythongh-112205: Support docstring for `@getter` (python#113160)