<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"MS Mincho";
        panose-1:2 2 6 9 4 2 5 8 3 4;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@MS Mincho";
        panose-1:2 2 6 9 4 2 5 8 3 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:JA;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
tt
        {mso-style-priority:99;
        font-family:"Courier New";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.apple-converted-space
        {mso-style-name:apple-converted-space;}
span.pre
        {mso-style-name:pre;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:JA;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">Hi,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I noticed the following changes in the C API manuals from 3.3.5 (and earlier versions) to 3.4. I don’t know if these changes are deliberate and imply that we C extension developers no longer need to care about ‘reference ownership’ because
 of some improvements in 3.4. Could anyone clarify it? <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks,<o:p></o:p></p>
<p class="MsoNormal">Jianfeng<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-size:16.0pt">--- 3.4  C API  reference manual ----<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"><a href="https://docs.python.org/3/c-api/structures.html#c.PyObject" title="PyObject"><span style="color:#30306F;text-decoration:none">PyObject</span></a>*<span class="apple-converted-space"> </span></span><tt><b><span style="font-size:14.5pt;color:#222222">PySequence_GetItem</span></b></tt><span style="font-size:13.5pt;font-family:"Arial","sans-serif";color:#222222">(</span><span style="font-family:"Arial","sans-serif";color:#222222"><a href="https://docs.python.org/3/c-api/structures.html#c.PyObject" title="PyObject"><span style="color:#30306F;text-decoration:none">PyObject</span></a><em><span style="font-family:"Arial","sans-serif""> *o</span></em>,
 Py_ssize_t<em><span style="font-family:"Arial","sans-serif""> i</span></em></span><span style="font-size:13.5pt;font-family:"Arial","sans-serif";color:#222222">)</span><span style="font-family:"Arial","sans-serif";color:#222222"><a href="https://docs.python.org/3/c-api/sequence.html#c.PySequence_GetItem" title="Permalink to this definition"><span style="font-size:9.5pt;color:#30306F;text-decoration:none">¶</span></a><o:p></o:p></span></p>
<p style="mso-margin-top-alt:0in;margin-right:0in;margin-bottom:5.0pt;margin-left:.5in;text-align:justify;text-justify:inter-ideograph;line-height:16.8pt;background:white">
<span style="font-family:"Arial","sans-serif";color:#222222">Return the</span><span class="apple-converted-space"><span style="font-family:"Arial","sans-serif";color:#222222"> </span></span><em><span style="font-family:"Arial","sans-serif";color:#222222">i</span></em><span style="font-family:"Arial","sans-serif";color:#222222">th
 element of</span><span class="apple-converted-space"><span style="font-family:"Arial","sans-serif";color:#222222"> </span></span><em><span style="font-family:"Arial","sans-serif";color:#222222">o</span></em><span style="font-family:"Arial","sans-serif";color:#222222">,
 or</span><span class="apple-converted-space"><span style="font-family:"Arial","sans-serif";color:#222222"> </span></span><em><span style="font-family:"Arial","sans-serif";color:#222222">NULL</span></em><span class="apple-converted-space"><span style="font-family:"Arial","sans-serif";color:#222222"> </span></span><span style="font-family:"Arial","sans-serif";color:#222222">on
 failure. This is the equivalent of the Python expression</span><span class="apple-converted-space"><span style="font-family:"Arial","sans-serif";color:#222222"> </span></span><span class="pre"><span style="font-size:11.5pt;font-family:"Courier New";color:#222222;background:#ECF0F3">o[i]</span></span><span style="font-family:"Arial","sans-serif";color:#222222">.<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"><a href="https://docs.python.org/3.4/c-api/structures.html#c.PyObject" title="PyObject"><span style="color:#30306F;text-decoration:none">PyObject</span></a>*<span class="apple-converted-space"> </span></span><tt><b><span style="font-size:14.5pt;color:#222222">PyList_GetItem</span></b></tt><span style="font-size:13.5pt;font-family:"Arial","sans-serif";color:#222222">(</span><span style="font-family:"Arial","sans-serif";color:#222222"><a href="https://docs.python.org/3.4/c-api/structures.html#c.PyObject" title="PyObject"><span style="color:#30306F;text-decoration:none">PyObject</span></a><em><span style="font-family:"Arial","sans-serif""> *list</span></em>,
 Py_ssize_t<em><span style="font-family:"Arial","sans-serif""> index</span></em></span><span style="font-size:13.5pt;font-family:"Arial","sans-serif";color:#222222">)</span><span style="font-family:"Arial","sans-serif";color:#222222"><o:p></o:p></span></p>
<p style="mso-margin-top-alt:0in;margin-right:0in;margin-bottom:5.0pt;margin-left:.5in;text-align:justify;text-justify:inter-ideograph;line-height:16.8pt;background:white">
<span style="font-family:"Arial","sans-serif";color:#222222">Return the object at position</span><span class="apple-converted-space"><span style="font-family:"Arial","sans-serif";color:#222222"> </span></span><em><span style="font-family:"Arial","sans-serif";color:#222222">index</span></em><span class="apple-converted-space"><span style="font-family:"Arial","sans-serif";color:#222222"> </span></span><span style="font-family:"Arial","sans-serif";color:#222222">in
 the list pointed to by</span><span class="apple-converted-space"><span style="font-family:"Arial","sans-serif";color:#222222"> </span></span><em><span style="font-family:"Arial","sans-serif";color:#222222">list</span></em><span style="font-family:"Arial","sans-serif";color:#222222">.
 The position must be positive, indexing from the end of the list is not supported. If</span><span class="apple-converted-space"><span style="font-family:"Arial","sans-serif";color:#222222"> </span></span><em><span style="font-family:"Arial","sans-serif";color:#222222">index</span></em><span class="apple-converted-space"><span style="font-family:"Arial","sans-serif";color:#222222"> </span></span><span style="font-family:"Arial","sans-serif";color:#222222">is
 out of bounds, return</span><span class="apple-converted-space"><span style="font-family:"Arial","sans-serif";color:#222222"> </span></span><em><span style="font-family:"Arial","sans-serif";color:#222222">NULL</span></em><span class="apple-converted-space"><span style="font-family:"Arial","sans-serif";color:#222222"> </span></span><span style="font-family:"Arial","sans-serif";color:#222222">and
 set an</span><span class="apple-converted-space"><span style="font-family:"Arial","sans-serif";color:#222222"> </span></span><span style="font-family:"Arial","sans-serif";color:#222222"><a href="https://docs.python.org/3.4/library/exceptions.html#IndexError" title="IndexError"><span class="pre"><span style="font-size:11.5pt;font-family:"Courier New";color:#30306F;text-decoration:none">IndexError</span></span></a></span><span class="apple-converted-space"><span style="font-family:"Arial","sans-serif";color:#222222"> </span></span><span style="font-family:"Arial","sans-serif";color:#222222">exception.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black;mso-fareast-language:ZH-CN"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:16.0pt;color:black;mso-fareast-language:ZH-CN">--- 3.3.5 C API reference manual ---<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"><a href="https://docs.python.org/3.3/c-api/structures.html#PyObject" title="PyObject"><span style="color:#30306F;text-decoration:none">PyObject</span></a>*<span class="apple-converted-space"> </span></span><tt><b><span style="font-size:14.5pt;color:#222222">PySequence_GetItem</span></b></tt><span style="font-size:13.5pt;font-family:"Arial","sans-serif";color:#222222">(</span><span style="font-family:"Arial","sans-serif";color:#222222"><a href="https://docs.python.org/3.3/c-api/structures.html#PyObject" title="PyObject"><span style="color:#30306F;text-decoration:none">PyObject</span></a><em><span style="font-family:"Arial","sans-serif""> *o</span></em>,
 Py_ssize_t<em><span style="font-family:"Arial","sans-serif""> i</span></em></span><span style="font-size:13.5pt;font-family:"Arial","sans-serif";color:#222222">)</span><span style="font-family:"Arial","sans-serif";color:#222222"><a href="https://docs.python.org/3.3/c-api/sequence.html#PySequence_GetItem" title="Permalink to this definition"><span style="font-size:9.5pt;color:#30306F;text-decoration:none">¶</span></a><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:2.25pt;margin-right:0in;margin-bottom:7.5pt;margin-left:.5in;text-align:justify;text-justify:inter-ideograph;line-height:15.6pt;background:white">
<em><span style="font-family:"Arial","sans-serif";color:#006600">Return value: New reference.</span></em><span style="font-family:"Arial","sans-serif";color:#222222"><o:p></o:p></span></p>
<p style="mso-margin-top-alt:0in;margin-right:0in;margin-bottom:5.0pt;margin-left:.5in;text-align:justify;text-justify:inter-ideograph;line-height:16.8pt;background:white">
<span style="font-family:"Arial","sans-serif";color:#222222">Return the</span><span class="apple-converted-space"><span style="font-family:"Arial","sans-serif";color:#222222"> </span></span><em><span style="font-family:"Arial","sans-serif";color:#222222">i</span></em><span style="font-family:"Arial","sans-serif";color:#222222">th
 element of</span><span class="apple-converted-space"><span style="font-family:"Arial","sans-serif";color:#222222"> </span></span><em><span style="font-family:"Arial","sans-serif";color:#222222">o</span></em><span style="font-family:"Arial","sans-serif";color:#222222">,
 or</span><span class="apple-converted-space"><span style="font-family:"Arial","sans-serif";color:#222222"> </span></span><em><span style="font-family:"Arial","sans-serif";color:#222222">NULL</span></em><span class="apple-converted-space"><span style="font-family:"Arial","sans-serif";color:#222222"> </span></span><span style="font-family:"Arial","sans-serif";color:#222222">on
 failure. This is the equivalent of the Python expression</span><span class="apple-converted-space"><span style="font-family:"Arial","sans-serif";color:#222222"> </span></span><span class="pre"><span style="font-size:11.5pt;font-family:"Courier New";color:#222222;background:#ECF0F3">o[i]</span></span><span style="font-family:"Arial","sans-serif";color:#222222">.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black;mso-fareast-language:ZH-CN"><o:p> </o:p></span></p>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"><a href="https://docs.python.org/3.3/c-api/structures.html#PyObject" title="PyObject"><span style="color:#30306F;text-decoration:none">PyObject</span></a>*<span class="apple-converted-space"> </span></span><tt><b><span style="font-size:14.5pt;color:#222222">PyList_GetItem</span></b></tt><span style="font-size:13.5pt;font-family:"Arial","sans-serif";color:#222222">(</span><span style="font-family:"Arial","sans-serif";color:#222222"><a href="https://docs.python.org/3.3/c-api/structures.html#PyObject" title="PyObject"><span style="color:#30306F;text-decoration:none">PyObject</span></a><em><span style="font-family:"Arial","sans-serif""> *list</span></em>,
 Py_ssize_t<em><span style="font-family:"Arial","sans-serif""> index</span></em></span><span style="font-size:13.5pt;font-family:"Arial","sans-serif";color:#222222">)</span><span style="font-family:"Arial","sans-serif";color:#222222"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:2.25pt;margin-right:0in;margin-bottom:7.5pt;margin-left:.5in;text-align:justify;text-justify:inter-ideograph;line-height:15.6pt;background:white">
<em><span style="font-family:"Arial","sans-serif";color:#006600">Return value: Borrowed reference.</span></em><span style="font-family:"Arial","sans-serif";color:#222222"><o:p></o:p></span></p>
<p style="mso-margin-top-alt:0in;margin-right:0in;margin-bottom:5.0pt;margin-left:.5in;text-align:justify;text-justify:inter-ideograph;line-height:16.8pt;background:white">
<span style="font-family:"Arial","sans-serif";color:#222222">Return the object at position</span><span class="apple-converted-space"><span style="font-family:"Arial","sans-serif";color:#222222"> </span></span><em><span style="font-family:"Arial","sans-serif";color:#222222">index</span></em><span class="apple-converted-space"><span style="font-family:"Arial","sans-serif";color:#222222"> </span></span><span style="font-family:"Arial","sans-serif";color:#222222">in
 the list pointed to by</span><span class="apple-converted-space"><span style="font-family:"Arial","sans-serif";color:#222222"> </span></span><em><span style="font-family:"Arial","sans-serif";color:#222222">list</span></em><span style="font-family:"Arial","sans-serif";color:#222222">.
 The position must be positive, indexing from the end of the list is not supported. If</span><span class="apple-converted-space"><span style="font-family:"Arial","sans-serif";color:#222222"> </span></span><em><span style="font-family:"Arial","sans-serif";color:#222222">index</span></em><span class="apple-converted-space"><span style="font-family:"Arial","sans-serif";color:#222222"> </span></span><span style="font-family:"Arial","sans-serif";color:#222222">is
 out of bounds, return</span><span class="apple-converted-space"><span style="font-family:"Arial","sans-serif";color:#222222"> </span></span><em><span style="font-family:"Arial","sans-serif";color:#222222">NULL</span></em><span class="apple-converted-space"><span style="font-family:"Arial","sans-serif";color:#222222"> </span></span><span style="font-family:"Arial","sans-serif";color:#222222">and
 set an</span><span class="apple-converted-space"><span style="font-family:"Arial","sans-serif";color:#222222"> </span></span><span style="font-family:"Arial","sans-serif";color:#222222"><a href="https://docs.python.org/3.3/library/exceptions.html#IndexError" title="IndexError"><span class="pre"><span style="font-size:11.5pt;font-family:"Courier New";color:#30306F;text-decoration:none">IndexError</span></span></a></span><span class="apple-converted-space"><span style="font-family:"Arial","sans-serif";color:#222222"> </span></span><span style="font-family:"Arial","sans-serif";color:#222222">exception.<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>