PyCXX: Write Python Extensions in C++

Barry Scott, barry@barrys-emacs.org

The CXX Project Page at SourceForge Home gives you access to the releases, the Subversion repository, and more.

PyCXX is designed to make it easier to extend Python with C++

CXX/Objects is a set of C++ facilities to make it easier to write Python extensions. The chief way in which PyCXX makes it easier to write Python extensions is that it greatly increases the probability that your program will not make a reference-counting error and will not have to continually check error returns from the Python C API. CXX/Objects integrates Python with C++ in these ways:


PyCXX documentation is split into Python 3 and Python 2 versions. The Python 3 documentation is the most accurate.

Latest PyCXX README file.


Version 6.2.3 (6-Feb-2011)

Fix memory leak in string encode and decode functions

Fix indirect python loading on windows - Bool_type was missing


Version 6.2.2 (26-Dec-2010)

Fix problem compiling against Python 3.1.3


Version 6.2.1 (15-Aug-2010)

Add support for NotImplementedError

Remove String() and Byte() c'tors that are not allowed by ISO C++ and where ambigous


Version 6.2.0 (9-May-2010)

Fix problems with new style classes.

Replace all example makefile and project files with setup_makefile.py script.

Add APIs to make calling python functions easier. See TupleN(), callOnSelf(), self()


Version 6.1.1 (26-Sep-2009)

Supports Python 3 starting at Python 3.1 and Python 2

Code clean up to fix compiler warnings reported by gcc 4.2.1 on Mac OS X when building for Python 3.


Version 6.1.0 (19-Jul-2009)

Supports Python 3 and Python 2

This release replaces 5.5.0 and 6.0.0

Speed of method calling has been improved.


Version 6.0.0 (31-Jan-2009)

Supports Python 3 only


Version 5.5.0 (31-Jan-2009)

Supports Python 2 only


Version 5.4.2 (11-Oct-2008)

Add support for rich compare.

Add the simplest code for a module with a single function and a single class (Demo/simple.cxx)

Fix long standing bugs with Dict::iterator


Version 5.4.1 (28-Jun-2008)

Add Boolean type from Vivian De Smedt.

Patch from Dmitry Kostjuchenko to which improves PyCXX method's calling speed/performance by almost 2 times.

More PY_LONG_LONG support.

No longer allow creation of Py::Int from PY_LONG_LONG as long long cannot fit. Use Py::Long.

Py:Dict can now be constructed from a Py::Object.


Version 5.4.0 (20-Jan-2007)

PyCXX has a new BSD license to make it open source compatible. Many thanks to Sebastian Sauer for bring this matter to our attention and to Paul Dubios for working with the LLNL people to get the license changed.

Fix compilation issues with GCC 4.1 found on FC6.

Fix compilation issues caused by problems in IRIX header files.

Add PY_LONG_LONG support from patch contributed by Dmitry Kostjuchenko.

Version 5.3.6 (21-Oct-2006)

Add support for Python 2.5

Add support for PY_LONG_LONG to Py::Int()

Version 5.3.5 (2-Oct-2005)

More changes to keep GCC 4.0 happy - no warning should be report

Version 5.3.4 (29-Aug-2005)

Add interator support - thanks to Helmut Jarausch - see pycxx_iter demo

Allow an extension to be part of a python package

Allow creation of Exception hierachies

Fix problem compiling with GCC 2.9X

Fix uninitialise memory problem

Work around compile problems with the example and GCC 4.0.

Version 5.3.3 and 5.3.2

No details recorded

PyCXX V5.3.1

Added fixes to support problems reported against GCC4 builds and .NET 2003 builds

Download PyCXX 5.3.1 from SourceForge.

PyCXX V5.3.0

I've added Unicode string support to PyCXX and fixed a number of reported bugs.

See the README and documentation for details.

Download PyCXX 5.3.0 from SourceForge.

-- BArry Scott, October 2004


PyCXX V5.2.0

After a long gap I have updated PyCXX (the name I prefer for CXX) to fix a number of bugs and add a small number of features.

I'm using the development of pysvn to drive the need for fixes and features in PyCXX.

-- Barry Scott, November 2003