A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2009-May/089534.html below:

drop unnecessary "context" pointer from PyGetSetDef

[Python-Dev] Proposed: drop unnecessary "context" pointer from PyGetSetDefCasey Duncan casey at pandora.com
Fri May 8 19:19:24 CEST 2009
On May 4, 2009, at 3:10 AM, Larry Hastings wrote:

>
> I should have brought this up to python-dev before--sorry for being  
> so slow.  It's already in the tracker for a couple of days:
>
>   http://bugs.python.org/issue5880
>
> The idea: PyGetSetDef has this "void *closure" field that acts like  
> a context pointer.  You stick it in the PyGetSetDef, and it gets  
> passed back to you when your getter or setter is called.  It's a  
> reasonable API design, but in practice you almost never need it.   
> Meanwhile, it clutters up CPython, particularly typeobject.c; there  
> are all these function calls that end with ", NULL);", just to  
> satisfy the getter/setter prototype internally.

I think this is an important feature, which allows you to define  
generic, reusable getter and setter functions and pass static metadata  
to them at runtime. Admittedly I have never needed the full pointer,  
my typical usage is to pass in an offset.

I think this should only be removed if a suitable mechanism replaces  
it, if not it will require some needless duplication of code in  
extensions that use it (in particular my own) 8^)

-Casey
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4