diff options
author | Serge Guelton <sguelton@quarkslab.com> | 2018-12-18 08:36:33 +0000 |
---|---|---|
committer | Serge Guelton <sguelton@quarkslab.com> | 2018-12-18 08:36:33 +0000 |
commit | c0ebe773cd0fb301474430205c69440f9915d5b0 (patch) | |
tree | 15c98a08b79b0dddbfeea4f95372771ba44d4dd1 /clang/utils/TestUtils/deep-stack.py | |
parent | 85833393d0e588f6d7613567db9c212236e3f0eb (diff) | |
download | bcm5719-llvm-c0ebe773cd0fb301474430205c69440f9915d5b0.tar.gz bcm5719-llvm-c0ebe773cd0fb301474430205c69440f9915d5b0.zip |
Portable Python script across Python version
Using from __future__ import print_function it is possible to have a compatible behavior of `print(...)` across Python version.
Differential Revision: https://reviews.llvm.org/D55213
llvm-svn: 349454
Diffstat (limited to 'clang/utils/TestUtils/deep-stack.py')
-rwxr-xr-x | clang/utils/TestUtils/deep-stack.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/clang/utils/TestUtils/deep-stack.py b/clang/utils/TestUtils/deep-stack.py index 1750a5fca03..8636efabec0 100755 --- a/clang/utils/TestUtils/deep-stack.py +++ b/clang/utils/TestUtils/deep-stack.py @@ -1,22 +1,23 @@ #!/usr/bin/env python +from __future__ import print_function def pcall(f, N): if N == 0: - print >>f, ' f(0)' + print(' f(0)', file=f) return - print >>f, ' f(' + print(' f(', file=f) pcall(f, N - 1) - print >>f, ' )' + print(' )', file=f) def main(): f = open('t.c','w') - print >>f, 'int f(int n) { return n; }' - print >>f, 'int t() {' - print >>f, ' return' + print('int f(int n) { return n; }', file=f) + print('int t() {', file=f) + print(' return', file=f) pcall(f, 10000) - print >>f, ' ;' - print >>f, '}' + print(' ;', file=f) + print('}', file=f) if __name__ == "__main__": import sys |