top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Python : How a programmer can avoid infinite loop while writing progam in python ?

+1 vote
304 views
Python : How a programmer can avoid infinite loop while writing progam in python ?
posted Apr 24, 2016 by Vikram Singh

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

Similar Questions
+1 vote

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, 

 printf("before call");
 write_this_c(offset, size);
 printf("after call");
 Py_RETURN_NONE; ##delay happens here
}

How to avoid this delay time?

0 votes

I have searched for lots of tutorials and documentation on the web but, didnt find a decent one to develop extensions for Python 3 using a custom compiler (mingw32, nvcc). Please help me. PS: Dont point me to Python Documentation. It is not good for beginners. It doesnt elaborate about calls and implementation.

...