psutil icon indicating copy to clipboard operation
psutil copied to clipboard

[Linux] psutil.NoSuchProcess exception can't be pickled

Open anthonyryan1 opened this issue 2 years ago • 0 comments

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)

anthonyryan1 avatar Jun 27 '23 00:06 anthonyryan1