Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pickle support to psutil Exceptions #2380

Merged
merged 1 commit into from
Mar 15, 2024

Conversation

anthonyryan1
Copy link
Contributor

Summary

  • OS: N/A
  • Bug fix: yes
  • Type: core
  • Fixes: 2272

Description

Add __reduce__ method to exceptions commonly thrown, and start testing that exceptions can be pickled in test_serialization.

Prior to this, it was not possible to pickle a psutil exception (for error reporting), and this also made it impossible to send them through multiprocessing pipes. Code demonstrating the problem is available in #2272

Add __reduce__ method to exceptions commonly thrown, and start
testing that exceptions can be pickled in test_serialization.

Fixes giampaolo#2272

Signed-off-by: Anthony Ryan <[email protected]>
@giampaolo
Copy link
Owner

Nice change. I like it.

@giampaolo giampaolo merged commit bd03362 into giampaolo:master Mar 15, 2024
15 checks passed
ddelange added a commit to ddelange/psutil that referenced this pull request Apr 9, 2024
…mpaolo-master

* 'master' of https://github.com/giampaolo/psutil:
  Fix workflow visibility badges in README (giampaolo#2399)
  OpenBSD: pid_exists() returns True for thread IDs (TIDs) (giampaolo#2395)
  pid_exists() and Process() disagree on whether a pid exists when ERROR_ACCESS_DENIED (giampaolo#2394)
  fix ruff errors
  Fix typos again (giampaolo#2388)
  fix doc style
  update HISTORY / CREDITS
  Include CoreFoundation/CoreFoundation.h (giampaolo#2364)
  Tests: Compare floats less strictly (giampaolo#2372)
  chore: build macOS arm64 wheels on macos-14 (giampaolo#2375)
  Update to fix OSX older version build failure (giampaolo#2379)
  Makefile: define a PYTHON_ENV_VARS var to use with the $PYTHON var.
  fix win tests
  refact serialization tests
  always use unittest.SkipTest where needed
  Add pickle support to psutil Exceptions (giampaolo#2380)
  enable ruff preview mode
ddelange added a commit to ddelange/psutil that referenced this pull request Apr 9, 2024
* giampaolo-master:
  Fix workflow visibility badges in README (giampaolo#2399)
  OpenBSD: pid_exists() returns True for thread IDs (TIDs) (giampaolo#2395)
  pid_exists() and Process() disagree on whether a pid exists when ERROR_ACCESS_DENIED (giampaolo#2394)
  fix ruff errors
  Fix typos again (giampaolo#2388)
  fix doc style
  update HISTORY / CREDITS
  Include CoreFoundation/CoreFoundation.h (giampaolo#2364)
  Tests: Compare floats less strictly (giampaolo#2372)
  chore: build macOS arm64 wheels on macos-14 (giampaolo#2375)
  Update to fix OSX older version build failure (giampaolo#2379)
  Makefile: define a PYTHON_ENV_VARS var to use with the $PYTHON var.
  fix win tests
  refact serialization tests
  always use unittest.SkipTest where needed
  Add pickle support to psutil Exceptions (giampaolo#2380)
  enable ruff preview mode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants