[issue22406] uu-codec trailing garbage workaround is Python 2 code
Roundup Robot added the comment: New changeset ad89a652b4ed by Serhiy Storchaka in branch '3.4': Issue #22406: Fixed the uu_codec codec incorrectly ported to 3.x. https://hg.python.org/cpython/rev/ad89a652b4ed New changeset b18ef4a3e7c1 by Serhiy Storchaka in branch 'default': Issue #22406: Fixed the uu_codec codec incorrectly ported to 3.x. https://hg.python.org/cpython/rev/b18ef4a3e7c1 New changeset 7b82b58b8329 by Serhiy Storchaka in branch '2.7': Backported tests for issue #22406. https://hg.python.org/cpython/rev/7b82b58b8329 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22406 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22406] uu-codec trailing garbage workaround is Python 2 code
Serhiy Storchaka added the comment: I think it is safer now just fix existing code than replace it with totally different code with the risk of incompatibility. In any case uu_codec needs rewriting because currently it doesn't support incremental encoding and decoding. Thank you for your contribution Martin. And if you are going to do further contribution, please submit a contributor form (https://www.python.org/psf/contrib/). Few notes. It is more handy to provide all changes as one patch. And your patches contain trailing spaces in blank lines. -- resolution: - fixed stage: patch review - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22406 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22406] uu-codec trailing garbage workaround is Python 2 code
Changes by Berker Peksag berker.pek...@gmail.com: -- stage: needs patch - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22406 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22406] uu-codec trailing garbage workaround is Python 2 code
Changes by Martin Panter vadmium...@gmail.com: Added file: http://bugs.python.org/file36619/uu_codec ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22406 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22406] uu-codec trailing garbage workaround is Python 2 code
Martin Panter added the comment: Here are two patches: a test and a fix. I’m not sure if it is okay to add a test for the “codecs” module with the tests for the “uu” module; it was easier that way because I am basically running the same test over the two different APIs. -- Added file: http://bugs.python.org/file36618/test ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22406 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22406] uu-codec trailing garbage workaround is Python 2 code
New submission from Martin Panter: The handler for the “Trailing garbage” error for “uu-codec” uses Python 2 code, while the copy in the uu” module has the correct Python 3 code. Please change the line at https://hg.python.org/cpython/file/775453a7b85d/Lib/encodings/uu_codec.py#l57 to look like https://hg.python.org/cpython/file/775453a7b85d/Lib/uu.py#l148 In particular, drop ord() and use floor division. Better yet, maybe the code could be reused so that there is less duplication! Demonstration: codecs.decode(bbegin 666 data\n!,___\n \nend\n, uu-codec) Traceback (most recent call last): File /usr/lib/python3.4/encodings/uu_codec.py, line 54, in uu_decode data = binascii.a2b_uu(s) binascii.Error: Trailing garbage During handling of the above exception, another exception occurred: Traceback (most recent call last): File /usr/lib/python3.4/encodings/uu_codec.py, line 57, in uu_decode nbytes = (((ord(s[0])-32) 63) * 4 + 5) / 3 TypeError: ord() expected string of length 1, but int found The above exception was the direct cause of the following exception: Traceback (most recent call last): File stdin, line 1, in module TypeError: decoding with 'uu-codec' codec failed (TypeError: ord() expected string of length 1, but int found) codecs.decode(bbegin 666 data\n!,P \n \nend\n, uu-codec) b'3' # Expected output for both cases -- components: Library (Lib) messages: 226870 nosy: vadmium priority: normal severity: normal status: open title: uu-codec trailing garbage workaround is Python 2 code type: behavior versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22406 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22406] uu-codec trailing garbage workaround is Python 2 code
Changes by Serhiy Storchaka storch...@gmail.com: -- assignee: - serhiy.storchaka keywords: +easy nosy: +doerwalter, lemburg, serhiy.storchaka priority: normal - low stage: - needs patch versions: +Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22406 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22406] uu-codec trailing garbage workaround is Python 2 code
Serhiy Storchaka added the comment: Do you want to provide a patch Martin? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22406 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com