Author X-Istence
Recipients X-Istence, ronaldoussoren
Date 2011-01-14.21:21:37
SpamBayes Score 8.03256e-11
Marked as misclassified No
Message-id <1295040100.28.0.0907494738582.issue10910@psf.upfronthosting.co.za>
In-reply-to
Content
I was recently attempting to get Botan (http://botan.randombit.net) working with Python 2.6.6 on FreeBSD when it failed to compile, I filled a bug with Botan (http://bugs.randombit.net/show_bug.cgi?id=135) and first thought it was a compiler issue, and then thought it might be a Boost.Python issue.

However after further digging, see comment 3 (http://bugs.randombit.net/show_bug.cgi?id=135#c3) I figured out it had to do with the fix that went in to pyport.h for issues with isspace/toupper/et al. on FreeBSD's libc and also Mac OS X.

As can be seen in http://svn.python.org/view/python/trunk/Include/pyport.h?r1=36519&r2=36793 a change was added to override the original definitions with a new one that used the wide character support. It was modified again in http://svn.python.org/view/python/trunk/Include/pyport.h?r1=77585&r2=80178 to also include Mac OS X for http://bugs.python.org/issue7072.

The issue here is that if this file is included in any C++ code that then also includes <locale> or any of other functions that might pull in localefwd.h the defines will cause actual C++ code functions to be overwritten with invalid data, and the C++ compiler will throw errors such as:

/usr/include/c++/4.2/bits/localefwd.h:58:34: error: macro "isspace" passed 2
arguments, but takes just 1

Putting an #if 0, #endif around that block of code allows Botan's python module to cleanly compile without issues.

I do apologise that I don't have a simple C++ program that reproduces the problem.
History
Date User Action Args
2011-01-14 21:21:40X-Istencesetrecipients: + X-Istence, ronaldoussoren
2011-01-14 21:21:40X-Istencesetmessageid: <1295040100.28.0.0907494738582.issue10910@psf.upfronthosting.co.za>
2011-01-14 21:21:37X-Istencelinkissue10910 messages
2011-01-14 21:21:37X-Istencecreate