-
Notifications
You must be signed in to change notification settings - Fork 784
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
Allow #[getter] and #[setter] functions to take PyRef #999
Conversation
Thank you! The approach looks good, but it seems like there are some rooms for refactoring. I'll give a detailed review later.
Is it possible? |
👍 no rush. I'm sure there are things we can improve in here further. Also I don't mind if you want to wait for this until after
That's why I say might 😄 . The pyproto code uses the same function parser so this PR would at least enable us to parse such function definitions. I need to experiment another time to understand if the rest of the implementation is possible! |
d666bcb
to
6372229
Compare
I spotted a refactoring around Also I was able to use |
180fba8
to
4427dd8
Compare
Thanks for the review - I merged all of the suggestions! |
4427dd8
to
2f27440
Compare
Co-authored-by: Yuji Kanagawa <yuji.kngw.80s.revive@gmail.com>
2f27440
to
c3e993e
Compare
@@ -5,6 +5,8 @@ fn test_compile_errors() { | |||
t.compile_fail("tests/ui/invalid_macro_args.rs"); | |||
t.compile_fail("tests/ui/invalid_property_args.rs"); | |||
t.compile_fail("tests/ui/invalid_pyclass_args.rs"); | |||
t.compile_fail("tests/ui/invalid_pymethod_names.rs"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test already existed but seemed to accidentally be lost from the compile error test list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooops, I accidently removed it when tackling the CI problem. Thanks!
Thanks! |
Closes #837
I rewrote the proc_macro code to allow
#[getter]
and#[setter]
functions to take&self
as well asPyRef<Self>
etc.It might also be possible to make a similar change so that all
#[pyproto]
methods can also choose beteween&self
,&mut self
,PyRef<Self>
, etc. but this change was necessary first so I began with this PR.