summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2019-02-28 23:49:29 +0100
committerGiampaolo Rodola <g.rodola@gmail.com>2019-02-28 23:49:29 +0100
commit4a283d62b687b849b89991a03a4099c53fd9f125 (patch)
tree217494b8101a448559c21c888b3200a78040e915
parent59e3c5e2aa889d443f5f0e44beb52f654fc6e23e (diff)
downloadpsutil-4a283d62b687b849b89991a03a4099c53fd9f125.tar.gz
#1291: (BACKWARD-INCOMPATIBLE) remove memory_maps() on OSX
-rw-r--r--HISTORY.rst6
-rw-r--r--docs/index.rst9
-rw-r--r--psutil/_psosx.py6
-rw-r--r--psutil/tests/__init__.py2
-rwxr-xr-xpsutil/tests/test_contracts.py11
-rwxr-xr-xpsutil/tests/test_memory_leaks.py2
-rwxr-xr-xpsutil/tests/test_process.py2
7 files changed, 8 insertions, 30 deletions
diff --git a/HISTORY.rst b/HISTORY.rst
index 2428f033..6b2a23f7 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -41,10 +41,10 @@ XXXX-XX-XX
- 1439_: [NetBSD] Process.connections() may return incomplete results if using
oneshot()
-**API changes**
+**Incompatible API changes**
-- 1291_: [OSX] Process.memory_maps() is deprecated and will always raise
- AccessDenied. It will be removed in psutil 6.0.0.
+- 1291_: [OSX] Process.memory_maps() was removed because inherently broken
+ (segfault) for years.
5.5.1
=====
diff --git a/docs/index.rst b/docs/index.rst
index 6d464c85..73a81cdb 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -1708,14 +1708,9 @@ Process class
Availability: Linux, Windows, FreeBSD, SunOS
- .. warning::
- on macOS, starting from version 5.6.0, this function is deprecated and
- will always raise :class:`psutil.AccessDenied`. It is scheduled for
- removal in 6.0.0
- (see `issue 1020 <https://github.com/giampaolo/psutil/issues/1291#issuecomment-467828376>`_).
-
.. versionchanged::
- 5.6.0 deprecated on macOS, always raise AccessDenied
+ 5.6.0 removed macOS support because inherently broken (see
+ issue `#1291 <https://github.com/giampaolo/psutil/issues/1291>`__)
.. method:: children(recursive=False)
diff --git a/psutil/_psosx.py b/psutil/_psosx.py
index 78f710aa..20c05612 100644
--- a/psutil/_psosx.py
+++ b/psutil/_psosx.py
@@ -8,7 +8,6 @@ import contextlib
import errno
import functools
import os
-import warnings
from socket import AF_INET
from collections import namedtuple
@@ -575,8 +574,3 @@ class Process(object):
ntuple = _common.pthread(thread_id, utime, stime)
retlist.append(ntuple)
return retlist
-
- def memory_maps(self):
- msg = "memory_maps() on OSX is deprecated and will be removed in 6.0.0"
- warnings.warn(msg, category=DeprecationWarning, stacklevel=2)
- raise AccessDenied(self.pid, msg=msg)
diff --git a/psutil/tests/__init__.py b/psutil/tests/__init__.py
index 86af2cfb..545f5f25 100644
--- a/psutil/tests/__init__.py
+++ b/psutil/tests/__init__.py
@@ -167,7 +167,7 @@ HAS_ENVIRON = hasattr(psutil.Process, "environ")
HAS_PROC_IO_COUNTERS = hasattr(psutil.Process, "io_counters")
HAS_IONICE = hasattr(psutil.Process, "ionice")
HAS_MEMORY_FULL_INFO = 'uss' in psutil.Process().memory_full_info()._fields
-HAS_MEMORY_MAPS = not MACOS and hasattr(psutil.Process, "memory_maps")
+HAS_MEMORY_MAPS = hasattr(psutil.Process, "memory_maps")
HAS_PROC_CPU_NUM = hasattr(psutil.Process, "cpu_num")
HAS_RLIMIT = hasattr(psutil.Process, "rlimit")
HAS_THREADS = hasattr(psutil.Process, "threads")
diff --git a/psutil/tests/test_contracts.py b/psutil/tests/test_contracts.py
index 97a1a0f0..1f02156f 100755
--- a/psutil/tests/test_contracts.py
+++ b/psutil/tests/test_contracts.py
@@ -167,7 +167,8 @@ class TestAvailability(unittest.TestCase):
def test_proc_memory_maps(self):
hasit = hasattr(psutil.Process, "memory_maps")
- self.assertEqual(hasit, False if OPENBSD or NETBSD or AIX else True)
+ self.assertEqual(
+ hasit, False if OPENBSD or NETBSD or AIX or MACOS else True)
# ===================================================================
@@ -185,14 +186,6 @@ class TestDeprecations(unittest.TestCase):
self.assertIn("memory_info_ex() is deprecated", str(w.message))
self.assertIn("use memory_info() instead", str(w.message))
- @unittest.skipIf(not MACOS, "deprecated on macOS")
- def test_memory_maps_osx(self):
- with warnings.catch_warnings(record=True) as ws:
- with self.assertRaises(psutil.AccessDenied):
- psutil.Process().memory_maps()
- w = ws[0]
- self.assertIsInstance(w.category(), DeprecationWarning)
-
# ===================================================================
# --- System API types
diff --git a/psutil/tests/test_memory_leaks.py b/psutil/tests/test_memory_leaks.py
index 16128571..07d7f068 100755
--- a/psutil/tests/test_memory_leaks.py
+++ b/psutil/tests/test_memory_leaks.py
@@ -344,8 +344,6 @@ class TestProcessObjectLeaks(TestMemLeak):
with open(TESTFN, 'w'):
self.execute(self.proc.open_files)
- # MACOS implementation is unbelievably slow
- @unittest.skipIf(MACOS, "too slow on MACOS")
@unittest.skipIf(not HAS_MEMORY_MAPS, "not supported")
@skip_if_linux()
def test_memory_maps(self):
diff --git a/psutil/tests/test_process.py b/psutil/tests/test_process.py
index 31f42eba..2af676ba 100755
--- a/psutil/tests/test_process.py
+++ b/psutil/tests/test_process.py
@@ -1291,8 +1291,6 @@ class TestProcess(unittest.TestCase):
ret = meth([0])
elif name == 'send_signal':
ret = meth(signal.SIGTERM)
- elif MACOS and name == 'memory_maps':
- continue # XXX
else:
ret = meth()
except psutil.ZombieProcess: