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

Function update_registry

crates/vm/src/warn.rs:226–247  ·  view source on GitHub ↗

Create a `(text, category)` or `(text, category, 0)` key and record it in the registry via `already_warned`.

(
    registry: &PyObject,
    text: &PyObject,
    category: &PyObject,
    add_zero: bool,
    vm: &VirtualMachine,
)

Source from the content-addressed store, hash-verified

224/// Create a `(text, category)` or `(text, category, 0)` key and record
225/// it in the registry via `already_warned`.
226fn update_registry(
227 registry: &PyObject,
228 text: &PyObject,
229 category: &PyObject,
230 add_zero: bool,
231 vm: &VirtualMachine,
232) -> PyResult<bool> {
233 let altkey: PyObjectRef = if add_zero {
234 PyTuple::new_ref(
235 vec![
236 text.to_owned(),
237 category.to_owned(),
238 vm.ctx.new_int(0).into(),
239 ],
240 &vm.ctx,
241 )
242 .into()
243 } else {
244 PyTuple::new_ref(vec![text.to_owned(), category.to_owned()], &vm.ctx).into()
245 };
246 already_warned(registry, altkey, true, vm)
247}
248
249fn normalize_module(filename: &Py<PyStr>, vm: &VirtualMachine) -> PyObjectRef {
250 match filename.byte_len() {

Callers 1

warn_explicitFunction · 0.85

Calls 1

already_warnedFunction · 0.85

Tested by

no test coverage detected