Conversation
|
Lines 8 to 35 in da1ab1b The tests passed after pushing the same code again. |
|
Thank you, but... is this feature actually used? impl Hoge {
#[init]
fn __init__(...) -> {}
}, but I can't find any document about this. @konstin |
|
It does get called, although I'm not sure about the use of it: #[pyclass]
pub struct Foo {
bar: usize,
}
#[pymethods]
impl Foo {
#[init]
fn init(&mut self) -> () {
println!("{}", self.bar);
self.bar = 10;
println!("{}", self.bar);
}
#[new]
fn new(obj: &PyRawObject) -> PyResult<()> {
obj.init(Self { bar: 0 });
Ok(())
}
} |
Unfortunately not |
I would guess |
|
Relevant: dgrunwald/rust-cpython#11 (comment) |
|
Thank you for comments. |
|
I'm sorry for closing this PR via #658. |
The if statement evaluated to true if the return type was not
"()"or"PyResult<()>"which was always the case since"()" != "PyResult<()>".