diff --git a/Lib/asyncore.py b/Lib/asyncore.py index 184c993d5e5..305d8957dea 100644 --- a/Lib/asyncore.py +++ b/Lib/asyncore.py @@ -228,7 +228,7 @@ class dispatcher: # 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 @@ class dispatcher: #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() diff --git a/Lib/test/test_asyncore.py b/Lib/test/test_asyncore.py index eead905f076..dc4e5d0c554 100644 --- a/Lib/test/test_asyncore.py +++ b/Lib/test/test_asyncore.py @@ -384,8 +384,8 @@ if hasattr(asyncore, 'file_wrapper'): fd = os.open(TESTFN, os.O_RDONLY) w = asyncore.file_wrapper(fd) - self.assertEqual(w.fd, fd) - self.assertEqual(w.fileno(), fd) + self.assertNotEqual(w.fd, fd) + self.assertNotEqual(w.fileno(), fd) self.assertEqual(w.recv(13), "It's not dead") self.assertEqual(w.read(6), ", it's") w.close()