[issue8592] 'y' does not check for embedded NUL bytes

2010-06-13 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: I commited a bigger patch: r81973 not only fixes y format, but also u and Z. It does also add a lot of tests in test_getargs2.py for many string formats (not all, eg. es is not tested). Even if I consider this as a bugfix, I don't

[issue8592] 'y' does not check for embedded NUL bytes

2010-06-11 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Attached patch fixes the initial problem: raise an error if the byte strings embeds a NUL-byte. -- keywords: +patch Added file: http://bugs.python.org/file17636/y_format.patch ___ Python

[issue8592] 'y' does not check for embedded NUL bytes

2010-06-08 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: See also #8850: Remove w format of PyParse_ParseTuple(). -- About y: the parser HAVE TO check for embedded NUL bytes, because the caller doesn't know the size of the buffer (and strlen() would give the wrong size). --

[issue8592] 'y' does not check for embedded NUL bytes

2010-05-04 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Same issue for y#: y# (...) This variant on s# doesn’t accept Unicode objects, only bytes-like objects. s# (...) The string may contain embedded null bytes. -- y* might mention that it accepts embedded null bytes. -- grep

[issue8592] 'y' does not check for embedded NUL bytes

2010-05-04 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: See also #8215. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8592 ___ ___

[issue8592] 'y' does not check for embedded NUL bytes

2010-05-01 Thread Antoine Pitrou
New submission from Antoine Pitrou pit...@free.fr: The documentation for the 'y' format (PyArg_ParseTuple and friends) states that: « The bytes object must not contain embedded NUL bytes; if it does, a TypeError exception is raised. » But, reading Python/getargs.c, the strlen() check is