Skip to content

Commit d39a28b

Browse files
authored
Merge pull request #3742 from HyunP-dev/staticmethod
use Initiailizer for PyStaticMethod
2 parents bfa595d + 849b81e commit d39a28b

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

vm/src/builtins/staticmethod.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::{
33
builtins::builtinfunc::PyBuiltinMethod,
44
class::PyClassImpl,
55
function::{FuncArgs, IntoPyNativeFunc},
6-
types::{Callable, Constructor, GetDescriptor},
6+
types::{Callable, Constructor, GetDescriptor, Initializer},
77
Context, Py, PyObjectRef, PyPayload, PyRef, PyResult, VirtualMachine,
88
};
99

@@ -73,7 +73,18 @@ impl PyStaticMethod {
7373
}
7474
}
7575

76-
#[pyclass(with(Callable, GetDescriptor, Constructor), flags(BASETYPE, HAS_DICT))]
76+
impl Initializer for PyStaticMethod {
77+
type Args = PyObjectRef;
78+
79+
fn init(_zelf: PyRef<Self>, _func: Self::Args, _vm: &VirtualMachine) -> PyResult<()> {
80+
Ok(())
81+
}
82+
}
83+
84+
#[pyclass(
85+
with(Callable, GetDescriptor, Constructor, Initializer),
86+
flags(BASETYPE, HAS_DICT)
87+
)]
7788
impl PyStaticMethod {
7889
#[pyproperty(magic)]
7990
fn func(&self) -> PyObjectRef {

0 commit comments

Comments
 (0)