[Python-Dev] cpython: add generic implementation of a __dict__ descriptor for C types

Georg Brandl g.brandl at gmx.net
Mon Feb 20 08:45:14 CET 2012


Am 20.02.2012 02:04, schrieb benjamin.peterson:
> http://hg.python.org/cpython/rev/78f93eb7dd75
> changeset:   75050:78f93eb7dd75
> user:        Benjamin Peterson <benjamin at python.org>
> date:        Sun Feb 19 19:59:10 2012 -0500
> summary:
>   add generic implementation of a __dict__ descriptor for C types
> 
> files:
>   Doc/c-api/object.rst |  12 +++++++++
>   Doc/c-api/type.rst   |   1 -
>   Include/object.h     |   2 +
>   Misc/NEWS            |   4 +++
>   Objects/object.c     |  42 ++++++++++++++++++++++++++++++++
>   Objects/typeobject.c |  22 +++-------------
>   6 files changed, 64 insertions(+), 19 deletions(-)
> 
> 
> diff --git a/Doc/c-api/object.rst b/Doc/c-api/object.rst
> --- a/Doc/c-api/object.rst
> +++ b/Doc/c-api/object.rst
> @@ -101,6 +101,18 @@
>     This is the equivalent of the Python statement ``del o.attr_name``.
>  
>  
> +.. c:function:: PyObject* PyType_GenericGetDict(PyObject *o, void *context)
> +
> +   A generic implementation for the getter of a ``__dict__`` descriptor. It
> +   creates the dictionary if necessary.
> +
> +
> +.. c:function:: int PyType_GenericSetDict(PyObject *o, void *context)
> +
> +   A generic implementation for the setter of a ``__dict__`` descriptor. This
> +   implementation does not allow the dictionary to be deleted.
> +
> +
>  .. c:function:: PyObject* PyObject_RichCompare(PyObject *o1, PyObject *o2, int opid)


versionadded, please?

Georg



More information about the Python-Dev mailing list