[New-bugs-announce] [issue21328] Resize doesn't change reported length on create_string_buffer()

Dustin Oprea report at bugs.python.org
Tue Apr 22 16:02:29 CEST 2014


New submission from Dustin Oprea:

The memory is resized, but the value returned by len() doesn't change:

>>> b = ctypes.create_string_buffer(23)
>>> len(b)
23
>>> b.raw = '0' * 23
>>> b.raw = '0' * 24
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: string too long

>>> ctypes.resize(b, 28)
>>> len(b)
23
>>> b.raw = '0' * 28
>>> b.raw = '0' * 29
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: string too long

----------
components: ctypes
messages: 217005
nosy: Dustin.Oprea
priority: normal
severity: normal
status: open
title: Resize doesn't change reported length on create_string_buffer()
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21328>
_______________________________________


More information about the New-bugs-announce mailing list