PFZheng / psutil

Automatically exported from code.google.com/p/psutil
Other
0 stars 0 forks source link

Make psutil.STATUS_* constants str comparable #282

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Now that we've introduced Process.as_dict() method (issue 278) a typical usage 
one might face is to serialize the returned dict.
When that's done, process status gets automatically turned into a string due to:
https://code.google.com/p/psutil/source/browse/tags/release-0.4.1/psutil/_common
.py#27
That makes it impossible to compare the serialized status value (which is a 
string) with the base STATUS_* constants (which are derived from int but 
doesn't check for equality with the string).
Proposal is to override constant.__eq__ method in order to use both int or str 
values when comparing for equality.

Original issue reported on code.google.com by g.rodola on 13 Jun 2012 at 1:58

GoogleCodeExporter commented 9 years ago
Fixed in r1344.

Original comment by g.rodola on 13 Jun 2012 at 2:05

GoogleCodeExporter commented 9 years ago
0.5.0 is finally out. Closing out as fixed.

Original comment by g.rodola on 27 Jun 2012 at 6:54

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Updated csets after the SVN -> Mercurial migration:
r1344 == revision ???

Original comment by g.rodola on 2 Mar 2013 at 12:09