psutil
psutil copied to clipboard
[Linux] psutil.NoSuchProcess exception can't be pickled
Summary
- OS: Linux
- Architecture: 64bit
- Psutil version: 5.9.5
- Python version: 3.11.4
- Type: core, tests
Description
psutil.NoSuchProcess exceptions can't be pickled and sent through a pipe. Normally, one would expect python exceptions to be pickleable so they can be moved.
#!/bin/env python3
import multiprocessing
import psutil
# err = Exception("A standard exception works")
err = psutil.NoSuchProcess(pid=123)
recv_pipe, send_pipe = multiprocessing.Pipe(duplex=False)
send_pipe.send(err)
output = recv_pipe.recv()
# assert isinstance(output, Exception)
assert isinstance(output, psutil.NoSuchProcess)