MCPcopy Create free account
hub / github.com/python/mypy / analyze_borrowed_arguments

Function analyze_borrowed_arguments

mypyc/analysis/dataflow.py:420–435  ·  view source on GitHub ↗

Calculate arguments that can use references borrowed from the caller. When assigning to an argument, it no longer is borrowed.

(
    blocks: list[BasicBlock], cfg: CFG, borrowed: set[Value]
)

Source from the content-addressed store, hash-verified

418
419
420def analyze_borrowed_arguments(
421 blocks: list[BasicBlock], cfg: CFG, borrowed: set[Value]
422) -> AnalysisResult[Value]:
423 """Calculate arguments that can use references borrowed from the caller.
424
425 When assigning to an argument, it no longer is borrowed.
426 """
427 return run_analysis(
428 blocks=blocks,
429 cfg=cfg,
430 gen_and_kill=BorrowedArgumentsVisitor(borrowed),
431 initial=borrowed,
432 backward=False,
433 kind=MUST_ANALYSIS,
434 universe=borrowed,
435 )
436
437
438class UndefinedVisitor(BaseAnalysisVisitor[Value]):

Callers 1

insert_ref_count_opcodesFunction · 0.90

Calls 2

run_analysisFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…