[New-bugs-announce] [issue33797] json int encoding incorrect for dbus.Byte

Brad Bishop report at bugs.python.org
Thu Jun 7 12:32:41 EDT 2018


New submission from Brad Bishop <bradleyb at fuzziesquirrel.com>:

JSON does not correctly encode dbus.Byte from dbus-python on 2.7:

dbus.Byte is a subclass of int with its own __str__ implementation.

>>> import json
>>> import dbus
>>> json.dumps(dbus.Byte(0))
'\x00'

On 3.x:

>>> import json
>>> import dbus
>>> json.dumps(dbus.Byte(0))
'0'

This seems to have been fixed in 3.x here:
https://bugs.python.org/issue18264
and subsequently:
https://bugs.python.org/issue26719

I'm interested in backporting these but they are marked as enhancements.  However a backport for a similar issue:
https://bugs.python.org/issue27934

was accepted.  Would the maintainers be amenable to a backport of 18264 & 26719?

----------
components: Library (Lib)
messages: 318954
nosy: radsquirrel
priority: normal
severity: normal
status: open
title: json int encoding incorrect for dbus.Byte
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33797>
_______________________________________


More information about the New-bugs-announce mailing list