[issue3753] bytearray incompatible with y#

Antoine Pitrou report at bugs.python.org
Mon Sep 1 18:17:12 CEST 2008


Antoine Pitrou <pitrou at free.fr> added the comment:

Yes, you must use y* instead: see
http://docs.python.org/dev/3.0/c-api/arg.html

y# would not be safe to use with bytearray since another thread could
mutate the bytearray in-between, possibly reallocating the internal
buffer (to shrink or grow it), and lead to a segfault when your thread
uses the obsolete pointer.

IMO, the documentation should mention that the '*' codes (y*, s*, etc.)
must be used in preference to the '#' codes, which are there for
backwards compatibility.

----------
assignee:  -> georg.brandl
components: +Documentation
nosy: +georg.brandl, pitrou
title: bytearray incompatible with bytes -> bytearray incompatible with y#
versions: +Python 2.6

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


More information about the Python-bugs-list mailing list