86 | | === Other notes === |
| 86 | == Known issues with `future` == |
| 87 | |
| 88 | The `from builtins import <every builtin ever>` thing gives a decent Python 3 layer for Python 2. For example it'll automatically create `__nonzero__` to wrap a `__bool__`. |
| 89 | |
| 90 | But there are caveats. |
| 91 | |
| 92 | One of them is the `bytes` objects: |
| 93 | |
| 94 | 1. `builtins.bytes.translate` are `builtins.bytes.maketrans` buggy on PyPy. One way to fix this is with a `if PY2: translate = string.translate else: translate = bytes.translate`. |
| 95 | 2. The behavior with `b"%s" % some_bytes_object` works fine if both objects are Future `builtins.bytes`, or both objects are native Python 2 strings/bytes, but not if you combine them. This has caused bugs. One way to fix this is by exposing only native byte strings for now, see e.g. `allmydata.util.base32`. |
| 96 | |
| 97 | == Other notes == |