-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set Process.info
to None
by default
#2260
Conversation
Hmm... debatable. |
Oh, whatever you like, I am not a user of this feature, so I cannot really decide. |
Yes, I think empty dict is fine! |
I came here to raise a similar issue. This example from the docs raises type errors since https://psutil.readthedocs.io/en/latest/#psutil.process_iter: import psutil
for proc in psutil.process_iter(['pid', 'name', 'username']):
print(proc.info) # Cannot access member "info" for type "Process"; Member "info" is unknown We would need to update the type stubs accordingly: https://github.com/python/typeshed/blob/e347af1d59ed46478a788ed60fd02096fce26edd/stubs/psutil/psutil/__init__.pyi#L158 |
related: python/typeshed#10195, giampaolo#2260; giampaolo#2260 (comment) Signed-off-by: Matthew Hoffman <matthew@protopia.ai>
Oh, closing in favor of #2267 |
Refs python/typeshed#10195
Summary
Description
Right now
.info
attribute is only set duringprocess_iter
, which is not quite correct.This results in
AttributeError
when using regularProcess
:I propose using
None
default for cases when it is not created usingprocess_iter
.This way it will simplify typing of
Process
for us.