Note that there are some explanatory texts on larger screens.

plurals
  1. POPython C API: PyEval_CallFunction?
    text
    copied!<p>I've discovered a function in the Python C API named <code>PyEval_CallFunction</code> which seems to be useful. It allows you to invoke a Python callable by saying something like:</p> <pre><code>PyEval_CallFunction(obj, "OOO", a, b, c); </code></pre> <p>However, I can't find any official documentation on this function. A google search brings up various <a href="http://starship.python.net/crew/mwh/toext/calling-python-from-c.html" rel="nofollow"><em>unofficial</em> tutorials</a> which discuss this function, but:</p> <ol> <li><p>The function <a href="http://docs.python.org/release/3.0.1/search.html?q=PyEval_CallFunction&amp;check_keywords=yes&amp;area=default" rel="nofollow">isn't documented</a> in the official Python docs, so I don't know if it's even something that is supposed to be part of the public API.</p></li> <li><p>Searching the web turns up inconsistent usage policies. Some tutorials indicate the format string needs parenthesis around the type list, like <code>"(OiiO)"</code>, whereas other times I see it used without the parenthesis. When I actually try the function in a real program, it seems to require the parenthesis, otherwise it segfaults.</p></li> </ol> <p>I'd like to use this function because it's convenient. Does anyone know anything about this, or know why it <a href="http://docs.python.org/release/3.0.1/search.html?q=PyEval_CallFunction&amp;check_keywords=yes&amp;area=default" rel="nofollow">isn't documented</a>? Is it part of the public API?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload