summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2019-03-03 22:40:12 +0100
committerGiampaolo Rodola <g.rodola@gmail.com>2019-03-03 22:40:12 +0100
commit95244de84f59f4793bc806196b383fbd217aa639 (patch)
treefe93d7d0c1b17b8194a283cc609edba01ed05346
parent7a9e7969f172c80507416a0fb1df98bf72e71139 (diff)
downloadpsutil-95244de84f59f4793bc806196b383fbd217aa639.tar.gz
fix #1447: we weren't use @wrap_exceptions around oneshot() (doh\!)
-rw-r--r--HISTORY.rst4
-rw-r--r--psutil/_psaix.py3
-rw-r--r--psutil/_psbsd.py1
-rw-r--r--psutil/_pslinux.py3
-rw-r--r--psutil/_psosx.py2
-rw-r--r--psutil/_pssunos.py8
-rw-r--r--psutil/_pswindows.py1
7 files changed, 17 insertions, 5 deletions
diff --git a/HISTORY.rst b/HISTORY.rst
index 35a9ae60..5f3c38f2 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -36,7 +36,9 @@ XXXX-XX-XX
- 1432_: [Windows] Process.memory_info_ex()'s USS memory is miscalculated
because we're not using the actual system PAGESIZE.
- 1439_: [NetBSD] Process.connections() may return incomplete results if using
- oneshot()
+ oneshot().
+- 1447_: original exception wasn't turned into NSP/AD exceptions when using
+ Process.oneshot() ctx manager.
**Incompatible API changes**
diff --git a/psutil/_psaix.py b/psutil/_psaix.py
index 96ed9476..4fc87827 100644
--- a/psutil/_psaix.py
+++ b/psutil/_psaix.py
@@ -371,14 +371,17 @@ class Process(object):
self._proc_basic_info.cache_deactivate(self)
self._proc_cred.cache_deactivate(self)
+ @wrap_exceptions
@memoize_when_activated
def _proc_name_and_args(self):
return cext.proc_name_and_args(self.pid, self._procfs_path)
+ @wrap_exceptions
@memoize_when_activated
def _proc_basic_info(self):
return cext.proc_basic_info(self.pid, self._procfs_path)
+ @wrap_exceptions
@memoize_when_activated
def _proc_cred(self):
return cext.proc_cred(self.pid, self._procfs_path)
diff --git a/psutil/_psbsd.py b/psutil/_psbsd.py
index 92864cea..3d9dfdab 100644
--- a/psutil/_psbsd.py
+++ b/psutil/_psbsd.py
@@ -611,6 +611,7 @@ class Process(object):
# incorrect or incomplete result.
cext.proc_name(self.pid)
+ @wrap_exceptions
@memoize_when_activated
def oneshot(self):
"""Retrieves multiple process info in one shot as a raw tuple."""
diff --git a/psutil/_pslinux.py b/psutil/_pslinux.py
index 2eadc4c7..41be6665 100644
--- a/psutil/_pslinux.py
+++ b/psutil/_pslinux.py
@@ -1546,6 +1546,7 @@ class Process(object):
# incorrect or incomplete result.
os.stat('%s/%s' % (self._procfs_path, self.pid))
+ @wrap_exceptions
@memoize_when_activated
def _parse_stat_file(self):
"""Parse /proc/{pid}/stat file and return a dict with various
@@ -1579,6 +1580,7 @@ class Process(object):
return ret
+ @wrap_exceptions
@memoize_when_activated
def _read_status_file(self):
"""Read /proc/{pid}/stat file and return its content.
@@ -1588,6 +1590,7 @@ class Process(object):
with open_binary("%s/%s/status" % (self._procfs_path, self.pid)) as f:
return f.read()
+ @wrap_exceptions
@memoize_when_activated
def _read_smaps_file(self):
with open_binary("%s/%s/smaps" % (self._procfs_path, self.pid),
diff --git a/psutil/_psosx.py b/psutil/_psosx.py
index 20c05612..7459a0f3 100644
--- a/psutil/_psosx.py
+++ b/psutil/_psosx.py
@@ -384,6 +384,7 @@ class Process(object):
self._name = None
self._ppid = None
+ @wrap_exceptions
@memoize_when_activated
def _get_kinfo_proc(self):
# Note: should work with all PIDs without permission issues.
@@ -391,6 +392,7 @@ class Process(object):
assert len(ret) == len(kinfo_proc_map)
return ret
+ @wrap_exceptions
@memoize_when_activated
def _get_pidtaskinfo(self):
# Note: should work for PIDs owned by user only.
diff --git a/psutil/_pssunos.py b/psutil/_pssunos.py
index 17469eac..67166e46 100644
--- a/psutil/_pssunos.py
+++ b/psutil/_pssunos.py
@@ -396,22 +396,22 @@ class Process(object):
self._proc_basic_info.cache_deactivate(self)
self._proc_cred.cache_deactivate(self)
+ @wrap_exceptions
@memoize_when_activated
def _proc_name_and_args(self):
return cext.proc_name_and_args(self.pid, self._procfs_path)
+ @wrap_exceptions
@memoize_when_activated
def _proc_basic_info(self):
ret = cext.proc_basic_info(self.pid, self._procfs_path)
assert len(ret) == len(proc_info_map)
return ret
+ @wrap_exceptions
@memoize_when_activated
def _proc_cred(self):
- @wrap_exceptions
- def proc_cred(self):
- return cext.proc_cred(self.pid, self._procfs_path)
- return proc_cred(self)
+ return cext.proc_cred(self.pid, self._procfs_path)
@wrap_exceptions
def name(self):
diff --git a/psutil/_pswindows.py b/psutil/_pswindows.py
index 3fcee450..9fa14af4 100644
--- a/psutil/_pswindows.py
+++ b/psutil/_pswindows.py
@@ -686,6 +686,7 @@ class Process(object):
def oneshot_exit(self):
self.oneshot_info.cache_deactivate(self)
+ @wrap_exceptions
@memoize_when_activated
def oneshot_info(self):
"""Return multiple information about this process as a