MCPcopy Index your code
hub / github.com/MagicStack/asyncpg / _extract_stack

Function _extract_stack

asyncpg/connection.py:2725–2743  ·  view source on GitHub ↗

Replacement for traceback.extract_stack() that only does the necessary work for asyncio debug mode.

(limit=10)

Source from the content-addressed store, hash-verified

2723
2724
2725def _extract_stack(limit=10):
2726 """Replacement for traceback.extract_stack() that only does the
2727 necessary work for asyncio debug mode.
2728 """
2729 frame = sys._getframe().f_back
2730 try:
2731 stack = traceback.StackSummary.extract(
2732 traceback.walk_stack(frame), lookup_lines=False)
2733 finally:
2734 del frame
2735
2736 apg_path = asyncpg.__path__[0]
2737 i = 0
2738 while i < len(stack) and stack[i][0].startswith(apg_path):
2739 i += 1
2740 stack = stack[i:i + limit]
2741
2742 stack.reverse()
2743 return ''.join(traceback.format_list(stack))
2744
2745
2746def _check_record_class(record_class):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…