CINXE.COM

Issue 47208: Support libffi implementations that cannot support invocations with 1024 arguments - 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 47208: Support libffi implementations that cannot support invocations with 1024 arguments - 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="dc7842cf3ccad2d07512d480b1fd517629f22691db876c97bc99e34983d99197" 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&amp;status=1">Search</a></li> <li><a href="issue?@action=random">Random Issue</a></li> <li> <form method="post" action="issue47208"> <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&amp;@sort=-activity&amp;@columns=id%2Cgithub%2Cactivity%2Ctitle%2Ccreator%2Cstatus&amp;@dispname=Issues%20with%20patch&amp;@startwith=0&amp;@group=priority&amp;keywords=2&amp;@action=search&amp;@filter=&amp;@pagesize=50">Issues with patch</a> </li> <li> <a href="issue?status=1&amp;@sort=-activity&amp;@columns=id%2Cgithub%2Cactivity%2Ctitle%2Ccreator%2Cstatus&amp;@dispname=Easy%20issues&amp;@startwith=0&amp;@group=priority&amp;keywords=6&amp;@action=search&amp;@filter=&amp;@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="issue47208"> <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/issue47208?"> <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&nbsp;your&nbsp;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&amp;@action=search&amp;@sort=username&amp;@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"> Issue47208 </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="issue47208"> <div id="gh-issue-link"> <a href="https://github.com/python/cpython/issues/91364"> <img width="32" src="@@file/gh-icon.png" /> <p> <span>This issue has been migrated to GitHub:</span> https://github.com/python/cpython/issues/91364 </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>Support libffi implementations that cannot support invocations with 1024 arguments</span> <input type="hidden" name="title" value="Support libffi implementations that cannot support invocations with 1024 arguments"> </td> </tr> <tr> <th class="required"><a href="http://docs.python.org/devguide/triaging.html#type" target="_blank">Type</a>:</th> <td>behavior</td> <th><a href="http://docs.python.org/devguide/triaging.html#stage" target="_blank">Stage</a>:</th> <td>patch review</td> </tr> <tr> <th><a href="http://docs.python.org/devguide/triaging.html#components" target="_blank">Components</a>:</th> <td>ctypes, Tests</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>open</td> <th><a href="http://docs.python.org/devguide/triaging.html#resolution" target="_blank">Resolution</a>:</th> <td></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> amaury.forgeotdarc, belopolsky, christian.heimes, hoodchatham, meador.inge </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>2022-04-04 00:27</strong> by <strong>hoodchatham</strong>, last changed <strong>2022-04-11 14:59</strong> by <strong>admin</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/32297" title="bpo-47208: Allow vendors to override CTYPES_MAX_ARGCOUNT (GH-32297)">PR 32297</a></td> <td>merged</td> <td> <span>christian.heimes</span>, <span>2022-04-04 06:59</span> </td> <td> </td> </tr> </table> <table class="messages"> <tr><th colspan="4" class="header">Messages (4)</th></tr> <tr> <th> <a href="#msg416646" id="msg416646">msg416646</a> - <a href="msg416646">(view)</a></th> <th>Author: Hood Chatham (hoodchatham) <span title="Contributor form received">*</span></th> <th>Date: 2022-04-04 00:27</th> </tr> <tr> <td colspan="4" class="content"> <pre>ctypes defines `CTYPES_MAX_ARGCOUNT` to be 1024: <a href="https://github.com/python/cpython/blob/6db2db91b96aaa1270c200ec931a2250fe2799c7/Modules/_ctypes/ctypes.h#L21">https://github.com/python/cpython/blob/6db2db91b96aaa1270c200ec931a2250fe2799c7/Modules/_ctypes/ctypes.h#L21</a> If a function call is attempted with more than 1024 arguments, it will fail. The libffi emscripten port github.com/hoodmane/libffi-emscripten can only support function calls with at most 122 arguments due to limitations in Emscripten / Wasm: <a href="https://github.com/emscripten-core/emscripten/pull/16653">https://github.com/emscripten-core/emscripten/pull/16653</a> I propose to allow the libffi port to define FFI_MAX_CLOSURE_ARGS and if this is defined then use this number instead for `CTYPES_MAX_ARGCOUNT`. <a href="https://github.com/libffi/libffi/issues/703">https://github.com/libffi/libffi/issues/703</a> The test `test_callback_too_many_args` should also be updated to respect the value of `CTYPES_MAX_ARGCOUNT` rather than hardcoding 1024 into the test.</pre> </td> </tr> <tr> <th> <a href="#msg416677" id="msg416677">msg416677</a> - <a href="msg416677">(view)</a></th> <th>Author: Christian Heimes (christian.heimes) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2022-04-04 17:13</th> </tr> <tr> <td colspan="4" class="content"> <pre> New changeset <a href="https://hg.python.org/lookup/d1b1c885d8f276a0b1ff2e327270916396a8b842">d1b1c885d8f276a0b1ff2e327270916396a8b842</a> by Christian Heimes in branch 'main': <a class="open" title="[open] Support libffi implementations that cannot support invocations with 1024 arguments" href="issue47208">bpo-47208</a>: Allow vendors to override CTYPES_MAX_ARGCOUNT (<a href="https://github.com/python/cpython/pull/32297" class="closed" title="GitHub PR 32297: [merged] bpo-47208: Allow vendors to override CTYPES_MAX_ARGCOUNT (GH-32297)">GH-32297</a>) <a href="https://github.com/python/cpython/commit/d1b1c885d8f276a0b1ff2e327270916396a8b842">https://github.com/python/cpython/commit/d1b1c885d8f276a0b1ff2e327270916396a8b842</a> </pre> </td> </tr> <tr> <th> <a href="#msg416678" id="msg416678">msg416678</a> - <a href="msg416678">(view)</a></th> <th>Author: Christian Heimes (christian.heimes) <span title="Contributor form received">*</span> <img src="@@file/committer.png" title="Python committer" alt="(Python committer)" /></th> <th>Date: 2022-04-04 17:15</th> </tr> <tr> <td colspan="4" class="content"> <pre><a href="https://github.com/python/cpython/pull/32297" class="closed" title="GitHub PR 32297: [merged] bpo-47208: Allow vendors to override CTYPES_MAX_ARGCOUNT (GH-32297)">GH-32297</a> adds #ifndef CTYPES_MAX_ARGCOUNT and exposes the constant in the _ctypes extension module, so the test case can use the constant. It allows you to override CTYPES_MAX_ARGCOUNT until libffi upstream agrees on FFI_MAX_CLOSURE_ARGS.</pre> </td> </tr> <tr> <th> <a href="#msg416692" id="msg416692">msg416692</a> - <a href="msg416692">(view)</a></th> <th>Author: Hood Chatham (hoodchatham) <span title="Contributor form received">*</span></th> <th>Date: 2022-04-04 19:07</th> </tr> <tr> <td colspan="4" class="content"> <pre>Ideally the library should be able to define a different macro, e.g., CTYPES_CUSTOM_MAX_ARGCOUNT. This way the libffi port can define CTYPES_CUSTOM_MAX_ARGCOUNT and it will be compatible with older Python versions without causing Warning: "CTYPES_MAX_ARGCOUNT redefined`.</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&nbsp;14:59:58</td><td>admin</td><td>set</td><td>github: 91364</td></tr> <tr><td>2022-04-04&nbsp;19:07:48</td><td>hoodchatham</td><td>set</td><td>messages: + <a rel="nofollow" href="msg416692">msg416692</a></td></tr> <tr><td>2022-04-04&nbsp;17:15:36</td><td>christian.heimes</td><td>set</td><td>type: behavior<br />components: + Tests<br />versions: + Python 3.11</td></tr> <tr><td>2022-04-04&nbsp;17:15:19</td><td>christian.heimes</td><td>set</td><td>messages: + <a rel="nofollow" href="msg416678">msg416678</a></td></tr> <tr><td>2022-04-04&nbsp;17:13:50</td><td>christian.heimes</td><td>set</td><td>messages: + <a rel="nofollow" href="msg416677">msg416677</a></td></tr> <tr><td>2022-04-04&nbsp;06:59:50</td><td>christian.heimes</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_request30356">pull_request30356</a></td></tr> <tr><td>2022-04-04&nbsp;00:28:20</td><td>hoodchatham</td><td>set</td><td>nosy: + <a rel="nofollow" href="user1076">amaury.forgeotdarc</a>, <a rel="nofollow" href="user1427">belopolsky</a>, <a rel="nofollow" href="user3108">christian.heimes</a>, <a rel="nofollow" href="user11255">meador.inge</a><br /></td></tr> <tr><td>2022-04-04&nbsp;00:27:44</td><td>hoodchatham</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 &copy; 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>

Pages: 1 2 3 4 5 6 7 8 9 10