[Python-Dev] PyString_DecodeEscape and PEP293

Walter Dörwald walter@livinglogic.de
Mon, 19 Aug 2002 14:53:15 +0200

A recent checkin added a function PyString_DecodeEscape()
to stringobject.c. To make this function PEP293 compatible
it would need access to unicode_decode_call_errorhandler
which is defined static in unicodeobject.c. Does
PyString_DecodeEscape() really need an errors argument?

If yes, we could either move it to unicodeobject.c or make
unicode_decode_call_errorhandler externally visible.

Another problem that I noticed is that string-escape can't
be used for encoding Unicode objects:

 >>> u"\u0100".encode("string-escape")
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
TypeError: escape_encode() argument 1 must be str, not unicode

    Walter Dörwald