File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -200,7 +200,7 @@ cdef class Packer(object):
200200 dval = o
201201 ret = msgpack_pack_double(& self .pk, dval)
202202 elif PyBytesLike_CheckExact(o) if strict_types else PyBytesLike_Check(o):
203- L = len (o)
203+ L = Py_SIZE (o)
204204 if L > ITEM_LIMIT:
205205 PyErr_Format(ValueError , b" %.200s object is too large" , Py_TYPE(o).tp_name)
206206 rawval = o
@@ -214,7 +214,7 @@ cdef class Packer(object):
214214 raise ValueError (" unicode string is too large" )
215215 else :
216216 o = PyUnicode_AsEncodedString(o, self .encoding, self .unicode_errors)
217- L = len (o)
217+ L = Py_SIZE (o)
218218 if L > ITEM_LIMIT:
219219 raise ValueError (" unicode string is too large" )
220220 ret = msgpack_pack_raw(& self .pk, L)
@@ -254,7 +254,7 @@ cdef class Packer(object):
254254 ret = msgpack_pack_ext(& self .pk, longval, L)
255255 ret = msgpack_pack_raw_body(& self .pk, rawval, L)
256256 elif PyList_CheckExact(o) if strict_types else (PyTuple_Check(o) or PyList_Check(o)):
257- L = len (o)
257+ L = Py_SIZE (o)
258258 if L > ITEM_LIMIT:
259259 raise ValueError (" list is too large" )
260260 ret = msgpack_pack_array(& self .pk, L)
You can’t perform that action at this time.
0 commit comments