Hi, I plan to replace all %.100s (or any other size, %\.[0-9]+s regex) by %s in the whole source code, in all calls to PyErr_Format(). And I would like your opinion.
When Guido added the function PyErr_Format(), 13 years ago, the function was implemented using a buffer of 500 bytes (allocated on the stack). The developer was responsible to limit the argument fit into a total of 500 bytes. But 3 years later (2000), PyErr_Format() was patched to use a dynamic buffer (allocated on the heap). But since this change, PyErr_Format() doesn't support %.100s anymore (the 100 bytes limitation is just ignored), and it becomes useless and so no, it's no more (since 10 years) a "protection" against segmentation fault. But I would like to know if I have to do in all branches (3.1-3.3, or worse: 2.5-3.3), or just in 3.3? Because it may make merge harder (like any change only done in default). I would like to replace %.100s because there are no more reason to truncate strings to an arbitrary length. => http://bugs.python.org/issue10833 --- ... at the same time, Ray Allen wrote a patch to implement %.100s in PyUnicode_FromFormatV() (so PyErr_Format() will support it too). I would like to replace %.100s in PyErr_Format(), and then commit its patch. http://bugs.python.org/issue7330 Victor _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com