Changes between Version 39 and Version 40 of Python3


Ignore:
Timestamp:
2020-10-15T13:49:16Z (4 years ago)
Author:
itamarst
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Python3

    v39 v40  
    155155
    156156Originally we went with first approach, but plausibly second approach is better.
     157
     158== Serializing bytes with JSON ==
     159
     160In Python 2 you can serialize bytes with `json`. In Python 3 you can't. Real Soon Now there will be utility module `allmydata.util.jsonbytes` that allows encoding bytes on Python 3, to minimize changes.
     161
     162== Dictionaries with bytes/unicode keys ==
     163
     164In Python 2 a key can be bytes or unicode, and it will replace the other one. So the key `b"foo"` is the same as `u"foo"` from dict's perspective. In Python 3 they are different keys.
     165
     166This can lead to bugs when porting, where you end up with two keys instead of one as some strings become Unicode strings.
     167
     168The interim solution will likely be dicts that enforce key type to be only bytes or only Unicode (https://tahoe-lafs.org/trac/tahoe-lafs/ticket/3476#ticket).