[Patches] [Patch #100895] safe version of PyErr_Format
noreply@sourceforge.net
noreply@sourceforge.net
Thu, 31 Aug 2000 19:12:06 -0700
Patch #100895 has been updated.
Project:
Category: core (C code)
Status: Open
Summary: safe version of PyErr_Format
Follow-Ups:
Date: 2000-Jul-17 14:56
By: effbot
Comment:
minor tweaks (mostly comments), based on input from moshe.
-------------------------------------------------------
Date: 2000-Jul-17 23:23
By: moshez
Comment:
I'm +1 on that! It will plug one more security hole in Python, and seems a "good enough" replacement for an unsure snprintf()
-------------------------------------------------------
Date: 2000-Aug-08 10:19
By: effbot
Comment:
regenerated, since moshez reported that it didn't apply cleanly to the current CVS tree.
reassigned, since it's been sitting here for ages.
-------------------------------------------------------
Date: 2000-Aug-10 21:04
By: tim_one
Comment:
Rejected and back to /F.
Major: no docs! Format strings processed by this have different semantics than anyone could guess (e.g., flags are ignored, width is ignored, some format codes are copied verbatim). Reverse-engineering the code each time there's a question is just too painful. You're basically inventing a new sublanguage here, so document what the heck it is & means.
Mechanical:
There's a "step 1" but no "step 2" <wink>.
We shouldn't be #ifdef'ing on prototypes anymore.
Guido did not yield to the push for 4-space indents in C code, so this should use hard tabs.
-------------------------------------------------------
Date: 2000-Aug-15 17:05
By: tim_one
Comment:
Changed status from Rejeced to Open so we only have to look in one place for the status of putative 2.0 patches.
But the patch is still *effectively* rejected pending response to the objections.
-------------------------------------------------------
Date: 2000-Aug-21 18:42
By: tim_one
Comment:
Just reminding you this is still on your plate.
-------------------------------------------------------
Date: 2000-Aug-23 02:32
By: moshez
Comment:
Here's a summary, for a future documentation patch:
PyObject *PyErr_Format(PyObject *exception, char *fmt, ...)
exception should be a Python object.
"fmt" should be a string, containing format codes, similar to "printf". width.precision is parsed, but the width part
is ignored.
Formatting characters
---------------------
'c' -- format a character, as an "int" argument
'd' -- format a number in decimal, as an "int" argument
'x' -- format a number in hex, as an "int" argument
's' -- format a C string, as a "char *" argument
An unrecognized format character causes all the rest of
the format string to be copied as-is to the result string,
and any extra arguments discarded.
A new reference is returned, which is owned by the caller.
I don't want to clobber the patch with an API docs patch,
but the above should be pretty much cut-and-pastable
(or, if not, tell me what's wrong and I'll try and fix it)
-------------------------------------------------------
-------------------------------------------------------
For more info, visit:
http://sourceforge.net/patch/?func=detailpatch&patch_id=100895&group_id=5470