[New-bugs-announce] [issue2807] Remove the API PyUnicode_AsString()

Alexandre Vassalotti report at bugs.python.org
Sat May 10 00:31:28 CEST 2008

New submission from Alexandre Vassalotti <alexandre at peadrop.com>:

Marc-Andre Lemburg noted:

  BTW: The API PyUnicode_AsString() is pretty useless by itself - there's
  no way to access the size information of the returned string without
  again going to the Unicode object.
  I'd suggest to remove the API altogether and not only deprecating it.
  Furthermore, the API PyUnicode_AsStringAndSize() does not follow the API
  signature of PyString_AsStringAndSize() in that it passes back the
  pointer to the string as output parameter. That should be changed as
  well. Note that PyString_AsStringAndSize() already does this for both
  8-bit strings and Unicode, so the special Unicode API is not really
  needed at all or you may want to rename PyString_AsStringAndSize() to
  Finally, since there are many cases where the string buffer contents are
  copied to a new buffer, it's probably worthwhile to add a new API which
  does the copying straight away and also deals with the overflow cases in
  a central place. I'd suggest PyUnicode_AsChar() (with an API like

components: Interpreter Core, Unicode
messages: 66495
nosy: alexandre.vassalotti, lemburg
priority: normal
severity: normal
status: open
title: Remove the API PyUnicode_AsString()
type: feature request
versions: Python 3.0

Tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list