MCPcopy Index your code
hub / github.com/google/clusterfuzz / reverse_python_stacktrace

Function reverse_python_stacktrace

src/clusterfuzz/stacktraces/__init__.py:1614–1636  ·  view source on GitHub ↗

Extract a Python stacktrace. Python stacktraces are a bit special: they are reversed, and followed by a sanitizer one, so we need to extract them, reverse them, and put their "title" back on top.

(stacktrace)

Source from the content-addressed store, hash-verified

1612
1613
1614def reverse_python_stacktrace(stacktrace):
1615 """Extract a Python stacktrace.
1616 Python stacktraces are a bit special: they are reversed,
1617 and followed by a sanitizer one, so we need to extract them, reverse them,
1618 and put their "title" back on top."""
1619 python_stacktrace_split = []
1620 in_python_stacktrace = False
1621
1622 for line in stacktrace:
1623 # Locate the beginning of the python stacktrace.
1624 if in_python_stacktrace is False:
1625 for regex, _ in PYTHON_CRASH_TYPES_MAP:
1626 if regex.match(line):
1627 in_python_stacktrace = True
1628 python_stacktrace_split = [line] # Add the "title" of the stacktrace
1629 break
1630 else:
1631 # Locate beginning of the sanitizer stacktrace.
1632 if '=========' in line or '== ERROR: ' in line:
1633 break
1634 python_stacktrace_split.insert(1, line)
1635
1636 return python_stacktrace_split
1637
1638
1639def update_kasan_crash_details(state, line):

Callers 1

parseMethod · 0.85

Calls 1

insertMethod · 0.80

Tested by

no test coverage detected