MCPcopy Index your code
hub / github.com/python/cpython / merge

Method merge

Tools/cases_generator/stack.py:606–631  ·  view source on GitHub ↗
(self, other: "Storage", out: CWriter)

Source from the content-addressed store, hash-verified

604 return self.stack.is_flushed()
605
606 def merge(self, other: "Storage", out: CWriter) -> None:
607 self.sanity_check()
608 if len(self.inputs) != len(other.inputs):
609 self.clear_dead_inputs()
610 other.clear_dead_inputs()
611 if len(self.inputs) != len(other.inputs) and self.check_liveness:
612 diff = self.inputs[-1] if len(self.inputs) > len(other.inputs) else other.inputs[-1]
613 self._print(out)
614 other._print(out)
615 raise StackError(f"Unmergeable inputs. Differing state of '{diff.name}'")
616 for var, other_var in zip(self.inputs, other.inputs):
617 if var.in_local != other_var.in_local:
618 raise StackError(f"'{var.name}' is cleared on some paths, but not all")
619 if len(self.outputs) != len(other.outputs):
620 self._push_defined_outputs()
621 other._push_defined_outputs()
622 if len(self.outputs) != len(other.outputs):
623 var = self.outputs[0] if len(self.outputs) > len(other.outputs) else other.outputs[0]
624 raise StackError(f"'{var.name}' is set on some paths, but not all")
625 for var, other_var in zip(self.outputs, other.outputs):
626 if var.memory_offset is None:
627 other_var.memory_offset = None
628 elif other_var.memory_offset is None:
629 var.memory_offset = None
630 self.stack.merge(other.stack, out)
631 self.sanity_check()
632
633 def push_outputs(self) -> None:
634 if self.spilled:

Callers

nothing calls this directly

Calls 7

sanity_checkMethod · 0.95
clear_dead_inputsMethod · 0.95
_printMethod · 0.95
_push_defined_outputsMethod · 0.95
StackErrorClass · 0.85
_printMethod · 0.45
mergeMethod · 0.45

Tested by

no test coverage detected