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

Method _emit_traceback

mypyc/codegen/emit.py:1391–1416  ·  view source on GitHub ↗
(
        self,
        func: str,
        source_path: str,
        module_name: str,
        traceback_entry: tuple[str, int],
        type_str: str = "",
        src: str = "",
    )

Source from the content-addressed store, hash-verified

1389 )
1390
1391 def _emit_traceback(
1392 self,
1393 func: str,
1394 source_path: str,
1395 module_name: str,
1396 traceback_entry: tuple[str, int],
1397 type_str: str = "",
1398 src: str = "",
1399 ) -> None:
1400 if self.context.strict_traceback_checks:
1401 assert traceback_entry[1] >= 0, "Traceback cannot have a negative line number"
1402 globals_static = self.static_name("globals", module_name)
1403 line = '%s("%s", "%s", %d, %s' % (
1404 func,
1405 source_path.replace("\\", "\\\\"),
1406 traceback_entry[0],
1407 traceback_entry[1],
1408 globals_static,
1409 )
1410 if type_str:
1411 assert src
1412 line += f", {type_str}, {src}"
1413 line += ");"
1414 self.emit_line(line)
1415 if DEBUG_ERRORS:
1416 self.emit_line('assert(PyErr_Occurred() != NULL && "failure w/o err!");')
1417
1418 def emit_unbox_failure_with_overlapping_error_value(
1419 self, dest: str, typ: RType, failure: str

Callers 2

emit_tracebackMethod · 0.95

Calls 3

static_nameMethod · 0.95
emit_lineMethod · 0.95
replaceMethod · 0.80

Tested by

no test coverage detected