John Ehresman j...@wingware.com added the comment:
I'm trying to port an existing C extension to py3k and find myself wanting
something like PyUnicode_AsString so I don't need to introduce other objects to
do memory management. PyUnicode_AsString is equivalent to PyArg_Parse w/ a 's'
format
Changes by Daniel Diniz aja...@gmail.com:
--
nosy: +ezio.melotti, haypo
priority: - normal
type: - feature request
versions: +Python 3.1
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2799
Stefan Behnel [EMAIL PROTECTED] added the comment:
While PyUnicode_AsStringAndSize() may be a better solution if the length
is required, PyUnicode_AsString is enough() when it is not required. So
I don't buy that argument. Since there are dedicated UTF-8 encoding
functions, both functions are
Alexandre Vassalotti [EMAIL PROTECTED] added the comment:
I now think the proposed changes wouldn't be bad thing, after all. I
have been bitten myself by the confusing naming of the Unicode API. So,
there is definitely a potential for errors.
The main problem with PyUnicode_AsString(), as
Martin v. Löwis [EMAIL PROTECTED] added the comment:
How about PyUnicode_GetUTF8Buffer() or just PyUnicode_UTF8() ?!
-1
Note that the function *must* check the UTF-8 buffer for embedded
NUL bytes and then raise an exception if it finds one. Otherwise,
the API would silently cause
Martin v. Löwis [EMAIL PROTECTED] added the comment:
I don't agree that PyUnicode_AsString is useless. There are many cases
where you don't need the length of the string, e.g. when relying on NULL
termination when passing stuff to some C library.
I suggest to close this report as works for me.
Changes by Haoyu Bai [EMAIL PROTECTED]:
--
nosy: +bhy
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2799
__
___
Python-bugs-list mailing list
Unsubscribe:
Marc-Andre Lemburg [EMAIL PROTECTED] added the comment:
IMO, it's better to correct API design errors early, rather than going
through a deprecation process.
Note that PyUnicode_AsString() is also different than its cousind
PyString_AsString().
PyString_AsString() is mostly used to access the
New submission from Marc-Andre Lemburg [EMAIL PROTECTED]:
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
Alexandre Vassalotti [EMAIL PROTECTED] added the comment:
Honestly, I am not sure if removing PyUnicode_AsString() is a good idea.
There is many cases where the size of the returned string is not needed.
Furthermore, this would be a rather major backward-incompatible change
to be included in a
10 matches
Mail list logo