Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'static': 0.04; 'foss': 0.09; 'null,': 0.09; 'subject:while': 0.09; 'api': 0.11; 'python': 0.11; 'invoking': 0.16; 'seconds.': 0.16; 'size;': 0.16; 'statement.': 0.16; 'subject:python': 0.16; 'cheers,': 0.24; 'script': 0.25; '----': 0.29; 'quickly': 0.29; 'message- id:@mail.gmail.com': 0.30; 'skip:( 20': 0.30; 'fine,': 0.31; 'stuff': 0.32; '-----': 0.33; 'subject:from': 0.34; 'problem': 0.35; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'next': 0.36; 'method': 0.36; 'thanks': 0.36; 'subject:?': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'skip:x 10': 0.40; 'how': 0.40; 'here': 0.66; 'below.': 0.71 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=Jz8VMgm9eeXaZckUNtRN8OV0+rvcCaKP6uK4ZqdXqMI=; b=IryfrkAJEkoA3ts++AOMGyOCyDCb5HmWlkN2bRjwzTEfkvvcdTJuQ+F59iFkZA8mcj ZZPaWTK47XWOSfbUykzDEsHpwqp9WmNqicg/hpJFDti0Y/lRGewRPsi0Y0C32hZA/+7d yN+HZs/MRau84PXLm/g/dO5fRbQDYfs84mDGGnWfexKn/3sWGJnzVWa7kwzFHXyeEhzt a5hRqfowvQ1krIp17wuq8AQZSIRr6z+ClphMM8w1SlUo1tzeWoQbIlPQrAEpz4C3mLbL vaENJCJrbyntoYqUWR5Pb8Pz64/smqv6Xb7eOgeQ1t0TWj3Ny6QyIZ9nkXEtcsjIcexf 7egQ== X-Received: by 10.180.91.114 with SMTP id cd18mr46743139wib.28.1401272582691; Wed, 28 May 2014 03:23:02 -0700 (PDT) MIME-Version: 1.0 From: "Lakshmipathi.G" Date: Wed, 28 May 2014 15:52:42 +0530 Subject: how avoid delay while returning from C-python api? To: python-list@python.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 48 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1401272591 news.xs4all.nl 2872 [2001:888:2000:d::a6]:36402 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:72144 Hi - I have C-Python api like below. It works fine, but the problem is while invoking this method from python script say #cat script.py offset=0 size=4 write_object(offset,size) This calls write_this_c() C api and returns quickly to next printf statement. But the return call (Py_RETURN_NONE) takes something like 4-6 seconds. ----- static PyMethodDef xyz_methods[] = { {"write_object", write_object, METH_VARARGS,"write some stuff "}, {NULL, NULL, 0, NULL} }; ---- static PyObject * write_object(PyObject *self, PyObject *args) { int offset, size; if (!PyArg_ParseTuple(args,"ii", &offset, &size)) Py_RETURN_NONE; printf("before call"); write_this_c(offset, size); printf("after call"); Py_RETURN_NONE; ##delay happens here } How to avoid this delay time? Thanks for any help/pointers! ---- ---- Cheers, Lakshmipathi.G FOSS Programmer. www.giis.co.in