Bytes versus text issues on Python 3
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
tooz |
Fix Released
|
Medium
|
Unassigned | ||
python-tooz (Ubuntu) |
Fix Released
|
High
|
James Page |
Bug Description
It's unclear to me if group and member identifiers are supposed to be bytes or text strings in tooz. Try to run unit tests with "python3 -bb" to see BytesWarning errors.
It looks like bytes is preferred, but it's cause some conversion issues on Python 3.
Tooz errors have group_id and member_id attributes which are used to format error messages. Example:
---
class MemberAlreadyEx
"""Exception raised when the caller try to join a group but a member
with the same identifier belongs to that group.
"""
def __init__(self, group_id, member_id):
"Member %s has already joined %s" %
---
If group_id and member_id must be bytes, we must decode them to format the error message. "%s" % b'bytes' raises a BytesWarning when python3 is used with -bb.
Changed in python-tooz: | |
importance: | Undecided → Medium |
status: | New → Triaged |
Changed in python-tooz (Ubuntu): | |
status: | New → In Progress |
importance: | Undecided → High |
milestone: | none → ubuntu-18.10 |
assignee: | nobody → James Page (james-page) |
Changed in python-tooz: | |
status: | Triaged → Fix Released |
Since they're bytes, we can't really decode them safely I'd say. What's the best approach to decode them and print whatever it is (ascii or \xfoobar stuff)?