_c¶
_c
¶
Low-level, process-wide helpers nnsight installs at import.
py_mount— a small C extension that writes a method intoobject's type dict (bypassing its read-onlymappingproxy), so it appears on all objects. nnsight uses it to add.save()universally. Optional: if it didn't build,mount/unmountareNoneand callers fall back tonnsight.save(value).backtrace— neutralizes glibcbacktrace()so a torch C++ error raised inside an interleaving greenlet surfaces as a normal Python exception instead of segfaulting the process (seebacktrace.install).
install_backtrace_guard
¶
Neutralize glibc backtrace() so a c10 error on a greenlet can't crash.
Returns True if the guard is in place (including on a repeat call), and
False if it was skipped -- unsupported platform, no glibc backtrace,
or a page could not be made writable. Idempotent and never raises.