summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2019-02-26 17:22:15 +0100
committerGiampaolo Rodola <g.rodola@gmail.com>2019-02-26 17:22:15 +0100
commit62e5b208938bb0ce1b533dced5cf566ded754452 (patch)
tree4abc91a302c097bd5ca2069cd7a16e1aebd9bc24
parent31324467736c9a0fc63f47f11c6810dee23f05e2 (diff)
downloadpsutil-62e5b208938bb0ce1b533dced5cf566ded754452.tar.gz
remove assertion
-rw-r--r--docs/index.rst3
-rw-r--r--psutil/__init__.py7
2 files changed, 6 insertions, 4 deletions
diff --git a/docs/index.rst b/docs/index.rst
index a6f2ba73..012f18ae 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -1205,6 +1205,9 @@ Process class
.. versionadded:: 5.6.0
+ .. warning::
+ this API is experimental and may be removed if deemed necessary.
+
.. method:: status()
The current process status as a string. The returned string is one of the
diff --git a/psutil/__init__.py b/psutil/__init__.py
index 1893298b..513b2a7a 100644
--- a/psutil/__init__.py
+++ b/psutil/__init__.py
@@ -398,7 +398,7 @@ def _pprint_secs(secs):
@lru_cache()
-def _first_pid():
+def _lowest_pid():
return pids()[0]
@@ -666,13 +666,13 @@ class Process(object):
"""Return the parents of this process as a list of Process
instances. If no parents are known return an empty list.
"""
- first_pid = _first_pid()
+ lowest = _lowest_pid() # 1 if LINUX else 0
parents = []
proc = self.parent()
while True:
if proc is None:
break
- elif proc.pid == first_pid:
+ elif proc.pid == lowest:
# Needed because on certain systems such as macOS
# Process(0).ppid() returns 0.
parents.append(proc)
@@ -681,7 +681,6 @@ class Process(object):
par = proc.parent()
if par is None:
break
- assert par.pid < proc.pid, (par.pid, proc.pid)
parents.append(proc)
proc = par
return parents