[Python-Dev] asyncore patch

Josiah Carlson josiah.carlson at gmail.com
Tue Jun 10 17:58:33 CEST 2008


On Tue, Jun 10, 2008 at 8:26 AM, Giampaolo Rodola' <gnewsg at gmail.com> wrote:
> On 10 Giu, 07:01, "Josiah Carlson" <josiah.carl... at gmail.com> wrote:
>> On Mon, Jun 9, 2008 at 7:19 PM, Benjamin Peterson
>>
>> <musiccomposit... at gmail.com> wrote:
>> > On Mon, Jun 9, 2008 at 8:42 PM, Josiah Carlson <josiah.carl... at gmail.com> wrote:
>>
>> >> Would it be ok if I committed the changes?  Neal, do you want to
>> >> commit the changes if I post an updated patch with a blurb for the
>> >> NEWS file?
>>
>> > You are the asyncore maintainer, correct? I believe it's pretty much
>> > up to you, then. :)
>>
>> Indeed, but I didn't want to step on anyone's toes.
>>
>> It's committed in revision 64062 for anyone who cares.
>>
>>  - Josiah
>
>
> I've started to test the new code by using the pyftpdlib test suite.
> On Windows all tests passed but on Linux I get some "EBADF Bad file
> descriptor" errors occurring when using poll() instead of select().
> I'll try to look into them today and open a report if necessary.
> In the meanwhile I noticed some minor bugs in asyncore.py. Take a look
> at the patch below:
>
>
> Index: Lib/asyncore.py
> ===================================================================
> --- Lib/asyncore.py     (revisione 64069)
> +++ Lib/asyncore.py     (copia locale)
> @@ -228,7 +228,7 @@
>             # passed be connected.
>             try:
>                 self.addr = sock.getpeername()
> -            except socket.error:
> +            except socket.error, err:
>                 if err[0] == ENOTCONN:
>                     # To handle the case where we got an unconnected
>                     # socket.
> @@ -424,7 +424,7 @@
>             #check for errors
>             err = self.socket.getsockopt(socket.SOL_SOCKET,
> socket.SO_ERROR)
>             if err != 0:
> -                raise socket.error(err, strerror(err))
> +                raise socket.error(err, _strerror(err))
>
>             self.handle_connect_event()
>         self.handle_write()

I have fixed the testcase (it was failing due to the new semantics of
the filewrapper automatically duping the file handle), as well as the
two NameErrors that Giampaolo pointed out.  See revision 64080.

 - Josiah


More information about the Python-Dev mailing list