[issue20335] bytes constructor accepts more than one argument even of the first one is not a string
New submission from Renaud Blanch: % python3 Python 3.3.2 (v3.3.2:d047928ae3f6, May 13 2013, 13:52:24) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type help, copyright, credits or license for more information. help(bytes) bytes constructor accepts more than one argument even of the first one is not a string (and then the other arguments are checked to be strings): bytes(2, foo, bar) b'\x00\x00' bytes(2, foo) b'\x00\x00' but: bytes(2, 1) Traceback (most recent call last): File stdin, line 1, in module TypeError: bytes() argument 2 must be str, not int -- components: Interpreter Core messages: 208707 nosy: rndblnch priority: normal severity: normal status: open title: bytes constructor accepts more than one argument even of the first one is not a string versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20335 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20335] bytes constructor accepts more than one argument even of the first one is not a string
Changes by Renaud Blanch rndbl...@gmail.com: -- keywords: +patch Added file: http://bugs.python.org/file33600/bytesobject.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20335 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20335] bytes constructor accepts more than one argument even if the first one is not a string
Changes by Renaud Blanch rndbl...@gmail.com: -- title: bytes constructor accepts more than one argument even of the first one is not a string - bytes constructor accepts more than one argument even if the first one is not a string ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20335 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11682] PEP 380 reference implementation for 3.3
Renaud Blanch rndbl...@gmail.com added the comment: I can not comment on http://bugs.python.org/review/11682/, so a quick comment here: Doc/whatsnew/3.3.rst patch gives me credit together with Greg Ewing for the implementation, but I've only upgraded his patches to 3.3. So, the following line: +(Implementation by Greg Ewing and Renauld Blanch) should really be: +(Implementation by Greg Ewing) And, as I'm on it, the proper spelling for my surname is Renaud (not Renauld as it also appears in the commit message :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11682 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12471] wrong TypeError message on '%i' formatting
Renaud Blanch rndbl...@gmail.com added the comment: that was quick! just a question: is it worth backporting the fix to 2.7? if this helps, here is a backport for the patch commited to 3.2 http://hg.python.org/cpython/rev/97707459bb5a -- Added file: http://bugs.python.org/file22563/PyUnicode_Format_TypeError_message.2.7.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12471 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12471] wrong TypeError message on '%i' formatting
New submission from Renaud Blanch rndbl...@gmail.com: The TypeError message is erroneous when attempting to format a non number object with a '%i' string (notice the '%d' in the error message): '%i' % 's' Traceback (most recent call last): File stdin, line 1, in module TypeError: %d format: a number is required, not str This is because PyUnicode_Format aliases i to d for the formatting handling, but this has the side effect of performing the substitution in the error message too. The attached patch (against 3.3, but this behaviour has been there since 2.6) suppress the side effect and corrects the error message. -- components: Interpreter Core files: PyUnicode_Format_TypeError_message.patch keywords: patch messages: 139607 nosy: rndblnch priority: normal severity: normal status: open title: wrong TypeError message on '%i' formatting type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file22542/PyUnicode_Format_TypeError_message.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12471 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11682] PEP 380 reference implementation for 3.3
Renaud Blanch rndbl...@gmail.com added the comment: I've just updated the pep380-test patch to make it slightly simpler (still in golden output form though) https://bitbucket.org/rndblnch/cpython-pep380/src/317eadf5e3e8/pep380-tests -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11682 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11682] PEP 380 reference implementation for 3.3
Renaud Blanch rndbl...@gmail.com added the comment: As nick said, the repo only host a patch queue. the patch itself is visible here: https://bitbucket.org/rndblnch/cpython-pep380/qseries?apply=tqs_apply=pep380 Or it can be download here in raw text: https://bitbucket.org/rndblnch/cpython-pep380/raw/tip/pep380 I have documented how to apply the patch to a cpython clone here: https://bitbucket.org/rndblnch/cpython-pep380/wiki -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11682 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11682] PEP 380 reference implementation for 3.3
Changes by Renaud Blanch rndbl...@gmail.com: -- nosy: +rndblnch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11682 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1672568] silent error in email.message.Message.get_payload
Renaud Blanch rndbl...@gmail.com added the comment: looks very good to me. thanks daniel for your work renaud -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1672568 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1672568] silent error in email.message.Message.get_payload
Renaud Blanch rndbl...@gmail.com added the comment: good idea, why not something like sketched in the attached patch? it does not break any existing code, while providing a way for new users to have a chance to get the decoding errors. of course, the doc should be updated accordingly, and tests should be added. -- Added file: http://bugs.python.org/file13631/unsilent_get_payload_decoding_errors.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1672568 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1672568] silent error in email.message.Message.get_payload
Renaud Blanch rndbl...@gmail.com added the comment: Daniel: i can't remember the exact scenario (i filled this bug 2 years ago !) after having a look back at email.message.Message.get_payload, i remember the problem: the decoding errors are silented by the method and you have no way to know if the decoding has been successful or not. to find my malformed email i had to patch the module like that (basically just removing the try/except blocks): patch --- message.py.orig 2009-04-03 23:46:47.0 +0200 +++ message.py 2009-04-03 23:48:27.0 +0200 @@ -192,19 +192,11 @@ if cte == 'quoted-printable': return utils._qdecode(payload) elif cte == 'base64': -try: -return utils._bdecode(payload) -except binascii.Error: -# Incorrect padding -return payload +return utils._bdecode(payload) elif cte in ('x-uuencode', 'uuencode', 'uue', 'x-uue'): sfp = StringIO() -try: -uu.decode(StringIO(payload+'\n'), sfp, quiet=True) -payload = sfp.getvalue() -except uu.Error: -# Some decoding problem -return payload +uu.decode(StringIO(payload+'\n'), sfp, quiet=True) +return sfp.getvalue() # Everything else, including encodings with 8bit or 7bit are returned # unchanged. return payload /patch once again, the behaviour is documented, so it's not really a bug. but it caused me a lot of trouble (and it does not conforms very well to Errors should never pass silently.:) but i guess applying such a patch could potentially break number of client code so... is it worth the change? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1672568 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com