diff options
| author | Inada Naoki <songofacandy@gmail.com> | 2019-12-03 21:18:17 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-12-03 21:18:17 +0900 |
| commit | 2c6668941f72e3bcb797d096437683eca4e3caf5 (patch) | |
| tree | e10aed39d7ae7bd560992d142a94ccb0a1cf074c /msgpack/unpack.h | |
| parent | e419cd8e2db6b8226bd681b52b6acfe70d8e6a86 (diff) | |
| download | msgpack-python-2c6668941f72e3bcb797d096437683eca4e3caf5.tar.gz | |
Intern map keys (#381)
Fixes #372.
Diffstat (limited to 'msgpack/unpack.h')
| -rw-r--r-- | msgpack/unpack.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/msgpack/unpack.h b/msgpack/unpack.h index 539a991..ead5095 100644 --- a/msgpack/unpack.h +++ b/msgpack/unpack.h @@ -192,6 +192,9 @@ static inline int unpack_callback_map_item(unpack_user* u, unsigned int current, PyErr_Format(PyExc_ValueError, "%.100s is not allowed for map key", Py_TYPE(k)->tp_name); return -1; } + if (PyUnicode_CheckExact(k)) { + PyUnicode_InternInPlace(&k); + } if (u->has_pairs_hook) { msgpack_unpack_object item = PyTuple_Pack(2, k, v); if (!item) |
