Skip to content

Instantly share code, notes, and snippets.

View pablogsal's full-sized avatar

Pablo Galindo Salgado pablogsal

View GitHub Profile
how do you feel about these stacks?
Traceback for thread 2896 (python) [Garbage collecting] (most recent call last):
(C) File "???", line 0, in _start (/home/mwoznisk/3ps/cpython/python)
(C) File "../csu/libc-start.c", line 302, in __libc_start_main (/usr/lib64/libc-2.28.so)
(C) File "Modules/main.c", line 829, in Py_BytesMain (/home/mwoznisk/3ps/cpython/python)
(C) File "Modules/main.c", line 805, in pymain_main (inlined) (/home/mwoznisk/3ps/cpython/python)
(C) File "Modules/main.c", line 777, in Py_RunMain (inlined) (/home/mwoznisk/3ps/cpython/python)
(C) File "Python/gc_free_threading.c", line 2608, in PyGC_Collect (/home/mwoznisk/3ps/cpython/python)
(C) File "Python/gc_free_threading.c", line 2314, in gc_collect_main.constprop.0 (/home/mwoznisk/3ps/cpython/python)
(C) File "Python/gc_free_threading.c", line 2144, in gc_collect_internal (inlined) (/home/mwoznisk/3ps/cpython/python)
#1 _PyCode_GetTLBCArray (co=0x0) at ./Include/internal/pycore_code.h:529
529 return _Py_STATIC_CAST(_PyCodeArray *,
(gdb) up
#2 _PyFrame_GetBytecode (f=0x727f2e2331a8) at ./Include/internal/pycore_interpframe.h:32
32 _PyCodeArray *tlbc = _PyCode_GetTLBCArray(co);
(gdb) up
#3 PyUnstable_InterpreterFrame_GetLine (frame=0x727f2e2331a8) at Python/frame.c:149
149 int addr = _PyInterpreterFrame_LASTI(frame) * sizeof(_Py_CODEUNIT);
(gdb) p *frame
$1 = {f_executable = 0x0, previous = 0x727f2e233128, f_funcobj = 0x0,
#1 _PyCode_GetTLBCArray (co=0x0) at ./Include/internal/pycore_code.h:529
529 return _Py_STATIC_CAST(_PyCodeArray *,
(gdb) up
#2 _PyFrame_GetBytecode (f=0x727f2e2331a8) at ./Include/internal/pycore_interpframe.h:32
32 _PyCodeArray *tlbc = _PyCode_GetTLBCArray(co);
(gdb) up
#3 PyUnstable_InterpreterFrame_GetLine (frame=0x727f2e2331a8) at Python/frame.c:149
149 int addr = _PyInterpreterFrame_LASTI(frame) * sizeof(_Py_CODEUNIT);
(gdb) p *frame
$1 = {f_executable = 0x0, previous = 0x727f2e233128, f_funcobj = 0x0,
import sys
import threading
import time
from memray._test import MemoryAllocator
def background_attacher():
time.sleep(1)
import memray
import argparse
import _remote_debugging
import time
import signal
from collections import defaultdict
class SamplingProfiler:
def __init__(self):
self.function_stats = defaultdict(lambda: {'ncalls': 0, 'tottime': 0.0})
self.total_samples = 0
import tokenize
from io import BytesIO
from typing import List, Tuple, Optional, Dict, Any
import keyword
from codeop import compile_command
from _suggestions import _generate_suggestions
from textwrap import dedent
class StatementFinder:
"""Finds the smallest surrounding statement given a line number and Python source."""
#include <elf.h>
#include <execinfo.h>
#include <fcntl.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/mman.h>
#define UNW_LOCAL_ONLY
#include <libunwind.h>
// AArch64 registers
#include <elf.h>
#include <execinfo.h>
#include <fcntl.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <unistd.h>
import ast
class ComparisonTransformer(ast.NodeTransformer):
def visit_Compare(self, node):
self.generic_visit(node)
if len(node.ops) == 1 and len(node.comparators) == 1:
return self.transform_single_comparison(node)
else: