[Python-3000-checkins] r56961 - python/branches/py3k/Objects/unicodeobject.c

Guido van Rossum guido at python.org
Mon Aug 13 04:47:12 CEST 2007


On 8/12/07, neal.norwitz <python-3000-checkins at python.org> wrote:
> Author: neal.norwitz
> Date: Sun Aug 12 19:21:38 2007
> New Revision: 56961
>
> Modified:
>    python/branches/py3k/Objects/unicodeobject.c
> Log:
> Add comment that should be addressed
>
> Modified: python/branches/py3k/Objects/unicodeobject.c
> ==============================================================================
> --- python/branches/py3k/Objects/unicodeobject.c        (original)
> +++ python/branches/py3k/Objects/unicodeobject.c        Sun Aug 12 19:21:38 2007
> @@ -1188,6 +1188,9 @@
>          return v;
>      if (errors != NULL)
>          Py_FatalError("non-NULL encoding in _PyUnicode_AsDefaultEncodedString");
> +    /* XXX(nnorwitz): errors will always be NULL due to the check above.
> +       Should this check and the else be removed since it's dead code?
> +     */
>      if (errors == NULL) {
>          b = PyUnicode_EncodeUTF8(PyUnicode_AS_UNICODE(unicode),
>                                   PyUnicode_GET_SIZE(unicode),

I would like to replace this API with one that doesn't take an errors
argument at all, and doesn't begin with an underscore. But I've been
holding off because I would also like it to return a PyBytes object
instead of a PyString. Hm, given how this is most likely used, perhaps
it should return a char*... Although then you won't know how long it
is (if there's a null byte in it). So maybe we should at least change
the API to remove the _, change the name, and remove the 2nd arg.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000-checkins mailing list