(
fn: FuncIR, emitter: Emitter, source_path: str, module_name: str
)
| 69 | |
| 70 | |
| 71 | def 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 | |
| 89 | def make_arg_groups(args: list[RuntimeArg]) -> dict[ArgKind, list[RuntimeArg]]: |
no test coverage detected
searching dependent graphs…