CINXE.COM
Issue 39573: [C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type - Python tracker
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title> Issue 39573: [C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type - Python tracker </title> <link rel="shortcut icon" href="@@file/favicon.ico" /> <link rel="stylesheet" type="text/css" href="@@file/main.css" /> <link rel="stylesheet" type="text/css" href="@@file/style.css" /> <link rel="search" type="application/opensearchdescription+xml" href="@@file/osd.xml" title="Python bug tracker search" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script nonce="41278ac60baf9dfc05e62c491244ecac9dd4d2c6380f2f42948bb1eee050b15d" type="text/javascript"> submitted = false; function submit_once() { if (submitted) { alert("Your request is being processed.\nPlease be patient."); return false; } submitted = true; return true; } function help_window(helpurl, width, height) { HelpWin = window.open('https://bugs.python.org/' + helpurl, 'RoundupHelpWindow', 'scrollbars=yes,resizable=yes,toolbar=no,height='+height+',width='+width); HelpWin.focus () } </script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.15/jquery-ui.js"></script> <script type="text/javascript" src="@@file/issue.item.js"></script> <link rel="stylesheet" type="text/css" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/smoothness/jquery-ui.css" /> </head> <body> <!-- Logo --> <h1 id="logoheader"> <a accesskey="1" href="." id="logolink"> <img src="@@file/python-logo.gif" alt="homepage" border="0" id="logo" /></a> </h1> <div id="utility-menu"> <!-- Search Box --> <div id="searchbox"> <form name="searchform" method="get" action="issue" id="searchform"> <div id="search"> <input type="hidden" name="@columns" value="id,github,activity,title,creator,assignee,status,type" /> <input type="hidden" name="@sort" value="-activity" /> <input type="hidden" name="@filter" value="status" /> <input type="hidden" name="@action" value="searchid" /> <input type="hidden" name="ignore" value="file:content" /> <input class="input-text" id="search-text" name="@search_text" size="10" /> <input type="submit" id="submit" value="search" name="submit" class="input-button" /> <input type="radio" name="status" id="status_notresolved" value="-1,1,3" /> <label for="status_notresolved">open</label> <input type="radio" name="status" checked="checked" id="status_all" value="-1,1,2,3" /> <label for="status_all">all</label> </div> </form> </div> </div> <div id="left-hand-navigation"> <!-- Main Menu NEED LEVEL TWO HEADER AND FOOTER --> <div id="menu"> <ul class="level-one"> <li><a href="https://www.python.org/" title="Go to the Python homepage">Python Home</a></li> <li><a href="https://www.python.org/about/" title="About The Python Language">About</a></li> <li><a href="https://www.python.org/blogs/" title="">News</a></li> <li><a href="https://www.python.org/doc/" title="">Documentation</a></li> <li><a href="https://www.python.org/downloads/" title="">Downloads</a></li> <li><a href="https://www.python.org/community/" title="">Community</a></li> <li><a href="https://www.python.org/psf/" title="Python Software Foundation">Foundation</a></li> <li><a href="https://devguide.python.org/" title="Python Developer's Guide">Developer's Guide</a></li> <li class="selected"><a href="." class="selected" title="Python Issue Tracker">Issue Tracker</a> <ul class="level-two"> <li> <strong>Issues</strong> <ul class="level-three"> <li><a href="issue?@template=search&status=1">Search</a></li> <li><a href="issue?@action=random">Random Issue</a></li> <li> <form method="post" action="issue39573"> <input type="submit" class="form-small" value="Show issue:" /> <input class="form-small" size="4" type="text" name="@number" /> <input type="hidden" name="@type" value="issue" /> <input type="hidden" name="@action" value="show" /> </form> </li> </ul> </li> <li> <strong>Summaries</strong> <ul class="level-three"> <li> <a href="issue?status=1&@sort=-activity&@columns=id%2Cgithub%2Cactivity%2Ctitle%2Ccreator%2Cstatus&@dispname=Issues%20with%20patch&@startwith=0&@group=priority&keywords=2&@action=search&@filter=&@pagesize=50">Issues with patch</a> </li> <li> <a href="issue?status=1&@sort=-activity&@columns=id%2Cgithub%2Cactivity%2Ctitle%2Ccreator%2Cstatus&@dispname=Easy%20issues&@startwith=0&@group=priority&keywords=6&@action=search&@filter=&@pagesize=50">Easy issues</a> </li> <li> <a href="issue?@template=stats">Stats</a> </li> </ul> </li> <li> <strong>User</strong> <form method="post" action="issue39573"> <ul class="level-three"> <li> Login<br /> <input size="10" name="openid_identifier" style="" /><br /> <input size="10" type="password" name="__login_password" /><br /> <input type="hidden" name="@action" value="Login" /> <input type="checkbox" name="remember" id="remember" /> <label for="remember">Remember me?</label><br /> <input class="form-small" type="submit" value="Login" /><br /> <input type="hidden" name="__came_from" value="https://bugs.python.org/issue39573?"> <input type="hidden" name="@sort" value=""/> <input type="hidden" name="@group" value=""/> <input type="hidden" name="@pagesize" value="50"/> <input type="hidden" name="@startwith" value="0"/> </li> <li> </li> <li><a href="user?@template=forgotten">Lost your login?</a></li> </ul> </form> </li> <li> <strong>Administration</strong> <ul class="level-three"> <li> <a href="user?@sort=username">User List</a></li> <li> <a href="user?iscommitter=1&@action=search&@sort=username&@pagesize=300">Committer List</a></li> </ul> </li> <li> <strong>Help</strong> <ul class="level-three"> <li><a href="http://docs.python.org/devguide/triaging.html"> Tracker Documentation</a></li> <li><a href="http://wiki.python.org/moin/TrackerDevelopment"> Tracker Development</a></li> <li><a href="https://github.com/python/psf-infra-meta/issues"> Report Tracker Problem</a></li> </ul> </li> </ul> </li> </ul> </div> <!-- menu --> </div> <!-- left-hand-navigation --> <div id="content-body"> <div id="body-main"> <div id="content"> <div id="breadcrumb"> Issue39573 </div> <div id="migration-notice"> <div id="migration-images"> <img width="32" src="@@file/python-logo-small.png" /> ➜ <a href="https://github.com/python/cpython/issues"><img width="32" src="@@file/gh-icon.png" /></a> </div> <p>This issue tracker <b>has been migrated to <a href="https://github.com/python/cpython/issues">GitHub</a></b>, and is currently <b>read-only</b>.<br /> For more information, <a title="GitHub FAQs" href="https://devguide.python.org/gh-faq/"> see the GitHub FAQs in the Python's Developer Guide.</a></p> </div> <div> <form method="post" name="itemSynopsis" onsubmit="return submit_once()" enctype="multipart/form-data" action="issue39573"> <div id="gh-issue-link"> <a href="https://github.com/python/cpython/issues/83754"> <img width="32" src="@@file/gh-icon.png" /> <p> <span>This issue has been migrated to GitHub:</span> https://github.com/python/cpython/issues/83754 </p> </a> </div> <fieldset><legend>classification</legend> <table class="form"> <tr> <th class="required"><a href="http://docs.python.org/devguide/triaging.html#title" target="_blank">Title</a>:</th> <td colspan="3"> <span>[C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type</span> <input type="hidden" name="title" value="[C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type"> </td> </tr> <tr> <th class="required"><a href="http://docs.python.org/devguide/triaging.html#type" target="_blank">Type</a>:</th> <td></td> <th><a href="http://docs.python.org/devguide/triaging.html#stage" target="_blank">Stage</a>:</th> <td>resolved</td> </tr> <tr> <th><a href="http://docs.python.org/devguide/triaging.html#components" target="_blank">Components</a>:</th> <td>C API</td> <th><a href="http://docs.python.org/devguide/triaging.html#versions" target="_blank">Versions</a>:</th> <td>Python 3.11</td> </tr> </table> </fieldset> <fieldset><legend>process</legend> <table class="form"> <tr> <th><a href="http://docs.python.org/devguide/triaging.html#status" target="_blank">Status</a>:</th> <td>closed</td> <th><a href="http://docs.python.org/devguide/triaging.html#resolution" target="_blank">Resolution</a>:</th> <td>fixed</td> </tr> <tr> <th> <a href="http://docs.python.org/devguide/triaging.html#dependencies" target="_blank">Dependencies</a>: </th> <td> </td> <th><a href="http://docs.python.org/devguide/triaging.html#superseder" target="_blank">Superseder</a>:</th> <td> </td> </tr> <tr> <th> <a href="http://docs.python.org/devguide/triaging.html#assigned-to" target="_blank">Assigned To</a>: </th> <td> </td> <th> <a href="http://docs.python.org/devguide/triaging.html#nosy-list" target="_blank">Nosy List</a><!-- <span tal:condition="context/nosy_count" tal:replace="python: ' (%d)' % context.nosy_count" /> -->: </th> <td> vstinner </td> </tr> <tr> <th> <a href="http://docs.python.org/devguide/triaging.html#priority" target="_blank">Priority</a>: </th> <td>normal</td> <th> <a href="http://docs.python.org/devguide/triaging.html#keywords" target="_blank">Keywords</a>: </th> <td>patch</td> </tr> </table> </fieldset> </form> <p>Created on <strong>2020-02-06 23:07</strong> by <strong>vstinner</strong>, last changed <strong>2022-04-11 14:59</strong> by <strong>admin</strong>. This issue is now <strong style="color:#00F; background-color:inherit;">closed</strong>.</p> <table class="files"> <tr><th class="header" colspan="4">Pull Requests</th></tr> <tr> <th>URL</th> <th>Status</th> <th>Linked</th> <th>Edit</th> </tr> <tr> <td><a href="https://github.com/python/cpython/pull/18388" title="bpo-39573: Use Py_REFCNT() macro">PR 18388</a></td> <td>merged</td> <td> <span>vstinner</span>, <span>2020-02-06 23:16</span> </td> <td> </td> </tr> <tr> <td><a href="https://github.com/python/cpython/pull/18389" title="bpo-39573: Add Py_SET_REFCNT() function">PR 18389</a></td> <td>merged</td> <td> <span>vstinner</span>, <span>2020-02-06 23:41</span> </td> <td> </td> </tr> <tr> <td><a href="https://github.com/python/cpython/pull/18390" title="bpo-39573: Use Py_TYPE() in abstract.c">PR 18390</a></td> <td>merged</td> <td> <span>vstinner</span>, <span>2020-02-07 00:26</span> </td> <td> </td> </tr> <tr> <td><a href="https://github.com/python/cpython/pull/18391" title="bpo-39573: Use Py_TYPE() macro in Python and Include directories">PR 18391</a></td> <td>merged</td> <td> <span>vstinner</span>, <span>2020-02-07 00:55</span> </td> <td> </td> </tr> <tr> <td><a href="https://github.com/python/cpython/pull/18392" title="bpo-39573: Use Py_TYPE() macro in Objects directory">PR 18392</a></td> <td>merged</td> <td> <span>vstinner</span>, <span>2020-02-07 01:26</span> </td> <td> </td> </tr> <tr> <td><a href="https://github.com/python/cpython/pull/18393" title="bpo-39573: Use Py_TYPE() macro in Modules directory">PR 18393</a></td> <td>merged</td> <td> <span>vstinner</span>, <span>2020-02-07 02:06</span> </td> <td> </td> </tr> <tr> <td><a href="https://github.com/python/cpython/pull/18394" title="bpo-39573: Add Py_SET_TYPE() function">PR 18394</a></td> <td>merged</td> <td> <span>vstinner</span>, <span>2020-02-07 02:39</span> </td> <td> </td> </tr> <tr> <td><a href="https://github.com/python/cpython/pull/18398" title="bpo-39573: Use Py_TYPE() macro in object.c">PR 18398</a></td> <td>merged</td> <td> <span>vstinner</span>, <span>2020-02-07 09:47</span> </td> <td> </td> </tr> <tr> <td><a href="https://github.com/python/cpython/pull/18400" title="bpo-39573: Add Py_SET_SIZE() function">PR 18400</a></td> <td>merged</td> <td> <span>vstinner</span>, <span>2020-02-07 10:20</span> </td> <td> </td> </tr> <tr> <td><a href="https://github.com/python/cpython/pull/18402" title="bpo-39573: Use Py_SET_SIZE() function">PR 18402</a></td> <td>merged</td> <td> <span>vstinner</span>, <span>2020-02-07 11:15</span> </td> <td> </td> </tr> <tr> <td><a href="https://github.com/python/cpython/pull/18411" title="bpo-39573: Use Py_TYPE() macro in ctypes.h">PR 18411</a></td> <td>merged</td> <td> <span>corona10</span>, <span>2020-02-08 03:53</span> </td> <td> </td> </tr> <tr> <td><a href="https://github.com/python/cpython/pull/18419" title="bpo-39573: Use Py_SIZE() in s_set() of cfield.c">PR 18419</a></td> <td>closed</td> <td> <span>shihai1991</span>, <span>2020-02-09 05:48</span> </td> <td> </td> </tr> <tr> <td><a href="https://github.com/python/cpython/pull/18488" title="bpo-39573: Add Py_IS_TYPE macro">PR 18488</a></td> <td>merged</td> <td> <span>corona10</span>, <span>2020-02-12 16:54</span> </td> <td> </td> </tr> <tr> <td><a href="https://github.com/python/cpython/pull/18496" title="bpo-39573: Fix bad copy-paste in Py_SET_SIZE.">PR 18496</a></td> <td>merged</td> <td> <span>brandtbucher</span>, <span>2020-02-13 01:43</span> </td> <td> </td> </tr> <tr> <td><a href="https://github.com/python/cpython/pull/18507" title=" bpo-39573: Update clinic to use Py_IS_TYPE macro">PR 18507</a></td> <td>merged</td> <td> <span>corona10</span>, <span>2020-02-14 01:11</span> </td> <td> </td> </tr> <tr> <td><a href="https://github.com/python/cpython/pull/18508" title="bpo-39573: Update Include/* to use Py_IS_TYPE">PR 18508</a></td> <td>merged</td> <td> <span>corona10</span>, <span>2020-02-14 01:21</span> </td> <td> </td> </tr> <tr> <td><a href="https://github.com/python/cpython/pull/18521" title="bpo-39573: Clean up modules and headers to use Py_IS_TYPE">PR 18521</a></td> <td>merged</td> <td> <span>corona10</span>, <span>2020-02-16 17:25</span> </td> <td> </td> </tr> <tr> <td><a href="https://github.com/python/cpython/pull/18601" title="bpo-39573: Finish converting to new Py_IS_TYPE macro.">PR 18601</a></td> <td>merged</td> <td> <span>petdance</span>, <span>2020-02-22 04:44</span> </td> <td> </td> </tr> <tr> <td><a href="https://github.com/python/cpython/pull/18789" title="bpo-39573: Use Py_IS_TYPE for type checking">PR 18789</a></td> <td>closed</td> <td> <span>petdance</span>, <span>2020-03-05 05:28</span> </td> <td> </td> </tr> <tr> <td><a href="https://github.com/python/cpython/pull/18798" title="bpo-39573: Use Py_IS_TYPE for negative type checks">PR 18798</a></td> <td>closed</td> <td> <span>petdance</span>, <span>2020-03-06 05:51</span> </td> <td> </td> </tr> <tr> <td><a href="https://github.com/python/cpython/pull/18799" title="bpo-39573: Make Py_IS_TYPE take const args. Add _PyObject_CAST_CONST.">PR 18799</a></td> <td>merged</td> <td> <span>petdance</span>, <span>2020-03-06 05:52</span> </td> <td> </td> </tr> <tr> <td><a href="https://github.com/python/cpython/pull/18804" title="">PR 18804</a></td> <td>merged</td> <td> <span>vstinner</span>, <span>2020-03-06 09:43</span> </td> <td> </td> </tr> <tr> <td><a href="https://github.com/python/cpython/pull/18809" title="bpo-39573: Use Py_IS_TYPE to check for types">PR 18809</a></td> <td>merged</td> <td> <span>petdance</span>, <span>2020-03-06 16:51</span> </td> <td> </td> </tr> <tr> <td><a href="https://github.com/python/cpython/pull/19882" title="bpo-39573: Use Py_IS_TYPE to check for types">PR 19882</a></td> <td>merged</td> <td> <span>shihai1991</span>, <span>2020-05-03 12:40</span> </td> <td> </td> </tr> <tr> <td><a href="https://github.com/python/cpython/pull/19975" title="">PR 19975</a></td> <td>closed</td> <td> <span>ZackerySpytz</span>, <span>2020-05-07 10:21</span> </td> <td> </td> </tr> <tr> <td><a href="https://github.com/python/cpython/pull/20290" title="bpo-39573: Convert Py_TYPE() to a static inline function">PR 20290</a></td> <td>merged</td> <td> <span>corona10</span>, <span>2020-05-21 15:37</span> </td> <td> </td> </tr> <tr> <td><a href="https://github.com/python/cpython/pull/20391" title="bpo-39573: Fix buildbot failure for tupleobject.c">PR 20391</a></td> <td>merged</td> <td> <span>corona10</span>, <span>2020-05-25 17:00</span> </td> <td> </td> </tr> <tr> <td><a href="https://github.com/python/cpython/pull/20429" title="bpo-39573: Convert Py_REFCNT and Py_SIZE to functions">PR 20429</a></td> <td>merged</td> <td> <span>vstinner</span>, <span>2020-05-26 14:19</span> </td> <td> </td> </tr> <tr> <td><a href="https://github.com/python/cpython/pull/20610" title="bpo-39573: Porting to Python 3.10: Py_SET_SIZE() macro">PR 20610</a></td> <td>merged</td> <td> <span>vstinner</span>, <span>2020-06-03 13:00</span> </td> <td> </td> </tr> <tr> <td><a href="https://github.com/python/cpython/pull/21262" title="[WIP, DO NOT MERGE] bpo-39573: Prepare CPython for opague PyObject structure.">PR 21262</a></td> <td>closed</td> <td> <span>WildCard65</span>, <span>2020-07-01 16:04</span> </td> <td> </td> </tr> <tr> <td><a href="https://github.com/python/cpython/pull/21433" title="bpo-39573: Use the Py_TYPE() macro">PR 21433</a></td> <td>merged</td> <td> <span>vstinner</span>, <span>2020-07-10 10:17</span> </td> <td> </td> </tr> <tr> <td><a href="https://github.com/python/cpython/pull/23366" title="bpo-39573: Convert Py_TYPE() and Py_SIZE() back to macros">PR 23366</a></td> <td>merged</td> <td> <span>vstinner</span>, <span>2020-11-18 14:02</span> </td> <td> </td> </tr> <tr> <td><a href="https://github.com/python/cpython/pull/23375" title="bpo-39573: Remove What's new entry for Py_SIZE()">PR 23375</a></td> <td>merged</td> <td> <span>hroncok</span>, <span>2020-11-18 18:49</span> </td> <td> </td> </tr> <tr> <td><a href="https://github.com/python/cpython/pull/26493" title="bpo-39573: Py_TYPE becomes a static inline function">PR 26493</a></td> <td>merged</td> <td> <span>vstinner</span>, <span>2021-06-02 23:08</span> </td> <td> </td> </tr> <tr> <td><a href="https://github.com/python/cpython/pull/26550" title="">PR 26550</a></td> <td></td> <td> <span>BTaskaya</span>, <span>2021-06-06 10:59</span> </td> <td> </td> </tr> <tr> <td><a href="https://github.com/python/cpython/pull/26596" title="bpo-44348: Revert "bpo-39573: Py_TYPE becomes a static inline function (GH-26493)"">PR 26596</a></td> <td>merged</td> <td> <span>pablogsal</span>, <span>2021-06-08 11:07</span> </td> <td> </td> </tr> <tr> <td><a href="https://github.com/python/cpython/pull/28128" title="bpo-39573: Py_TYPE becomes a static inline function">PR 28128</a></td> <td>merged</td> <td> <span>vstinner</span>, <span>2021-09-02 15:46</span> </td> <td> </td> </tr> </table> <table class="messages"> <tr><th colspan="4" class="header">Messages (96)</th></tr> <tr> <th> <a href="#msg361513" id="msg361513">msg361513</a> - <a href="msg361513">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-02-06 23:07</th> </tr> <tr> <td colspan="4" class="content"> <pre>Today, CPython is leaking too many implementation through its public C API. We cannot easily change the "default" C API, but we can enhance the "limited" C API (when Py_LIMITED_API macro is defined). Example of leaking implementation details: memory allocator, garbage collector, structure layouts, etc. Making PyObject an opaque structure would allow in the long term of modify structures to implement more efficient types (ex: list specialized for small integers), and it can prepare CPython to experiment tagged pointers. Longer rationale: * <a href="https://pythoncapi.readthedocs.io/">https://pythoncapi.readthedocs.io/</a> * <a href="https://pythoncapi.readthedocs.io/bad_api.html">https://pythoncapi.readthedocs.io/bad_api.html</a> * <a href="https://pythoncapi.readthedocs.io/optimization_ideas.html">https://pythoncapi.readthedocs.io/optimization_ideas.html</a> I propose to incremental evolve the existing limited C API towards opaque PyObject, by trying to reduce the risk of breakage. We may test changes on PyQt which uses the limited C API. Another idea would be to convert some C extensions of the standard library to the limited C API. It would ensure that the limited C API contains enough functions to be useful, but would also notify us directly if the API is broken.</pre> </td> </tr> <tr> <th> <a href="#msg361514" id="msg361514">msg361514</a> - <a href="msg361514">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-02-06 23:38</th> </tr> <tr> <td colspan="4" class="content"> <pre>> Another idea would be to convert some C extensions of the standard library to the limited C API. It would ensure that the limited C API contains enough functions to be useful, but would also notify us directly if the API is broken. First issues that I met when I tried that: * C code generated by Argument Clinic is incompatible the limited C API: METH_FASTCALL, _PyArg_CheckPositional(), static _PyArg_Parser, etc. are excluded from the limited C API. * PyTypeObject is opaque and so it's not possible to implement a deallocator function (tp_dealloc) which calls tp_free like: Py_TYPE(self)->tp_free((PyObject*)self); * _Py_IDENTIFIER() is not part of the limited C API</pre> </td> </tr> <tr> <th> <a href="#msg361515" id="msg361515">msg361515</a> - <a href="msg361515">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-02-06 23:39</th> </tr> <tr> <td colspan="4" class="content"> <pre> New changeset <a href="https://hg.python.org/lookup/a93c51e3a8e15f1a486d11d5b55a64f3381babe0">a93c51e3a8e15f1a486d11d5b55a64f3381babe0</a> by Victor Stinner in branch 'master': <a class="closed" title="[closed] [C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type" href="issue39573">bpo-39573</a>: Use Py_REFCNT() macro (<a href="https://github.com/python/cpython/pull/18388" class="closed" title="GitHub PR 18388: [merged] bpo-39573: Use Py_REFCNT() macro">GH-18388</a>) <a href="https://github.com/python/cpython/commit/a93c51e3a8e15f1a486d11d5b55a64f3381babe0">https://github.com/python/cpython/commit/a93c51e3a8e15f1a486d11d5b55a64f3381babe0</a> </pre> </td> </tr> <tr> <th> <a href="#msg361516" id="msg361516">msg361516</a> - <a href="msg361516">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-02-07 00:11</th> </tr> <tr> <td colspan="4" class="content"> <pre>> it can prepare CPython to experiment tagged pointers In September 2018, Neil Schemenauer did an experiment: * <a href="https://mail.python.org/archives/list/capi-sig@python.org/thread/EGAY55ZWMF2WSEMP7VAZSFZCZ4VARU7L/">https://mail.python.org/archives/list/capi-sig@python.org/thread/EGAY55ZWMF2WSEMP7VAZSFZCZ4VARU7L/</a> * <a href="https://github.com/nascheme/cpython/commits/tagged_int">https://github.com/nascheme/cpython/commits/tagged_int</a> More recent discussion on the capi-sig list: <a href="https://mail.python.org/archives/list/capi-sig@python.org/thread/JPUNPN3AILGXOA3C2TTSLMOFNSWJE3QX/">https://mail.python.org/archives/list/capi-sig@python.org/thread/JPUNPN3AILGXOA3C2TTSLMOFNSWJE3QX/</a> See also my notes: <a href="https://pythoncapi.readthedocs.io/optimization_ideas.html#tagged-pointers-doable">https://pythoncapi.readthedocs.io/optimization_ideas.html#tagged-pointers-doable</a> Wikipedia article: <a href="https://en.wikipedia.org/wiki/Tagged_pointer">https://en.wikipedia.org/wiki/Tagged_pointer</a></pre> </td> </tr> <tr> <th> <a href="#msg361517" id="msg361517">msg361517</a> - <a href="msg361517">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-02-07 00:19</th> </tr> <tr> <td colspan="4" class="content"> <pre>In the limited C API, Py_REFCNT() should be converted to: static inline Py_ssize_t _Py_REFCNT(const PyObject *ob) { return ob->ob_refcnt; } #define Py_REFCNT(ob) _Py_REFCNT(_PyObject_CAST(ob)) It would enforce the usage of newly added Py_SET_REFCNT() (<a href="https://github.com/python/cpython/pull/18389" class="closed" title="GitHub PR 18389: [merged] bpo-39573: Add Py_SET_REFCNT() function">PR 18389</a>) and advertise that the object is not modified (const). That would only be the first step towards a really opaque Py_REFCNT() function.</pre> </td> </tr> <tr> <th> <a href="#msg361518" id="msg361518">msg361518</a> - <a href="msg361518">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-02-07 00:22</th> </tr> <tr> <td colspan="4" class="content"> <pre>TODO: Add Py_IS_TYPE() macro: #define Py_IS_TYPE(ob, tp) (Py_TYPE(ob) == (tp)) For example, replace: #define PyBool_Check(x) (Py_TYPE(x) == &PyBool_Type) with: #define PyBool_Check(x) Py_IS_TYPE(x, &PyBool_Type) IMHO it makes the code more readable. <a href="https://github.com/nascheme/cpython/commit/c156300592dc1eab234b74ed5b7cc90a020ab82b">https://github.com/nascheme/cpython/commit/c156300592dc1eab234b74ed5b7cc90a020ab82b</a></pre> </td> </tr> <tr> <th> <a href="#msg361519" id="msg361519">msg361519</a> - <a href="msg361519">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-02-07 00:24</th> </tr> <tr> <td colspan="4" class="content"> <pre> New changeset <a href="https://hg.python.org/lookup/c86a11221df7e37da389f9c6ce6e47ea22dc44ff">c86a11221df7e37da389f9c6ce6e47ea22dc44ff</a> by Victor Stinner in branch 'master': <a class="closed" title="[closed] [C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type" href="issue39573">bpo-39573</a>: Add Py_SET_REFCNT() function (<a href="https://github.com/python/cpython/pull/18389" class="closed" title="GitHub PR 18389: [merged] bpo-39573: Add Py_SET_REFCNT() function">GH-18389</a>) <a href="https://github.com/python/cpython/commit/c86a11221df7e37da389f9c6ce6e47ea22dc44ff">https://github.com/python/cpython/commit/c86a11221df7e37da389f9c6ce6e47ea22dc44ff</a> </pre> </td> </tr> <tr> <th> <a href="#msg361522" id="msg361522">msg361522</a> - <a href="msg361522">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-02-07 00:53</th> </tr> <tr> <td colspan="4" class="content"> <pre> New changeset <a href="https://hg.python.org/lookup/0d76d2bd28ac815dabae8b07240ed002ac8fce2d">0d76d2bd28ac815dabae8b07240ed002ac8fce2d</a> by Victor Stinner in branch 'master': <a class="closed" title="[closed] [C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type" href="issue39573">bpo-39573</a>: Use Py_TYPE() in abstract.c (<a href="https://github.com/python/cpython/pull/18390" class="closed" title="GitHub PR 18390: [merged] bpo-39573: Use Py_TYPE() in abstract.c">GH-18390</a>) <a href="https://github.com/python/cpython/commit/0d76d2bd28ac815dabae8b07240ed002ac8fce2d">https://github.com/python/cpython/commit/0d76d2bd28ac815dabae8b07240ed002ac8fce2d</a> </pre> </td> </tr> <tr> <th> <a href="#msg361523" id="msg361523">msg361523</a> - <a href="msg361523">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-02-07 01:02</th> </tr> <tr> <td colspan="4" class="content"> <pre>Py_TYPE() is commonly used to render the type name in an error message. Example: PyErr_Format(PyExc_TypeError, "cannot convert '%.200s' object to bytearray", Py_TYPE(arg)->tp_name); This code has multiple issues: * It truncates type name to 200 characters: there is no Python exception, not even a marker to indicate that the string has been truncated * It's only the short name: the qualified name (tp_qualname) would be more helpful. The best would be to generate the fully qualified name: module + qualname. * Py_TYPE() returns a borrowed reference which is causing multiple issues: <a href="https://pythoncapi.readthedocs.io/bad_api.html#borrowed-references">https://pythoncapi.readthedocs.io/bad_api.html#borrowed-references</a> In September 2018, I created <a class="closed" title="[closed] PyUnicode_FromFormat(): add %T format for an object type name" href="issue34595">bpo-34595</a>: "PyUnicode_FromFormat(): add %T format for an object type name". But there was disagreement, so I rejected my change. I started "<a class="closed" title="[closed] PyUnicode_FromFormat(): add %T format for an object type name" href="issue34595">bpo-34595</a>: How to format a type name?" thread on python-dev: * <a href="https://mail.python.org/archives/list/python-dev@python.org/thread/HKYUMTVHNBVB5LJNRMZ7TPUQKGKAERCJ/#3UAMHYG6UF4MPLXBZORHO4JVKUBRUZ53">https://mail.python.org/archives/list/python-dev@python.org/thread/HKYUMTVHNBVB5LJNRMZ7TPUQKGKAERCJ/#3UAMHYG6UF4MPLXBZORHO4JVKUBRUZ53</a> I didn't continue this work (until now), since it wasn't my priority.</pre> </td> </tr> <tr> <th> <a href="#msg361526" id="msg361526">msg361526</a> - <a href="msg361526">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-02-07 01:24</th> </tr> <tr> <td colspan="4" class="content"> <pre> New changeset <a href="https://hg.python.org/lookup/a102ed7d2f0e7e05438f14d5fb72ca0358602249">a102ed7d2f0e7e05438f14d5fb72ca0358602249</a> by Victor Stinner in branch 'master': <a class="closed" title="[closed] [C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type" href="issue39573">bpo-39573</a>: Use Py_TYPE() macro in Python and Include directories (<a href="https://github.com/python/cpython/pull/18391" class="closed" title="GitHub PR 18391: [merged] bpo-39573: Use Py_TYPE() macro in Python and Include directories">GH-18391</a>) <a href="https://github.com/python/cpython/commit/a102ed7d2f0e7e05438f14d5fb72ca0358602249">https://github.com/python/cpython/commit/a102ed7d2f0e7e05438f14d5fb72ca0358602249</a> </pre> </td> </tr> <tr> <th> <a href="#msg361527" id="msg361527">msg361527</a> - <a href="msg361527">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-02-07 01:42</th> </tr> <tr> <td colspan="4" class="content"> <pre>Make PyObject an opaque structure is also a first step towards the more ambitious project "HPy" project which is fully opaque: <a href="https://github.com/pyhandle/hpy">https://github.com/pyhandle/hpy</a> This API is written from scratch and currently implemented on top on the existing C API. The following article is a nice introduction to the overall idea: <a href="https://morepypy.blogspot.com/2019/12/hpy-kick-off-sprint-report.html">https://morepypy.blogspot.com/2019/12/hpy-kick-off-sprint-report.html</a> From my point of view, the long term goal would be to get better performance on PyPy and having a single API for C extension which would be efficient on all Python implementations (not only CPython). Currently, the C API is not only a performance issue to run C extensions on PyPy. It's also an issue in CPython. Because the C API leaks too many implementation details, we cannot experiment optimizations. See also: <a href="https://pythoncapi.readthedocs.io/rationale.html">https://pythoncapi.readthedocs.io/rationale.html</a></pre> </td> </tr> <tr> <th> <a href="#msg361529" id="msg361529">msg361529</a> - <a href="msg361529">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-02-07 02:04</th> </tr> <tr> <td colspan="4" class="content"> <pre> New changeset <a href="https://hg.python.org/lookup/58ac700fb09497df14d4492b6f820109490b2b88">58ac700fb09497df14d4492b6f820109490b2b88</a> by Victor Stinner in branch 'master': <a class="closed" title="[closed] [C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type" href="issue39573">bpo-39573</a>: Use Py_TYPE() macro in Objects directory (<a href="https://github.com/python/cpython/pull/18392" class="closed" title="GitHub PR 18392: [merged] bpo-39573: Use Py_TYPE() macro in Objects directory">GH-18392</a>) <a href="https://github.com/python/cpython/commit/58ac700fb09497df14d4492b6f820109490b2b88">https://github.com/python/cpython/commit/58ac700fb09497df14d4492b6f820109490b2b88</a> </pre> </td> </tr> <tr> <th> <a href="#msg361531" id="msg361531">msg361531</a> - <a href="msg361531">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-02-07 02:37</th> </tr> <tr> <td colspan="4" class="content"> <pre> New changeset <a href="https://hg.python.org/lookup/daa9756cb6395323d6f291efe5c7d7fdc6b2e9d8">daa9756cb6395323d6f291efe5c7d7fdc6b2e9d8</a> by Victor Stinner in branch 'master': <a class="closed" title="[closed] [C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type" href="issue39573">bpo-39573</a>: Use Py_TYPE() macro in Modules directory (<a href="https://github.com/python/cpython/pull/18393" class="closed" title="GitHub PR 18393: [merged] bpo-39573: Use Py_TYPE() macro in Modules directory">GH-18393</a>) <a href="https://github.com/python/cpython/commit/daa9756cb6395323d6f291efe5c7d7fdc6b2e9d8">https://github.com/python/cpython/commit/daa9756cb6395323d6f291efe5c7d7fdc6b2e9d8</a> </pre> </td> </tr> <tr> <th> <a href="#msg361540" id="msg361540">msg361540</a> - <a href="msg361540">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-02-07 08:17</th> </tr> <tr> <td colspan="4" class="content"> <pre> New changeset <a href="https://hg.python.org/lookup/d2ec81a8c99796b51fb8c49b77a7fe369863226f">d2ec81a8c99796b51fb8c49b77a7fe369863226f</a> by Victor Stinner in branch 'master': <a class="closed" title="[closed] [C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type" href="issue39573">bpo-39573</a>: Add Py_SET_TYPE() function (<a href="https://github.com/python/cpython/pull/18394" class="closed" title="GitHub PR 18394: [merged] bpo-39573: Add Py_SET_TYPE() function">GH-18394</a>) <a href="https://github.com/python/cpython/commit/d2ec81a8c99796b51fb8c49b77a7fe369863226f">https://github.com/python/cpython/commit/d2ec81a8c99796b51fb8c49b77a7fe369863226f</a> </pre> </td> </tr> <tr> <th> <a href="#msg361549" id="msg361549">msg361549</a> - <a href="msg361549">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-02-07 09:19</th> </tr> <tr> <td colspan="4" class="content"> <pre>To make PyObject opaque, we would have to convert Py_INCREF() and Py_DECREF() to opaque function calls. Example: #define Py_XINCREF(op) Py_IncRef(op) #define Py_XDECREF(op) Py_DecRef(op) Benchmarks should be run to measure to overhead and balance the advantages and drawbacks.</pre> </td> </tr> <tr> <th> <a href="#msg361555" id="msg361555">msg361555</a> - <a href="msg361555">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-02-07 09:55</th> </tr> <tr> <td colspan="4" class="content"> <pre>Would a Py_TYPE_IS() macro help code readability? For example: #define Future_CheckExact(obj) (Py_TYPE(obj) == &FutureType) would become: #define Future_CheckExact(obj) (Py_TYPE_IS(obj, &FutureType)) Py_TYPE_IS() would be more efficient for tagged pointers. I'm not sure about the macro name. Neil used Py_IS_TYPE(obj, type). Note: Py_TYPE_EQ(obj, type) name sounds confusing since the first parameter is an object, whereas the second one is a type.</pre> </td> </tr> <tr> <th> <a href="#msg361557" id="msg361557">msg361557</a> - <a href="msg361557">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-02-07 10:18</th> </tr> <tr> <td colspan="4" class="content"> <pre> New changeset <a href="https://hg.python.org/lookup/c65b320a95784d2b2133926921d67ac439259e9f">c65b320a95784d2b2133926921d67ac439259e9f</a> by Victor Stinner in branch 'master': <a class="closed" title="[closed] [C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type" href="issue39573">bpo-39573</a>: Use Py_TYPE() macro in object.c (<a href="https://github.com/python/cpython/pull/18398" class="closed" title="GitHub PR 18398: [merged] bpo-39573: Use Py_TYPE() macro in object.c">GH-18398</a>) <a href="https://github.com/python/cpython/commit/c65b320a95784d2b2133926921d67ac439259e9f">https://github.com/python/cpython/commit/c65b320a95784d2b2133926921d67ac439259e9f</a> </pre> </td> </tr> <tr> <th> <a href="#msg361590" id="msg361590">msg361590</a> - <a href="msg361590">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-02-07 11:05</th> </tr> <tr> <td colspan="4" class="content"> <pre> New changeset <a href="https://hg.python.org/lookup/b10dc3e7a11fcdb97e285882eba6da92594f90f9">b10dc3e7a11fcdb97e285882eba6da92594f90f9</a> by Victor Stinner in branch 'master': <a class="closed" title="[closed] [C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type" href="issue39573">bpo-39573</a>: Add Py_SET_SIZE() function (<a href="https://github.com/python/cpython/pull/18400" class="closed" title="GitHub PR 18400: [merged] bpo-39573: Add Py_SET_SIZE() function">GH-18400</a>) <a href="https://github.com/python/cpython/commit/b10dc3e7a11fcdb97e285882eba6da92594f90f9">https://github.com/python/cpython/commit/b10dc3e7a11fcdb97e285882eba6da92594f90f9</a> </pre> </td> </tr> <tr> <th> <a href="#msg361593" id="msg361593">msg361593</a> - <a href="msg361593">(view)</a></th> <th>Author: Serhiy Storchaka (serhiy.storchaka) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-02-07 11:31</th> </tr> <tr> <td colspan="4" class="content"> <pre>You have merged so much PRs today. What they do? PyObject cannot just be made an opaque structure. The user code reads and writes its fields directly and via macros. This change would break working code. We can encourage the user code to prepare to making PyObject an opaque structure. We need to provide a stable C API for access of PyObject fields for this. Note that there is a performance penalty of using functions instead of direct access, so you should have very good reasons to do this.</pre> </td> </tr> <tr> <th> <a href="#msg361607" id="msg361607">msg361607</a> - <a href="msg361607">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-02-07 18:45</th> </tr> <tr> <td colspan="4" class="content"> <pre>> You have merged so much PRs today. What they do? I merged changes which prepares CPython code base to make PyObject opaque. I only merged changes which should have no impact on performance, but prepare the API to make the structure opaque. Right now, Py_SET_REFNCT() stills access directly to PyObject.ob_refcnt. But it becomes possible to make Py_SET_REFNCT() an opaque function call. Do you see any issue with the changes that I already merged? Using PGO+LTO, static inline functions should be as efficient as the previous code using Py_REFCNT() & cie macros. > PyObject cannot just be made an opaque structure. The user code reads and writes its fields directly and via macros. This change would break working code. I'm trying to modifying the limited C API to make it possible: all access to PyObject fields should go through macros or function calls. The question is now how which fields are accessed and how. > We can encourage the user code to prepare to making PyObject an opaque structure. We need to provide a stable C API for access of PyObject fields for this. For the short term, I don't plan to make PyObject opaque, so I don't plan to enforce usage of Py_TYPE(), Py_SET_REFCNT(), etc. > Note that there is a performance penalty of using functions instead of direct access, so you should have very good reasons to do this. Yeah, replacing Py_REFCNT() macro with an opaque function call is likely to have an impact on performance. It should be properly measure, I'm well aware of that, I already wrote it in a previous comment ;-) I don't plan to push change such right now. And I will wait for the review of my peers (like you) for such change ;-)</pre> </td> </tr> <tr> <th> <a href="#msg361611" id="msg361611">msg361611</a> - <a href="msg361611">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-02-07 22:18</th> </tr> <tr> <td colspan="4" class="content"> <pre> New changeset <a href="https://hg.python.org/lookup/60ac6ed5579f6666130fc264d3b748ee9575e3aa">60ac6ed5579f6666130fc264d3b748ee9575e3aa</a> by Victor Stinner in branch 'master': <a class="closed" title="[closed] [C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type" href="issue39573">bpo-39573</a>: Use Py_SET_SIZE() function (<a href="https://github.com/python/cpython/pull/18402" class="closed" title="GitHub PR 18402: [merged] bpo-39573: Use Py_SET_SIZE() function">GH-18402</a>) <a href="https://github.com/python/cpython/commit/60ac6ed5579f6666130fc264d3b748ee9575e3aa">https://github.com/python/cpython/commit/60ac6ed5579f6666130fc264d3b748ee9575e3aa</a> </pre> </td> </tr> <tr> <th> <a href="#msg361626" id="msg361626">msg361626</a> - <a href="msg361626">(view)</a></th> <th>Author: Steve Dower (steve.dower) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-02-08 12:08</th> </tr> <tr> <td colspan="4" class="content"> <pre>"static inline" functions are not opaque - as they get inlined into 3rd-party compiled code, we can't change anything they reference, and so the structure layout is still fixed and has to be visible to the user's compiler. I'm not totally against the changes, but it's worth pointing out that you aren't achieving what the issue title claims, so it's really just code cleanliness (and/or introducing macro-users to static inline functions ;) ).</pre> </td> </tr> <tr> <th> <a href="#msg361631" id="msg361631">msg361631</a> - <a href="msg361631">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-02-08 14:28</th> </tr> <tr> <td colspan="4" class="content"> <pre>> "static inline" functions are not opaque I'm well aware of that :-) But once the CPython code base will stop accessing directly PyObject fields directly, it would become possible to experiment changing PyObject layout, at least testing it in CPython. First changes are just to prepare the code base to experiment the real change. But as Serhiy pointed out, the second part will have an impact on performance and so should be carefully benchmarked to balance advantages and drawbacks, even if it's only done in the limited C API.</pre> </td> </tr> <tr> <th> <a href="#msg361639" id="msg361639">msg361639</a> - <a href="msg361639">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-02-08 23:46</th> </tr> <tr> <td colspan="4" class="content"> <pre> New changeset <a href="https://hg.python.org/lookup/7f6f7eef5206858030cbe4f80a7c04b02781cc9a">7f6f7eef5206858030cbe4f80a7c04b02781cc9a</a> by Dong-hee Na in branch 'master': <a class="closed" title="[closed] [C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type" href="issue39573">bpo-39573</a>: Use Py_TYPE() macro in ctypes.h (<a href="https://github.com/python/cpython/pull/18411" class="closed" title="GitHub PR 18411: [merged] bpo-39573: Use Py_TYPE() macro in ctypes.h">GH-18411</a>) <a href="https://github.com/python/cpython/commit/7f6f7eef5206858030cbe4f80a7c04b02781cc9a">https://github.com/python/cpython/commit/7f6f7eef5206858030cbe4f80a7c04b02781cc9a</a> </pre> </td> </tr> <tr> <th> <a href="#msg361904" id="msg361904">msg361904</a> - <a href="msg361904">(view)</a></th> <th>Author: Dong-hee Na (corona10) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-02-12 15:36</th> </tr> <tr> <td colspan="4" class="content"> <pre>FYI, I am working on to add Py_IS_TYPE macro. :)</pre> </td> </tr> <tr> <th> <a href="#msg361960" id="msg361960">msg361960</a> - <a href="msg361960">(view)</a></th> <th>Author: Hai Shi (shihai1991) <span title="Contributor form received">*</span> <img src="@@file/triager.png" title="Python triager" alt="(Python triager)" /></th> <th>Date: 2020-02-13 15:55</th> </tr> <tr> <td colspan="4" class="content"> <pre>Hi, guys. Is there value in adding `PyNone_Check` macro?(`_PyNone_Type` is not esposed to CAPI directly, so I am not sure about it) If the answer is 'yes', i can add it ;)</pre> </td> </tr> <tr> <th> <a href="#msg361961" id="msg361961">msg361961</a> - <a href="msg361961">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-02-13 15:58</th> </tr> <tr> <td colspan="4" class="content"> <pre>> Hi, guys. Is there value in adding `PyNone_Check` macro? "obj == Py_None" is a very common pattern. You have check how it is done in HPy: <a href="https://github.com/pyhandle/hpy">https://github.com/pyhandle/hpy</a> See also <a class="open" title="[open] [subinterpreters] Per-interpreter singletons (None, True, False, etc.)" href="issue39511">bpo-39511</a>: "[subinterpreters] Per-interpreter singletons (None, True, False, etc.)".</pre> </td> </tr> <tr> <th> <a href="#msg361963" id="msg361963">msg361963</a> - <a href="msg361963">(view)</a></th> <th>Author: Hai Shi (shihai1991) <span title="Contributor form received">*</span> <img src="@@file/triager.png" title="Python triager" alt="(Python triager)" /></th> <th>Date: 2020-02-13 16:03</th> </tr> <tr> <td colspan="4" class="content"> <pre>>"obj == Py_None" is a very common pattern. >You have check how it is done in HPy: <a href="https://github.com/pyhandle/hpy">https://github.com/pyhandle/hpy</a> >See also <a class="open" title="[open] [subinterpreters] Per-interpreter singletons (None, True, False, etc.)" href="issue39511">bpo-39511</a>: "[subinterpreters] Per-interpreter singletons (None, >True, False, etc.)". Thanks, I will check it.</pre> </td> </tr> <tr> <th> <a href="#msg361964" id="msg361964">msg361964</a> - <a href="msg361964">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-02-13 17:35</th> </tr> <tr> <td colspan="4" class="content"> <pre> New changeset <a href="https://hg.python.org/lookup/968dcd9e7a4d3aa9aaa1dfca693adf60d6b71ce7">968dcd9e7a4d3aa9aaa1dfca693adf60d6b71ce7</a> by Brandt Bucher in branch 'master': <a class="closed" title="[closed] [C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type" href="issue39573">bpo-39573</a>: Fix bad copy-paste in Py_SET_SIZE (<a href="https://github.com/python/cpython/pull/18496" class="closed" title="GitHub PR 18496: [merged] bpo-39573: Fix bad copy-paste in Py_SET_SIZE.">GH-18496</a>) <a href="https://github.com/python/cpython/commit/968dcd9e7a4d3aa9aaa1dfca693adf60d6b71ce7">https://github.com/python/cpython/commit/968dcd9e7a4d3aa9aaa1dfca693adf60d6b71ce7</a> </pre> </td> </tr> <tr> <th> <a href="#msg361965" id="msg361965">msg361965</a> - <a href="msg361965">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-02-13 17:37</th> </tr> <tr> <td colspan="4" class="content"> <pre> New changeset <a href="https://hg.python.org/lookup/d905df766c367c350f20c46ccd99d4da19ed57d8">d905df766c367c350f20c46ccd99d4da19ed57d8</a> by Dong-hee Na in branch 'master': <a class="closed" title="[closed] [C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type" href="issue39573">bpo-39573</a>: Add Py_IS_TYPE() function (<a href="https://github.com/python/cpython/pull/18488" class="closed" title="GitHub PR 18488: [merged] bpo-39573: Add Py_IS_TYPE macro">GH-18488</a>) <a href="https://github.com/python/cpython/commit/d905df766c367c350f20c46ccd99d4da19ed57d8">https://github.com/python/cpython/commit/d905df766c367c350f20c46ccd99d4da19ed57d8</a> </pre> </td> </tr> <tr> <th> <a href="#msg361971" id="msg361971">msg361971</a> - <a href="msg361971">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-02-13 21:50</th> </tr> <tr> <td colspan="4" class="content"> <pre>> Hi, guys. By the way, please find another more inclusive way to say hi, see: <a href="https://heyguys.cc/">https://heyguys.cc/</a></pre> </td> </tr> <tr> <th> <a href="#msg361977" id="msg361977">msg361977</a> - <a href="msg361977">(view)</a></th> <th>Author: Hai Shi (shihai1991) <span title="Contributor form received">*</span> <img src="@@file/triager.png" title="Python triager" alt="(Python triager)" /></th> <th>Date: 2020-02-14 00:50</th> </tr> <tr> <td colspan="4" class="content"> <pre>> By the way, please find another more inclusive way to say hi, see: <a href="https://heyguys.cc/">https://heyguys.cc/</a> Oh, copy that. Sorry for my poor english.</pre> </td> </tr> <tr> <th> <a href="#msg361987" id="msg361987">msg361987</a> - <a href="msg361987">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-02-14 07:48</th> </tr> <tr> <td colspan="4" class="content"> <pre> New changeset <a href="https://hg.python.org/lookup/d212c3c55d414203b0579e000d9f340f8cd11be7">d212c3c55d414203b0579e000d9f340f8cd11be7</a> by Dong-hee Na in branch 'master': <a class="closed" title="[closed] [C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type" href="issue39573">bpo-39573</a>: PyXXX_Check() macros use Py_IS_TYPE() (<a href="https://github.com/python/cpython/pull/18508" class="closed" title="GitHub PR 18508: [merged] bpo-39573: Update Include/* to use Py_IS_TYPE">GH-18508</a>) <a href="https://github.com/python/cpython/commit/d212c3c55d414203b0579e000d9f340f8cd11be7">https://github.com/python/cpython/commit/d212c3c55d414203b0579e000d9f340f8cd11be7</a> </pre> </td> </tr> <tr> <th> <a href="#msg361988" id="msg361988">msg361988</a> - <a href="msg361988">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-02-14 07:50</th> </tr> <tr> <td colspan="4" class="content"> <pre> New changeset <a href="https://hg.python.org/lookup/9aeb0ef9309384099e2f23bcee2240fbc096568e">9aeb0ef9309384099e2f23bcee2240fbc096568e</a> by Dong-hee Na in branch 'master': <a class="closed" title="[closed] [C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type" href="issue39573">bpo-39573</a>: Update clinic to use Py_IS_TYPE() function (<a href="https://github.com/python/cpython/pull/18507" class="closed" title="GitHub PR 18507: [merged] bpo-39573: Update clinic to use Py_IS_TYPE macro">GH-18507</a>) <a href="https://github.com/python/cpython/commit/9aeb0ef9309384099e2f23bcee2240fbc096568e">https://github.com/python/cpython/commit/9aeb0ef9309384099e2f23bcee2240fbc096568e</a> </pre> </td> </tr> <tr> <th> <a href="#msg362033" id="msg362033">msg362033</a> - <a href="msg362033">(view)</a></th> <th>Author: Andy Lester (petdance) <span title="Contributor form received">*</span></th> <th>Date: 2020-02-15 21:34</th> </tr> <tr> <td colspan="4" class="content"> <pre>@vstinner would it be helpful if I went on a sweep looking for places we can use the new Py_IS_TYPE macro? Getting away from Py_TYPE(op) would also mean a move to making the internals const-correct.</pre> </td> </tr> <tr> <th> <a href="#msg362034" id="msg362034">msg362034</a> - <a href="msg362034">(view)</a></th> <th>Author: Andy Lester (petdance) <span title="Contributor form received">*</span></th> <th>Date: 2020-02-15 21:36</th> </tr> <tr> <td colspan="4" class="content"> <pre>I'm hoping that a goal here is to make static inline int _Py_IS_TYPE(PyObject *ob, PyTypeObject *type) actually be static inline int _Py_IS_TYPE(const PyObject *ob, const PyTypeObject *type)</pre> </td> </tr> <tr> <th> <a href="#msg362133" id="msg362133">msg362133</a> - <a href="msg362133">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-02-17 09:48</th> </tr> <tr> <td colspan="4" class="content"> <pre>> Getting away from Py_TYPE(op) would also mean a move to making the internals const-correct. Would you mind to explain how it's an issue to modify PyObject* temporarily during a function call? It's common to increase the object reference count to ensure that it doesn't go even while we use it.</pre> </td> </tr> <tr> <th> <a href="#msg362134" id="msg362134">msg362134</a> - <a href="msg362134">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-02-17 10:09</th> </tr> <tr> <td colspan="4" class="content"> <pre> New changeset <a href="https://hg.python.org/lookup/1b55b65638254aa78b005fbf0b71fb02499f1852">1b55b65638254aa78b005fbf0b71fb02499f1852</a> by Dong-hee Na in branch 'master': <a class="closed" title="[closed] [C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type" href="issue39573">bpo-39573</a>: Clean up modules and headers to use Py_IS_TYPE() function (<a href="https://github.com/python/cpython/pull/18521" class="closed" title="GitHub PR 18521: [merged] bpo-39573: Clean up modules and headers to use Py_IS_TYPE">GH-18521</a>) <a href="https://github.com/python/cpython/commit/1b55b65638254aa78b005fbf0b71fb02499f1852">https://github.com/python/cpython/commit/1b55b65638254aa78b005fbf0b71fb02499f1852</a> </pre> </td> </tr> <tr> <th> <a href="#msg362166" id="msg362166">msg362166</a> - <a href="msg362166">(view)</a></th> <th>Author: Andy Lester (petdance) <span title="Contributor form received">*</span></th> <th>Date: 2020-02-18 02:21</th> </tr> <tr> <td colspan="4" class="content"> <pre>> Would you mind to explain how it's an issue to modify PyObject* temporarily during a function call? It's not a problem to modify the PyObject* during a function call. However, many functions don't need to modify the object, but are still taking non-const PyObject* arguments. For example if I have this code: if (Py_TYPE(deque) == &deque_type) { That doesn't modify deque to check the type, but because Py_TYPE casts away the constness, deque can't be a const object. However, with the new Py_IS_TYPE function: if (Py_IS_TYPE(deque, &deque_type)) { and these two changes: -static inline int _Py_IS_TYPE(PyObject *ob, PyTypeObject *type) { +static inline int _Py_IS_TYPE(const PyObject *ob, const PyTypeObject *type) { return ob->ob_type == type; } -#define Py_IS_TYPE(ob, type) _Py_IS_TYPE(_PyObject_CAST(ob), type) +#define Py_IS_TYPE(ob, type) _Py_IS_TYPE(((const PyObject*)(ob)), type) the deque variable can be const. Another example of a common pattern that I believe could benefit from this is Py_TYPE(ob)->tp_name. That could be turned into Py_TYPE_NAME(ob) and that would allow the ob to be a const pointer. If we can keep functions that don't modify the object to accept const PyObject* it will help make things safer in the long run.</pre> </td> </tr> <tr> <th> <a href="#msg362212" id="msg362212">msg362212</a> - <a href="msg362212">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-02-18 13:50</th> </tr> <tr> <td colspan="4" class="content"> <pre>> If we can keep functions that don't modify the object to accept const PyObject* it will help make things safer in the long run. In my experience, trying to add "const" is quite painful, since the "const" has to be propagated to all functions called by the modified function. Python never used "const" with "PyObject*" because they are *so many* functions which really modify objects on purpose. I don't see how adding "const" would help this issue "Make PyObject an opaque structure in the limited C API". If you consider that something should be changed, please open a *separated* issue.</pre> </td> </tr> <tr> <th> <a href="#msg362216" id="msg362216">msg362216</a> - <a href="msg362216">(view)</a></th> <th>Author: Andy Lester (petdance) <span title="Contributor form received">*</span></th> <th>Date: 2020-02-18 14:38</th> </tr> <tr> <td colspan="4" class="content"> <pre>All I'm saying is that I think Py_IS_TYPE is a great idea, and that Py_IS_TYPE should take const arguments, since its arguments are not modified. If you think that should go in a different ticket, then I can make that happen.</pre> </td> </tr> <tr> <th> <a href="#msg362445" id="msg362445">msg362445</a> - <a href="msg362445">(view)</a></th> <th>Author: Andy Lester (petdance) <span title="Contributor form received">*</span></th> <th>Date: 2020-02-22 04:45</th> </tr> <tr> <td colspan="4" class="content"> <pre>Just added a new PR to finish off the remaining places to use Py_IS_TYPE() <a href="https://github.com/python/cpython/pull/18601">https://github.com/python/cpython/pull/18601</a></pre> </td> </tr> <tr> <th> <a href="#msg363345" id="msg363345">msg363345</a> - <a href="msg363345">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-03-04 13:15</th> </tr> <tr> <td colspan="4" class="content"> <pre> New changeset <a href="https://hg.python.org/lookup/dffe4c07095e0c693e094d3c140e85a68bd8128e">dffe4c07095e0c693e094d3c140e85a68bd8128e</a> by Andy Lester in branch 'master': <a class="closed" title="[closed] [C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type" href="issue39573">bpo-39573</a>: Finish converting to new Py_IS_TYPE() macro (<a href="https://github.com/python/cpython/pull/18601" class="closed" title="GitHub PR 18601: [merged] bpo-39573: Finish converting to new Py_IS_TYPE macro.">GH-18601</a>) <a href="https://github.com/python/cpython/commit/dffe4c07095e0c693e094d3c140e85a68bd8128e">https://github.com/python/cpython/commit/dffe4c07095e0c693e094d3c140e85a68bd8128e</a> </pre> </td> </tr> <tr> <th> <a href="#msg363494" id="msg363494">msg363494</a> - <a href="msg363494">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-03-06 08:04</th> </tr> <tr> <td colspan="4" class="content"> <pre> New changeset <a href="https://hg.python.org/lookup/8767ce92d24d3687405848442e6c67cf0af1c657">8767ce92d24d3687405848442e6c67cf0af1c657</a> by Andy Lester in branch 'master': <a class="closed" title="[closed] [C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type" href="issue39573">bpo-39573</a>: Make Py_IS_TYPE() take constant parameters (<a href="https://github.com/python/cpython/pull/18799" class="closed" title="GitHub PR 18799: [merged] bpo-39573: Make Py_IS_TYPE take const args. Add _PyObject_CAST_CONST.">GH-18799</a>) <a href="https://github.com/python/cpython/commit/8767ce92d24d3687405848442e6c67cf0af1c657">https://github.com/python/cpython/commit/8767ce92d24d3687405848442e6c67cf0af1c657</a> </pre> </td> </tr> <tr> <th> <a href="#msg363564" id="msg363564">msg363564</a> - <a href="msg363564">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-03-06 22:53</th> </tr> <tr> <td colspan="4" class="content"> <pre> New changeset <a href="https://hg.python.org/lookup/557287075c264d2458cd3e1b45e9b8ee5341e0a1">557287075c264d2458cd3e1b45e9b8ee5341e0a1</a> by Andy Lester in branch 'master': <a class="closed" title="[closed] [C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type" href="issue39573">bpo-39573</a>: Use Py_IS_TYPE() macro to check for types (<a href="https://github.com/python/cpython/pull/18809" class="closed" title="GitHub PR 18809: [merged] bpo-39573: Use Py_IS_TYPE to check for types">GH-18809</a>) <a href="https://github.com/python/cpython/commit/557287075c264d2458cd3e1b45e9b8ee5341e0a1">https://github.com/python/cpython/commit/557287075c264d2458cd3e1b45e9b8ee5341e0a1</a> </pre> </td> </tr> <tr> <th> <a href="#msg365690" id="msg365690">msg365690</a> - <a href="msg365690">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-04-03 11:57</th> </tr> <tr> <td colspan="4" class="content"> <pre>I created <a class="closed" title="[closed] [C API] Prepare PyTypeObject structure for a stable ABI: avoid accessing members in the public API" href="issue40170">bpo-40170</a> "[C API] Make PyTypeObject structure an opaque structure in the public C API".</pre> </td> </tr> <tr> <th> <a href="#msg366473" id="msg366473">msg366473</a> - <a href="msg366473">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-04-15 01:35</th> </tr> <tr> <td colspan="4" class="content"> <pre>PyType_FromSpec() and PyType_Spec API are not currently compatible with opaque PyObject. Example: --- #define PyObject_HEAD PyObject ob_base; typedef struct { PyObject_HEAD ... } MyObject; static PyType_Spec type_spec = { .name = "MyObject", .basicsize = sizeof(MyObject), ... }; ... = PyType_FromSpec(&type_spec); --- sizeof(MyObject) requires to compute sizeof(PyObject). Issue reported by Ronald Oussoren on python-dev: <a href="https://mail.python.org/archives/list/python-dev@python.org/message/PGKRW7S2IUOWVRX6F7RT6VAWD3ZPUDYS/">https://mail.python.org/archives/list/python-dev@python.org/message/PGKRW7S2IUOWVRX6F7RT6VAWD3ZPUDYS/</a></pre> </td> </tr> <tr> <th> <a href="#msg366493" id="msg366493">msg366493</a> - <a href="msg366493">(view)</a></th> <th>Author: Ronald Oussoren (ronaldoussoren) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-04-15 08:30</th> </tr> <tr> <td colspan="4" class="content"> <pre>The incompatibility mentioned in <a href="msg366473">msg366473</a> is probably fixable by treating the PyObject header the same as the GC head structure. With some care this could mostly maintain binary compatibility by inserting some unused fields in PyObject_HEAD instead of the PyObject header when an extension targets a stable ABI version that has the PyObject header in-line. This issue seems to be comparible to the "fragile instance variable" issue fixed in Objective-C 2.0, see <<a href="https://en.wikipedia.org/wiki/Objective-C#Non-fragile_instance_variables">https://en.wikipedia.org/wiki/Objective-C#Non-fragile_instance_variables</a>>. That was fixed by adding a level of indirection when accessing member variables. Something like that is probably necessary to be able to subclass builtin types (other than object itself) in an extension.</pre> </td> </tr> <tr> <th> <a href="#msg368047" id="msg368047">msg368047</a> - <a href="msg368047">(view)</a></th> <th>Author: Dong-hee Na (corona10) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-05-04 13:32</th> </tr> <tr> <td colspan="4" class="content"> <pre> New changeset <a href="https://hg.python.org/lookup/5e8ffe147710e449c2e935a4e2ff5cbd19828a8a">5e8ffe147710e449c2e935a4e2ff5cbd19828a8a</a> by Hai Shi in branch 'master': <a class="closed" title="[closed] [C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type" href="issue39573">bpo-39573</a>: Use Py_IS_TYPE to check for types (<a href="https://github.com/python/cpython/pull/19882" class="closed" title="GitHub PR 19882: [merged] bpo-39573: Use Py_IS_TYPE to check for types">GH-19882</a>) <a href="https://github.com/python/cpython/commit/5e8ffe147710e449c2e935a4e2ff5cbd19828a8a">https://github.com/python/cpython/commit/5e8ffe147710e449c2e935a4e2ff5cbd19828a8a</a> </pre> </td> </tr> <tr> <th> <a href="#msg369896" id="msg369896">msg369896</a> - <a href="msg369896">(view)</a></th> <th>Author: Dong-hee Na (corona10) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-05-25 16:52</th> </tr> <tr> <td colspan="4" class="content"> <pre> New changeset <a href="https://hg.python.org/lookup/ad3252bad905d41635bcbb4b76db30d570cf0087">ad3252bad905d41635bcbb4b76db30d570cf0087</a> by Dong-hee Na in branch 'master': <a class="closed" title="[closed] [C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type" href="issue39573">bpo-39573</a>: Convert Py_TYPE() to a static inline function (<a href="https://github.com/python/cpython/pull/20290" class="closed" title="GitHub PR 20290: [merged] bpo-39573: Convert Py_TYPE() to a static inline function">GH-20290</a>) <a href="https://github.com/python/cpython/commit/ad3252bad905d41635bcbb4b76db30d570cf0087">https://github.com/python/cpython/commit/ad3252bad905d41635bcbb4b76db30d570cf0087</a> </pre> </td> </tr> <tr> <th> <a href="#msg369898" id="msg369898">msg369898</a> - <a href="msg369898">(view)</a></th> <th>Author: Dong-hee Na (corona10) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-05-25 17:25</th> </tr> <tr> <td colspan="4" class="content"> <pre> New changeset <a href="https://hg.python.org/lookup/7d847e29d76b178c2db66b180065771b4d90c78f">7d847e29d76b178c2db66b180065771b4d90c78f</a> by Dong-hee Na in branch 'master': <a class="closed" title="[closed] [C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type" href="issue39573">bpo-39573</a>: Fix buildbot failure for tupleobject.c (<a href="https://github.com/python/cpython/pull/20391" class="closed" title="GitHub PR 20391: [merged] bpo-39573: Fix buildbot failure for tupleobject.c">GH-20391</a>) <a href="https://github.com/python/cpython/commit/7d847e29d76b178c2db66b180065771b4d90c78f">https://github.com/python/cpython/commit/7d847e29d76b178c2db66b180065771b4d90c78f</a> </pre> </td> </tr> <tr> <th> <a href="#msg370074" id="msg370074">msg370074</a> - <a href="msg370074">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-05-27 12:55</th> </tr> <tr> <td colspan="4" class="content"> <pre> New changeset <a href="https://hg.python.org/lookup/fe2978b3b940fe2478335e3a2ca5ad22338cdf9c">fe2978b3b940fe2478335e3a2ca5ad22338cdf9c</a> by Victor Stinner in branch 'master': <a class="closed" title="[closed] [C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type" href="issue39573">bpo-39573</a>: Convert Py_REFCNT and Py_SIZE to functions (<a href="https://github.com/python/cpython/pull/20429" class="closed" title="GitHub PR 20429: [merged] bpo-39573: Convert Py_REFCNT and Py_SIZE to functions">GH-20429</a>) <a href="https://github.com/python/cpython/commit/fe2978b3b940fe2478335e3a2ca5ad22338cdf9c">https://github.com/python/cpython/commit/fe2978b3b940fe2478335e3a2ca5ad22338cdf9c</a> </pre> </td> </tr> <tr> <th> <a href="#msg370303" id="msg370303">msg370303</a> - <a href="msg370303">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-05-29 12:24</th> </tr> <tr> <td colspan="4" class="content"> <pre>> <a class="closed" title="[closed] [C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type" href="issue39573">bpo-39573</a>: Convert Py_TYPE() to a static inline function (<a href="https://github.com/python/cpython/pull/20290" class="closed" title="GitHub PR 20290: [merged] bpo-39573: Convert Py_TYPE() to a static inline function">GH-20290</a>) This change broke two projects: * Cython: <a href="https://github.com/cython/cython/commit/d8e93b332fe7d15459433ea74cd29178c03186bd">https://github.com/cython/cython/commit/d8e93b332fe7d15459433ea74cd29178c03186bd</a> (FIXED) * immutables: <a href="https://github.com/MagicStack/immutables/issues/46">https://github.com/MagicStack/immutables/issues/46</a></pre> </td> </tr> <tr> <th> <a href="#msg370638" id="msg370638">msg370638</a> - <a href="msg370638">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-06-03 00:18</th> </tr> <tr> <td colspan="4" class="content"> <pre>> <a class="closed" title="[closed] [C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type" href="issue39573">bpo-39573</a>: Convert Py_TYPE() to a static inline function (<a href="https://github.com/python/cpython/pull/20290" class="closed" title="GitHub PR 20290: [merged] bpo-39573: Convert Py_TYPE() to a static inline function">GH-20290</a>) This change broke pycurl: <a href="https://github.com/pycurl/pycurl/pull/636">https://github.com/pycurl/pycurl/pull/636</a> Extract of its current code: """ /* Initialize the type of the new type objects here; doing it here * is required for portability to Windows without requiring C++. */ p_Curl_Type = &Curl_Type; p_CurlMulti_Type = &CurlMulti_Type; p_CurlShare_Type = &CurlShare_Type; Py_TYPE(&Curl_Type) = &PyType_Type; Py_TYPE(&CurlMulti_Type) = &PyType_Type; Py_TYPE(&CurlShare_Type) = &PyType_Type; """</pre> </td> </tr> <tr> <th> <a href="#msg370663" id="msg370663">msg370663</a> - <a href="msg370663">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-06-03 12:43</th> </tr> <tr> <td colspan="4" class="content"> <pre>To port code to Python 3.10, the following macro can be copied/pasted in your code. It defines Py_SET_SIZE() if it's not defined. #if PY_VERSION_HEX < 0x030900A4 # define Py_SET_SIZE(obj, size) do { Py_SIZE(obj) = (size); } while (0) #endif</pre> </td> </tr> <tr> <th> <a href="#msg370665" id="msg370665">msg370665</a> - <a href="msg370665">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-06-03 12:44</th> </tr> <tr> <td colspan="4" class="content"> <pre>Similar macro for Py_SET_TYPE: #if PY_VERSION_HEX < 0x030900A4 # define Py_SET_TYPE(obj, size) do { Py_TYPE(obj) = (size); } while (0) #endif</pre> </td> </tr> <tr> <th> <a href="#msg370666" id="msg370666">msg370666</a> - <a href="msg370666">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-06-03 12:46</th> </tr> <tr> <td colspan="4" class="content"> <pre>numpy fix defines Py_SET_TYPE() and Py_SET_SIZE() on old Python versions: * <a href="https://github.com/numpy/numpy/commit/a96b18e3d4d11be31a321999cda4b795ea9eccaa">https://github.com/numpy/numpy/commit/a96b18e3d4d11be31a321999cda4b795ea9eccaa</a> * <a href="https://github.com/numpy/numpy/pull/16417">https://github.com/numpy/numpy/pull/16417</a> In the whole numpy code base, only 5 lines have to be modified!</pre> </td> </tr> <tr> <th> <a href="#msg370671" id="msg370671">msg370671</a> - <a href="msg370671">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-06-03 13:17</th> </tr> <tr> <td colspan="4" class="content"> <pre>I proposed <a href="https://github.com/python/cpython/pull/20610" class="closed" title="GitHub PR 20610: [merged] bpo-39573: Porting to Python 3.10: Py_SET_SIZE() macro">PR 20610</a> to enhance the documentation explaining how to port existing to code to Py_SET_SIZE() & cie.</pre> </td> </tr> <tr> <th> <a href="#msg370729" id="msg370729">msg370729</a> - <a href="msg370729">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-06-04 20:10</th> </tr> <tr> <td colspan="4" class="content"> <pre> New changeset <a href="https://hg.python.org/lookup/dc24b8a2ac32114313bae519db3ccc21fe45c982">dc24b8a2ac32114313bae519db3ccc21fe45c982</a> by Victor Stinner in branch 'master': <a class="closed" title="[closed] [C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type" href="issue39573">bpo-39573</a>: Porting to Python 3.10: Py_SET_SIZE() macro (<a href="https://github.com/python/cpython/pull/20610" class="closed" title="GitHub PR 20610: [merged] bpo-39573: Porting to Python 3.10: Py_SET_SIZE() macro">GH-20610</a>) <a href="https://github.com/python/cpython/commit/dc24b8a2ac32114313bae519db3ccc21fe45c982">https://github.com/python/cpython/commit/dc24b8a2ac32114313bae519db3ccc21fe45c982</a> </pre> </td> </tr> <tr> <th> <a href="#msg370902" id="msg370902">msg370902</a> - <a href="msg370902">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-06-07 14:24</th> </tr> <tr> <td colspan="4" class="content"> <pre>Note: numpy was updated to also the use the macros using ", (void)0": <a href="https://github.com/numpy/numpy/commit/f1671076c80bd972421751f2d48186ee9ac808aa">https://github.com/numpy/numpy/commit/f1671076c80bd972421751f2d48186ee9ac808aa</a></pre> </td> </tr> <tr> <th> <a href="#msg370932" id="msg370932">msg370932</a> - <a href="msg370932">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-06-07 23:41</th> </tr> <tr> <td colspan="4" class="content"> <pre>See also <a class="closed" title="[closed] --with-valgrind broken" href="issue40881">bpo-40881</a> "--with-valgrind broken": unicode_release_interned() still used "Py_REFCNT(s) += 1;". It's now fixed by commit <a href="https://hg.python.org/lookup/c96a61e8163c2d25ed4ac77cf96201fd0bdb945c">c96a61e8163c2d25ed4ac77cf96201fd0bdb945c</a>.</pre> </td> </tr> <tr> <th> <a href="#msg372308" id="msg372308">msg372308</a> - <a href="msg372308">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-06-25 08:54</th> </tr> <tr> <td colspan="4" class="content"> <pre>> Another idea would be to convert some C extensions of the standard library to the limited C API. It would ensure that the limited C API contains enough functions to be useful, but would also notify us directly if the API is broken. I created <a class="open" title="[open] [C API] Convert a few stdlib extensions to the limited C API (PEP 384)" href="issue41111">bpo-41111</a>: "Convert a few stdlib extensions to the limited C API".</pre> </td> </tr> <tr> <th> <a href="#msg373460" id="msg373460">msg373460</a> - <a href="msg373460">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-07-10 10:40</th> </tr> <tr> <td colspan="4" class="content"> <pre> New changeset <a href="https://hg.python.org/lookup/8182cc2e68a3c6ea5d5342fed3f1c76b0521fbc1">8182cc2e68a3c6ea5d5342fed3f1c76b0521fbc1</a> by Victor Stinner in branch 'master': <a class="closed" title="[closed] [C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type" href="issue39573">bpo-39573</a>: Use the Py_TYPE() macro (<a href="https://github.com/python/cpython/pull/21433" class="closed" title="GitHub PR 21433: [merged] bpo-39573: Use the Py_TYPE() macro">GH-21433</a>) <a href="https://github.com/python/cpython/commit/8182cc2e68a3c6ea5d5342fed3f1c76b0521fbc1">https://github.com/python/cpython/commit/8182cc2e68a3c6ea5d5342fed3f1c76b0521fbc1</a> </pre> </td> </tr> <tr> <th> <a href="#msg379675" id="msg379675">msg379675</a> - <a href="msg379675">(view)</a></th> <th>Author: Miro Hrončok (hroncok) <span title="Contributor form received">*</span></th> <th>Date: 2020-10-26 17:45</th> </tr> <tr> <td colspan="4" class="content"> <pre>This also breaks pycurl: <a href="https://github.com/pycurl/pycurl/pull/660">https://github.com/pycurl/pycurl/pull/660</a> And breezy: <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1890880">https://bugzilla.redhat.com/show_bug.cgi?id=1890880</a> (not yet reported upstream) I don't understand the rationale for this change in depth, but does the benefit outweigh (yet another) backwards incompatibility?</pre> </td> </tr> <tr> <th> <a href="#msg379679" id="msg379679">msg379679</a> - <a href="msg379679">(view)</a></th> <th>Author: Neil Schemenauer (nascheme) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-10-26 18:27</th> </tr> <tr> <td colspan="4" class="content"> <pre>> I don't understand the rationale for this change in depth, but > does the benefit outweigh (yet another) backwards incompatibility? I think you can have it both ways. Do you want a C API that is stable over a long period of CPython releases or do you want to continue to be able to look deep (i.e. non opaque PyObject*) into CPython implementation internals? During the sprint last week, we talked about how to provide a compatible API, similar to what Pypy cpyext does. It would be possible to provide a (nearly) fully compatible API with the approach. It could get quite painful for CPython to maintain such a thing however. E.g. cpyext has proxy objects (to maintain CPython compatible structure layouts) but keeping those proxies in sync with the internal VM object structures is expensive and tricky. Certainly making PyObject opaque is going to break some 3rd party code. Making it opaque for the non-limited API is not an option IMHO because it breaks too much 3rd party code. Is making it opaque for the limited C API going to break too much code? Maybe, I don't know. Thanks for pointing out pycurl and breezy.</pre> </td> </tr> <tr> <th> <a href="#msg379680" id="msg379680">msg379680</a> - <a href="msg379680">(view)</a></th> <th>Author: Neil Schemenauer (nascheme) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-10-26 18:28</th> </tr> <tr> <td colspan="4" class="content"> <pre>Correction: I think you *cannot* have it both ways.</pre> </td> </tr> <tr> <th> <a href="#msg379757" id="msg379757">msg379757</a> - <a href="msg379757">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-10-27 13:55</th> </tr> <tr> <td colspan="4" class="content"> <pre>Miro: > This also breaks pycurl: > <a href="https://github.com/pycurl/pycurl/pull/660">https://github.com/pycurl/pycurl/pull/660</a> Right, see my previous comment, another PR was already proposed in May! me: > This change broke pycurl: > <a href="https://github.com/pycurl/pycurl/pull/636">https://github.com/pycurl/pycurl/pull/636</a> Merged pycurl fix: <a href="https://github.com/pycurl/pycurl/commit/e633f9a1ac4df5e249e78c218d5fbbd848219042">https://github.com/pycurl/pycurl/commit/e633f9a1ac4df5e249e78c218d5fbbd848219042</a></pre> </td> </tr> <tr> <th> <a href="#msg379759" id="msg379759">msg379759</a> - <a href="msg379759">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-10-27 14:11</th> </tr> <tr> <td colspan="4" class="content"> <pre>Miro: > I don't understand the rationale for this change in depth, but does the benefit outweigh (yet another) backwards incompatibility? I wrote <a href="https://www.python.org/dev/peps/pep-0620/">PEP 620</a> "Hide implementation details from the C API" to explain the rationale: <a href="https://www.python.org/dev/peps/pep-0620/">https://www.python.org/dev/peps/pep-0620/</a></pre> </td> </tr> <tr> <th> <a href="#msg381337" id="msg381337">msg381337</a> - <a href="msg381337">(view)</a></th> <th>Author: Miro Hrončok (hroncok) <span title="Contributor form received">*</span></th> <th>Date: 2020-11-18 13:31</th> </tr> <tr> <td colspan="4" class="content"> <pre>Another batch of broken projects: PyPAM <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1897264">https://bugzilla.redhat.com/show_bug.cgi?id=1897264</a> bitarray <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1897536">https://bugzilla.redhat.com/show_bug.cgi?id=1897536</a> boost <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1896382">https://bugzilla.redhat.com/show_bug.cgi?id=1896382</a> duplicity <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1896684">https://bugzilla.redhat.com/show_bug.cgi?id=1896684</a> gobject-introspection <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1893194">https://bugzilla.redhat.com/show_bug.cgi?id=1893194</a> mercurial <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1897178">https://bugzilla.redhat.com/show_bug.cgi?id=1897178</a> pybluez <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1897256">https://bugzilla.redhat.com/show_bug.cgi?id=1897256</a> pygobject3 <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1894522">https://bugzilla.redhat.com/show_bug.cgi?id=1894522</a> pylibacl <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1897529">https://bugzilla.redhat.com/show_bug.cgi?id=1897529</a> pyside2 <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1898974">https://bugzilla.redhat.com/show_bug.cgi?id=1898974</a> rdiff-backup <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1898980">https://bugzilla.redhat.com/show_bug.cgi?id=1898980</a> Those are just the initial set of packages we have discovered so far. I think there will be more.</pre> </td> </tr> <tr> <th> <a href="#msg381345" id="msg381345">msg381345</a> - <a href="msg381345">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-11-18 14:24</th> </tr> <tr> <td colspan="4" class="content"> <pre>I wrote <a href="https://github.com/python/cpython/pull/23366" class="closed" title="GitHub PR 23366: [merged] bpo-39573: Convert Py_TYPE() and Py_SIZE() back to macros">PR 23366</a> to revert the Py_TYPE() and Py_SIZE() changes: convert them back to macros to allow again "Py_TYPE(obj) = type;" and "Py_SIZE(obj) = size;" syntaxes. Miro Hrončok: > Another batch of broken projects: > PyPAM <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1897264">https://bugzilla.redhat.com/show_bug.cgi?id=1897264</a> "Py_TYPE=" > bitarray <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1897536">https://bugzilla.redhat.com/show_bug.cgi?id=1897536</a> "Py_TYPE=/Py_SIZE=" > boost <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1896382">https://bugzilla.redhat.com/show_bug.cgi?id=1896382</a> "Py_TYPE=" > duplicity <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1896684">https://bugzilla.redhat.com/show_bug.cgi?id=1896684</a> "Py_TYPE=" > gobject-introspection <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1893194">https://bugzilla.redhat.com/show_bug.cgi?id=1893194</a> "Py_TYPE=" > mercurial <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1897178">https://bugzilla.redhat.com/show_bug.cgi?id=1897178</a> "Py_TYPE=/Py_SIZE=" > pybluez <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1897256">https://bugzilla.redhat.com/show_bug.cgi?id=1897256</a> "Py_TYPE=" > pygobject3 <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1894522">https://bugzilla.redhat.com/show_bug.cgi?id=1894522</a> "Py_TYPE=" > pylibacl <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1897529">https://bugzilla.redhat.com/show_bug.cgi?id=1897529</a> "Py_TYPE=" > pyside2 <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1898974">https://bugzilla.redhat.com/show_bug.cgi?id=1898974</a> "Py_TYPE=" > rdiff-backup <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1898980">https://bugzilla.redhat.com/show_bug.cgi?id=1898980</a> "Py_TYPE=" > Those are just the initial set of packages we have discovered so far. I think there will be more. Well, since the <a href="https://www.python.org/dev/peps/pep-0620/">PEP 620</a> is not accepted, I prefer to revert the Py_TYPE() and the Py_SIZE() changes for now. We should have a wider discussion on how to introduce incompatible changes into the C API before being able to push more incompatible changes which impact a so wide range of C extension modules. One practical problem is how to estimate the number of broken Python projects to decide if an incompatible change can be introduced or not. When I did early experiment before merging the <a href="https://github.com/python/cpython/pull/20290" class="closed" title="GitHub PR 20290: [merged] bpo-39573: Convert Py_TYPE() to a static inline function">PR 20290</a>, it seems like only a minority of C extensions rely on "Py_TYPE(obj) = type;" syntax. It's a common pattern to define a type statically. Pseudo-code: --- PyTypeObject MyType = {...}; PyInit_MyExtension(...) { Py_TYPE(&MyType) = ...; PyType_Ready(&MyType); ... } --- "Py_TYPE(&MyType) = ...;" is required since some C compilers don't support setting ob_type directly in the MyType static declaration. The type must be set at runtime. Also I considered that the change is trivial enough to be accepable. Well, I was wrong, and that's why I'm not proposing to revert thes changes. About the rationale for introducing C API incompatible changes, see the <a href="https://www.python.org/dev/peps/pep-0620/">PEP 620</a>.</pre> </td> </tr> <tr> <th> <a href="#msg381365" id="msg381365">msg381365</a> - <a href="msg381365">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-11-18 17:48</th> </tr> <tr> <td colspan="4" class="content"> <pre> New changeset <a href="https://hg.python.org/lookup/0e2ac21dd4960574e89561243763eabba685296a">0e2ac21dd4960574e89561243763eabba685296a</a> by Victor Stinner in branch 'master': <a class="closed" title="[closed] [C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type" href="issue39573">bpo-39573</a>: Convert Py_TYPE() and Py_SIZE() back to macros (<a href="https://github.com/python/cpython/pull/23366" class="closed" title="GitHub PR 23366: [merged] bpo-39573: Convert Py_TYPE() and Py_SIZE() back to macros">GH-23366</a>) <a href="https://github.com/python/cpython/commit/0e2ac21dd4960574e89561243763eabba685296a">https://github.com/python/cpython/commit/0e2ac21dd4960574e89561243763eabba685296a</a> </pre> </td> </tr> <tr> <th> <a href="#msg381374" id="msg381374">msg381374</a> - <a href="msg381374">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-11-18 21:39</th> </tr> <tr> <td colspan="4" class="content"> <pre> New changeset <a href="https://hg.python.org/lookup/e0251787d85950538cf2490c2c73cc680b153940">e0251787d85950538cf2490c2c73cc680b153940</a> by Miro Hrončok in branch 'master': <a class="closed" title="[closed] [C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type" href="issue39573">bpo-39573</a>: Remove What's new entry for Py_SIZE() (<a href="https://github.com/python/cpython/pull/23375" class="closed" title="GitHub PR 23375: [merged] bpo-39573: Remove What's new entry for Py_SIZE()">GH-23375</a>) <a href="https://github.com/python/cpython/commit/e0251787d85950538cf2490c2c73cc680b153940">https://github.com/python/cpython/commit/e0251787d85950538cf2490c2c73cc680b153940</a> </pre> </td> </tr> <tr> <th> <a href="#msg381403" id="msg381403">msg381403</a> - <a href="msg381403">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-11-19 10:58</th> </tr> <tr> <td colspan="4" class="content"> <pre>> And breezy: > <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1890880">https://bugzilla.redhat.com/show_bug.cgi?id=1890880</a> (not yet reported upstream) Oh, I didn't notice that this project is broken by the Py_REFCNT() change. I expected it to be broken by the Py_TYPE() change as others. Should we revert the Py_REFCNT() change as well? So far, breezy is the only impacted project, and the fix should be simple, no? breezy uses "Py_REFCNT(self) -= 1;" instead of "Py_DECREF(self);" in its StaticTuple_Intern() function: static StaticTuple * StaticTuple_Intern(StaticTuple *self) { PyObject *canonical_tuple = NULL; if (_interned_tuples == NULL || _StaticTuple_is_interned(self)) { Py_INCREF(self); return self; } /* SimpleSet_Add returns whatever object is present at self * or the new object if it needs to add it. */ canonical_tuple = SimpleSet_Add(_interned_tuples, (PyObject *)self); if (!canonical_tuple) { // Some sort of exception, propogate it. return NULL; } if (canonical_tuple != (PyObject *)self) { // There was already a tuple with that value return (StaticTuple *)canonical_tuple; } self->flags |= STATIC_TUPLE_INTERNED_FLAG; // The two references in the dict do not count, so that the StaticTuple // object does not become immortal just because it was interned. Py_REFCNT(self) -= 1; return self; } But it also uses "Py_REFCNT(self) = 2;" to "revive dead object temporarily for Discard". static void StaticTuple_dealloc(StaticTuple *self) { int i, len; if (_StaticTuple_is_interned(self)) { /* revive dead object temporarily for Discard */ Py_REFCNT(self) = 2; if (SimpleSet_Discard(_interned_tuples, (PyObject*)self) != 1) Py_FatalError("deletion of interned StaticTuple failed"); self->flags &= ~STATIC_TUPLE_INTERNED_FLAG; } len = self->size; for (i = 0; i < len; ++i) { Py_XDECREF(self->items[i]); } Py_TYPE(self)->tp_free((PyObject *)self); } It sounds like an optimization using a set of "interned" tuples. Maybe to reduce the memory footprint.</pre> </td> </tr> <tr> <th> <a href="#msg381404" id="msg381404">msg381404</a> - <a href="msg381404">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-11-19 11:06</th> </tr> <tr> <td colspan="4" class="content"> <pre>> And breezy: > <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1890880">https://bugzilla.redhat.com/show_bug.cgi?id=1890880</a> (not yet reported upstream) I reported the issue to breezy upstream: <a href="https://bugs.launchpad.net/brz/+bug/1904868">https://bugs.launchpad.net/brz/+bug/1904868</a></pre> </td> </tr> <tr> <th> <a href="#msg382260" id="msg382260">msg382260</a> - <a href="msg382260">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-12-01 15:17</th> </tr> <tr> <td colspan="4" class="content"> <pre>I created the <a href="https://github.com/pythoncapi/upgrade_pythoncapi">https://github.com/pythoncapi/upgrade_pythoncapi</a> project which updates automatically a C extension to newer C API. For example, it uses Py_TYPE(), Py_SIZE(), Py_REFCNT(), Py_SET_SIZE(), Py_SET_SIZE() and Py_SET_REFCNT() functions.</pre> </td> </tr> <tr> <th> <a href="#msg382534" id="msg382534">msg382534</a> - <a href="msg382534">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-12-04 21:51</th> </tr> <tr> <td colspan="4" class="content"> <pre>Status: * Py_SET_REFCNT(), Py_SET_TYPE() and Py_SET_SIZE() functions added to Python 3.9. * Python and Cython have been modified to use Py_TYPE(), Py_SET_REFCNT(), Py_IS_TYPE(), etc. * pythoncapi_compat.h header file has been created to provide new functions to Python 3.6: <a href="https://github.com/pythoncapi/pythoncapi_compat">https://github.com/pythoncapi/pythoncapi_compat</a> * Script has been created to upgrade C extensions to add support for Python 3.10 without losing support for old Python versions: <a href="https://github.com/pythoncapi/pythoncapi_compat">https://github.com/pythoncapi/pythoncapi_compat</a> * <a href="https://www.python.org/dev/peps/pep-0620/">PEP 620</a> "Hide implementation details from the C API" written * Py_TYPE() and Py_SIZE() were converted to a static inline function to deny "Py_TYPE(obj) = type;" syntax, but this change has been reverted during Python 3.10 development cycle since it broke too many C extension modules. (<a href="msg381337">msg381337</a>) TODO: * Maybe add a new formatter for type names (<a href="msg361523">msg361523</a>) * Avoid sizeof(PyObject) in PyType_FromSpec() (<a href="msg366473">msg366473</a>) The purpose of this issue is only to fix the API part. Replacing static inline functions with opaque function calls (stable ABI) is not in the scope of this issue.</pre> </td> </tr> <tr> <th> <a href="#msg382539" id="msg382539">msg382539</a> - <a href="msg382539">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-12-04 22:12</th> </tr> <tr> <td colspan="4" class="content"> <pre>> immutables: <a href="https://github.com/MagicStack/immutables/issues/46">https://github.com/MagicStack/immutables/issues/46</a> I proposed a fix: <a href="https://github.com/MagicStack/immutables/pull/52">https://github.com/MagicStack/immutables/pull/52</a> > mercurial <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1897178">https://bugzilla.redhat.com/show_bug.cgi?id=1897178</a> I proposed a fix: <a href="https://bz.mercurial-scm.org/show_bug.cgi?id=6451">https://bz.mercurial-scm.org/show_bug.cgi?id=6451</a></pre> </td> </tr> <tr> <th> <a href="#msg382780" id="msg382780">msg382780</a> - <a href="msg382780">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-12-09 00:30</th> </tr> <tr> <td colspan="4" class="content"> <pre>> pyside2 <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1898974">https://bugzilla.redhat.com/show_bug.cgi?id=1898974</a> I proposed a fix upstream: <a href="https://bugreports.qt.io/browse/PYSIDE-1436">https://bugreports.qt.io/browse/PYSIDE-1436</a> I also wrote a fix in Fedora: <a href="https://src.fedoraproject.org/rpms/python-pyside2/pull-request/7">https://src.fedoraproject.org/rpms/python-pyside2/pull-request/7</a> The issue is now tracked in Fedora as: <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1902618">https://bugzilla.redhat.com/show_bug.cgi?id=1902618</a></pre> </td> </tr> <tr> <th> <a href="#msg382781" id="msg382781">msg382781</a> - <a href="msg382781">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-12-09 00:45</th> </tr> <tr> <td colspan="4" class="content"> <pre>> bitarray <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1897536">https://bugzilla.redhat.com/show_bug.cgi?id=1897536</a> I created <a href="https://github.com/ilanschnell/bitarray/pull/109">https://github.com/ilanschnell/bitarray/pull/109</a></pre> </td> </tr> <tr> <th> <a href="#msg382783" id="msg382783">msg382783</a> - <a href="msg382783">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2020-12-09 01:13</th> </tr> <tr> <td colspan="4" class="content"> <pre>> boost <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1896382">https://bugzilla.redhat.com/show_bug.cgi?id=1896382</a> I proposed <a href="https://github.com/boostorg/python/pull/330">https://github.com/boostorg/python/pull/330</a> fix. See also <a href="https://github.com/boostorg/python/pull/329">https://github.com/boostorg/python/pull/329</a></pre> </td> </tr> <tr> <th> <a href="#msg394954" id="msg394954">msg394954</a> - <a href="msg394954">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2021-06-02 23:46</th> </tr> <tr> <td colspan="4" class="content"> <pre>Most projects broken by Py_TYPE and Py_SIZE changes have been fixed since last year. I succeeded to use my new pythoncapi_compat project on multiple C extensions. So I propose again to convert Py_TYPE and Py_SIZE macros to static inline functions: <a href="https://github.com/python/cpython/pull/26493">https://github.com/python/cpython/pull/26493</a> I also proposed to promote the pythoncapi_compat project in the "C API: Porting to Python 3.10" section of "What's New In Python 3.10?" on python-dev: <a href="https://mail.python.org/archives/list/python-dev@python.org/thread/KHDZGCNOYEDUTSPAATUDP55ZSSQM5RRC/">https://mail.python.org/archives/list/python-dev@python.org/thread/KHDZGCNOYEDUTSPAATUDP55ZSSQM5RRC/</a> I already announced the pythoncapi_compat project on the capi-sig last December: <a href="https://mail.python.org/archives/list/capi-sig@python.org/thread/LFLXFMKMZ77UCDUFD5EQCONSAFFWJWOZ/">https://mail.python.org/archives/list/capi-sig@python.org/thread/LFLXFMKMZ77UCDUFD5EQCONSAFFWJWOZ/</a></pre> </td> </tr> <tr> <th> <a href="#msg394971" id="msg394971">msg394971</a> - <a href="msg394971">(view)</a></th> <th>Author: Dong-hee Na (corona10) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2021-06-03 02:08</th> </tr> <tr> <td colspan="4" class="content"> <pre>> So I propose again to convert Py_TYPE and Py_SIZE macros to static inline functions +1</pre> </td> </tr> <tr> <th> <a href="#msg395018" id="msg395018">msg395018</a> - <a href="msg395018">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2021-06-03 16:43</th> </tr> <tr> <td colspan="4" class="content"> <pre> New changeset <a href="https://hg.python.org/lookup/f3fa63ec75fdbb4a08a10957a5c631bf0c4a5970">f3fa63ec75fdbb4a08a10957a5c631bf0c4a5970</a> by Victor Stinner in branch 'main': <a class="closed" title="[closed] [C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type" href="issue39573">bpo-39573</a>: Py_TYPE becomes a static inline function (<a href="https://github.com/python/cpython/pull/26493" class="closed" title="GitHub PR 26493: [merged] bpo-39573: Py_TYPE becomes a static inline function">GH-26493</a>) <a href="https://github.com/python/cpython/commit/f3fa63ec75fdbb4a08a10957a5c631bf0c4a5970">https://github.com/python/cpython/commit/f3fa63ec75fdbb4a08a10957a5c631bf0c4a5970</a> </pre> </td> </tr> <tr> <th> <a href="#msg395205" id="msg395205">msg395205</a> - <a href="msg395205">(view)</a></th> <th>Author: Ken Jin (kj) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2021-06-06 11:12</th> </tr> <tr> <td colspan="4" class="content"> <pre>@victor, git bisect tells me the change <a href="https://hg.python.org/lookup/f3fa63ec75fdbb4a08a10957a5c631bf0c4a5970">f3fa63ec75fdbb4a08a10957a5c631bf0c4a5970</a> caused test_exceptions.ExceptionTests.test_recursion_in_except_handler to stack overflow only on windows debug builds. 3 windows buildbots using python debug mode is affected. Python compiled with release mode is *not* affected and passes the test. Here's an example error on one of the buildbots: <a href="https://buildbot.python.org/all/#/builders/596/builds/354/steps/4/logs/stdio">https://buildbot.python.org/all/#/builders/596/builds/354/steps/4/logs/stdio</a> I can also reproduce this locally. I tracked this issue down after a recursion in AST also caused a stack overflow, see my message here: <a href="https://bugs.python.org/msg395172">https://bugs.python.org/msg395172</a> TLDR: Windows builds seems to set stack size to 2MB, on *nix it's probably higher (usually 8MB). I suspect the static inline functions are not being inlined in windows debug builds, so every function call adds to the stack. In that message I proposed to increase the stack size on windows but there are some concerns (see <a href="msg395177">msg395177</a>). What do you think?</pre> </td> </tr> <tr> <th> <a href="#msg395206" id="msg395206">msg395206</a> - <a href="msg395206">(view)</a></th> <th>Author: William Pickard (WildCard65) <span title="Contributor form received">*</span></th> <th>Date: 2021-06-06 11:21</th> </tr> <tr> <td colspan="4" class="content"> <pre>MSVC by default disables method inlining (/Ob0) when '/Od' is specified on the command line while the optimization options specify '/Ob2'.</pre> </td> </tr> <tr> <th> <a href="#msg395287" id="msg395287">msg395287</a> - <a href="msg395287">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2021-06-07 21:03</th> </tr> <tr> <td colspan="4" class="content"> <pre>Ken Jin: Please open a separated issue for test_exceptions.test_recursion_in_except_handler(). It's not directly related to marking PyObject opaque, as William Pickard explained. See my notes on the stack size and stack overflow on a recursion error on Windows: <a href="https://pythondev.readthedocs.io/unstable_tests.html#unlimited-recursion">https://pythondev.readthedocs.io/unstable_tests.html#unlimited-recursion</a></pre> </td> </tr> <tr> <th> <a href="#msg395323" id="msg395323">msg395323</a> - <a href="msg395323">(view)</a></th> <th>Author: Pablo Galindo Salgado (pablogsal) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2021-06-08 11:24</th> </tr> <tr> <td colspan="4" class="content"> <pre> New changeset <a href="https://hg.python.org/lookup/6d518bb3a11f9b16098f45b21a13ebe8f537f045">6d518bb3a11f9b16098f45b21a13ebe8f537f045</a> by Pablo Galindo in branch 'main': <a class="closed" title="[closed] test_exceptions.ExceptionTests.test_recursion_in_except_handler stack overflow on Windows debug builds" href="issue44348">bpo-44348</a>: Revert "<a class="closed" title="[closed] [C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type" href="issue39573">bpo-39573</a>: Py_TYPE becomes a static inline function (<a href="https://github.com/python/cpython/pull/26493" class="closed" title="GitHub PR 26493: [merged] bpo-39573: Py_TYPE becomes a static inline function">GH-26493</a>)" (<a href="https://github.com/python/cpython/pull/26596" class="closed" title="GitHub PR 26596: [merged] bpo-44348: Revert 'bpo-39573: Py_TYPE becomes a static inline function (GH-26493)'">GH-26596</a>) <a href="https://github.com/python/cpython/commit/6d518bb3a11f9b16098f45b21a13ebe8f537f045">https://github.com/python/cpython/commit/6d518bb3a11f9b16098f45b21a13ebe8f537f045</a> </pre> </td> </tr> <tr> <th> <a href="#msg395536" id="msg395536">msg395536</a> - <a href="msg395536">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2021-06-10 13:27</th> </tr> <tr> <td colspan="4" class="content"> <pre>See also <a class="closed" title="[closed] Py_IS_TYPE(): cast discards ‘const’ qualifier from pointer target type" href="issue44378">bpo-44378</a>: "Py_IS_TYPE(): cast discards ‘const’ qualifier from pointer target type". If Py_TYPE() is converted again to a static inline function which takes a "const PyObject*" type, Py_IS_TYPE() can be modified again at the same time to use Py_TYPE().</pre> </td> </tr> <tr> <th> <a href="#msg401365" id="msg401365">msg401365</a> - <a href="msg401365">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2021-09-08 09:59</th> </tr> <tr> <td colspan="4" class="content"> <pre> New changeset <a href="https://hg.python.org/lookup/cb15afcccffc6c42cbfb7456ce8db89cd2f77512">cb15afcccffc6c42cbfb7456ce8db89cd2f77512</a> by Victor Stinner in branch 'main': <a class="closed" title="[closed] [C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type" href="issue39573">bpo-39573</a>: Py_TYPE becomes a static inline function (<a href="https://github.com/python/cpython/pull/28128" class="closed" title="GitHub PR 28128: [merged] bpo-39573: Py_TYPE becomes a static inline function">GH-28128</a>) <a href="https://github.com/python/cpython/commit/cb15afcccffc6c42cbfb7456ce8db89cd2f77512">https://github.com/python/cpython/commit/cb15afcccffc6c42cbfb7456ce8db89cd2f77512</a> </pre> </td> </tr> <tr> <th> <a href="#msg401370" id="msg401370">msg401370</a> - <a href="msg401370">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2021-09-08 10:33</th> </tr> <tr> <td colspan="4" class="content"> <pre>> boost <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1896382">https://bugzilla.redhat.com/show_bug.cgi?id=1896382</a> Fixed by: <a href="https://github.com/boostorg/python/commit/500194edb7833d0627ce7a2595fec49d0aae2484">https://github.com/boostorg/python/commit/500194edb7833d0627ce7a2595fec49d0aae2484</a></pre> </td> </tr> <tr> <th> <a href="#msg401378" id="msg401378">msg401378</a> - <a href="msg401378">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2021-09-08 12:12</th> </tr> <tr> <td colspan="4" class="content"> <pre>I checked again the list of broken projects listed previously. Fixed: * Cython: <a href="https://github.com/cython/cython/commit/d8e93b332fe7d15459433ea74cd29178c03186bd">https://github.com/cython/cython/commit/d8e93b332fe7d15459433ea74cd29178c03186bd</a> * immutables: <a href="https://github.com/MagicStack/immutables/pull/52">https://github.com/MagicStack/immutables/pull/52</a> * numpy: * <a href="https://github.com/numpy/numpy/commit/a96b18e3d4d11be31a321999cda4b795ea9eccaa">https://github.com/numpy/numpy/commit/a96b18e3d4d11be31a321999cda4b795ea9eccaa</a> * <a href="https://github.com/numpy/numpy/commit/f1671076c80bd972421751f2d48186ee9ac808aa">https://github.com/numpy/numpy/commit/f1671076c80bd972421751f2d48186ee9ac808aa</a> * pycurl: <a href="https://github.com/pycurl/pycurl/commit/e633f9a1ac4df5e249e78c218d5fbbd848219042">https://github.com/pycurl/pycurl/commit/e633f9a1ac4df5e249e78c218d5fbbd848219042</a> * bitarray: <a href="https://github.com/ilanschnell/bitarray/pull/109">https://github.com/ilanschnell/bitarray/pull/109</a> * mercurial: <a href="https://bz.mercurial-scm.org/show_bug.cgi?id=6451">https://bz.mercurial-scm.org/show_bug.cgi?id=6451</a> * boost: <a href="https://github.com/boostorg/python/commit/500194edb7833d0627ce7a2595fec49d0aae2484">https://github.com/boostorg/python/commit/500194edb7833d0627ce7a2595fec49d0aae2484</a> * pyside2: <a href="https://bugreports.qt.io/browse/PYSIDE-1436">https://bugreports.qt.io/browse/PYSIDE-1436</a> * breezy: <a href="https://bugs.launchpad.net/brz/+bug/1904868">https://bugs.launchpad.net/brz/+bug/1904868</a> * duplicity: <a href="https://git.launchpad.net/duplicity/commit/duplicity/_librsyncmodule.c?id=bbaae91b5ac6ef7e295968e508522884609fbf84">https://git.launchpad.net/duplicity/commit/duplicity/_librsyncmodule.c?id=bbaae91b5ac6ef7e295968e508522884609fbf84</a> * gobject-introspection: <a href="https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/243">https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/243</a> Fix proposed: * pybluez: <a href="https://github.com/pybluez/pybluez/pull/410">https://github.com/pybluez/pybluez/pull/410</a> Broken: * PyPAM * pygobject3 * pylibacl * rdiff-backup</pre> </td> </tr> <tr> <th> <a href="#msg401395" id="msg401395">msg401395</a> - <a href="msg401395">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2021-09-08 16:06</th> </tr> <tr> <td colspan="4" class="content"> <pre>At commit <a href="https://hg.python.org/lookup/cb15afcccffc6c42cbfb7456ce8db89cd2f77512">cb15afcccffc6c42cbfb7456ce8db89cd2f77512</a>, I am able to rename PyObject members (to make sure that the structure is not accessed directly), I only had to modify header files: * Py_REFCNT(), Py_SET_REFCNT() * Py_INCREF(), Py_DECREF() * Py_TYPE(), Py_SET_TYPE() * Py_IS_TYPE() And just two more C files which corner cases: * 1 line in <a href="https://github.com/python/cpython/blob/master/Python/specialize.c">Python/specialize.c</a> * 1 line in <a href="https://github.com/python/cpython/blob/master/Modules/_testcapimodule.c">Modules/_testcapimodule.c</a>: check_pyobject_forbidden_bytes_is_freed() -- I did the same with PyVarObject, rename the ob_size member. I had to modify header files: * Py_SIZE(), Py_SET_SIZE() But I had to modify the following function of the array module: static int array_buffer_getbuf(arrayobject *self, Py_buffer *view, int flags) { ... if ((flags & PyBUF_ND)==PyBUF_ND) { view->shape = &((PyVarObject*)self)->ob_size; } ... return 0; } I'm not sure how to patch this function. -- This experience doesn't check usage of sizeof(PyObject) and sizeof(PyVarObject) which would break if these structures become opaque. sizeof() issues are listed in previous comments.</pre> </td> </tr> <tr> <th> <a href="#msg401396" id="msg401396">msg401396</a> - <a href="msg401396">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2021-09-08 16:14</th> </tr> <tr> <td colspan="4" class="content"> <pre>Oh and obviously, it's not possible possible to define structures which *include* PyObject or PyVarObject if PyObject and PyVarObject become opaque. Example: typedef struct { PyObject ob_base; Py_ssize_t ob_size; /* Number of items in variable part */ } PyVarObject; This C code requires the PyObject structure to be fully defined (not being opaque). A new C API and ABI where structures *don't* include PyObject or PyVarObject should be designed to allocate their members "before" the PyObject* pointer value. Something like the current PyGC_Head structure which is excluded from PyObject and stored *before* the "PyObject*" pointer. Simplified code which allocates memory for an object implementin the GC protocol: static PyObject * _PyObject_GC_Malloc(size_t basicsize) { ... size_t size = sizeof(PyGC_Head) + basicsize; ... PyGC_Head *g = (PyGC_Head *)PyObject_Malloc(size); ... PyObject *op = (PyObject *)(g + 1); return op; }</pre> </td> </tr> <tr> <th> <a href="#msg401399" id="msg401399">msg401399</a> - <a href="msg401399">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2021-09-08 16:32</th> </tr> <tr> <td colspan="4" class="content"> <pre>I changed the issue title to restrict its scope: "[C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type". Making PyObject and PyVarObject structures opaque is a broader topic which should be splited into sub-issues. "Py_TYPE(obj)=type;" is now disallowed. I consider that the work of this issue is now completed and I close the issue. Thanks everyone who help to fix these tedious issues! You can continue to use this issue if you need my help to adapt your C extensions to Py_SET_TYPE()/Py_SET_SIZE(). See also the upgrade_pythoncapi.py script of the pythoncapi_compat project which helps to port your C extensions without losing support for old Python versions: <a href="https://github.com/pythoncapi/pythoncapi_compat">https://github.com/pythoncapi/pythoncapi_compat</a> See also the Py_TYPE() change announcement on the capi-sig list: <a href="https://mail.python.org/archives/list/capi-sig@python.org/thread/WGRLTHTHC32DQTACPPX36TPR2GLJAFRB/">https://mail.python.org/archives/list/capi-sig@python.org/thread/WGRLTHTHC32DQTACPPX36TPR2GLJAFRB/</a></pre> </td> </tr> <tr> <th> <a href="#msg403252" id="msg403252">msg403252</a> - <a href="msg403252">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2021-10-05 16:36</th> </tr> <tr> <td colspan="4" class="content"> <pre>I wrote an article about these changes: <a href="https://vstinner.github.io/c-api-abstract-pyobject.html">https://vstinner.github.io/c-api-abstract-pyobject.html</a> It elaborates the rationale for making these changes.</pre> </td> </tr> <tr> <th> <a href="#msg410995" id="msg410995">msg410995</a> - <a href="msg410995">(view)</a></th> <th>Author: STINNER Victor (vstinner) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2022-01-20 00:24</th> </tr> <tr> <td colspan="4" class="content"> <pre>> @victor, git bisect tells me the change <a href="https://hg.python.org/lookup/f3fa63ec75fdbb4a08a10957a5c631bf0c4a5970">f3fa63ec75fdbb4a08a10957a5c631bf0c4a5970</a> caused test_exceptions.ExceptionTests.test_recursion_in_except_handler to stack overflow only on windows debug builds. FYI this regression was handled last year in <a class="closed" title="[closed] test_exceptions.ExceptionTests.test_recursion_in_except_handler stack overflow on Windows debug builds" href="issue44348">bpo-44348</a> "test_exceptions.ExceptionTests.test_recursion_in_except_handler stack overflow on Windows debug builds" and fixed at 2021-09-07 by using the trashcan mecanism in the BaseException deallocator function: New changeset <a href="https://hg.python.org/lookup/fb305092a5d7894b41f122c1a1117b3abf4c567e">fb305092a5d7894b41f122c1a1117b3abf4c567e</a> by Victor Stinner in branch 'main': <a class="closed" title="[closed] test_exceptions.ExceptionTests.test_recursion_in_except_handler stack overflow on Windows debug builds" href="issue44348">bpo-44348</a>: BaseException deallocator uses trashcan (<a href="https://github.com/python/cpython/pull/28190" class="closed" title="GitHub PR 28190: [merged] bpo-44348: BaseException deallocator uses trashcan">GH-28190</a>) <a href="https://github.com/python/cpython/commit/fb305092a5d7894b41f122c1a1117b3abf4c567e">https://github.com/python/cpython/commit/fb305092a5d7894b41f122c1a1117b3abf4c567e</a></pre> </td> </tr> </table> <table class="history table table-condensed table-striped"><tr><th colspan="4" class="header"> History </th></tr><tr> <th>Date</th> <th>User</th> <th>Action</th> <th>Args</th> </tr> <tr><td>2022-04-11 14:59:26</td><td>admin</td><td>set</td><td>github: 83754</td></tr> <tr><td>2022-01-20 00:24:00</td><td>vstinner</td><td>set</td><td>nosy: + <a rel="nofollow" href="user2377">vstinner</a><br />messages: + <a rel="nofollow" href="msg410995">msg410995</a><br /></td></tr> <tr><td>2021-11-04 13:58:23</td><td>eryksun</td><td>set</td><td>nosy: - <a rel="nofollow" href="user40940">ahmedsayeed1982</a><br /> -> (no value)</td></tr> <tr><td>2021-11-04 13:58:10</td><td>eryksun</td><td>set</td><td>messages: - <a rel="nofollow" href="msg405687">msg405687</a></td></tr> <tr><td>2021-11-04 12:08:29</td><td>ahmedsayeed1982</td><td>set</td><td>nosy: + <a rel="nofollow" href="user40940">ahmedsayeed1982</a>, - <a rel="nofollow" href="user83">nascheme</a>, <a rel="nofollow" href="user925">ronaldoussoren</a>, <a rel="nofollow" href="user2377">vstinner</a>, <a rel="nofollow" href="user15623">serhiy.storchaka</a>, <a rel="nofollow" href="user16632">steve.dower</a>, <a rel="nofollow" href="user25227">hroncok</a>, <a rel="nofollow" href="user25975">corona10</a>, <a rel="nofollow" href="user26650">ZackerySpytz</a>, <a rel="nofollow" href="user26865">pablogsal</a>, <a rel="nofollow" href="user27683">WildCard65</a>, <a rel="nofollow" href="user30064">BTaskaya</a>, <a rel="nofollow" href="user31412">shihai1991</a>, <a rel="nofollow" href="user31937">erlendaasland</a>, <a rel="nofollow" href="user35958">kj</a><br />messages: + <a rel="nofollow" href="msg405687">msg405687</a><br /></td></tr> <tr><td>2021-10-05 16:36:53</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg403252">msg403252</a></td></tr> <tr><td>2021-09-08 16:32:15</td><td>vstinner</td><td>set</td><td>status: open -> closed<br />versions: + Python 3.11, - Python 3.9<br />title: [C API] Make PyObject an opaque structure in the limited C API -> [C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type<br />messages: + <a rel="nofollow" href="msg401399">msg401399</a><br /><br />resolution: fixed<br />stage: patch review -> resolved</td></tr> <tr><td>2021-09-08 16:14:01</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg401396">msg401396</a></td></tr> <tr><td>2021-09-08 16:06:14</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg401395">msg401395</a></td></tr> <tr><td>2021-09-08 12:12:35</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg401378">msg401378</a></td></tr> <tr><td>2021-09-08 10:33:11</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg401370">msg401370</a></td></tr> <tr><td>2021-09-08 09:59:21</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg401365">msg401365</a></td></tr> <tr><td>2021-09-02 15:46:06</td><td>vstinner</td><td>set</td><td>pull_requests: + <a rel="nofollow" href="pull_request26567">pull_request26567</a></td></tr> <tr><td>2021-06-10 13:27:28</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg395536">msg395536</a></td></tr> <tr><td>2021-06-08 11:24:57</td><td>pablogsal</td><td>set</td><td>messages: + <a rel="nofollow" href="msg395323">msg395323</a></td></tr> <tr><td>2021-06-08 11:07:12</td><td>pablogsal</td><td>set</td><td>nosy: + <a rel="nofollow" href="user26865">pablogsal</a><br />pull_requests: + <a rel="nofollow" href="pull_request25180">pull_request25180</a><br /></td></tr> <tr><td>2021-06-07 21:24:48</td><td>erlendaasland</td><td>set</td><td>nosy: + <a rel="nofollow" href="user31937">erlendaasland</a><br /></td></tr> <tr><td>2021-06-07 21:03:04</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg395287">msg395287</a></td></tr> <tr><td>2021-06-06 11:21:15</td><td>WildCard65</td><td>set</td><td>messages: + <a rel="nofollow" href="msg395206">msg395206</a></td></tr> <tr><td>2021-06-06 11:12:42</td><td>kj</td><td>set</td><td>nosy: + <a rel="nofollow" href="user35958">kj</a><br />messages: + <a rel="nofollow" href="msg395205">msg395205</a><br /></td></tr> <tr><td>2021-06-06 10:59:47</td><td>BTaskaya</td><td>set</td><td>nosy: + <a rel="nofollow" href="user30064">BTaskaya</a><br />pull_requests: + <a rel="nofollow" href="pull_request25148">pull_request25148</a><br /></td></tr> <tr><td>2021-06-03 16:43:09</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg395018">msg395018</a></td></tr> <tr><td>2021-06-03 02:08:51</td><td>corona10</td><td>set</td><td>messages: + <a rel="nofollow" href="msg394971">msg394971</a></td></tr> <tr><td>2021-06-02 23:46:36</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg394954">msg394954</a></td></tr> <tr><td>2021-06-02 23:08:20</td><td>vstinner</td><td>set</td><td>pull_requests: + <a rel="nofollow" href="pull_request25089">pull_request25089</a></td></tr> <tr><td>2020-12-09 01:13:17</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg382783">msg382783</a></td></tr> <tr><td>2020-12-09 00:45:01</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg382781">msg382781</a></td></tr> <tr><td>2020-12-09 00:30:44</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg382780">msg382780</a></td></tr> <tr><td>2020-12-04 22:12:15</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg382539">msg382539</a></td></tr> <tr><td>2020-12-04 21:51:45</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg382534">msg382534</a></td></tr> <tr><td>2020-12-01 15:36:26</td><td>petdance</td><td>set</td><td>nosy: - <a rel="nofollow" href="user33299">petdance</a><br /></td></tr> <tr><td>2020-12-01 15:17:44</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg382260">msg382260</a></td></tr> <tr><td>2020-11-19 11:06:21</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg381404">msg381404</a></td></tr> <tr><td>2020-11-19 10:58:56</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg381403">msg381403</a></td></tr> <tr><td>2020-11-18 21:39:09</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg381374">msg381374</a></td></tr> <tr><td>2020-11-18 18:49:38</td><td>hroncok</td><td>set</td><td>pull_requests: + <a rel="nofollow" href="pull_request22268">pull_request22268</a></td></tr> <tr><td>2020-11-18 17:48:16</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg381365">msg381365</a></td></tr> <tr><td>2020-11-18 14:24:55</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg381345">msg381345</a></td></tr> <tr><td>2020-11-18 14:02:52</td><td>vstinner</td><td>set</td><td>pull_requests: + <a rel="nofollow" href="pull_request22259">pull_request22259</a></td></tr> <tr><td>2020-11-18 13:31:16</td><td>hroncok</td><td>set</td><td>messages: + <a rel="nofollow" href="msg381337">msg381337</a></td></tr> <tr><td>2020-10-27 14:11:28</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg379759">msg379759</a></td></tr> <tr><td>2020-10-27 13:55:36</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg379757">msg379757</a></td></tr> <tr><td>2020-10-26 18:28:26</td><td>nascheme</td><td>set</td><td>messages: + <a rel="nofollow" href="msg379680">msg379680</a></td></tr> <tr><td>2020-10-26 18:27:40</td><td>nascheme</td><td>set</td><td>messages: + <a rel="nofollow" href="msg379679">msg379679</a></td></tr> <tr><td>2020-10-26 17:45:02</td><td>hroncok</td><td>set</td><td>nosy: + <a rel="nofollow" href="user25227">hroncok</a><br />messages: + <a rel="nofollow" href="msg379675">msg379675</a><br /></td></tr> <tr><td>2020-07-10 10:40:54</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg373460">msg373460</a></td></tr> <tr><td>2020-07-10 10:17:32</td><td>vstinner</td><td>set</td><td>pull_requests: + <a rel="nofollow" href="pull_request20580">pull_request20580</a></td></tr> <tr><td>2020-07-01 16:04:14</td><td>WildCard65</td><td>set</td><td>nosy: + <a rel="nofollow" href="user27683">WildCard65</a><br />pull_requests: + <a rel="nofollow" href="pull_request20410">pull_request20410</a><br /></td></tr> <tr><td>2020-06-25 08:54:37</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg372308">msg372308</a></td></tr> <tr><td>2020-06-07 23:41:23</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg370932">msg370932</a></td></tr> <tr><td>2020-06-07 14:24:18</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg370902">msg370902</a></td></tr> <tr><td>2020-06-04 20:10:47</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg370729">msg370729</a></td></tr> <tr><td>2020-06-03 13:17:01</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg370671">msg370671</a></td></tr> <tr><td>2020-06-03 13:00:52</td><td>vstinner</td><td>set</td><td>pull_requests: + <a rel="nofollow" href="pull_request19838">pull_request19838</a></td></tr> <tr><td>2020-06-03 12:46:39</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg370666">msg370666</a></td></tr> <tr><td>2020-06-03 12:44:23</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg370665">msg370665</a></td></tr> <tr><td>2020-06-03 12:43:04</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg370663">msg370663</a></td></tr> <tr><td>2020-06-03 00:18:04</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg370638">msg370638</a></td></tr> <tr><td>2020-05-29 12:24:24</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg370303">msg370303</a></td></tr> <tr><td>2020-05-27 12:55:16</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg370074">msg370074</a></td></tr> <tr><td>2020-05-26 14:19:53</td><td>vstinner</td><td>set</td><td>pull_requests: + <a rel="nofollow" href="pull_request19686">pull_request19686</a></td></tr> <tr><td>2020-05-25 17:25:35</td><td>corona10</td><td>set</td><td>messages: + <a rel="nofollow" href="msg369898">msg369898</a></td></tr> <tr><td>2020-05-25 17:00:03</td><td>corona10</td><td>set</td><td>pull_requests: + <a rel="nofollow" href="pull_request19654">pull_request19654</a></td></tr> <tr><td>2020-05-25 16:52:57</td><td>corona10</td><td>set</td><td>messages: + <a rel="nofollow" href="msg369896">msg369896</a></td></tr> <tr><td>2020-05-21 15:37:24</td><td>corona10</td><td>set</td><td>pull_requests: + <a rel="nofollow" href="pull_request19565">pull_request19565</a></td></tr> <tr><td>2020-05-07 10:21:10</td><td>ZackerySpytz</td><td>set</td><td>nosy: + <a rel="nofollow" href="user26650">ZackerySpytz</a><br />pull_requests: + <a rel="nofollow" href="pull_request19294">pull_request19294</a><br /></td></tr> <tr><td>2020-05-04 13:32:01</td><td>corona10</td><td>set</td><td>messages: + <a rel="nofollow" href="msg368047">msg368047</a></td></tr> <tr><td>2020-05-03 12:40:35</td><td>shihai1991</td><td>set</td><td>pull_requests: + <a rel="nofollow" href="pull_request19194">pull_request19194</a></td></tr> <tr><td>2020-04-15 08:30:11</td><td>ronaldoussoren</td><td>set</td><td>nosy: + <a rel="nofollow" href="user925">ronaldoussoren</a><br />messages: + <a rel="nofollow" href="msg366493">msg366493</a><br /></td></tr> <tr><td>2020-04-15 01:35:27</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg366473">msg366473</a><br />title: Make PyObject an opaque structure in the limited C API -> [C API] Make PyObject an opaque structure in the limited C API</td></tr> <tr><td>2020-04-03 11:57:17</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg365690">msg365690</a></td></tr> <tr><td>2020-03-06 22:53:21</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg363564">msg363564</a></td></tr> <tr><td>2020-03-06 16:51:37</td><td>petdance</td><td>set</td><td>pull_requests: + <a rel="nofollow" href="pull_request18167">pull_request18167</a></td></tr> <tr><td>2020-03-06 09:43:06</td><td>vstinner</td><td>set</td><td>pull_requests: + <a rel="nofollow" href="pull_request18161">pull_request18161</a></td></tr> <tr><td>2020-03-06 08:04:04</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg363494">msg363494</a></td></tr> <tr><td>2020-03-06 05:52:26</td><td>petdance</td><td>set</td><td>pull_requests: + <a rel="nofollow" href="pull_request18155">pull_request18155</a></td></tr> <tr><td>2020-03-06 05:51:27</td><td>petdance</td><td>set</td><td>pull_requests: + <a rel="nofollow" href="pull_request18154">pull_request18154</a></td></tr> <tr><td>2020-03-05 05:28:43</td><td>petdance</td><td>set</td><td>pull_requests: + <a rel="nofollow" href="pull_request18146">pull_request18146</a></td></tr> <tr><td>2020-03-04 13:15:30</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg363345">msg363345</a></td></tr> <tr><td>2020-02-22 04:45:50</td><td>petdance</td><td>set</td><td>messages: + <a rel="nofollow" href="msg362445">msg362445</a></td></tr> <tr><td>2020-02-22 04:44:36</td><td>petdance</td><td>set</td><td>pull_requests: + <a rel="nofollow" href="pull_request17968">pull_request17968</a></td></tr> <tr><td>2020-02-18 14:38:54</td><td>petdance</td><td>set</td><td>messages: + <a rel="nofollow" href="msg362216">msg362216</a></td></tr> <tr><td>2020-02-18 13:50:56</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg362212">msg362212</a></td></tr> <tr><td>2020-02-18 02:21:19</td><td>petdance</td><td>set</td><td>messages: + <a rel="nofollow" href="msg362166">msg362166</a></td></tr> <tr><td>2020-02-17 10:09:24</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg362134">msg362134</a></td></tr> <tr><td>2020-02-17 09:48:51</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg362133">msg362133</a></td></tr> <tr><td>2020-02-16 17:25:05</td><td>corona10</td><td>set</td><td>pull_requests: + <a rel="nofollow" href="pull_request17898">pull_request17898</a></td></tr> <tr><td>2020-02-15 21:36:05</td><td>petdance</td><td>set</td><td>messages: + <a rel="nofollow" href="msg362034">msg362034</a></td></tr> <tr><td>2020-02-15 21:34:35</td><td>petdance</td><td>set</td><td>nosy: + <a rel="nofollow" href="user33299">petdance</a><br />messages: + <a rel="nofollow" href="msg362033">msg362033</a><br /></td></tr> <tr><td>2020-02-14 07:50:23</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg361988">msg361988</a></td></tr> <tr><td>2020-02-14 07:48:34</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg361987">msg361987</a></td></tr> <tr><td>2020-02-14 01:21:52</td><td>corona10</td><td>set</td><td>pull_requests: + <a rel="nofollow" href="pull_request17884">pull_request17884</a></td></tr> <tr><td>2020-02-14 01:11:53</td><td>corona10</td><td>set</td><td>pull_requests: + <a rel="nofollow" href="pull_request17883">pull_request17883</a></td></tr> <tr><td>2020-02-14 00:50:55</td><td>shihai1991</td><td>set</td><td>messages: + <a rel="nofollow" href="msg361977">msg361977</a></td></tr> <tr><td>2020-02-13 21:50:34</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg361971">msg361971</a></td></tr> <tr><td>2020-02-13 17:37:20</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg361965">msg361965</a></td></tr> <tr><td>2020-02-13 17:35:08</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg361964">msg361964</a></td></tr> <tr><td>2020-02-13 16:03:41</td><td>shihai1991</td><td>set</td><td>messages: + <a rel="nofollow" href="msg361963">msg361963</a></td></tr> <tr><td>2020-02-13 15:58:01</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg361961">msg361961</a></td></tr> <tr><td>2020-02-13 15:55:19</td><td>shihai1991</td><td>set</td><td>nosy: + <a rel="nofollow" href="user31412">shihai1991</a><br />messages: + <a rel="nofollow" href="msg361960">msg361960</a><br /></td></tr> <tr><td>2020-02-13 01:43:16</td><td>brandtbucher</td><td>set</td><td>pull_requests: + <a rel="nofollow" href="pull_request17870">pull_request17870</a></td></tr> <tr><td>2020-02-12 16:54:09</td><td>corona10</td><td>set</td><td>pull_requests: + <a rel="nofollow" href="pull_request17861">pull_request17861</a></td></tr> <tr><td>2020-02-12 15:36:10</td><td>corona10</td><td>set</td><td>nosy: + <a rel="nofollow" href="user25975">corona10</a><br />messages: + <a rel="nofollow" href="msg361904">msg361904</a><br /></td></tr> <tr><td>2020-02-09 05:48:39</td><td>shihai1991</td><td>set</td><td>pull_requests: + <a rel="nofollow" href="pull_request17795">pull_request17795</a></td></tr> <tr><td>2020-02-08 23:46:05</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg361639">msg361639</a></td></tr> <tr><td>2020-02-08 14:28:50</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg361631">msg361631</a></td></tr> <tr><td>2020-02-08 12:08:44</td><td>steve.dower</td><td>set</td><td>nosy: + <a rel="nofollow" href="user16632">steve.dower</a><br />messages: + <a rel="nofollow" href="msg361626">msg361626</a><br /></td></tr> <tr><td>2020-02-08 03:53:01</td><td>corona10</td><td>set</td><td>pull_requests: + <a rel="nofollow" href="pull_request17785">pull_request17785</a></td></tr> <tr><td>2020-02-07 22:18:30</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg361611">msg361611</a></td></tr> <tr><td>2020-02-07 18:45:00</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg361607">msg361607</a></td></tr> <tr><td>2020-02-07 11:31:10</td><td>serhiy.storchaka</td><td>set</td><td>nosy: + <a rel="nofollow" href="user15623">serhiy.storchaka</a><br />messages: + <a rel="nofollow" href="msg361593">msg361593</a><br /></td></tr> <tr><td>2020-02-07 11:15:57</td><td>vstinner</td><td>set</td><td>pull_requests: + <a rel="nofollow" href="pull_request17778">pull_request17778</a></td></tr> <tr><td>2020-02-07 11:05:16</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg361590">msg361590</a></td></tr> <tr><td>2020-02-07 10:20:39</td><td>vstinner</td><td>set</td><td>pull_requests: + <a rel="nofollow" href="pull_request17776">pull_request17776</a></td></tr> <tr><td>2020-02-07 10:18:42</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg361557">msg361557</a></td></tr> <tr><td>2020-02-07 09:55:12</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg361555">msg361555</a></td></tr> <tr><td>2020-02-07 09:47:42</td><td>vstinner</td><td>set</td><td>pull_requests: + <a rel="nofollow" href="pull_request17774">pull_request17774</a></td></tr> <tr><td>2020-02-07 09:19:24</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg361549">msg361549</a></td></tr> <tr><td>2020-02-07 08:17:11</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg361540">msg361540</a></td></tr> <tr><td>2020-02-07 02:39:37</td><td>vstinner</td><td>set</td><td>pull_requests: + <a rel="nofollow" href="pull_request17770">pull_request17770</a></td></tr> <tr><td>2020-02-07 02:37:11</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg361531">msg361531</a></td></tr> <tr><td>2020-02-07 02:06:14</td><td>vstinner</td><td>set</td><td>pull_requests: + <a rel="nofollow" href="pull_request17769">pull_request17769</a></td></tr> <tr><td>2020-02-07 02:04:30</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg361529">msg361529</a></td></tr> <tr><td>2020-02-07 01:42:16</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg361527">msg361527</a></td></tr> <tr><td>2020-02-07 01:26:55</td><td>vstinner</td><td>set</td><td>pull_requests: + <a rel="nofollow" href="pull_request17767">pull_request17767</a></td></tr> <tr><td>2020-02-07 01:24:55</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg361526">msg361526</a></td></tr> <tr><td>2020-02-07 01:02:14</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg361523">msg361523</a></td></tr> <tr><td>2020-02-07 00:55:54</td><td>vstinner</td><td>set</td><td>pull_requests: + <a rel="nofollow" href="pull_request17765">pull_request17765</a></td></tr> <tr><td>2020-02-07 00:53:27</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg361522">msg361522</a></td></tr> <tr><td>2020-02-07 00:26:52</td><td>vstinner</td><td>set</td><td>pull_requests: + <a rel="nofollow" href="pull_request17764">pull_request17764</a></td></tr> <tr><td>2020-02-07 00:24:52</td><td>vstinner</td><td>set</td><td>nosy: + <a rel="nofollow" href="user83">nascheme</a><br /></td></tr> <tr><td>2020-02-07 00:24:36</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg361519">msg361519</a></td></tr> <tr><td>2020-02-07 00:22:52</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg361518">msg361518</a></td></tr> <tr><td>2020-02-07 00:19:37</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg361517">msg361517</a></td></tr> <tr><td>2020-02-07 00:11:48</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg361516">msg361516</a></td></tr> <tr><td>2020-02-06 23:41:28</td><td>vstinner</td><td>set</td><td>pull_requests: + <a rel="nofollow" href="pull_request17763">pull_request17763</a></td></tr> <tr><td>2020-02-06 23:39:12</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg361515">msg361515</a></td></tr> <tr><td>2020-02-06 23:38:40</td><td>vstinner</td><td>set</td><td>messages: + <a rel="nofollow" href="msg361514">msg361514</a></td></tr> <tr><td>2020-02-06 23:16:05</td><td>vstinner</td><td>set</td><td>keywords: + <a rel="nofollow" href="keyword2">patch</a><br />stage: patch review<br />pull_requests: + <a rel="nofollow" href="pull_request17762">pull_request17762</a></td></tr> <tr><td>2020-02-06 23:07:12</td><td>vstinner</td><td>create</td><td></td></tr> </table> </div> </div> <!-- content-body --> <div id="footer"> <div id="credits"> Supported by <a href="https://python.org/psf-landing/" title="The Python Software Foundation">The Python Software Foundation</a>, <br> Powered by <a href="http://roundup.sourceforge.net" title="Powered by the Roundup Issue Tracker">Roundup</a> </div> <!-- credits --> Copyright © 1990-2022, <a href="http://python.org/psf">Python Software Foundation</a><br /> <a href="http://python.org/about/legal">Legal Statements</a> </div> <!-- footer --> </div> <!-- body-main --> </div> <!-- content --> </body> </html>