[Python-checkins] CVS: python/dist/src/Lib asyncore.py,1.10,1.11

Jeremy Hylton jhylton@users.sourceforge.net
2001年4月20日 12:04:58 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv32506
Modified Files:
	asyncore.py 
Log Message:
dispatcher.__repr__() was unprepared to handle the address for a Unix
domain socket. Fix that and make the error message for failures a
little more helpful by including the class name.
Index: asyncore.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/asyncore.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** asyncore.py	2001年02月09日 05:03:15	1.10
--- asyncore.py	2001年04月20日 19:04:55	1.11
***************
*** 51,54 ****
--- 51,55 ----
 import socket
 import sys
+ import types
 
 import os
***************
*** 216,232 ****
 status.append ('connected')
 if self.addr:
! status.append ('%s:%d' % self.addr)
! return '<%s %s at %x>' % (
! self.__class__.__name__,
! ' '.join (status),
! id(self)
! )
 except:
! try:
! ar = repr(self.addr)
! except:
! ar = 'no self.addr!'
 
! return '<__repr__ (self) failed for object at %x (addr=%s)>' % (id(self),ar)
 
 def add_channel (self, map=None):
--- 217,236 ----
 status.append ('connected')
 if self.addr:
! if self.addr == types.TupleType:
! status.append ('%s:%d' % self.addr)
! else:
! status.append (self.addr)
! return '<%s %s at %x>' % (self.__class__.__name__,
! ' '.join (status), id (self))
 except:
! pass
! 
! try:
! ar = repr (self.addr)
! except AttributeError:
! ar = 'no self.addr!'
 
! return '<__repr__() failed for %s instance at %x (addr=%s)>' % \
! (self.__class__.__name__, id (self), ar)
 
 def add_channel (self, map=None):
***************
*** 300,303 ****
--- 304,308 ----
 def connect (self, address):
 self.connected = 0
+ # XXX why not use connect_ex?
 try:
 self.socket.connect (address)

AltStyle によって変換されたページ (->オリジナル) /