Skip to content

paulross/PythonExtensionPatterns

Repository files navigation

PythonExtensionPatterns

If you need to write C extension for Python then this is the place for you.

The full documentation is on Read the Docs.

Code examples and documentation source are right here on GitHub.

Videos

I have presented some of this, well mostly the chapter "PyObjects and Reference Counting", at Python conferences so if you prefer videos they are here:

Subjects Covered

  • Introduction
  • A Simple Example
  • PyObjects and Reference Counting
  • Exception Raising
  • A Pythonic Coding Pattern for C Functions
  • Parsing Python Arguments
  • Creating New Types
  • Setting and Getting Module Globals
  • Logging
  • File Paths and Files
  • Subclassing and Using super()
  • Capsules
  • Iterators and Generators
  • Pickling C Extension Types
  • Setting Compiler Flags
  • Debugging
  • Memory Leaks
  • Thread Safety
  • Source Code Layout
  • Using C++ With CPython Code
  • Miscellaneous
  • Further Reading