pyo3
pyo3 copied to clipboard
Collecting multiple attribute error
~~Attempt to clos e #2892~~ (Edit by @davidhewitt - I think there's more we can do with #[pymethods] probably, though might be a fair bit more work.)
I am not sure how to add the test in CI but I have tested manually with the following:
use pyo3::prelude::*;
#[pyclass]
struct Example {
#[pyo3(foo)]
#[pyo3(blah)]
x: i32,
#[pyo3(pop)]
y: i32,
}
Originally it gave:
error: expected one of: `get`, `set`, `name`
--> pytests/src/pyclasses.rs:7:12
|
7 | #[pyo3(foo)]
| ^^^
error: cannot find attribute `pyo3` in this scope
--> pytests/src/pyclasses.rs:10:7
|
10 | #[pyo3(pop)]
| ^^^^
|
= note: `pyo3` is in scope, but it is a crate, not an attribute
error: could not compile `pyo3-pytests` (lib) due to 2 previous errors
Now it gives:
error: expected one of: `get`, `set`, `name`
--> pytests/src/pyclasses.rs:7:12
|
7 | #[pyo3(foo)]
| ^^^
error: expected one of: `get`, `set`, `name`
--> pytests/src/pyclasses.rs:8:12
|
8 | #[pyo3(blah)]
| ^^^^
error: expected one of: `get`, `set`, `name`
--> pytests/src/pyclasses.rs:10:12
|
10 | #[pyo3(pop)]
| ^^^
error: could not compile `pyo3-pytests` (lib) due to 3 previous errors
Thanks for the suggestions @davidhewitt i have added the test and have refactored as suggested.
Thank you for your patience. I was busy with EuroPython. I plan to finish this PR this weekend or next week.
(I took the liberty to fix the new merge conflicts.)
Thank you @davidhewitt