Replacement for traceback.extract_stack() that only does the necessary work for asyncio debug mode.
(limit=10)
| 2723 | |
| 2724 | |
| 2725 | def _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 | |
| 2746 | def _check_record_class(record_class): |
no outgoing calls
no test coverage detected
searching dependent graphs…