This is an archive of the discontinued LLVM Phabricator instance.

[NFC] Convert openmp/runtime/tools/summarizeStats.py to python 3 syntax
Needs ReviewPublic

Authored by thieta on Feb 9 2023, 11:37 PM.

Details

Reviewers
jdoerfert
Summary

I found a few python scripts still using python 2 syntax in the tree.

This has been converted with 2to3 and the changes seems sane, but
I don't know how to use this script so if someone knows how to test
it, that would probably be good to run.

Diff Detail

Event Timeline

thieta created this revision.Feb 9 2023, 11:37 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 9 2023, 11:37 PM
thieta requested review of this revision.Feb 9 2023, 11:37 PM
Herald added a project: Restricted Project. · View Herald Transcript

Some extra call to list are correct wrt py2/py3 compat but are actually not needed, let's not introduce them at all.

openmp/runtime/tools/summarizeStats.py
175

I think this list call here is actually not needed.

195

same here

209

here I'm unsure.

217

not needed

230

not neeed

306

not needed

thieta updated this revision to Diff 497221.Feb 14 2023, 12:07 AM
thieta marked 6 inline comments as done.

Removed unecessary lists

Thanks for the review - removed those lists(). Wonder why 2to3 is so aggressive with inserting them? anyway - it seems to parse fine afterwards. but since I don't know the files this should be executed on it's hard for me to test the functionallity.

Are you good with this now @serge-sans-paille ?

jlpeyton added inline comments.
openmp/runtime/tools/summarizeStats.py
306

I do think this list() is necessary because the del data[key] line may change the size of the dictionary during iteration.

@thieta ACK once you fix the issue spotted by@jlpeyton.

openmp/runtime/tools/summarizeStats.py
306

Correct! my bad, thanks @jlpeyton for spotting this.