➜

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
标题: bug in 2to3 dealing with "print FOO," followed by "sys.stdout.write('')"
类型: behavior Stage: resolved
Components: 2to3 (2.x to 3.x conversion tool) Versions: Python 3.4, Python 3.5, Python 2.7
process
状态: closed Resolution: wont fix
Dependencies: 后续: Close 2to3 issues and list them here
View: 45544
分配给: 抄送列表: benjamin.peterson, eric.araujo, gmattbond, trentm
优先级: normal 关键字: patch

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

文件
文件名 上传时间 Description 编辑
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) 日期: 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) 日期: 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) * 日期: 2014-06-15 19:34
@Benjamin could you review the patch please.
历史
日期 用户 动作 参数
2022-04-11 14:56:58admin修改github: 52277
2021-10-20 23:03:20iritkatriel修改状态: open -> closed
后续: Close 2to3 issues and list them here
resolution: wont fix
stage: resolved
2019-03-15 23:16:35BreamoreBoy修改抄送: - BreamoreBoy
2014-06-15 19:34:12BreamoreBoy修改versions: + Python 2.7, Python 3.4, Python 3.5
抄送: + BreamoreBoy

消息: + msg220666

type: behavior
2010-04-08 03:59:10gmattbond修改文件: + fix8029.patch

抄送: + gmattbond
消息: + msg102590

keywords: + patch
2010-02-28 15:15:04r.david.murray修改抄送: + benjamin.peterson
2010-02-28 05:24:53eric.araujo修改抄送: + eric.araujo
2010-02-27 23:08:40trentm创建