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
Icxolu
left a comment
There was a problem hiding this comment.
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.
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.
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. :(
Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>
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.