Awasu » Extending Python
Monday 4th November 2019 4:22 PM []

This series of tutorials explains how to extend Python, allowing C/C++ functions to be called directly from Python code.

A minimal setup

How to create a minimal Python extension module.

Calling functions

How to define a C/C++ function and call it from Python.

Handling errors

How to pass errors back to the calling Python code.


How to call back into Python from the C/C++ code.

Managing the GIL

How to manage the GIL, for better multi-threaded performance.

There is also a companion tutorial that shows how to go the other way, and embed Python into an existing C/C++ program.

Have your say