[Python-checkins] r81456 - in python/branches/release26-maint: Lib/test/test_multibytecodec.py Misc/NEWS Modules/cjkcodecs/multibytecodec.c
victor.stinner
python-checkins at python.org
Sat May 22 00:55:31 CEST 2010
Author: victor.stinner
Date: Sat May 22 00:55:31 2010
New Revision: 81456
Log:
Merged revisions 81454 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r81454 | victor.stinner | 2010-05-22 00:50:28 +0200 (sam., 22 mai 2010) | 3 lines
Issue #5640: Fix Shift-JIS incremental encoder for error handlers different
than strict
........
Modified:
python/branches/release26-maint/ (props changed)
python/branches/release26-maint/Lib/test/test_multibytecodec.py
python/branches/release26-maint/Misc/NEWS
python/branches/release26-maint/Modules/cjkcodecs/multibytecodec.c
Modified: python/branches/release26-maint/Lib/test/test_multibytecodec.py
==============================================================================
--- python/branches/release26-maint/Lib/test/test_multibytecodec.py (original)
+++ python/branches/release26-maint/Lib/test/test_multibytecodec.py Sat May 22 00:55:31 2010
@@ -108,6 +108,10 @@
self.assertRaises(UnicodeEncodeError, encoder.encode, u'\u0123')
self.assertEqual(encoder.encode(u'', True), '\xa9\xdc')
+ def test_issue5640(self):
+ encoder = codecs.getincrementalencoder('shift-jis')('backslashreplace')
+ self.assertEqual(encoder.encode(u'\xff'), b'\\xff')
+ self.assertEqual(encoder.encode(u'\n'), b'\n')
class Test_IncrementalDecoder(unittest.TestCase):
Modified: python/branches/release26-maint/Misc/NEWS
==============================================================================
--- python/branches/release26-maint/Misc/NEWS (original)
+++ python/branches/release26-maint/Misc/NEWS Sat May 22 00:55:31 2010
@@ -55,6 +55,9 @@
Library
-------
+- Issue #5640: Fix Shift-JIS incremental encoder for error handlers different
+ than strict
+
- Issue #8782: Add a trailing newline in linecache.updatecache to the last line
of files without one.
Modified: python/branches/release26-maint/Modules/cjkcodecs/multibytecodec.c
==============================================================================
--- python/branches/release26-maint/Modules/cjkcodecs/multibytecodec.c (original)
+++ python/branches/release26-maint/Modules/cjkcodecs/multibytecodec.c Sat May 22 00:55:31 2010
@@ -498,7 +498,6 @@
outleft = (Py_ssize_t)(buf.outbuf_end - buf.outbuf);
r = codec->encode(state, codec->config, &buf.inbuf, inleft,
&buf.outbuf, outleft, flags);
- *data = buf.inbuf;
if ((r == 0) || (r == MBERR_TOOFEW && !(flags & MBENC_FLUSH)))
break;
else if (multibytecodec_encerror(codec, state, &buf, errors,r))
@@ -528,6 +527,7 @@
if (_PyString_Resize(&buf.outobj, finalsize) == -1)
goto errorexit;
+ *data = buf.inbuf;
Py_XDECREF(buf.excobj);
return buf.outobj;
More information about the Python-checkins
mailing list