<div dir="ltr">Hi,<br><br><a href="http://hg.python.org/cpython/file/52e166a975f9/Doc/extending/extending.rst">http://hg.python.org/cpython/file/52e166a975f9/Doc/extending/extending.rst</a><br><br><div class=""><a href="http://hg.python.org/cpython/file/52e166a975f9/Doc/extending/extending.rst#l509" id="l509">   509</a> <span class="">   /* Time to call the callback */</span></div>

<div class=""><a href="http://hg.python.org/cpython/file/52e166a975f9/Doc/extending/extending.rst#l510" id="l510">   510</a> <span class="">   arglist = Py_BuildValue("(i)", arg);</span></div>
<div class=""><a href="http://hg.python.org/cpython/file/52e166a975f9/Doc/extending/extending.rst#l511" id="l511">   511</a> <span class="">   result = PyObject_CallObject(my_callback, arglist);</span></div>
<div class=""><a href="http://hg.python.org/cpython/file/52e166a975f9/Doc/extending/extending.rst#l512" id="l512">   512</a> <span class="">   Py_DECREF(arglist);</span></div>
<div class=""><a href="http://hg.python.org/cpython/file/52e166a975f9/Doc/extending/extending.rst#l513" id="l513">   513</a> </div>
<div class=""><a href="http://hg.python.org/cpython/file/52e166a975f9/Doc/extending/extending.rst#l514" id="l514">   514</a> <span class="">:c:func:`PyObject_CallObject` returns a Python object pointer:</span> <span class="">this is the return</span></div>

<div class=""><a href="http://hg.python.org/cpython/file/52e166a975f9/Doc/extending/extending.rst#l515" id="l515">   515</a> value of the Python function.  <span class="">:c:func:</span><span class="">`PyObject_CallObject`</span> is</div>

<div class=""><a href="http://hg.python.org/cpython/file/52e166a975f9/Doc/extending/extending.rst#l516" id="l516">   516</a> "reference-count-neutral" with respect to its arguments.  In the example a new</div>
<div class=""><a href="http://hg.python.org/cpython/file/52e166a975f9/Doc/extending/extending.rst#l517" id="l517">   517</a> tuple was created to serve as the argument list, which is <span class="">:c:func:</span><span class="">`Py_DECREF`</span>\</div>

<div class=""><a href="http://hg.python.org/cpython/file/52e166a975f9/Doc/extending/extending.rst#l518" id="l518">   518</a> -ed immediately after the call.<br><br>According to the explain directly after the code, line 512 should be:<br>
<br>Py_DECREF(result);<br><br>Regards,<br>Isaiah Peng<br></div><br></div>