Python Extension Patterns
latest
  • 1. Introduction
  • 2. PyObjects and Reference Counting
  • 3. Exception Raising
  • 4. A Pythonic Coding Pattern for C Functions
  • 5. Parsing Python Arguments
  • 6. Creating New Types
  • 7. Setting and Getting Module Globals
  • 8. Calling super() from C
  • 9. Setting Compiler Flags
  • 10. Debugging
  • 11. Memory Leaks
  • 12. Thread Safety
  • 13. Source Code Layout
  • 14. Using C++ With CPython Code
    • 14.1. C++ RAII Wrappers Around PyObject*
    • 14.2. Handling Default Arguments
    • 14.3. Homogeneous Python Containers and C++
    • 14.4. Python Unicode Strings and C++
    • 14.5. C++ and the Numpy C API
  • 15. Pickling C Extension Types
  • 16. Miscellaneous
  • 17. Further Reading
Python Extension Patterns
  • Docs »
  • 14. Using C++ With CPython Code
  • Edit on GitHub

14. Using C++ With CPython CodeΒΆ

Using C++ can take a lot of the pain out of interfacing CPython code, here are some examples.

  • 14.1. C++ RAII Wrappers Around PyObject*
    • 14.1.1. C++ RAII Wrapper for a Borrowed PyObject*
    • 14.1.2. C++ RAII Wrapper for a New PyObject*
  • 14.2. Handling Default Arguments
  • 14.3. Homogeneous Python Containers and C++
    • 14.3.1. Python Lists and C++ std::vector<T>
      • 14.3.1.1. Python list to C++ std::vector<T>
      • 14.3.1.2. C++ std::vector<T> to Python list
    • 14.3.2. Python Sets, Frozensets and C++ std::unordered_set<T>
      • 14.3.2.1. Python set to C++ std::unordered_set<T>
      • 14.3.2.2. C++ std::unordered_set<T> to Python set or frozenset
    • 14.3.3. Python Dicts and C++ std::unordered_map<K, V>
      • 14.3.3.1. Python dict to C++ std::unordered_map<K, V>
      • 14.3.3.2. C++ std::unordered_map<K, V> to Python dict
  • 14.4. Python Unicode Strings and C++
    • 14.4.1. Basic Handling of Unicode
    • 14.4.2. Working with bytes, bytearray and UTF-8 Unicode Arguments
  • 14.5. C++ and the Numpy C API
    • 14.5.1. Initialising Numpy
    • 14.5.2. Verifying Numpy is Initialised
    • 14.5.3. Numpy Initialisation Techniques
      • 14.5.3.1. Initialising Numpy in a CPython Module
      • 14.5.3.2. Initialising Numpy in Pure C++ Code
      • 14.5.3.3. Initialising Numpy in a CPython Module using C++ Code
      • 14.5.3.4. How These Macros Work Together
      • 14.5.3.5. Adding a Search Path to a Virtual Environment
Next Previous

© Copyright 2014, Paul Ross Revision 3c9d5601.

Built with Sphinx using a theme provided by Read the Docs.
Read the Docs v: latest
Versions
latest
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.