Browse Source

Merge 3.4

pull/9921/head
Victor Stinner 11 years ago
parent
commit
8cc80f1d81
  1. 7
      Lib/test/multibytecodec_support.py
  2. 2
      Misc/NEWS
  3. 3
      Modules/cjkcodecs/multibytecodec.c

7
Lib/test/multibytecodec_support.py

@ -270,6 +270,13 @@ class TestBase:
self.assertEqual(ostream.getvalue(), self.tstring[0])
def test_streamwriter_reset_no_pending(self):
# Issue #23247: Calling reset() on a fresh StreamWriter instance
# (without pending data) must not crash
stream = BytesIO()
writer = self.writer(stream)
writer.reset()
class TestBase_Mapping(unittest.TestCase):
pass_enctest = []

2
Misc/NEWS

@ -169,6 +169,8 @@ Core and Builtins
Library
-------
- Issue #23247: Fix a crash in the StreamWriter.reset() of CJK codecs.
- Issue #24270: Add math.isclose() and cmath.isclose() functions as per PEP 485.
Contributed by Chris Barker and Tal Einat.

3
Modules/cjkcodecs/multibytecodec.c

@ -1685,6 +1685,9 @@ _multibytecodec_MultibyteStreamWriter_reset_impl(MultibyteStreamWriterObject *se
{
PyObject *pwrt;
if (!self->pending)
Py_RETURN_NONE;
pwrt = multibytecodec_encode(self->codec, &self->state,
self->pending, NULL, self->errors,
MBENC_FLUSH | MBENC_RESET);

Loading…
Cancel
Save