Serhiy Storchaka <> added the comment:

Things are more complicated. bytes object is an iterable. I think serialize an 
bytes object (which can be unexpectedly leaked in a code ported from 2.7) as a 
list of integers is not expected behavior in most cases. It is safer to fail by 
default and provide an explicit handling for bytes if it is needed. There are 
other iterables that are better not to serialize by default: mappings, which 
are not dict subclasses, exhaustible iterators.

I'm working on large patch for the json module (maybe even a PEP). It will not 
allow serializing all iterables by default, but will make easy to switch on 
serialization for particular types, including iterables.

assignee:  -> serhiy.storchaka
nosy: +serhiy.storchaka
priority: normal -> low

Python tracker <>
Python-bugs-list mailing list

Reply via email to