[issue10833] Replace %.100s by %s in PyErr_Format(): the arbitrary limit of 500 bytes is outdated

2011-03-24 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: My stronger argument was that %.100s was never supported. I am wrong: Python 2 is only to truncate strings in PyErr_Format() (PyString_FromFormatV() supports precision for %s format). As I am the only one wanting to changing that,

[issue10833] Replace %.100s by %s in PyErr_Format(): the arbitrary limit of 500 bytes is outdated

2011-03-24 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@haypocalc.com: -- resolution: - invalid status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10833 ___

[issue10833] Replace %.100s by %s in PyErr_Format(): the arbitrary limit of 500 bytes is outdated

2011-03-21 Thread Roundup Robot
Roundup Robot devnull@devnull added the comment: New changeset 74d3dc78f0db by Victor Stinner in branch 'default': Issue #10833: Use PyUnicode_FromFormat() and PyErr_Format() instead of http://hg.python.org/cpython/rev/74d3dc78f0db -- nosy: +python-dev

[issue10833] Replace %.100s by %s in PyErr_Format(): the arbitrary limit of 500 bytes is outdated

2011-03-21 Thread Roundup Robot
Roundup Robot devnull@devnull added the comment: New changeset 513bab5cfb18 by Victor Stinner in branch 'default': Issue #10833: Remove the buffer allocated on the stack, it isn't used anymore http://hg.python.org/cpython/rev/513bab5cfb18 New changeset 4c2135930882 by Victor Stinner in branch

[issue10833] Replace %.100s by %s in PyErr_Format(): the arbitrary limit of 500 bytes is outdated

2011-03-03 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: I am working with Python since 5 years (and on Python since 3 years): I never seen any garbage string in error messages. My concern is to not truncate strings in error messages anymore. I consider that it is more important than

[issue10833] Replace %.100s by %s in PyErr_Format(): the arbitrary limit of 500 bytes is outdated

2011-03-03 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: History of PyErr_Format(): - r7580 (13 years ago): creation of PyErr_Format() using a buffer of 500 bytes (fixed size buffer, allocated on the stack) - r17159 (10 years ago): PyErr_Format() allocates a dynamic buffer on the heap

[issue10833] Replace %.100s by %s in PyErr_Format(): the arbitrary limit of 500 bytes is outdated

2011-03-03 Thread Eric Smith
Eric Smith e...@trueblade.com added the comment: I don't feel strongly one way or the other about it. I was just relaying the reason I heard when I asked the question about why it's done the way it is. I suggest mentioning that you're going to commit this change on python-dev, since this

[issue10833] Replace %.100s by %s in PyErr_Format(): the arbitrary limit of 500 bytes is outdated

2011-02-21 Thread Ray.Allen
Ray.Allen ysj@gmail.com added the comment: see also #7330, I'm implementing %.100s in that issue. -- nosy: +ysj.ray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10833 ___

[issue10833] Replace %.100s by %s in PyErr_Format(): the arbitrary limit of 500 bytes is outdated

2011-01-14 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: belopolsky Limiting field width when formatting error messages is belopolsky a good safety measure. The problem is that PyUnicode_FromFormatV() doesn't support %.100s format (it ignores .100). If we truncate at 100 bytes, it may

[issue10833] Replace %.100s by %s in PyErr_Format(): the arbitrary limit of 500 bytes is outdated

2011-01-09 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: I am concerned about conditions that are impossible in a valid program. However, if you have a buffer overflow that trashes your tp_name pointer so that it suddenly resolves to a binary code section, Yes, %.100s may avoid a

[issue10833] Replace %.100s by %s in PyErr_Format(): the arbitrary limit of 500 bytes is outdated

2011-01-06 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: I agree with Eric. Limiting field width when formatting error messages is a good safety measure. It is not only the amount of garbage that can be spitted in error logs, if garbage is not null-terminated, you may get a

[issue10833] Replace %.100s by %s in PyErr_Format(): the arbitrary limit of 500 bytes is outdated

2011-01-06 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: /* Caller is responsible for limiting the format */ Note that it is a good idea to avoid memory allocation during exception processing. Think of out of memory errors: how would you report those if you need more memory

[issue10833] Replace %.100s by %s in PyErr_Format(): the arbitrary limit of 500 bytes is outdated

2011-01-06 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: eric I always thought that one of the reasons for specifying the length eric was in case a pointer pointed to garbage: at least you'd be limiting eric how much trash was printed. No, it's because of the old (removed) 500 bytes

[issue10833] Replace %.100s by %s in PyErr_Format(): the arbitrary limit of 500 bytes is outdated

2011-01-06 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: On Thu, Jan 6, 2011 at 3:49 PM, STINNER Victor rep...@bugs.python.org wrote: .. eric I always thought that one of the reasons for specifying the length eric was in case a pointer pointed to garbage: at least you'd be

[issue10833] Replace %.100s by %s in PyErr_Format(): the arbitrary limit of 500 bytes is outdated

2011-01-05 Thread Eric Smith
Eric Smith e...@trueblade.com added the comment: I always thought that one of the reasons for specifying the length was in case a pointer pointed to garbage: at least you'd be limiting how much trash was printed. But maybe that's just my imagination and there is no such reason. --

[issue10833] Replace %.100s by %s in PyErr_Format(): the arbitrary limit of 500 bytes is outdated

2011-01-04 Thread STINNER Victor
New submission from STINNER Victor victor.stin...@haypocalc.com: Guido created the convenience function PyErr_Format() 13 years ago (r7580) with a naive implementation using char buffer[500] and vsprintf(). He added a comment: /* Caller is responsible for limiting the format */ Ok, that was

[issue10833] Replace %.100s by %s in PyErr_Format(): the arbitrary limit of 500 bytes is outdated

2011-01-04 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: use_format.patch is a patch to avoid PyOS_snprintf() with a fixed buffer: use directly PyUnicode_FromFormat(), PyErr_Format() or PySys_FormatStderr() instead. This patch is just a draft, it should be tested :-) There are other

[issue10833] Replace %.100s by %s in PyErr_Format(): the arbitrary limit of 500 bytes is outdated

2011-01-04 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Woops, I didn't want to do it, but I already commited the simple part of this issue (U format, eg. %.100U): r87753. -- ___ Python tracker rep...@bugs.python.org