-
Notifications
You must be signed in to change notification settings - Fork 779
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
deprecate GIL refs in function argument #3847
Conversation
2daa644
to
ee12c0f
Compare
Will we get warnings from |
No, and also not for |
548d7d8
to
0854cab
Compare
Ok, with luck, this now passes CI! |
0854cab
to
61831cc
Compare
61831cc
to
d1dc4ce
Compare
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.
Very nice 🚀! I really like how Holders
turned out, and how it could be reused to handle the self_arg
as well. I found a few places to double check on (plus some very minor nits).
error[E0271]: type mismatch resolving `<Foo as PyClass>::Frozen == False` | ||
--> tests/ui/invalid_frozen_pyclass_borrow.rs:9:1 | ||
| | ||
9 | #[pymethods] | ||
| ^^^^^^^^^^^^ expected `False`, found `True` | ||
| | ||
note: required by a bound in `PyRefMut` | ||
--> src/pycell.rs | ||
| | ||
| pub struct PyRefMut<'p, T: PyClass<Frozen = False>> { | ||
| ^^^^^^^^^^^^^^ required by this bound in `PyRefMut` | ||
= note: this error originates in the attribute macro `pymethods` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
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.
Given the corresponding test did not change i'm not sure where this one comes from and if it is expected
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.
I think what's happened is that the spans for the code in question are now mixed, so the error has duplicated onto both spans.
It's not really expected but I think it'll also be quite hard to fix without a bit of trial-and-error on spans. I think for now I'm inclined to leave this as-is and hope when we remove these warnings in a release or two it cleans up again. It is a touch ugly though. :(
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.
I see, sounds reasonable
Co-authored-by: Icxolu <[email protected]>
2a66640
to
094787e
Compare
6f89e57
to
81b71f6
Compare
This was built on-stream today, the goal is to add a deprecation warning to
#[pyfunction]
and#[pymethods]
arguments which take a GIL ref. The span is wrong but otherwise this technique works. The code is also a bit of a bodge job as I was floundering a bit on-stream trying to figure out how to get it to work 😂This is not in a reviewable state but I felt like pushing the code anyway so it can be found easily when I get a chance to tidy it up.