summaryrefslogtreecommitdiff
path: root/msgpack/fallback.py
diff options
context:
space:
mode:
authorInada Naoki <songofacandy@gmail.com>2019-12-03 21:18:17 +0900
committerGitHub <noreply@github.com>2019-12-03 21:18:17 +0900
commit2c6668941f72e3bcb797d096437683eca4e3caf5 (patch)
treee10aed39d7ae7bd560992d142a94ccb0a1cf074c /msgpack/fallback.py
parente419cd8e2db6b8226bd681b52b6acfe70d8e6a86 (diff)
downloadmsgpack-python-2c6668941f72e3bcb797d096437683eca4e3caf5.tar.gz
Intern map keys (#381)
Fixes #372.
Diffstat (limited to 'msgpack/fallback.py')
-rw-r--r--msgpack/fallback.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/msgpack/fallback.py b/msgpack/fallback.py
index 9e31213..9a48b71 100644
--- a/msgpack/fallback.py
+++ b/msgpack/fallback.py
@@ -644,6 +644,8 @@ class Unpacker(object):
key = self._unpack(EX_CONSTRUCT)
if self._strict_map_key and type(key) not in (unicode, bytes):
raise ValueError("%s is not allowed for map key" % str(type(key)))
+ if not PY2 and type(key) is str:
+ key = sys.intern(key)
ret[key] = self._unpack(EX_CONSTRUCT)
if self._object_hook is not None:
ret = self._object_hook(ret)