diff options
author | Marty B <mrbm74@gmail.com> | 2019-12-09 11:29:47 +0100 |
---|---|---|
committer | Inada Naoki <songofacandy@gmail.com> | 2019-12-09 19:29:47 +0900 |
commit | 5fd611909319d03200774ea3c7a6ae16dbd26c12 (patch) | |
tree | dec40579f25d612e44a916b95ff2cf23aa9a7703 /msgpack | |
parent | d10f12db8f328130a13df759bc9cb3fa064cc8b8 (diff) | |
download | msgpack-python-5fd611909319d03200774ea3c7a6ae16dbd26c12.tar.gz |
Simplify check for bool type (#362)
Diffstat (limited to 'msgpack')
-rw-r--r-- | msgpack/_packer.pyx | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/msgpack/_packer.pyx b/msgpack/_packer.pyx index 2a768b0..1426439 100644 --- a/msgpack/_packer.pyx +++ b/msgpack/_packer.pyx @@ -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. |