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):
200
200
dval = o
201
201
ret = msgpack_pack_double(& self .pk, dval)
202
202
elif PyBytesLike_CheckExact(o) if strict_types else PyBytesLike_Check(o):
203
- L = len (o)
203
+ L = Py_SIZE (o)
204
204
if L > ITEM_LIMIT:
205
205
PyErr_Format(ValueError , b" %.200s object is too large" , Py_TYPE(o).tp_name)
206
206
rawval = o
@@ -214,7 +214,7 @@ cdef class Packer(object):
214
214
raise ValueError (" unicode string is too large" )
215
215
else :
216
216
o = PyUnicode_AsEncodedString(o, self .encoding, self .unicode_errors)
217
- L = len (o)
217
+ L = Py_SIZE (o)
218
218
if L > ITEM_LIMIT:
219
219
raise ValueError (" unicode string is too large" )
220
220
ret = msgpack_pack_raw(& self .pk, L)
@@ -254,7 +254,7 @@ cdef class Packer(object):
254
254
ret = msgpack_pack_ext(& self .pk, longval, L)
255
255
ret = msgpack_pack_raw_body(& self .pk, rawval, L)
256
256
elif PyList_CheckExact(o) if strict_types else (PyTuple_Check(o) or PyList_Check(o)):
257
- L = len (o)
257
+ L = Py_SIZE (o)
258
258
if L > ITEM_LIMIT:
259
259
raise ValueError (" list is too large" )
260
260
ret = msgpack_pack_array(& self .pk, L)
You can’t perform that action at this time.
0 commit comments