Skip to content
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

bug in 2to3 dealing with "print FOO," followed by "sys.stdout.write('')" #52277

Closed
trentm mannequin opened this issue Feb 27, 2010 · 3 comments
Closed

bug in 2to3 dealing with "print FOO," followed by "sys.stdout.write('')" #52277

trentm mannequin opened this issue Feb 27, 2010 · 3 comments
Labels
topic-2to3 type-bug An unexpected behavior, bug, or error

Comments

@trentm
Copy link
Mannequin

trentm mannequin commented Feb 27, 2010

BPO 8029
Nosy @benjaminp, @merwok
Superseder
  • bpo-45544: Close 2to3 issues and list them here
  • Files
  • fix8029.patch: patch for fix_print and test_fixers to fix issue 8029
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2021-10-20.23:03:20.590>
    created_at = <Date 2010-02-27.23:08:40.833>
    labels = ['type-bug', 'expert-2to3']
    title = 'bug in 2to3 dealing with "print FOO," followed by "sys.stdout.write(\'\')"'
    updated_at = <Date 2021-10-20.23:03:20.590>
    user = 'https://bugs.python.org/trentm'

    bugs.python.org fields:

    activity = <Date 2021-10-20.23:03:20.590>
    actor = 'iritkatriel'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-10-20.23:03:20.590>
    closer = 'iritkatriel'
    components = ['2to3 (2.x to 3.x conversion tool)']
    creation = <Date 2010-02-27.23:08:40.833>
    creator = 'trentm'
    dependencies = []
    files = ['16812']
    hgrepos = []
    issue_num = 8029
    keywords = ['patch']
    message_count = 3.0
    messages = ['100194', '102590', '220666']
    nosy_count = 4.0
    nosy_names = ['benjamin.peterson', 'trentm', 'eric.araujo', 'gmattbond']
    pr_nums = []
    priority = 'normal'
    resolution = 'wont fix'
    stage = 'resolved'
    status = 'closed'
    superseder = '45544'
    type = 'behavior'
    url = 'https://bugs.python.org/issue8029'
    versions = ['Python 2.7', 'Python 3.4', 'Python 3.5']

    @trentm
    Copy link
    Mannequin Author

    trentm mannequin commented Feb 27, 2010

    According to http://docs.python.org/reference/simple_stmts.html#the-print-statement the following with result in the print statement NOT printing a trailing space:

        import sys
        print u"ASD",; sys.stdout.write(u"")

    However, 2to3 currently translates this to:

        import sys
        print("ASD", end=' '); sys.stdout.write("")

    It *should* translate to:

        import sys
        print("ASD", end='')

    You can also see the discussion of this on this lib3to2 bug report:
    http://bitbucket.org/amentajo/lib3to2/issue/13/print-3-end-isnt-translated-properly
    and translation of this between 2to3 and 3to2 here:
    http://pythontranslationparty.appspot.com/6004/

    @trentm trentm mannequin added the topic-2to3 label Feb 27, 2010
    @gmattbond
    Copy link
    Mannequin

    gmattbond mannequin commented Apr 8, 2010

    I've attached a patch that fixes this particular idiom as well as a problem with the handling of bare 'print' statements. It also includes updated tests for these issues.

    @BreamoreBoy
    Copy link
    Mannequin

    BreamoreBoy mannequin commented Jun 15, 2014

    @benjamin could you review the patch please.

    @BreamoreBoy BreamoreBoy mannequin added the type-bug An unexpected behavior, bug, or error label Jun 15, 2014
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    topic-2to3 type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant