Skip to content
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-112205: Support @setter annotation from AC #112922

Merged
merged 18 commits into from
Dec 13, 2023

Conversation

corona10
Copy link
Member

@corona10 corona10 commented Dec 10, 2023

@corona10 corona10 changed the title gh-112205: Support @setter annotation from AC [WIP] gh-112205: Support @setter annotation from AC Dec 10, 2023
@corona10 corona10 marked this pull request as draft December 10, 2023 07:13
@corona10 corona10 marked this pull request as ready for review December 10, 2023 07:29
@corona10
Copy link
Member Author

corona10 commented Dec 10, 2023

@colesbury @erlend-aasland @AlexWaygood
The current implementation is not super pretty, so please leave feedback for this implementation.
I tried not to touch the overall architecture of AC as possible.

  • Unify getter/setter method macro definition with undef keyword.
  • Update AC to support @setter annotation.

@corona10 corona10 changed the title [WIP] gh-112205: Support @setter annotation from AC gh-112205: Support @setter annotation from AC Dec 10, 2023
@corona10
Copy link
Member Author

For the dev guide, I will send a PR once the PR is landed.

@corona10
Copy link
Member Author

And also, we need to consider supporting PyDoc for getter/setter with the separated PR.

static PyGetSetDef textiobase_getset[] = {
{"encoding", (getter)textiobase_encoding_get, NULL, textiobase_encoding_doc},
{"newlines", (getter)textiobase_newlines_get, NULL, textiobase_newlines_doc},
{"errors", (getter)textiobase_errors_get, NULL, textiobase_errors_doc},
{NULL}
};

Copy link
Contributor

@erlend-aasland erlend-aasland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this looks good to me; thanks!

I would prefer to use a naming aligned with the names already used in the C API (tp_getset, PyGetSetDef); that is, consistently use getset and GETSET instead of getsetter and GETSETTER.

Tools/clinic/clinic.py Outdated Show resolved Hide resolved
Tools/clinic/clinic.py Outdated Show resolved Hide resolved
Tools/clinic/clinic.py Outdated Show resolved Hide resolved
Tools/clinic/clinic.py Outdated Show resolved Hide resolved
Tools/clinic/clinic.py Outdated Show resolved Hide resolved
Tools/clinic/clinic.py Show resolved Hide resolved
Tools/clinic/clinic.py Outdated Show resolved Hide resolved
Tools/clinic/clinic.py Show resolved Hide resolved
Tools/clinic/clinic.py Outdated Show resolved Hide resolved
Copy link
Contributor

@erlend-aasland erlend-aasland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, I probably introduced a typo with my recent suggestions; sorry 'bout that!

Tools/clinic/clinic.py Outdated Show resolved Hide resolved
Tools/clinic/clinic.py Outdated Show resolved Hide resolved
@corona10
Copy link
Member Author

@erlend-aasland Thank you nice catch! PTAL one more time

Copy link
Contributor

@erlend-aasland erlend-aasland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Let's wait for Alex to chime in.

(cc. @colesbury, if you'd like to take a look.)

@AlexWaygood
Copy link
Member

(I'm travelling right now, but will do my best to review this tomorrow or Wednesday!)

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! A few small suggestions, mostly to do with error messages:

Tools/clinic/clinic.py Outdated Show resolved Hide resolved
Tools/clinic/clinic.py Outdated Show resolved Hide resolved
Tools/clinic/clinic.py Outdated Show resolved Hide resolved
Tools/clinic/clinic.py Outdated Show resolved Hide resolved
Tools/clinic/clinic.py Outdated Show resolved Hide resolved
@corona10 corona10 requested a review from AlexWaygood December 13, 2023 13:19
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
@corona10 corona10 requested a review from AlexWaygood December 13, 2023 13:23
Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@corona10 corona10 enabled auto-merge (squash) December 13, 2023 13:33
@corona10 corona10 merged commit 498a096 into python:main Dec 13, 2023
36 checks passed
@corona10 corona10 deleted the gh-112205-getset branch December 13, 2023 14:00
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
---------

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
---------

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants