[issue8949] PyArg_Parse*(): z should not accept bytes
STINNER Victor victor.stin...@haypocalc.com added the comment: Patch commited to 3.2 (r82200), blocked in 3.1 (r82201). -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8949 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8949] PyArg_Parse*(): z should not accept bytes
Marc-Andre Lemburg m...@egenix.com added the comment: STINNER Victor wrote: STINNER Victor victor.stin...@haypocalc.com added the comment: @lemburg: So what is your opinion on this issue? You're probably right: it's too late to change s to accept buffer interface compatible objects as well. In that case, symmetry is more important, so +1 on rejecting bytes for z as well. Please add a note to the NEWS file for this change. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8949 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8949] PyArg_Parse*(): z should not accept bytes
STINNER Victor victor.stin...@haypocalc.com added the comment: @lemburg: So what is your opinion on this issue? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8949 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8949] PyArg_Parse*(): z should not accept bytes
STINNER Victor victor.stin...@haypocalc.com added the comment: Update the patch to update also the new tests that I added in r81973 (to fix #8592). -- Added file: http://bugs.python.org/file17661/pyarg_z_no_bytes-2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8949 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8949] PyArg_Parse*(): z should not accept bytes
Changes by STINNER Victor victor.stin...@haypocalc.com: Removed file: http://bugs.python.org/file17591/pyarg_z_no_bytes.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8949 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8949] PyArg_Parse*(): z should not accept bytes
STINNER Victor victor.stin...@haypocalc.com added the comment: Some examples of functions using s format: * str.encode(encoding, errors), bytes.decode(encoding, errors): both arguments have to be unicode strings * compile(source, filename, mode, ...): filename and mode have to be unicode strings * crypt.crypt(word, salt): both arguments have to be unicode strings I think that crypt() should also accept bytes, but not str.encode() nor bytes.decode(). Some examples of functions using z format: * _locale.bindtextdomain(domain, dirname): dirname uses z format and so accepts str, bytes or buffer compatible object. It should use PyUnicode_FSConverter() instead. But I agree that bytes is welcomed here. * readline.(write_history_file|read_init_file|read_history_file) functions do use z to parse a filename. PyUnicode_FSConverter() would also be better, but in this case z is better than s :-) I don't know why s and z are different about bytes, but it will be difficult to change it without changing a lot ot code (all functions using these formats). I tried to reject types different than str for z: most tests of the test suite fail. I tried to accept bytes for s format: unicode.encode(b'abc') does segfault. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8949 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8949] PyArg_Parse*(): z should not accept bytes
STINNER Victor victor.stin...@haypocalc.com added the comment: I tried to reject types different than str for z: most tests of the test suite fail Wait, what? No. I modified the wrong line of code :-) The whole test suite pass without any error if z doesn't accept bytes anymore. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8949 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8949] PyArg_Parse*(): z should not accept bytes
Changes by STINNER Victor victor.stin...@haypocalc.com: -- nosy: +lemburg ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8949 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8949] PyArg_Parse*(): z should not accept bytes
Marc-Andre Lemburg m...@egenix.com added the comment: z should not accept bytes... why not ? z is the same as s with the addition that passing None as parameter will result in the pointer to get set to NULL. s accepts bytes via the buffer interface, so why should z behave differently ? If a function should only accept Unicode or None, then Z should be used instead. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8949 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8949] PyArg_Parse*(): z should not accept bytes
STINNER Victor victor.stin...@haypocalc.com added the comment: Le mercredi 09 juin 2010 13:06:53, vous avez écrit : s accepts bytes via the buffer interface No. s* and s# do accept any buffer compatible object (including bytes and bytearray), but s doesn't. I fixed recently the documentation about that. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8949 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8949] PyArg_Parse*(): z should not accept bytes
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +loewis ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8949 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8949] PyArg_Parse*(): z should not accept bytes
New submission from STINNER Victor victor.stin...@haypocalc.com: z is supposed to be the same format than s but accepts None Except that z does also accept bytes. I suppose that s was fixed between Python2 and Python3, but z is not fixed yet. I think that it can be fixed in Python 3.2 without any deprecation process. -- components: Interpreter Core messages: 107351 nosy: haypo priority: normal severity: normal status: open title: PyArg_Parse*(): z should not accept bytes versions: Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8949 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8949] PyArg_Parse*(): z should not accept bytes
Changes by STINNER Victor victor.stin...@haypocalc.com: -- keywords: +patch Added file: http://bugs.python.org/file17591/pyarg_z_no_bytes.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8949 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8949] PyArg_Parse*(): z should not accept bytes
STINNER Victor victor.stin...@haypocalc.com added the comment: Hum, the patch doesn't update the documentation (at least Porting section of the What's new in Python 3.2). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8949 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com