Update of /cvsroot/wpdev/xmlscripts/python-lib
In directory sc8-pr-cvs1:/tmp/cvs-serv5168
Modified Files:
aifc.py anydbm.py asynchat.py asyncore.py atexit.py
BaseHTTPServer.py Bastion.py bdb.py calendar.py cgi.py
CGIHTTPServer.py cgitb.py chunk.py cmd.py code.py codecs.py
codeop.py compileall.py ConfigParser.py Cookie.py copy.py
copy_reg.py dbhash.py difflib.py dircache.py dis.py doctest.py
dumbdbm.py filecmp.py fileinput.py fnmatch.py formatter.py
ftplib.py getopt.py getpass.py gettext.py gopherlib.py gzip.py
hmac.py htmlentitydefs.py htmllib.py HTMLParser.py httplib.py
ihooks.py imaplib.py imputil.py inspect.py keyword.py
linecache.py locale.py macpath.py mailbox.py mailcap.py
markupbase.py mhlib.py mimetools.py mimetypes.py mimify.py
multifile.py mutex.py netrc.py nntplib.py ntpath.py os.py
pdb.py pickle.py pipes.py popen2.py poplib.py posixpath.py
pprint.py pre.py profile.py pstats.py pty.py py_compile.py
pyclbr.py pydoc.py Queue.py quopri.py random.py re.py
regsub.py repr.py rexec.py rfc822.py rlcompleter.py
robotparser.py sched.py sgmllib.py shelve.py shlex.py
shutil.py SimpleHTTPServer.py SimpleXMLRPCServer.py site.py
smtpd.py smtplib.py socket.py SocketServer.py sre.py
sre_compile.py sre_constants.py sre_parse.py statcache.py
string.py StringIO.py symbol.py symtable.py tabnanny.py
telnetlib.py tempfile.py threading.py toaiff.py token.py
tokenize.py traceback.py types.py unittest.py urllib.py
urllib2.py urlparse.py user.py UserDict.py UserList.py
UserString.py uu.py warnings.py weakref.py webbrowser.py
whichdb.py xdrlib.py xmllib.py xmlrpclib.py zipfile.py
Log Message:
Updated to Python 2.3.2
Index: aifc.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/python-lib/aifc.py,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** aifc.py 1 Jul 2002 01:55:58 -0000 1.1.1.1
--- aifc.py 10 Nov 2003 12:44:15 -0000 1.2
***************
*** 143,147 ****
pass
! _AIFC_version = 0xA2805140 # Version 1 of AIFF-C
_skiplist = 'COMT', 'INST', 'MIDI', 'AESD', \
--- 143,147 ----
pass
! _AIFC_version = 0xA2805140L # Version 1 of AIFF-C
_skiplist = 'COMT', 'INST', 'MIDI', 'AESD', \
***************
*** 179,183 ****
def _read_float(f): # 10 bytes
- import math
expon = _read_short(f) # 2 bytes
sign = 1
--- 179,182 ----
***************
*** 311,315 ****
self._ssnd_seek_needed = 0
elif chunkname == 'FVER':
! self._version = _read_long(chunk)
elif chunkname == 'MARK':
self._readmark(chunk)
--- 310,314 ----
self._ssnd_seek_needed = 0
elif chunkname == 'FVER':
! self._version = _read_ulong(chunk)
elif chunkname == 'MARK':
self._readmark(chunk)
***************
*** 747,752 ****
def _comp_data(self, data):
import cl
! dum = self._comp.SetParam(cl.FRAME_BUFFER_SIZE, len(data))
! dum = self._comp.SetParam(cl.COMPRESSED_BUFFER_SIZE, len(data))
return self._comp.Compress(self._nframes, data)
--- 746,751 ----
def _comp_data(self, data):
import cl
! dummy = self._comp.SetParam(cl.FRAME_BUFFER_SIZE, len(data))
! dummy = self._comp.SetParam(cl.COMPRESSED_BUFFER_SIZE, len(data))
return self._comp.Compress(self._nframes, data)
***************
*** 785,789 ****
def _init_compression(self):
if self._comptype == 'G722':
- import audioop
self._convert = self._lin2adpcm
return
--- 784,787 ----
Index: anydbm.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/python-lib/anydbm.py,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** anydbm.py 1 Jul 2002 01:55:58 -0000 1.1.1.1
--- anydbm.py 10 Nov 2003 12:44:15 -0000 1.2
***************
*** 26,30 ****
del d[key] # delete data stored at key (raises KeyError
# if no such key)
! flag = d.has_key(key) # true if the key exists
list = d.keys() # return a list of all existing keys (slow!)
--- 26,30 ----
del d[key] # delete data stored at key (raises KeyError
# if no such key)
! flag = key in d # true if the key exists
list = d.keys() # return a list of all existing keys (slow!)
***************
*** 43,51 ****
"""
! try:
! class error(Exception):
! pass
! except (NameError, TypeError):
! error = "anydbm.error"
_names = ['dbhash', 'gdbm', 'dbm', 'dumbdbm']
--- 43,48 ----
"""
! class error(Exception):
! pass
_names = ['dbhash', 'gdbm', 'dbm', 'dumbdbm']
Index: asynchat.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/python-lib/asynchat.py,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** asynchat.py 1 Jul 2002 01:55:58 -0000 1.1.1.1
--- asynchat.py 10 Nov 2003 12:44:15 -0000 1.2
***************
*** 65,68 ****
--- 65,74 ----
asyncore.dispatcher.__init__ (self, conn)
+ def collect_incoming_data(self, data):
+ raise NotImplementedError, "must be implemented in subclass"
+
+ def found_terminator(self):
+ raise NotImplementedError, "must be implemented in subclass"
+
def set_terminator (self, term):
"Set the input delimiter. Can be a fixed string of any length, an integer, or None"
***************
*** 95,103 ****
lb = len(self.ac_in_buffer)
terminator = self.get_terminator()
! if terminator is None:
# no terminator, collect it all
self.collect_incoming_data (self.ac_in_buffer)
self.ac_in_buffer = ''
! elif type(terminator) == type(0):
# numeric terminator
n = terminator
--- 101,109 ----
lb = len(self.ac_in_buffer)
terminator = self.get_terminator()
! if terminator is None or terminator == '':
# no terminator, collect it all
self.collect_incoming_data (self.ac_in_buffer)
self.ac_in_buffer = ''
! elif isinstance(terminator, int):
# numeric terminator
n = terminator
***************
*** 178,182 ****
# of the first producer in the queue
def refill_buffer (self):
- _string_type = type('')
while 1:
if len(self.producer_fifo):
--- 184,187 ----
***************
*** 189,193 ****
self.close()
return
! elif type(p) is _string_type:
self.producer_fifo.pop()
self.ac_out_buffer = self.ac_out_buffer + p
--- 194,198 ----
self.close()
return
! elif isinstance(p, str):
self.producer_fifo.pop()
self.ac_out_buffer = self.ac_out_buffer + p
***************
*** 264,270 ****
def pop (self):
if self.list:
! result = self.list[0]
! del self.list[0]
! return (1, result)
else:
return (0, None)
--- 269,273 ----
def pop (self):
if self.list:
! return (1, self.list.pop(0))
else:
return (0, None)
***************
*** 275,293 ****
# for example:
# f_p_a_e ("qwerty\r", "\r\n") => 1
- # f_p_a_e ("qwerty\r\n", "\r\n") => 2
# f_p_a_e ("qwertydkjf", "\r\n") => 0
# this could maybe be made faster with a computed regex?
# [answer: no; circa Python-2.0, Jan 2001]
! # python: 18307/s
# re: 12820/s
# regex: 14035/s
def find_prefix_at_end (haystack, needle):
! nl = len(needle)
! result = 0
! for i in range (1,nl):
! if haystack[-(nl-i):] == needle[:(nl-i)]:
! result = nl-i
! break
! return result
--- 278,294 ----
# for example:
# f_p_a_e ("qwerty\r", "\r\n") => 1
# f_p_a_e ("qwertydkjf", "\r\n") => 0
+ # f_p_a_e ("qwerty\r\n", "\r\n") => <undefined>
# this could maybe be made faster with a computed regex?
# [answer: no; circa Python-2.0, Jan 2001]
! # new python: 28961/s
! # old python: 18307/s
# re: 12820/s
# regex: 14035/s
def find_prefix_at_end (haystack, needle):
! l = len(needle) - 1
! while l and not haystack.endswith(needle[:l]):
! l -= 1
! return l
Index: asyncore.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/python-lib/asyncore.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** asyncore.py 21 Dec 2002 14:52:54 -0000 1.2
--- asyncore.py 10 Nov 2003 12:44:15 -0000 1.3
***************
*** 62,71 ****
socket_map = {}
! class ExitNow (exceptions.Exception):
pass
! DEBUG = 0
! def poll (timeout=0.0, map=None):
if map is None:
map = socket_map
--- 62,96 ----
socket_map = {}
! class ExitNow(exceptions.Exception):
pass
! def read(obj):
! try:
! obj.handle_read_event()
! except ExitNow:
! raise
! except:
! obj.handle_error()
! def write(obj):
! try:
! obj.handle_write_event()
! except ExitNow:
! raise
! except:
! obj.handle_error()
!
! def readwrite(obj, flags):
! try:
! if flags & select.POLLIN:
! obj.handle_read_event()
! if flags & select.POLLOUT:
! obj.handle_write_event()
! except ExitNow:
! raise
! except:
! obj.handle_error()
!
! def poll(timeout=0.0, map=None):
if map is None:
map = socket_map
***************
*** 74,123 ****
for fd, obj in map.items():
if obj.readable():
! r.append (fd)
if obj.writable():
! w.append (fd)
if [] == r == w == e:
time.sleep(timeout)
else:
try:
! r,w,e = select.select (r,w,e, timeout)
except select.error, err:
if err[0] != EINTR:
raise
! r = []; w = []; e = []
!
! if DEBUG:
! print r,w,e
for fd in r:
! try:
! obj = map[fd]
! except KeyError:
continue
!
! try:
! obj.handle_read_event()
! except ExitNow:
! raise ExitNow
! except:
! obj.handle_error()
for fd in w:
! try:
! obj = map[fd]
! except KeyError:
continue
! try:
! obj.handle_write_event()
! except ExitNow:
! raise ExitNow
! except:
! obj.handle_error()
!
! def poll2 (timeout=0.0, map=None):
import poll
if map is None:
! map=socket_map
if timeout is not None:
# timeout is in milliseconds
--- 99,132 ----
for fd, obj in map.items():
if obj.readable():
! r.append(fd)
if obj.writable():
! w.append(fd)
if [] == r == w == e:
time.sleep(timeout)
else:
try:
! r, w, e = select.select(r, w, e, timeout)
except select.error, err:
if err[0] != EINTR:
raise
! else:
! return
for fd in r:
! obj = map.get(fd)
! if obj is None:
continue
! read(obj)
for fd in w:
! obj = map.get(fd)
! if obj is None:
continue
+ write(obj)
! def poll2(timeout=0.0, map=None):
import poll
if map is None:
! map = socket_map
if timeout is not None:
# timeout is in milliseconds
***************
*** 132,157 ****
flags = flags | poll.POLLOUT
if flags:
! l.append ((fd, flags))
! r = poll.poll (l, timeout)
for fd, flags in r:
! try:
! obj = map[fd]
! except KeyError:
continue
! try:
! if (flags & poll.POLLIN):
! obj.handle_read_event()
! if (flags & poll.POLLOUT):
! obj.handle_write_event()
! except ExitNow:
! raise ExitNow
! except:
! obj.handle_error()
!
! def poll3 (timeout=0.0, map=None):
# Use the poll() support added to the select module in Python 2.0
if map is None:
! map=socket_map
if timeout is not None:
# timeout is in milliseconds
--- 141,156 ----
flags = flags | poll.POLLOUT
if flags:
! l.append((fd, flags))
! r = poll.poll(l, timeout)
for fd, flags in r:
! obj = map.get(fd)
! if obj is None:
continue
+ readwrite(obj, flags)
! def poll3(timeout=0.0, map=None):
# Use the poll() support added to the select module in Python 2.0
if map is None:
! map = socket_map
if timeout is not None:
# timeout is in milliseconds
***************
*** 168,172 ****
pollster.register(fd, flags)
try:
! r = pollster.poll (timeout)
except select.error, err:
if err[0] != EINTR:
--- 167,171 ----
pollster.register(fd, flags)
try:
! r = pollster.poll(timeout)
except select.error, err:
if err[0] != EINTR:
***************
*** 174,199 ****
r = []
for fd, flags in r:
! try:
! obj = map[fd]
! except KeyError:
continue
! try:
! if (flags & select.POLLIN):
! obj.handle_read_event()
! if (flags & select.POLLOUT):
! obj.handle_write_event()
! except ExitNow:
! raise ExitNow
! except:
! obj.handle_error()
!
! def loop (timeout=30.0, use_poll=0, map=None):
!
if map is None:
! map=socket_map
if use_poll:
! if hasattr (select, 'poll'):
poll_fun = poll3
else:
--- 173,187 ----
r = []
for fd, flags in r:
! obj = map.get(fd)
! if obj is None:
continue
+ readwrite(obj, flags)
! def loop(timeout=30.0, use_poll=0, map=None):
if map is None:
! map = socket_map
if use_poll:
! if hasattr(select, 'poll'):
poll_fun = poll3
else:
***************
*** 203,209 ****
while map:
! poll_fun (timeout, map)
class dispatcher:
debug = 0
connected = 0
--- 191,198 ----
while map:
! poll_fun(timeout, map)
class dispatcher:
+
debug = 0
connected = 0
***************
*** 212,220 ****
addr = None
! def __init__ (self, sock=None, map=None):
if sock:
! self.set_socket (sock, map)
# I think it should inherit this anyway
! self.socket.setblocking (0)
self.connected = 1
# XXX Does the constructor require that the socket passed
--- 201,209 ----
addr = None
! def __init__(self, sock=None, map=None):
if sock:
! self.set_socket(sock, map)
# I think it should inherit this anyway
! self.socket.setblocking(0)
self.connected = 1
# XXX Does the constructor require that the socket passed
***************
*** 228,278 ****
self.socket = None
! def __repr__ (self):
status = [self.__class__.__module__+"."+self.__class__.__name__]
if self.accepting and self.addr:
! status.append ('listening')
elif self.connected:
! status.append ('connected')
if self.addr is not None:
try:
! status.append ('%s:%d' % self.addr)
except TypeError:
! status.append (repr(self.addr))
! return '<%s at %#x>' % (' '.join (status), id (self))
! def add_channel (self, map=None):
! #self.log_info ('adding channel %s' % self)
if map is None:
! map=socket_map
! map [self._fileno] = self
! def del_channel (self, map=None):
fd = self._fileno
if map is None:
! map=socket_map
! if map.has_key (fd):
! #self.log_info ('closing channel %d:%s' % (fd, self))
! del map [fd]
! def create_socket (self, family, type):
self.family_and_type = family, type
! self.socket = socket.socket (family, type)
self.socket.setblocking(0)
self._fileno = self.socket.fileno()
self.add_channel()
! def set_socket (self, sock, map=None):
self.socket = sock
## self.__dict__['socket'] = sock
self._fileno = sock.fileno()
! self.add_channel (map)
! def set_reuse_addr (self):
# try to re-use a server port if possible
try:
! self.socket.setsockopt (
socket.SOL_SOCKET, socket.SO_REUSEADDR,
! self.socket.getsockopt (socket.SOL_SOCKET,
! socket.SO_REUSEADDR) | 1
)
except socket.error:
--- 217,267 ----
self.socket = None
! def __repr__(self):
status = [self.__class__.__module__+"."+self.__class__.__name__]
if self.accepting and self.addr:
! status.append('listening')
elif self.connected:
! status.append('connected')
if self.addr is not None:
try:
! status.append('%s:%d' % self.addr)
except TypeError:
! status.append(repr(self.addr))
! return '<%s at %#x>' % (' '.join(status), id(self))
! def add_channel(self, map=None):
! #self.log_info('adding channel %s' % self)
if map is None:
! map = socket_map
! map[self._fileno] = self
! def del_channel(self, map=None):
fd = self._fileno
if map is None:
! map = socket_map
! if map.has_key(fd):
! #self.log_info('closing channel %d:%s' % (fd, self))
! del map[fd]
! def create_socket(self, family, type):
self.family_and_type = family, type
! self.socket = socket.socket(family, type)
self.socket.setblocking(0)
self._fileno = self.socket.fileno()
self.add_channel()
! def set_socket(self, sock, map=None):
self.socket = sock
## self.__dict__['socket'] = sock
self._fileno = sock.fileno()
! self.add_channel(map)
! def set_reuse_addr(self):
# try to re-use a server port if possible
try:
! self.socket.setsockopt(
socket.SOL_SOCKET, socket.SO_REUSEADDR,
! self.socket.getsockopt(socket.SOL_SOCKET,
! socket.SO_REUSEADDR) | 1
)
except socket.error:
***************
*** 285,299 ****
# ==================================================
! def readable (self):
! return 1
if os.name == 'mac':
# The macintosh will select a listening socket for
# write if you let it. What might this mean?
! def writable (self):
return not self.accepting
else:
! def writable (self):
! return 1
# ==================================================
--- 274,288 ----
# ==================================================
! def readable(self):
! return True
if os.name == 'mac':
# The macintosh will select a listening socket for
# write if you let it. What might this mean?
! def writable(self):
return not self.accepting
else:
! def writable(self):
! return True
# ==================================================
***************
*** 301,317 ****
# ==================================================
! def listen (self, num):
self.accepting = 1
if os.name == 'nt' and num > 5:
num = 1
! return self.socket.listen (num)
! def bind (self, addr):
self.addr = addr
! return self.socket.bind (addr)
! def connect (self, address):
self.connected = 0
err = self.socket.connect_ex(address)
if err in (EINPROGRESS, EALREADY, EWOULDBLOCK):
return
--- 290,307 ----
# ==================================================
! def listen(self, num):
self.accepting = 1
if os.name == 'nt' and num > 5:
num = 1
! return self.socket.listen(num)
! def bind(self, addr):
self.addr = addr
! return self.socket.bind(addr)
! def connect(self, address):
self.connected = 0
err = self.socket.connect_ex(address)
+ # XXX Should interpret Winsock return values
if err in (EINPROGRESS, EALREADY, EWOULDBLOCK):
return
***************
*** 323,327 ****
raise socket.error, err
! def accept (self):
try:
conn, addr = self.socket.accept()
--- 313,318 ----
raise socket.error, err
! def accept(self):
! # XXX can return either an address pair or None
try:
conn, addr = self.socket.accept()
***************
*** 333,339 ****
raise socket.error, why
! def send (self, data):
try:
! result = self.socket.send (data)
return result
except socket.error, why:
--- 324,330 ----
raise socket.error, why
! def send(self, data):
try:
! result = self.socket.send(data)
return result
except socket.error, why:
***************
*** 344,350 ****
return 0
! def recv (self, buffer_size):
try:
! data = self.socket.recv (buffer_size)
if not data:
# a closed connection is indicated by signaling
--- 335,341 ----
return 0
! def recv(self, buffer_size):
try:
! data = self.socket.recv(buffer_size)
if not data:
# a closed connection is indicated by signaling
***************
*** 362,366 ****
raise socket.error, why
! def close (self):
self.del_channel()
self.socket.close()
--- 353,357 ----
raise socket.error, why
! def close(self):
self.del_channel()
self.socket.close()
***************
*** 368,386 ****
# cheap inheritance, used to pass all other attribute
# references to the underlying socket object.
! def __getattr__ (self, attr):
! return getattr (self.socket, attr)
! # log and log_info maybe overriden to provide more sophisitcated
# logging and warning methods. In general, log is for 'hit' logging
# and 'log_info' is for informational, warning and error logging.
! def log (self, message):
! sys.stderr.write ('log: %s\n' % str(message))
! def log_info (self, message, type='info'):
if __debug__ or type != 'info':
print '%s: %s' % (type, message)
! def handle_read_event (self):
if self.accepting:
# for an accepting socket, getting a read implies
--- 359,377 ----
# cheap inheritance, used to pass all other attribute
# references to the underlying socket object.
! def __getattr__(self, attr):
! return getattr(self.socket, attr)
! # log and log_info may be overridden to provide more sophisticated
# logging and warning methods. In general, log is for 'hit' logging
# and 'log_info' is for informational, warning and error logging.
! def log(self, message):
! sys.stderr.write('log: %s\n' % str(message))
! def log_info(self, message, type='info'):
if __debug__ or type != 'info':
print '%s: %s' % (type, message)
! def handle_read_event(self):
if self.accepting:
# for an accepting socket, getting a read implies
***************
*** 396,400 ****
self.handle_read()
! def handle_write_event (self):
# getting a write implies that we are connected
if not self.connected:
--- 387,391 ----
self.handle_read()
! def handle_write_event(self):
# getting a write implies that we are connected
if not self.connected:
***************
*** 403,419 ****
self.handle_write()
! def handle_expt_event (self):
self.handle_expt()
! def handle_error (self):
nil, t, v, tbinfo = compact_traceback()
# sometimes a user repr method will crash.
try:
! self_repr = repr (self)
except:
! self_repr = '<__repr__ (self) failed for object at %0x>' % id(self)
! self.log_info (
'uncaptured python exception, closing channel %s (%s:%s %s)' % (
self_repr,
--- 394,410 ----
self.handle_write()
! def handle_expt_event(self):
self.handle_expt()
! def handle_error(self):
nil, t, v, tbinfo = compact_traceback()
# sometimes a user repr method will crash.
try:
! self_repr = repr(self)
except:
! self_repr = '<__repr__(self) failed for object at %0x>' % id(self)
! self.log_info(
'uncaptured python exception, closing channel %s (%s:%s %s)' % (
self_repr,
***************
*** 426,446 ****
self.close()
! def handle_expt (self):
! self.log_info ('unhandled exception', 'warning')
! def handle_read (self):
! self.log_info ('unhandled read event', 'warning')
! def handle_write (self):
! self.log_info ('unhandled write event', 'warning')
! def handle_connect (self):
! self.log_info ('unhandled connect event', 'warning')
! def handle_accept (self):
! self.log_info ('unhandled accept event', 'warning')
! def handle_close (self):
! self.log_info ('unhandled close event', 'warning')
self.close()
--- 417,437 ----
self.close()
! def handle_expt(self):
! self.log_info('unhandled exception', 'warning')
! def handle_read(self):
! self.log_info('unhandled read event', 'warning')
! def handle_write(self):
! self.log_info('unhandled write event', 'warning')
! def handle_connect(self):
! self.log_info('unhandled connect event', 'warning')
! def handle_accept(self):
! self.log_info('unhandled accept event', 'warning')
! def handle_close(self):
! self.log_info('unhandled close event', 'warning')
self.close()
***************
*** 450,472 ****
# ---------------------------------------------------------------------------
! class dispatcher_with_send (dispatcher):
! def __init__ (self, sock=None):
! dispatcher.__init__ (self, sock)
self.out_buffer = ''
! def initiate_send (self):
num_sent = 0
! num_sent = dispatcher.send (self, self.out_buffer[:512])
self.out_buffer = self.out_buffer[num_sent:]
! def handle_write (self):
self.initiate_send()
! def writable (self):
return (not self.connected) or len(self.out_buffer)
! def send (self, data):
if self.debug:
! self.log_info ('sending %s' % repr(data))
self.out_buffer = self.out_buffer + data
self.initiate_send()
--- 441,464 ----
# ---------------------------------------------------------------------------
! class dispatcher_with_send(dispatcher):
!
! def __init__(self, sock=None):
! dispatcher.__init__(self, sock)
self.out_buffer = ''
! def initiate_send(self):
num_sent = 0
! num_sent = dispatcher.send(self, self.out_buffer[:512])
self.out_buffer = self.out_buffer[num_sent:]
! def handle_write(self):
self.initiate_send()
! def writable(self):
return (not self.connected) or len(self.out_buffer)
! def send(self, data):
if self.debug:
! self.log_info('sending %s' % repr(data))
self.out_buffer = self.out_buffer + data
self.initiate_send()
***************
*** 476,484 ****
# ---------------------------------------------------------------------------
! def compact_traceback ():
! t,v,tb = sys.exc_info()
tbinfo = []
! while 1:
! tbinfo.append ((
tb.tb_frame.f_code.co_filename,
tb.tb_frame.f_code.co_name,
--- 468,477 ----
# ---------------------------------------------------------------------------
! def compact_traceback():
! t, v, tb = sys.exc_info()
tbinfo = []
! assert tb # Must have a traceback
! while tb:
! tbinfo.append((
tb.tb_frame.f_code.co_filename,
tb.tb_frame.f_code.co_name,
***************
*** 486,491 ****
))
tb = tb.tb_next
- if not tb:
- break
# just to be safe
--- 479,482 ----
***************
*** 493,502 ****
file, function, line = tbinfo[-1]
! info = '[' + '] ['.join(map(lambda x: '|'.join(x), tbinfo)) + ']'
return (file, function, line), t, v, info
! def close_all (map=None):
if map is None:
! map=socket_map
for x in map.values():
x.socket.close()
--- 484,493 ----
file, function, line = tbinfo[-1]
! info = ' '.join(['[%s|%s|%s]' % x for x in tbinfo])
return (file, function, line), t, v, info
! def close_all(map=None):
if map is None:
! map = socket_map
for x in map.values():
x.socket.close()
***************
*** 522,555 ****
# here we override just enough to make a file
# look like a socket for the purposes of asyncore.
! def __init__ (self, fd):
self.fd = fd
! def recv (self, *args):
! return apply (os.read, (self.fd,)+args)
! def send (self, *args):
! return apply (os.write, (self.fd,)+args)
read = recv
write = send
! def close (self):
! return os.close (self.fd)
! def fileno (self):
return self.fd
! class file_dispatcher (dispatcher):
! def __init__ (self, fd):
! dispatcher.__init__ (self)
self.connected = 1
# set it to non-blocking mode
! flags = fcntl.fcntl (fd, fcntl.F_GETFL, 0)
flags = flags | os.O_NONBLOCK
! fcntl.fcntl (fd, fcntl.F_SETFL, flags)
! self.set_file (fd)
! def set_file (self, fd):
self._fileno = fd
! self.socket = file_wrapper (fd)
self.add_channel()
--- 513,548 ----
# here we override just enough to make a file
# look like a socket for the purposes of asyncore.
!
! def __init__(self, fd):
self.fd = fd
! def recv(self, *args):
! return os.read(self.fd, *args)
! def send(self, *args):
! return os.write(self.fd, *args)
read = recv
write = send
! def close(self):
! return os.close(self.fd)
! def fileno(self):
return self.fd
! class file_dispatcher(dispatcher):
!
! def __init__(self, fd):
! dispatcher.__init__(self)
self.connected = 1
# set it to non-blocking mode
! flags = fcntl.fcntl(fd, fcntl.F_GETFL, 0)
flags = flags | os.O_NONBLOCK
! fcntl.fcntl(fd, fcntl.F_SETFL, flags)
! self.set_file(fd)
! def set_file(self, fd):
self._fileno = fd
! self.socket = file_wrapper(fd)
self.add_channel()
Index: atexit.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/python-lib/atexit.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** atexit.py 21 Dec 2002 14:52:54 -0000 1.2
--- atexit.py 10 Nov 2003 12:44:15 -0000 1.3
***************
*** 18,22 ****
while _exithandlers:
func, targs, kargs = _exithandlers.pop()
! apply(func, targs, kargs)
def register(func, *targs, **kargs):
--- 18,22 ----
while _exithandlers:
func, targs, kargs = _exithandlers.pop()
! func(*targs, **kargs)
def register(func, *targs, **kargs):
Index: BaseHTTPServer.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/python-lib/BaseHTTPServer.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** BaseHTTPServer.py 21 Dec 2002 14:52:54 -0000 1.2
--- BaseHTTPServer.py 10 Nov 2003 12:44:15 -0000 1.3
***************
*** 3,7 ****
Note: the class in this module doesn't implement any HTTP request; see
SimpleHTTPServer for simple implementations of GET, HEAD and POST
! (including CGI scripts).
Contents:
--- 3,8 ----
Note: the class in this module doesn't implement any HTTP request; see
SimpleHTTPServer for simple implementations of GET, HEAD and POST
! (including CGI scripts). It does, however, optionally implement HTTP/1.1
! persistent connections, as of version 0.3.
Contents:
***************
*** 12,21 ****
XXX To do:
- - send server version
- log requests even later (to capture byte count)
- log user-agent header and other interesting goodies
- send error log to separate file
- - are request names really case sensitive?
-
"""
--- 13,19 ----
***************
*** 29,33 ****
#
# URL: http://www.ics.uci.edu/pub/ietf/http/draft-ietf-http-v10-spec-00.txt
!
# Log files
--- 27,39 ----
#
# URL: http://www.ics.uci.edu/pub/ietf/http/draft-ietf-http-v10-spec-00.txt
! #
! # and
! #
! # Network Working Group R. Fielding
! # Request for Comments: 2616 et al
! # Obsoletes: 2068 June 1999
! # Category: Standards Track
! #
! # URL: http://www.faqs.org/rfcs/rfc2616.html
# Log files
***************
*** 61,66 ****
# at the time the request was made!)
!
! __version__ = "0.2"
__all__ = ["HTTPServer", "BaseHTTPRequestHandler"]
--- 67,71 ----
# at the time the request was made!)
! __version__ = "0.3"
__all__ = ["HTTPServer", "BaseHTTPRequestHandler"]
***************
*** 71,74 ****
--- 76,80 ----
import mimetools
import SocketServer
+ import cStringIO
# Default error message
***************
*** 93,97 ****
"""Override server_bind to store the server name."""
SocketServer.TCPServer.server_bind(self)
! host, port = self.socket.getsockname()
self.server_name = socket.getfqdn(host)
self.server_port = port
--- 99,103 ----
"""Override server_bind to store the server name."""
SocketServer.TCPServer.server_bind(self)
! host, port = self.socket.getsockname()[:2]
self.server_name = socket.getfqdn(host)
self.server_port = port
***************
*** 123,135 ****
where <command> is a (case-sensitive) keyword such as GET or POST,
<path> is a string containing path information for the request,
! and <version> should be the string "HTTP/1.0". <path> is encoded
! using the URL encoding scheme (using %xx to signify the ASCII
! character with hex code xx).
! The protocol is vague about whether lines are separated by LF
! characters or by CRLF pairs -- for compatibility with the widest
! range of clients, both should be accepted. Similarly, whitespace
! in the request line should be treated sensibly (allowing multiple
! spaces between components and allowing trailing whitespace).
Similarly, for output, lines ought to be separated by CRLF pairs
--- 129,141 ----
where <command> is a (case-sensitive) keyword such as GET or POST,
<path> is a string containing path information for the request,
! and <version> should be the string "HTTP/1.0" or "HTTP/1.1".
! <path> is encoded using the URL encoding scheme (using %xx to signify
! the ASCII character with hex code xx).
! The specification specifies that lines are separated by CRLF but
! for compatibility with the widest range of clients recommends
! servers also handle LF. Similarly, whitespace in the request line
! is treated sensibly (allowing multiple spaces between components
! and allowing trailing whitespace).
Similarly, for output, lines ought to be separated by CRLF pairs
***************
*** 144,148 ****
the reply consists of just the data.
! The reply form of the HTTP 1.0 protocol again has three parts:
1. One line giving the response code
--- 150,154 ----
the reply consists of just the data.
! The reply form of the HTTP 1.x protocol again has three parts:
1. One line giving the response code
***************
*** 156,160 ****
<version> <responsecode> <responsestring>
! where <version> is the protocol version (always "HTTP/1.0"),
<responsecode> is a 3-digit response code indicating success or
failure of the request, and <responsestring> is an optional
--- 162,166 ----
<version> <responsecode> <responsestring>
! where <version> is the protocol version ("HTTP/1.0" or "HTTP/1.1"),
<responsecode> is a 3-digit response code indicating success or
failure of the request, and <responsestring> is an optional
***************
*** 213,225 ****
"""Parse a request (internal).
! The request should be stored in self.raw_request; the results
are in self.command, self.path, self.request_version and
self.headers.
! Return value is 1 for success, 0 for failure; on failure, an
error is sent back.
"""
self.request_version = version = "HTTP/0.9" # Default
requestline = self.raw_requestline
if requestline[-2:] == '\r\n':
--- 219,233 ----
"""Parse a request (internal).
! The request should be stored in self.raw_requestline; the results
are in self.command, self.path, self.request_version and
self.headers.
! Return True for success, False for failure; on failure, an
error is sent back.
"""
+ self.command = None # set in case of error on the first line
self.request_version = version = "HTTP/0.9" # Default
+ self.close_connection = 1
requestline = self.raw_requestline
if requestline[-2:] == '\r\n':
***************
*** 233,251 ****
if version[:5] != 'HTTP/':
self.send_error(400, "Bad request version (%s)" % `version`)
! return 0
elif len(words) == 2:
[command, path] = words
if command != 'GET':
self.send_error(400,
"Bad HTTP/0.9 request type (%s)" % `command`)
! return 0
else:
self.send_error(400, "Bad request syntax (%s)" % `requestline`)
! return 0
self.command, self.path, self.request_version = command, path, version
- self.headers = self.MessageClass(self.rfile, 0)
- return 1
! def handle(self):
"""Handle a single HTTP request.
--- 241,301 ----
if version[:5] != 'HTTP/':
self.send_error(400, "Bad request version (%s)" % `version`)
! return False
! try:
! base_version_number = version.split('/', 1)[1]
! version_number = base_version_number.split(".")
! # RFC 2145 section 3.1 says there can be only one "." and
! # - major and minor numbers MUST be treated as
! # separate integers;
! # - HTTP/2.4 is a lower version than HTTP/2.13, which in
! # turn is lower than HTTP/12.3;
! # - Leading zeros MUST be ignored by recipients.
! if len(version_number) != 2:
! raise ValueError
! version_number = int(version_number[0]), int(version_number[1])
! except (ValueError, IndexError):
! self.send_error(400, "Bad request version (%s)" % `version`)
! return False
! if version_number >= (1, 1) and self.protocol_version >= "HTTP/1.1":
! self.close_connection = 0
! if version_number >= (2, 0):
! self.send_error(505,
! "Invalid HTTP Version (%s)" % base_version_number)
! return False
elif len(words) == 2:
[command, path] = words
+ self.close_connection = 1
if command != 'GET':
self.send_error(400,
"Bad HTTP/0.9 request type (%s)" % `command`)
! return False
! elif not words:
! return False
else:
self.send_error(400, "Bad request syntax (%s)" % `requestline`)
! return False
self.command, self.path, self.request_version = command, path, version
! # Deal with pipelining
! bytes = ""
! while 1:
! line = self.rfile.readline()
! bytes = bytes + line
! if line == '\r\n' or line == '\n' or line == '':
! break
!
! # Examine the headers and look for a Connection directive
! hfile = cStringIO.StringIO(bytes)
! self.headers = self.MessageClass(hfile)
!
! conntype = self.headers.get('Connection', "")
! if conntype.lower() == 'close':
! self.close_connection = 1
! elif (conntype.lower() == 'keep-alive' and
! self.protocol_version >= "HTTP/1.1"):
! self.close_connection = 0
! return True
!
! def handle_one_request(self):
"""Handle a single HTTP request.
***************
*** 255,260 ****
"""
-
self.raw_requestline = self.rfile.readline()
if not self.parse_request(): # An error code has been sent, just exit
return
--- 305,312 ----
"""
self.raw_requestline = self.rfile.readline()
+ if not self.raw_requestline:
+ self.close_connection = 1
+ return
if not self.parse_request(): # An error code has been sent, just exit
return
***************
*** 266,269 ****
--- 318,329 ----
method()
+ def handle(self):
+ """Handle multiple requests if necessary."""
+ self.close_connection = 1
+
+ self.handle_one_request()
+ while not self.close_connection:
+ self.handle_one_request()
+
def send_error(self, code, message=None):
"""Send and log an error reply.
***************
*** 283,297 ****
except KeyError:
short, long = '???', '???'
! if not message:
message = short
explain = long
self.log_error("code %d, message %s", code, message)
self.send_response(code, message)
self.send_header("Content-Type", "text/html")
self.end_headers()
! self.wfile.write(self.error_message_format %
! {'code': code,
! 'message': message,
! 'explain': explain})
error_message_format = DEFAULT_ERROR_MESSAGE
--- 343,358 ----
except KeyError:
short, long = '???', '???'
! if message is None:
message = short
explain = long
self.log_error("code %d, message %s", code, message)
+ content = (self.error_message_format %
+ {'code': code, 'message': message, 'explain': explain})
self.send_response(code, message)
self.send_header("Content-Type", "text/html")
+ self.send_header('Connection', 'close')
self.end_headers()
! if self.command != 'HEAD' and code >= 200 and code not in (204, 304):
! self.wfile.write(content)
error_message_format = DEFAULT_ERROR_MESSAGE
***************
*** 306,316 ****
self.log_request(code)
if message is None:
! if self.responses.has_key(code):
message = self.responses[code][0]
else:
message = ''
if self.request_version != 'HTTP/0.9':
! self.wfile.write("%s %s %s\r\n" %
! (self.protocol_version, str(code), message))
self.send_header('Server', self.version_string())
self.send_header('Date', self.date_time_string())
--- 367,378 ----
self.log_request(code)
if message is None:
! if code in self.responses:
message = self.responses[code][0]
else:
message = ''
if self.request_version != 'HTTP/0.9':
! self.wfile.write("%s %d %s\r\n" %
! (self.protocol_version, code, message))
! # print (self.protocol_version, code, message)
self.send_header('Server', self.version_string())
self.send_header('Date', self.date_time_string())
***************
*** 321,324 ****
--- 383,392 ----
self.wfile.write("%s: %s\r\n" % (keyword, value))
+ if keyword.lower() == 'connection':
+ if value.lower() == 'close':
+ self.close_connection = 1
+ elif value.lower() == 'keep-alive':
+ self.close_connection = 0
+
def end_headers(self):
"""Send the blank line ending the MIME headers."""
***************
*** 348,352 ****
"""
! apply(self.log_message, args)
def log_message(self, format, *args):
--- 416,420 ----
"""
! self.log_message(*args)
def log_message(self, format, *args):
***************
*** 408,412 ****
"""
! host, port = self.client_address
return socket.getfqdn(host)
--- 476,480 ----
"""
! host, port = self.client_address[:2]
return socket.getfqdn(host)
***************
*** 414,419 ****
# The version of the HTTP protocol we support.
! # Don't override unless you know what you're doing (hint: incoming
! # requests are required to have exactly this version string).
protocol_version = "HTTP/1.0"
--- 482,486 ----
# The version of the HTTP protocol we support.
! # Set this to HTTP/1.1 to enable automatic keepalive
protocol_version = "HTTP/1.0"
***************
*** 425,440 ****
# See http://www.w3.org/hypertext/WWW/Protocols/HTTP/HTRESP.html
responses = {
200: ('OK', 'Request fulfilled, document follows'),
201: ('Created', 'Document created, URL follows'),
202: ('Accepted',
'Request accepted, processing continues off-line'),
! 203: ('Partial information', 'Request fulfilled from cache'),
204: ('No response', 'Request fulfilled, nothing follows'),
! 301: ('Moved', 'Object moved permanently -- see URI list'),
302: ('Found', 'Object moved temporarily -- see URI list'),
! 303: ('Method', 'Object moved -- see Method and URL list'),
304: ('Not modified',
! 'Document has not changed singe given time'),
400: ('Bad request',
--- 492,520 ----
# See http://www.w3.org/hypertext/WWW/Protocols/HTTP/HTRESP.html
responses = {
+ 100: ('Continue', 'Request received, please continue'),
+ 101: ('Switching Protocols',
+ 'Switching to new protocol; obey Upgrade header'),
+
200: ('OK', 'Request fulfilled, document follows'),
201: ('Created', 'Document created, URL follows'),
202: ('Accepted',
'Request accepted, processing continues off-line'),
! 203: ('Non-Authoritative Information', 'Request fulfilled from cache'),
204: ('No response', 'Request fulfilled, nothing follows'),
+ 205: ('Reset Content', 'Clear input form for further input.'),
+ 206: ('Partial Content', 'Partial content follows.'),
! 300: ('Multiple Choices',
! 'Object has several resources -- see URI list'),
! 301: ('Moved Permanently', 'Object moved permanently -- see URI list'),
302: ('Found', 'Object moved temporarily -- see URI list'),
! 303: ('See Other', 'Object moved -- see Method and URL list'),
304: ('Not modified',
! 'Document has not changed since given time'),
! 305: ('Use Proxy',
! 'You must use proxy specified in Location to access this '
! 'resource.'),
! 307: ('Temporary Redirect',
! 'Object moved temporarily -- see URI list'),
400: ('Bad request',
***************
*** 446,464 ****
403: ('Forbidden',
'Request forbidden -- authorization will not help'),
! 404: ('Not found', 'Nothing matches the given URI'),
500: ('Internal error', 'Server got itself in trouble'),
! 501: ('Not implemented',
'Server does not support this operation'),
! 502: ('Service temporarily overloaded',
'The server cannot process the request due to a high load'),
! 503: ('Gateway timeout',
'The gateway server did not receive a timely response'),
!
}
def test(HandlerClass = BaseHTTPRequestHandler,
! ServerClass = HTTPServer):
"""Test the HTTP request handler class.
--- 526,563 ----
403: ('Forbidden',
'Request forbidden -- authorization will not help'),
! 404: ('Not Found', 'Nothing matches the given URI'),
! 405: ('Method Not Allowed',
! 'Specified method is invalid for this server.'),
! 406: ('Not Acceptable', 'URI not available in preferred format.'),
! 407: ('Proxy Authentication Required', 'You must authenticate with '
! 'this proxy before proceeding.'),
! 408: ('Request Time-out', 'Request timed out; try again later.'),
! 409: ('Conflict', 'Request conflict.'),
! 410: ('Gone',
! 'URI no longer exists and has been permanently removed.'),
! 411: ('Length Required', 'Client must specify Content-Length.'),
! 412: ('Precondition Failed', 'Precondition in headers is false.'),
! 413: ('Request Entity Too Large', 'Entity is too large.'),
! 414: ('Request-URI Too Long', 'URI is too long.'),
! 415: ('Unsupported Media Type', 'Entity body in unsupported format.'),
! 416: ('Requested Range Not Satisfiable',
! 'Cannot satisfy request range.'),
! 417: ('Expectation Failed',
! 'Expect condition could not be satisfied.'),
500: ('Internal error', 'Server got itself in trouble'),
! 501: ('Not Implemented',
'Server does not support this operation'),
! 502: ('Bad Gateway', 'Invalid responses from another server/proxy.'),
! 503: ('Service temporarily overloaded',
'The server cannot process the request due to a high load'),
! 504: ('Gateway timeout',
'The gateway server did not receive a timely response'),
! 505: ('HTTP Version not supported', 'Cannot fulfill request.'),
}
def test(HandlerClass = BaseHTTPRequestHandler,
! ServerClass = HTTPServer, protocol="HTTP/1.0"):
"""Test the HTTP request handler class.
***************
*** 474,477 ****
--- 573,577 ----
server_address = ('', port)
+ HandlerClass.protocol_version = protocol
httpd = ServerClass(server_address, HandlerClass)
Index: Bastion.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/python-lib/Bastion.py,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** Bastion.py 1 Jul 2002 01:56:00 -0000 1.1.1.1
--- Bastion.py 10 Nov 2003 12:44:15 -0000 1.2
***************
*** 98,101 ****
--- 98,103 ----
"""
+ raise RuntimeError, "This code is not secure in Python 2.2 and 2.3"
+
# Note: we define *two* ad-hoc functions here, get1 and get2.
# Both are intended to be called in the same way: get(name).
Index: bdb.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/python-lib/bdb.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** bdb.py 21 Dec 2002 14:52:54 -0000 1.2
--- bdb.py 10 Nov 2003 12:44:15 -0000 1.3
***************
*** 7,11 ****
__all__ = ["BdbQuit","Bdb","Breakpoint"]
! BdbQuit = 'bdb.BdbQuit' # Exception to give up completely
--- 7,12 ----
__all__ = ["BdbQuit","Bdb","Breakpoint"]
! class BdbQuit(Exception):
! """Exception to give up completely"""
***************
*** 94,111 ****
# (CT) the former test for None is therefore removed from here.
if frame is self.stopframe:
! return 1
while frame is not None and frame is not self.stopframe:
if frame is self.botframe:
! return 1
frame = frame.f_back
! return 0
def break_here(self, frame):
filename = self.canonic(frame.f_code.co_filename)
! if not self.breaks.has_key(filename):
! return 0
lineno = frame.f_lineno
if not lineno in self.breaks[filename]:
! return 0
# flag says ok to delete temp. bp
(bp, flag) = effective(filename, lineno, frame)
--- 95,112 ----
# (CT) the former test for None is therefore removed from here.
if frame is self.stopframe:
! return True
while frame is not None and frame is not self.stopframe:
if frame is self.botframe:
! return True
frame = frame.f_back
! return False
def break_here(self, frame):
filename = self.canonic(frame.f_code.co_filename)
! if not filename in self.breaks:
! return False
lineno = frame.f_lineno
if not lineno in self.breaks[filename]:
! return False
# flag says ok to delete temp. bp
(bp, flag) = effective(filename, lineno, frame)
***************
*** 114,120 ****
if (flag and bp.temporary):
self.do_clear(str(bp.number))
! return 1
else:
! return 0
def do_clear(self, arg):
--- 115,121 ----
if (flag and bp.temporary):
self.do_clear(str(bp.number))
! return True
else:
! return False
def do_clear(self, arg):
***************
*** 211,215 ****
return 'Line %s:%d does not exist' % (filename,
lineno)
! if not self.breaks.has_key(filename):
self.breaks[filename] = []
list = self.breaks[filename]
--- 212,216 ----
return 'Line %s:%d does not exist' % (filename,
lineno)
! if not filename in self.breaks:
self.breaks[filename] = []
list = self.breaks[filename]
***************
*** 220,224 ****
def clear_break(self, filename, lineno):
filename = self.canonic(filename)
! if not self.breaks.has_key(filename):
return 'There are no breakpoints in %s' % filename
if lineno not in self.breaks[filename]:
--- 221,225 ----
def clear_break(self, filename, lineno):
filename = self.canonic(filename)
! if not filename in self.breaks:
return 'There are no breakpoints in %s' % filename
if lineno not in self.breaks[filename]:
***************
*** 249,253 ****
def clear_all_file_breaks(self, filename):
filename = self.canonic(filename)
! if not self.breaks.has_key(filename):
return 'There are no breakpoints in %s' % filename
for line in self.breaks[filename]:
--- 250,254 ----
def clear_all_file_breaks(self, filename):
filename = self.canonic(filename)
! if not filename in self.breaks:
return 'There are no breakpoints in %s' % filename
for line in self.breaks[filename]:
***************
*** 267,276 ****
def get_break(self, filename, lineno):
filename = self.canonic(filename)
! return self.breaks.has_key(filename) and \
lineno in self.breaks[filename]
def get_breaks(self, filename, lineno):
filename = self.canonic(filename)
! return self.breaks.has_key(filename) and \
lineno in self.breaks[filename] and \
Breakpoint.bplist[filename, lineno] or []
--- 268,277 ----
def get_break(self, filename, lineno):
filename = self.canonic(filename)
! return filename in self.breaks and \
lineno in self.breaks[filename]
def get_breaks(self, filename, lineno):
filename = self.canonic(filename)
! return filename in self.breaks and \
lineno in self.breaks[filename] and \
Breakpoint.bplist[filename, lineno] or []
***************
*** 278,282 ****
def get_file_breaks(self, filename):
filename = self.canonic(filename)
! if self.breaks.has_key(filename):
return self.breaks[filename]
else:
--- 279,283 ----
def get_file_breaks(self, filename):
filename = self.canonic(filename)
! if filename in self.breaks:
return self.breaks[filename]
else:
***************
*** 316,320 ****
else:
s = s + "<lambda>"
! if frame.f_locals.has_key('__args__'):
args = frame.f_locals['__args__']
else:
--- 317,321 ----
else:
s = s + "<lambda>"
! if '__args__' in frame.f_locals:
args = frame.f_locals['__args__']
else:
***************
*** 324,328 ****
else:
s = s + '()'
! if frame.f_locals.has_key('__return__'):
rv = frame.f_locals['__return__']
s = s + '->'
--- 325,329 ----
else:
s = s + '()'
! if '__return__' in frame.f_locals:
rv = frame.f_locals['__return__']
s = s + '->'
***************
*** 385,389 ****
try:
try:
! res = apply(func, args)
except BdbQuit:
pass
--- 386,390 ----
try:
try:
! res = func(*args)
except BdbQuit:
pass
Index: calend...
[truncated message content] |