Skip to content

Commit

Permalink
Fix Python 3 compatibility bug
Browse files Browse the repository at this point in the history
In Python 3 dict.keys() does not return a list. If you want to treat it
like a list you need to go list(dict.keys()). This change fixes issue
  • Loading branch information
randomascii committed Jul 20, 2017
1 parent e563000 commit c01b535
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bin/IdentifyChromeProcesses.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def main():
# to get. See crbug.com/614502 for how this happened.
# This should probably be deleted at some point, along with the declaration and
# initialization of lineByPid.
for pid in pathByBrowserPid.keys()[:]:
for pid in list(pathByBrowserPid.keys())[:]:
# Checking that there is only one entry (itself) in the list is important
# to avoid problems caused by Pid reuse that could cause one browser process
# to appear to be another browser process' parent.
Expand All @@ -172,7 +172,7 @@ def main():
del pidsByParent[pid]

print("Chrome PIDs by process type:\r")
for browserPid in pidsByParent.keys():
for browserPid in list(pidsByParent.keys()):
# I hit one trace where there was a crash-handler process that was the
# child of another crash-handler process, which caused this script to
# fail here. Avoiding the script crash with .get() seems sufficient.
Expand Down

0 comments on commit c01b535

Please sign in to comment.