summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2019-04-25 05:05:06 +0200
committerGiampaolo Rodola <g.rodola@gmail.com>2019-04-25 05:05:06 +0200
commit3d6b084a281ed72ae4d31218ed949d7046e7e841 (patch)
tree08e532a3348ec6d9c359050892b4d4fb8af4b8d4
parentc0aba35a78649c453f0c89ab163a58a8efb4639e (diff)
downloadpsutil-3d6b084a281ed72ae4d31218ed949d7046e7e841.tar.gz
fix #1486: add wraps() decorator around wrap_exceptions
-rw-r--r--HISTORY.rst2
-rw-r--r--psutil/_psaix.py3
-rw-r--r--psutil/_pssunos.py3
3 files changed, 6 insertions, 2 deletions
diff --git a/HISTORY.rst b/HISTORY.rst
index b9393d17..f2a0bd13 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -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
=====
diff --git a/psutil/_psaix.py b/psutil/_psaix.py
index b0aefa99..174dac1e 100644
--- a/psutil/_psaix.py
+++ b/psutil/_psaix.py
@@ -7,6 +7,7 @@
"""AIX platform implementation."""
import errno
+import functools
import glob
import os
import re
@@ -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)
diff --git a/psutil/_pssunos.py b/psutil/_pssunos.py
index 47a18181..6d7fda85 100644
--- a/psutil/_pssunos.py
+++ b/psutil/_pssunos.py
@@ -5,6 +5,7 @@
"""Sun OS Solaris platform implementation."""
import errno
+import functools
import os
import socket
import subprocess
@@ -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)