STINNER Victor victor.stin...@haypocalc.com added the comment:
I commited my patch (with a new test, iso-8859-1:replace) to 2.7: r84621. I
will no backport to 2.6 because this branch now only accept security fixes.
--
resolution: - fixed
status: open - closed
Changes by Éric Araujo mer...@netwok.org:
--
nosy: +lemburg
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4947
___
___
Python-bugs-list mailing
STINNER Victor victor.stin...@haypocalc.com added the comment:
Attached patch fixes this old and annoying issue. The issue only concerns
sys.std* files, because Python only set the encoding and errors attributes for
these files.
--
keywords: +patch
versions: +Python 2.7
Added file:
STINNER Victor victor.stin...@haypocalc.com added the comment:
Oh, I forgot to write that my patch uses also the errors attribute. Update the
patch to add tests on errors: file_write-2.7-v2.patch.
--
Added file: http://bugs.python.org/file18522/file_write-2.7-v2.patch
Changes by STINNER Victor victor.stin...@haypocalc.com:
Removed file: http://bugs.python.org/file18521/file_write-2.7.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4947
___
Antoine Pitrou pit...@free.fr added the comment:
Your patch threatens to break compatibility. I think it would be better to
simply change the encoding and errors attributes of standard streams.
--
___
Python tracker rep...@bugs.python.org
STINNER Victor victor.stin...@haypocalc.com added the comment:
Your patch threatens to break compatibility
Yes it does. But I think that nobody relies on this bug. If your terminal uses
something that utf-8, you will see strange characters if you write something
else than ascii characters. I
STINNER Victor victor.stin...@haypocalc.com added the comment:
3rd version of the patch: accept character buffer objects without reencoding
them. Add also tests on character buffer objects.
--
Added file: http://bugs.python.org/file18524/file_write-2.7-v3.patch
Changes by STINNER Victor victor.stin...@haypocalc.com:
Removed file: http://bugs.python.org/file18522/file_write-2.7-v2.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4947
___
Changes by Éric Araujo mer...@netwok.org:
--
nosy: +haypo
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4947
___
___
Python-bugs-list mailing list
Changes by Terry J. Reedy tjre...@udel.edu:
--
versions: -Python 2.4, Python 2.5
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4947
___
___
Changes by Sridhar Ratnakumar sridh...@activestate.com:
--
nosy: +srid
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4947
___
___
Python-bugs-list
Changes by Chris Rebert pyb...@rebertia.com:
--
nosy: +cvrebert
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4947
___
___
Python-bugs-list
Changes by Ezio Melotti ezio.melo...@gmail.com:
--
nosy: +ezio.melotti
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4947
___
___
Python-bugs-list
Changes by Denilson Figueiredo de Sá denilso...@gmail.com:
--
nosy: +denilsonsa
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4947
___
___
Jan Kaliszewski z...@chopin.edu.pl added the comment:
The matter had been discussed (and not once...), IMO without
satisfactory conclusion -- see:
* http://bugs.python.org/issue612627 (the feature added)
* http://bugs.python.org/issue1214889 (another feature rejected)
*
Jan Kaliszewski z...@chopin.edu.pl added the comment:
PS. The main problem is not a lack of feature but that inconsistency,
and that's not documented if File type docs:
print my_file, my_unicode # - is encoded with my_file.encoding
my_file.write(my_unicode) # - is encoded with
Jan Kaliszewski z...@chopin.edu.pl added the comment:
s / if File / in File
s / -- works # - is encoded with my_file.encoding / # - is encoded
with sys.stdout.encoding
(sorry, too little sleep)
--
___
Python tracker rep...@bugs.python.org
Changes by Jan Kaliszewski z...@chopin.edu.pl:
--
assignee: - georg.brandl
components: +Documentation
nosy: +georg.brandl
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4947
___
Changes by Qiangning Hong hon...@gmail.com:
--
nosy: +hongqn
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4947
___
___
Python-bugs-list mailing
New submission from Steven D'Aprano st...@pearwood.info:
Documentation for files states that when writing to a file, unicode
strings are converted to byte strings using the encoding specified by
file.encoding.
http://docs.python.org/library/stdtypes.html#file.encoding
sys.stdout is a file,
Gabriel Genellina gagsl-...@yahoo.com.ar added the comment:
It probably uses sys.getdefaultencoding() instead.
That would be wrong too, according to the cited documentation.
file.encoding is a read only attribute; it can be set in C code using
PyFile_SetEncoding. Apart from its definition in
22 matches
Mail list logo