Index: Lib/SocketServer.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Lib/SocketServer.py,v retrieving revision 1.8 retrieving revision 1.9 diff -c -r1.8 -r1.9 *** SocketServer.py 1998/04/03 16:49:52 1.8 --- SocketServer.py 1998/06/16 02:27:33 1.9 *************** *** 265,271 **** max_packet_size = 8192 def get_request(self): ! return self.socket.recvfrom(self.max_packet_size) if hasattr(socket, 'AF_UNIX'): --- 265,276 ---- max_packet_size = 8192 def get_request(self): ! data, client_addr = self.socket.recvfrom(self.max_packet_size) ! return (data, self.socket), client_addr ! ! def server_activate(self): ! # No need to call listen() for UDP. ! pass if hasattr(socket, 'AF_UNIX'): *************** *** 411,414 **** self.wfile = StringIO.StringIO(self.packet) def finish(self): ! self.socket.send(self.wfile.getvalue()) --- 416,419 ---- self.wfile = StringIO.StringIO(self.packet) def finish(self): ! self.socket.sendto(self.wfile.getvalue(), self.client_address) Index: Modules/_tkinter.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/_tkinter.c,v retrieving revision 1.62 diff -c -r1.62 _tkinter.c *** _tkinter.c 1998/04/10 22:27:26 1.62 --- _tkinter.c 1998/04/20 18:19:51 *************** *** 1548,1554 **** --- 1548,1556 ---- if (PyErr_Occurred()) return; + #if TKMAJORMINOR >= 8000 Py_AtExit(Tcl_Finalize); + #endif #ifdef macintosh /* Index: Python/bltinmodule.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.115 retrieving revision 2.116 diff -c -r2.115 -r2.116 *** bltinmodule.c 1998/04/10 22:25:25 2.115 --- bltinmodule.c 1998/04/23 21:46:19 2.116 *************** *** 1282,1288 **** Py_DECREF(v); return NULL; } ! PyList_SetItem(v, i, w); ilow += istep; } return v; --- 1282,1288 ---- Py_DECREF(v); return NULL; } ! PyList_GET_ITEM(v, i) = w; ilow += istep; } return v; Index: Python/bltinmodule.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.117 retrieving revision 2.118 diff -c -r2.117 -r2.118 *** bltinmodule.c 1998/04/24 18:21:48 2.117 --- bltinmodule.c 1998/05/09 14:42:25 2.118 *************** *** 1488,1501 **** if (!PyArg_ParseTuple(args, "d|i:round", &x, &ndigits)) return NULL; f = 1.0; ! for (i = ndigits; --i >= 0; ) f = f*10.0; ! for (i = ndigits; ++i <= 0; ) ! f = f*0.1; if (x >= 0.0) ! return PyFloat_FromDouble(floor(x*f + 0.5) / f); else ! return PyFloat_FromDouble(ceil(x*f - 0.5) / f); } static PyObject * --- 1488,1509 ---- if (!PyArg_ParseTuple(args, "d|i:round", &x, &ndigits)) return NULL; f = 1.0; ! i = abs(ndigits); ! while (--i >= 0) f = f*10.0; ! if (ndigits < 0) ! x /= f; ! else ! x *= f; if (x >= 0.0) ! x = floor(x + 0.5); ! else ! x = ceil(x - 0.5); ! if (ndigits < 0) ! x *= f; else ! x /= f; ! return PyFloat_FromDouble(x); } static PyObject * *** Python/bltinmodule.c.orig Fri Jul 24 15:23:33 1998 --- Python/bltinmodule.c Sat Jul 25 23:28:53 1998 *************** *** 2100,2111 **** s = PyString_AS_STRING(v); while (*s && isspace(Py_CHARMASK(*s))) s++; - if (s[0] == '\0') { - PyErr_SetString(PyExc_ValueError, "empty string for int()"); - return NULL; - } errno = 0; x = PyOS_strtol(s, &end, 10); while (*end && isspace(Py_CHARMASK(*end))) end++; if (*end != '\0') { --- 2100,2111 ---- s = PyString_AS_STRING(v); while (*s && isspace(Py_CHARMASK(*s))) s++; errno = 0; x = PyOS_strtol(s, &end, 10); + if (end == s || !isdigit(end[-1])) { + PyErr_SetString(PyExc_ValueError, "no digits in int constant"); + return NULL; + } while (*end && isspace(Py_CHARMASK(*end))) end++; if (*end != '\0') { *************** *** 2113,2119 **** PyErr_SetString(PyExc_ValueError, buffer); return NULL; } ! else if (end-s != PyString_GET_SIZE(v)) { PyErr_SetString(PyExc_ValueError, "null byte in argument for int()"); return NULL; --- 2113,2119 ---- PyErr_SetString(PyExc_ValueError, buffer); return NULL; } ! else if (end != PyString_AS_STRING(v) + PyString_GET_SIZE(v)) { PyErr_SetString(PyExc_ValueError, "null byte in argument for int()"); return NULL; *************** *** 2137,2146 **** s = PyString_AS_STRING(v); while (*s && isspace(Py_CHARMASK(*s))) s++; - if (s[0] == '\0') { - PyErr_SetString(PyExc_ValueError, "empty string for long()"); - return NULL; - } x = PyLong_FromString(s, &end, 10); if (x == NULL) return NULL; --- 2137,2142 ---- *************** *** 2152,2160 **** Py_DECREF(x); return NULL; } ! else if (end-s != PyString_GET_SIZE(v)) { PyErr_SetString(PyExc_ValueError, ! "null byte in argument for float()"); return NULL; } return x; --- 2148,2156 ---- Py_DECREF(x); return NULL; } ! else if (end != PyString_AS_STRING(v) + PyString_GET_SIZE(v)) { PyErr_SetString(PyExc_ValueError, ! "null byte in argument for long()"); return NULL; } return x; *************** *** 2187,2193 **** PyErr_SetString(PyExc_ValueError, buffer); return NULL; } ! else if (end-s != PyString_GET_SIZE(v)) { PyErr_SetString(PyExc_ValueError, "null byte in argument for float()"); return NULL; --- 2183,2189 ---- PyErr_SetString(PyExc_ValueError, buffer); return NULL; } ! else if (end != PyString_AS_STRING(v) + PyString_GET_SIZE(v)) { PyErr_SetString(PyExc_ValueError, "null byte in argument for float()"); return NULL; Index: Python/ceval.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/ceval.c,v retrieving revision 2.145 retrieving revision 2.146 diff -c -r2.145 -r2.146 *** ceval.c 1998/04/10 22:25:29 2.145 --- ceval.c 1998/05/12 20:27:36 2.146 *************** *** 1337,1342 **** --- 1337,1349 ---- continue; case DELETE_FAST: + x = GETLOCAL(oparg); + if (x == NULL) { + PyErr_SetObject(PyExc_NameError, + PyTuple_GetItem(co->co_varnames, + oparg)); + break; + } SETLOCAL(oparg, NULL); continue; Index: Objects/classobject.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Objects/classobject.c,v retrieving revision 2.79 diff -c -r2.79 classobject.c *** classobject.c 1998/07/10 15:46:33 2.79 --- classobject.c 1998/07/23 20:49:29 *************** *** 143,148 **** --- 143,151 ---- Py_DECREF(op->cl_bases); Py_DECREF(op->cl_dict); Py_XDECREF(op->cl_name); + Py_XDECREF(op->cl_getattr); + Py_XDECREF(op->cl_setattr); + Py_XDECREF(op->cl_delattr); free((ANY *)op); } Index: configure.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/configure.in,v retrieving revision 1.83 retrieving revision 1.84 diff -c -r1.83 -r1.84 *** configure.in 1998/04/13 15:27:01 1.83 --- configure.in 1998/04/20 18:51:54 1.84 *************** *** 314,320 **** SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";; IRIX*/6*) case $CC in *gcc*) CCSHARED="-shared";; ! *) CCSHARED="-shared -all";; esac;; esac fi --- 314,320 ---- SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";; IRIX*/6*) case $CC in *gcc*) CCSHARED="-shared";; ! *) CCSHARED="";; esac;; esac fi Index: configure =================================================================== RCS file: /projects/cvsroot/python/dist/src/configure,v retrieving revision 1.76 retrieving revision 1.77 diff -c -r1.76 -r1.77 *** configure 1998/04/13 15:26:57 1.76 --- configure 1998/04/20 18:51:49 1.77 *************** *** 1865,1871 **** SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";; IRIX*/6*) case $CC in *gcc*) CCSHARED="-shared";; ! *) CCSHARED="-shared -all";; esac;; esac fi --- 1865,1871 ---- SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";; IRIX*/6*) case $CC in *gcc*) CCSHARED="-shared";; ! *) CCSHARED="";; esac;; esac fi Index: config.h.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/config.h.in,v retrieving revision 2.34 diff -c -r2.34 config.h.in *** config.h.in 1998/04/10 19:17:15 2.34 --- config.h.in 1998/05/01 16:47:39 *************** *** 396,398 **** --- 396,401 ---- /* Define if you have the ieee library (-lieee). */ #undef HAVE_LIBIEEE + + /* Define if you have the m library (-lm). */ + #undef HAVE_LIBM Index: configure =================================================================== RCS file: /projects/cvsroot/python/dist/src/configure,v retrieving revision 1.77 diff -c -r1.77 configure *** configure 1998/04/20 18:51:49 1.77 --- configure 1998/05/01 16:54:17 *************** *** 1989,2012 **** echo "$ac_t""no" 1>&6 fi # Dynamic linking for HP-UX ! echo $ac_n "checking for getpwnam in -lsun""... $ac_c" 1>&6 ! echo "configure:1994: checking for getpwnam in -lsun" >&5 ! ac_lib_var=`echo sun'_'getpwnam | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" ! LIBS="-lsun $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then --- 1989,2012 ---- echo "$ac_t""no" 1>&6 fi # Dynamic linking for HP-UX ! echo $ac_n "checking for pow in -lm""... $ac_c" 1>&6 ! echo "configure:1994: checking for pow in -lm" >&5 ! ac_lib_var=`echo m'_'pow | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" ! LIBS="-lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then *************** *** 2024,2041 **** fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 ! ac_tr_lib=HAVE_LIB`echo sun | sed -e 's/[^a-zA-Z0-9_]/_/g' \ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` cat >> confdefs.h <&6 fi ! # NIS (== YP) interface for IRIX 4 # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl. # However on SGI IRIX, these exist but are broken. if test "$ac_sys_system" != IRIX --- 2024,2041 ---- fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 ! ac_tr_lib=HAVE_LIB`echo m | sed -e 's/[^a-zA-Z0-9_]/_/g' \ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` cat >> confdefs.h <&6 fi ! # Std math lib -- assume needed if it exists # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl. # However on SGI IRIX, these exist but are broken. if test "$ac_sys_system" != IRIX Index: configure.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/configure.in,v retrieving revision 1.84 diff -c -r1.84 configure.in *** configure.in 1998/04/20 18:51:54 1.84 --- configure.in 1998/05/01 16:54:12 *************** *** 345,351 **** # checks for libraries AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX ! AC_CHECK_LIB(sun, getpwnam) # NIS (== YP) interface for IRIX 4 # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl. # However on SGI IRIX, these exist but are broken. if test "$ac_sys_system" != IRIX --- 345,351 ---- # checks for libraries AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX ! AC_CHECK_LIB(m, pow) # Std math lib -- assume needed if it exists # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl. # However on SGI IRIX, these exist but are broken. if test "$ac_sys_system" != IRIX Index: Objects/fileobject.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Objects/fileobject.c,v retrieving revision 2.58 diff -c -r2.58 fileobject.c *** fileobject.c 1998/04/10 22:16:34 2.58 --- fileobject.c 1998/05/05 21:48:45 *************** *** 415,421 **** struct stat st; if (fstat(fileno(f->f_fp), &st) == 0) { end = st.st_size; ! pos = ftell(f->f_fp); if (end > pos && pos >= 0) return end - pos + 1; /* Add 1 so if the file were to grow we'd notice. */ --- 421,431 ---- struct stat st; if (fstat(fileno(f->f_fp), &st) == 0) { end = st.st_size; ! pos = lseek(fileno(f->f_fp), 0L, SEEK_CUR); ! if (pos >= 0) ! pos = ftell(f->f_fp); ! if (pos < 0) ! clearerr(f->f_fp); if (end > pos && pos >= 0) return end - pos + 1; /* Add 1 so if the file were to grow we'd notice. */ Index: Tools/freeze/freeze.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Tools/freeze/freeze.py,v retrieving revision 1.25 retrieving revision 1.26 diff -c -r1.25 -r1.26 *** freeze.py 1998/03/20 17:37:18 1.25 --- freeze.py 1998/04/20 17:53:19 1.26 *************** *** 72,78 **** import os import string import sys - import addpack # Import the freeze-private modules --- 72,77 ---- Index: Lib/gzip.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Lib/gzip.py,v retrieving revision 1.5 retrieving revision 1.6 diff -c -r1.5 -r1.6 *** gzip.py 1998/03/26 21:12:11 1.5 --- gzip.py 1998/05/13 21:49:58 1.6 *************** *** 1,7 **** import time import string import zlib - import StringIO import __builtin__ # implements a python function that reads and writes a gzipped file --- 1,6 ---- *************** *** 157,163 **** def writelines(self,lines): self.write(string.join(lines)) ! def read(self,size=None): if self.extrasize <= 0 and self.fileobj is None: return '' --- 156,162 ---- def writelines(self,lines): self.write(string.join(lines)) ! def read(self, size=None): if self.extrasize <= 0 and self.fileobj is None: return '' *************** *** 185,191 **** def _unread(self, buf): self.extrabuf = buf + self.extrabuf ! self.extrasize = len(buf) + self.extrasize def _read(self, size=1024): try: --- 184,190 ---- def _unread(self, buf): self.extrabuf = buf + self.extrabuf ! self.extrasize = len(self.extrabuf) def _read(self, size=1024): try: *************** *** 250,256 **** c = self.read(readsize) i = string.find(c, '\n') if i >= 0 or c == '': ! bufs.append(c[:i]) self._unread(c[i+1:]) return string.join(bufs, '') bufs.append(c) --- 249,255 ---- c = self.read(readsize) i = string.find(c, '\n') if i >= 0 or c == '': ! bufs.append(c[:i+1]) self._unread(c[i+1:]) return string.join(bufs, '') bufs.append(c) Index: Lib/imaplib.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Lib/imaplib.py,v retrieving revision 1.4 diff -c -r1.4 imaplib.py *** imaplib.py 1998/04/11 03:11:51 1.4 --- imaplib.py 1998/05/05 02:29:39 *************** *** 275,283 **** (typ, [data]) = .list(user, password) """ - if not 'AUTH=LOGIN' in self.capabilities \ - and not 'AUTH-LOGIN' in self.capabilities: - raise self.error("server doesn't allow LOGIN authorisation") typ, dat = self._simple_command('LOGIN', user, password) if typ != 'OK': raise self.error(dat) --- 275,280 ---- Index: Lib/imaplib.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Lib/imaplib.py,v retrieving revision 1.5 retrieving revision 1.6 diff -c -r1.5 -r1.6 *** imaplib.py 1998/05/05 03:08:46 1.5 --- imaplib.py 1998/05/18 14:39:42 1.6 *************** *** 172,179 **** date_time = Time2Internaldate(date_time) else: date_time = None ! tag = self._command(name, mailbox, flags, date_time, message) ! return self._command_complete(name, tag) def authenticate(self, func): --- 172,178 ---- date_time = Time2Internaldate(date_time) else: date_time = None ! return self._simple_command(name, mailbox, flags, date_time, message) def authenticate(self, func): *************** *** 314,319 **** --- 313,320 ---- def recent(self): """Prompt server for an update. + Flush all untagged responses. + (typ, [data]) = .recent() 'data' is None if no new messages, *************** *** 323,328 **** --- 324,330 ---- typ, dat = self._untagged_response('OK', name) if dat[-1]: return typ, dat + self.untagged_responses = {} typ, dat = self._simple_command('NOOP') return self._untagged_response(typ, name) *************** *** 338,346 **** def response(self, code): """Return data for response 'code' if received, or None. (code, [data]) = .response(code) """ ! return code, self.untagged_responses.get(code, [None]) def search(self, charset, criteria): --- 340,350 ---- def response(self, code): """Return data for response 'code' if received, or None. + Old value for response 'code' is cleared. + (code, [data]) = .response(code) """ ! return self._untagged_response(code, code) def search(self, charset, criteria): *************** *** 360,374 **** def select(self, mailbox='INBOX', readonly=None): """Select a mailbox. (typ, [data]) = .select(mailbox='INBOX', readonly=None) 'data' is count of messages in mailbox ('EXISTS' response). """ # Mandated responses are ('FLAGS', 'EXISTS', 'RECENT', 'UIDVALIDITY') ! # Remove immediately interesting responses ! for r in ('EXISTS', 'READ-WRITE'): ! if self.untagged_responses.has_key(r): ! del self.untagged_responses[r] if readonly: name = 'EXAMINE' else: --- 364,377 ---- def select(self, mailbox='INBOX', readonly=None): """Select a mailbox. + Flush all untagged responses. + (typ, [data]) = .select(mailbox='INBOX', readonly=None) 'data' is count of messages in mailbox ('EXISTS' response). """ # Mandated responses are ('FLAGS', 'EXISTS', 'RECENT', 'UIDVALIDITY') ! self.untagged_responses = {} # Flush old responses. if readonly: name = 'EXAMINE' else: *************** *** 400,407 **** (typ, [data]) = .store(message_set, command, flag_list) """ ! command = '%s %s' % (command, flag_list) ! typ, dat = self._simple_command('STORE', message_set, command) return self._untagged_response(typ, 'FETCH') --- 403,409 ---- (typ, [data]) = .store(message_set, command, flag_list) """ ! typ, dat = self._simple_command('STORE', message_set, command, flag_list) return self._untagged_response(typ, 'FETCH') *************** *** 413,428 **** return self._simple_command('SUBSCRIBE', mailbox) ! def uid(self, command, args): ! """Execute "command args" with messages identified by UID, rather than message number. ! (typ, [data]) = .uid(command, args) Returns response appropriate to 'command'. """ name = 'UID' ! typ, dat = self._simple_command('UID', command, args) if command == 'SEARCH': name = 'SEARCH' else: --- 415,430 ---- return self._simple_command('SUBSCRIBE', mailbox) ! def uid(self, command, *args): ! """Execute "command arg ..." with messages identified by UID, rather than message number. ! (typ, [data]) = .uid(command, arg1, arg2, ...) Returns response appropriate to 'command'. """ name = 'UID' ! typ, dat = apply(self._simple_command, ('UID', command) + args) if command == 'SEARCH': name = 'SEARCH' else: *************** *** 440,454 **** return self._simple_command('UNSUBSCRIBE', mailbox) ! def xatom(self, name, arg1=None, arg2=None): """Allow simple extension commands notified by server in CAPABILITY response. ! (typ, [data]) = .xatom(name, arg1=None, arg2=None) """ if name[0] != 'X' or not name in self.capabilities: raise self.error('unknown extension command: %s' % name) ! return self._simple_command(name, arg1, arg2) --- 442,456 ---- return self._simple_command('UNSUBSCRIBE', mailbox) ! def xatom(self, name, *args): """Allow simple extension commands notified by server in CAPABILITY response. ! (typ, [data]) = .xatom(name, arg, ...) """ if name[0] != 'X' or not name in self.capabilities: raise self.error('unknown extension command: %s' % name) ! return apply(self._simple_command, (name,) + args) *************** *** 475,481 **** tag = self._new_tag() data = '%s %s' % (tag, name) for d in (dat1, dat2, dat3): ! if d is not None: data = '%s %s' % (data, d) if literal is not None: data = '%s {%s}' % (data, len(literal)) --- 477,491 ---- tag = self._new_tag() data = '%s %s' % (tag, name) for d in (dat1, dat2, dat3): ! if d is None: continue ! if type(d) is type(''): ! l = len(string.split(d)) ! else: ! l = 1 ! if l == 0 or l > 1 and (d[0],d[-1]) not in (('(',')'),('"','"')): ! data = '%s "%s"' % (data, d) ! else: ! data = '%s %s' % (data, d) if literal is not None: data = '%s {%s}' % (data, len(literal)) *************** *** 529,539 **** # Read response and store. # # Returns None for continuation responses, ! # otherwise first response line received ! # Protocol mandates all lines terminated by CRLF. ! ! resp = self._get_line()[:-2] # Command completion response? --- 539,547 ---- # Read response and store. # # Returns None for continuation responses, ! # otherwise first response line received. ! resp = self._get_line() # Command completion response? *************** *** 584,590 **** # Read trailer - possibly containing another literal ! dat = self._get_line()[:-2] self._append_untagged(typ, dat) --- 592,598 ---- # Read trailer - possibly containing another literal ! dat = self._get_line() self._append_untagged(typ, dat) *************** *** 614,621 **** # Protocol mandates all lines terminated by CRLF if __debug__ and self.debug >= 4: ! print '\t< %s' % line[:-2] return line --- 622,630 ---- # Protocol mandates all lines terminated by CRLF + line = line[:-2] if __debug__ and self.debug >= 4: ! print '\t< %s' % line return line *************** *** 638,646 **** return tag ! def _simple_command(self, name, dat1=None, dat2=None): ! return self._command_complete(name, self._command(name, dat1, dat2)) def _untagged_response(self, typ, name): --- 647,655 ---- return tag ! def _simple_command(self, name, *args): ! return self._command_complete(name, apply(self._command, (name,) + args)) def _untagged_response(self, typ, name): *************** *** 648,653 **** --- 657,664 ---- if not self.untagged_responses.has_key(name): return typ, [None] data = self.untagged_responses[name] + if __debug__ and self.debug >= 5: + print '\tuntagged_responses[%s] => %.20s..' % (name, `data`) del self.untagged_responses[name] return typ, data *************** *** 755,770 **** test_seq1 = ( ('login', (USER, PASSWD)), ! ('create', ('/tmp/xxx',)), ! ('rename', ('/tmp/xxx', '/tmp/yyy')), ! ('CREATE', ('/tmp/yyz',)), ! ('append', ('/tmp/yyz', None, None, 'From: anon@x.y.z\n\ndata...')), ! ('select', ('/tmp/yyz',)), ! ('recent', ()), ('uid', ('SEARCH', 'ALL')), ('fetch', ('1', '(INTERNALDATE RFC822)')), ('store', ('1', 'FLAGS', '(\Deleted)')), ('expunge', ()), ('close', ()), ) --- 766,781 ---- test_seq1 = ( ('login', (USER, PASSWD)), ! ('create', ('/tmp/xxx 1',)), ! ('rename', ('/tmp/xxx 1', '/tmp/yyy')), ! ('CREATE', ('/tmp/yyz 2',)), ! ('append', ('/tmp/yyz 2', None, None, 'From: anon@x.y.z\n\ndata...')), ! ('select', ('/tmp/yyz 2',)), ('uid', ('SEARCH', 'ALL')), ('fetch', ('1', '(INTERNALDATE RFC822)')), ('store', ('1', 'FLAGS', '(\Deleted)')), ('expunge', ()), + ('recent', ()), ('close', ()), ) *************** *** 772,779 **** ('select', ()), ('response',('UIDVALIDITY',)), ('uid', ('SEARCH', 'ALL')), - ('recent', ()), ('response', ('EXISTS',)), ('logout', ()), ) --- 783,790 ---- ('select', ()), ('response',('UIDVALIDITY',)), ('uid', ('SEARCH', 'ALL')), ('response', ('EXISTS',)), + ('recent', ()), ('logout', ()), ) *************** *** 790,796 **** run(cmd, args) for ml in run('list', ('/tmp/', 'yy%')): ! path = string.split(ml)[-1] run('delete', (path,)) for cmd,args in test_seq2: --- 801,809 ---- run(cmd, args) for ml in run('list', ('/tmp/', 'yy%')): ! mo = re.match(r'.*"([^"]+)"$', ml) ! if mo: path = mo.group(1) ! else: path = string.split(ml)[-1] run('delete', (path,)) for cmd,args in test_seq2: *************** *** 800,804 **** continue uid = string.split(dat[0])[-1] ! run('uid', ('FETCH', ! '%s (FLAGS INTERNALDATE RFC822.SIZE RFC822.HEADER RFC822)' % uid)) --- 813,817 ---- continue uid = string.split(dat[0])[-1] ! run('uid', ('FETCH', '%s' % uid, ! '(FLAGS INTERNALDATE RFC822.SIZE RFC822.HEADER RFC822)')) Index: Lib/imaplib.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Lib/imaplib.py,v retrieving revision 1.6 retrieving revision 1.8 diff -c -r1.6 -r1.8 *** imaplib.py 1998/05/18 14:39:42 1.6 --- imaplib.py 1998/05/29 13:34:03 1.8 *************** *** 12,18 **** Time2Internaldate """ ! import re, socket, string, time, whrandom # Globals --- 12,18 ---- Time2Internaldate """ ! import re, socket, string, time, random # Globals *************** *** 77,85 **** port - port number (default: standard IMAP4 port). All IMAP4rev1 commands are supported by methods of the same ! name (in lower-case). Each command returns a tuple: (type, [data, ...]) ! where 'type' is usually 'OK' or 'NO', and 'data' is either the ! text from the tagged response, or untagged results from command. Errors raise the exception class .error(""). IMAP4 server errors raise .abort(""), --- 77,92 ---- port - port number (default: standard IMAP4 port). All IMAP4rev1 commands are supported by methods of the same ! name (in lower-case). ! ! All arguments to commands are converted to strings, except for ! the last argument to APPEND which is passed as an IMAP4 ! literal. If necessary (the string isn't enclosed with either ! parentheses or double quotes) each converted string is quoted. ! ! Each command returns a tuple: (type, [data, ...]) where 'type' ! is usually 'OK' or 'NO', and 'data' is either the text from the ! tagged response, or untagged results from command. Errors raise the exception class .error(""). IMAP4 server errors raise .abort(""), *************** *** 95,100 **** --- 102,108 ---- self.port = port self.debug = Debug self.state = 'LOGOUT' + self.literal = None # A literal argument to a command self.tagged_commands = {} # Tagged commands awaiting response self.untagged_responses = {} # {typ: [data, ...], ...} self.continuation_response = '' # Last continuation response *************** *** 109,115 **** # Create unique tag for this session, # and compile tagged response matcher. ! self.tagpre = Int2AP(whrandom.random()*32000) self.tagre = re.compile(r'(?P' + self.tagpre + r'\d+) (?P[A-Z]+) (?P.*)') --- 117,123 ---- # Create unique tag for this session, # and compile tagged response matcher. ! self.tagpre = Int2AP(random.randint(0, 31999)) self.tagre = re.compile(r'(?P' + self.tagpre + r'\d+) (?P[A-Z]+) (?P.*)') *************** *** 172,178 **** date_time = Time2Internaldate(date_time) else: date_time = None ! return self._simple_command(name, mailbox, flags, date_time, message) def authenticate(self, func): --- 180,187 ---- date_time = Time2Internaldate(date_time) else: date_time = None ! self.literal = message ! return self._simple_command(name, mailbox, flags, date_time) def authenticate(self, func): *************** *** 310,319 **** return self._untagged_response(typ, name) ! def recent(self): ! """Prompt server for an update. ! Flush all untagged responses. (typ, [data]) = .recent() --- 319,336 ---- return self._untagged_response(typ, name) ! def noop(self): ! """Send NOOP command. ! (typ, data) = .noop() ! """ ! return self._simple_command('NOOP') ! ! ! def recent(self): ! """Return most recent 'RECENT' response if it exists, ! else prompt server for an update using the 'NOOP' command, ! and flush all untagged responses. (typ, [data]) = .recent() *************** *** 468,482 **** print '\tuntagged_responses[%s] += %.20s..' % (typ, `dat`) ! def _command(self, name, dat1=None, dat2=None, dat3=None, literal=None): if self.state not in Commands[name]: raise self.error( 'command %s illegal in state %s' % (name, self.state)) tag = self._new_tag() data = '%s %s' % (tag, name) ! for d in (dat1, dat2, dat3): if d is None: continue if type(d) is type(''): l = len(string.split(d)) --- 485,500 ---- print '\tuntagged_responses[%s] += %.20s..' % (typ, `dat`) ! def _command(self, name, *args): if self.state not in Commands[name]: + self.literal = None raise self.error( 'command %s illegal in state %s' % (name, self.state)) tag = self._new_tag() data = '%s %s' % (tag, name) ! for d in args: if d is None: continue if type(d) is type(''): l = len(string.split(d)) *************** *** 486,492 **** --- 504,513 ---- data = '%s "%s"' % (data, d) else: data = '%s %s' % (data, d) + + literal = self.literal if literal is not None: + self.literal = None data = '%s {%s}' % (data, len(literal)) try: Index: Python/import.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/import.c,v retrieving revision 2.110 retrieving revision 2.111 diff -c -r2.110 -r2.111 *** import.c 1998/05/14 02:32:54 2.110 --- import.c 1998/05/19 15:09:05 2.111 *************** *** 1664,1672 **** struct filedescr *fdp; FILE *fp = NULL; ! path = PyObject_GetAttrString(mod, "__path__"); ! if (path == NULL) ! PyErr_Clear(); buf[0] = '\0'; fdp = find_module(subname, path, --- 1664,1679 ---- struct filedescr *fdp; FILE *fp = NULL; ! if (mod == Py_None) ! path = NULL; ! else { ! path = PyObject_GetAttrString(mod, "__path__"); ! if (path == NULL) { ! PyErr_Clear(); ! Py_INCREF(Py_None); ! return Py_None; ! } ! } buf[0] = '\0'; fdp = find_module(subname, path, Index: Objects/longobject.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Objects/longobject.c,v retrieving revision 1.40 diff -c -r1.40 longobject.c *** longobject.c 1998/04/10 22:16:36 1.40 --- longobject.c 1998/07/25 12:42:02 *************** *** 175,182 **** PyLong_AsLong(vv) PyObject *vv; { register PyLongObject *v; ! long x, prev; int i, sign; if (vv == NULL || !PyLong_Check(vv)) { --- 175,183 ---- PyLong_AsLong(vv) PyObject *vv; { + /* This version by Tim Peters */ register PyLongObject *v; ! unsigned long x, prev; int i, sign; if (vv == NULL || !PyLong_Check(vv)) { *************** *** 194,206 **** while (--i >= 0) { prev = x; x = (x << SHIFT) + v->ob_digit[i]; ! if ((x >> SHIFT) != prev) { ! PyErr_SetString(PyExc_OverflowError, ! "long int too long to convert"); ! return -1; ! } } ! return x * sign; } /* Get a C long int from a long int object. --- 195,216 ---- while (--i >= 0) { prev = x; x = (x << SHIFT) + v->ob_digit[i]; ! if ((x >> SHIFT) != prev) ! goto overflow; } ! /* Haven't lost any bits, but if the sign bit is set we're in ! * trouble *unless* this is the min negative number. So, ! * trouble iff sign bit set && (positive || some bit set other ! * than the sign bit). ! */ ! if ((long)x < 0 && (sign > 0 || (x << 1) != 0)) ! goto overflow; ! return (long)x * sign; ! ! overflow: ! PyErr_SetString(PyExc_OverflowError, ! "long int too long to convert"); ! return -1; } /* Get a C long int from a long int object. *************** *** 443,448 **** --- 453,459 ---- int base; { int sign = 1; + char *start; PyLongObject *z; if ((base != 0 && base < 2) || base > 36) { *************** *** 471,476 **** --- 482,488 ---- if (base == 16 && str[0] == '0' && (str[1] == 'x' || str[1] == 'X')) str += 2; z = _PyLong_New(0); + start = str; for ( ; z != NULL; ++str) { int k = -1; PyLongObject *temp; *************** *** 486,491 **** --- 498,510 ---- temp = muladd1(z, (digit)base, (digit)k); Py_DECREF(z); z = temp; + } + if (z == NULL) + return NULL; + if (str == start) { + PyErr_SetString(PyExc_ValueError, + "no digits in long int constant"); + return NULL; } if (sign < 0 && z != NULL && z->ob_size != 0) z->ob_size = -(z->ob_size); Index: Objects/object.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Objects/object.c,v retrieving revision 2.55 retrieving revision 2.56 diff -c -r2.55 -r2.56 *** object.c 1998/04/11 15:17:34 2.55 --- object.c 1998/04/21 22:25:01 2.56 *************** *** 188,195 **** ret = -1; } else { ! fprintf(fp, "%s", ! PyString_AsString(s)); } Py_XDECREF(s); } --- 188,195 ---- ret = -1; } else { ! ret = PyObject_Print(s, fp, ! Py_PRINT_RAW); } Py_XDECREF(s); } Index: Modules/parsermodule.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/parsermodule.c,v retrieving revision 2.25 retrieving revision 2.26 diff -c -r2.25 -r2.26 *** parsermodule.c 1998/04/13 18:45:18 2.25 --- parsermodule.c 1998/04/21 22:31:45 2.26 *************** *** 473,483 **** static PyMethodDef parser_methods[] = { ! {"compile", parser_compileast, METH_VARARGS}, ! {"isexpr", parser_isexpr, METH_VARARGS}, ! {"issuite", parser_issuite, METH_VARARGS}, ! {"tolist", parser_ast2list, METH_VARARGS}, ! {"totuple", parser_ast2tuple, METH_VARARGS}, {NULL} }; --- 473,488 ---- static PyMethodDef parser_methods[] = { ! {"compile", (PyCFunction)parser_compileast, METH_VARARGS, ! "Compile this AST object into a code object."}, ! {"isexpr", (PyCFunction)parser_isexpr, METH_VARARGS, ! "Determines if this AST object was created from an expression."}, ! {"issuite", (PyCFunction)parser_issuite, METH_VARARGS, ! "Determines if this AST object was created from a suite."}, ! {"tolist", (PyCFunction)parser_ast2list, METH_VARARGS, ! "Creates a list-tree representation of this AST."}, ! {"totuple", (PyCFunction)parser_ast2tuple, METH_VARARGS, ! "Creates a tuple-tree representation of this AST."}, {NULL} }; *************** *** 2685,2711 **** * inheritance. */ static PyMethodDef parser_functions[] = { ! {"ast2tuple", parser_ast2tuple, METH_VARARGS, "Creates a tuple-tree representation of an AST."}, ! {"ast2list", parser_ast2list, METH_VARARGS, "Creates a list-tree representation of an AST."}, ! {"compileast", parser_compileast, METH_VARARGS, "Compiles an AST object into a code object."}, ! {"expr", parser_expr, METH_VARARGS, "Creates an AST object from an expression."}, ! {"isexpr", parser_isexpr, METH_VARARGS, "Determines if an AST object was created from an expression."}, ! {"issuite", parser_issuite, METH_VARARGS, "Determines if an AST object was created from a suite."}, ! {"suite", parser_suite, METH_VARARGS, "Creates an AST object from a suite."}, ! {"sequence2ast", parser_tuple2ast, METH_VARARGS, "Creates an AST object from a tree representation."}, ! {"tuple2ast", parser_tuple2ast, METH_VARARGS, "Creates an AST object from a tree representation."}, /* private stuff: support pickle module */ ! {"_pickler", parser__pickler, METH_VARARGS, "Returns the pickle magic to allow ast objects to be pickled."}, {0, 0, 0} --- 2690,2716 ---- * inheritance. */ static PyMethodDef parser_functions[] = { ! {"ast2tuple", (PyCFunction)parser_ast2tuple, METH_VARARGS, "Creates a tuple-tree representation of an AST."}, ! {"ast2list", (PyCFunction)parser_ast2list, METH_VARARGS, "Creates a list-tree representation of an AST."}, ! {"compileast", (PyCFunction)parser_compileast, METH_VARARGS, "Compiles an AST object into a code object."}, ! {"expr", (PyCFunction)parser_expr, METH_VARARGS, "Creates an AST object from an expression."}, ! {"isexpr", (PyCFunction)parser_isexpr, METH_VARARGS, "Determines if an AST object was created from an expression."}, ! {"issuite", (PyCFunction)parser_issuite, METH_VARARGS, "Determines if an AST object was created from a suite."}, ! {"suite", (PyCFunction)parser_suite, METH_VARARGS, "Creates an AST object from a suite."}, ! {"sequence2ast", (PyCFunction)parser_tuple2ast, METH_VARARGS, "Creates an AST object from a tree representation."}, ! {"tuple2ast", (PyCFunction)parser_tuple2ast, METH_VARARGS, "Creates an AST object from a tree representation."}, /* private stuff: support pickle module */ ! {"_pickler", (PyCFunction)parser__pickler, METH_VARARGS, "Returns the pickle magic to allow ast objects to be pickled."}, {0, 0, 0} *************** *** 2761,2767 **** /* register to support pickling */ module = PyImport_ImportModule("copy_reg"); if (module != NULL) { ! PyObject *func, *constructor, *pickler; func = PyObject_GetAttrString(module, "pickle"); pickle_constructor = PyDict_GetItemString(dict, "sequence2ast"); --- 2766,2772 ---- /* register to support pickling */ module = PyImport_ImportModule("copy_reg"); if (module != NULL) { ! PyObject *func, *pickler; func = PyObject_GetAttrString(module, "pickle"); pickle_constructor = PyDict_GetItemString(dict, "sequence2ast"); Index: Modules/pcre-int.h =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/pcre-int.h,v retrieving revision 2.3 diff -c -r2.3 pcre-int.h *** pcre-int.h 1998/04/03 21:13:23 2.3 --- pcre-int.h 1998/05/07 15:22:53 *************** *** 3,9 **** *************************************************/ ! #define PCRE_VERSION "1.07 16-Feb-1998" /* This is a library of functions to support regular expressions whose syntax --- 3,9 ---- *************************************************/ ! #define PCRE_VERSION "1.09 28-Apr-1998" /* This is a library of functions to support regular expressions whose syntax *************** *** 80,90 **** #ifdef FOR_PYTHON #define PUBLIC_OPTIONS \ (PCRE_CASELESS|PCRE_EXTENDED|PCRE_ANCHORED|PCRE_MULTILINE| \ ! PCRE_DOTALL|PCRE_DOLLAR_ENDONLY|PCRE_EXTRA|PCRE_LOCALE) #else #define PUBLIC_OPTIONS \ (PCRE_CASELESS|PCRE_EXTENDED|PCRE_ANCHORED|PCRE_MULTILINE| \ ! PCRE_DOTALL|PCRE_DOLLAR_ENDONLY|PCRE_EXTRA) #endif #define PUBLIC_EXEC_OPTIONS \ (PCRE_CASELESS|PCRE_ANCHORED|PCRE_MULTILINE|PCRE_NOTBOL|PCRE_NOTEOL| \ --- 80,91 ---- #ifdef FOR_PYTHON #define PUBLIC_OPTIONS \ (PCRE_CASELESS|PCRE_EXTENDED|PCRE_ANCHORED|PCRE_MULTILINE| \ ! PCRE_DOTALL|PCRE_DOLLAR_ENDONLY|PCRE_EXTRA|PCRE_UNGREEDY| \ ! PCRE_LOCALE) #else #define PUBLIC_OPTIONS \ (PCRE_CASELESS|PCRE_EXTENDED|PCRE_ANCHORED|PCRE_MULTILINE| \ ! PCRE_DOTALL|PCRE_DOLLAR_ENDONLY|PCRE_EXTRA|PCRE_UNGREEDY) #endif #define PUBLIC_EXEC_OPTIONS \ (PCRE_CASELESS|PCRE_ANCHORED|PCRE_MULTILINE|PCRE_NOTBOL|PCRE_NOTEOL| \ Index: Modules/pcre.h =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/pcre.h,v retrieving revision 2.6 diff -c -r2.6 pcre.h *** pcre.h 1998/04/03 21:13:25 2.6 --- pcre.h 1998/05/07 15:22:54 *************** *** 34,39 **** --- 34,40 ---- #define PCRE_EXTRA 0x0040 #define PCRE_NOTBOL 0x0080 #define PCRE_NOTEOL 0x0100 + #define PCRE_UNGREEDY 0x0400 #ifdef FOR_PYTHON #define PCRE_LOCALE 0x0200 #endif Index: Modules/pypcre.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/pypcre.c,v retrieving revision 2.12 diff -c -r2.12 pypcre.c *** pypcre.c 1998/04/10 21:50:23 2.12 --- pypcre.c 1998/05/07 15:22:55 *************** *** 1216,1221 **** --- 1216,1222 ---- int repeat_type, op_type; int repeat_min, repeat_max; int bravalue, length; + int greedy_default, greedy_non_default; register int c; register uschar *code = *codeptr; const uschar *ptr = *ptrptr; *************** *** 1224,1229 **** --- 1225,1235 ---- uschar class[32]; uschar *class_flag; /* Pointer to the single-byte flag for OP_CLASS_L */ + /* Set up the default and non-default settings for greediness */ + + greedy_default = ((options & PCRE_UNGREEDY) != 0); + greedy_non_default = greedy_default ^ 1; + /* Switch on next character until the end of the branch */ for (;; ptr++) *************** *** 1536,1545 **** goto FAILED; } ! /* If the next character is '?' this is a minimizing repeat. Advance to the next character. */ ! if (ptr[1] == '?') { repeat_type = 1; ptr++; } else repeat_type = 0; /* If the maximum is zero then the minimum must also be zero; Perl allows this case, so we do too - by simply omitting the item altogether. */ --- 1542,1554 ---- goto FAILED; } ! /* If the next character is '?' this is a minimizing repeat, by default, ! but if PCRE_UNGREEDY is set, it works the other way round. Advance to the next character. */ ! if (ptr[1] == '?') ! { repeat_type = greedy_non_default; ptr++; } ! else repeat_type = greedy_default; /* If the maximum is zero then the minimum must also be zero; Perl allows this case, so we do too - by simply omitting the item altogether. */ *************** *** 1628,1641 **** /* If the mininum is 1 and the previous item was a character string, we either have to put back the item that got cancelled if the string length was 1, or add the character back onto the end of a longer ! string. For a character type nothing need be done; it will just get put ! back naturally. */ else if (*previous == OP_CHARS) { if (code == previous) code += 2; else previous[1]++; } /* If the maximum is unlimited, insert an OP_STAR. */ if (repeat_max < 0) --- 1637,1656 ---- /* If the mininum is 1 and the previous item was a character string, we either have to put back the item that got cancelled if the string length was 1, or add the character back onto the end of a longer ! string. For a character type nothing need be done; it will just get ! put back naturally. Note that the final character is always going to ! get added below. */ else if (*previous == OP_CHARS) { if (code == previous) code += 2; else previous[1]++; } + /* For a single negated character we also have to put back the + item that got cancelled. */ + + else if (*previous == OP_NOT) code++; + /* If the maximum is unlimited, insert an OP_STAR. */ if (repeat_max < 0) *************** *** 2484,2490 **** ptr += 2; break; } ! /* Else fall thourh */ /* Else loop setting valid options until ) is met. Anything else is an error. */ --- 2499,2505 ---- ptr += 2; break; } ! /* Else fall through */ /* Else loop setting valid options until ) is met. Anything else is an error. */ *************** *** 2725,2738 **** if (re->options != 0) { ! printf("%s%s%s%s%s%s%s\n", ((re->options & PCRE_ANCHORED) != 0)? "anchored " : "", ((re->options & PCRE_CASELESS) != 0)? "caseless " : "", ((re->options & PCRE_EXTENDED) != 0)? "extended " : "", ((re->options & PCRE_MULTILINE) != 0)? "multiline " : "", ((re->options & PCRE_DOTALL) != 0)? "dotall " : "", ((re->options & PCRE_DOLLAR_ENDONLY) != 0)? "endonly " : "", ! ((re->options & PCRE_EXTRA) != 0)? "extra " : ""); } if ((re->options & PCRE_FIRSTSET) != 0) --- 2740,2754 ---- if (re->options != 0) { ! printf("%s%s%s%s%s%s%s%s\n", ((re->options & PCRE_ANCHORED) != 0)? "anchored " : "", ((re->options & PCRE_CASELESS) != 0)? "caseless " : "", ((re->options & PCRE_EXTENDED) != 0)? "extended " : "", ((re->options & PCRE_MULTILINE) != 0)? "multiline " : "", ((re->options & PCRE_DOTALL) != 0)? "dotall " : "", ((re->options & PCRE_DOLLAR_ENDONLY) != 0)? "endonly " : "", ! ((re->options & PCRE_EXTRA) != 0)? "extra " : "", ! ((re->options & PCRE_UNGREEDY) != 0)? "ungreedy " : ""); } if ((re->options & PCRE_FIRSTSET) != 0) *************** *** 3070,3076 **** if (md->offset_top == NULL || md->eptr == NULL || md->ecode == NULL || md->off_num == NULL || md->r1 == NULL || md->r2 == NULL) { ! PyErr_SetString(PyExc_MemoryError, "Can't increase failure stack for re operation"); longjmp(md->error_env, 1); } return 0; --- 3086,3092 ---- if (md->offset_top == NULL || md->eptr == NULL || md->ecode == NULL || md->off_num == NULL || md->r1 == NULL || md->r2 == NULL) { ! PyErr_NoMemory(); longjmp(md->error_env, 1); } return 0; Index: Lib/sgmllib.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Lib/sgmllib.py,v retrieving revision 1.13 retrieving revision 1.14 diff -c -r1.13 -r1.14 *** sgmllib.py 1998/03/26 21:12:54 1.13 --- sgmllib.py 1998/04/16 21:04:26 1.14 *************** *** 30,41 **** endbracket = re.compile('[<>]') special = re.compile(']*>') commentopen = re.compile('