Codebase list cppy / f8b9bcd
Import upstream version 1.1.0+git20210519.1.fa4db98 Debian Janitor 2 years ago
7 changed file(s) with 17 addition(s) and 16 deletion(s). Raw diff Collapse all Expand all
55 Author: The Nucleic Development Team
66 Author-email: sccolbert@gmail.com
77 License: UNKNOWN
8 Description: cppy
8 Description: Cppy
99 ====
1010
1111 .. image:: https://travis-ci.org/nucleic/cppy.svg?branch=master
0 cppy
0 Cppy
11 ====
22
33 .. image:: https://travis-ci.org/nucleic/cppy.svg?branch=master
55 Author: The Nucleic Development Team
66 Author-email: sccolbert@gmail.com
77 License: UNKNOWN
8 Description: cppy
8 Description: Cppy
99 ====
1010
1111 .. image:: https://travis-ci.org/nucleic/cppy.svg?branch=master
00 Error reporting
11 ===============
22
3 In addition to `cppy::ptr`, cppy provides a set a convenience function for
3 In addition to `cppy::ptr`, cppy provides a set of convenience functions for
44 reporting errors which all return a NULL pointer allowing them to be used as
55 follows:
66
1717 Functions
1818 ---------
1919
20 Functions taking two arguments provide sensible pre-formated error messages.
20 Functions taking two arguments provide sensible pre-formatted error messages.
2121
2222 .. code:: c++
2323
22 You can adapt this file completely to your liking, but it should at least
33 contain the root `toctree` directive.
44
5 Welcome to cppy's documentation!
5 Welcome to Cppy's documentation!
66 ================================
77
8 Cpppy is a small C++ header library which makes it easier to write Python
8 Cppy is a small C++ header library which makes it easier to write Python
99 extension modules. The primary feature is a PyObject smart pointer which
1010 automatically handles reference counting and provides convenience methods for
1111 performing common object operations.
00 Installation and use with setuptools
11 ====================================
22
3 Since cppy is nothing else than a collection of header that are only compiled
3 Since Cppy is nothing else than a collection of header that are only compiled
44 when used, installing it is extremely straightforward using pip::
55
66 $ pip install cppy
77
88 If you want to run the development version, you can install directly from
9 Github::
9 GitHub::
1010
1111 $ pip install https://github.com/nucleic/cppy
1212
1313
14 Using cppy in an extensions
14 Using Cppy in an extensions
1515 ---------------------------
1616
17 To use cppy in your extension (written in C++), you simply need to include it.
17 To use Cppy in your extension (written in C++), you simply need to include it.
1818
1919 .. code:: c++
2020
2323 Cppy includes Python.h so when including cppy.h you do not need to also include
2424 Python.h.
2525
26 Every functions, classes exposed by cppy are stored in the `cppy` namespace.
26 Every functions, classes exposed by Cppy are stored in the `cppy` namespace.
2727
2828 .. code:: c++
2929
3434 -------------------
3535
3636 Cppy is only needed during the installation step of the projects using it. The
37 following example setup.py script illustrates how to use cppy without requiring
37 following example setup.py script illustrates how to use Cppy without requiring
3838 it to be installed before `setup.py` is run.
3939
4040 .. code:: python
2727 In this situation you own a reference.
2828
2929 - Borrowed reference:
30 Some functions (`PyList_GetItem`, `PyTuple_GetItem`) do not incref the object
31 count before returning. In that case, you have only a borrowed reference, you
32 are not responsible for decrefing the object reference count.
30 Some functions (`PyList_GetItem`, `PyTuple_GetItem`, `PyDict_GetItem`, ...)
31 do not incref the object count before returning. In that case, you have only
32 a borrowed reference, you are not responsible for decrefing the object
33 reference count.
3334
3435 Borrowed references allow to avoid the cost of increfing/decrefing which is
3536 nice. However since you do not own the reference, if the object referenced is