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

Function emit_attr_defaults_func_call

mypyc/codegen/emitclass.py:680–692  ·  view source on GitHub ↗

Emit C code to initialize attribute defaults by calling defaults_fn. The code returns NULL on a raised exception.

(defaults_fn: FuncIR, self_name: str, emitter: Emitter)

Source from the content-addressed store, hash-verified

678
679
680def emit_attr_defaults_func_call(defaults_fn: FuncIR, self_name: str, emitter: Emitter) -> None:
681 """Emit C code to initialize attribute defaults by calling defaults_fn.
682
683 The code returns NULL on a raised exception.
684 """
685 emitter.emit_lines(
686 "if ({}{}((PyObject *){}) == 0) {{".format(
687 NATIVE_PREFIX, defaults_fn.cname(emitter.names), self_name
688 ),
689 "Py_DECREF(self);",
690 "return NULL;",
691 "}",
692 )
693
694
695def emit_setup_or_dunder_new_call(

Callers 1

generate_setup_for_classFunction · 0.85

Calls 3

emit_linesMethod · 0.45
formatMethod · 0.45
cnameMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…