Skip to content
Some examples of using the C API of python 2.7.
C++ CMake C Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
00_extending_python
01_errors_exceptions
02_callback
03_vargs_kwargs
04_custom_type
05_python_function_call
06_python_run
.gitignore
CMakeLists.txt
LICENSE.md
README.md

README.md

cpython cookbook

License:MIT

Examples

  • 00 Extending python with C/C++: a simple python module written in C/C++ with an hello-world function;

  • 01 Errors and exceptions: this recipe shows how to create a custom exception and raise it back into Python;

  • 02 Python callback inside a C/C++ module: this recipe shows how to pass a python function into the module and call it inside the C/C++ module;

  • 03 Variable-length arguments and keyword arguments: this recipe shows how to handle variable-length arguments and keyword arguments;

  • 04 Custom type: this recipe shows how to define a custom data type inside the C/C++ module;

  • 05 Embedding python inside C/C++: this recipe shows how to integrate a python interpreter inside a C/C++ program;

  • 06 Executing python inside C/C++: this recipe shows how to run a simple C string as python code;

Contributing

  • Fork it!
  • Create your feature branch: git checkout -b my-new-feature
  • Commit your changes: git commit -am 'Add some feature'
  • Push to the branch: git push origin my-new-feature
  • Submit a pull request :D
You can’t perform that action at this time.