[New-bugs-announce] [issue12434] Strengthen 2.7 io types warning
Terry J. Reedy
report at bugs.python.org
Tue Jun 28 21:22:58 CEST 2011
New submission from Terry J. Reedy <tjreedy at udel.edu>:
Trying 3.2 code with 2.7, I got this (greatly simplified):
from __future__ import print_function
from io import StringIO
print('hello world', file=StringIO())
TypeError: string argument expected, got 'str'
(StringIO.StringIO works fine, of course.)
This was initially confusing. Suggestion: after
"Note Since this module has been designed primarily for Python 3.x, you have to be aware that all uses of “bytes” in this document refer to the str type (of which bytes is an alias), and all uses of “text” refer to the unicode type. "
'String' in exception messages may also mean the unicode type."
assignee: docs at python
nosy: docs at python, terry.reedy
stage: needs patch
title: Strengthen 2.7 io types warning
versions: Python 2.7
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce