Merge branch 'release-0.4'

This commit is contained in:
INADA Naoki 2017-01-12 18:17:00 +09:00
commit 2481c64cf1
10 changed files with 52 additions and 51 deletions

View File

@ -183,7 +183,7 @@ Changes
0.2.4
=======
=====
:release date: 2012-12-22
Bugs fixed
@ -192,7 +192,7 @@ Bugs fixed
* Fix SEGV when object_hook or object_pairs_hook raise Exception. (#39)
0.2.3
=======
=====
:release date: 2012-12-11
Changes
@ -200,11 +200,11 @@ Changes
* Warn when use_list is not specified. It's default value will be changed in 0.3.
Bugs fixed
-----------
----------
* Can't pack subclass of dict.
0.2.2
=======
=====
:release date: 2012-09-21
Changes
@ -213,7 +213,7 @@ Changes
object in single precision format.
Bugs fixed
-----------
----------
* ``unpack()`` didn't restores gc state when it called with gc disabled.
``unpack()`` doesn't control gc now instead of restoring gc state collectly.
User can control gc state when gc cause performance issue.
@ -221,7 +221,7 @@ Bugs fixed
* ``Unpacker``'s ``read_size`` option didn't used.
0.2.1
=======
=====
:release date: 2012-08-20
Changes
@ -229,8 +229,8 @@ Changes
* Add ``max_buffer_size`` parameter to Unpacker. It limits internal buffer size
and allows unpack data from untrusted source safely.
* Unpacker's buffer reallocation algorithm is less greedy now. It cause perforamce
derease in rare case but memory efficient and don't allocate than ``max_buffer_size``.
* Unpacker's buffer reallocation algorithm is less greedy now. It cause performance
decrease in rare case but memory efficient and don't allocate than ``max_buffer_size``.
Bugs fixed
----------
@ -240,7 +240,7 @@ Bugs fixed
0.2.0
=======
=====
:release date: 2012-06-27
Changes
@ -255,16 +255,16 @@ Bugs fixed
0.1.13
=======
======
:release date: 2012-04-21
New
----
---
* Don't accept subtype of list and tuple as msgpack list. (Steeve Morin)
It allows customize how it serialized with ``default`` argument.
Bugs fixed
-----------
----------
* Fix wrong error message. (David Wolever)
* Fix memory leak while unpacking when ``object_hook`` or ``list_hook`` is used.
(Steeve Morin)
@ -276,21 +276,21 @@ Other changes
0.1.12
=======
======
:release date: 2011-12-27
Bugs fixed
-------------
----------
* Re-enable packs/unpacks removed at 0.1.11. It will be removed when 0.2 is released.
0.1.11
=======
======
:release date: 2011-12-26
Bugs fixed
-------------
----------
* Include test code for Python3 to sdist. (Johan Bergström)
* Fix compilation error on MSVC. (davidgaleano)
@ -308,7 +308,7 @@ New feature
0.1.9
======
=====
:release date: 2011-01-29
New feature
@ -322,16 +322,16 @@ Bugs fixed
* Add MemoryError check.
0.1.8
======
=====
:release date: 2011-01-10
New feature
------------
-----------
* Support ``loads`` and ``dumps`` aliases for API compatibility with
simplejson and pickle.
* Add *object_hook* and *list_hook* option to unpacker. It allows you to
hook unpacing mapping type and array type.
hook unpacking mapping type and array type.
* Add *default* option to packer. It allows you to pack unsupported types.
@ -343,13 +343,13 @@ Bugs fixed
0.1.7
======
=====
:release date: 2010-11-02
New feature
------------
-----------
* Add *object_hook* and *list_hook* option to unpacker. It allows you to
hook unpacing mapping type and array type.
hook unpacking mapping type and array type.
* Add *default* option to packer. It allows you to pack unsupported types.

View File

@ -1,6 +1,6 @@
=======================
======================
MessagePack for Python
=======================
======================
:author: INADA Naoki
:version: 0.4.6
@ -11,21 +11,22 @@ MessagePack for Python
What's this
------------
-----------
`MessagePack <http://msgpack.org/>`_ is a fast, compact binary serialization format, suitable for
similar data to JSON. This package provides CPython bindings for reading and
writing MessagePack data.
`MessagePack <http://msgpack.org/>`_ is an efficient binary serialization format.
It lets you exchange data among multiple languages like JSON.
But it's faster and smaller.
This package provides CPython bindings for reading and writing MessagePack data.
Install
---------
-------
::
$ pip install msgpack-python
PyPy
^^^^^
^^^^
msgpack-python provides pure python implementation. PyPy can use this.
@ -44,7 +45,7 @@ Community Edition or Express Edition can be used to build extension module.
How to use
-----------
----------
One-shot pack & unpack
^^^^^^^^^^^^^^^^^^^^^^
@ -134,7 +135,7 @@ It is also possible to pack/unpack custom data types. Here is an example for
key-value pairs.
Extended types
^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^
It is also possible to pack/unpack custom data types using the **ext** type.
@ -166,7 +167,7 @@ Advanced unpacking control
As an alternative to iteration, ``Unpacker`` objects provide ``unpack``,
``skip``, ``read_array_header`` and ``read_map_header`` methods. The former two
read an entire message from the stream, respectively deserialising and returning
read an entire message from the stream, respectively de-serialising and returning
the result, or ignoring it. The latter two methods return the number of elements
in the upcoming container, so that each element in an array, or key-value pair
in a map, can be unpacked or skipped individually.
@ -243,7 +244,7 @@ instead of `StopIteration`.
`StopIteration` is used for iterator protocol only.
Note about performance
------------------------
----------------------
GC
^^
@ -253,7 +254,7 @@ This means unpacking may cause useless GC.
You can use ``gc.disable()`` when unpacking large message.
use_list option
^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^
List is the default sequence type of Python.
But tuple is lighter than list.
You can use ``use_list=False`` while unpacking when performance is important.
@ -264,7 +265,7 @@ Another way to unpacking such object is using ``object_pairs_hook``.
Development
------------
-----------
Test
^^^^

View File

@ -28,7 +28,7 @@ test_script:
# only needed to support those cases.
# Note that you must use the environment variable %PYTHON% to refer to
# the interpreter you're using - Appveyor does not do anything special
# to put the Python evrsion you want to use on PATH.
# to put the Python version you want to use on PATH.
- "build.cmd %PYTHON%\\python.exe setup.py build_ext -i"
- "build.cmd %PYTHON%\\python.exe setup.py install"
- "%PYTHON%\\python.exe -c \"import sys; print(hex(sys.maxsize))\""

View File

@ -28,7 +28,7 @@ API reference
.. autoclass:: ExtType
exceptions
-----------
----------
These exceptions are accessible via `msgpack` package.
(For example, `msgpack.OutOfData` is shortcut for `msgpack.exceptions.OutOfData`)

View File

@ -1,5 +1,5 @@
msgpack document
==================
================
`MessagePack <http://msgpack.org>`_ is a efficient format for inter
language data exchange.

View File

@ -61,11 +61,11 @@ cdef class Packer(object):
:param bool use_single_float:
Use single precision float type for float. (default: False)
:param bool autoreset:
Reset buffer after each pack and return it's content as `bytes`. (default: True).
Reset buffer after each pack and return its content as `bytes`. (default: True).
If set this to false, use `bytes()` to get content and `.reset()` to clear buffer.
:param bool use_bin_type:
Use bin type introduced in msgpack spec 2.0 for bytes.
It also enable str8 type for unicode.
It also enables str8 type for unicode.
:param bool strict_types:
If set to true, types will be checked to be exact. Derived classes
from serializeable types will not be serialized and will be
@ -299,7 +299,7 @@ cdef class Packer(object):
"""
Pack *pairs* as msgpack map type.
*pairs* should sequence of pair.
*pairs* should be a sequence of pairs.
(`len(pairs)` and `for k, v in pairs:` should be supported.)
"""
cdef int ret = msgpack_pack_map(&self.pk, len(pairs))

View File

@ -272,7 +272,7 @@ cdef class Unpacker(object):
:param int max_buffer_size:
Limits size of data waiting unpacked. 0 means system's INT_MAX (default).
Raises `BufferFull` exception when it is insufficient.
You shoud set this parameter when unpacking data from untrusted source.
You should set this parameter when unpacking data from untrusted source.
:param int max_str_len:
Limits max length of str. (default: 2**31-1)

View File

@ -164,7 +164,7 @@ class Unpacker(object):
:param int max_buffer_size:
Limits size of data waiting unpacked. 0 means system's INT_MAX (default).
Raises `BufferFull` exception when it is insufficient.
You shoud set this parameter when unpacking data from untrusted source.
You should set this parameter when unpacking data from untrusted source.
:param int max_str_len:
Limits max length of str. (default: 2**31-1)
@ -214,7 +214,7 @@ class Unpacker(object):
self.file_like = file_like
self._feeding = False
#: array of bytes feeded.
#: array of bytes fed.
self._buffer = bytearray()
#: Which position we currently reads
self._buff_i = 0
@ -646,17 +646,17 @@ class Packer(object):
Convert user type to builtin type that Packer supports.
See also simplejson's document.
:param str encoding:
Convert unicode to bytes with this encoding. (default: 'utf-8')
Convert unicode to bytes with this encoding. (default: 'utf-8')
:param str unicode_errors:
Error handler for encoding unicode. (default: 'strict')
:param bool use_single_float:
Use single precision float type for float. (default: False)
:param bool autoreset:
Reset buffer after each pack and return it's content as `bytes`. (default: True).
Reset buffer after each pack and return its content as `bytes`. (default: True).
If set this to false, use `bytes()` to get content and `.reset()` to clear buffer.
:param bool use_bin_type:
Use bin type introduced in msgpack spec 2.0 for bytes.
It also enable str8 type for unicode.
It also enables str8 type for unicode.
:param bool strict_types:
If set to true, types will be checked to be exact. Derived classes
from serializeable types will not be serialized and will be

View File

@ -42,7 +42,7 @@ def test_extension_type():
typecode = 123 # application specific typecode
data = obj.tostring()
return ExtType(typecode, data)
raise TypeError("Unknwon type object %r" % (obj,))
raise TypeError("Unknown type object %r" % (obj,))
def ext_hook(code, data):
print('ext_hook called', code, data)

View File

@ -130,7 +130,7 @@ def testMapSize(sizes=[0, 5, 50, 1000]):
class odict(dict):
'''Reimplement OrderedDict to run test on Python 2.6'''
"""Reimplement OrderedDict to run test on Python 2.6"""
def __init__(self, seq):
self._seq = seq
dict.__init__(self, seq)