Thomas Heller added the comment:

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?

----------
assignee:  -> theller
nosy: +theller

__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2123>
__________________________________
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to