[Patches] [ python-Patches-1474907 ] detect %zd format for PY_FORMAT_SIZE_T

SourceForge.net noreply at sourceforge.net
Thu Apr 27 07:16:49 CEST 2006


Patches item #1474907, was opened at 2006-04-22 23:18
Message generated for change (Comment added) made by bcannon
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1474907&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Build
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Brett Cannon (bcannon)
Assigned to: Martin v. Löwis (loewis)
Summary: detect %zd format for PY_FORMAT_SIZE_T

Initial Comment:
The patch modifies configure.in to add PY_FORMAT_SIZE_T
to configure.in (meaning you need to run autoheader on
configure.in) so that if %zd is supported for size_t it
sets PY_FORMAT_SIZE_T to "z", otherwise it goes
undefined and the preprocessor trickery in
Include/pyport.h kicks in.

This fix removes compiler warnings on OS X 10.4.6 with
gcc 4.0.1 thanks to PY_FORMAT_SIZE_T being set to "".

Initially assigned to Martin v. Loewis since he said
this would be good to do and the Py_ssize_t stuff is
his invention.

----------------------------------------------------------------------

>Comment By: Brett Cannon (bcannon)
Date: 2006-04-26 22:16

Message:
Logged In: YES 
user_id=357491

Realized there is a better way: just strncmp() for the
expected result.  Uploaded a new version.

----------------------------------------------------------------------

Comment By: Brett Cannon (bcannon)
Date: 2006-04-26 21:59

Message:
Logged In: YES 
user_id=357491

OK, uploaded a new version that uses strchr to check for
'%', 'z', and 'd'.  If it looks reasonable I will apply it
and hope I don't break the buildbot.  =)

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2006-04-26 09:15

Message:
Logged In: YES 
user_id=21627

The patch seems to rely on printf returning <0 for the
unrecognized format. That seems unreliable: atleast on
Linux, printf just outputs the format as-is for unrecognized
formats. Instead, I think it should use sprintf, and then
check whether the result is the string "0" (in addition to
checking whether the printf call itself failed).

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1474907&group_id=5470


More information about the Patches mailing list