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

Method modified

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

Invalidate this type's version tag and cascade to all subclasses.

(&self)

Source from the content-addressed store, hash-verified

489
490 /// Invalidate this type's version tag and cascade to all subclasses.
491 pub fn modified(&self) {
492 if let Some(ext) = self.heaptype_ext.as_ref() {
493 ext.specialization_cache.invalidate_for_type_modified();
494 }
495 // If already invalidated, all subclasses must also be invalidated
496 // (guaranteed by the MRO invariant in assign_version_tag).
497 let old_version = self.tp_version_tag.load(Ordering::Acquire);
498 if old_version == 0 {
499 return;
500 }
501 self.tp_version_tag.store(0, Ordering::SeqCst);
502 // Nullify borrowed pointers in cache entries for this version
503 // so they don't dangle after the dict is modified.
504 type_cache_clear_version(old_version);
505 let subclasses = self.subclasses.read();
506 for weak_ref in subclasses.iter() {
507 if let Some(sub) = weak_ref.upgrade() {
508 sub.downcast_ref::<PyType>().unwrap().modified();
509 }
510 }
511 }
512
513 pub fn new_simple_heap(
514 name: &str,

Callers 4

set_attrMethod · 0.45
set_basesMethod · 0.45
set___type_params__Method · 0.45
setattroMethod · 0.45

Calls 9

type_cache_clear_versionFunction · 0.85
as_refMethod · 0.45
loadMethod · 0.45
storeMethod · 0.45
readMethod · 0.45
iterMethod · 0.45
upgradeMethod · 0.45
unwrapMethod · 0.45

Tested by

no test coverage detected