MCPcopy Index your code
hub / github.com/RustPython/RustPython / check

Method check

crates/vm/src/builtins/type.rs:557–559  ·  view source on GitHub ↗

Equivalent to CPython's PyType_Check macro Checks if obj is an instance of type (or its subclass)

(obj: &PyObject)

Source from the content-addressed store, hash-verified

555 /// Equivalent to CPython's PyType_Check macro
556 /// Checks if obj is an instance of type (or its subclass)
557 pub(crate) fn check(obj: &PyObject) -> Option<&Py<Self>> {
558 obj.downcast_ref::<Self>()
559 }
560
561 fn resolve_mro(bases: &[PyRef<Self>]) -> Result<Vec<PyTypeRef>, String> {
562 // Check for duplicates in bases.

Callers 1

py_newMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected