MCPcopy Index your code
hub / github.com/python/mypy / DecRef

Class DecRef

mypyc/ir/ops.py:602–627  ·  view source on GitHub ↗

Decrease reference count and free object if zero (dec_ref src). The is_xdec flag says to use an XDECREF, which checks if the pointer is NULL first.

Source from the content-addressed store, hash-verified

600
601@final
602class DecRef(RegisterOp):
603 """Decrease reference count and free object if zero (dec_ref src).
604
605 The is_xdec flag says to use an XDECREF, which checks if the
606 pointer is NULL first.
607 """
608
609 error_kind = ERR_NEVER
610
611 def __init__(self, src: Value, is_xdec: bool = False, line: int = -1) -> None:
612 assert src.type.is_refcounted
613 super().__init__(line)
614 self.src = src
615 self.is_xdec = is_xdec
616
617 def __repr__(self) -> str:
618 return "<{}DecRef {!r}>".format("X" if self.is_xdec else "", self.src)
619
620 def sources(self) -> list[Value]:
621 return [self.src]
622
623 def set_sources(self, new: list[Value]) -> None:
624 (self.src,) = new
625
626 def accept(self, visitor: OpVisitor[T]) -> T:
627 return visitor.visit_dec_ref(self)
628
629
630@final

Callers 8

vec_set_itemFunction · 0.90
test_dec_refMethod · 0.90
test_dec_ref_intMethod · 0.90
test_dec_ref_tupleMethod · 0.90
maybe_append_dec_refFunction · 0.90
add_blockFunction · 0.90
spill_regsFunction · 0.90

Calls

no outgoing calls

Tested by 4

test_dec_refMethod · 0.72
test_dec_ref_intMethod · 0.72
test_dec_ref_tupleMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…