<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/cpython.git/Objects/methodobject.c, branch v2.5b2</title>
<subtitle>
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython.git/'/>
<entry>
<title>Use Py_VISIT in all tp_traverse methods, instead of traversing manually or</title>
<updated>2006-04-15T21:47:09+00:00</updated>
<author>
<name>Thomas Wouters</name>
<email>thomas@python.org</email>
</author>
<published>2006-04-15T21:47:09+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython.git/commit/?id=58c4139c1d6d525e89bb2e6233422e5d2fc38e14'/>
<id>58c4139c1d6d525e89bb2e6233422e5d2fc38e14</id>
<content type='text'>
using a custom, nearly-identical macro. This probably changes how some of
these functions are compiled, which may result in fractionally slower (or
faster) execution. Considering the nature of traversal, visiting much of the
address space in unpredictable patterns, I'd argue the code readability and
maintainability is well worth it ;P
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
using a custom, nearly-identical macro. This probably changes how some of
these functions are compiled, which may result in fractionally slower (or
faster) execution. Considering the nature of traversal, visiting much of the
address space in unpredictable patterns, I'd argue the code readability and
maintainability is well worth it ;P
</pre>
</div>
</content>
</entry>
<entry>
<title>Use Py_ssize_t for counts and sizes.</title>
<updated>2006-02-16T14:32:27+00:00</updated>
<author>
<name>Martin v. Löwis</name>
<email>martin@v.loewis.de</email>
</author>
<published>2006-02-16T14:32:27+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython.git/commit/?id=4b3354f93da362a0fe7ea56b91018abdb5ad4f57'/>
<id>4b3354f93da362a0fe7ea56b91018abdb5ad4f57</id>
<content type='text'>
Convert Py_ssize_t using PyInt_FromSsize_t
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Convert Py_ssize_t using PyInt_FromSsize_t
</pre>
</div>
</content>
</entry>
<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>* Added a new method flag, METH_COEXIST.</title>
<updated>2003-12-13T11:26:12+00:00</updated>
<author>
<name>Raymond Hettinger</name>
<email>python@rcn.com</email>
</author>
<published>2003-12-13T11:26:12+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython.git/commit/?id=da4fc36ea6ec45fde356173e58874a6847af7ce4'/>
<id>da4fc36ea6ec45fde356173e58874a6847af7ce4</id>
<content type='text'>
* Used the flag to optimize set.__contains__(), dict.__contains__(),
  dict.__getitem__(), and list.__getitem__().
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Used the flag to optimize set.__contains__(), dict.__contains__(),
  dict.__getitem__(), and list.__getitem__().
</pre>
</div>
</content>
</entry>
<entry>
<title>Make __module__ writable except in restricted mode (like for classic classes).</title>
<updated>2003-02-18T17:18:35+00:00</updated>
<author>
<name>Guido van Rossum</name>
<email>guido@python.org</email>
</author>
<published>2003-02-18T17:18:35+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython.git/commit/?id=9d4abdbafa2f169e41a724fccadb2430e3b9272f'/>
<id>9d4abdbafa2f169e41a724fccadb2430e3b9272f</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Make __module__ settable on functions and methods.</title>
<updated>2003-02-18T17:02:15+00:00</updated>
<author>
<name>Jeremy Hylton</name>
<email>jeremy@alum.mit.edu</email>
</author>
<published>2003-02-18T17:02:15+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython.git/commit/?id=a1075e7247af0a7777d192121c980806a0852bb3'/>
<id>a1075e7247af0a7777d192121c980806a0852bb3</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Provide __module__ attributes for functions defined in C and Python.</title>
<updated>2003-01-31T18:33:18+00:00</updated>
<author>
<name>Jeremy Hylton</name>
<email>jeremy@alum.mit.edu</email>
</author>
<published>2003-01-31T18:33:18+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython.git/commit/?id=f18506e24fd99637da224c622e25cd9ae8d9f12d'/>
<id>f18506e24fd99637da224c622e25cd9ae8d9f12d</id>
<content type='text'>
__module__ is the string name of the module the function was defined
in, just like __module__ of classes.  In some cases, particularly for
C functions, the __module__ may be None.

Change PyCFunction_New() from a function to a macro, but keep an
unused copy of the function around so that we don't change the binary
API.

Change pickle's save_global() to use whichmodule() if __module__ is
None, but add the __module__ logic to whichmodule() since it might be
used outside of pickle.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
__module__ is the string name of the module the function was defined
in, just like __module__ of classes.  In some cases, particularly for
C functions, the __module__ may be None.

Change PyCFunction_New() from a function to a macro, but keep an
unused copy of the function around so that we don't change the binary
API.

Change pickle's save_global() to use whichmodule() if __module__ is
None, but add the __module__ logic to whichmodule() since it might be
used outside of pickle.
</pre>
</div>
</content>
</entry>
<entry>
<title>PyCFunction_Call():  Combined two switch cases w/ identical bodies.</title>
<updated>2003-01-05T07:22:44+00:00</updated>
<author>
<name>Tim Peters</name>
<email>tim.peters@gmail.com</email>
</author>
<published>2003-01-05T07:22:44+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython.git/commit/?id=d3e62fb62da5110913606811105e9deb1a2dd60a'/>
<id>d3e62fb62da5110913606811105e9deb1a2dd60a</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>SF Patch #661440: Refactor and streamline PyCFunction_Call</title>
<updated>2003-01-04T00:37:53+00:00</updated>
<author>
<name>Raymond Hettinger</name>
<email>python@rcn.com</email>
</author>
<published>2003-01-04T00:37:53+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython.git/commit/?id=f4d86ed05e9de1a5a68ddfe87a75b14a84b96b5e'/>
<id>f4d86ed05e9de1a5a68ddfe87a75b14a84b96b5e</id>
<content type='text'>
Refactor code in PyCFunction_Call giving a modest (tiny) speed boost,
a slight improvement in semantics (now detects invalid flag combinations),
and (arguably) improved clarity (making it blindingly clear which flag
combinations are allowed).  All this comes at a cost of a few lines of
code duplication.

* Folded test for METH_KEYWORDS into the switch/case.
* Deferred testing for an empty dictionary until when and where needed.
* Make a similar deferral for filling the "size" variable.
* Inverted the dictionary test so that the common case falls though
  instead of making a jump.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Refactor code in PyCFunction_Call giving a modest (tiny) speed boost,
a slight improvement in semantics (now detects invalid flag combinations),
and (arguably) improved clarity (making it blindingly clear which flag
combinations are allowed).  All this comes at a cost of a few lines of
code duplication.

* Folded test for METH_KEYWORDS into the switch/case.
* Deferred testing for an empty dictionary until when and where needed.
* Make a similar deferral for filling the "size" variable.
* Inverted the dictionary test so that the common case falls though
  instead of making a jump.
</pre>
</div>
</content>
</entry>
</feed>
