A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2005-September/345477.html below:

Python 2.2.1 DLL extension causes "abnormal program termination"

Python 2.2.1 DLL extension causes "abnormal program termination" Python 2.2.1 DLL extension causes "abnormal program termination"Fredrik Lundh fredrik at pythonware.com
Thu Sep 1 10:47:55 EDT 2005
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> 




More information about the Python-list mailing list

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