[issue4618] print_function and unicode_literals don't work together
Benjamin Peterson benja...@python.org added the comment: Fixed in r73776. -- nosy: +benjamin.peterson resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4618 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4618] print_function and unicode_literals don't work together
Changes by Antoine Pitrou pit...@free.fr: -- priority: - high stage: - needs patch type: - behavior versions: +Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4618 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4618] print_function and unicode_literals don't work together
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4618 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4618] print_function and unicode_literals don't work together
Changes by John Szakmeister j...@szakmeister.net: -- nosy: +jszakmeister ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4618 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4618] print_function and unicode_literals don't work together
New submission from Jean-Paul Calderone [EMAIL PROTECTED]: Consider: [EMAIL PROTECTED]:~$ ~/Projects/python/branches/release26-maint/python Python 2.6+ (trunk:66997, Oct 23 2008, 16:02:09) [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2 Type help, copyright, credits or license for more information. def f(o): ... print type(o) ... f('foo') type 'str' from __future__ import unicode_literals f('foo') type 'unicode' from __future__ import print_function print('foo') foo from io import StringIO print('foo', file=StringIO()) Traceback (most recent call last): File stdin, line 1, in module File /home/exarkun/Projects/python/branches/release26-maint/Lib/io.py, line 1487, in write s.__class__.__name__) TypeError: can't write str to text stream StringIO().write('foo') 3 StringIO().write(b'foo') Traceback (most recent call last): File stdin, line 1, in module File /home/exarkun/Projects/python/branches/release26-maint/Lib/io.py, line 1487, in write s.__class__.__name__) TypeError: can't write str to text stream It seems the type of a literal string is `strĀ“ when it is an argument to the print function, even with the unicode_literals future import in effect. -- components: Interpreter Core messages: 77539 nosy: exarkun severity: normal status: open title: print_function and unicode_literals don't work together versions: Python 2.6 ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4618 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4618] print_function and unicode_literals don't work together
STINNER Victor [EMAIL PROTECTED] added the comment: The TypeError(can't write str to text stream) comes from the newline written by builtin_print(). Workaround: print(ufoo, end=u\n, file=StringIO()). -- nosy: +haypo ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4618 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com