summaryrefslogtreecommitdiff
path: root/msgpack
diff options
context:
space:
mode:
authorInada Naoki <songofacandy@gmail.com>2019-12-05 21:34:10 +0900
committerGitHub <noreply@github.com>2019-12-05 21:34:10 +0900
commit7e9905bdfaecde83ddb1a4575e734a10b055fde9 (patch)
tree2b9900fcdf0b5b1986b024edb2802971399b8fb8 /msgpack
parentde320488ae494b85a03b60dd33f91b650033d775 (diff)
downloadmsgpack-python-7e9905bdfaecde83ddb1a4575e734a10b055fde9.tar.gz
Use new msgpack spec by default. (#386)
Diffstat (limited to 'msgpack')
-rw-r--r--msgpack/_packer.pyx6
-rw-r--r--msgpack/_unpacker.pyx16
-rw-r--r--msgpack/fallback.py20
3 files changed, 16 insertions, 26 deletions
diff --git a/msgpack/_packer.pyx b/msgpack/_packer.pyx
index f3bde3f..8cf3c05 100644
--- a/msgpack/_packer.pyx
+++ b/msgpack/_packer.pyx
@@ -80,9 +80,7 @@ cdef class Packer(object):
:param bool use_bin_type:
Use bin type introduced in msgpack spec 2.0 for bytes.
- It also enables str8 type for unicode.
- Current default value is false, but it will be changed to true
- in future version. You should specify it explicitly.
+ It also enables str8 type for unicode. (default: True)
:param bool strict_types:
If set to true, types will be checked to be exact. Derived classes
@@ -113,7 +111,7 @@ cdef class Packer(object):
self.pk.length = 0
def __init__(self, *, default=None, unicode_errors=None,
- bint use_single_float=False, bint autoreset=True, bint use_bin_type=False,
+ bint use_single_float=False, bint autoreset=True, bint use_bin_type=True,
bint strict_types=False):
self.use_float = use_single_float
self.strict_types = strict_types
diff --git a/msgpack/_unpacker.pyx b/msgpack/_unpacker.pyx
index 3a9d494..f10e99d 100644
--- a/msgpack/_unpacker.pyx
+++ b/msgpack/_unpacker.pyx
@@ -131,7 +131,7 @@ cdef inline int get_data_from_buffer(object obj,
def unpackb(object packed, *, object object_hook=None, object list_hook=None,
- bint use_list=True, bint raw=True, bint strict_map_key=False,
+ bint use_list=True, bint raw=False, bint strict_map_key=False,
unicode_errors=None,
object_pairs_hook=None, ext_hook=ExtType,
Py_ssize_t max_str_len=-1,
@@ -217,12 +217,8 @@ cdef class Unpacker(object):
Otherwise, unpack to Python tuple. (default: True)
:param bool raw:
- If true, unpack msgpack raw to Python bytes (default).
- Otherwise, unpack to Python str (or unicode on Python 2) by decoding
- with UTF-8 encoding (recommended).
- Currently, the default is true, but it will be changed to false in
- near future. So you must specify it explicitly for keeping backward
- compatibility.
+ If true, unpack msgpack raw to Python bytes.
+ Otherwise, unpack to Python str by decoding with UTF-8 encoding (default).
:param bool strict_map_key:
If true, only str or bytes are accepted for map (dict) keys.
@@ -268,13 +264,13 @@ cdef class Unpacker(object):
Example of streaming deserialize from file-like object::
- unpacker = Unpacker(file_like, raw=False, max_buffer_size=10*1024*1024)
+ unpacker = Unpacker(file_like, max_buffer_size=10*1024*1024)
for o in unpacker:
process(o)
Example of streaming deserialize from socket::
- unpacker = Unpacker(raw=False, max_buffer_size=10*1024*1024)
+ unpacker = Unpacker(max_buffer_size=10*1024*1024)
while True:
buf = sock.recv(1024**2)
if not buf:
@@ -309,7 +305,7 @@ cdef class Unpacker(object):
self.buf = NULL
def __init__(self, file_like=None, *, Py_ssize_t read_size=0,
- bint use_list=True, bint raw=True, bint strict_map_key=False,
+ bint use_list=True, bint raw=False, bint strict_map_key=False,
object object_hook=None, object object_pairs_hook=None, object list_hook=None,
unicode_errors=None, Py_ssize_t max_buffer_size=0,
object ext_hook=ExtType,
diff --git a/msgpack/fallback.py b/msgpack/fallback.py
index 9de3553..fa2f3a8 100644
--- a/msgpack/fallback.py
+++ b/msgpack/fallback.py
@@ -158,7 +158,7 @@ else:
class Unpacker(object):
"""Streaming unpacker.
- arguments:
+ Arguments:
:param file_like:
File-like object having `.read(n)` method.
@@ -172,12 +172,8 @@ class Unpacker(object):
Otherwise, unpack to Python tuple. (default: True)
:param bool raw:
- If true, unpack msgpack raw to Python bytes (default).
- Otherwise, unpack to Python str (or unicode on Python 2) by decoding
- with UTF-8 encoding (recommended).
- Currently, the default is true, but it will be changed to false in
- near future. So you must specify it explicitly for keeping backward
- compatibility.
+ If true, unpack msgpack raw to Python bytes.
+ Otherwise, unpack to Python str by decoding with UTF-8 encoding (default).
:param bool strict_map_key:
If true, only str or bytes are accepted for map (dict) keys.
@@ -226,13 +222,13 @@ class Unpacker(object):
Example of streaming deserialize from file-like object::
- unpacker = Unpacker(file_like, raw=False, max_buffer_size=10*1024*1024)
+ unpacker = Unpacker(file_like, max_buffer_size=10*1024*1024)
for o in unpacker:
process(o)
Example of streaming deserialize from socket::
- unpacker = Unpacker(raw=False, max_buffer_size=10*1024*1024)
+ unpacker = Unpacker(max_buffer_size=10*1024*1024)
while True:
buf = sock.recv(1024**2)
if not buf:
@@ -253,7 +249,7 @@ class Unpacker(object):
file_like=None,
read_size=0,
use_list=True,
- raw=True,
+ raw=False,
strict_map_key=False,
object_hook=None,
object_pairs_hook=None,
@@ -748,7 +744,7 @@ class Packer(object):
:param bool use_bin_type:
Use bin type introduced in msgpack spec 2.0 for bytes.
- It also enables str8 type for unicode.
+ It also enables str8 type for unicode. (default: True)
:param bool strict_types:
If set to true, types will be checked to be exact. Derived classes
@@ -769,7 +765,7 @@ class Packer(object):
unicode_errors=None,
use_single_float=False,
autoreset=True,
- use_bin_type=False,
+ use_bin_type=True,
strict_types=False,
):
self._strict_types = strict_types