Skip to content

Commit

Permalink
AIX: improve open_files() regexp speed (#2457)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlekseyLobanov authored Oct 15, 2024
1 parent 223938f commit b19d5bd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CREDITS
Original file line number Diff line number Diff line change
Expand Up @@ -835,3 +835,8 @@ I: 2272
N: Sam Gross
W: https://github.com/colesbury
I: 2401, 2427

N: Aleksey Lobanov
C: Russia
E: [email protected]
W: https://github.com/AlekseyLobanov
2 changes: 2 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ XXXX-XX-XX
Python 3.13. (patch by Sam Gross)
- 2455_, [Linux]: ``IndexError`` may occur when reading /proc/pid/stat and
field 40 (blkio_ticks) is missing.
- 2457_, [AIX]: significantly improve the speed of `Process.open_files()`_ for
some edge cases.
- 2460_, [OpenBSD]: `Process.num_fds()`_ and `Process.open_files()`_ may fail
with `NoSuchProcess`_ for PID 0. Instead, we now return "null" values (0 and
[] respectively).
Expand Down
2 changes: 1 addition & 1 deletion psutil/_psaix.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ def open_files(self):
)
if "no such process" in stderr.lower():
raise NoSuchProcess(self.pid, self._name)
procfiles = re.findall(r"(\d+): S_IFREG.*\s*.*name:(.*)\n", stdout)
procfiles = re.findall(r"(\d+): S_IFREG.*name:(.*)\n", stdout)
retlist = []
for fd, path in procfiles:
path = path.strip()
Expand Down

0 comments on commit b19d5bd

Please sign in to comment.