classification
Title: json int encoding incorrect for dbus.Byte
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 2.7
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: ZackerySpytz, mark.dickinson, radsquirrel, xtreak
Priority: normal Keywords:

Created on 2018-06-07 16:32 by radsquirrel, last changed 2020-05-16 07:38 by ned.deily. This issue is now closed.

Messages (2)
msg318954 - (view) Author: Brad Bishop (radsquirrel) Date: 2018-06-07 16:32
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?
msg369015 - (view) Author: Zackery Spytz (ZackerySpytz) * (Python triager) Date: 2020-05-16 06:06
Python 2 is EOL, so I think this issue should be closed.
History
Date User Action Args
2020-05-16 07:38:34ned.deilysetstatus: open -> closed
resolution: wont fix
stage: resolved
2020-05-16 06:06:29ZackerySpytzsetnosy: + ZackerySpytz
messages: + msg369015
2018-09-25 11:53:31serhiy.storchakasetnosy: + mark.dickinson
2018-09-25 11:12:37xtreaksetnosy: + xtreak
2018-06-07 16:32:41radsquirrelcreate