[Python-Dev] PEP-393: request for keeping PyUnicode_EncodeDecimal()

Stefan Krah stefan at bytereef.org
Sat Oct 1 16:58:59 CEST 2011


"Martin v. Löwis" <martin at v.loewis.de> wrote:
> > the subject says it all. PyUnicode_EncodeDecimal() is listed among
> > the deprecated functions.
> 
> Please see the section on deprecation. None of the deprecated functions
> will be removed for a period of five years, and afterwards, they will
> be kept until usage outside of the core is low. Most likely, this means
> they will be kept until Python 4.

I've to confess that I missed that; sounds good.


> In addition, you could also take the same approach as decimal.py,
> i.e. do
> 
>    self._int = str(int(intpart+fracpart))
> 
> This would improve compatibility with the decimal.py implementation,
> which doesn't use PyUnicode_EncodeDecimal either (but instead goes
> through _PyUnicode_TransformDecimalAndSpaceToASCII).

longobject.c still used PyUnicode_EncodeDecimal() until 10 months
ago (8304bd765bcf). I missed the PyUnicode_TransformDecimalToASCII()
commit, probably because #10557 is still open.

That's why I wouldn't like to implement the function myself at least
until the API is settled.


I see this in the new code:

#if 0
static PyObject *
unicode__decimal2ascii(PyObject *self)
{
    return PyUnicode_TransformDecimalAndSpaceToASCII(self);
}
#endif


Will PyUnicode_TransformDecimalAndSpaceToASCII() be public?


Stefan Krah




More information about the Python-Dev mailing list