[Python-Dev] Does anyone care enough about asyncore and asynchat to help adapt their APIs for Py3k?

Guido van Rossum guido at python.org
Wed Dec 5 19:20:18 CET 2007


On Dec 5, 2007 10:04 AM, Josiah Carlson <josiah.carlson at gmail.com> wrote:
> On Dec 5, 2007 9:19 AM, Guido van Rossum <guido at python.org> wrote:
> > The asyncore and asynchat modules are in a difficult position when it
> > comes to Python 3000. None of the core developers use it or
> > particularly care about it (AFAIK), and the API has problems because
> > it wasn't written to deal with bytes vs. unicode. E.g. in
> > http://bugs.python.org/issue1067, Thomas suggests that these modules
> > need to be rewritten to use bytes internally and have separate APIs to
> > handle (unicode) text as desired, similar to the way file I/O was
> > redesigned. Another alternative would be to make these modules deal
> > strictly in bytes, but that would probably vastly reduce their
> > usefulness (though I don't know -- as I said, I don't use them).
>
> I can look into it later this month, but for the short term, I'm a
> little squeezed for time (work, finishing school, etc.).

That's fine; I see this as part of the library reorg effort, which is
still in the starting blocks.

> I am a bit
> curious, however, I could have sworn that bytes were to become,
> essentially, the 2.x str type (without some methods).  If that is the
> case, no changes should really be necessary, except for a few small
> changes to asynchat with regards to line terminators.

Well, yes, that would be the easiest thing (and may be right for
asyncore), but most of the code that *uses* asynchat (that I've seen
anyway) passes it text strings, not byte strings. And in 3.0, all text
is unicode, and you *must* specify an encoding *somewhere* in order to
convert it to bytes correctly -- otherwise it will blow up immediately
with a TypeError.

> Then again, I haven't really been keeping up in the p3k/pydev lists
> for the last 6-8 months, and only the subject line of this posting
> caught my eye (because I use asyncore/asynchat, and support users of
> asyncore/asynchat that contact me directly).

Good to know there are users. Perhaps you could make them aware of this request.

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


More information about the Python-Dev mailing list