Skip to content

raw_input breaking with multiple futurize passes #427

Closed
@ghost

Description

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:

from builtins import input
test = input("Input: ")

Pass 2: Running futurize.exe test.py --both-stages -w again converts this to:

from builtins import input
test = eval(input("Input: "))

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.

Activity

guyer

guyer commented on May 9, 2019

@guyer

👍
Encountered when applying fixers atomically and then calling futurize --unicode-literals.

added and removed on Jul 9, 2019
added a commit that references this issue on Jan 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @jmadler@guyer

      Issue actions

        raw_input breaking with multiple futurize passes · Issue #427 · PythonCharmers/python-future