Extending C++ With Python (A Brief Odyssey)

Presented by Tim Serong
Wednesday 4:45 p.m.–5:30 p.m. in Green Theatre CB07.02.25
Target audience: Developer


When the words "Python", "C++", "extension" and "module" appear in the same sentence, it's usually because someone is talking about a Python application which uses a C++ extension module, maybe for performance reasons. What if, instead, you want to extend a C++ application by writing Python modules? It turns out that's actually possible, by using the Python/C APIs to embed a Python interpreter in your application. But it's not very well documented. Come with me on a journey into the wonderful world of sub-interpreters, thread states, reference counting and irritating conflicts between global objects that expect to exist only once. Along the way we'll battle unexpected deadlocks, untangle contradictory documentation, and find that there are some things that cannot be safely killed. By the end of this adventure, you will have learned more than you ever wanted to know about pieces of the Python interpreter you never knew existed.

Presented by

Tim Serong

Tim spends most of his time working for SUSE, hacking on Ceph and related technologies. He has spoken about high availability and distributed storage at several previous LCAs. In his spare time he wrangles pigs, chickens, sheep and ducks, and was declared by one colleague "teammate most likely to survive the zombie apocalypse".