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

Function gen_glue

mypyc/irbuild/function.py:637–660  ·  view source on GitHub ↗

Generate glue methods that mediate between different method types in subclasses. Works on both properties and methods. See gen_glue_methods below for more details. If do_py_ops is True, then the glue methods should use generic C API operations instead of direct calls, to enable gen

(
    builder: IRBuilder,
    base_sig: FuncSignature,
    target: FuncIR,
    cls: ClassIR,
    base: ClassIR,
    fdef: FuncItem,
    *,
    do_py_ops: bool = False,
)

Source from the content-addressed store, hash-verified

635
636
637def gen_glue(
638 builder: IRBuilder,
639 base_sig: FuncSignature,
640 target: FuncIR,
641 cls: ClassIR,
642 base: ClassIR,
643 fdef: FuncItem,
644 *,
645 do_py_ops: bool = False,
646) -> FuncIR:
647 """Generate glue methods that mediate between different method types in subclasses.
648
649 Works on both properties and methods. See gen_glue_methods below
650 for more details.
651
652 If do_py_ops is True, then the glue methods should use generic
653 C API operations instead of direct calls, to enable generating
654 "shadow" glue methods that work with interpreted subclasses.
655 """
656 if fdef.is_property:
657 return gen_glue_property(builder, base_sig, target, cls, base, fdef.line, do_py_ops)
658 if do_py_ops and target.name.startswith(PROPSET_PREFIX):
659 return gen_glue_property_setter(builder, base_sig, target, cls, base, fdef.line)
660 return gen_glue_method(builder, base_sig, target, cls, base, fdef.line, do_py_ops)
661
662
663class ArgInfo(NamedTuple):

Callers 1

handle_ext_methodFunction · 0.85

Calls 4

gen_glue_propertyFunction · 0.85
gen_glue_property_setterFunction · 0.85
gen_glue_methodFunction · 0.85
startswithMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…