<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/cpython.git/Include/ceval.h, branch v2.5b2</title>
<subtitle>
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython.git/'/>
<entry>
<title>Merge ssize_t branch.</title>
<updated>2006-02-15T17:27:45+00:00</updated>
<author>
<name>Martin v. Löwis</name>
<email>martin@v.loewis.de</email>
</author>
<published>2006-02-15T17:27:45+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython.git/commit/?id=26a6348f77faff1083d501950812ea9f68eb9547'/>
<id>26a6348f77faff1083d501950812ea9f68eb9547</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Add const to several API functions that take char *.</title>
<updated>2005-12-10T18:50:16+00:00</updated>
<author>
<name>Jeremy Hylton</name>
<email>jeremy@alum.mit.edu</email>
</author>
<published>2005-12-10T18:50:16+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython.git/commit/?id=10b7308bdafd13a6e9ec459c09774cc7cd99d97e'/>
<id>10b7308bdafd13a6e9ec459c09774cc7cd99d97e</id>
<content type='text'>
In C++, it's an error to pass a string literal to a char* function
without a const_cast().  Rather than require every C++ extension
module to put a cast around string literals, fix the API to state the
const-ness.

I focused on parts of the API where people usually pass literals:
PyArg_ParseTuple() and friends, Py_BuildValue(), PyMethodDef, the type
slots, etc.  Predictably, there were a large set of functions that
needed to be fixed as a result of these changes.  The most pervasive
change was to make the keyword args list passed to
PyArg_ParseTupleAndKewords() to be a const char *kwlist[].

One cast was required as a result of the changes:  A type object
mallocs the memory for its tp_doc slot and later frees it.
PyTypeObject says that tp_doc is const char *; but if the type was
created by type_new(), we know it is safe to cast to char *.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In C++, it's an error to pass a string literal to a char* function
without a const_cast().  Rather than require every C++ extension
module to put a cast around string literals, fix the API to state the
const-ness.

I focused on parts of the API where people usually pass literals:
PyArg_ParseTuple() and friends, Py_BuildValue(), PyMethodDef, the type
slots, etc.  Predictably, there were a large set of functions that
needed to be fixed as a result of these changes.  The most pervasive
change was to make the keyword args list passed to
PyArg_ParseTupleAndKewords() to be a const char *kwlist[].

One cast was required as a result of the changes:  A type object
mallocs the memory for its tp_doc slot and later frees it.
PyTypeObject says that tp_doc is const char *; but if the type was
created by type_new(), we know it is safe to cast to char *.
</pre>
</div>
</content>
</entry>
<entry>
<title>PEP 342 implementation.  Per Guido's comments, the generator throw()</title>
<updated>2005-08-02T00:46:46+00:00</updated>
<author>
<name>Phillip J. Eby</name>
<email>pje@telecommunity.com</email>
</author>
<published>2005-08-02T00:46:46+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython.git/commit/?id=ee4bf0733bf0fa1db63b18ef4c8b9767f856c847'/>
<id>ee4bf0733bf0fa1db63b18ef4c8b9767f856c847</id>
<content type='text'>
method still needs to support string exceptions, and allow None for the
third argument.  Documentation updates are needed, too.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
method still needs to support string exceptions, and allow None for the
third argument.  Documentation updates are needed, too.
</pre>
</div>
</content>
</entry>
<entry>
<title>SF patch 1044089:  New C API function PyEval_ThreadsInitialized(), by Nick</title>
<updated>2004-10-11T02:40:51+00:00</updated>
<author>
<name>Tim Peters</name>
<email>tim.peters@gmail.com</email>
</author>
<published>2004-10-11T02:40:51+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython.git/commit/?id=32bc1e4c7e3d32edb9a77714391ed5593c1c001c'/>
<id>32bc1e4c7e3d32edb9a77714391ed5593c1c001c</id>
<content type='text'>
Coghlan, for determining whether PyEval_InitThreads() has been called.
Also purged the undocumented+unused _PyThread_Started int.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Coghlan, for determining whether PyEval_InitThreads() has been called.
Also purged the undocumented+unused _PyThread_Started int.
</pre>
</div>
</content>
</entry>
<entry>
<title>Patch #966493: Cleanup generator/eval_frame exposure.</title>
<updated>2004-06-27T15:43:12+00:00</updated>
<author>
<name>Martin v. Löwis</name>
<email>martin@v.loewis.de</email>
</author>
<published>2004-06-27T15:43:12+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython.git/commit/?id=8161ff8f3d8947086b5e4f7e460795a633a3cbd6'/>
<id>8161ff8f3d8947086b5e4f7e460795a633a3cbd6</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Patch #957398: Add public API for Generator Object/Type.</title>
<updated>2004-06-01T15:22:42+00:00</updated>
<author>
<name>Martin v. Löwis</name>
<email>martin@v.loewis.de</email>
</author>
<published>2004-06-01T15:22:42+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython.git/commit/?id=9e75991668866ad0695e7f3b258fe063cb27f75d'/>
<id>9e75991668866ad0695e7f3b258fe063cb27f75d</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Deleting cyclic object comparison.</title>
<updated>2003-10-28T12:05:48+00:00</updated>
<author>
<name>Armin Rigo</name>
<email>arigo@tunes.org</email>
</author>
<published>2003-10-28T12:05:48+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython.git/commit/?id=8cbe70f474e47964f45a14a4e265a30ce2fedac9'/>
<id>8cbe70f474e47964f45a14a4e265a30ce2fedac9</id>
<content type='text'>
SF patch 825639
http://mail.python.org/pipermail/python-dev/2003-October/039445.html
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
SF patch 825639
http://mail.python.org/pipermail/python-dev/2003-October/039445.html
</pre>
</div>
</content>
</entry>
<entry>
<title>As far as I can tell PyEval_GetOwner was removed in 1997 (when it was</title>
<updated>2003-02-20T17:59:17+00:00</updated>
<author>
<name>Michael W. Hudson</name>
<email>mwh@python.net</email>
</author>
<published>2003-02-20T17:59:17+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython.git/commit/?id=e905d033795341350a3904f9b4ccb6cc52b74285'/>
<id>e905d033795341350a3904f9b4ccb6cc52b74285</id>
<content type='text'>
called something else!).  I can't imagine removing the prototype is
going to hurt, but put it back if *you* can.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
called something else!).  I can't imagine removing the prototype is
going to hurt, but put it back if *you* can.
</pre>
</div>
</content>
</entry>
<entry>
<title>- PyEval_GetFrame() is now declared to return a PyFrameObject *</title>
<updated>2003-02-19T15:53:17+00:00</updated>
<author>
<name>Guido van Rossum</name>
<email>guido@python.org</email>
</author>
<published>2003-02-19T15:53:17+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython.git/commit/?id=e753db80908c6890ec33efc0c9708ca3d399fdeb'/>
<id>e753db80908c6890ec33efc0c9708ca3d399fdeb</id>
<content type='text'>
  instead of a plain PyObject *.  (SF patch #686601 by Ben Laurie.)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
  instead of a plain PyObject *.  (SF patch #686601 by Ben Laurie.)
</pre>
</div>
</content>
</entry>
<entry>
<title>Small function call optimization and special build option for call stats.</title>
<updated>2003-02-05T23:13:00+00:00</updated>
<author>
<name>Jeremy Hylton</name>
<email>jeremy@alum.mit.edu</email>
</author>
<published>2003-02-05T23:13:00+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython.git/commit/?id=a99f781d016f9d9c65e7eeb842904c7cc2c0468d'/>
<id>a99f781d016f9d9c65e7eeb842904c7cc2c0468d</id>
<content type='text'>
-DCALL_PROFILE: Count the number of function calls executed.

When this symbol is defined, the ceval mainloop and helper functions
count the number of function calls made.  It keeps detailed statistics
about what kind of object was called and whether the call hit any of
the special fast paths in the code.

Optimization:

When we take the fast_function() path, which seems to be taken for
most function calls, and there is minimal frame setup to do, avoid
call PyEval_EvalCodeEx().  The eval code ex function does a lot of
work to handle keywords args and star args, free variables,
generators, etc.  The inlined version simply allocates the frame and
copies the arguments values into the frame.

The optimization gets a little help from compile.c which adds a
CO_NOFREE flag to code objects that don't have free variables or cell
variables.  This change allows fast_function() to get into the fast
path with fewer tests.

I measure a couple of percent speedup in pystone with this change, but
there's surely more that can be done.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
-DCALL_PROFILE: Count the number of function calls executed.

When this symbol is defined, the ceval mainloop and helper functions
count the number of function calls made.  It keeps detailed statistics
about what kind of object was called and whether the call hit any of
the special fast paths in the code.

Optimization:

When we take the fast_function() path, which seems to be taken for
most function calls, and there is minimal frame setup to do, avoid
call PyEval_EvalCodeEx().  The eval code ex function does a lot of
work to handle keywords args and star args, free variables,
generators, etc.  The inlined version simply allocates the frame and
copies the arguments values into the frame.

The optimization gets a little help from compile.c which adds a
CO_NOFREE flag to code objects that don't have free variables or cell
variables.  This change allows fast_function() to get into the fast
path with fewer tests.

I measure a couple of percent speedup in pystone with this change, but
there's surely more that can be done.
</pre>
</div>
</content>
</entry>
</feed>
