diff options
| author | Brian Gesiak <modocache@gmail.com> | 2017-08-11 17:56:57 +0000 |
|---|---|---|
| committer | Brian Gesiak <modocache@gmail.com> | 2017-08-11 17:56:57 +0000 |
| commit | efd227f3c7ab1eda9d66816a3fcf0912781b76d8 (patch) | |
| tree | 88499a24a3c17ff32b8d71c6bfefae9da47db8d4 /llvm/tools/opt-viewer/optrecord.py | |
| parent | 976cedda26c29c600b786611efcc353bf9c50343 (diff) | |
| download | bcm5719-llvm-efd227f3c7ab1eda9d66816a3fcf0912781b76d8.tar.gz bcm5719-llvm-efd227f3c7ab1eda9d66816a3fcf0912781b76d8.zip | |
[opt-viewer] Use Python 3-compatible `intern()`
Summary:
In Python 2, `intern()` is a builtin function available to all programs.
In Python 3, it was moved into the `sys` module, available as
`sys.intern`. Import it such that, within `optrecord.py`, `intern()` is
available whether run using Python 2 or 3.
Test Plan:
Run `opt-viewer.py` using Python 3, confirm it no longer
encounters a runtime error when `intern()` is called.
Reviewers: anemet
Reviewed By: anemet
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D36622
llvm-svn: 310739
Diffstat (limited to 'llvm/tools/opt-viewer/optrecord.py')
| -rw-r--r-- | llvm/tools/opt-viewer/optrecord.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/tools/opt-viewer/optrecord.py b/llvm/tools/opt-viewer/optrecord.py index 3744c68af60..2bf0f356d85 100644 --- a/llvm/tools/opt-viewer/optrecord.py +++ b/llvm/tools/opt-viewer/optrecord.py @@ -17,6 +17,12 @@ import functools from multiprocessing import Lock import os, os.path import subprocess +try: + # The previously builtin function `intern()` was moved + # to the `sys` module in Python 3. + from sys import intern +except: + pass import optpmap |

