Hugh wrote: > Apologies if this has already been answered in here and I can't find > it, but can anyone help with this problem? > I hope the example code and comments state clearly enough what is > happening, but if not, please ask me for further information. > Thank in advance for any help. > # static PyObject* dummy(PyObject* self, PyObject* args) > # { > # return Py_None; > # } C functions must return an "owned" reference. or in other words, since Py_None is an existing object, you need to increment the reference count before returning it: Py_INCREF(Py_None); return Py_None; or, better, but only works in recent Pythons: Py_RETURN_NONE; for more on reference counting and object ownership, see: http://docs.python.org/ext/refcounts.html </F>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4