Skip to content

Conversation

@corona10
Copy link
Member

@corona10corona10 commented Dec 10, 2023

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

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.

@corona10corona10 changed the title [WIP] gh-112205: Support @setter annotation from ACgh-112205: Support @setter annotation from ACDec 10, 2023
@corona10
Copy link
MemberAuthor

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

@corona10
Copy link
MemberAuthor

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

staticPyGetSetDeftextiobase_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-aaslanderlend-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.

Copy link
Contributor

@erlend-aaslanderlend-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!

@corona10
Copy link
MemberAuthor

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

Copy link
Contributor

@erlend-aaslanderlend-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

@AlexWaygoodAlexWaygood 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:

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Copy link
Member

@AlexWaygoodAlexWaygood 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!

@corona10corona10 enabled auto-merge (squash) December 13, 2023 13:33
@corona10corona10 merged commit 498a096 into python:mainDec 13, 2023
@corona10corona10 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 freeto 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

@corona10@erlend-aasland@AlexWaygood