Skip to content

Instantly share code, notes, and snippets.

View my_coroutine_in_py_27.py
from collections import namedtuple
ALIVE = '*'
EMPTY = '-'
Query = namedtuple('Query',('y','x'))
Transition = namedtuple('Transition', ('y', 'x', 'state'))
TICK = object()
class MyReturn(Exception):
def __init__(self, value):
@bslatkin
bslatkin / llvmlite_ctypes_bug.py
Created Feb 19, 2022
Minimal bug reproduction case in the interaction of ctypes.Union with llvmlite
View llvmlite_ctypes_bug.py
"""
# These are the values I see on my system that reproduces the bug:
$ uname -a
Darwin silver-surfer.lan 21.3.0 Darwin Kernel Version 21.3.0: Wed Jan 5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_X86_64 x86_64
$ /usr/local/Cellar/llvm@11/11.1.0_4/bin/clang -v
Homebrew clang version 11.1.0
Target: x86_64-apple-darwin21.3.0
Thread model: posix
@bslatkin
bslatkin / stack trace.txt
Created Feb 22, 2022
Stack trace from a ctypes crash
View stack trace.txt
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
* frame #0: 0x00007ff811b05112 libsystem_kernel.dylib`__pthread_kill + 10
frame #1: 0x00007ff811b3b214 libsystem_pthread.dylib`pthread_kill + 263
frame #2: 0x00007ff811a87daa libsystem_c.dylib`__abort + 139
frame #3: 0x00007ff811a73dbe libsystem_c.dylib`__stack_chk_fail + 100
frame #4: 0x00007ff81fec9f50 libffi.dylib`ffi_prep_cif_machdep + 688
frame #5: 0x00007ff81fec9c34 libffi.dylib`ffi_prep_cif + 23
frame #6: 0x00000001066fbc5f _ctypes.cpython-310d-darwin.so`_call_function_pointer(flags=4353, pProc=0x00000001061ff000, avalues=0x00007ff7bfee5420, atypes=0x00007ff7bfee53e0, restype=0x0000611000438828, resmem=0x00007ff7bfee5460, argcount=0, argtypecount=0) at callproc.c:883:23
frame #7: 0x00000001066f8df6 _ctypes.cpython-310d-darwin.so`_ctypes_callproc(pProc=0x00000001061ff000, argtuple=0x00006060000070c0, flags=4353, argtypes=0x00006060000070c0, restype=0x0000619000225ba0, checker=0x0000000000000000) at c