forked from Rust-related/RustPython
hide member of classmethod
This commit is contained in:
@@ -29,10 +29,16 @@ use crate::vm::VirtualMachine;
|
||||
#[pyclass]
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct PyClassMethod {
|
||||
pub callable: PyObjectRef,
|
||||
callable: PyObjectRef,
|
||||
}
|
||||
pub type PyClassMethodRef = PyRef<PyClassMethod>;
|
||||
|
||||
impl PyClassMethod {
|
||||
pub fn new(value: PyObjectRef) -> Self {
|
||||
Self { callable: value }
|
||||
}
|
||||
}
|
||||
|
||||
impl PyValue for PyClassMethod {
|
||||
const HAVE_DICT: bool = true;
|
||||
|
||||
@@ -73,7 +79,7 @@ impl PyClassMethod {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn init(context: &PyContext) {
|
||||
pub(crate) fn init(context: &PyContext) {
|
||||
PyClassMethod::extend_class(context, &context.types.classmethod_type);
|
||||
extend_class!(context, context.types.classmethod_type, {
|
||||
"__get__" => context.new_method(PyClassMethod::get),
|
||||
|
||||
@@ -492,9 +492,7 @@ impl PyContext {
|
||||
F: IntoPyNativeFunc<T, R, VM>,
|
||||
{
|
||||
PyObject::new(
|
||||
PyClassMethod {
|
||||
callable: self.new_method(f),
|
||||
},
|
||||
PyClassMethod::new(self.new_method(f)),
|
||||
self.classmethod_type(),
|
||||
None,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user