Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'debug': 0.04; 'subject:Python': 0.05; 'tries': 0.05; '*);': 0.09; 'indicates': 0.09; 'objects.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; '*v;': 0.16; 'expects': 0.16; 'pyobject': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'trying': 0.22; 'null)': 0.22; 'object.': 0.22; 'header:User-Agent:1': 0.26; 'header:X -Complaints-To:1': 0.26; 'parameters': 0.27; "i'm": 0.29; 'objects': 0.29; 'error.': 0.31; 'wrong': 0.35; 'to:addr:python- list': 0.35; 'expected': 0.35; 'should': 0.37; 'subject:: ': 0.37; 'charset:us-ascii': 0.37; 'received:org': 0.38; 'goes': 0.39; 'to:addr:python.org': 0.39; 'received:de': 0.40; 'received:217': 0.61; 'email addr:gmail.com': 0.64; 'when:': 0.66 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: dieter Subject: Re: Embedded Python and C Callback functions Date: Mon, 08 Jun 2015 07:44:52 +0200 References: <3726dccc-76cb-45a2-b0a8-e41ef300be96@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Gmane-NNTP-Posting-Host: pd9e0a03c.dip0.t-ipconnect.de User-Agent: Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.22 (linux) Cancel-Lock: sha1:PM9elbnrRlQHB4kOPXniFH9byxk= X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1433742309 news.xs4all.nl 2868 [2001:888:2000:d::a6]:51046 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:92327 doc.mefisto@gmail.com writes: > I'm trying to debug and find my error. It goes wrong when: > PyObject *v; > v = va_arg(*p_va, PyObject *); > if (v != NULL) { > if (*(*p_format - 1) != 'N') > Py_INCREF(v); > } > > it tries to PyINCREF to my passed callback. This indicates that it expects the "callback" to be a Python object. Check the C-API specification. It should tell you which parameters are expected to be Python objects and which C objects.