-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-23698] Remove raw_input() from Python 2 #21702
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
Signed-off-by: cclauss <[email protected]>
| sys.exit(-1) | ||
|
|
||
| if sys.version < '3': | ||
| input = raw_input |
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.
If we can do the opposite, the diff should be only 4 lines though
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.
Two downsides to that approach:
- We stick with the legacy Python syntax which will unnecessarily complicate our lives (and our diffs) in 18 months
- This approach reduces the linting errors from 10 down to just 2.
HyukjinKwon
left a comment
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.
Are you actually able to roughly check if those scripts can be ran against Python 3?
|
Tested data entry... Test: 'y' or 'Y' caused a loop while all others including "", "yes", "n", "N", "0", "1", "." caused an exit() In ./dev/create-release/releaseutils.py just after _yesOrNoPrompt() I added the lines: Test: 'y' caused an exit() while all others including "", "Y", "yes", "n", "N", "0", "1", "." caused a loop |
|
ok to test |
HyukjinKwon
left a comment
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.
LGTM
|
Test build #92570 has finished for PR 21702 at commit
|
|
Merged to master |
Signed-off-by: cclauss [email protected]
What changes were proposed in this pull request?
Humans will be able to enter text in Python 3 prompts which they can not do today.
The Python builtin raw_input() was removed in Python 3 in favor of input(). This PR does the same thing in Python 2.
How was this patch tested?
(Please explain how this patch was tested. E.g. unit tests, integration tests, manual tests)
(If this patch involves UI changes, please attach a screenshot; otherwise, remove this)
flake8 testing
Please review http://spark.apache.org/contributing.html before opening a pull request.