fix repr(Error): PID was not shown if PID == 0

Signed-off-by: zhang-liang-pengkun <zhangliangpengkun@xfusion.com>
(cherry picked from commit e91c59d7faa590573b0ec0648340d8a6c1a95c89)
(cherry picked from commit 60d09981220e318efe7ea1a0ca0318087b913bac)
This commit is contained in:
zhang-liang-pengkun 2023-10-19 17:25:19 +08:00 committed by openeuler-sync-bot
parent 9d7dae12c9
commit 567b51cad4
2 changed files with 31 additions and 1 deletions

View File

@ -0,0 +1,26 @@
From d135e2c3a99bfd1bd01d1158ec31dbc8dc1c910f Mon Sep 17 00:00:00 2001
From: Giampaolo Rodola <g.rodola@gmail.com>
Date: Sat, 15 Jan 2022 22:21:39 +0100
Subject: [PATCH] fix repr(Error): PID was not shown if PID == 0
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
---
psutil/_common.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/psutil/_common.py b/psutil/_common.py
index 1e33699c..c94a8378 100644
--- a/psutil/_common.py
+++ b/psutil/_common.py
@@ -289,7 +289,7 @@ class Error(Exception):
info = {} # Python 2.6
for name in attrs:
value = getattr(self, name, None)
- if value:
+ if value is not None:
info[name] = value
return info
--
2.39.0.windows.2

View File

@ -1,10 +1,11 @@
Name: python-psutil Name: python-psutil
Version: 5.9.0 Version: 5.9.0
Release: 1 Release: 2
Summary: A library for retrieving information on running processes and system utilization in Python Summary: A library for retrieving information on running processes and system utilization in Python
License: BSD License: BSD
URL: https://github.com/giampaolo/psutil URL: https://github.com/giampaolo/psutil
Source0: https://github.com/giampaolo/psutil/archive/release-%{version}.tar.gz#/psutil-%{version}.tar.gz Source0: https://github.com/giampaolo/psutil/archive/release-%{version}.tar.gz#/psutil-%{version}.tar.gz
Patch0001: 0001-fix-repr-Error-PID-was-not-shown-if-PID-0.patch
BuildRequires: gcc python3-devel procps-ng python3-mock BuildRequires: gcc python3-devel procps-ng python3-mock
@ -48,6 +49,9 @@ done
%{python3_sitearch}/*.egg-info %{python3_sitearch}/*.egg-info
%changelog %changelog
* Thu Oct 19 2023 zhangliangpengkun<zhangliangpengkun@xfusion.com> - 5.9.0-2
- fix repr(Error): PID was not shown if PID == 0
* Mon Jun 13 2022 OpenStack_SIG <openstack@openeuler.org> - 5.9.0-1 * Mon Jun 13 2022 OpenStack_SIG <openstack@openeuler.org> - 5.9.0-1
- Update version to 5.9.0 - Update version to 5.9.0