mirror of
https://github.com/msgpack/msgpack-python.git
synced 2026-02-06 09:50:01 +00:00
Simplify check for bool type (#362)
This commit is contained in:
parent
d10f12db8f
commit
5fd6119093
1 changed files with 4 additions and 5 deletions
|
|
@ -153,11 +153,10 @@ cdef class Packer(object):
|
|||
while True:
|
||||
if o is None:
|
||||
ret = msgpack_pack_nil(&self.pk)
|
||||
elif PyBool_Check(o) if strict_types else isinstance(o, bool):
|
||||
if o:
|
||||
ret = msgpack_pack_true(&self.pk)
|
||||
else:
|
||||
ret = msgpack_pack_false(&self.pk)
|
||||
elif o is True:
|
||||
ret = msgpack_pack_true(&self.pk)
|
||||
elif o is False:
|
||||
ret = msgpack_pack_false(&self.pk)
|
||||
elif PyLong_CheckExact(o) if strict_types else PyLong_Check(o):
|
||||
# PyInt_Check(long) is True for Python 3.
|
||||
# So we should test long before int.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue