[Python-3000] How best to handle failing tests in struni?

"Martin v. Löwis" martin at v.loewis.de
Wed Jun 20 21:25:32 CEST 2007


> And speaking of struni, when I realized that fixing _bsddb.c was not
> going to be simple, I moved on to the next test (test_asynchat) and
> came across a string with an 's' prefix.  Just to make sure I got
> everything straight, str8 produces a classic str instance (pure ASCII)
> and a string with an 's' prefix is a str8 string.  Other there any
> other differences to be aware of when working on the branch?

There appears to be some disagreement on what the objective for that
branch is. I would personally like to see str8 disappear, at least
from Python API. IOW, if a str8 shows up somewhere, check whether it
might be easy to replace it with a Unicode string.

> And I assume the PyString API is going away, so when working on a
> module one should just tear out use of the API and convert it over to
> PyUnicode, correct?  

The API will stay. However, it should get used less-and-less. Whether
converting it in Unicode depends on the use case. It might be that
converting to binary is the right answer.

> And do the same for "s" format characters in
> Py_BuildValue and PyArg_ParseTuple?

Again, depends. On ParseTuple, the default encoding is applied, which
is supposed to always work, and always provides you with a char*.
(it currently produces a str8 internally, but eventually should
create a bytes object instead).

For BuildValue, I would recommend that the s format code produces
a Unicode object. That might be ambiguous, as some people might
want to create bytes instead, but I recommend to designate a
different code for creating bytes in BuildValue.

> I just want to get an idea of the basic process going on to do the
> conversion so that I don't have to figure out the hard way.

I think many questions are still open, and should be discussed
(or Guido would have to publish a policy in case he made up
his mind already).

Regards,
Martin


More information about the Python-3000 mailing list