https://github.com/dexpota/cpython-api-examples
Some examples of using the C API of python 2.7.
https://github.com/dexpota/cpython-api-examples
Last synced: 12 months ago
JSON representation
Some examples of using the C API of python 2.7.
- Host: GitHub
- URL: https://github.com/dexpota/cpython-api-examples
- Owner: dexpota
- License: mit
- Created: 2017-05-12T20:00:57.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2022-11-24T10:21:08.000Z (over 3 years ago)
- Last Synced: 2025-05-06T19:32:00.618Z (about 1 year ago)
- Language: C++
- Size: 21.5 KB
- Stars: 4
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# cpython cookbook
[](https://opensource.org/licenses/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