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

Method repr_str

crates/vm/src/builtins/getset.rs:145–157  ·  view source on GitHub ↗
(zelf: &Py<Self>, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

143impl Representable for PyGetSet {
144 #[inline]
145 fn repr_str(zelf: &Py<Self>, vm: &VirtualMachine) -> PyResult<String> {
146 let class = unsafe { zelf.class.borrow_static() };
147 // Special case for object type
148 if core::ptr::eq(class, vm.ctx.types.object_type) {
149 Ok(format!("<attribute '{}'>", zelf.name))
150 } else {
151 Ok(format!(
152 "<attribute '{}' of '{}' objects>",
153 zelf.name,
154 class.name()
155 ))
156 }
157 }
158}
159
160pub(crate) fn init(context: &'static Context) {

Callers

nothing calls this directly

Calls 2

borrow_staticMethod · 0.80
eqFunction · 0.50

Tested by

no test coverage detected