-
Notifications
You must be signed in to change notification settings - Fork 295
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
raw_input breaking with multiple futurize passes #427
Labels
Comments
👍 |
guyer
added a commit
to guyer/fipy
that referenced
this issue
May 9, 2019
Undoes changes made in 98af1a6. If not careful, `futurize` converts `raw_input()` into `input()`, and then into `eval(input())`, which is VeryBad\TM. See PythonCharmers/python-future#427
guyer
added a commit
to usnistgov/fipy
that referenced
this issue
May 10, 2019
* futurize --fix lib2to3.fixes.fix_except * futurize_doctests lib2to3.fixes.fix_except * futurize --fix lib2to3.fixes.fix_exec * futurize --fix lib2to3.fixes.fix_funcattrs * futurize --fix lib2to3.fixes.fix_has_key * futurize --fix lib2to3.fixes.fix_idioms * futurize_doctests lib2to3.fixes.fix_idioms * futurize_doctests lib2to3.fixes.fix_numliterals * futurize --fix lib2to3.fixes.fix_reduce * futurize --fix lib2to3.fixes.fix_repr * futurize --fix lib2to3.fixes.fix_types * futurize --fix lib2to3.fixes.fix_ws_comma * futurize_doctests lib2to3.fixes.fix_ws_comma * futurize --fix libfuturize.fixes.fix_absolute_import * futurize --fix libfuturize.fixes.fix_print_with_import * futurize --fix libfuturize.fixes.fix_raise * 2to3 --doctests_only --fix import * 2to3 --doctests_only --fix print * Import print_function where needed for doctests * Scrub usage of 2to3 * Install libglu in test apt-get installations not shared between different job environments * futurize --fix lib2to3.fixes.fix_dict * futurize_doctests lib2to3.fixes.fix_dict * futurize --fix lib2to3.fixes.fix_map * futurize --fix lib2to3.fixes.fix_nonzero * futurize --fix lib2to3.fixes.fix_raw_input * futurize_doctests lib2to3.fixes.fix_raw_input * futurize --fix lib2to3.fixes.fix_zip * Alias __nonzero__ to __bool__ Recommended by https://portingguide.readthedocs.io/en/latest/core-obj-misc.html#customizing-truthiness-bool and get weird errors without it * futurize --fix libfuturize.fixes.fix_division_safe * futurize --fix libfuturize.fixes.fix_future_builtins * futurize_doctests libfuturize.fixes.fix_future_builtins * futurize --fix libfuturize.fixes.fix_future_standard_library * futurize --fix libfuturize.fixes.fix_object * futurize_doctests libfuturize.fixes.fix_xrange_with_import * futurize --fix libpasteurize.fixes.fix_newstyle * Specify what to futurizerize * Purge past.utils.old_div We always(?) know whether we're doing float or integer division * Import future * Fix fixes to future_builtins Fix native string typechecking Fix range as list * Pervasively switch to unicode_literals Resolves many inconsistent appearances of strings as sometimes unicode and sometimes not. Requires conversion of `__all__` entries because ["Python 2 names are strings, not unicode values"](https://stackoverflow.com/a/19913680/2019542) Force unit to render as native string Force .gz filenames to be native * Convert raw latex docstrings to double-backslashed latex docstrings Python 2 has [no way to represent `\u` in a raw unicode string literal](https://matplotlib.org/2.1.1/devel/portable_code.html#the-dreaded-u-escapes) * Reformat numpy output before run Reformatting was done too late to be effective * Discard futurization of versioneer * Ping the build * Fix typo * Strip whitespace * Undo bad integer division * Nativize command strings * Define _nativize_all locally in test command * Add future package to Nix build * Fix latex backslashing * Document need for `numpydoc` * Remove redundant type * Convert leading tabs to spaces * Add future package to Nix build * Remove sphinxext file that was never used(?) * Credit @pya and @woodscn * Comment on plans for Py3k development * Remove conversion scripts No longer needed now that conversion is done * Remove gratuitous (and dangerous) `eval` Undoes changes made in 98af1a6. If not careful, `futurize` converts `raw_input()` into `input()`, and then into `eval(input())`, which is VeryBad\TM. See PythonCharmers/python-future#427 * Remove only_directive We weren't using it and it's been removed in Py3k * Remove backlash line continuation that suddenly stopped working * Fix more line continuations
guyer
added a commit
to usnistgov/steppyngstounes
that referenced
this issue
Jan 26, 2021
* futurize --fix lib2to3.fixes.fix_except * futurize_doctests lib2to3.fixes.fix_except * futurize --fix lib2to3.fixes.fix_exec * futurize --fix lib2to3.fixes.fix_funcattrs * futurize --fix lib2to3.fixes.fix_has_key * futurize --fix lib2to3.fixes.fix_idioms * futurize_doctests lib2to3.fixes.fix_idioms * futurize_doctests lib2to3.fixes.fix_numliterals * futurize --fix lib2to3.fixes.fix_reduce * futurize --fix lib2to3.fixes.fix_repr * futurize --fix lib2to3.fixes.fix_types * futurize --fix lib2to3.fixes.fix_ws_comma * futurize_doctests lib2to3.fixes.fix_ws_comma * futurize --fix libfuturize.fixes.fix_absolute_import * futurize --fix libfuturize.fixes.fix_print_with_import * futurize --fix libfuturize.fixes.fix_raise * 2to3 --doctests_only --fix import * 2to3 --doctests_only --fix print * Import print_function where needed for doctests * Scrub usage of 2to3 * Install libglu in test apt-get installations not shared between different job environments * futurize --fix lib2to3.fixes.fix_dict * futurize_doctests lib2to3.fixes.fix_dict * futurize --fix lib2to3.fixes.fix_map * futurize --fix lib2to3.fixes.fix_nonzero * futurize --fix lib2to3.fixes.fix_raw_input * futurize_doctests lib2to3.fixes.fix_raw_input * futurize --fix lib2to3.fixes.fix_zip * Alias __nonzero__ to __bool__ Recommended by https://portingguide.readthedocs.io/en/latest/core-obj-misc.html#customizing-truthiness-bool and get weird errors without it * futurize --fix libfuturize.fixes.fix_division_safe * futurize --fix libfuturize.fixes.fix_future_builtins * futurize_doctests libfuturize.fixes.fix_future_builtins * futurize --fix libfuturize.fixes.fix_future_standard_library * futurize --fix libfuturize.fixes.fix_object * futurize_doctests libfuturize.fixes.fix_xrange_with_import * futurize --fix libpasteurize.fixes.fix_newstyle * Specify what to futurizerize * Purge past.utils.old_div We always(?) know whether we're doing float or integer division * Import future * Fix fixes to future_builtins Fix native string typechecking Fix range as list * Pervasively switch to unicode_literals Resolves many inconsistent appearances of strings as sometimes unicode and sometimes not. Requires conversion of `__all__` entries because ["Python 2 names are strings, not unicode values"](https://stackoverflow.com/a/19913680/2019542) Force unit to render as native string Force .gz filenames to be native * Convert raw latex docstrings to double-backslashed latex docstrings Python 2 has [no way to represent `\u` in a raw unicode string literal](https://matplotlib.org/2.1.1/devel/portable_code.html#the-dreaded-u-escapes) * Reformat numpy output before run Reformatting was done too late to be effective * Discard futurization of versioneer * Ping the build * Fix typo * Strip whitespace * Undo bad integer division * Nativize command strings * Define _nativize_all locally in test command * Add future package to Nix build * Fix latex backslashing * Document need for `numpydoc` * Remove redundant type * Convert leading tabs to spaces * Add future package to Nix build * Remove sphinxext file that was never used(?) * Credit @pya and @woodscn * Comment on plans for Py3k development * Remove conversion scripts No longer needed now that conversion is done * Remove gratuitous (and dangerous) `eval` Undoes changes made in 98af1a61. If not careful, `futurize` converts `raw_input()` into `input()`, and then into `eval(input())`, which is VeryBad\TM. See PythonCharmers/python-future#427 * Remove only_directive We weren't using it and it's been removed in Py3k * Remove backlash line continuation that suddenly stopped working * Fix more line continuations
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Let's start with a python file (test.py) containing a single line:
test = raw_input("Test: ")
Pass 1: Running futurize.exe test.py --both-stages -w converts this to:
Pass 2: Running futurize.exe test.py --both-stages -w again converts this to:
The second pass is incorrect. The presence of "from builtins import input" should indicate that the bare input has already been corrected.
Note that --both-stages can be replaced with --fix lib2to3.fixes.fix_input --fix lib2to3.fixes.fix_raw_input --fix libfuturize.fixes.fix_future_builtins.
The text was updated successfully, but these errors were encountered: