[New-bugs-announce] [issue15947] Assigning new values to instance of pointer types does not check validity
report at bugs.python.org
Sat Sep 15 16:41:47 CEST 2012
New submission from Facundo Batista:
In the doc it says:
Assigning a new value to instances of the pointer types c_char_p, c_wchar_p, and c_void_p changes the memory location they point to, not the contents of the memory block [...].
>>> s = "Hello, World"
>>> c_s = c_wchar_p(s)
>>> c_s.value = "Hi, there"
>>> print(s) # first object is unchanged
However, c_s it's not getting "Hi, there" as "the memory location it points to", otherwise next access will surely segfault.
OTOH, if it *does* change the memory location, but the value is cached locally, which is the point of letting it change the memory location? Shouldn't it raise AttributeError or something?
title: Assigning new values to instance of pointer types does not check validity
versions: Python 3.2
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce