-
-
Notifications
You must be signed in to change notification settings - Fork 11k
print() is a function in Python 3 #7409
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
Conversation
|
Thanks @cclauss for your contribution. But things are not so easy, because some people have python2 and others python3 as default. The most trivial way to fix this would be to change the shebang line to use python2 explicitly. #!/usr/bin/python2Alternatively, and more flexibly, you can add the following line to the beginning of the file from __future__ import print_functionwhich will make print a function in python2 and make both python2 and python3 happy. (At least as far as I can see in the case of helper.py, because it is very simple and does not do any sophisticated string handling, so there should not be any unicode issues.) As for the license: I agree that it's a trivial change. You need to add a single line containing Since it's a tiny pr, feel free to just amend your previous commit and force-push. |
|
Sorry for the lengthy explanation, @cclauss; of course you know about print_function :-) |
|
Actually things are so easy because this PR already works as expected on both Python 2 and on Python 3. The future import is only required for print statements that contain a comma or that will need a parameter like end= or file=. With just 442 days left until the end of life of Python 2, it would be a mistake to put a Python 2-only shebang line on this file. The goal of this PR is to allow this script to run on both Python 2 and Python 3, not to force it to run on Python 2 only. Many Linux distros now ship with Python 3 only. We do not want to force users to install legacy Python just to run the fuzzer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The future import is only required for print statements that contain a comma or that will need a parameter like end= or file=
Thanks for the explanation, I did not know that yet. In that case, you might as well omit the future import. And I agree that it's due time for python3 :-).
I'll approve as soon as the cla-bot has been pacified.
|
Ah, I'm stupid: this always worked, because |
|
Correct. That is why the commas are an issue because they form a tuple. |
@jasnell @refack This change was merged into upstream in openssl/openssl#7409
The CLA is only required for non-trivial changes but this is a trivial change.
Discovered via #7410 @ https://travis-ci.org/openssl/openssl/jobs/442003489#L440