Part of D42712 that fixes --verbose (sys is not imported) of utils/update_{,llc_}test_checks.py
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Adding @modocache as reviewer, who has been responsible for making the opt-viewer tools Py2+Py3 compatible. The changes look sensible to me, but the vast majority of the Python I've written for a long time has been Py3.
sys is missing so without the revision, --verbose will complain the name is undefined
Mostly looks good, but I had one suggestion!
utils/UpdateTestChecks/common.py | ||
---|---|---|
41 ↗ | (On Diff #131910) | I think you can call decode regardless. For example, the following code works on both Python 2 and 3: from __future__ import print_function import subprocess out = subprocess.check_output(['ls']).decode() print(out) Here it is in an online Python 2 and Python 3 interpreter. (I don't think there's much overhead to doing so on Python 2, but if you're worried about that it might be worth looking into.) |
In Python 2, str.decode returns unicode. I just want to ensure everything is str in both Python 2 and Python 3.
Oops, sorry, I should have accepted this revision along with my last comment. Thanks for making this change!