Stop using raw_input for python3 compat
ClosedPublic

Authored by demon on Oct 27 2017, 5:15 PM.

Details

Reviewers
mmodell
Group Reviewers
Release-Engineering-Team
Commits
rMSCA53ea6b8de34e: Stop using raw_input for python3 compat
Patch without arc
git checkout -b D853 && curl -L https://phabricator.wikimedia.org/D853?download=true | git apply
Summary

Prefix input from builtins as _input() so it's easy to find after we move to py3

Diff Detail

Repository
rMSCA Scap
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
demon created this revision.Oct 27 2017, 5:15 PM
Restricted Application added a reviewer: mmodell. · View Herald TranscriptOct 27 2017, 5:15 PM
Restricted Application added a reviewer: Release-Engineering-Team. · View Herald Transcript
Restricted Application added a project: Release-Engineering-Team. · View Herald Transcript

why not do this:

from six.moves import input
mmodell added inline comments.Oct 27 2017, 5:57 PM
scap/utils.py
35

in python 2, the input function does not do what we want. It evaluates whatever you type as if you ran eval(raw_input(...)) ... in python 3, input behaves sanely and the eval behavior is gone. The sane thing to do is to use six.

mmodell requested changes to this revision.Oct 27 2017, 5:58 PM
This revision now requires changes to proceed.Oct 27 2017, 5:58 PM
demon added inline comments.Oct 27 2017, 6:25 PM
scap/utils.py
35

Was following a different guide. Will amend.

demon updated this revision to Diff 2249.Oct 27 2017, 6:28 PM
  • Swap builtins.input for six.moves.input
demon marked 2 inline comments as done.Oct 27 2017, 6:29 PM
mmodell accepted this revision.Oct 27 2017, 6:57 PM
This revision is now accepted and ready to land.Oct 27 2017, 6:57 PM
demon updated this revision to Diff 2257.Oct 27 2017, 7:03 PM

Rebased

This revision was automatically updated to reflect the committed changes.