[issue25916] wave module readframes now returns bytes not str
New submission from Iber Parodi Siri: The documentation of readframes (wave module) states that readframes returns a string of bytes, just like python 2.7, but that's not the case in python 3.4 readframes returns byte type objects ---------- assignee: docs@python components: Documentation messages: 256759 nosy: Iber Parodi Siri, docs@python priority: normal severity: normal status: open title: wave module readframes now returns bytes not str versions: Python 3.4 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue25916> _______________________________________
SilentGhost added the comment: Here is the patch. ---------- keywords: +needs review, patch nosy: +SilentGhost stage: -> patch review type: -> behavior versions: +Python 3.3, Python 3.5, Python 3.6 Added file: http://bugs.python.org/file41368/issue25916.diff _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue25916> _______________________________________
Changes by R. David Murray <rdmurray@bitdance.com>: ---------- stage: patch review -> commit review _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue25916> _______________________________________
Changes by R. David Murray <rdmurray@bitdance.com>: ---------- versions: -Python 3.3, Python 3.4 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue25916> _______________________________________
Serhiy Storchaka added the comment: This is not the only place where "string of bytes" or "byte string" is used as a synonym to "bytes object". ---------- nosy: +serhiy.storchaka _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue25916> _______________________________________
R. David Murray added the comment: Yes, and I think it would be good to consistently use "bytes object" or similar wording, to avoid confusion. But not high enough priority to do a hunt-and-fix (unless someone really feels like doing that). I've got a patch pending for fixing it in the base64 module, as part of making other fixes to that doc, for example. ---------- nosy: +r.david.murray _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue25916> _______________________________________
SilentGhost added the comment: Here is the patch replacing exact match 'string of bytes' with :class:`bytes` where appropriate. No match was found in base64. ---------- Added file: http://bugs.python.org/file41375/issue25916_2.diff _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue25916> _______________________________________
Martin Panter added the comment: Two of the changes don’t seem right to me; see the review. In the other two cases, IMO “string of bytes” is a reasonable description of :class:`bytes`, but being explicit is better. ---------- nosy: +martin.panter _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue25916> _______________________________________
R. David Murray added the comment: Agree with Martin. Only the two audio module changes are correct. However, I think we can reduce ambiguity without compromising the meaning by changing "string of bytes" to "sequence of bytes" in both of those other cases. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue25916> _______________________________________
SilentGhost added the comment: Here is the updated patch. ---------- Added file: http://bugs.python.org/file41465/issue25916_3.diff _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue25916> _______________________________________
R. David Murray added the comment: In those contexts, bytes should not be linked to the bytes object. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue25916> _______________________________________
Changes by SilentGhost <ghost.adh@gmail.com>: Added file: http://bugs.python.org/file41466/issue25916_4.diff _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue25916> _______________________________________
Martin Panter added the comment: Patch 4 looks fine to me. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue25916> _______________________________________
Serhiy Storchaka added the comment: Another uses of this idiom: "string of 16 bytes" in uuid.rst and uuid.py "string of *n* random bytes" in os.rst "string of bytes" in bytesio.c And a number of uses "bytestring", "byte string" and "bytes string". I think that either all occurrences should be changed consistently, or nothing. Personally I'm good with all these "string of bytes", "bytestring", etc, it is clear to me that that mean bytes or bytes-like objects. What is a bug, it's using the term "string" without "bytes" for bytes strings (there are a lot of such Python 2 remnants in the documentation and comments). ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue25916> _______________________________________
R. David Murray added the comment: As I said, I think it's like fixing style issues in code: only do it if you touch the docs for some other reason. But this patch is fine. Although we should fix the 'string' when it is really 'bytes' issues, if we can find them. Those are real bugs, not style issues. But that should be a different issue or issues from this one. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue25916> _______________________________________
Roundup Robot added the comment: New changeset 7ac8e8568da2 by R David Murray in branch '3.5': #25916: fix a few 'string of bytes' references. https://hg.python.org/cpython/rev/7ac8e8568da2 New changeset 089f7d761a9c by R David Murray in branch 'default': Merge: #25916: fix a few 'string of bytes' references. https://hg.python.org/cpython/rev/089f7d761a9c ---------- nosy: +python-dev _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue25916> _______________________________________
R. David Murray added the comment: Thanks SilentGhost. ---------- resolution: -> fixed stage: commit review -> resolved status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue25916> _______________________________________
participants (6)
-
Iber Parodi Siri
-
Martin Panter
-
R. David Murray
-
Roundup Robot
-
Serhiy Storchaka
-
SilentGhost