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

Function warn_if_bool_fd

crates/vm/src/stdlib/os.rs:108–122  ·  view source on GitHub ↗
(obj: &PyObjectRef, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

106}
107
108pub(crate) fn warn_if_bool_fd(obj: &PyObjectRef, vm: &VirtualMachine) -> PyResult<()> {
109 use crate::class::StaticType;
110 if obj
111 .class()
112 .is(crate::builtins::bool_::PyBool::static_type())
113 {
114 crate::stdlib::_warnings::warn(
115 vm.ctx.exceptions.runtime_warning,
116 "bool is used as a file descriptor".to_owned(),
117 1,
118 vm,
119 )?;
120 }
121 Ok(())
122}
123
124impl TryFromObject for crt_fd::Owned {
125 fn try_from_object(vm: &VirtualMachine, obj: PyObjectRef) -> PyResult<Self> {

Callers 4

try_from_objectMethod · 0.85
fchdirFunction · 0.85
from_argsMethod · 0.85
try_from_objectMethod · 0.85

Calls 4

isMethod · 0.80
warnFunction · 0.70
classMethod · 0.45
to_ownedMethod · 0.45

Tested by

no test coverage detected