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 theller
Recipients arigo, theller
Date 2008-02-15.20:00:12
SpamBayes Score 0.03960926
Marked as misclassified No
Message-id <1203105613.79.0.707144726286.issue2123@psf.upfronthosting.co.za>
In-reply-to
Content
May I ask: do you have a real use case for this, or is it a carefully
constructed example?

Of course I take all the blame for not defining/documenting this
stuff.  My current view is this:

Python code                     C code
=======================         ================

ptr = POINTER(c_long)()         int *ptr = NULL;
x = c_long(42)                  int x = 42;

ptr.contents = x                ptr = &x;

a = ptr[0]                      int a = *ptr;
b = ptr[n]                      int b = ptr[n];

Assigning to .contents changes 'where the pointer points to'.
__setitem__ changes the pointed to memory location; __getitem__
retrieves the pointed to memory location.

Having said that, it is no longer clear to me what reading the
.contents attribute should mean.  Would making the .contents attribute
write-only help - is it impossible to construct this 'bug' without
assigning to .contents?
History
Date User Action Args
2008-02-15 20:00:13thellersetspambayes_score: 0.0396093 -> 0.03960926
recipients: + theller, arigo
2008-02-15 20:00:13thellersetspambayes_score: 0.0396093 -> 0.0396093
messageid: <1203105613.79.0.707144726286.issue2123@psf.upfronthosting.co.za>
2008-02-15 20:00:13thellerlinkissue2123 messages
2008-02-15 20:00:12thellercreate