¡@

Home 

python Programming Glossary: py_decref

Writing Python bindings for C++ code that use OpenCV

http://stackoverflow.com/questions/12957492/writing-python-bindings-for-c-code-that-use-opencv

PyObject o pyObjectFromRefcount refcount Py_INCREF o Py_DECREF o NumpyAllocator g_numpyAllocator enum ARG_NONE 0 ARG_MAT 1..

Call Python from C++

http://stackoverflow.com/questions/1417473/call-python-from-c

Main Name of Pythonfile pModule PyImport_Import pName Py_DECREF pName if pModule NULL pFunc PyObject_GetAttrString pModule writeLyricToFile.. 1 pValue PyUnicode_FromWideChar title 1 if pValue Py_DECREF pArgs Py_DECREF pModule showErrorBox _T pValue is false return.. PyUnicode_FromWideChar title 1 if pValue Py_DECREF pArgs Py_DECREF pModule showErrorBox _T pValue is false return 1 PyTuple_SetItem..

Understanding performance difference

http://stackoverflow.com/questions/17640235/understanding-performance-difference

additional parts. if result ob_refcnt 1 Py_INCREF result Py_DECREF PyTuple_GET_ITEM result 0 Py_DECREF PyTuple_GET_ITEM result.. 1 Py_INCREF result Py_DECREF PyTuple_GET_ITEM result 0 Py_DECREF PyTuple_GET_ITEM result 1 else result PyTuple_New 2 if result..

How to create a generator/iterator with the Python C API?

http://stackoverflow.com/questions/1815812/how-to-create-a-generator-iterator-with-the-python-c-api

to Sequence so you'll need deallocator method for it to Py_DECREF it . The sequence itself needs to implement __iter __ and create.. necessary. if PyObject_Init PyObject p spam_MyIterType Py_DECREF p return NULL p m m p i 0 return PyObject p The rest is pretty..

Simple Python Challenge: Fastest Bitwise XOR on Data Buffers

http://stackoverflow.com/questions/2119761/simple-python-challenge-fastest-bitwise-xor-on-data-buffers

const char pa const char pb char pc tail return_val res Py_DECREF res def inline_xor_nocopy aa bb real_size len aa a numpy.frombuffer..

Create and call python function from string via C API

http://stackoverflow.com/questions/3789881/create-and-call-python-function-from-string-via-c-api

x n tprint 5 x n treturn 77 n Py_file_input pGlobal pLocal Py_DECREF pValue Get a pointer to the function I just defined pFunc PyObject_GetAttrString.. it the number four pValue PyObject_CallObject pFunc pArgs Py_DECREF pArgs printf Returned val ld n PyInt_AsLong pValue Py_DECREF.. pArgs printf Returned val ld n PyInt_AsLong pValue Py_DECREF pValue Py_XDECREF pFunc Py_DECREF pNewMod Py_Finalize return..

Good way to append to a string

http://stackoverflow.com/questions/4435169/good-way-to-append-to-a-string

sv v pv if PyBytes_Check v Py_REFCNT v 1 newsize 0 pv 0 Py_DECREF v PyErr_BadInternalCall return 1 XXX UNREF NEWREF interface..

Python (and Python C API): __new__ versus __init__

http://stackoverflow.com/questions/4859129/python-and-python-c-api-new-versus-init

..... self first PyString_FromString if self first NULL Py_DECREF self return NULL ..... Note that without the __new__ method..