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

Function generate_traceback_code

mypyc/codegen/emitwrapper.py:71–86  ·  view source on GitHub ↗
(
    fn: FuncIR, emitter: Emitter, source_path: str, module_name: str
)

Source from the content-addressed store, hash-verified

69
70
71def generate_traceback_code(
72 fn: FuncIR, emitter: Emitter, source_path: str, module_name: str
73) -> str:
74 # If we hit an error while processing arguments, then we emit a
75 # traceback frame to make it possible to debug where it happened.
76 # Unlike traceback frames added for exceptions seen in IR, we do this
77 # even if there is no `traceback_name`. This is because the error will
78 # have originated here and so we need it in the traceback.
79 globals_static = emitter.static_name("globals", module_name)
80 traceback_code = 'CPy_AddTraceback("%s", "%s", %d, %s);' % (
81 source_path.replace("\\", "\\\\"),
82 fn.traceback_name or fn.name,
83 fn.line,
84 globals_static,
85 )
86 return traceback_code
87
88
89def make_arg_groups(args: list[RuntimeArg]) -> dict[ArgKind, list[RuntimeArg]]:

Callers 2

Calls 2

static_nameMethod · 0.80
replaceMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…