MCPcopy Create free account
hub / github.com/MagicStack/asyncpg / _extract_stack

Function _extract_stack

asyncpg/connection.py:2780–2798  ·  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

2778
2779
2780def _extract_stack(limit=10):
2781 """Replacement for traceback.extract_stack() that only does the
2782 necessary work for asyncio debug mode.
2783 """
2784 frame = sys._getframe().f_back
2785 try:
2786 stack = traceback.StackSummary.extract(
2787 traceback.walk_stack(frame), lookup_lines=False)
2788 finally:
2789 del frame
2790
2791 apg_path = asyncpg.__path__[0]
2792 i = 0
2793 while i < len(stack) and stack[i][0].startswith(apg_path):
2794 i += 1
2795 stack = stack[i:i + limit]
2796
2797 stack.reverse()
2798 return ''.join(traceback.format_list(stack))
2799
2800
2801def _check_record_class(record_class):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected