Skip to content

Commit

Permalink
remove memory_info_ex()
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Apr 18, 2024
1 parent aefb59c commit 8295f59
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 31 deletions.
18 changes: 12 additions & 6 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
- 2407_: `Process.connections()`_ was renamed to `Process.net_connections()`_.
The old name is still available, but it's deprecated (triggers a
``DeprecationWarning``) and will be removed in the future.
- 2409_: removed `Process.memory_info_ex()`, which was deprecated 8 years ago.

**Bug fixes**

Expand All @@ -40,9 +41,15 @@ Version 6.0.0 introduces some changes which affect backward compatibility:
been reused. If you want to check for PID reusage you are supposed to use
`Process.is_running()`_ against the yielded `Process`_ instances. That will
also automatically remove reused PIDs from `process_iter()`_ internal cache.
You can now also use new `process_iter.cache_clear()` API if you want to.
- 2407_: `Process.connections()`_ was renamed to `Process.net_connections()`_.
The old name is still available, but it's deprecated (triggers a
``DeprecationWarning``) and will be removed in the future.
``DeprecationWarning``) and will be removed in the future. This also means
that `Process.as_dict()`_ will 1) return a dictionary with a different key
name ( "net_connections" instead of "connections") 2) it will no longer
accept ``as_dict(attrs=["connections"])`` as an argument.
- 2409_: removed `Process.memory_info_ex()`, which was deprecated 8 years ago.
You are supposed to use `Process.memory_info()`_ instead.

5.9.8
=====
Expand Down Expand Up @@ -676,7 +683,7 @@ Version 6.0.0 introduces some changes which affect backward compatibility:
- 1429_, [Windows]: ``SE DEBUG`` was not properly set for current process. It is
now, and it should result in less `AccessDenied`_ exceptions for low PID
processes.
- 1432_, [Windows]: `Process.memory_info_ex()`_'s USS memory is miscalculated
- 1432_, [Windows]: `Process.memory_info_ex()` USS memory is miscalculated
because we're not using the actual system ``PAGESIZE``.
- 1439_, [NetBSD]: `Process.connections()`_ may return incomplete results if using
`Process.oneshot()`_.
Expand Down Expand Up @@ -894,7 +901,7 @@ Version 6.0.0 introduces some changes which affect backward compatibility:
to print useful debug messages on stderr (useful in case of nasty errors).
- 1177_, [macOS]: added support for `sensors_battery()`_. (patch by Arnon Yaari)
- 1183_: `Process.children()`_ is 2x faster on POSIX and 2.4x faster on Linux.
- 1188_: deprecated method `Process.memory_info_ex()`_ now warns by using
- 1188_: deprecated method `Process.memory_info_ex()` now warns by using
``FutureWarning`` instead of ``DeprecationWarning``.

**Bug fixes**
Expand Down Expand Up @@ -1300,7 +1307,7 @@ Version 6.0.0 introduces some changes which affect backward compatibility:
`Process.threads()`_ and `Process.memory_maps()`_ may raise ``RuntimeError`` if
attempting to query a 64bit process with a 32bit Python. "Null" values are
returned as a fallback.
- 858_: `Process.as_dict()`_ should not call `Process.memory_info_ex()`_
- 858_: `Process.as_dict()`_ should not call `Process.memory_info_ex()`
because it's deprecated.
- 863_, [Windows]: `Process.memory_maps()`_ truncates addresses above 32 bits.
- 866_, [Windows]: `win_service_iter()`_ and services in general are not able to
Expand Down Expand Up @@ -2160,7 +2167,7 @@ In most cases accessing the old names will work but it will cause a
- 220_, [FreeBSD]: ``get_connections()`` has been rewritten in C and no longer
requires ``lsof``.
- 222_, [macOS]: add support for `Process.cwd()`_.
- 261_: per-process extended memory info (`Process.memory_info_ex()`_).
- 261_: per-process extended memory info (`Process.memory_info_ex()`).
- 295_, [macOS]: `Process.exe()`_ path is now determined by asking the OS
instead of being guessed from `Process.cmdline()`_.
- 297_, [macOS]: the `Process`_ methods below were always raising `AccessDenied`_
Expand Down Expand Up @@ -2646,7 +2653,6 @@ In most cases accessing the old names will work but it will cause a
.. _`Process.kill()`: https://psutil.readthedocs.io/en/latest/#psutil.Process.kill
.. _`Process.memory_full_info()`: https://psutil.readthedocs.io/en/latest/#psutil.Process.memory_full_info
.. _`Process.memory_info()`: https://psutil.readthedocs.io/en/latest/#psutil.Process.memory_info
.. _`Process.memory_info_ex()`: https://psutil.readthedocs.io/en/latest/#psutil.Process.memory_info_ex
.. _`Process.memory_maps()`: https://psutil.readthedocs.io/en/latest/#psutil.Process.memory_maps
.. _`Process.memory_percent()`: https://psutil.readthedocs.io/en/latest/#psutil.Process.memory_percent
.. _`Process.name()`: https://psutil.readthedocs.io/en/latest/#psutil.Process.name
Expand Down
7 changes: 0 additions & 7 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1706,13 +1706,6 @@ Process class
.. versionchanged::
4.0.0 multiple fields are returned, not only `rss` and `vms`.

.. method:: memory_info_ex()

Same as :meth:`memory_info` (deprecated).

.. warning::
deprecated in version 4.0.0; use :meth:`memory_info` instead.

.. method:: memory_full_info()

This method returns the same information as :meth:`memory_info`, plus, on
Expand Down
6 changes: 1 addition & 5 deletions psutil/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1106,10 +1106,6 @@ def memory_info(self):
"""
return self._proc.memory_info()

@_common.deprecated_method(replacement="memory_info")
def memory_info_ex(self):
return self.memory_info()

def memory_full_info(self):
"""This method returns the same information as memory_info(),
plus, on some platform (Linux, macOS, Windows), also provides
Expand Down Expand Up @@ -1341,7 +1337,7 @@ def wait(self, timeout=None):
[x for x in dir(Process) if not x.startswith('_') and x not in
{'send_signal', 'suspend', 'resume', 'terminate', 'kill', 'wait',
'is_running', 'as_dict', 'parent', 'parents', 'children', 'rlimit',
'memory_info_ex', 'oneshot'}])
'connections', 'oneshot'}])
# fmt: on


Expand Down
1 change: 0 additions & 1 deletion psutil/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1401,7 +1401,6 @@ class process_namespace:
('children', (), {'recursive': True}),
('connections', (), {}), # deprecated
('is_running', (), {}),
('memory_info_ex', (), {}), # deprecated
('oneshot', (), {}),
('parent', (), {}),
('parents', (), {}),
Expand Down
6 changes: 3 additions & 3 deletions psutil/tests/test_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -1207,9 +1207,9 @@ def test_as_dict(self):
self.assertEqual(sorted(d.keys()), ['exe', 'name'])

p = psutil.Process(min(psutil.pids()))
d = p.as_dict(attrs=['connections'], ad_value='foo')
if not isinstance(d['connections'], list):
self.assertEqual(d['connections'], 'foo')
d = p.as_dict(attrs=['net_connections'], ad_value='foo')
if not isinstance(d['net_connections'], list):
self.assertEqual(d['net_connections'], 'foo')

# Test ad_value is set on AccessDenied.
with mock.patch(
Expand Down
18 changes: 9 additions & 9 deletions scripts/internal/print_api_speed.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,20 +184,20 @@ def main():
print()
print_header("PROCESS APIS")
ignore = [
'send_signal',
'suspend',
'resume',
'terminate',
'kill',
'wait',
'as_dict',
'children',
'connections',
'kill',
'oneshot',
'parent',
'parents',
'memory_info_ex',
'oneshot',
'pid',
'resume',
'rlimit',
'children',
'send_signal',
'suspend',
'terminate',
'wait',
]
if psutil.MACOS:
ignore.append('memory_maps') # XXX
Expand Down

0 comments on commit 8295f59

Please sign in to comment.