[Python-checkins] r47170 - python/trunk/Modules/_ctypes/callproc.c
Thomas Heller
theller at python.net
Fri Jun 30 19:37:35 CEST 2006
Neal Norwitz schrieb:
> Whoops, you're right. I'll try to remember to fix this when I get home
> tonight...unless someone beats me to it. :-)
I'll do it.
Thanks, Thomas
> --
>
> On 6/30/06, Tim Peters <tim.peters at gmail.com> wrote:
>> > Author: neal.norwitz
>> > Date: Fri Jun 30 09:32:16 2006
>> > New Revision: 47170
>> >
>> > Modified:
>> > python/trunk/Modules/_ctypes/callproc.c
>> > Log:
>> > Silence compiler warning
>> >
>> > Modified: python/trunk/Modules/_ctypes/callproc.c
>> > ==============================================================================
>> > --- python/trunk/Modules/_ctypes/callproc.c (original)
>> > +++ python/trunk/Modules/_ctypes/callproc.c Fri Jun 30 09:32:16 2006
>> > @@ -82,6 +82,10 @@
>> > #define DONT_USE_SEH
>> > #endif
>> >
>> > +#ifndef PY_FORMAT_SIZE_T
>> > +#define PY_FORMAT_SIZE_T ""
>> > +#endif
>> > +
>> > #ifdef MS_WIN32
>> > PyObject *ComError;
>> >
>> > @@ -1486,7 +1490,8 @@
>> > }
>> > if (size < dict->size) {
>> > PyErr_Format(PyExc_ValueError,
>> > - "minimum size is %d", dict->size);
>> > + "minimum size is %" PY_FORMAT_SIZE_T "d",
>> > + dict->size);
>>
>> Unfortunately, that doesn't make sense -- there's no guarantee that
>> PyErr_Format() can understand PY_FORMAT_SIZE_T's expansion.
>> PY_FORMAT_SIZE_T should only be used in calls to C's format functions
>> (like printf or sprintf). PyErr_Format() in 2.5 makes sense of "%zd"
>> itself, but before 2.5 does not, so "%zd" can't be used here either.
>>
>> #if PY_VERSION_HEX < 0x02050000
>> "minimum size is %d", dict->size);
>> #else
>> "minimum size is %zd", dict->size);
>> #endif
>>
>> makes sense. That directly reflects that this module uses C int
>> before 2.5, but uses Py_ssize_t starting with 2.5.
>> _______________________________________________
>> Python-checkins mailing list
>> Python-checkins at python.org
>> http://mail.python.org/mailman/listinfo/python-checkins
>>
More information about the Python-checkins
mailing list