-
-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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
Support getters and setters in Argument Clinic #112205
Comments
cc @aisk (who brought up this issue in #112116 (comment)) and @erlend-aasland for feedback |
Another example that needs this feature: #112298 |
@colesbury @erlend-aasland @AlexWaygood
|
I am working on supporting |
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 :-) |
Following up discussions on #113160. See my comments for context:
Here's a quick braindump of how I'd like the PyGetSetDef feature to be handled internally in Argument Clinic:
I think the clinic input side of things work well! My complaints are strictly about clinic internals :) |
Yeah, I fully agree with your suggestion. The current hacky implementation is a kind of tech debt. |
Yes, see what I wrote in #113160 (comment) ;) |
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
I created a follow-up issue and am now closing the current issue.: #113318 Thank you for all your support @colesbury @erlend-aasland @AlexWaygood and @vstinner |
…3278) Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
--------- Co-authored-by: Erlend E. Aasland <erlend@python.org>
--------- Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
…3278) Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
--------- Co-authored-by: Erlend E. Aasland <erlend@python.org>
--------- Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
…3278) Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
--------- Co-authored-by: Erlend E. Aasland <erlend@python.org>
Feature or enhancement
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.Linked PRs
@setter
annotation from AC #112922@getter
as possible. #113095@getter
#113160The text was updated successfully, but these errors were encountered: