[Imported from Trac: page Python3, version 13]

itamarst 2020-08-05 15:48:47 +00:00
parent e4cafd26fa
commit 8c42bc8a63

@ -92,6 +92,10 @@ One of them is the `bytes` objects:
1. `builtins.bytes.translate` are `builtins.bytes.maketrans` buggy on [PyPy](PyPy). One way to fix this is with a `if PY2: translate = string.translate else: translate = bytes.translate`. 1. `builtins.bytes.translate` are `builtins.bytes.maketrans` buggy on [PyPy](PyPy). One way to fix this is with a `if PY2: translate = string.translate else: translate = bytes.translate`.
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`. 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`.
## Don't leak Future objects
Leaking Future objects (newints, new dicts, new bytes) in module API can break existing code on Python 2. So need to be careful not to do that. For that reason int isn't in the suggested list above.
## Other notes ## Other notes
If you just want to run the tests from the explicitly ported test modules, you can do `python -m allmydata.util._python3`. If you just want to run the tests from the explicitly ported test modules, you can do `python -m allmydata.util._python3`.