Skip to content

Fix line-directive print errors on different python versions #7381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 12, 2017
Merged

Fix line-directive print errors on different python versions #7381

merged 1 commit into from
Feb 12, 2017

Conversation

hughbe
Copy link
Contributor

@hughbe hughbe commented Feb 10, 2017

Most Python files have

from __future__ import print_function

but this one doesn't, even though it has

print(map_line_from_source_file(source_file, source_line, target_file))

@hughbe
Copy link
Contributor Author

hughbe commented Feb 10, 2017

@swift-ci please smoke test

@hughbe hughbe merged commit 813b8e0 into swiftlang:master Feb 12, 2017
@hughbe hughbe deleted the line-directive-print branch February 12, 2017 02:02
@dabrahams
Copy link
Contributor

This broke the doctests, that you get by running the tool with no arguments:

**********************************************************************
File "/Users/Shared/dabrahams/s/swift-master/utils/line-directive", line 231, in __main__.run
Failed example:
    print output.replace(target1.name,'TARGET1-NAME').replace(target2.name,'TARGET2-NAME') + 'EOF'
Exception raised:
    Traceback (most recent call last):
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/doctest.py", line 1315, in __run
        compileflags, 1) in test.globs
      File "<doctest __main__.run[13]>", line 1
        print output.replace(target1.name,'TARGET1-NAME').replace(target2.name,'TARGET2-NAME') + 'EOF'
                   ^
    SyntaxError: invalid syntax
**********************************************************************
File "/Users/Shared/dabrahams/s/swift-master/utils/line-directive", line 247, in __main__.run
Failed example:
    print subprocess.check_output([__file__, 'foo.bar', '21', target1.name]),
Exception raised:
    Traceback (most recent call last):
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/doctest.py", line 1315, in __run
        compileflags, 1) in test.globs
      File "<doctest __main__.run[14]>", line 1
        print subprocess.check_output([__file__, 'foo.bar', '21', target1.name]),
                       ^
    SyntaxError: invalid syntax
**********************************************************************
File "/Users/Shared/dabrahams/s/swift-master/utils/line-directive", line 249, in __main__.run
Failed example:
    print subprocess.check_output([__file__, 'foo.bar', '8', target2.name]),
Exception raised:
    Traceback (most recent call last):
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/doctest.py", line 1315, in __run
        compileflags, 1) in test.globs
      File "<doctest __main__.run[15]>", line 1
        print subprocess.check_output([__file__, 'foo.bar', '8', target2.name]),
                       ^
    SyntaxError: invalid syntax
**********************************************************************
1 items had failures:
   3 of  16 in __main__.run
***Test Failed*** 3 failures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants