This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author larry
Recipients larry, loewis
Date 2009-04-29.16:15:18
SpamBayes Score 8.441581e-13
Marked as misclassified No
Message-id <1241021724.62.0.808491876443.issue5880@psf.upfronthosting.co.za>
In-reply-to
Content
PyGetSetDef has a "void *context" field.  This field is passed in to the
get and set functions implementing the property.  The field is almost
never used, so it adds unnecessary complexity.  Clearly, YAGNI.

There are two places in CPython where it got used: both in PyLongObject,
both using long_getN(), where it's used to store an integer constant
(not a pointer!) that is converted to a Long object and returned.  Since
there are only two of these, this was easy to fix: split long_getN()
into two functions returning a hard-coded number, long_get0() and
long_get1().

The attached patch removes the "void *context" field of PyGetSetDef,
removes the almost universally ignored context arguments to the getters
and setters, and removes the data declarations for the context pointer
in static PyGetSetDef structs.  With the patch applied py3k/trunk passes
all expected regression tests.

Martin: I added you to the nosy list 'cause we looked in to this at the
sprints, so I figured you'd be interested.
History
Date User Action Args
2009-04-29 16:15:24larrysetrecipients: + larry, loewis
2009-04-29 16:15:24larrysetmessageid: <1241021724.62.0.808491876443.issue5880@psf.upfronthosting.co.za>
2009-04-29 16:15:23larrylinkissue5880 messages
2009-04-29 16:15:22larrycreate