This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: bug in 2to3 dealing with "print FOO," followed by "sys.stdout.write('')"
Type: behavior Stage: resolved
Components: 2to3 (2.x to 3.x conversion tool) Versions: Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: wont fix
Dependencies: Superseder: Close 2to3 issues and list them here
View: 45544
Assigned To: Nosy List: benjamin.peterson, eric.araujo, gmattbond, trentm
Priority: normal Keywords: patch

Created on 2010-02-27 23:08 by trentm, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
fix8029.patch gmattbond, 2010-04-08 03:59 patch for fix_print and test_fixers to fix issue 8029 review
Messages (3)
msg100194 - (view) Author: Trent Mick (trentm) * (Python committer) Date: 2010-02-27 23:08
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/
msg102590 - (view) Author: Matt Bond (gmattbond) Date: 2010-04-08 03:59
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.
msg220666 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-06-15 19:34
@Benjamin could you review the patch please.
History
Date User Action Args
2022-04-11 14:56:58adminsetgithub: 52277
2021-10-20 23:03:20iritkatrielsetstatus: open -> closed
superseder: Close 2to3 issues and list them here
resolution: wont fix
stage: resolved
2019-03-15 23:16:35BreamoreBoysetnosy: - BreamoreBoy
2014-06-15 19:34:12BreamoreBoysetversions: + Python 2.7, Python 3.4, Python 3.5
nosy: + BreamoreBoy

messages: + msg220666

type: behavior
2010-04-08 03:59:10gmattbondsetfiles: + fix8029.patch

nosy: + gmattbond
messages: + msg102590

keywords: + patch
2010-02-28 15:15:04r.david.murraysetnosy: + benjamin.peterson
2010-02-28 05:24:53eric.araujosetnosy: + eric.araujo
2010-02-27 23:08:40trentmcreate