From 709d0cc33e7ac5c2029bca17ee2e4b0e4b1df55d Mon Sep 17 00:00:00 2001 From: INADA Naoki Date: Tue, 31 May 2011 15:40:11 +0900 Subject: [PATCH] Revert "(python) Change error message for unicode is passed but no encoding is" This reverts commit bd73742552cf16592662a7ec5ba3608888081131. --- python/ChangeLog.rst | 10 ++++++++++ python/msgpack/_msgpack.pyx | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/python/ChangeLog.rst b/python/ChangeLog.rst index 75e86b27..a0aae257 100644 --- a/python/ChangeLog.rst +++ b/python/ChangeLog.rst @@ -1,3 +1,13 @@ +0.1.10 +====== +:release date: NOT RELEASED YET + +New feature +----------- +* Add ``encoding`` and ``unicode_erros`` option to packer and unpacker. + When this option is specified, (un)packs unicode object instead of bytes. + This enables using msgpack as a replacement of json. + 0.1.9 ====== :release date: 2011-01-29 diff --git a/python/msgpack/_msgpack.pyx b/python/msgpack/_msgpack.pyx index 14bc9d77..443cbd75 100644 --- a/python/msgpack/_msgpack.pyx +++ b/python/msgpack/_msgpack.pyx @@ -120,7 +120,7 @@ cdef class Packer(object): ret = msgpack_pack_raw_body(&self.pk, rawval, len(o)) elif PyUnicode_Check(o): if not self.encoding: - raise TypeError("Can't pack unicode object: No encoding is specified") + raise TypeError("Can't encode utf-8 no encoding is specified") o = PyUnicode_AsEncodedString(o, self.encoding, self.unicode_errors) rawval = o ret = msgpack_pack_raw(&self.pk, len(o))