~/talk

Monkey patching

Talkat PiterPy 2023 · 2023-11-07..11-14· [python, testing]
links:none on file
slides:none on file

Uses Python monkey patching to replace standard threading.Thread and multiprocessing Process behavior, adding an exception field, wrapping original run, and sending SIGUSR1 from threads and SIGUSR2 from processes. Processes serialize exception args and traceback to strings and send them over a channel; parent waits on an event with a 1 second timeout to ensure delivery. Built signal handlers re-raise the original exception in the main process; it works and turns long 60s mystery failures into immediate, specific errors like a missing install script.

AI-written summary · about

  1. 0:00Introduction
  2. 2:13What is monkey patching
  3. 3:38Monkey patching example
  4. 5:27Thread exceptions problem
  5. 9:41Thread class modification
  6. 17:39Process class modification
  7. 24:33Results and benefits
  8. 25:59Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.