all Python 3Linux · macOSosfunction
os.WCOREDUMP
os — status decoding (W*)
Test whether a terminated child produced a core dump. Availability: Unix.
Syntax
os.WCOREDUMP(...)
A dump appears only if allowed: the ulimit -c limit is often zero, and modern Linux hands dumps to systemd-coredump. So a false value does not mean there was no crash. Check it only after WIFSIGNALED is true.
Examples
import os
pid = os.fork() # → ? только Unix: 0 в дочернем процессе, pid потомка в родителе
if pid == 0: os.abort() # потомок аварийно падает по SIGABRT
_, status = os.waitpid(pid, 0) # родитель забирает статус завершения потомка
print(os.WIFSIGNALED(status)) # → True — потомок убит сигналом, а не вышел сам
print(os.WCOREDUMP(status)) # → True, если система разрешила записать core (ulimit -c unlimited), иначе False
print(os.WCOREDUMP(0)) # → False — после штатного завершения дампа нет
See also
Open in the full glossarydocs.python.orgReport an inaccuracy