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

Function object_getstate

crates/vm/src/builtins/object.rs:660–669  ·  view source on GitHub ↗

object_getstate - calls __getstate__ method or default implementation

(obj: &PyObject, required: bool, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

658
659/// object_getstate - calls __getstate__ method or default implementation
660fn object_getstate(obj: &PyObject, required: bool, vm: &VirtualMachine) -> PyResult {
661 // If __getstate__ is not overridden, use the default implementation with required flag
662 if !is_getstate_overridden(obj, vm) {
663 return object_getstate_default(obj, required, vm);
664 }
665
666 // __getstate__ is overridden, call it without required
667 let getstate = obj.get_attr(identifier!(vm, __getstate__), vm)?;
668 getstate.call((), vm)
669}
670
671/// Get list items iterator if obj is a list (or subclass), None iterator otherwise
672fn get_items_iter(obj: &PyObjectRef, vm: &VirtualMachine) -> PyResult<(PyObjectRef, PyObjectRef)> {

Callers 1

reduce_newobjFunction · 0.85

Calls 4

is_getstate_overriddenFunction · 0.85
object_getstate_defaultFunction · 0.85
get_attrMethod · 0.45
callMethod · 0.45

Tested by

no test coverage detected