[Python-Dev] Maybe we should have a C++ extension for testing...

skip at pobox.com skip at pobox.com
Wed Sep 13 19:46:39 CEST 2006


Building Python with C and then linking in extensions written in or wrapped
with C++ can present problems, at least in some situations.  I don't know if
it's kosher to build that way, but folks do.  We're bumping into such
problems at work using Solaris 10 and Python 2.4 (building matplotlib, which
is largely written in C++), and it appears others have similar problems:

    http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6395191
    http://mail.python.org/pipermail/patches/2005-June/017820.html
    http://mail.python.org/pipermail/python-bugs-list/2005-November/030900.html

I attached a comment to the third item yesterday (even though it was
closed).

One of our C++ gurus (that's definitely not me!) patched the Python source
to include <wchar.h> at the top of Python.h.  That seems to have solved our
problems, but seems to be a symptomatic fix.  I got to thinking, should we
a) encourage people to compile Python with a C++ compiler if most/all of
their extensions are written in C++ anyway (does that even work if one or
more extensions are written in C?), or b) should the standard distribution
maybe include a toy extension written in C++ whose sole purpose is to test
for cross-language problems?

Either/or/neither/something else?

Skip


More information about the Python-Dev mailing list