Skip to content

Commit

Permalink
fix #1486: add wraps() decorator around wrap_exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Apr 25, 2019
1 parent c0aba35 commit 3d6b084
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
APIs. Different process methods were affected by this.
- 1480_: [Windows] psutil.cpu_count(logical=False) could cause a crash due to
fixed read violation. (patch by Samer Masterson)
- 1486_: [AIX, SunOS] AttributeError when interacting with Process methods
involved into oneshot() context.

5.6.1
=====
Expand Down
3 changes: 2 additions & 1 deletion psutil/_psaix.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"""AIX platform implementation."""

import errno
import functools
import glob
import os
import re
Expand Down Expand Up @@ -322,7 +323,7 @@ def wrap_exceptions(fun):
"""Call callable into a try/except clause and translate ENOENT,
EACCES and EPERM in NoSuchProcess or AccessDenied exceptions.
"""

@functools.wraps(fun)
def wrapper(self, *args, **kwargs):
try:
return fun(self, *args, **kwargs)
Expand Down
3 changes: 2 additions & 1 deletion psutil/_pssunos.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"""Sun OS Solaris platform implementation."""

import errno
import functools
import os
import socket
import subprocess
Expand Down Expand Up @@ -336,7 +337,7 @@ def wrap_exceptions(fun):
"""Call callable into a try/except clause and translate ENOENT,
EACCES and EPERM in NoSuchProcess or AccessDenied exceptions.
"""

@functools.wraps(fun)
def wrapper(self, *args, **kwargs):
try:
return fun(self, *args, **kwargs)
Expand Down

0 comments on commit 3d6b084

Please sign in to comment.