From ping@users.sourceforge.net Thu Mar 1 00:24:34 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Wed, 28 Feb 2001 16:24:34 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv20798 Modified Files: pydoc.py Log Message: Normalize case of paths in sys.path to avoid duplicates on Windows. Handle <... at 001B6378> like <... at 0x120f80> (%p is platform-dependent). Fix RCS version tag handling. Move __main__ behaviour into a function, pydoc.cli(). Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** pydoc.py 2001/02/28 08:26:44 1.7 --- pydoc.py 2001/03/01 00:24:32 1.8 *************** *** 1,4 **** #!/usr/bin/env python ! """Generate Python documentation in HTML or as text for interactive use. At the shell command line outside of Python, run "pydoc " to show --- 1,4 ---- #!/usr/bin/env python ! """Generate Python documentation in HTML or text for interactive use. At the shell command line outside of Python, run "pydoc " to show *************** *** 75,82 **** """Convert sys.path into a list of absolute, existing, unique paths.""" dirs = [] for dir in sys.path: dir = os.path.abspath(dir or '.') ! if dir not in dirs and os.path.isdir(dir): dirs.append(dir) return dirs --- 75,85 ---- """Convert sys.path into a list of absolute, existing, unique paths.""" dirs = [] + normdirs = [] for dir in sys.path: dir = os.path.abspath(dir or '.') ! normdir = os.path.normcase(dir) ! if normdir not in normdirs and os.path.isdir(dir): dirs.append(dir) + normdirs.append(normdir) return dirs *************** *** 117,123 **** return text ! def cleanid(text): """Remove the hexadecimal id from a Python object representation.""" ! return re.sub(' at 0x[0-9a-f]{5,}>$', '>', text) def modulename(path): --- 120,130 ---- return text ! def stripid(text): """Remove the hexadecimal id from a Python object representation.""" ! # The behaviour of %p is implementation-dependent, so we need an example. ! for pattern in [' at 0x[0-9a-f]{6,}>$', ' at [0-9A-F]{8,}>$']: ! if re.search(pattern, repr(Exception)): ! return re.sub(pattern, '>', text) ! return text def modulename(path): *************** *** 205,209 **** return getattr(self, methodname)(x, level) else: ! return self.escape(cram(cleanid(repr(x)), self.maxother)) def repr_string(self, x, level): --- 212,216 ---- return getattr(self, methodname)(x, level) else: ! return self.escape(cram(stripid(repr(x)), self.maxother)) def repr_string(self, x, level): *************** *** 214,218 **** def repr_instance(self, x, level): try: ! return cram(cleanid(repr(x)), self.maxstring) except: return self.escape('<%s instance>' % x.__class__.__name__) --- 221,225 ---- def repr_instance(self, x, level): try: ! return cram(stripid(repr(x)), self.maxstring) except: return self.escape('<%s instance>' % x.__class__.__name__) *************** *** 387,392 **** head = '
 %s' % name try: ! file = inspect.getsourcefile(object) ! filelink = '%s' % (file, file) except TypeError: filelink = '(built-in)' --- 394,399 ---- head = '
 %s' % name try: ! path = os.path.abspath(inspect.getfile(object)) ! filelink = '%s' % (path, path) except TypeError: filelink = '(built-in)' *************** *** 396,400 **** if version[:11] == '$' + 'Revision: ' and version[-1:] == '$': version = strip(version[11:-1]) ! info.append('version: %s' % self.escape(version)) if hasattr(object, '__date__'): info.append(self.escape(str(object.__date__))) --- 403,407 ---- if version[:11] == '$' + 'Revision: ' and version[-1:] == '$': version = strip(version[11:-1]) ! info.append('version %s' % self.escape(version)) if hasattr(object, '__date__'): info.append(self.escape(str(object.__date__))) *************** *** 599,607 **** return getattr(self, methodname)(x, level) else: ! return cram(cleanid(repr(x)), self.maxother) def repr_instance(self, x, level): try: ! return cram(cleanid(repr(x)), self.maxstring) except: return '<%s instance>' % x.__class__.__name__ --- 606,614 ---- return getattr(self, methodname)(x, level) else: ! return cram(stripid(repr(x)), self.maxother) def repr_instance(self, x, level): try: ! return cram(stripid(repr(x)), self.maxstring) except: return '<%s instance>' % x.__class__.__name__ *************** *** 720,725 **** if hasattr(object, '__version__'): version = str(object.__version__) ! if version[:11] == '$Revision$': ! version = version[11:-1] result = result + self.section('VERSION', version) if hasattr(object, '__date__'): --- 727,732 ---- if hasattr(object, '__version__'): version = str(object.__version__) ! if version[:11] == '$' + 'Revision: ' and version[-1:] == '$': ! version = strip(version[11:-1]) result = result + self.section('VERSION', version) if hasattr(object, '__date__'): *************** *** 1110,1114 **** # -------------------------------------------------- command-line interface ! if __name__ == '__main__': import getopt class BadUsage: pass --- 1117,1121 ---- # -------------------------------------------------- command-line interface ! def cli(): import getopt class BadUsage: pass *************** *** 1181,1182 **** --- 1188,1192 ---- under a given directory to files in the current directory. """ % ((sys.argv[0],) * 5) + + if __name__ == '__main__': + cli() From ping@users.sourceforge.net Thu Mar 1 00:25:42 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Wed, 28 Feb 2001 16:25:42 -0800 Subject: [Python-checkins] CVS: python/dist/src/Tools/scripts pydoc,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory usw-pr-cvs1:/tmp/cvs-serv21366 Modified Files: pydoc Log Message: Call main routine in pydoc module (pydoc.cli). Index: pydoc =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/pydoc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** pydoc 2001/02/28 20:55:10 1.1 --- pydoc 2001/03/01 00:25:40 1.2 *************** *** 1,78 **** #!/usr/bin/env python ! # -------------------------------------------------- command-line interface ! ! import sys, os, pydoc ! from string import lower ! ! if __name__ == '__main__': ! import getopt ! class BadUsage: pass ! ! try: ! opts, args = getopt.getopt(sys.argv[1:], 'k:p:w') ! writing = 0 ! ! for opt, val in opts: ! if opt == '-k': ! pydoc.apropos(lower(val)) ! break ! if opt == '-p': ! try: ! port = int(val) ! except ValueError: ! raise BadUsage ! def ready(port=port): ! print 'server ready at http://127.0.0.1:%d/' % port ! pydoc.serve(('127.0.0.1', port), ready) ! break ! if opt == '-w': ! if not args: raise BadUsage ! writing = 1 ! else: ! if args: ! for arg in args: ! try: ! if os.path.isfile(arg): ! arg = pydoc.importfile(arg) ! if writing: ! if os.path.isdir(arg): pydoc.writedocs(arg) ! else: pydoc.writedoc(arg) ! else: pydoc.man(arg) ! except pydoc.DocImportError, value: ! print 'problem in %s - %s' % ( ! value.filename, value.args) ! else: ! if sys.platform in ['mac', 'win', 'win32', 'nt']: ! # GUI platforms with threading ! import threading ! ready = threading.Event() ! address = ('127.0.0.1', 12346) ! threading.Thread( ! target=pydoc.serve, args=(address, ready.set)).start() ! ready.wait() ! import webbrowser ! webbrowser.open('http://127.0.0.1:12346/') ! else: ! raise BadUsage ! ! except (getopt.error, BadUsage): ! print """%s ... ! Show documentation on something. ! may be the name of a Python function, module, or package, ! or a dotted reference to a class or function within a module or ! module in a package, or the filename of a Python module to import. ! ! %s -k ! Search for a keyword in the synopsis lines of all modules. ! ! %s -p ! Start an HTTP server on the given port on the local machine. ! ! %s -w ... ! Write out the HTML documentation for a module to a file. ! ! %s -w ! Write out the HTML documentation for all modules in the tree ! under a given directory to files in the current directory. ! """ % ((sys.argv[0],) * 5) --- 1,4 ---- #!/usr/bin/env python ! import pydoc ! pydoc.cli() From gvanrossum@users.sourceforge.net Thu Mar 1 00:36:56 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 28 Feb 2001 16:36:56 -0800 Subject: [Python-checkins] CVS: python/dist/src Makefile.pre.in,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv23476 Modified Files: Makefile.pre.in Log Message: Use find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f to remove all .py[co] files before testing, rather than just those in the Lib/test directory. "find" is used all over the Makefile so I suppose it's safe; how about xargs? Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -r1.26 -r1.27 *** Makefile.pre.in 2001/02/27 19:07:02 1.26 --- Makefile.pre.in 2001/03/01 00:36:53 1.27 *************** *** 462,466 **** TESTPYTHON= ./$(PYTHON) -tt test: all platform ! -rm -f $(srcdir)/Lib/test/*.py[co] -PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) --- 462,466 ---- TESTPYTHON= ./$(PYTHON) -tt test: all platform ! -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f -PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) *************** *** 470,474 **** test_linuxaudiodev test_sunaudiodev quicktest: all platform ! -rm -f $(srcdir)/Lib/test/*.py[co] -PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS) PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS) --- 470,474 ---- test_linuxaudiodev test_sunaudiodev quicktest: all platform ! -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f -PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS) PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS) From jhylton@users.sourceforge.net Thu Mar 1 00:42:57 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Wed, 28 Feb 2001 16:42:57 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python compile.c,2.182,2.183 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv24539/Python Modified Files: compile.c Log Message: Don't add global names to st->st_global if we're already iterating over the elements of st->st_global! Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.182 retrieving revision 2.183 diff -C2 -r2.182 -r2.183 *** compile.c 2001/02/28 23:47:55 2.182 --- compile.c 2001/03/01 00:42:55 2.183 *************** *** 3976,3983 **** char buf[350]; sprintf(buf, ! "unknown scope for %.100s in %.100s(%s) in %s", name, c->c_name, PyObject_REPR(c->c_symtable->st_cur->ste_id), ! c->c_filename); Py_FatalError(buf); } --- 3976,3989 ---- char buf[350]; sprintf(buf, ! "unknown scope for %.100s in %.100s(%s) " ! "in %s\nsymbols: %s\nlocals: %s\nglobals: %s\n", name, c->c_name, PyObject_REPR(c->c_symtable->st_cur->ste_id), ! c->c_filename, ! PyObject_REPR(c->c_symtable->st_cur->ste_symbols), ! PyObject_REPR(c->c_locals), ! PyObject_REPR(c->c_globals) ! ); ! Py_FatalError(buf); } *************** *** 4330,4338 **** if (PyDict_SetItem(c->c_globals, name, implicit) < 0) - goto fail; - v = PyInt_FromLong(flags); - if (PyDict_SetItem(st->st_global, name, v)) goto fail; ! Py_DECREF(v); } } --- 4336,4347 ---- if (PyDict_SetItem(c->c_globals, name, implicit) < 0) goto fail; ! if (st->st_nscopes != 1) { ! v = PyInt_FromLong(flags); ! if (PyDict_SetItem(st->st_global, ! name, v)) ! goto fail; ! Py_DECREF(v); ! } } } From tim_one@users.sourceforge.net Thu Mar 1 01:30:58 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 28 Feb 2001 17:30:58 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python import.c,2.165,2.166 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv31512/python/dist/src/Python Modified Files: import.c Log Message: In Steven's apparent absence, check in *something* with a non-zero chance of making new-fangled Mac imports work again. May not work, and may not even compile on his boxes, but should be at worst very close on both. Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.165 retrieving revision 2.166 diff -C2 -r2.165 -r2.166 *** import.c 2001/02/28 05:57:51 2.165 --- import.c 2001/03/01 01:30:56 2.166 *************** *** 834,871 **** static int find_init_module(char *); /* Forward */ - #if 0 /* XXX was #ifdef HAVE_DIRENT_H; resolve whether we really need this */ - - static int MatchFilename(char *pathname, char *filename); - - #include - #include - - static int MatchFilename(char *pathname, char *filename) - { - DIR *dirp; - struct dirent *dp; - int len = strlen(filename); - - if ((pathname == NULL) || (strlen(pathname) == 0)) - pathname = "."; - dirp = opendir(pathname); - if (dirp) { - while ((dp = readdir(dirp)) != NULL) { - #ifdef _DIRENT_HAVE_D_NAMELINE - int namelen = dp->d_namlen; - #else /* !_DIRENT_HAVE_D_NAMELINE */ - int namelen = strlen(dp->d_name); - #endif /* _DIRENT_HAVE_D_NAMELINE */ - if (namelen == len && !strcmp(dp->d_name, filename)) { - (void)closedir(dirp); - return 1; /* Found */ - } - } - } - (void)closedir(dirp); - return 0 ; /* Not found */ - } - #endif /* HAVE_DIRENT_H */ - static struct filedescr * find_module(char *realname, PyObject *path, char *buf, size_t buflen, --- 834,837 ---- *************** *** 1037,1041 **** #if defined(MS_WIN32) || defined(__CYGWIN__) #include - #include #ifdef __CYGWIN__ #include --- 1003,1006 ---- *************** *** 1051,1054 **** --- 1016,1023 ---- #endif + #elif defined(__MACH__) && defined(__APPLE__) + #include + #include + #endif *************** *** 1138,1141 **** --- 1107,1146 ---- return fss.name[0] >= namelen && strncmp(name, (char *)fss.name+1, namelen) == 0; + + /* new-fangled macintosh */ + #elif defined(__MACH__) && defined(__APPLE__) + DIR *dirp; + struct dirent *dp; + char pathname[MAX_PATH + 1]; + const int pathlen = len - namelen - 1; /* don't want trailing SEP */ + + /* Copy the path component into pathname; substitute "." if empty */ + if (pathlen <= 0) { + pathname[0] = '.'; + pathname[1] = '\0'; + } + else { + assert(pathlen <= MAX_PATH); + memcpy(pathname, buf, pathlen); + pathname[pathlen] = '\0'; + } + /* Open the directory and search the entries for an exact match. */ + dirp = opendir(pathname); + if (dirp) { + while ((dp = readdir(dirp)) != NULL) { + #ifdef _DIRENT_HAVE_D_NAMELEN + const int thislen = dp->d_namlen; + #else + const int thislen = strlen(dp->d_name); + #endif + if (thislen == namelen && !strcmp(dp->d_name, name)) { + (void)closedir(dirp); + return 1; /* Found */ + } + } + } + (void)closedir(dirp); + return 0 ; /* Not found */ + } /* assuming it's a case-sensitive filesystem, so there's nothing to do! */ From tim_one@users.sourceforge.net Thu Mar 1 02:20:03 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 28 Feb 2001 18:20:03 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python import.c,2.166,2.167 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv4717/python/dist/src/Python Modified Files: import.c Log Message: Remove extra close curly in code #ifdef'ed out on my box. Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.166 retrieving revision 2.167 diff -C2 -r2.166 -r2.167 *** import.c 2001/03/01 01:30:56 2.166 --- import.c 2001/03/01 02:20:01 2.167 *************** *** 1142,1146 **** (void)closedir(dirp); return 0 ; /* Not found */ - } /* assuming it's a case-sensitive filesystem, so there's nothing to do! */ --- 1142,1145 ---- From tim_one@users.sourceforge.net Thu Mar 1 02:31:35 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 28 Feb 2001 18:31:35 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.129,1.130 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv5610/python/dist/src/Misc Modified Files: NEWS Log Message: Added blurbs about difflib, doctest and Windows import (PEP 235). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.129 retrieving revision 1.130 diff -C2 -r1.129 -r1.130 *** NEWS 2001/02/28 21:05:42 1.129 --- NEWS 2001/03/01 02:31:33 1.130 *************** *** 1,3 **** ! What's New in Python 2.1 alpha 507? =================================== --- 1,3 ---- ! What's New in Python 2.1 alpha 509? =================================== *************** *** 35,50 **** for interactively converting docstrings to HTML or text. Tools/scripts/pydoc, which is now automatically installed into ! /bin, uses pydoc.py to display documentation; try running 'pydoc' for the instructions. Windows changes ! - Build: Subproject _test (effectively) renamed to _testcapi. - winsound module: Under Win9x, winsound.Beep() now attempts to simulate what it's supposed to do (and does do under NT and 2000) via direct port manipulation. It's unknown whether this will work on all systems, ! but it does work on my Win98SE system now and was known to be useless on all Win9x systems before. --- 35,75 ---- for interactively converting docstrings to HTML or text. Tools/scripts/pydoc, which is now automatically installed into ! /bin, uses pydoc.py to display documentation; try running 'pydoc' for the instructions. + - New library module difflib.py, primarily packaging the SequenceMatcher + class at the heart of the popular ndiff.py file-comparison tool. + + - doctest.py (a framework for verifying Python code examples in docstrings) + is now part of the std library. + Windows changes ! - Import is now case-sensitive. PEP 235 (Import on Case-Insensitive ! Platforms) is implemented. See ! ! http://python.sourceforge.net/peps/pep-0235.html ! ! for full details, especially the "Current Lower-Left Semantics" section. ! The new Windows import rules are simpler than before: + A. If the PYTHONCASEOK environment variable exists, same as + before: silently accept the first case-insensitive match of any + kind; raise ImportError if none found. + + B. Else search sys.path for the first case-sensitive match; raise + ImportError if none found. + + The same rules have been implented on other platforms with case- + insensitive but case-preserving filesystems too (including Cygwin, and + several flavors of Macintosh operating systems). + - winsound module: Under Win9x, winsound.Beep() now attempts to simulate what it's supposed to do (and does do under NT and 2000) via direct port manipulation. It's unknown whether this will work on all systems, ! but it does work on my Win98SE systems now and was known to be useless on all Win9x systems before. + + - Build: Subproject _test (effectively) renamed to _testcapi. From tim_one@users.sourceforge.net Thu Mar 1 02:43:42 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 28 Feb 2001 18:43:42 -0800 Subject: [Python-checkins] CVS: python/dist/src/PCbuild BUILDno.txt,1.6,1.7 python20.wse,1.27,1.28 pythoncore.dsp,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv6565/python/dist/src/PCbuild Modified Files: BUILDno.txt python20.wse pythoncore.dsp Log Message: Prepare Windows for 2.1 beta 1: installer dialogs and bump "build number". Index: BUILDno.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/BUILDno.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** BUILDno.txt 2001/02/01 05:10:02 1.6 --- BUILDno.txt 2001/03/01 02:43:40 1.7 *************** *** 34,37 **** --- 34,39 ---- Windows Python BUILD numbers ---------------------------- + 11 2.1b1 + 28-Feb-2001 10 2.1a2 1-Feb-2001 Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -r1.27 -r1.28 *** python20.wse 2001/02/04 03:09:53 1.27 --- python20.wse 2001/03/01 02:43:40 1.28 *************** *** 2,6 **** item: Global Version=5.0 ! Title=Python 2.1 alpha 2 Flags=00010100 Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 --- 2,6 ---- item: Global Version=5.0 ! Title=Python 2.1 beta 1 Flags=00010100 Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 *************** *** 65,69 **** item: Set Variable Variable=APPTITLE ! Value=Python 2.1 alpha 2 end item: Set Variable --- 65,69 ---- item: Set Variable Variable=APPTITLE ! Value=Python 2.1 beta 1 end item: Set Variable *************** *** 73,77 **** item: Set Variable Variable=PY_VERSION ! Value=2.1a2 end item: Set Variable --- 73,77 ---- item: Set Variable Variable=PY_VERSION ! Value=2.1b1 end item: Set Variable Index: pythoncore.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/pythoncore.dsp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** pythoncore.dsp 2001/02/27 19:52:02 1.8 --- pythoncore.dsp 2001/03/01 02:43:40 1.9 *************** *** 740,748 **** !IF "$(CFG)" == "pythoncore - Win32 Release" ! # ADD CPP /D BUILD=10 !ELSEIF "$(CFG)" == "pythoncore - Win32 Debug" ! # ADD CPP /D BUILD=10 !ELSEIF "$(CFG)" == "pythoncore - Win32 Alpha Debug" --- 740,748 ---- !IF "$(CFG)" == "pythoncore - Win32 Release" ! # ADD CPP /D BUILD=11 !ELSEIF "$(CFG)" == "pythoncore - Win32 Debug" ! # ADD CPP /D BUILD=11 !ELSEIF "$(CFG)" == "pythoncore - Win32 Alpha Debug" From fdrake@users.sourceforge.net Thu Mar 1 03:06:05 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 28 Feb 2001 19:06:05 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib weakref.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv8774 Modified Files: weakref.py Log Message: Change WeakDictionary to WeakValueDictionary in a couple more places. WeakValueDictionary.copy(), WeakKeyDictionary.copy(): Actually return the copy! Index: weakref.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/weakref.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** weakref.py 2001/02/27 18:36:55 1.4 --- weakref.py 2001/03/01 03:06:03 1.5 *************** *** 32,37 **** # We inherit the constructor without worrying about the input # dictionary; since it uses our .update() method, we get the right ! # checks (if the other dictionary is a WeakDictionary, objects are ! # unwrapped on the way out, and we always wrap on the way in). def __getitem__(self, key): --- 32,38 ---- # We inherit the constructor without worrying about the input # dictionary; since it uses our .update() method, we get the right ! # checks (if the other dictionary is a WeakValueDictionary, ! # objects are unwrapped on the way out, and we always wrap on the ! # way in). def __getitem__(self, key): *************** *** 43,47 **** def __repr__(self): ! return "" % id(self) def __setitem__(self, key, value): --- 44,48 ---- def __repr__(self): ! return "" % id(self) def __setitem__(self, key, value): *************** *** 51,59 **** def copy(self): ! new = WeakDictionary() for key, ref in self.data.items(): o = ref() if o is not None: new[key] = o def get(self, key, default): --- 52,61 ---- def copy(self): ! new = WeakValueDictionary() for key, ref in self.data.items(): o = ref() if o is not None: new[key] = o + return new def get(self, key, default): *************** *** 140,143 **** --- 142,146 ---- if o is not None: new[o] = value + return new def get(self, key, default): From fdrake@users.sourceforge.net Thu Mar 1 03:06:55 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 28 Feb 2001 19:06:55 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_weakref.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv8838/test Modified Files: test_weakref.py Log Message: Add tests for the .copy() methods of both weak dictionary classes. Index: test_weakref.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_weakref.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** test_weakref.py 2001/02/27 18:36:56 1.2 --- test_weakref.py 2001/03/01 03:06:53 1.3 *************** *** 150,153 **** --- 150,160 ---- verify(o is dict[o.arg], "wrong object returned by weak dict!") + items1 = dict.items() + items2 = dict.copy().items() + items1.sort() + items2.sort() + verify(items1 == items2, + "cloning of weak-valued dictionary did not work!") + del items1, items2 dict.clear() print "weak dict test complete" *************** *** 166,170 **** verify(o.arg is dict[o], "wrong object returned by weak dict!") ! del objects,o verify(len(dict)==0, "deleting the keys did not clear the dictionary") print "weak key dict test complete" --- 173,184 ---- verify(o.arg is dict[o], "wrong object returned by weak dict!") ! items1 = dict.items() ! items2 = dict.copy().items() ! items1.sort() ! items2.sort() ! verify(items1 == items2, ! "cloning of weak-keyed dictionary did not work!") ! del items1, items2 ! del objects, o verify(len(dict)==0, "deleting the keys did not clear the dictionary") print "weak key dict test complete" From fdrake@users.sourceforge.net Thu Mar 1 03:28:10 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 28 Feb 2001 19:28:10 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules termios.c,2.15,2.16 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv10799 Modified Files: termios.c Log Message: Revised version of Jason Tishler's patch to make this compile on Cygwin, which does not define all the constants. This closes SF tracker patch #404924. Index: termios.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/termios.c,v retrieving revision 2.15 retrieving revision 2.16 diff -C2 -r2.15 -r2.16 *** termios.c 2001/02/27 21:22:39 2.15 --- termios.c 2001/03/01 03:28:08 2.16 *************** *** 318,322 **** --- 318,324 ---- {"B57600", B57600}, {"B115200", B115200}, + #ifdef B230400 {"B230400", B230400}, + #endif {"CBAUDEX", CBAUDEX}, *************** *** 396,400 **** --- 398,404 ---- {"HUPCL", HUPCL}, {"CLOCAL", CLOCAL}, + #ifdef CIBAUD {"CIBAUD", CIBAUD}, + #endif {"CRTSCTS", CRTSCTS}, *************** *** 408,412 **** --- 412,418 ---- {"ISIG", ISIG}, {"ICANON", ICANON}, + #ifdef XCASE {"XCASE", XCASE}, + #endif {"ECHO", ECHO}, {"ECHOE", ECHOE}, *************** *** 414,423 **** --- 420,433 ---- {"ECHONL", ECHONL}, {"ECHOCTL", ECHOCTL}, + #ifdef ECHOPRT {"ECHOPRT", ECHOPRT}, + #endif {"ECHOKE", ECHOKE}, {"FLUSHO", FLUSHO}, {"NOFLSH", NOFLSH}, {"TOSTOP", TOSTOP}, + #ifdef PENDIN {"PENDIN", PENDIN}, + #endif {"IEXTEN", IEXTEN}, From ping@users.sourceforge.net Thu Mar 1 03:55:37 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Wed, 28 Feb 2001 19:55:37 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib inspect.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv12913 Modified Files: inspect.py Log Message: Add getlineno() routine to account for LINENO optimization. Index: inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** inspect.py 2001/02/28 08:26:44 1.2 --- inspect.py 2001/03/01 03:55:35 1.3 *************** *** 561,566 **** filename = getsourcefile(frame) if context > 0: ! start = frame.f_lineno - 1 - context/2 try: lines, lnum = findsource(frame) --- 561,567 ---- filename = getsourcefile(frame) + lineno = getlineno(frame) if context > 0: ! start = lineno - 1 - context/2 try: lines, lnum = findsource(frame) *************** *** 568,572 **** start = min(start, len(lines) - context) lines = lines[start:start+context] ! index = frame.f_lineno - 1 - start except: lines = index = None --- 569,573 ---- start = min(start, len(lines) - context) lines = lines[start:start+context] ! index = lineno - 1 - start except: lines = index = None *************** *** 574,578 **** lines = index = None ! return (filename, frame.f_lineno, frame.f_code.co_name, lines, index) def getouterframes(frame, context=1): --- 575,594 ---- lines = index = None ! return (filename, lineno, frame.f_code.co_name, lines, index) ! ! def getlineno(frame): ! """Get the line number from a frame object, allowing for optimization.""" ! # Written by Marc-André Lemburg; revised by Jim Hugunin and Fredrik Lundh. ! lineno = frame.f_lineno ! code = frame.f_code ! if hasattr(code, 'co_lnotab'): ! table = code.co_lnotab ! lineno = code.co_firstlineno ! addr = 0 ! for i in range(0, len(table), 2): ! addr = addr + ord(table[i]) ! if addr > frame.f_lasti: break ! lineno = lineno + ord(table[i+1]) ! return lineno def getouterframes(frame, context=1): From montanaro@users.sourceforge.net Thu Mar 1 04:13:53 2001 From: montanaro@users.sourceforge.net (Skip Montanaro) Date: Wed, 28 Feb 2001 20:13:53 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib whichdb.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv14641 Modified Files: whichdb.py Log Message: move import into function to avoid having to add an __all__ list... Index: whichdb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/whichdb.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** whichdb.py 2000/08/04 08:46:59 1.8 --- whichdb.py 2001/03/01 04:13:51 1.9 *************** *** 1,6 **** """Guess which db package to use to open a db file.""" - import struct - def whichdb(filename): """Guess which db package to use to open a db file. --- 1,4 ---- *************** *** 15,18 **** --- 13,18 ---- database using that module may still fail. """ + + import struct # Check for dbm first -- this has a .pag and a .dir file From montanaro@users.sourceforge.net Thu Mar 1 04:27:21 2001 From: montanaro@users.sourceforge.net (Skip Montanaro) Date: Wed, 28 Feb 2001 20:27:21 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib tabnanny.py,1.11,1.12 telnetlib.py,1.10,1.11 tempfile.py,1.28,1.29 toaiff.py,1.9,1.10 tokenize.py,1.18,1.19 traceback.py,1.21,1.22 tty.py,1.4,1.5 urllib.py,1.119,1.120 urlparse.py,1.28,1.29 uu.py,1.15,1.16 warnings.py,1.6,1.7 wave.py,1.14,1.15 weakref.py,1.5,1.6 webbrowser.py,1.13,1.14 xdrlib.py,1.11,1.12 zipfile.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv15703 Modified Files: tabnanny.py telnetlib.py tempfile.py toaiff.py tokenize.py traceback.py tty.py urllib.py urlparse.py uu.py warnings.py wave.py weakref.py webbrowser.py xdrlib.py zipfile.py Log Message: final round of __all__ lists (I hope) - skipped urllib2 because Moshe may be giving it a slight facelift Index: tabnanny.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/tabnanny.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** tabnanny.py 2001/01/15 03:26:36 1.11 --- tabnanny.py 2001/03/01 04:27:19 1.12 *************** *** 17,20 **** --- 17,22 ---- import tokenize + __all__ = ["check"] + verbose = 0 filename_only = 0 Index: telnetlib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/telnetlib.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** telnetlib.py 2001/02/09 07:10:12 1.10 --- telnetlib.py 2001/03/01 04:27:19 1.11 *************** *** 42,45 **** --- 42,47 ---- import select + __all__ = ["Telnet"] + # Tunable parameters DEBUGLEVEL = 0 Index: tempfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/tempfile.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -r1.28 -r1.29 *** tempfile.py 2001/02/19 15:34:10 1.28 --- tempfile.py 2001/03/01 04:27:19 1.29 *************** *** 7,10 **** --- 7,12 ---- import os + __all__ = ["mktemp", "TemporaryFile", "tempdir", "gettempprefix"] + # Parameters that the caller may set to override the defaults tempdir = None Index: toaiff.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/toaiff.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** toaiff.py 2001/01/15 03:26:36 1.9 --- toaiff.py 2001/03/01 04:27:19 1.10 *************** *** 14,17 **** --- 14,19 ---- import sndhdr + __all__ = ["error", "toaiff"] + table = {} Index: tokenize.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/tokenize.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -r1.18 -r1.19 *** tokenize.py 2001/02/09 11:06:38 1.18 --- tokenize.py 2001/03/01 04:27:19 1.19 *************** *** 15,23 **** from token import * COMMENT = N_TOKENS tok_name[COMMENT] = 'COMMENT' NL = N_TOKENS + 1 tok_name[NL] = 'NL' ! # Changes from 1.3: --- 15,27 ---- from token import * + import token + __all__ = [x for x in dir(token) if x[0] != '_'] + ["COMMENT", "tokenize", "NL"] + del token + COMMENT = N_TOKENS tok_name[COMMENT] = 'COMMENT' NL = N_TOKENS + 1 tok_name[NL] = 'NL' ! N_TOKENS += 2 # Changes from 1.3: Index: traceback.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/traceback.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -r1.21 -r1.22 *** traceback.py 2001/02/10 00:22:33 1.21 --- traceback.py 2001/03/01 04:27:19 1.22 *************** *** 5,8 **** --- 5,13 ---- import types + __all__ = ['extract_stack', 'extract_tb', 'format_exception', + 'format_exception_only', 'format_list', 'format_stack', + 'format_tb', 'print_exc', 'print_exception', 'print_last', + 'print_stack', 'print_tb', 'tb_lineno'] + def _print(file, str='', terminator='\n'): file.write(str+terminator) Index: tty.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/tty.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** tty.py 2001/02/27 21:23:31 1.4 --- tty.py 2001/03/01 04:27:19 1.5 *************** *** 5,8 **** --- 5,10 ---- from termios import * + __all__ = ["setraw", "setcbreak"] + # Indexes for termios list. IFLAG = 0 Index: urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib.py,v retrieving revision 1.119 retrieving revision 1.120 diff -C2 -r1.119 -r1.120 *** urllib.py 2001/02/28 08:26:44 1.119 --- urllib.py 2001/03/01 04:27:19 1.120 *************** *** 29,32 **** --- 29,36 ---- import types + __all__ = ["urlopen", "URLopener", "FancyURLopener", "urlretrieve", + "urlcleanup", "quote", "quote_plus", "unquote", "unquote_plus", + "urlencode"] + __version__ = '1.15' # XXX This version is not always updated :-( Index: urlparse.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urlparse.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -r1.28 -r1.29 *** urlparse.py 2001/01/15 03:34:38 1.28 --- urlparse.py 2001/03/01 04:27:19 1.29 *************** *** 5,8 **** --- 5,10 ---- """ + __all__ = ["urlparse", "urlunparse", "urljoin"] + # A classification of schemes ('' means apply by default) uses_relative = ['ftp', 'http', 'gopher', 'nntp', 'wais', 'file', Index: uu.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/uu.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -r1.15 -r1.16 *** uu.py 2001/01/15 03:34:38 1.15 --- uu.py 2001/03/01 04:27:19 1.16 *************** *** 35,38 **** --- 35,40 ---- import sys + __all__ = ["Error", "encode", "decode"] + class Error(Exception): pass Index: warnings.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/warnings.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** warnings.py 2001/02/28 22:26:36 1.6 --- warnings.py 2001/03/01 04:27:19 1.7 *************** *** 3,6 **** --- 3,9 ---- import sys, re, types + __all__ = ["warn", "showwarning", "formatwarning", "filterwarnings", + "resetwarnings"] + defaultaction = "default" filters = [] Index: wave.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/wave.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** wave.py 2001/01/15 03:34:38 1.14 --- wave.py 2001/03/01 04:27:19 1.15 *************** *** 74,77 **** --- 74,79 ---- import __builtin__ + __all__ = ["open", "openfp", "Error"] + class Error(Exception): pass Index: weakref.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/weakref.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** weakref.py 2001/03/01 03:06:03 1.5 --- weakref.py 2001/03/01 04:27:19 1.6 *************** *** 20,23 **** --- 20,26 ---- ProxyTypes = (ProxyType, CallableProxyType) + __all__ = ["ref", "mapping", "proxy", "getweakrefcount", "getweakrefs", + "WeakKeyDictionary", "ReferenceType", "ProxyType", + "CallableProxyType", "ProxyTypes", "WeakValueDictionary"] def mapping(dict=None,weakkeys=0): Index: webbrowser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/webbrowser.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** webbrowser.py 2001/02/28 08:26:44 1.13 --- webbrowser.py 2001/03/01 04:27:19 1.14 *************** *** 4,7 **** --- 4,9 ---- import sys + __all__ = ["Error", "open", "get", "register"] + class Error(Exception): pass Index: xdrlib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xdrlib.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** xdrlib.py 2001/01/15 03:34:38 1.11 --- xdrlib.py 2001/03/01 04:27:19 1.12 *************** *** 7,10 **** --- 7,12 ---- import struct + __all__ = ["Error", "Packer", "Unpacker", "ConversionError"] + # exceptions class Error: Index: zipfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/zipfile.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** zipfile.py 2001/02/28 17:56:26 1.7 --- zipfile.py 2001/03/01 04:27:19 1.8 *************** *** 11,14 **** --- 11,17 ---- zlib = None + __all__ = ["BadZipfile", "error", "ZIP_STORED", "ZIP_DEFLATED", "is_zipfile", + "ZipInfo", "ZipFile", "PyZipFile"] + class BadZipfile(Exception): pass From montanaro@users.sourceforge.net Thu Mar 1 04:27:21 2001 From: montanaro@users.sourceforge.net (Skip Montanaro) Date: Wed, 28 Feb 2001 20:27:21 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test___all__.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv15703/test Modified Files: test___all__.py Log Message: final round of __all__ lists (I hope) - skipped urllib2 because Moshe may be giving it a slight facelift Index: test___all__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test___all__.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** test___all__.py 2001/02/18 14:44:42 1.16 --- test___all__.py 2001/03/01 04:27:19 1.17 *************** *** 136,137 **** --- 136,153 ---- check_all("sre") check_all("stat_cache") + check_all("tabnanny") + check_all("telnetlib") + check_all("tempfile") + check_all("toaiff") + check_all("tokenize") + check_all("traceback") + check_all("tty") + check_all("urllib") + check_all("urlparse") + check_all("uu") + check_all("warnings") + check_all("wave") + check_all("weakref") + check_all("webbrowser") + check_all("xdrlib") + check_all("zipfile") From fdrake@users.sourceforge.net Thu Mar 1 06:01:22 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 28 Feb 2001 22:01:22 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc Makefile,1.210,1.211 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory usw-pr-cvs1:/tmp/cvs-serv25691/Doc Modified Files: Makefile Log Message: Bump the release number to 2.1b1. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile,v retrieving revision 1.210 retrieving revision 1.211 diff -C2 -r1.210 -r1.211 *** Makefile 2001/02/28 22:59:37 1.210 --- Makefile 2001/03/01 06:01:20 1.211 *************** *** 68,72 **** # This is the *documentation* release, and is used to construct the file # names of the downloadable tarballs. ! RELEASE=2.1a2 PYTHON= python --- 68,72 ---- # This is the *documentation* release, and is used to construct the file # names of the downloadable tarballs. ! RELEASE=2.1b1 PYTHON= python From jhylton@users.sourceforge.net Thu Mar 1 06:06:39 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Wed, 28 Feb 2001 22:06:39 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects funcobject.c,2.35,2.36 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv26139/Objects Modified Files: funcobject.c Log Message: Visit the closure during traversal and XDECREF it on during deallocation. Index: funcobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/funcobject.c,v retrieving revision 2.35 retrieving revision 2.36 diff -C2 -r2.35 -r2.36 *** funcobject.c 2001/02/28 02:42:56 2.35 --- funcobject.c 2001/03/01 06:06:37 2.36 *************** *** 253,256 **** --- 253,257 ---- Py_XDECREF(op->func_doc); Py_XDECREF(op->func_dict); + Py_XDECREF(op->func_closure); op = (PyFunctionObject *) PyObject_AS_GC(op); PyObject_DEL(op); *************** *** 301,304 **** --- 302,310 ---- if (f->func_dict) { err = visit(f->func_dict, arg); + if (err) + return err; + } + if (f->func_closure) { + err = visit(f->func_closure, arg); if (err) return err; From jhylton@users.sourceforge.net Thu Mar 1 06:09:36 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Wed, 28 Feb 2001 22:09:36 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python compile.c,2.183,2.184 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv26299/Python Modified Files: compile.c Log Message: Fix core dump in example from Samuele Pedroni: from __future__ import nested_scopes x=7 def f(): x=1 def g(): global x def i(): def h(): return x return h() return i() return g() print f() print x This kind of code didn't work correctly because x was treated as free in i, leading to an attempt to load x in g to make a closure for i. Solution is to make global decl apply to nested scopes unless their is an assignment. Thus, x in h is global. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.183 retrieving revision 2.184 diff -C2 -r2.183 -r2.184 *** compile.c 2001/03/01 00:42:55 2.183 --- compile.c 2001/03/01 06:09:34 2.184 *************** *** 180,183 **** --- 180,185 ---- } + /* XXX code objects need to participate in GC? */ + PyTypeObject PyCode_Type = { PyObject_HEAD_INIT(&PyType_Type) *************** *** 2133,2138 **** arg = com_lookup_arg(c->c_freevars, name); if (arg == -1) { ! fprintf(stderr, "lookup %s in %s %d %d\n", ! PyObject_REPR(name), c->c_name, reftype, arg); Py_FatalError("com_make_closure()"); } --- 2135,2145 ---- arg = com_lookup_arg(c->c_freevars, name); if (arg == -1) { ! fprintf(stderr, "lookup %s in %s %d %d\n" ! "freevars of %s: %s\n", ! PyObject_REPR(name), ! c->c_name, ! reftype, arg, ! PyString_AS_STRING(co->co_name), ! PyObject_REPR(co->co_freevars)); Py_FatalError("com_make_closure()"); } *************** *** 4425,4430 **** PyList_GET_ITEM(ste->ste_children, i); while (PyDict_Next(child->ste_symbols, &pos, &name, &o)) { ! int v = PyInt_AS_LONG(o); ! if (!(is_free(v))) continue; /* avoids indentation */ if (list == NULL) { --- 4432,4437 ---- PyList_GET_ITEM(ste->ste_children, i); while (PyDict_Next(child->ste_symbols, &pos, &name, &o)) { ! int flags = PyInt_AS_LONG(o); ! if (!(is_free(flags))) continue; /* avoids indentation */ if (list == NULL) { *************** *** 4439,4454 **** } } - /* - if (st->st_nested_scopes == 0 - && list && PyList_GET_SIZE(list) > 0) { - fprintf(stderr, "function %s has children with " - "the following free vars:\n%s\n", - PyString_AS_STRING(ste->ste_name), - PyObject_REPR(list)); - continue; - } - */ for (j = 0; list && j < PyList_GET_SIZE(list); j++) { name = PyList_GET_ITEM(list, j); if (ste->ste_nested) { if (symtable_add_def_o(st, ste->ste_symbols, --- 4446,4467 ---- } } for (j = 0; list && j < PyList_GET_SIZE(list); j++) { + PyObject *v; name = PyList_GET_ITEM(list, j); + v = PyDict_GetItem(ste->ste_symbols, name); + /* If a name N is declared global in scope A and + referenced in scope B contained (perhaps + indirectly) in A and there are no scopes + with bindings for N between B and A, then N + is global in B. + */ + if (v) { + int flags = PyInt_AS_LONG(v); + if (flags & DEF_GLOBAL) { + symtable_undo_free(st, child->ste_id, + name); + continue; + } + } if (ste->ste_nested) { if (symtable_add_def_o(st, ste->ste_symbols, *************** *** 4482,4486 **** int v; PySymtableEntryObject *ste = st->st_cur; ! if (ste->ste_type == TYPE_CLASS) return symtable_undo_free(st, child, name); --- 4495,4499 ---- int v; PySymtableEntryObject *ste = st->st_cur; ! if (ste->ste_type == TYPE_CLASS) return symtable_undo_free(st, child, name); *************** *** 4489,4492 **** --- 4502,4506 ---- return symtable_undo_free(st, child, name); v = PyInt_AS_LONG(o); + if (is_free(v) || (v & DEF_GLOBAL)) return symtable_undo_free(st, child, name); *************** *** 4507,4510 **** --- 4521,4525 ---- if (ste == NULL) return -1; + info = PyDict_GetItem(ste->ste_symbols, name); if (info == NULL) *************** *** 4939,4942 **** --- 4954,4958 ---- if (st->st_nscopes == 1) { + /* XXX must check that we are compiling file_input */ if (symtable_warn(st, "global statement has no meaning at module level") < 0) From fdrake@users.sourceforge.net Thu Mar 1 06:33:34 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 28 Feb 2001 22:33:34 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python import.c,2.167,2.168 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv28944 Modified Files: import.c Log Message: Suppress a compiler warning under OpenVMS; time_t is unsigned on (at least) the more recent versions of that platform, so we use the value (time_t)(-1) as the error value. This is the type used in the OpenVMS documentation: http://www.openvms.compaq.com/commercial/c/5763p048.htm#inde This closes SF tracker bug #404240. Also clean up an exception message when detecting overflow of time_t values beyond 4 bytes. Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.167 retrieving revision 2.168 diff -C2 -r2.167 -r2.168 *** import.c 2001/03/01 02:20:01 2.167 --- import.c 2001/03/01 06:33:32 2.168 *************** *** 703,707 **** mtime = PyOS_GetLastModificationTime(pathname, fp); ! if (mtime == -1) return NULL; #if SIZEOF_TIME_T > 4 --- 703,707 ---- mtime = PyOS_GetLastModificationTime(pathname, fp); ! if (mtime == (time_t)(-1)) return NULL; #if SIZEOF_TIME_T > 4 *************** *** 712,716 **** if (mtime >> 32) { PyErr_SetString(PyExc_OverflowError, ! "modification time overflows a 4 bytes"); return NULL; } --- 712,716 ---- if (mtime >> 32) { PyErr_SetString(PyExc_OverflowError, ! "modification time overflows a 4 byte field"); return NULL; } From thomas@xs4all.net Thu Mar 1 07:21:22 2001 From: thomas@xs4all.net (Thomas Wouters) Date: Thu, 1 Mar 2001 08:21:22 +0100 Subject: [Python-checkins] CVS: python/dist/src Makefile.pre.in,1.26,1.27 In-Reply-To: ; from gvanrossum@users.sourceforge.net on Wed, Feb 28, 2001 at 04:36:56PM -0800 References: Message-ID: <20010301082122.H9678@xs4all.nl> On Wed, Feb 28, 2001 at 04:36:56PM -0800, Guido van Rossum wrote: > "find" is used all over the Makefile so I suppose it's safe; how about > xargs? I remember seeing 'xargs' on the old Atari MiNT UNIX-alike system eons ago. (In fact, that's where I learned to use it ;) Since we now require an ANSI C compiler, I do not see the requirement of 'xargs' for testing as a problem. If it ends up being a problem after all, we can provide a replacement script. -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From tim_one@users.sourceforge.net Thu Mar 1 08:31:42 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 01 Mar 2001 00:31:42 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_future.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv12379/python/dist/src/Lib/test Modified Files: test_future.py Log Message: Whitespace normalization. Index: test_future.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_future.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** test_future.py 2001/02/28 17:48:06 1.1 --- test_future.py 2001/03/01 08:31:39 1.2 *************** *** 43,45 **** except SyntaxError, msg: check_error_location(str(msg)) - --- 43,44 ---- From moshez@users.sourceforge.net Thu Mar 1 08:40:44 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Thu, 01 Mar 2001 00:40:44 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib urllib2.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv12219/Lib Modified Files: urllib2.py Log Message: Checking in patch 404826 -- urllib2 enhancements and documentations. (please not that the library reference does *not* include the urllib2 documnetation -- that will wiat for Fred) Index: urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** urllib2.py 2001/02/09 10:55:20 1.8 --- urllib2.py 2001/03/01 08:40:42 1.9 *************** *** 58,63 **** authinfo.add_password('realm', 'host', 'username', 'password') # build a new opener that adds authentication and caching FTP handlers ! opener = urllib2.build_opener(authinfo, urllib2.CacheFTPHandler) # install it --- 58,65 ---- authinfo.add_password('realm', 'host', 'username', 'password') + proxy_support = urllib2.ProxyHandler({"http" : "http://ahad-haam:3128"}) + # build a new opener that adds authentication and caching FTP handlers ! opener = urllib2.build_opener(proxy_support, authinfo, urllib2.CacheFTPHandler) # install it *************** *** 93,97 **** import types import urlparse - import os import md5 import mimetypes --- 95,98 ---- *************** *** 101,104 **** --- 102,106 ---- import time import gopherlib + import posixpath try: *************** *** 122,129 **** # support for FileHandler ! from urllib import localhost, thishost, url2pathname, pathname2url ! ! # support for GopherHandler ! from urllib import splitgophertype, splitquery __version__ = "2.0a1" --- 124,128 ---- # support for FileHandler ! from urllib import localhost, url2pathname __version__ = "2.0a1" *************** *** 178,182 **** --- 177,183 ---- pass + class Request: + def __init__(self, url, data=None, headers={}): # unwrap('') --> 'type://host/path' *************** *** 230,242 **** return self.__r_host ! def set_proxy(self, proxy): ! self.__proxy = proxy ! # XXX this code is based on urllib, but it doesn't seem ! # correct. specifically, if the proxy has a port number then ! # splittype will return the hostname as the type and the port ! # will be include with everything else ! self.type, self.__r_type = splittype(self.__proxy) ! self.host, XXX = splithost(self.__r_type) ! self.host = unquote(self.host) self.__r_host = self.__original --- 231,236 ---- return self.__r_host ! def set_proxy(self, host, type): ! self.host, self.type = host, type self.__r_host = self.__original *************** *** 330,336 **** def error(self, proto, *args): ! if proto == 'http': ! # XXX http protocol is special cased ! dict = self.handle_error[proto] proto = args[2] # YUCK! meth_name = 'http_error_%d' % proto --- 324,330 ---- def error(self, proto, *args): ! if proto in ['http', 'https']: ! # XXX http[s] protocols are special cased ! dict = self.handle_error['http'] # https is not different then http proto = args[2] # YUCK! meth_name = 'http_error_%d' % proto *************** *** 398,401 **** --- 392,397 ---- HTTPDefaultErrorHandler, HTTPRedirectHandler, FTPHandler, FileHandler] + if hasattr(httplib, 'HTTPS'): + default_classes.append(HTTPSHandler) skip = [] for klass in default_classes: *************** *** 452,456 **** new.error_302_dict = {} if hasattr(req, 'error_302_dict'): ! if req.error_302_dict.has_key(newurl): raise HTTPError(req.get_full_url(), code, self.inf_msg + msg, headers) --- 448,452 ---- new.error_302_dict = {} if hasattr(req, 'error_302_dict'): ! if len(error_302_dict)>10 or req.error_302_dict.has_key(newurl): raise HTTPError(req.get_full_url(), code, self.inf_msg + msg, headers) *************** *** 478,482 **** def proxy_open(self, req, proxy, type): orig_type = req.get_type() ! req.set_proxy(proxy) if orig_type == type: # let other handlers take care of it --- 474,485 ---- def proxy_open(self, req, proxy, type): orig_type = req.get_type() ! type, r_type = splittype(proxy) ! host, XXX = splithost(r_type) ! if '@' in host: ! user_pass, host = host.split('@', 1) ! user_pass = base64.encode_string(unquote(user_passw)).strip() ! req.addheader('Proxy-Authorization', user_pass) ! host = unquote(host) ! req.set_proxy(host, type) if orig_type == type: # let other handlers take care of it *************** *** 570,580 **** if base[0] != test[0]: return 0 ! common = os.path.commonprefix((base[1], test[1])) if len(common) == len(base[1]): return 1 return 0 - class HTTPBasicAuthHandler(BaseHandler): rx = re.compile('[ \t]*([^ \t]+)[ \t]+realm="([^"]*)"') --- 573,593 ---- if base[0] != test[0]: return 0 ! common = posixpath.commonprefix((base[1], test[1])) if len(common) == len(base[1]): return 1 return 0 + + class HTTPPasswordMgrWithDefaultRealm(HTTPPasswordMgr): + + def find_user_password(self, realm, authuri): + user, password = HTTPPasswordMgr.find_user_password(self,realm,authuri) + if user is not None: + return user, password + return HTTPPasswordMgr.find_user_password(self, None, authuri) + + + class AbstractBasicAuthHandler: rx = re.compile('[ \t]*([^ \t]+)[ \t]+realm="([^"]*)"') *************** *** 583,588 **** # in parsing them to extract multiple alternatives ! def __init__(self): ! self.passwd = HTTPPasswordMgr() self.add_password = self.passwd.add_password self.__current_realm = None --- 596,603 ---- # in parsing them to extract multiple alternatives ! def __init__(self, password_mgr=None): ! if password_mgr is None: ! password_mgr = HTTPPasswordMgr() ! self.passwd = password_mgr self.add_password = self.passwd.add_password self.__current_realm = None *************** *** 592,606 **** # return. ! def http_error_401(self, req, fp, code, msg, headers): ! # XXX could be mult. headers ! authreq = headers.get('www-authenticate', None) if authreq: ! mo = HTTPBasicAuthHandler.rx.match(authreq) if mo: scheme, realm = mo.groups() if scheme.lower() == 'basic': ! return self.retry_http_basic_auth(req, realm) ! def retry_http_basic_auth(self, req, realm): if self.__current_realm is None: self.__current_realm = realm --- 607,621 ---- # return. ! def http_error_auth_reqed(self, authreq, host, req, headers): ! # XXX could be multiple headers ! authreq = headers.get(authreq, None) if authreq: ! mo = AbstractBasicAuthHandler.rx.match(authreq) if mo: scheme, realm = mo.groups() if scheme.lower() == 'basic': ! return self.retry_http_basic_auth(host, req, realm) ! def retry_http_basic_auth(self, host, req, realm): if self.__current_realm is None: self.__current_realm = realm *************** *** 608,618 **** self.__current_realm = realm return None - # XXX host isn't really the correct URI? - host = req.get_host() user,pw = self.passwd.find_user_password(realm, host) if pw: raw = "%s:%s" % (user, pw) auth = base64.encodestring(raw).strip() ! req.add_header('Authorization', 'Basic %s' % auth) resp = self.parent.open(req) self.__current_realm = None --- 623,631 ---- self.__current_realm = realm return None user,pw = self.passwd.find_user_password(realm, host) if pw: raw = "%s:%s" % (user, pw) auth = base64.encodestring(raw).strip() ! req.add_header(self.header, 'Basic %s' % auth) resp = self.parent.open(req) self.__current_realm = None *************** *** 622,640 **** return None ! class HTTPDigestAuthHandler(BaseHandler): ! """An authentication protocol defined by RFC 2069 ! Digest authentication improves on basic authentication because it ! does not transmit passwords in the clear. ! """ ! def __init__(self): ! self.passwd = HTTPPasswordMgr() self.add_password = self.passwd.add_password self.__current_realm = None ! def http_error_401(self, req, fp, code, msg, headers): ! # XXX could be mult. headers ! authreq = headers.get('www-authenticate', None) if authreq: kind = authreq.split()[0] --- 635,669 ---- return None ! class HTTPBasicAuthHandler(AbstractBasicAuthHandler, BaseHandler): ! header = 'Authorization' ! def http_error_401(self, req, fp, code, msg, headers): ! host = urlparse.urlparse(req.get_full_url())[1] ! return self.http_error_auth_reqed('www-authenticate', ! host, req, headers) ! ! ! class ProxyBasicAuthHandler(AbstractBasicAuthHandler, BaseHandler): ! ! header = 'Proxy-Authorization' ! ! def http_error_407(self, req, fp, code, msg, headers): ! host = req.get_host() ! return self.http_error_auth_reqed('proxy-authenticate', ! host, req, headers) ! ! ! class AbstractDigestAuthHandler: ! ! def __init__(self, passwd=None): ! if passwd is None: ! passwd = HTTPPassowrdMgr() ! self.passwd = passwd self.add_password = self.passwd.add_password self.__current_realm = None ! def http_error_auth_reqed(self, authreq, host, req, headers): ! authreq = headers.get(self.header, None) if authreq: kind = authreq.split()[0] *************** *** 647,651 **** auth = self.get_authorization(req, chal) if auth: ! req.add_header('Authorization', 'Digest %s' % auth) resp = self.parent.open(req) self.__current_realm = None --- 676,680 ---- auth = self.get_authorization(req, chal) if auth: ! req.add_header(self.header, 'Digest %s' % auth) resp = self.parent.open(req) self.__current_realm = None *************** *** 716,719 **** --- 745,772 ---- return None + + class HTTPDigestAuthHandler(BaseHandler, AbstractDigestAuthHandler): + """An authentication protocol defined by RFC 2069 + + Digest authentication improves on basic authentication because it + does not transmit passwords in the clear. + """ + + header = 'Authorization' + + def http_error_401(self, req, fp, code, msg, headers): + host = urlparse.urlparse(req.get_full_url())[1] + self.http_error_auth_reqed('www-authenticate', host, req, headers) + + + class ProxyDigestAuthHandler(BaseHandler, AbstractDigestAuthHandler): + + header = 'Proxy-Authorization' + + def http_error_407(self, req, fp, code, msg, headers): + host = req.get_host() + self.http_error_auth_reqed('proxy-authenticate', host, req, headers) + + def encode_digest(digest): hexrep = [] *************** *** 726,732 **** ! class HTTPHandler(BaseHandler): ! def http_open(self, req): ! # XXX devise a new mechanism to specify user/password host = req.get_host() if not host: --- 779,785 ---- ! class AbstractHTTPHandler(BaseHandler): ! ! def do_open(self, http_class, req): host = req.get_host() if not host: *************** *** 734,738 **** try: ! h = httplib.HTTP(host) # will parse host:port if req.has_data(): data = req.get_data() --- 787,791 ---- try: ! h = http_class(host) # will parse host:port if req.has_data(): data = req.get_data() *************** *** 762,765 **** --- 815,832 ---- else: return self.parent.error('http', req, fp, code, msg, hdrs) + + + class HTTPHandler(AbstractHTTPHandler): + + def http_open(self, req): + return self.do_open(httplib.HTTP, req) + + + if hasattr(httplib, 'HTTPS'): + class HTTPSHandler(AbstractHTTPHandler): + + def https_open(self, req): + return self.do_open(httplib.HTTPS, req) + class UnknownHandler(BaseHandler): From moshez@users.sourceforge.net Thu Mar 1 08:40:44 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Thu, 01 Mar 2001 00:40:44 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib liburllib2.tex,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv12219/Doc/lib Added Files: liburllib2.tex Log Message: Checking in patch 404826 -- urllib2 enhancements and documentations. (please not that the library reference does *not* include the urllib2 documnetation -- that will wiat for Fred) --- NEW FILE: liburllib2.tex --- \section{\module{urllib2} --- extensible library for opening URLs} \declaremodule{standard}{urllib2} \moduleauthor{Jeremy Hylton}{jhylton@users.sourceforge.net} \sectionauthor{Moshe Zadka}{moshez@users.sourceforge.net} \modulesynopsis{An extensible library for opening URLs using a variety of protocols} The \module{urllib2} module defines functions and classes which help in opening URLs (mostly HTTP) in a complex world -- basic and digest authentication, redirections and more. The \module{urllib2} module defines the following functions: \begin{funcdesc}{urlopen}{url\optional{, data}} Open the url \var{url}, which can either a string or a \class{Request} object (currently the code checks that it really is a \class{Request} instance, or an instance of a subclass of \class{Request}. \var{data} should be a string, which specifies additional data to send to the server. In HTTP requests, which are the only ones that support \var{data}, it should be a buffer in the format of \code{application/x-www-form-urlencoded}, for example one returned from \function{urllib.urlencode}. This function returns a file-like object with two additional methods: \begin{itemize} \item \code{geturl()} --- return the URL of the resource retrieved \item \code{info()} --- return the meta-information of the page, as a dictionary-like object \end{itemize} Raises \exception{URLError} on errors. \end{funcdesc} \begin{funcdesc}{install_opener}{opener} Install a \class{OpenerDirector} instance as the default opener. The code does not check for a real \class{OpenerDirector}, and any class with the appropriate interface will work. \end{funcdesc} \begin{funcdesc}{build_opener}{\optional{handler\optional{, handler\optional{, ...}}}} Return an \class{OpenerDirector} instance, which chains the handlers in the order given. \var{handler}s can be either instances of \class{BaseHandler}, or subclasses of \class{BaseHandler} (in which case it must be possible to call the constructor without any parameters. Instances of the following classes will be in the front of the \var{handler}s, unless the \var{handler}s contain them, instances of them or subclasses of them: \code{ProxyHandler, UnknownHandler, HTTPHandler, HTTPDefaultErrorHandler, HTTPRedirectHandler, FTPHandler, FileHandler} If the Python installation has SSL support (\code{socket.ssl} exists), \class{HTTPSHandler} will also be added. \end{funcdesc} \begin{excdesc}{URLError} The error handlers raise when they run into a problem. It is a subclass of \exception{IOError}. \end{excdesc} \begin{excdesc}{HTTPError} A subclass of \exception{URLError}, it can also function as a non-exceptional file-like return value (the same thing that \function{urlopen} returns). This is useful when handling exotic HTTP errors, such as requests for authentications. \end{excdesc} \begin{excdesc}{GopherError} A subclass of \exception{URLError}, this is the error raised by the Gopher handler. \end{excdesc} \begin{classdesc}{Request}{url\optional{data, \optional{, headers}}} This class is an abstraction of a URL request. \var{url} should be a string which is a valid URL. For descrtion of \var{data} see the \method{add_data} description. \var{headers} should be a dictionary, and will be treated as if \method{add_header} was called with each key and value as arguments. \end{classdesc} The following methods describe all of \class{Request}'s public interface, and so all must be overridden in subclasses. \begin{methoddesc}[Request]{add_data}{data} Set the \class{Request} data to \var{data} is ignored by all handlers except HTTP handlers --- and there it should be an \code{application/x-www-form-encoded} buffer, and will change the request to be \code{POST} rather then \code{GET}. \end{methoddesc} \begin{methoddesc}[Request]{has_data}{data} Return whether the instance has a non-\code{None} data. \end{methoddesc} \begin{methoddesc}[Request]{get_data}{data} Return the instance's data. \end{methoddesc} \begin{methoddesc}[Request]{add_header}{key, val} Add another header to the request. Headers are currently ignored by all handlers except HTTP handlers, where they are added to the list of headers sent to the server. Note that there cannot be more then one header with the same name, and later calls will overwrite previous calls in case the \var{key} collides. Currently, this is no loss of HTTP functionality, since all headers which have meaning when used more then once have a (header-specific) way of gaining the same functionality using only one header. \end{methoddesc} \begin{methoddesc}[Request]{get_full_url}{} Return the URL given in the constructor. \end{methoddesc} \begin{methoddesc}[Request]{get_type}{} Return the type of the URL --- also known as the schema. \end{methoddesc} \begin{methoddesc}[Request]{get_host}{} Return the host to which connection will be made. \end{methoddesc} \begin{methoddesc}[Request]{get_selector}{} Return the selector --- the part of the URL that is sent to the server. \end{methoddesc} \begin{methoddesc}[Request]{set_proxy}{host, type} Make the request by connecting to a proxy server. The \var{host} and \var{type} will replace those of the instance, and the instance's selector will be the original URL given in the constructor. \end{methoddesc} \begin{classdesc}{OpenerDirector}{} The \class{OpenerDirector} class opens URLs via \class{BaseHandler}s chained together. It manages the chaining of handlers, and recovery from errors. \end{classdesc} \begin{methoddesc}[OpenerDirector]{add_handler}{handler} \var{handler} should be an instance of \class{BaseHandler}. The following methods are searched, and added to the possible chains. \begin{itemize} \item \code{{\em protocol}_open} --- signal that the handler knows how to open {\em protocol} URLs. \item \code{{\em protocol}_error_{\em type}} -- signal that the handler knows how to handle {\em type} errors from {\em protocol}. \end{itemize} \end{methoddesc} \begin{methoddesc}[OpenerDirector]{close}{} Explicitly break cycles, and delete all the handlers. Because the \class{OpenerDirector} needs to know the registered handlers, and a handler needs to know who the \class{OpenerDirector} who called it is, there is a reference cycles. Even though recent versions of Python have cycle-collection, it is sometimes preferable to explicitly break the cycles. \end{methoddesc} \begin{methoddesc}[OpenerDirector]{open}{url\optional{, data}} Open the given \var{url}. (which can be a request object or a string), optionally passing the given \var{data}. Arguments, return values and exceptions raised are the same as those of \function{urlopen} (which simply calls the \method{open()} method on the default installed \class{OpenerDirector}. \end{methoddesc} \begin{methoddesc}[OpenerDirector]{error}{proto\optional{, arg\optional{, ...}}} Handle an error in a given protocol. The HTTP protocol is special cased to use the code as the error. This will call the registered error handlers for the given protocol with the given arguments (which are protocol specific). Return values and exceptions raised are the same as those of \function{urlopen}. \end{methoddesc} \begin{classdesc}{BaseHandler}{} This is the base class for all registered handlers --- and handles only the simple mechanics of registration. \end{classdesc} \begin{methoddesc}[BaseHandler]{add_parent}{director} Add a director as parent. \end{methoddesc} \begin{methoddesc}[BaseHandler]{close}{} Remove any parents. \end{methoddesc} The following members and methods should be used only be classes derived from \class{BaseHandler}: \begin{memberdesc}[BaseHandler]{parent} A valid \class{OpenerDirector}, which can be used to open using a different protocol, or handle errors. \end{memberdesc} \begin{methoddesc}[BaseHandler]{default_open}{req} This method is {\em not} defined in \class{BaseHandler}, but subclasses should define it if they want to catch all URLs. This method, if exists, will be called by the \member{parent} \class{OpenerDirector}. It should return a file-like object as described in the return value of the \method{open} of \class{OpenerDirector} or \code{None}. It should raise \exception{URLError}, unless a truly exceptional thing happens (for example, \exception{MemoryError} should not be mapped to \exception{URLError}. This method will be called before any protocol-specific open method. \end{methoddesc} \begin{methoddesc}[BaseHandler]{{\em protocol}_open}{req} This method is {\em not} defined in \class{BaseHandler}, but subclasses should define it if they want to handle URLs with the given protocol. This method, if exists, will be called by the \member{parent} \class{OpenerDirector}. Return values should be the same as for \method{default_open}. \end{methoddesc} \begin{methoddesc}[BaseHandler]{unknown_open}{req} This method is {\em not} defined in \class{BaseHandler}, but subclasses should define it if they want to catch all URLs with no specific registerd handler to open it. This method, if exists, will be called by the \member{parent} \class{OpenerDirector}. Return values should be the same as for \method{default_open}. \end{methoddesc} \begin{methoddesc}[BaseHandler]{http_error_default}{req, fp, code, msg, hdrs} This method is {\em not} defined in \class{BaseHandler}, but subclasses should override it if they intend to provide a catch-all for otherwise unhandled HTTP errors. It will be called automatically by the \class{OpenerDirector} getting the error, and should not normally be called in other circumstances. \var{req} will be a \class{Request} object, \var{fp} will be a file-like object with the HTTP error body, \var{code} will be the three-digit code of the error, \var{msg} will be the user-visible explanation of the code and \var{hdrs} will be a dictionary-like object with the headers of the error. Return values and exceptions raised should be the same as those of \function{urlopen}. \end{methoddesc} \begin{methoddesc}[BaseHandler]{http_error_{\em nnn}}{req, fp, code, msg, hdrs} \code{nnn} should be a three-digit HTTP error code. This method is also not defined in \class{BaseHandler}, but will be called, if it exists, on an instance of a subclass, when an HTTP error with code \code{nnn} occurse. Subclasses should override this method to handle specific HTTP errors. Arguments, return values and exceptions raised shoudl be the same as for \method{http_error_default} \end{methoddesc} \begin{classdesc}{HTTPDefaultErrorHandler}{} A class which catches all HTTP errors. \end{classdesc} \begin{methoddesc}[HTTPDefaultErrorHandler]{http_error_default}{req, fp, code, msg, hdrs} Raise an \exception{HTTPError} \end{methoddesc} \begin{classdesc}{HTTPRedirectHandler}{} A class to handle redirections. \end{classdesc} \begin{methoddesc}[HTTPRedirectHandler]{http_error_301}{req, fp, code, msg, hdrs} Redirect to the \code{Location:} URL. This method gets called by the parent \class{OpenerDirector} when getting an HTTP permanent-redirect error. \end{methoddesc} \begin{methoddesc}[HTTPRedirectHandler]{http_error_302}{req, fp, code, msg, hdrs} The same as \method{http_error_301}. \end{methoddesc} \strong{Note:} 303 redirection is not supported by this version of \module{urllib2}. \begin{classdesc}{ProxyHandler}{\optional{proxies}} Cause requests to go through a proxy. If \var{proxies} is given, it must be a dictionary mapping protocol names to URLs of proxies. The default is to read the list of proxies from the environment variables \code{{\em protocol}_proxy}. \end{classdesc} \begin{methoddesc}[ProxyHandler]{{\em protocol}_open}{request} The \class{ProxyHandler} will have a method \code{{\em protocol}_open} for every {\em protocol} which has a proxy in the \var{proxies} dictionary given in the constructor. The method will modify requests to go through the proxy, by calling \code{request.set_proxy()}, and call the next handler in the chain to actually execute the protocol. \end{methoddesc} \begin{classdesc}{HTTPPasswordMgr}{} Keep a database of \code{(\var{realm}, \var{uri}) -> (\var{user}, \var{password})} mapping. \end{classdesc} \begin{methoddesc}[HTTPPasswordMgr]{add_password}{realm, uri, user, passwd} \var{uri} can be either a single URI, or a sequene of URIs. \var{realm}, \var{user} and \var{passwd} must be strings. This causes \code{(\var{user}, \var{passwd})} to be used as authentication tokens when authentication for \var{realm} and a super-URI of any of the given URIs is given. \end{methoddesc} \begin{methoddesc}[HTTPPasswordMgr]{find_user_password}{realm, authuri} Get user/password for given realm and URI, if any. This method will return \code{(None, None)} if there is no user/password is known. \end{methoddesc} \begin{classdesc}{HTTPPasswordMgrWithDefaultRealm}{} Keep a database of \code{(\var{realm}, \var{uri}) -> (\var{user}, \var{password})} mapping. A realm of \code{None} is considered a catch-all realm, which is searched if no other realm fits. \end{classdesc} \begin{methoddesc}[HTTPPasswordMgrWithDefaultRealm]{add_password} {realm, uri, user, passwd} \var{uri} can be either a single URI, or a sequene of URIs. \var{realm}, \var{user} and \var{passwd} must be strings. This causes \code{(\var{user}, \var{passwd})} to be used as authentication tokens when authentication for \var{realm} and a super-URI of any of the given URIs is given. \end{methoddesc} \begin{methoddesc}[HTTPPasswordMgr]{find_user_password}{realm, authuri} Get user/password for given realm and URI, if any. This method will return \code{(None, None)} if there is no user/password is known. If the given \var{realm} has no user/password, the realm \code{None} will be searched. \end{methoddesc} \begin{classdesc}[AbstractBasicAuthHandler]{\optional{password_mgr}} This is a mixin class, that helps with HTTP authentication, both to the remote host and to a proxy. \var{password_mgr} should be something that is compatible with \class{HTTPPasswordMgr} --- supplies the documented interface above. \end{classdesc} \begin{methoddesc}[AbstractBasicAuthHandler]{handle_authentication_request} {authreq, host, req, headers} Handle an authentication request by getting user/password pair, and retrying. \var{authreq} should be the name of the header where the information about the realm, \var{host} is the host to authenticate too, \var{req} should be the (failed) \class{Request} object, and \var{headers} should be the error headers. \end{methoddesc} \begin{classdesc}{HTTPBasicAuthHandler}{\optional{password_mgr}} Handle authentication with the remote host. Valid \var{password_mgr}, if given, are the same as for \class{AbstractBasicAuthHandler}. \end{classdesc} \begin{methoddesc}[HTTPBasicAuthHandler]{http_error_401}{req, fp, code, msg, hdrs} Retry the request with authentication info, if available. \end{methoddesc} \begin{classdesc}{ProxyBasicAuthHandler}{\optional{password_mgr}} Handle authentication with the proxy. Valid \var{password_mgr}, if given, are the same as for \class{AbstractBasicAuthHandler}. \end{classdesc} \begin{methoddesc}[ProxyBasicAuthHandler]{http_error_407}{req, fp, code, msg, hdrs} Retry the request with authentication info, if available. \end{methoddesc} \begin{classdesc}{AbstractDigestAuthHandler}{\optional{password_mgr}} This is a mixin class, that helps with HTTP authentication, both to the remote host and to a proxy. \var{password_mgr} should be something that is compatible with \class{HTTPPasswordMgr} --- supplies the documented interface above. \end{classdesc} \begin{methoddesc}[AbstractBasicAuthHandler]{handle_authentication_request} {authreq, host, req, headers} \var{authreq} should be the name of the header where the information about the realm, \var{host} should be the host to authenticate too, \var{req} should be the (failed) \class{Request} object, and \var{headers} should be the error headers. \end{methoddesc} \begin{classdesc}{HTTPDigestAuthHandler}{\optional{password_mgr}} Handle authentication with the remote host. Valid \var{password_mgr}, if given, are the same as for \class{AbstractBasicAuthHandler}. \end{classdesc} \begin{methoddesc}[HTTPDigestAuthHandler]{http_error_401}{req, fp, code, msg, hdrs} Retry the request with authentication info, if available. \end{methoddesc} \begin{classdesc}{ProxyDigestAuthHandler}{\optional{password_mgr}} Handle authentication with the proxy. \var{password_mgr}, if given, shoudl be the same as for the constructor of \class{AbstractDigestAuthHandler}. \end{classdesc} \begin{methoddesc}[ProxyDigestAuthHandler]{http_error_407}{req, fp, code, msg, hdrs} Retry the request with authentication info, if available. \end{methoddesc} \begin{classdesc}{HTTPHandler}{} A class to handle opening of HTTP URLs \end{classdesc} \begin{methoddesc}[HTTPHandler]{http_open}{req} Send an HTTP request (either GET or POST, depending on whether \code{req.has_data()}. \end{methoddesc} \begin{classdesc}{HTTPSHandler}{} A class to handle opening of HTTPS URLs \end{classdesc} \begin{methoddesc}[HTTPSHandler]{https_open}{req} Send an HTTPS request (either GET or POST, depending on whether \code{req.has_data()}. \end{methoddesc} \begin{classdesc}{UknownHandler}{} A catch-all class to handle unknown URLs. \end{classdesc} \begin{methoddesc}[UknownHandler]{unknown_open} Raise a \exception{URLError} exception \end{methoddesc} \begin{classdesc}{FileHandler}{} Open local files. \end{classdesc} \begin{methoddesc}[FileHandler]{file_open}{req} Open the file locally, if there is no host name, or the host name is \code{"localhost"}. Change the protocol to \code{ftp} otherwise, and retry opening it using \member{parent}. \end{methoddesc} \begin{classdesc}{FTPHandler}{} Open FTP URLs. \end{classdesc} \begin{methoddesc}[FTPHandler]{ftp_open}{req} Open the FTP file indicated by \var{req}. The login is always done with empty username and password. \end{methoddesc} \begin{classdesc}{CacheFTPHandler}{} Open FTP URLs, keeping a cache of open FTP connections to minimize delays. \end{classdesc} \begin{methoddesc}[CacheFTPHandler]{ftp_open}{req} Open the FTP file indicated by \var{req}. The login is always done with empty username and password. \end{methoddesc} \begin{methoddesc}[CacheFTPHandler]{setTimeout}{t} Set timeout of connections to \var{t} seconds. \end{methoddesc} \begin{methoddesc}[CacheFTPHandler]{setMaxConns}{m} Set maximum number of cached connections to \var{m}. \end{methoddesc} \begin{classdesc}{GopherHandler}{} Open gopher URLs. \end{classdesc} \begin{methoddesc}[GopherHandler]{gopher_open}{req} Open the gopher resource indicated by \var{req}. \end{methoddesc} From tim_one@users.sourceforge.net Thu Mar 1 08:47:31 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 01 Mar 2001 00:47:31 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python import.c,2.168,2.169 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv15124/python/dist/src/python Modified Files: import.c Log Message: More fiddling w/ the new-fangled Mac import code. Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.168 retrieving revision 2.169 diff -C2 -r2.168 -r2.169 *** import.c 2001/03/01 06:33:32 2.168 --- import.c 2001/03/01 08:47:29 2.169 *************** *** 1112,1118 **** DIR *dirp; struct dirent *dp; ! char pathname[MAX_PATH + 1]; const int pathlen = len - namelen - 1; /* don't want trailing SEP */ /* Copy the path component into pathname; substitute "." if empty */ if (pathlen <= 0) { --- 1112,1121 ---- DIR *dirp; struct dirent *dp; ! char pathname[MAXPATHLEN + 1]; const int pathlen = len - namelen - 1; /* don't want trailing SEP */ + if (getenv("PYTHONCASEOK") != NULL) + return 1; + /* Copy the path component into pathname; substitute "." if empty */ if (pathlen <= 0) { *************** *** 1121,1125 **** } else { ! assert(pathlen <= MAX_PATH); memcpy(pathname, buf, pathlen); pathname[pathlen] = '\0'; --- 1124,1128 ---- } else { ! assert(pathlen <= MAXPATHLEN); memcpy(pathname, buf, pathlen); pathname[pathlen] = '\0'; *************** *** 1129,1136 **** if (dirp) { while ((dp = readdir(dirp)) != NULL) { #ifdef _DIRENT_HAVE_D_NAMELEN ! const int thislen = dp->d_namlen; #else ! const int thislen = strlen(dp->d_name); #endif if (thislen == namelen && !strcmp(dp->d_name, name)) { --- 1132,1140 ---- if (dirp) { while ((dp = readdir(dirp)) != NULL) { + const int thislen = #ifdef _DIRENT_HAVE_D_NAMELEN ! dp->d_namlen; #else ! strlen(dp->d_name); #endif if (thislen == namelen && !strcmp(dp->d_name, name)) { *************** *** 1139,1144 **** } } } - (void)closedir(dirp); return 0 ; /* Not found */ --- 1143,1148 ---- } } + (void)closedir(dirp); } return 0 ; /* Not found */ From ping@users.sourceforge.net Thu Mar 1 13:55:22 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Thu, 01 Mar 2001 05:55:22 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv13478 Modified Files: pydoc.py Log Message: Docstring improvements. Add checks for .pyo and .pyd. Collapse docfunction, docmethod, docbuiltin into the one method docroutine. Small formatting fixes. Link the segments of a package path in the title. Link to the source file only if it exists. Allow modules (e.g. repr.py) to take precedence over built-ins (e.g. repr()). Add interruptible synopsis scanner (so we can do searches in the background). Make HTTP server quit. Add small GUI for controlling the server and launching searches (like -k). (Tested on Win2k, Win98, and Linux.) Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** pydoc.py 2001/03/01 00:24:32 1.8 --- pydoc.py 2001/03/01 13:55:20 1.9 *************** *** 2,22 **** """Generate Python documentation in HTML or text for interactive use. - At the shell command line outside of Python, run "pydoc " to show - documentation on something. may be the name of a Python function, - module, package, or a dotted reference to a class or function within a - module or module in a package. Alternatively, the argument can be the - path to a Python source file. - - Or, at the shell prompt, run "pydoc -k " to search for a keyword - in the one-line descriptions of modules. - - Or, at the shell prompt, run "pydoc -p " to start an HTTP server - on a given port on the local machine to generate documentation web pages. - - Or, at the shell prompt, run "pydoc -w " to write out the HTML - documentation for a module to a file named ".html". - In the Python interpreter, do "from pydoc import help" to provide online ! help. Calling help(thing) on a Python object documents the object.""" __author__ = "Ka-Ping Yee " --- 2,27 ---- """Generate Python documentation in HTML or text for interactive use. In the Python interpreter, do "from pydoc import help" to provide online ! help. Calling help(thing) on a Python object documents the object. ! ! At the shell command line outside of Python: ! Run "pydoc " to show documentation on something. may be ! the name of a function, module, package, or a dotted reference to a ! class or function within a module or module in a package. If the ! argument contains a path segment delimiter (e.g. slash on Unix, ! backslash on Windows) it is treated as the path to a Python source file. ! ! Run "pydoc -k " to search for a keyword in the synopsis lines ! of all available modules. ! ! Run "pydoc -p " to start an HTTP server on a given port on the ! local machine to generate documentation web pages. ! ! For platforms without a command line, "pydoc -g" starts the HTTP server ! and also pops up a little window for controlling it. ! ! Run "pydoc -w " to write out the HTML documentation for a module ! to a file named ".html". ! """ __author__ = "Ka-Ping Yee " *************** *** 30,33 **** --- 35,42 ---- Mynd you, mřřse bites Kan be pretty nasti...""" + # Note: this module is designed to deploy instantly and run under any + # version of Python from 1.5 and up. That's why it's a single file and + # some 2.0 features (like string methods) are conspicuously avoided. + import sys, imp, os, stat, re, types, inspect from repr import Repr *************** *** 60,75 **** return result - def index(dir): - """Return a list of (module-name, synopsis) pairs for a directory tree.""" - results = [] - for entry in os.listdir(dir): - path = os.path.join(dir, entry) - if ispackage(path): - results.extend(map( - lambda (m, s), pkg=entry: (pkg + '.' + m, s), index(path))) - elif os.path.isfile(path) and entry[-3:] == '.py': - results.append((entry[:-3], synopsis(path))) - return results - def pathdirs(): """Convert sys.path into a list of absolute, existing, unique paths.""" --- 69,72 ---- *************** *** 133,137 **** if lower(filename[-3:]) == '.py': return filename[:-3] ! elif lower(filename[-4:]) == '.pyc': return filename[:-4] elif lower(filename[-11:]) == 'module.so': --- 130,134 ---- if lower(filename[-3:]) == '.py': return filename[:-3] ! elif lower(filename[-4:]) in ['.pyc', '.pyd', '.pyo']: return filename[:-4] elif lower(filename[-11:]) == 'module.so': *************** *** 185,191 **** if inspect.ismodule(object): return apply(self.docmodule, args) if inspect.isclass(object): return apply(self.docclass, args) ! if inspect.ismethod(object): return apply(self.docmethod, args) ! if inspect.isbuiltin(object): return apply(self.docbuiltin, args) ! if inspect.isfunction(object): return apply(self.docfunction, args) raise TypeError, "don't know how to document objects of type " + \ type(object).__name__ --- 182,186 ---- if inspect.ismodule(object): return apply(self.docmodule, args) if inspect.isclass(object): return apply(self.docclass, args) ! if inspect.isroutine(object): return apply(self.docroutine, args) raise TypeError, "don't know how to document objects of type " + \ type(object).__name__ *************** *** 259,267 **** return """

!

 %s
 %s
! """ % (bgcol, fgcol, title, fgcol, extras) def section(self, title, fgcol, bgcol, contents, width=20, --- 254,263 ---- return """

! !
 

 %s
%s 
! """ % (bgcol, fgcol, title, fgcol, extras or ' ') def section(self, title, fgcol, bgcol, contents, width=20, *************** *** 272,276 **** result = """

! """ % (bgcol, fgcol, title) --- 268,273 ---- result = """


 %s
! ! """ % (bgcol, fgcol, title) *************** *** 292,303 **** return apply(self.section, (title,) + args) - def footer(self): - return """ -
 
 %s
- generated with - htmldoc by Ka-Ping Yee -
- """ - def namelink(self, name, *dicts): """Make a link for an identifier, given name-to-URL mappings.""" --- 289,292 ---- *************** *** 391,398 **** """Produce HTML documentation for a module object.""" name = object.__name__ ! result = '' ! head = '
 %s' % name try: path = os.path.abspath(inspect.getfile(object)) filelink = '%s' % (path, path) except TypeError: --- 380,395 ---- """Produce HTML documentation for a module object.""" name = object.__name__ ! parts = split(name, '.') ! links = [] ! for i in range(len(parts)-1): ! links.append( ! '%s' % ! (join(parts[:i+1], '.'), parts[i])) ! linkedname = join(links + parts[-1:], '.') ! head = '%s' % linkedname try: path = os.path.abspath(inspect.getfile(object)) + sourcepath = os.path.abspath(inspect.getsourcefile(object)) + if os.path.isfile(sourcepath): path = sourcepath filelink = '%s' % (path, path) except TypeError: *************** *** 408,412 **** if info: head = head + ' (%s)' % join(info, ', ') ! result = result + self.heading( head, '#ffffff', '#7799ee', 'index
' + filelink) --- 405,409 ---- if info: head = head + ' (%s)' % join(info, ', ') ! result = self.heading( head, '#ffffff', '#7799ee', 'index
' + filelink) *************** *** 520,531 **** doc = self.markup(getdoc(object), self.preformat, funcs, classes, mdict) ! if doc: doc = '' + doc + '
 
' return self.section(title, '#000000', '#ffc8d8', contents, 10, doc) - def docmethod(self, object, funcs={}, classes={}, methods={}, clname=''): - """Produce HTML documentation for a method object.""" - return self.document( - object.im_func, funcs, classes, methods, clname) - def formatvalue(self, object): """Format an argument default value as text.""" --- 517,523 ---- doc = self.markup(getdoc(object), self.preformat, funcs, classes, mdict) ! if doc: doc = '' + doc + '' return self.section(title, '#000000', '#ffc8d8', contents, 10, doc) def formatvalue(self, object): """Format an argument default value as text.""" *************** *** 533,548 **** self.repr(object)) ! def docfunction(self, object, funcs={}, classes={}, methods={}, clname=''): ! """Produce HTML documentation for a function object.""" ! args, varargs, varkw, defaults = inspect.getargspec(object) ! argspec = inspect.formatargspec( ! args, varargs, varkw, defaults, formatvalue=self.formatvalue) ! ! if object.__name__ == '': ! decl = 'lambda ' + argspec[1:-1] else: ! anchor = clname + '-' + object.__name__ ! decl = '%s%s\n' % ( ! anchor, object.__name__, argspec) doc = self.markup(getdoc(object), self.preformat, funcs, classes, methods) --- 525,545 ---- self.repr(object)) ! def docroutine(self, object, funcs={}, classes={}, methods={}, clname=''): ! """Produce HTML documentation for a function or method object.""" ! if inspect.ismethod(object): object = object.im_func ! if inspect.isbuiltin(object): ! decl = '%s(...)\n' % ( ! clname + '-' + object.__name__, object.__name__) else: ! args, varargs, varkw, defaults = inspect.getargspec(object) ! argspec = inspect.formatargspec( ! args, varargs, varkw, defaults, formatvalue=self.formatvalue) ! ! if object.__name__ == '': ! decl = 'lambda ' + argspec[1:-1] ! else: ! anchor = clname + '-' + object.__name__ ! decl = '%s%s\n' % ( ! anchor, object.__name__, argspec) doc = self.markup(getdoc(object), self.preformat, funcs, classes, methods) *************** *** 551,563 **** return '

%s
%s
' % (decl, doc) - def docbuiltin(self, object, *extras): - """Produce HTML documentation for a built-in function.""" - return '
%s(...)
' % object.__name__ - def page(self, object): """Produce a complete HTML page of documentation for an object.""" ! return ''' ! Python: %s ! %s --- 548,556 ---- return '
%s
%s
' % (decl, doc) def page(self, object): """Produce a complete HTML page of documentation for an object.""" ! return ''' ! ! Python: %s %s *************** *** 758,782 **** return title + '\n' + self.indent(rstrip(contents), ' | ') + '\n' - def docmethod(self, object): - """Produce text documentation for a method object.""" - return self.document(object.im_func) - def formatvalue(self, object): """Format an argument default value as text.""" return '=' + self.repr(object) ! def docfunction(self, object): ! """Produce text documentation for a function object.""" ! try: args, varargs, varkw, defaults = inspect.getargspec(object) argspec = inspect.formatargspec( args, varargs, varkw, defaults, formatvalue=self.formatvalue) ! except TypeError: ! argspec = '(...)' ! ! if object.__name__ == '': ! decl = ' ' + argspec[1:-1] ! else: ! decl = self.bold(object.__name__) + argspec doc = getdoc(object) if doc: --- 751,771 ---- return title + '\n' + self.indent(rstrip(contents), ' | ') + '\n' def formatvalue(self, object): """Format an argument default value as text.""" return '=' + self.repr(object) ! def docroutine(self, object): ! """Produce text documentation for a function or method object.""" ! if inspect.ismethod(object): object = object.im_func ! if inspect.isbuiltin(object): ! decl = self.bold(object.__name__) + '(...)' ! else: args, varargs, varkw, defaults = inspect.getargspec(object) argspec = inspect.formatargspec( args, varargs, varkw, defaults, formatvalue=self.formatvalue) ! if object.__name__ == '': ! decl = ' ' + argspec[1:-1] ! else: ! decl = self.bold(object.__name__) + argspec doc = getdoc(object) if doc: *************** *** 785,793 **** return decl + '\n' - def docbuiltin(self, object): - """Produce text documentation for a built-in function object.""" - return (self.bold(object.__name__) + '(...)\n' + - rstrip(self.indent(object.__doc__)) + '\n') - # --------------------------------------------------------- user interfaces --- 774,777 ---- *************** *** 915,920 **** if type(path) is not types.StringType: return None, path - if hasattr(__builtins__, path): - return None, getattr(__builtins__, path) parts = split(path, '.') n = 1 --- 899,902 ---- *************** *** 925,929 **** module = reload(module) except: ! # Did the error occur before or after we found the module? if sys.modules.has_key(path): filename = sys.modules[path].__file__ --- 907,911 ---- module = reload(module) except: ! # determine if error occurred before or after module was found if sys.modules.has_key(path): filename = sys.modules[path].__file__ *************** *** 943,946 **** --- 925,930 ---- n = n + 1 continue + if hasattr(__builtins__, path): + return None, getattr(__builtins__, path) return None, None *************** *** 956,965 **** path, x = locate(thing) except DocImportError, value: ! print 'problem in %s - %s' % (value.filename, value.args) return if x: thing = x else: ! print 'could not find or import %s' % repr(thing) return --- 940,949 ---- path, x = locate(thing) except DocImportError, value: ! print 'Problem in %s - %s' % (value.filename, value.args) return if x: thing = x else: ! print 'No Python documentation found for %s.' % repr(thing) return *************** *** 970,987 **** pager('Help on %s:\n\n' % desc + text.document(thing)) - def writedocs(path, pkgpath=''): - if os.path.isdir(path): - dir = path - for file in os.listdir(dir): - path = os.path.join(dir, file) - if os.path.isdir(path): - writedocs(path, file + '.' + pkgpath) - if os.path.isfile(path): - writedocs(path, pkgpath) - if os.path.isfile(path): - modname = modulename(path) - if modname: - writedoc(pkgpath + modname) - def writedoc(key): """Write HTML documentation to a file in the current directory.""" --- 954,957 ---- *************** *** 1016,1046 **** found = 1 else: ! print 'could not find or import %s' % repr(key) def apropos(key): """Print all the one-line module summaries that contain a substring.""" ! key = lower(key) ! for module in sys.builtin_module_names: ! desc = __import__(module).__doc__ or '' ! desc = split(desc, '\n')[0] ! if find(lower(module + ' ' + desc), key) >= 0: ! print module, '-', desc or '(no description)' ! modules = [] ! for dir in pathdirs(): ! for module, desc in index(dir): ! desc = desc or '' ! if module not in modules: ! modules.append(module) ! if find(lower(module + ' ' + desc), key) >= 0: ! desc = desc or '(no description)' ! if module[-9:] == '.__init__': ! print module[:-9], '(package) -', desc ! else: ! print module, '-', desc # --------------------------------------------------- web browser interface ! def serve(address, callback=None): ! import BaseHTTPServer, mimetools # Patch up mimetools.Message so it doesn't break if rfc822 is reloaded. --- 986,1070 ---- found = 1 else: ! print 'No Python documentation found for %s.' % repr(key) ! ! class Scanner: ! """A generic tree iterator.""" ! def __init__(self, roots, children, recurse): ! self.roots = roots[:] ! self.state = [] ! self.children = children ! self.recurse = recurse ! ! def next(self): ! if not self.state: ! if not self.roots: ! return None ! root = self.roots.pop(0) ! self.state = [(root, self.children(root))] ! node, children = self.state[-1] ! if not children: ! self.state.pop() ! return self.next() ! child = children.pop(0) ! if self.recurse(child): ! self.state.append((child, self.children(child))) ! return child ! ! class ModuleScanner(Scanner): ! """An interruptible scanner that searches module synopses.""" ! def __init__(self): ! roots = map(lambda dir: (dir, ''), pathdirs()) ! Scanner.__init__(self, roots, self.submodules, self.ispackage) ! ! def submodules(self, (dir, package)): ! children = [] ! for file in os.listdir(dir): ! path = os.path.join(dir, file) ! if ispackage(path): ! children.append((path, package + (package and '.') + file)) ! else: ! children.append((path, package)) ! children.sort() ! return children + def ispackage(self, (dir, package)): + return ispackage(dir) + + def run(self, key, callback, completer=None): + self.quit = 0 + seen = {} + + for modname in sys.builtin_module_names: + seen[modname] = 1 + desc = split(__import__(modname).__doc__ or '', '\n')[0] + if find(lower(modname + ' - ' + desc), lower(key)) >= 0: + callback(None, modname, desc) + + while not self.quit: + node = self.next() + if not node: break + path, package = node + modname = modulename(path) + if os.path.isfile(path) and modname: + modname = package + (package and '.') + modname + if not seen.has_key(modname): + seen[modname] = 1 + desc = synopsis(path) or '' + if find(lower(modname + ' - ' + desc), lower(key)) >= 0: + callback(path, modname, desc) + if completer: completer() + def apropos(key): """Print all the one-line module summaries that contain a substring.""" ! def callback(path, modname, desc): ! if modname[-9:] == '.__init__': ! modname = modname[:-9] + ' (package)' ! print modname, '-', desc or '(no description)' ! ModuleScanner().run(key, callback) # --------------------------------------------------- web browser interface ! def serve(port, callback=None): ! import BaseHTTPServer, mimetools, select # Patch up mimetools.Message so it doesn't break if rfc822 is reloaded. *************** *** 1056,1067 **** class DocHandler(BaseHTTPServer.BaseHTTPRequestHandler): def send_document(self, title, contents): ! self.send_response(200) ! self.send_header('Content-Type', 'text/html') ! self.end_headers() ! self.wfile.write( ! ''' ! Python: %s''' % title) ! self.wfile.write(contents) ! self.wfile.write('') def do_GET(self): --- 1080,1093 ---- class DocHandler(BaseHTTPServer.BaseHTTPRequestHandler): def send_document(self, title, contents): ! try: ! self.send_response(200) ! self.send_header('Content-Type', 'text/html') ! self.end_headers() ! self.wfile.write(''' ! ! Python: %s ! %s ! ''' % (title, contents)) ! except IOError: pass def do_GET(self): *************** *** 1074,1078 **** except DocImportError, value: self.send_document(path, html.escape( ! 'problem with %s - %s' % (value.filename, value.args))) return if x: --- 1100,1104 ---- except DocImportError, value: self.send_document(path, html.escape( ! 'Problem in %s - %s' % (value.filename, value.args))) return if x: *************** *** 1080,1090 **** else: self.send_document(path, ! 'There is no Python module or object named "%s".' % path) else: heading = html.heading( ! '
 ' ! 'Python: Index of Modules' ! '', ! '#ffffff', '#7799ee') builtins = [] for name in sys.builtin_module_names: --- 1106,1114 ---- else: self.send_document(path, ! 'No Python documentation found for %s.' % repr(path)) else: heading = html.heading( ! 'Python: Index of Modules', ! '#ffffff', '#7799ee') builtins = [] for name in sys.builtin_module_names: *************** *** 1094,1132 **** for dir in pathdirs(): indices.append(html.index(dir, seen)) ! self.send_document('Index of Modules', heading + join(indices)) def log_message(self, *args): pass class DocServer(BaseHTTPServer.HTTPServer): ! def __init__(self, address, callback): self.callback = callback ! self.base.__init__(self, address, self.handler) def server_activate(self): self.base.server_activate(self) ! if self.callback: self.callback() DocServer.base = BaseHTTPServer.HTTPServer DocServer.handler = DocHandler DocHandler.MessageClass = Message try: ! DocServer(address, callback).serve_forever() except KeyboardInterrupt: ! print 'server stopped' # -------------------------------------------------- command-line interface def cli(): import getopt class BadUsage: pass try: ! opts, args = getopt.getopt(sys.argv[1:], 'k:p:w') writing = 0 for opt, val in opts: if opt == '-k': ! apropos(lower(val)) ! break if opt == '-p': try: --- 1118,1344 ---- for dir in pathdirs(): indices.append(html.index(dir, seen)) ! contents = heading + join(indices) + """

! ! pydoc by Ka-Ping Yee <ping@lfw.org>""" ! self.send_document('Index of Modules', contents) def log_message(self, *args): pass class DocServer(BaseHTTPServer.HTTPServer): ! def __init__(self, port, callback): ! self.address = ('127.0.0.1', port) ! self.url = 'http://127.0.0.1:%d/' % port self.callback = callback ! self.base.__init__(self, self.address, self.handler) ! ! def serve_until_quit(self): ! import select ! self.quit = 0 ! while not self.quit: ! rd, wr, ex = select.select([self.socket.fileno()], [], [], 1) ! if rd: self.handle_request() def server_activate(self): self.base.server_activate(self) ! if self.callback: self.callback(self) DocServer.base = BaseHTTPServer.HTTPServer DocServer.handler = DocHandler DocHandler.MessageClass = Message + try: + DocServer(port, callback).serve_until_quit() + except (KeyboardInterrupt, select.error): + pass + print 'server stopped' + + # ----------------------------------------------------- graphical interface + + def gui(): + """Graphical interface (starts web server and pops up a control window).""" + class GUI: + def __init__(self, window, port=7464): + self.window = window + self.server = None + self.scanner = None + + import Tkinter + self.server_frm = Tkinter.Frame(window) + self.title_lbl = Tkinter.Label(self.server_frm, + text='Starting server...\n ') + self.open_btn = Tkinter.Button(self.server_frm, + text='open browser', command=self.open, state='disabled') + self.quit_btn = Tkinter.Button(self.server_frm, + text='quit serving', command=self.quit, state='disabled') + + self.search_frm = Tkinter.Frame(window) + self.search_lbl = Tkinter.Label(self.search_frm, text='Search for') + self.search_ent = Tkinter.Entry(self.search_frm) + self.search_ent.bind('', self.search) + self.stop_btn = Tkinter.Button(self.search_frm, + text='stop', pady=0, command=self.stop, state='disabled') + if sys.platform == 'win32': + # Attempting to hide and show this button crashes under Windows. + self.stop_btn.pack(side='right') + + self.window.title('pydoc') + self.window.protocol('WM_DELETE_WINDOW', self.quit) + self.title_lbl.pack(side='top', fill='x') + self.open_btn.pack(side='left', fill='x', expand=1) + self.quit_btn.pack(side='right', fill='x', expand=1) + self.server_frm.pack(side='top', fill='x') + + self.search_lbl.pack(side='left') + self.search_ent.pack(side='right', fill='x', expand=1) + self.search_frm.pack(side='top', fill='x') + self.search_ent.focus_set() + + self.result_lst = Tkinter.Listbox(window, + font=('helvetica', 8), height=6) + self.result_lst.bind('', self.select) + self.result_lst.bind('', self.goto) + self.result_scr = Tkinter.Scrollbar(window, + orient='vertical', command=self.result_lst.yview) + self.result_lst.config(yscrollcommand=self.result_scr.set) + + self.result_frm = Tkinter.Frame(window) + self.goto_btn = Tkinter.Button(self.result_frm, + text='go to selected', command=self.goto) + self.hide_btn = Tkinter.Button(self.result_frm, + text='hide results', command=self.hide) + self.goto_btn.pack(side='left', fill='x', expand=1) + self.hide_btn.pack(side='right', fill='x', expand=1) + + self.window.update() + self.minwidth = self.window.winfo_width() + self.minheight = self.window.winfo_height() + self.bigminheight = (self.server_frm.winfo_reqheight() + + self.search_frm.winfo_reqheight() + + self.result_lst.winfo_reqheight() + + self.result_frm.winfo_reqheight()) + self.bigwidth, self.bigheight = self.minwidth, self.bigminheight + self.expanded = 0 + self.window.wm_geometry('%dx%d' % (self.minwidth, self.minheight)) + self.window.wm_minsize(self.minwidth, self.minheight) + + import threading + threading.Thread(target=serve, args=(port, self.ready)).start() + + def ready(self, server): + self.server = server + self.title_lbl.config( + text='Python documentation server at\n' + server.url) + self.open_btn.config(state='normal') + self.quit_btn.config(state='normal') + + def open(self, event=None): + import webbrowser + webbrowser.open(self.server.url) + + def quit(self, event=None): + if self.server: + self.server.quit = 1 + self.window.quit() + + def search(self, event=None): + key = self.search_ent.get() + self.stop_btn.pack(side='right') + self.stop_btn.config(state='normal') + self.search_lbl.config(text='Searching for "%s"...' % key) + self.search_ent.forget() + self.search_lbl.pack(side='left') + self.result_lst.delete(0, 'end') + self.goto_btn.config(state='disabled') + self.expand() + + import threading + if self.scanner: + self.scanner.quit = 1 + self.scanner = ModuleScanner() + threading.Thread(target=self.scanner.run, + args=(key, self.update, self.done)).start() + + def update(self, path, modname, desc): + if modname[-9:] == '.__init__': + modname = modname[:-9] + ' (package)' + self.result_lst.insert('end', + modname + ' - ' + (desc or '(no description)')) + + def stop(self, event=None): + if self.scanner: + self.scanner.quit = 1 + self.scanner = None + + def done(self): + self.scanner = None + self.search_lbl.config(text='Search for') + self.search_lbl.pack(side='left') + self.search_ent.pack(side='right', fill='x', expand=1) + if sys.platform != 'win32': self.stop_btn.forget() + self.stop_btn.config(state='disabled') + + def select(self, event=None): + self.goto_btn.config(state='normal') + + def goto(self, event=None): + selection = self.result_lst.curselection() + if selection: + import webbrowser + modname = split(self.result_lst.get(selection[0]))[0] + webbrowser.open(self.server.url + modname + '.html') + + def collapse(self): + if not self.expanded: return + self.result_frm.forget() + self.result_scr.forget() + self.result_lst.forget() + self.bigwidth = self.window.winfo_width() + self.bigheight = self.window.winfo_height() + self.window.wm_geometry('%dx%d' % (self.minwidth, self.minheight)) + self.window.wm_minsize(self.minwidth, self.minheight) + self.expanded = 0 + + def expand(self): + if self.expanded: return + self.result_frm.pack(side='bottom', fill='x') + self.result_scr.pack(side='right', fill='y') + self.result_lst.pack(side='top', fill='both', expand=1) + self.window.wm_geometry('%dx%d' % (self.bigwidth, self.bigheight)) + self.window.wm_minsize(self.minwidth, self.bigminheight) + self.expanded = 1 + + def hide(self, event=None): + self.stop() + self.collapse() + + import Tkinter try: ! gui = GUI(Tkinter.Tk()) ! Tkinter.mainloop() except KeyboardInterrupt: ! pass # -------------------------------------------------- command-line interface def cli(): + """Command-line interface (looks at sys.argv to decide what to do).""" import getopt class BadUsage: pass try: ! if sys.platform in ['mac', 'win', 'win32', 'nt'] and not sys.argv[1:]: ! # CLI-less platforms ! gui() ! return ! ! opts, args = getopt.getopt(sys.argv[1:], 'gk:p:w') writing = 0 for opt, val in opts: + if opt == '-g': + gui() + return if opt == '-k': ! apropos(val) ! return if opt == '-p': try: *************** *** 1134,1192 **** except ValueError: raise BadUsage ! def ready(port=port): ! print 'server ready at http://127.0.0.1:%d/' % port ! serve(('127.0.0.1', port), ready) ! break if opt == '-w': - if not args: raise BadUsage writing = 1 - else: - if args: - for arg in args: - try: - if os.path.isfile(arg): - arg = importfile(arg) - if writing: - if os.path.isdir(arg): writedocs(arg) - else: writedoc(arg) - else: man(arg) - except DocImportError, value: - print 'problem in %s - %s' % ( - value.filename, value.args) - else: - if sys.platform in ['mac', 'win', 'win32', 'nt']: - # GUI platforms with threading - import threading - ready = threading.Event() - address = ('127.0.0.1', 12346) - threading.Thread( - target=serve, args=(address, ready.set)).start() - ready.wait() - import webbrowser - webbrowser.open('http://127.0.0.1:12346/') - else: - raise BadUsage except (getopt.error, BadUsage): ! print """%s ... ! Show documentation on something. ! may be the name of a Python function, module, or package, ! or a dotted reference to a class or function within a module or ! module in a package, or the filename of a Python module to import. %s -k ! Search for a keyword in the synopsis lines of all modules. %s -p Start an HTTP server on the given port on the local machine. ! %s -w ... ! Write out the HTML documentation for a module to a file. - %s -w - Write out the HTML documentation for all modules in the tree - under a given directory to files in the current directory. - """ % ((sys.argv[0],) * 5) - if __name__ == '__main__': - cli() --- 1346,1391 ---- except ValueError: raise BadUsage ! def ready(server): ! print 'server ready at %s' % server.url ! serve(port, ready) ! return if opt == '-w': writing = 1 + if not args: raise BadUsage + for arg in args: + try: + if find(arg, os.sep) >= 0 and os.path.isfile(arg): + arg = importfile(arg) + if writing: writedoc(arg) + else: man(arg) + except DocImportError, value: + print 'Problem in %s - %s' % (value.filename, value.args) + except (getopt.error, BadUsage): ! cmd = sys.argv[0] ! print """pydoc - the Python documentation tool ! ! %s ... ! Show text documentation on something. may be the name of a ! function, module, or package, or a dotted reference to a class or ! function within a module or module in a package. If contains ! a '%s', it is used as the path to a Python source file to document. %s -k ! Search for a keyword in the synopsis lines of all available modules. %s -p Start an HTTP server on the given port on the local machine. + + %s -g + Pop up a graphical interface for serving and finding documentation. + + %s -w ... + Write out the HTML documentation for a module to a file in the current + directory. If contains a '%s', it is treated as a filename. + """ % (cmd, os.sep, cmd, cmd, cmd, cmd, os.sep) ! if __name__ == '__main__': cli() From ping@users.sourceforge.net Thu Mar 1 13:56:18 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Thu, 01 Mar 2001 05:56:18 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib inspect.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv14242 Modified Files: inspect.py Log Message: Add __author__ variable. Robustify: don't rely on modules being present in sys.modules. Index: inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** inspect.py 2001/03/01 03:55:35 1.3 --- inspect.py 2001/03/01 13:56:16 1.4 *************** *** 25,29 **** # This module is in the public domain. No warranties. ! __version__ = 'Ka-Ping Yee , 1 Jan 2001' import sys, types, string, dis, imp, tokenize --- 25,30 ---- # This module is in the public domain. No warranties. ! __author__ = 'Ka-Ping Yee ' ! __date__ = '1 Jan 2001' import sys, types, string, dis, imp, tokenize *************** *** 197,201 **** """Try to guess which module an object was defined in.""" if isclass(object): ! return sys.modules[object.__module__] try: file = getsourcefile(object) --- 198,202 ---- """Try to guess which module an object was defined in.""" if isclass(object): ! return sys.modules.get(object.__module__) try: file = getsourcefile(object) *************** *** 631,632 **** --- 632,635 ---- """Return a list of records for the stack below the current exception.""" return getinnerframes(sys.exc_traceback, context) + + From ping@users.sourceforge.net Thu Mar 1 13:56:42 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Thu, 01 Mar 2001 05:56:42 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib tokenize.py,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv14370 Modified Files: tokenize.py Log Message: Add __author__ and __credits__ variables. Index: tokenize.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/tokenize.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -r1.19 -r1.20 *** tokenize.py 2001/03/01 04:27:19 1.19 --- tokenize.py 2001/03/01 13:56:40 1.20 *************** *** 10,14 **** it produces COMMENT tokens for comments and gives type OP for all operators.""" ! __version__ = "Ka-Ping Yee, 26 October 1997; patched, GvR 3/30/98" import string, re --- 10,15 ---- it produces COMMENT tokens for comments and gives type OP for all operators.""" ! __author__ = 'Ka-Ping Yee ' ! __credits__ = 'first version, 26 October 1997; patched, GvR 3/30/98' import string, re From gvanrossum@users.sourceforge.net Thu Mar 1 14:50:16 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 01 Mar 2001 06:50:16 -0800 Subject: [Python-checkins] CVS: python/dist/src/Include patchlevel.h,2.44,2.45 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv26082 Modified Files: patchlevel.h Log Message: Here we go again, another round of version bumping... Index: patchlevel.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/patchlevel.h,v retrieving revision 2.44 retrieving revision 2.45 diff -C2 -r2.44 -r2.45 *** patchlevel.h 2001/02/02 20:13:01 2.44 --- patchlevel.h 2001/03/01 14:50:13 2.45 *************** *** 23,34 **** #define PY_MINOR_VERSION 1 #define PY_MICRO_VERSION 0 ! #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_ALPHA ! #define PY_RELEASE_SERIAL 2 /* Version as a string */ ! #define PY_VERSION "2.1a2" /* Historic */ ! #define PATCHLEVEL "2.1a2" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. --- 23,34 ---- #define PY_MINOR_VERSION 1 #define PY_MICRO_VERSION 0 ! #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_BETA ! #define PY_RELEASE_SERIAL 1 /* Version as a string */ ! #define PY_VERSION "2.1b1" /* Historic */ ! #define PATCHLEVEL "2.1b1" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. From ping@users.sourceforge.net Thu Mar 1 17:11:19 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Thu, 01 Mar 2001 09:11:19 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib tokenize.py,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv28841 Modified Files: tokenize.py Log Message: Better __credits__. Index: tokenize.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/tokenize.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -r1.20 -r1.21 *** tokenize.py 2001/03/01 13:56:40 1.20 --- tokenize.py 2001/03/01 17:11:17 1.21 *************** *** 11,15 **** __author__ = 'Ka-Ping Yee ' ! __credits__ = 'first version, 26 October 1997; patched, GvR 3/30/98' import string, re --- 11,16 ---- __author__ = 'Ka-Ping Yee ' ! __credits__ = \ ! 'GvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, Skip Montanaro' import string, re From tim_one@users.sourceforge.net Thu Mar 1 18:12:03 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 01 Mar 2001 10:12:03 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python import.c,2.169,2.170 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv11859/python/dist/src/python Modified Files: import.c Log Message: More MacOSX fiddling. As noted in a comment, I believe all variations of these "search the directory" schemes (including this one) are still prone to making mistakes. Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.169 retrieving revision 2.170 diff -C2 -r2.169 -r2.170 *** import.c 2001/03/01 08:47:29 2.169 --- import.c 2001/03/01 18:12:00 2.170 *************** *** 985,995 **** } ! /* case_ok(buf, len, namelen, name) ! * We've already done a successful stat() or fopen() on buf (a path of length ! * len, exclusive of trailing null). name is the last component of that path ! * (a string of length namelen, exclusive of trailing null). * case_ok() is to return 1 if there's a case-sensitive match for * name, else 0. case_ok() is also to return 1 if envar PYTHONCASEOK * exists. * case_ok() is used to implement case-sensitive import semantics even * on platforms with case-insensitive filesystems. It's trivial to implement --- 985,1006 ---- } ! /* case_ok(char* buf, int len, int namelen, char* name) ! * The arguments here are tricky, best shown by example: ! * /a/b/c/d/e/f/g/h/i/j/k/some_long_module_name.py\0 ! * ^ ^ ^ ^ ! * |--------------------- buf ---------------------| ! * |------------------- len ------------------| ! * |------ name -------| ! * |----- namelen -----| ! * buf is the full path, but len only counts up to (& exclusive of) the ! * extension. name is the module name, also exclusive of extension. ! * ! * We've already done a successful stat() or fopen() on buf, so know that ! * there's some match, possibly case-insensitive. ! * * case_ok() is to return 1 if there's a case-sensitive match for * name, else 0. case_ok() is also to return 1 if envar PYTHONCASEOK * exists. + * * case_ok() is used to implement case-sensitive import semantics even * on platforms with case-insensitive filesystems. It's trivial to implement *************** *** 1016,1020 **** #endif ! #elif defined(__MACH__) && defined(__APPLE__) #include #include --- 1027,1031 ---- #endif ! #elif defined(__MACH__) && defined(__APPLE__) && defined(HAVE_DIRENT_H) #include #include *************** *** 1108,1133 **** strncmp(name, (char *)fss.name+1, namelen) == 0; ! /* new-fangled macintosh */ ! #elif defined(__MACH__) && defined(__APPLE__) DIR *dirp; struct dirent *dp; ! char pathname[MAXPATHLEN + 1]; ! const int pathlen = len - namelen - 1; /* don't want trailing SEP */ if (getenv("PYTHONCASEOK") != NULL) return 1; ! /* Copy the path component into pathname; substitute "." if empty */ ! if (pathlen <= 0) { ! pathname[0] = '.'; ! pathname[1] = '\0'; } else { ! assert(pathlen <= MAXPATHLEN); ! memcpy(pathname, buf, pathlen); ! pathname[pathlen] = '\0'; } /* Open the directory and search the entries for an exact match. */ ! dirp = opendir(pathname); if (dirp) { while ((dp = readdir(dirp)) != NULL) { --- 1119,1151 ---- strncmp(name, (char *)fss.name+1, namelen) == 0; ! /* new-fangled macintosh (macosx) ! * ! * XXX This seems prone to obscure errors, like suppose someone does ! * XXX "import xyz", and in some directory there's both "XYZ.py" and ! * XXX "xyz.txt". fopen("xyz.py") will open XYZ.py, but when marching thru ! * XXX the directory we'll eventually "succeed" on "xyz.txt" because the ! * XXX extension is never checked. ! */ ! #elif defined(__MACH__) && defined(__APPLE__) && defined(HAVE_DIRENT_H) DIR *dirp; struct dirent *dp; ! char dirname[MAXPATHLEN + 1]; ! const int dirlen = len - namelen - 1; /* don't want trailing SEP */ if (getenv("PYTHONCASEOK") != NULL) return 1; ! /* Copy the dir component into dirname; substitute "." if empty */ ! if (dirlen <= 0) { ! dirname[0] = '.'; ! dirname[1] = '\0'; } else { ! assert(dirlen <= MAXPATHLEN); ! memcpy(dirname, buf, dirlen); ! dirname[dirlen] = '\0'; } /* Open the directory and search the entries for an exact match. */ ! dirp = opendir(dirname); if (dirp) { while ((dp = readdir(dirp)) != NULL) { *************** *** 1138,1142 **** strlen(dp->d_name); #endif ! if (thislen == namelen && !strcmp(dp->d_name, name)) { (void)closedir(dirp); return 1; /* Found */ --- 1156,1161 ---- strlen(dp->d_name); #endif ! if (thislen >= namelen && ! strncmp(dp->d_name, name, namelen) == 0) { (void)closedir(dirp); return 1; /* Found */ From gvanrossum@users.sourceforge.net Thu Mar 1 18:26:55 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 01 Mar 2001 10:26:55 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects fileobject.c,2.108,2.109 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv16128 Modified Files: fileobject.c Log Message: Two improvements to large file support: - In _portable_ftell(), try fgetpos() before ftello() and ftell64(). I ran into a situation on a 64-bit capable Linux where the C library's ftello() and ftell64() returned negative numbers despite fpos_t and off_t both being 64-bit types; fgetpos() did the right thing. - Define a new typedef, Py_off_t, which is either fpos_t or off_t, depending on which one is 64 bits. This removes the need for a lot of #ifdefs later on. (XXX Should this be moved to pyport.h? That file currently seems oblivious to large fille support, so for now I'll leave it here where it's needed.) Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.108 retrieving revision 2.109 diff -C2 -r2.108 -r2.109 *** fileobject.c 2001/01/18 03:03:16 2.108 --- fileobject.c 2001/03/01 18:26:53 2.109 *************** *** 213,224 **** ! /* a portable fseek() function ! return 0 on success, non-zero on failure (with errno set) */ ! int #if defined(HAVE_LARGEFILE_SUPPORT) && SIZEOF_OFF_T < 8 && SIZEOF_FPOS_T >= 8 ! _portable_fseek(FILE *fp, fpos_t offset, int whence) #else ! _portable_fseek(FILE *fp, off_t offset, int whence) #endif { #if defined(HAVE_FSEEKO) --- 213,228 ---- ! /* An 8-byte off_t-like type */ #if defined(HAVE_LARGEFILE_SUPPORT) && SIZEOF_OFF_T < 8 && SIZEOF_FPOS_T >= 8 ! typedef fpos_t Py_off_t; #else ! typedef off_t Py_off_t; #endif + + + /* a portable fseek() function + return 0 on success, non-zero on failure (with errno set) */ + int + _portable_fseek(FILE *fp, Py_off_t offset, int whence) { #if defined(HAVE_FSEEKO) *************** *** 254,273 **** Return -1 on failure with errno set appropriately, current file position on success */ ! #if defined(HAVE_LARGEFILE_SUPPORT) && SIZEOF_OFF_T < 8 && SIZEOF_FPOS_T >= 8 ! fpos_t ! #else ! off_t ! #endif _portable_ftell(FILE* fp) { ! #if defined(HAVE_FTELLO) && defined(HAVE_LARGEFILE_SUPPORT) ! return ftello(fp); ! #elif defined(HAVE_FTELL64) && defined(HAVE_LARGEFILE_SUPPORT) ! return ftell64(fp); ! #elif SIZEOF_FPOS_T >= 8 && defined(HAVE_LARGEFILE_SUPPORT) fpos_t pos; if (fgetpos(fp, &pos) != 0) return -1; return pos; #else return ftell(fp); --- 258,273 ---- Return -1 on failure with errno set appropriately, current file position on success */ ! Py_off_t _portable_ftell(FILE* fp) { ! #if SIZEOF_FPOS_T >= 8 && defined(HAVE_LARGEFILE_SUPPORT) fpos_t pos; if (fgetpos(fp, &pos) != 0) return -1; return pos; + #elif defined(HAVE_FTELLO) && defined(HAVE_LARGEFILE_SUPPORT) + return ftello(fp); + #elif defined(HAVE_FTELL64) && defined(HAVE_LARGEFILE_SUPPORT) + return ftell64(fp); #else return ftell(fp); *************** *** 281,289 **** int whence; int ret; ! #if defined(HAVE_LARGEFILE_SUPPORT) && SIZEOF_OFF_T < 8 && SIZEOF_FPOS_T >= 8 ! fpos_t offset, pos; ! #else ! off_t offset; ! #endif /* !MS_WIN64 */ PyObject *offobj; --- 281,285 ---- int whence; int ret; ! Py_off_t offset; PyObject *offobj; *************** *** 322,330 **** { int ret; ! #if defined(HAVE_LARGEFILE_SUPPORT) && SIZEOF_OFF_T < 8 && SIZEOF_FPOS_T >= 8 ! fpos_t newsize; ! #else ! off_t newsize; ! #endif PyObject *newsizeobj; --- 318,322 ---- { int ret; ! Py_off_t newsize; PyObject *newsizeobj; *************** *** 397,405 **** file_tell(PyFileObject *f, PyObject *args) { ! #if defined(HAVE_LARGEFILE_SUPPORT) && SIZEOF_OFF_T < 8 && SIZEOF_FPOS_T >= 8 ! fpos_t pos; ! #else ! off_t pos; ! #endif if (f->f_fp == NULL) --- 389,393 ---- file_tell(PyFileObject *f, PyObject *args) { ! Py_off_t pos; if (f->f_fp == NULL) From gvanrossum@users.sourceforge.net Thu Mar 1 18:29:59 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 01 Mar 2001 10:29:59 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libposix.tex,1.55,1.56 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv16606 Modified Files: libposix.tex Log Message: Document configuration flags to compile for large file support on certain Linux systems. Index: libposix.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libposix.tex,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -r1.55 -r1.56 *** libposix.tex 1999/07/01 13:53:32 1.55 --- libposix.tex 2001/03/01 18:29:57 1.56 *************** *** 57,62 **** \begin{verbatim} CFLAGS="`getconf LFS_CFLAGS`" OPT="-g -O2 $CFLAGS" \ ! configure \end{verbatim} % $ <-- bow to font-lock --- 57,70 ---- \begin{verbatim} CFLAGS="`getconf LFS_CFLAGS`" OPT="-g -O2 $CFLAGS" \ ! ./configure \end{verbatim} % $ <-- bow to font-lock + + On large-file-capable Linux systems, this might work: + + \begin{verbatim} + CC="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" + export CC + ./configure + \end{verbatim} From fdrake@users.sourceforge.net Thu Mar 1 18:35:46 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 01 Mar 2001 10:35:46 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/dist dist.tex,1.32,1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/dist In directory usw-pr-cvs1:/tmp/cvs-serv18233/dist Modified Files: dist.tex Log Message: Comment out section titles for sections that have not been written yet; there is no need to clutter a reader's life with those useless things. Make the snippets of Python code conform to the standard style. Suppress the "Contents" page for HTML; it is not needed for small documents in the online environment since LaTeX2HTML generates lots of tables of links anyway. Various markup consistency nits. Index: dist.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/dist/dist.tex,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -r1.32 -r1.33 *** dist.tex 2001/02/19 19:14:50 1.32 --- dist.tex 2001/03/01 18:35:43 1.33 *************** *** 23,28 **** --- 23,34 ---- \end{abstract} + % The ugly "%begin{latexonly}" pseudo-environment supresses the table + % of contents for HTML generation. + % + %begin{latexonly} \tableofcontents + %end{latexonly} + \section{Introduction} \label{intro} *************** *** 89,97 **** in a file \file{foo.py}, then your setup script can be as little as this: \begin{verbatim} from distutils.core import setup ! setup (name = "foo", ! version = "1.0", ! py_modules = ["foo"]) \end{verbatim} --- 95,104 ---- in a file \file{foo.py}, then your setup script can be as little as this: + \begin{verbatim} from distutils.core import setup ! setup(name="foo", ! version="1.0", ! py_modules=["foo"]) \end{verbatim} *************** *** 112,118 **** --- 119,127 ---- To create a source distribution for this module, you would create a setup script, \file{setup.py}, containing the above code, and run: + \begin{verbatim} python setup.py sdist \end{verbatim} + which will create an archive file (e.g., tarball on \UNIX, ZIP file on Windows) containing your setup script, \file{setup.py}, and your module, *************** *** 123,129 **** --- 132,140 ---- to do is download \file{Foo-1.0.tar.gz} (or \file{.zip}), unpack it, and---from the \file{Foo-1.0} directory---run + \begin{verbatim} python setup.py install \end{verbatim} + which will ultimately copy \file{foo.py} to the appropriate directory for third-party modules in their Python installation. *************** *** 143,149 **** --- 154,162 ---- appropriate type of built distribution for this platform) with the \command{bdist\_wininst} command. For example: + \begin{verbatim} python setup.py bdist_wininst \end{verbatim} + will create an executable installer, \file{Foo-1.0.win32.exe}, in the current directory. *************** *** 153,159 **** --- 166,174 ---- command. For example, the following command will create an RPM file called \file{Foo-1.0.noarch.rpm}: + \begin{verbatim} python setup.py bdist_rpm \end{verbatim} + (This uses the \command{rpm} command, so has to be run on an RPM-based system such as Red Hat Linux, SuSE Linux, or Mandrake Linux.) *************** *** 161,164 **** --- 176,180 ---- You can find out what distribution formats are available at any time by running + \begin{verbatim} python setup.py bdist --help-formats *************** *** 250,263 **** from distutils.core import setup ! setup (name = "Distutils", ! version = "1.0", ! description = "Python Distribution Utilities", ! author = "Greg Ward", ! author_email = "gward@python.net", ! url = "http://www.python.org/sigs/distutils-sig/", ! ! packages = ['distutils', 'distutils.command'], ! ) \end{verbatim} There are only two differences between this and the trivial one-file distribution presented in section~\ref{simple-example}: more --- 266,279 ---- from distutils.core import setup ! setup(name="Distutils", ! version="1.0", ! description="Python Distribution Utilities", ! author="Greg Ward", ! author_email="gward@python.net", ! url="http://www.python.org/sigs/distutils-sig/", ! packages=['distutils', 'distutils.command'], ! ) \end{verbatim} + There are only two differences between this and the trivial one-file distribution presented in section~\ref{simple-example}: more *************** *** 283,286 **** --- 299,303 ---- or os.listdir to specify files, you should be careful to write portable code instead of hardcoding path separators: + \begin{verbatim} glob.glob(os.path.join('mydir', 'subdir', '*.html')) *************** *** 312,318 **** --- 329,337 ---- \file{lib}, modules in the \module{foo} package are in \file{lib/foo}, and so forth. Then you would put + \begin{verbatim} package_dir = {'': 'lib'} \end{verbatim} + in your setup script. (The keys to this dictionary are package names, and an empty package name stands for the root package. The values are *************** *** 324,330 **** --- 343,351 ---- \file{lib}, the \module{foo.bar} package in \file{lib/bar}, etc. This would be written in the setup script as + \begin{verbatim} package_dir = {'foo': 'lib'} \end{verbatim} + A \code{\var{package}: \var{dir}} entry in the \option{package\_dir} dictionary implicitly applies to all packages below \var{package}, so *************** *** 347,353 **** --- 368,376 ---- simplest case was shown in section~\ref{simple-example}; here is a slightly more involved example: + \begin{verbatim} py_modules = ['mod1', 'pkg.mod2'] \end{verbatim} + This describes two modules, one of them in the ``root'' package, the other in the \module{pkg} package. Again, the default package/directory *************** *** 376,390 **** additional instructions to the compiler/linker are needed, describing this extension is quite simple: \begin{verbatim} Extension("foo", ["foo.c"]) \end{verbatim} The \class{Extension} class can be imported from \module{distutils.core}, along with \function{setup()}. Thus, the setup script for a module distribution that contains only this one extension and nothing else might be: \begin{verbatim} from distutils.core import setup, Extension ! setup(name = "foo", version = "1.0", ! ext_modules = [Extension("foo", ["foo.c"])]) \end{verbatim} --- 399,416 ---- additional instructions to the compiler/linker are needed, describing this extension is quite simple: + \begin{verbatim} Extension("foo", ["foo.c"]) \end{verbatim} + The \class{Extension} class can be imported from \module{distutils.core}, along with \function{setup()}. Thus, the setup script for a module distribution that contains only this one extension and nothing else might be: + \begin{verbatim} from distutils.core import setup, Extension ! setup(name="foo", version="1.0", ! ext_modules=[Extension("foo", ["foo.c"])]) \end{verbatim} *************** *** 399,409 **** --- 425,439 ---- The first argument to the \class{Extension} constructor is always the name of the extension, including any package names. For example, + \begin{verbatim} Extension("foo", ["src/foo1.c", "src/foo2.c"]) \end{verbatim} + describes an extension that lives in the root package, while + \begin{verbatim} Extension("pkg.foo", ["src/foo1.c", "src/foo2.c"]) \end{verbatim} + describes the same extension in the \module{pkg} package. The source files and resulting object code are identical in both cases; the only *************** *** 414,424 **** the same base package), use the \option{ext\_package} keyword argument to \function{setup()}. For example, \begin{verbatim} setup(... ! ext_package = "pkg", ! ext_modules = [Extension("foo", ["foo.c"]), ! Extension("subpkg.bar", ["bar.c"])] ) \end{verbatim} will compile \file{foo.c} to the extension \module{pkg.foo}, and \file{bar.c} to \module{pkg.subpkg.bar}. --- 444,456 ---- the same base package), use the \option{ext\_package} keyword argument to \function{setup()}. For example, + \begin{verbatim} setup(... ! ext_package="pkg", ! ext_modules=[Extension("foo", ["foo.c"]), ! Extension("subpkg.bar", ["bar.c"])] ) \end{verbatim} + will compile \file{foo.c} to the extension \module{pkg.foo}, and \file{bar.c} to \module{pkg.subpkg.bar}. *************** *** 459,462 **** --- 491,495 ---- \file{include} directory under your distribution root, use the \code{include\_dirs} option: + \begin{verbatim} Extension("foo", ["foo.c"], include_dirs=["include"]) *************** *** 466,472 **** --- 499,507 ---- extension will only be built on \UNIX{} systems with X11R6 installed to \file{/usr}, you can get away with + \begin{verbatim} Extension("foo", ["foo.c"], include_dirs=["/usr/include/X11"]) \end{verbatim} + You should avoid this sort of non-portable usage if you plan to distribute your code: it's probably better to write your code to include *************** *** 486,489 **** --- 521,525 ---- though, you can find that directory using the Distutils \module{sysconfig} module: + \begin{verbatim} from distutils.sysconfig import get_python_inc *************** *** 492,495 **** --- 528,532 ---- Extension(..., include_dirs=[incdir])) \end{verbatim} + Even though this is quite portable---it will work on any Python installation, regardless of platform---it's probably easier to just *************** *** 507,510 **** --- 544,548 ---- For example: + \begin{verbatim} Extension(..., *************** *** 513,517 **** --- 551,557 ---- undef_macros=['HAVE_FOO', 'HAVE_BAR']) \end{verbatim} + is the equivalent of having this at the top of every C source file: + \begin{verbatim} #define NDEBUG 1 *************** *** 533,536 **** --- 573,577 ---- For example, if you need to link against libraries known to be in the standard library search path on target systems + \begin{verbatim} Extension(..., *************** *** 540,543 **** --- 581,585 ---- If you need to link with libraries in a non-standard location, you'll have to include the location in \code{library\_dirs}: + \begin{verbatim} Extension(..., *************** *** 545,548 **** --- 587,591 ---- libraries=["X11", "Xt"]) \end{verbatim} + (Again, this sort of non-portable construct should be avoided if you intend to distribute your code.) *************** *** 585,588 **** --- 628,632 ---- \subsection{Listing additional files} + The \option{data\_files} option can be used to specify additional files needed by the module distribution: configuration files, *************** *** 591,594 **** --- 635,639 ---- \option{data\_files} specify a sequence of \code{(directory, files)} pairs in the following way: + \begin{verbatim} setup(... *************** *** 626,632 **** or stable enough yet for real-world use.) - \XXX{should reference description of distutils config files in - ``Installing'' manual here} - The setup configuration file is a useful middle-ground between the setup script---which, ideally, would be opaque to installers\footnote{This --- 671,674 ---- *************** *** 648,651 **** --- 690,694 ---- The basic syntax of the configuration file is simple: + \begin{verbatim} [command] *************** *** 653,656 **** --- 696,700 ---- ... \end{verbatim} + where \var{command} is one of the Distutils commands (e.g. \command{build\_py}, \command{install}), and \var{option} is one of the *************** *** 663,666 **** --- 707,711 ---- You can find out the list of options supported by a particular command with the universal \longprogramopt{help} option, e.g. + \begin{verbatim} > python setup.py --help build_ext *************** *** 676,679 **** --- 721,725 ---- [...] \end{verbatim} + Or consult section \ref{reference} of this document (the command reference). *************** *** 688,702 **** --- 734,752 ---- \module{pkg.mod1} and \module{pkg.mod2}. You can always use the \longprogramopt{inplace} option on the command-line to ensure this: + \begin{verbatim} python setup.py build_ext --inplace \end{verbatim} + But this requires that you always specify the \command{build\_ext} command explicitly, and remember to provide \longprogramopt{inplace}. An easier way is to ``set and forget'' this option, by encoding it in \file{setup.cfg}, the configuration file for this distribution: + \begin{verbatim} [build_ext] inplace=1 \end{verbatim} + This will affect all builds of this module distribution, whether or not you explcitly specify \command{build\_ext}. If you include *************** *** 718,721 **** --- 768,772 ---- command-line for every run. Hence, here is a snippet from the Distutils' own \file{setup.cfg}: + \begin{verbatim} [bdist_rpm] *************** *** 728,735 **** --- 779,794 ---- examples/ \end{verbatim} + Note that the \option{doc\_files} option is simply a whitespace-separated string split across multiple lines for readability. + \begin{seealso} + \seetitle[../inst/config-syntax.html]{Installing Python + Modules}{More information on the configuration files is + available in the manual for system administrators.} + \end{seealso} + + \section{Creating a Source Distribution} \label{source-dist} *************** *** 738,744 **** --- 797,805 ---- \command{sdist} command to create a source distribution. In the simplest case, + \begin{verbatim} python setup.py sdist \end{verbatim} + (assuming you haven't specified any \command{sdist} options in the setup script or config file), \command{sdist} creates the archive of the *************** *** 749,755 **** --- 810,818 ---- You can specify as many formats as you like using the \longprogramopt{formats} option, for example: + \begin{verbatim} python setup.py sdist --formats=gztar,zip \end{verbatim} + to create a gzipped tarball and a zip file. The available formats are: \begin{tableiii}{l|l|c}{code}% *************** *** 811,814 **** --- 874,878 ---- distribution. For an example, again we turn to the Distutils' own manifest template: + \begin{verbatim} include *.txt *************** *** 816,819 **** --- 880,884 ---- prune examples/sample?/build \end{verbatim} + The meanings should be fairly clear: include all files in the distribution root matching \code{*.txt}, all files anywhere under the *************** *** 906,909 **** --- 971,975 ---- existing pattern in the manifest template, you should regenerate the manifest: + \begin{verbatim} python setup.py sdist --force-manifest *************** *** 912,918 **** --- 978,986 ---- Or, you might just want to (re)generate the manifest, but not create a source distribution: + \begin{verbatim} python setup.py sdist --manifest-only \end{verbatim} + \longprogramopt{manifest-only} implies \longprogramopt{force-manifest}. \programopt{-o} is a shortcut for \longprogramopt{manifest-only}, and *************** *** 954,960 **** --- 1022,1030 ---- As a simple example, if I run the following command in the Distutils source tree: + \begin{verbatim} python setup.py bdist \end{verbatim} + then the Distutils builds my module distribution (the Distutils itself in this case), does a ``fake'' installation (also in the \file{build} *************** *** 984,990 **** --- 1054,1062 ---- similar to the \command{sdist} command, which you can use to select the types of built distribution to generate: for example, + \begin{verbatim} python setup.py bdist --format=zip \end{verbatim} + would, when run on a \UNIX{} system, create \file{Distutils-0.8.\filevar{plat}.zip}---again, this archive would be *************** *** 1055,1069 **** --- 1127,1146 ---- The usual way to create an RPM of your module distribution is to run the \command{bdist\_rpm} command: + \begin{verbatim} python setup.py bdist_rpm \end{verbatim} + or the \command{bdist} command with the \longprogramopt{format} option: + \begin{verbatim} python setup.py bdist --formats=rpm \end{verbatim} + The former allows you to specify RPM-specific options; the latter allows you to easily specify multiple formats in one run. If you need to do both, you can explicitly specify multiple \command{bdist\_*} commands and their options: + \begin{verbatim} python setup.py bdist_rpm --packager="John Doe " \ *************** *** 1144,1147 **** --- 1221,1225 ---- \longprogramopt{spec-only}, this gives you an opportunity to customize the \file{.spec} file manually: + \begin{verbatim} > python setup.py bdist_rpm --spec-only *************** *** 1149,1152 **** --- 1227,1231 ---- > python setup.py bdist_rpm --spec-file=dist/FooBar-1.0.spec \end{verbatim} + (Although a better way to do this is probably to override the standard \command{bdist\_rpm} command with one that writes whatever else you want *************** *** 1166,1173 **** --- 1245,1255 ---- Since the meta-data is taken from the setup script, creating Windows installers is usually as easy as running: + \begin{verbatim} python setup.py bdist_wininst \end{verbatim} + or the \command{bdist} command with the \longprogramopt{format} option: + \begin{verbatim} python setup.py bdist --formats=wininst *************** *** 1191,1230 **** the \longprogramopt{no-target-optimize} option. ! \section{Examples} ! \label{examples} ! \subsection{Pure Python distribution (by module)} ! \label{pure-mod} ! \subsection{Pure Python distribution (by package)} ! \label{pure-pkg} ! \subsection{Single extension module} ! \label{single-ext} ! \subsection{Multiple extension modules} ! \label{multiple-ext} ! \subsection{Putting it all together} ! \section{Extending the Distutils} ! \label{extending} ! \subsection{Extending existing commands} ! \label{extend-existing} ! \subsection{Writing new commands} ! \label{new-commands} ! \XXX{Would an uninstall command be a good example here?} --- 1273,1312 ---- the \longprogramopt{no-target-optimize} option. ! %\section{Examples} ! %\label{examples} ! %\subsection{Pure Python distribution (by module)} ! %\label{pure-mod} ! %\subsection{Pure Python distribution (by package)} ! %\label{pure-pkg} ! %\subsection{Single extension module} ! %\label{single-ext} ! %\subsection{Multiple extension modules} ! %\label{multiple-ext} ! %\subsection{Putting it all together} ! %\section{Extending the Distutils} ! %\label{extending} ! %\subsection{Extending existing commands} ! %\label{extend-existing} ! %\subsection{Writing new commands} ! %\label{new-commands} ! %\XXX{Would an uninstall command be a good example here?} *************** *** 1234,1251 **** ! \subsection{Building modules: the \protect\command{build} command family} ! \label{build-cmds} ! \subsubsection{\protect\command{build}} ! \label{build-cmd} ! \subsubsection{\protect\command{build\_py}} ! \label{build-py-cmd} ! \subsubsection{\protect\command{build\_ext}} ! \label{build-ext-cmd} ! \subsubsection{\protect\command{build\_clib}} ! \label{build-clib-cmd} --- 1316,1333 ---- ! %\subsection{Building modules: the \protect\command{build} command family} ! %\label{build-cmds} ! %\subsubsection{\protect\command{build}} ! %\label{build-cmd} ! %\subsubsection{\protect\command{build\_py}} ! %\label{build-py-cmd} ! %\subsubsection{\protect\command{build\_ext}} ! %\label{build-ext-cmd} ! %\subsubsection{\protect\command{build\_clib}} ! %\label{build-clib-cmd} *************** *** 1258,1263 **** \command{install\_scripts}. ! \subsubsection{\protect\command{install\_lib}} ! \label{install-lib-cmd} \subsubsection{\protect\command{install\_data}} --- 1340,1345 ---- \command{install\_scripts}. ! %\subsubsection{\protect\command{install\_lib}} ! %\label{install-lib-cmd} \subsubsection{\protect\command{install\_data}} *************** *** 1270,1275 **** ! \subsection{Cleaning up: the \protect\command{clean} command} ! \label{clean-cmd} --- 1352,1357 ---- ! %\subsection{Cleaning up: the \protect\command{clean} command} ! %\label{clean-cmd} *************** *** 1310,1332 **** \XXX{Windows and MacOS support not there yet} - - \subsection{Creating a ``built'' distribution: the - \protect\command{bdist} command family} - \label{bdist-cmds} - - - \subsubsection{\protect\command{blib}} - - \subsubsection{\protect\command{blib\_dumb}} - - \subsubsection{\protect\command{blib\_rpm}} - - \subsubsection{\protect\command{blib\_wise}} --- 1392,1408 ---- \XXX{Windows and MacOS support not there yet} + %\subsection{Creating a built distribution: the + % \protect\command{bdist} command family} + %\label{bdist-cmds} + %\subsubsection{\protect\command{blib}} + %\subsubsection{\protect\command{blib\_dumb}} + %\subsubsection{\protect\command{blib\_rpm}} + %\subsubsection{\protect\command{blib\_wise}} From fdrake@users.sourceforge.net Thu Mar 1 18:37:54 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 01 Mar 2001 10:37:54 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/inst inst.tex,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/inst In directory usw-pr-cvs1:/tmp/cvs-serv18749/inst Modified Files: inst.tex Log Message: Comment out section titles for sections that have not been written yet; there is no need to clutter a reader's life with those useless things. Suppress the "Contents" page for HTML; it is not needed for small documents in the online environment since LaTeX2HTML generates lots of tables of links anyway. Various markup consistency nits. Index: inst.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/inst/inst.tex,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -r1.28 -r1.29 *** inst.tex 2001/02/17 00:42:56 1.28 --- inst.tex 2001/03/01 18:37:52 1.29 *************** *** 42,46 **** --- 42,53 ---- %\end{abstract} + + % The ugly "%begin{latexonly}" pseudo-environment supresses the table + % of contents for HTML generation. + % + %begin{latexonly} \tableofcontents + %end{latexonly} + \section{Introduction} *************** *** 114,117 **** --- 121,125 ---- \file{README}), which should explain that building and installing the module distribution is a simple matter of running + \begin{verbatim} python setup.py install *************** *** 163,169 **** --- 171,179 ---- As described in section~\ref{new-standard}, building and installing a module distribution using the Distutils is usually one simple command: + \begin{verbatim} python setup.py install \end{verbatim} + On \UNIX, you'd run this command from a shell prompt; on Windows, you have to open a command prompt window (``DOS box'') and do it there; on *************** *** 179,182 **** --- 189,193 ---- module source distribution \file{foo-1.0.tar.gz} onto a \UNIX{} system, the normal thing to do is: + \begin{verbatim} gunzip -c foo-1.0.tar.gz | tar xf - # unpacks into directory foo-1.0 *************** *** 192,195 **** --- 203,207 ---- unpack the archive. Then, open a command prompt window (``DOS box''), and run: + \begin{verbatim} cd c:\Temp\foo-1.0 *************** *** 231,238 **** --- 243,252 ---- For example, you can build everything in one step, and then install everything in a second step, by invoking the setup script twice: + \begin{verbatim} python setup.py build python setup.py install \end{verbatim} + (If you do this, you will notice that running the \command{install} command first runs the \command{build} command, which---in this *************** *** 256,262 **** --- 270,278 ---- change the build directory with the \longprogramopt{build-base} option. For example: + \begin{verbatim} python setup.py build --build-base=/tmp/pybuild/foo-1.0 \end{verbatim} + (Or you could do this permanently with a directive in your system or personal Distutils configuration file; see *************** *** 264,267 **** --- 280,284 ---- The default layout for the build tree is as follows: + \begin{verbatim} --- build/ --- lib/ *************** *** 270,273 **** --- 287,291 ---- temp./ \end{verbatim} + where \code{} expands to a brief description of the current OS/hardware platform and Python version. The first form, with just a *************** *** 407,412 **** ! \subsection{Tweaking compiler/linker flags} ! \label{tweak-flags} --- 425,430 ---- ! %\subsection{Tweaking compiler/linker flags} ! %\label{tweak-flags} *************** *** 451,460 **** --- 469,481 ---- personal stash of Python modules, probably under your home directory. Installing a new module distribution is as simple as + \begin{verbatim} python setup.py install --home=

\end{verbatim} + where you can supply any directory you like for the \longprogramopt{home} option. Lazy typists can just type a tilde (\code{\textasciitilde}); the \command{install} command will expand this to your home directory: + \begin{verbatim} python setup.py install --home=~ *************** *** 487,490 **** --- 508,512 ---- \file{/usr/local/lib/python1.\filevar{X}} rather than \file{/usr/lib/python1.\filevar{X}}. This can be done with + \begin{verbatim} /usr/bin/python setup.py install --prefix=/usr/local *************** *** 498,501 **** --- 520,524 ---- \file{/mnt/\filevar{@server}/export/lib/python1.\filevar{X}}. This could be done with + \begin{verbatim} /usr/local/bin/python setup.py install --prefix=/mnt/@server/export *************** *** 549,555 **** --- 572,580 ---- and \longprogramopt{home} options. Just use the \longprogramopt{prefix} option to specify a base directory, e.g. + \begin{verbatim} python setup.py install --prefix="\Temp\Python" \end{verbatim} + to install modules to the \file{\textbackslash{}Temp} directory on the current drive. *************** *** 607,610 **** --- 632,636 ---- sense to supply a relative path, which will be interpreted relative to the installation base directory (your home directory, in this case): + \begin{verbatim} python setup.py install --home=~ --install-scripts=scripts *************** *** 616,622 **** --- 642,650 ---- you want them in \file{/usr/local/bin} instead, you would supply this absolute directory for the \longprogramopt{install-scripts} option: + \begin{verbatim} python setup.py install --install-scripts=/usr/local/bin \end{verbatim} + (This performs an installation using the ``prefix scheme,'' where the prefix is whatever your Python interpreter was installed with--- *************** *** 629,635 **** --- 657,665 ---- two types of modules to worry about, pure modules and non-pure modules (i.e., modules from a non-pure distribution). For example: + \begin{verbatim} python setup.py install --install-purelib=Site --install-platlib=Site \end{verbatim} + The specified installation directories are relative to \filevar{prefix}. Of course, you also have to ensure that these directories are in *************** *** 645,648 **** --- 675,679 ---- you use your home directory from, you might define the following installation scheme: + \begin{verbatim} python setup.py install --home=~ \ *************** *** 652,656 **** --- 683,690 ---- --install-data=python/data \end{verbatim} + % $ % -- bow to font-lock + or, equivalently, + \begin{verbatim} python setup.py install --home=~/python \ *************** *** 660,663 **** --- 694,699 ---- --install-data=data \end{verbatim} + % $ % -- bow to font-lock + \code{\$PLAT} is not (necessarily) an environment variable---it will be expanded by the Distutils as it parses your command line options (just *************** *** 668,671 **** --- 704,708 ---- put these options into your Distutils config file (see section~\ref{config-files}): + \begin{verbatim} [install] *************** *** 676,680 **** --- 713,719 ---- install-data=python/data \end{verbatim} + or, equivalently, + \begin{verbatim} [install] *************** *** 685,693 **** --- 724,735 ---- install-data=data \end{verbatim} + Note that these two are \emph{not} equivalent if you supply a different installation base directory when you run the setup script. For example, + \begin{verbatim} python setup.py --install-base=/tmp \end{verbatim} + would install pure modules to \filevar{/tmp/python/lib} in the first case, and to \filevar{/tmp/lib} in the second case. (For the second *************** *** 798,801 **** --- 840,844 ---- For example, the following is a complete config file that just forces all commands to run quietly by default: + \begin{verbatim} [global] *************** *** 813,816 **** --- 856,860 ---- \command{build*} commands always forcibly rebuild all files with the following: + \begin{verbatim} [build] *************** *** 818,825 **** --- 862,872 ---- force=1 \end{verbatim} + which corresponds to the command-line arguments + \begin{verbatim} python setup.py build --build-base=blib --force \end{verbatim} + except that including the \command{build} command on the command-line means that command will be run. Including a particular command in *************** *** 831,857 **** You can find out the complete list of options for any command using the \longprogramopt{help} option, e.g.: \begin{verbatim} python setup.py build --help \end{verbatim} and you can find out the complete list of global options by using \longprogramopt{help} without a command: \begin{verbatim} python setup.py --help \end{verbatim} See also the ``Reference'' section of the ``Distributing Python Modules'' manual. - - \section{Pre-Distutils Conventions} - \label{pre-distutils} - \subsection{The Makefile.pre.in file} - \label{makefile-pre-in} - \subsection{Installing modules manually} - \label{manual-install} --- 878,907 ---- You can find out the complete list of options for any command using the \longprogramopt{help} option, e.g.: + \begin{verbatim} python setup.py build --help \end{verbatim} + and you can find out the complete list of global options by using \longprogramopt{help} without a command: + \begin{verbatim} python setup.py --help \end{verbatim} + See also the ``Reference'' section of the ``Distributing Python Modules'' manual. + %\section{Pre-Distutils Conventions} + %\label{pre-distutils} + %\subsection{The Makefile.pre.in file} + %\label{makefile-pre-in} + %\subsection{Installing modules manually} + %\label{manual-install} From fdrake@users.sourceforge.net Thu Mar 1 18:38:59 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 01 Mar 2001 10:38:59 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc Makefile,1.211,1.212 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory usw-pr-cvs1:/tmp/cvs-serv19060 Modified Files: Makefile Log Message: Use larger chunks for the HTML version of the Distutils documentation. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile,v retrieving revision 1.211 retrieving revision 1.212 diff -C2 -r1.211 -r1.212 *** Makefile 2001/03/01 06:01:20 1.211 --- Makefile 2001/03/01 18:38:56 1.212 *************** *** 272,279 **** inst html/inst/inst.html: $(INSTFILES) perl/distutils.perl ! $(MKHTML) --dir html/inst inst/inst.tex dist html/dist/dist.html: $(DISTFILES) perl/distutils.perl ! $(MKHTML) --dir html/dist dist/dist.tex --- 272,279 ---- inst html/inst/inst.html: $(INSTFILES) perl/distutils.perl ! $(MKHTML) --dir html/inst --split 4 inst/inst.tex dist html/dist/dist.html: $(DISTFILES) perl/distutils.perl ! $(MKHTML) --dir html/dist --split 4 dist/dist.tex From ping@users.sourceforge.net Thu Mar 1 19:31:27 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Thu, 01 Mar 2001 11:31:27 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv31533 Modified Files: pydoc.py Log Message: Also accept .so as an extension for module files. Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** pydoc.py 2001/03/01 13:55:20 1.9 --- pydoc.py 2001/03/01 19:31:25 1.10 *************** *** 128,139 **** """Return the Python module name for a given path, or None.""" filename = os.path.basename(path) ! if lower(filename[-3:]) == '.py': ! return filename[:-3] ! elif lower(filename[-4:]) in ['.pyc', '.pyd', '.pyo']: ! return filename[:-4] ! elif lower(filename[-11:]) == 'module.so': ! return filename[:-11] ! elif lower(filename[-13:]) == 'module.so.1': ! return filename[:-13] class DocImportError(Exception): --- 128,135 ---- """Return the Python module name for a given path, or None.""" filename = os.path.basename(path) ! for ending in ['.py', '.pyc', '.pyd', '.pyo', ! 'module.so', 'module.so.1', '.so']: ! if len(filename) > len(ending) and filename[-len(ending):] == ending: ! return filename[:-len(ending)] class DocImportError(Exception): From fdrake@users.sourceforge.net Thu Mar 1 19:54:31 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 01 Mar 2001 11:54:31 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc Makefile.deps,1.60,1.61 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory usw-pr-cvs1:/tmp/cvs-serv4046 Modified Files: Makefile.deps Log Message: Added entry for urllib2 documentation. Index: Makefile.deps =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile.deps,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -r1.60 -r1.61 *** Makefile.deps 2001/02/28 23:02:20 1.60 --- Makefile.deps 2001/03/01 19:54:29 1.61 *************** *** 106,109 **** --- 106,110 ---- lib/libcgi.tex \ lib/liburllib.tex \ + lib/liburllib2.tex \ lib/libhttplib.tex \ lib/libftplib.tex \ From fdrake@users.sourceforge.net Thu Mar 1 19:54:31 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 01 Mar 2001 11:54:31 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib lib.tex,1.182,1.183 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv4046/lib Modified Files: lib.tex Log Message: Added entry for urllib2 documentation. Index: lib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/lib.tex,v retrieving revision 1.182 retrieving revision 1.183 diff -C2 -r1.182 -r1.183 *** lib.tex 2001/02/28 23:02:20 1.182 --- lib.tex 2001/03/01 19:54:29 1.183 *************** *** 195,198 **** --- 195,199 ---- \input{libcgi} \input{liburllib} + \input{liburllib2} \input{libhttplib} \input{libftplib} From gvanrossum@users.sourceforge.net Thu Mar 1 20:35:47 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 01 Mar 2001 12:35:47 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_scope.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv12954 Modified Files: test_scope.py Log Message: Test interaction of global and nested scopes -- thanks to Samuele Pedroni. Index: test_scope.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_scope.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** test_scope.py 2001/02/27 20:23:58 1.9 --- test_scope.py 2001/03/01 20:35:45 1.10 *************** *** 319,320 **** --- 319,385 ---- verify(makeAddPair((1, 2))((100, 200)) == (101,202)) + + print "15. scope of global statements" + # Examples posted by Samuele Pedroni to python-dev on 3/1/2001 + + # I + x = 7 + def f(): + x = 1 + def g(): + global x + def i(): + def h(): + return x + return h() + return i() + return g() + verify(f() == 7) + verify(x == 7) + + # II + x = 7 + def f(): + x = 1 + def g(): + x = 2 + def i(): + def h(): + return x + return h() + return i() + return g() + verify(f() == 2) + verify(x == 7) + + # III + x = 7 + def f(): + x = 1 + def g(): + global x + x = 2 + def i(): + def h(): + return x + return h() + return i() + return g() + verify(f() == 2) + verify(x == 2) + + # IV + x = 7 + def f(): + x = 3 + def g(): + global x + x = 2 + def i(): + def h(): + return x + return h() + return i() + return g() + verify(f() == 2) + verify(x == 2) From gvanrossum@users.sourceforge.net Thu Mar 1 20:35:47 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 01 Mar 2001 12:35:47 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_scope,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv12954/output Modified Files: test_scope Log Message: Test interaction of global and nested scopes -- thanks to Samuele Pedroni. Index: test_scope =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_scope,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** test_scope 2001/02/09 22:56:46 1.3 --- test_scope 2001/03/01 20:35:45 1.4 *************** *** 14,15 **** --- 14,16 ---- 13. UnboundLocal 14. complex definitions + 15. scope of global statements From gvanrossum@users.sourceforge.net Thu Mar 1 20:36:50 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 01 Mar 2001 12:36:50 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc ACKS,1.82,1.83 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv13203 Modified Files: ACKS Log Message: Add Samuele Pedroni Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -r1.82 -r1.83 *** ACKS 2001/02/21 02:19:44 1.82 --- ACKS 2001/03/01 20:36:48 1.83 *************** *** 290,293 **** --- 290,294 ---- Randy Pausch Marcel van der Peijl + Samuele Pedroni Steven Pemberton Tim Peters From fdrake@users.sourceforge.net Thu Mar 1 20:48:19 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 01 Mar 2001 12:48:19 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules pyexpat.c,2.42,2.43 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv15479 Modified Files: pyexpat.c Log Message: Wrap some long lines, use only C89 /* */ comments, and add spaces around some operators (style guide conformance). Index: pyexpat.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/pyexpat.c,v retrieving revision 2.42 retrieving revision 2.43 diff -C2 -r2.42 -r2.43 *** pyexpat.c 2001/02/17 18:12:50 2.42 --- pyexpat.c 2001/03/01 20:48:17 2.43 *************** *** 1073,1077 **** static char template_buffer[257]; ! PyObject * template_string=NULL; static void --- 1073,1077 ---- static char template_buffer[257]; ! PyObject *template_string = NULL; static void *************** *** 1079,1086 **** { int i; ! for (i=0;i<256;i++) { ! template_buffer[i]=i; } ! template_buffer[256]=0; } --- 1079,1086 ---- { int i; ! for (i = 0; i < 256; i++) { ! template_buffer[i] = i; } ! template_buffer[256] = 0; } *************** *** 1090,1110 **** XML_Encoding * info) { ! PyUnicodeObject * _u_string=NULL; ! int result=0; int i; ! _u_string=(PyUnicodeObject *) PyUnicode_Decode(template_buffer, 256, name, "replace"); // Yes, supports only 8bit encodings ! if (_u_string==NULL) { return result; - } ! for (i=0; i<256; i++) { ! Py_UNICODE c = _u_string->str[i] ; // Stupid to access directly, but fast ! if (c==Py_UNICODE_REPLACEMENT_CHARACTER) { info->map[i] = -1; ! } else { info->map[i] = c; - } } --- 1090,1111 ---- XML_Encoding * info) { ! PyUnicodeObject *_u_string = NULL; ! int result = 0; int i; ! /* Yes, supports only 8bit encodings */ ! _u_string = (PyUnicodeObject *) ! PyUnicode_Decode(template_buffer, 256, name, "replace"); ! if (_u_string == NULL) return result; ! for (i = 0; i < 256; i++) { ! /* Stupid to access directly, but fast */ ! Py_UNICODE c = _u_string->str[i]; ! if (c == Py_UNICODE_REPLACEMENT_CHARACTER) info->map[i] = -1; ! else info->map[i] = c; } From fdrake@users.sourceforge.net Thu Mar 1 21:54:51 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 01 Mar 2001 13:54:51 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules termios.c,2.16,2.17 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv29170 Modified Files: termios.c Log Message: Solaris defines VSWTCH instead of VSWTC; carefully make sure both are defined and export both names. Solaris also does not define CBAUDEX; it is not clear that CBAUDEXT (which is defined there) is the same thing, so we only protect against the lack of CBAUDEX. Reported by Greg V. Wilson. Index: termios.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/termios.c,v retrieving revision 2.16 retrieving revision 2.17 diff -C2 -r2.16 -r2.17 *** termios.c 2001/03/01 03:28:08 2.16 --- termios.c 2001/03/01 21:54:49 2.17 *************** *** 295,298 **** --- 295,306 ---- + #if defined(VSWTCH) && !defined(VSWTC) + #define VSWTC VSWTCH + #endif + + #if defined(VSWTC) && !defined(VSWTCH) + #define VSWTCH VSWTC + #endif + static struct constant { char *name; *************** *** 321,325 **** --- 329,335 ---- {"B230400", B230400}, #endif + #ifdef CBAUDEX {"CBAUDEX", CBAUDEX}, + #endif /* tcsetattr() constants */ *************** *** 441,444 **** --- 451,455 ---- {"VMIN", VMIN}, {"VSWTC", VSWTC}, + {"VSWTCH", VSWTCH}, {"VSTART", VSTART}, {"VSTOP", VSTOP}, From thomas@xs4all.net Thu Mar 1 22:06:33 2001 From: thomas@xs4all.net (Thomas Wouters) Date: Thu, 1 Mar 2001 23:06:33 +0100 Subject: [Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.9,1.10 In-Reply-To: ; from ping@users.sourceforge.net on Thu, Mar 01, 2001 at 11:31:27AM -0800 References: Message-ID: <20010301230633.N9678@xs4all.nl> On Thu, Mar 01, 2001 at 11:31:27AM -0800, Ka-Ping Yee wrote: > --- 128,135 ---- > """Return the Python module name for a given path, or None.""" > filename = os.path.basename(path) > ! for ending in ['.py', '.pyc', '.pyd', '.pyo', > ! 'module.so', 'module.so.1', '.so']: > ! if len(filename) > len(ending) and filename[-len(ending):] == ending: > ! return filename[:-len(ending)] Out of curiosity, why are you specialcasing 'module.so.1' ? Shouldn't that be r'module\.so\.\d+' ? Or even better, r'module\.so(\.\d+)*' ? -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From tim_one@users.sourceforge.net Thu Mar 1 22:19:41 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 01 Mar 2001 14:19:41 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.130,1.131 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv2211/python/dist/src/Misc Modified Files: NEWS Log Message: Thank Jason Tishler and Steven Majewski for their help in the Cygwin and MacOS X ports. Change section header to beta 1. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.130 retrieving revision 1.131 diff -C2 -r1.130 -r1.131 *** NEWS 2001/03/01 02:31:33 1.130 --- NEWS 2001/03/01 22:19:38 1.131 *************** *** 1,4 **** ! What's New in Python 2.1 alpha 509? ! =================================== Core language, builtins, and interpreter --- 1,4 ---- ! What's New in Python 2.1 beta 1? ! ================================ Core language, builtins, and interpreter *************** *** 72,75 **** --- 72,83 ---- - Build: Subproject _test (effectively) renamed to _testcapi. + + New platforms + + - 2.1 should compile and run out of the box under MacOS X, even using HFS+. + Thanks to Steven Majewski! + + - 2.1 should compile and run out of the box on Cygwin. Thanks to Jason + Tishler! From loewis@users.sourceforge.net Thu Mar 1 22:56:20 2001 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Thu, 01 Mar 2001 14:56:20 -0800 Subject: [Python-checkins] CVS: python/dist/src/Tools/i18n pygettext.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/i18n In directory usw-pr-cvs1:/tmp/cvs-serv7975 Modified Files: pygettext.py Log Message: Put current date into POT-Creation-Date; leave PO-Revision-Date for for the translator to update; that is compatible with xgettext 0.10.35. Index: pygettext.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/i18n/pygettext.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** pygettext.py 2001/02/26 04:46:53 1.12 --- pygettext.py 2001/03/01 22:56:17 1.13 *************** *** 146,150 **** def _(s): return s ! __version__ = '1.2' default_keywords = ['_'] --- 146,150 ---- def _(s): return s ! __version__ = '1.3' default_keywords = ['_'] *************** *** 165,169 **** msgstr "" "Project-Id-Version: PACKAGE VERSION\\n" ! "PO-Revision-Date: %(time)s\\n" "Last-Translator: FULL NAME \\n" "Language-Team: LANGUAGE \\n" --- 165,170 ---- msgstr "" "Project-Id-Version: PACKAGE VERSION\\n" ! "POT-Creation-Date: %(time)s\\n" ! "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n" "Last-Translator: FULL NAME \\n" "Language-Team: LANGUAGE \\n" From jhylton@users.sourceforge.net Thu Mar 1 22:59:16 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Thu, 01 Mar 2001 14:59:16 -0800 Subject: [Python-checkins] CVS: python/dist/src/Include compile.h,2.27,2.28 pythonrun.h,2.38,2.39 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv8579/Include Modified Files: compile.h pythonrun.h Log Message: Useful future statement support for the interactive interpreter (Also remove warning about module-level global decl, because we can't distinguish from code passed to exec.) Define PyCompilerFlags type contains a single element, cf_nested_scopes, that is true if a nested scopes future statement has been entered at the interactive prompt. New API functions: PyNode_CompileFlags() PyRun_InteractiveOneFlags() -- same as their non Flags counterparts except that the take an optional PyCompilerFlags pointer compile.c: In jcompile() use PyCompilerFlags argument. If cf_nested_scopes is true, compile code with nested scopes. If it is false, but the code has a valid future nested scopes statement, set it to true. pythonrun.c: Create a new PyCompilerFlags object in PyRun_InteractiveLoop() and thread it through to PyRun_InteractiveOneFlags(). Index: compile.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/compile.h,v retrieving revision 2.27 retrieving revision 2.28 diff -C2 -r2.27 -r2.28 *** compile.h 2001/02/28 01:58:08 2.27 --- compile.h 2001/03/01 22:59:14 2.28 *************** *** 58,61 **** --- 58,63 ---- DL_IMPORT(PyFutureFeatures *) PyNode_Future(struct _node *, char *); + DL_IMPORT(PyCodeObject *) PyNode_CompileFlags(struct _node *, char *, + PyCompilerFlags *); #define NESTED_SCOPES_DEFAULT 0 Index: pythonrun.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pythonrun.h,v retrieving revision 2.38 retrieving revision 2.39 diff -C2 -r2.38 -r2.39 *** pythonrun.h 2001/02/02 18:19:15 2.38 --- pythonrun.h 2001/03/01 22:59:14 2.39 *************** *** 8,11 **** --- 8,15 ---- #endif + typedef struct { + int cf_nested_scopes; + } PyCompilerFlags; + DL_IMPORT(void) Py_SetProgramName(char *); DL_IMPORT(char *) Py_GetProgramName(void); *************** *** 27,30 **** --- 31,35 ---- DL_IMPORT(int) PyRun_SimpleFileEx(FILE *, char *, int); DL_IMPORT(int) PyRun_InteractiveOne(FILE *, char *); + DL_IMPORT(int) PyRun_InteractiveOneFlags(FILE *, char *, PyCompilerFlags *); DL_IMPORT(int) PyRun_InteractiveLoop(FILE *, char *); From jhylton@users.sourceforge.net Thu Mar 1 22:59:16 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Thu, 01 Mar 2001 14:59:16 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python compile.c,2.184,2.185 pythonrun.c,2.125,2.126 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv8579/Python Modified Files: compile.c pythonrun.c Log Message: Useful future statement support for the interactive interpreter (Also remove warning about module-level global decl, because we can't distinguish from code passed to exec.) Define PyCompilerFlags type contains a single element, cf_nested_scopes, that is true if a nested scopes future statement has been entered at the interactive prompt. New API functions: PyNode_CompileFlags() PyRun_InteractiveOneFlags() -- same as their non Flags counterparts except that the take an optional PyCompilerFlags pointer compile.c: In jcompile() use PyCompilerFlags argument. If cf_nested_scopes is true, compile code with nested scopes. If it is false, but the code has a valid future nested scopes statement, set it to true. pythonrun.c: Create a new PyCompilerFlags object in PyRun_InteractiveLoop() and thread it through to PyRun_InteractiveOneFlags(). Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.184 retrieving revision 2.185 diff -C2 -r2.184 -r2.185 *** compile.c 2001/03/01 06:09:34 2.184 --- compile.c 2001/03/01 22:59:14 2.185 *************** *** 472,476 **** static void com_assign_name(struct compiling *, node *, int); static PyCodeObject *icompile(node *, struct compiling *); ! static PyCodeObject *jcompile(node *, char *, struct compiling *); static PyObject *parsestrplus(node *); static PyObject *parsestr(char *); --- 472,477 ---- static void com_assign_name(struct compiling *, node *, int); static PyCodeObject *icompile(node *, struct compiling *); ! static PyCodeObject *jcompile(node *, char *, struct compiling *, ! PyCompilerFlags *); static PyObject *parsestrplus(node *); static PyObject *parsestr(char *); *************** *** 3817,3823 **** PyNode_Compile(node *n, char *filename) { ! return jcompile(n, filename, NULL); } struct symtable * PyNode_CompileSymtable(node *n, char *filename) --- 3818,3830 ---- PyNode_Compile(node *n, char *filename) { ! return PyNode_CompileFlags(n, filename, NULL); } + PyCodeObject * + PyNode_CompileFlags(node *n, char *filename, PyCompilerFlags *flags) + { + return jcompile(n, filename, NULL, flags); + } + struct symtable * PyNode_CompileSymtable(node *n, char *filename) *************** *** 3845,3853 **** icompile(node *n, struct compiling *base) { ! return jcompile(n, base->c_filename, base); } static PyCodeObject * ! jcompile(node *n, char *filename, struct compiling *base) { struct compiling sc; --- 3852,3861 ---- icompile(node *n, struct compiling *base) { ! return jcompile(n, base->c_filename, base, NULL); } static PyCodeObject * ! jcompile(node *n, char *filename, struct compiling *base, ! PyCompilerFlags *flags) { struct compiling sc; *************** *** 3865,3872 **** sc.c_private = NULL; sc.c_future = PyNode_Future(n, filename); ! if (sc.c_future == NULL || symtable_build(&sc, n) < 0) { com_free(&sc); return NULL; } } co = NULL; --- 3873,3890 ---- sc.c_private = NULL; sc.c_future = PyNode_Future(n, filename); ! if (sc.c_future == NULL) { com_free(&sc); return NULL; } + if (flags) { + if (flags->cf_nested_scopes) + sc.c_future->ff_nested_scopes = 1; + else if (sc.c_future->ff_nested_scopes) + flags->cf_nested_scopes = 1; + } + if (symtable_build(&sc, n) < 0) { + com_free(&sc); + return NULL; + } } co = NULL; *************** *** 4953,4962 **** int i; ! if (st->st_nscopes == 1) { ! /* XXX must check that we are compiling file_input */ ! if (symtable_warn(st, ! "global statement has no meaning at module level") < 0) ! return; ! } for (i = 1; i < NCH(n); i += 2) { --- 4971,4978 ---- int i; ! /* XXX It might be helpful to warn about module-level global ! statements, but it's hard to tell the difference between ! module-level and a string passed to exec. ! */ for (i = 1; i < NCH(n); i += 2) { Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.125 retrieving revision 2.126 diff -C2 -r2.125 -r2.126 *** pythonrun.c 2001/02/28 20:58:04 2.125 --- pythonrun.c 2001/03/01 22:59:14 2.126 *************** *** 37,46 **** static void initmain(void); static void initsite(void); ! static PyObject *run_err_node(node *n, char *filename, ! PyObject *globals, PyObject *locals); ! static PyObject *run_node(node *n, char *filename, ! PyObject *globals, PyObject *locals); ! static PyObject *run_pyc_file(FILE *fp, char *filename, ! PyObject *globals, PyObject *locals); static void err_input(perrdetail *); static void initsigs(void); --- 37,45 ---- static void initmain(void); static void initsite(void); ! static PyObject *run_err_node(node *, char *, PyObject *, PyObject *, ! PyCompilerFlags *); ! static PyObject *run_node(node *, char *, PyObject *, PyObject *, ! PyCompilerFlags *); ! static PyObject *run_pyc_file(FILE *, char *, PyObject *, PyObject *); static void err_input(perrdetail *); static void initsigs(void); *************** *** 57,61 **** extern void _PyCodecRegistry_Fini(void); - int Py_DebugFlag; /* Needed by parser.c */ int Py_VerboseFlag; /* Needed by import.c */ --- 56,59 ---- *************** *** 473,476 **** --- 471,477 ---- PyObject *v; int ret; + PyCompilerFlags flags; + + flags.cf_nested_scopes = 0; v = PySys_GetObject("ps1"); if (v == NULL) { *************** *** 484,488 **** } for (;;) { ! ret = PyRun_InteractiveOne(fp, filename); #ifdef Py_REF_DEBUG fprintf(stderr, "[%ld refs]\n", _Py_RefTotal); --- 485,489 ---- } for (;;) { ! ret = PyRun_InteractiveOneFlags(fp, filename, &flags); #ifdef Py_REF_DEBUG fprintf(stderr, "[%ld refs]\n", _Py_RefTotal); *************** *** 500,503 **** --- 501,510 ---- PyRun_InteractiveOne(FILE *fp, char *filename) { + return PyRun_InteractiveOneFlags(fp, filename, NULL); + } + + int + PyRun_InteractiveOneFlags(FILE *fp, char *filename, PyCompilerFlags *flags) + { PyObject *m, *d, *v, *w; node *n; *************** *** 538,542 **** return -1; d = PyModule_GetDict(m); ! v = run_node(n, filename, d, d); if (v == NULL) { PyErr_Print(); --- 545,549 ---- return -1; d = PyModule_GetDict(m); ! v = run_node(n, filename, d, d, flags); if (v == NULL) { PyErr_Print(); *************** *** 908,912 **** { return run_err_node(PyParser_SimpleParseString(str, start), ! "", globals, locals); } --- 915,919 ---- { return run_err_node(PyParser_SimpleParseString(str, start), ! "", globals, locals, NULL); } *************** *** 925,945 **** if (closeit) fclose(fp); ! return run_err_node(n, filename, globals, locals); } static PyObject * ! run_err_node(node *n, char *filename, PyObject *globals, PyObject *locals) { if (n == NULL) return NULL; ! return run_node(n, filename, globals, locals); } static PyObject * ! run_node(node *n, char *filename, PyObject *globals, PyObject *locals) { PyCodeObject *co; PyObject *v; ! co = PyNode_Compile(n, filename); PyNode_Free(n); if (co == NULL) --- 932,955 ---- if (closeit) fclose(fp); ! return run_err_node(n, filename, globals, locals, NULL); } static PyObject * ! run_err_node(node *n, char *filename, PyObject *globals, PyObject *locals, ! PyCompilerFlags *flags) { if (n == NULL) return NULL; ! return run_node(n, filename, globals, locals, flags); } static PyObject * ! run_node(node *n, char *filename, PyObject *globals, PyObject *locals, ! PyCompilerFlags *flags) { PyCodeObject *co; PyObject *v; ! /* XXX pass sess->ss_nested_scopes to PyNode_Compile */ ! co = PyNode_CompileFlags(n, filename, flags); PyNode_Free(n); if (co == NULL) From ping@users.sourceforge.net Fri Mar 2 01:19:16 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Thu, 01 Mar 2001 17:19:16 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv831 Modified Files: pydoc.py Log Message: Use imp.get_suffixes to determine a module name in modulename(file). When possible, display strings containing backslashes using r'' notation. Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** pydoc.py 2001/03/01 19:31:25 1.10 --- pydoc.py 2001/03/02 01:19:14 1.11 *************** *** 128,135 **** """Return the Python module name for a given path, or None.""" filename = os.path.basename(path) ! for ending in ['.py', '.pyc', '.pyd', '.pyo', ! 'module.so', 'module.so.1', '.so']: ! if len(filename) > len(ending) and filename[-len(ending):] == ending: ! return filename[:-len(ending)] class DocImportError(Exception): --- 128,138 ---- """Return the Python module name for a given path, or None.""" filename = os.path.basename(path) ! suffixes = map(lambda (suffix, mode, kind): (len(suffix), suffix), ! imp.get_suffixes()) ! suffixes.sort() ! suffixes.reverse() # try longest suffixes first, in case they overlap ! for length, suffix in suffixes: ! if len(filename) > length and filename[-length:] == suffix: ! return filename[:-length] class DocImportError(Exception): *************** *** 206,212 **** def repr_string(self, x, level): ! text = self.escape(cram(x, self.maxstring)) ! return re.sub(r'((\\[\\abfnrtv]|\\x..|\\u....)+)', ! r'\1', repr(text)) def repr_instance(self, x, level): --- 209,221 ---- def repr_string(self, x, level): ! test = cram(x, self.maxstring) ! testrepr = repr(test) ! if '\\' in test and '\\' not in replace(testrepr, (r'\\', '')): ! # Backslashes are only literal in the string and are never ! # needed to make any special characters, so show a raw string. ! return 'r' + testrepr[0] + self.escape(test) + testrepr[0] ! return re.sub(r'((\\[\\abfnrtv\'"]|\\x..|\\u....)+)', ! r'\1', ! self.escape(testrepr)) def repr_instance(self, x, level): *************** *** 596,599 **** --- 605,617 ---- else: return cram(stripid(repr(x)), self.maxother) + + def repr_string(self, x, level): + test = cram(x, self.maxstring) + testrepr = repr(test) + if '\\' in test and '\\' not in replace(testrepr, (r'\\', '')): + # Backslashes are only literal in the string and are never + # needed to make any special characters, so show a raw string. + return 'r' + testrepr[0] + test + testrepr[0] + return testrepr def repr_instance(self, x, level): From ping@users.sourceforge.net Fri Mar 2 01:19:41 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Thu, 01 Mar 2001 17:19:41 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib inspect.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv991 Modified Files: inspect.py Log Message: When seeking the module for an object, compare absolute (not relative) paths. Index: inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** inspect.py 2001/03/01 13:56:16 1.4 --- inspect.py 2001/03/02 01:19:39 1.5 *************** *** 28,32 **** __date__ = '1 Jan 2001' ! import sys, types, string, dis, imp, tokenize # ----------------------------------------------------------- type-checking --- 28,32 ---- __date__ = '1 Jan 2001' ! import sys, os, types, string, dis, imp, tokenize # ----------------------------------------------------------- type-checking *************** *** 200,204 **** return sys.modules.get(object.__module__) try: ! file = getsourcefile(object) except TypeError: return None --- 200,204 ---- return sys.modules.get(object.__module__) try: ! file = os.path.abspath(getsourcefile(object)) except TypeError: return None *************** *** 207,211 **** for module in sys.modules.values(): if hasattr(module, '__file__'): ! modulesbyfile[getsourcefile(module)] = module.__name__ if modulesbyfile.has_key(file): return sys.modules[modulesbyfile[file]] --- 207,212 ---- for module in sys.modules.values(): if hasattr(module, '__file__'): ! modulesbyfile[ ! os.path.abspath(getsourcefile(module))] = module.__name__ if modulesbyfile.has_key(file): return sys.modules[modulesbyfile[file]] From tim_one@users.sourceforge.net Fri Mar 2 01:48:18 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 01 Mar 2001 17:48:18 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_global.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv6515/python/dist/src/Lib/test Modified Files: test_global.py Log Message: test_global was broken by some recent checkin. Repairing. Index: test_global.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_global.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** test_global.py 2001/02/28 23:49:19 1.4 --- test_global.py 2001/03/02 01:48:16 1.5 *************** *** 1,3 **** ! """Verify that warnings are issued for global statements following use""" from test_support import check_syntax --- 1,3 ---- ! """Verify that warnings are issued for global statements following use.""" from test_support import check_syntax *************** *** 7,17 **** warnings.filterwarnings("error", module="") ! def compile_and_catch_warning(text): try: compile(text, "", "exec") except SyntaxError, msg: ! print "got SyntaxError as expected" else: ! print "expected SyntaxError" prog_text_1 = """ --- 7,23 ---- warnings.filterwarnings("error", module="") ! def compile_and_check(text, should_fail=1): try: compile(text, "", "exec") except SyntaxError, msg: ! if should_fail: ! print "got SyntaxError as expected" ! else: ! print "raised unexpected SyntaxError:", text else: ! if should_fail: ! print "should have raised SyntaxError:", text ! else: ! print "as expected, no SyntaxError" prog_text_1 = """ *************** *** 22,26 **** global b """ ! compile_and_catch_warning(prog_text_1) prog_text_2 = """ --- 28,32 ---- global b """ ! compile_and_check(prog_text_1) prog_text_2 = """ *************** *** 29,33 **** global x """ ! compile_and_catch_warning(prog_text_2) prog_text_3 = """ --- 35,39 ---- global x """ ! compile_and_check(prog_text_2) prog_text_3 = """ *************** *** 37,41 **** global x """ ! compile_and_catch_warning(prog_text_3) prog_text_4 = """ --- 43,47 ---- global x """ ! compile_and_check(prog_text_3) prog_text_4 = """ *************** *** 43,45 **** x = 2 """ ! compile_and_catch_warning(prog_text_4) --- 49,51 ---- x = 2 """ ! compile_and_check(prog_text_4, 0) From tim_one@users.sourceforge.net Fri Mar 2 01:48:18 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 01 Mar 2001 17:48:18 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_global,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv6515/python/dist/src/Lib/test/output Modified Files: test_global Log Message: test_global was broken by some recent checkin. Repairing. Index: test_global =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_global,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** test_global 2001/02/28 23:49:19 1.3 --- test_global 2001/03/02 01:48:16 1.4 *************** *** 3,5 **** got SyntaxError as expected got SyntaxError as expected ! got SyntaxError as expected --- 3,5 ---- got SyntaxError as expected got SyntaxError as expected ! as expected, no SyntaxError From ping@users.sourceforge.net Fri Mar 2 02:01:42 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Thu, 01 Mar 2001 18:01:42 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib webbrowser.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv8678 Modified Files: webbrowser.py Log Message: Clarify synopsis line a bit. Remove -no-about-splash option (not understood by all Netscapes). Index: webbrowser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/webbrowser.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** webbrowser.py 2001/03/01 04:27:19 1.14 --- webbrowser.py 2001/03/02 02:01:40 1.15 *************** *** 1,3 **** ! """Remote-control interfaces to common browsers.""" import os --- 1,3 ---- ! """Interfaces for launching and remotely controlling Web browsers.""" import os *************** *** 95,99 **** register("w3m", None, GenericBrowser("w3m %s")) ! # X browsers have mre in the way of options if os.environ.get("DISPLAY"): # First, the Netscape series --- 95,99 ---- register("w3m", None, GenericBrowser("w3m %s")) ! # X browsers have more in the way of options if os.environ.get("DISPLAY"): # First, the Netscape series *************** *** 112,116 **** if rc: import time ! os.system("%s -no-about-splash &" % self.name) time.sleep(PROCESS_CREATION_DELAY) rc = os.system(cmd) --- 112,116 ---- if rc: import time ! os.system("%s &" % self.name) time.sleep(PROCESS_CREATION_DELAY) rc = os.system(cmd) From ping@users.sourceforge.net Fri Mar 2 02:08:55 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Thu, 01 Mar 2001 18:08:55 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib inspect.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv9814 Modified Files: inspect.py Log Message: Clarify the purpose of getsourcefile(). Add getabsfile() for getting a most-normalized path. Index: inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** inspect.py 2001/03/02 01:19:39 1.5 --- inspect.py 2001/03/02 02:08:53 1.6 *************** *** 170,174 **** def getfile(object): ! """Try to guess which (text or binary) file an object was defined in.""" if ismodule(object): if hasattr(object, '__file__'): --- 170,174 ---- def getfile(object): ! """Work out which source or compiled file an object was defined in.""" if ismodule(object): if hasattr(object, '__file__'): *************** *** 193,196 **** --- 193,211 ---- 'function, traceback, frame, or code object' + def getsourcefile(object): + """Return the Python source file an object was defined in, if it exists.""" + filename = getfile(object) + if string.lower(filename[-4:]) in ['.pyc', '.pyo']: + filename = filename[:-4] + '.py' + if string.lower(filename[-3:]) == '.py' and os.path.exists(filename): + return filename + + def getabsfile(object): + """Return an absolute path to the source file or compiled file for an object. + + The idea is for each object to have a unique origin, so this routine normalizes + the result as much as possible.""" + return os.path.normcase(os.path.abspath(getsourcefile(object) or getfile(object))) + modulesbyfile = {} *************** *** 200,204 **** return sys.modules.get(object.__module__) try: ! file = os.path.abspath(getsourcefile(object)) except TypeError: return None --- 215,219 ---- return sys.modules.get(object.__module__) try: ! file = getabsfile(object) except TypeError: return None *************** *** 207,212 **** for module in sys.modules.values(): if hasattr(module, '__file__'): ! modulesbyfile[ ! os.path.abspath(getsourcefile(module))] = module.__name__ if modulesbyfile.has_key(file): return sys.modules[modulesbyfile[file]] --- 222,226 ---- for module in sys.modules.values(): if hasattr(module, '__file__'): ! modulesbyfile[getabsfile(module)] = module.__name__ if modulesbyfile.has_key(file): return sys.modules[modulesbyfile[file]] *************** *** 222,232 **** except AttributeError: pass - def getsourcefile(object): - """Try to guess which Python source file an object was defined in.""" - filename = getfile(object) - if filename[-4:] == '.pyc': - filename = filename[:-4] + '.py' - return filename - def findsource(object): """Return the entire source file and starting line number for an object. --- 236,239 ---- *************** *** 572,576 **** lines = lines[start:start+context] index = lineno - 1 - start ! except: lines = index = None else: --- 579,583 ---- lines = lines[start:start+context] index = lineno - 1 - start ! except IOError: lines = index = None else: From ping@users.sourceforge.net Fri Mar 2 02:45:10 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Thu, 01 Mar 2001 18:45:10 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv16004 Modified Files: pydoc.py Log Message: Clean up the handling of getsourcefile/getabsfile. Remove __main__ from the index of built-in modules. Miscellaneous compatibility fixes. Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** pydoc.py 2001/03/02 01:19:14 1.11 --- pydoc.py 2001/03/02 02:45:08 1.12 *************** *** 63,67 **** line = file.readline() if not line: break ! result = split(line, '"""')[0] else: result = None file.close() --- 63,67 ---- line = file.readline() if not line: break ! result = strip(split(line, '"""')[0]) else: result = None file.close() *************** *** 87,91 **** try: result = inspect.getcomments(object) except: pass ! return result and rstrip(result) or '' def classname(object, modname): --- 87,91 ---- try: result = inspect.getcomments(object) except: pass ! return result and re.sub('^ *\n', '', rstrip(result)) or '' def classname(object, modname): *************** *** 394,400 **** head = '%s' % linkedname try: ! path = os.path.abspath(inspect.getfile(object)) ! sourcepath = os.path.abspath(inspect.getsourcefile(object)) ! if os.path.isfile(sourcepath): path = sourcepath filelink = '%s' % (path, path) except TypeError: --- 394,398 ---- head = '%s' % linkedname try: ! path = inspect.getabsfile(object) filelink = '%s' % (path, path) except TypeError: *************** *** 676,682 **** lines = lines[2:] result = result + self.section('NAME', name) ! try: file = inspect.getfile(object) # XXX or getsourcefile? ! except TypeError: file = None ! result = result + self.section('FILE', file or '(built-in)') if lines: result = result + self.section('DESCRIPTION', join(lines, '\n')) --- 674,680 ---- lines = lines[2:] result = result + self.section('NAME', name) ! try: file = inspect.getabsfile(object) ! except TypeError: file = '(built-in)' ! result = result + self.section('FILE', file) if lines: result = result + self.section('DESCRIPTION', join(lines, '\n')) *************** *** 1050,1057 **** for modname in sys.builtin_module_names: ! seen[modname] = 1 ! desc = split(__import__(modname).__doc__ or '', '\n')[0] ! if find(lower(modname + ' - ' + desc), lower(key)) >= 0: ! callback(None, modname, desc) while not self.quit: --- 1048,1056 ---- for modname in sys.builtin_module_names: ! if modname != '__main__': ! seen[modname] = 1 ! desc = split(__import__(modname).__doc__ or '', '\n')[0] ! if find(lower(modname + ' - ' + desc), lower(key)) >= 0: ! callback(None, modname, desc) while not self.quit: *************** *** 1125,1132 **** 'Python: Index of Modules', '#ffffff', '#7799ee') ! builtins = [] ! for name in sys.builtin_module_names: ! builtins.append('%s' % (name, name)) ! indices = ['

Built-in modules: ' + join(builtins, ', ')] seen = {} for dir in pathdirs(): --- 1124,1134 ---- 'Python: Index of Modules', '#ffffff', '#7799ee') ! def bltinlink(name): ! return '%s' % (name, name) ! names = filter(lambda x: x != '__main__', sys.builtin_module_names) ! contents = html.multicolumn(names, bltinlink) ! indices = ['

' + html.bigsection( ! 'Built-in Modules', '#ffffff', '#ee77aa', contents)] ! seen = {} for dir in pathdirs(): *************** *** 1207,1212 **** self.search_ent.focus_set() ! self.result_lst = Tkinter.Listbox(window, ! font=('helvetica', 8), height=6) self.result_lst.bind('', self.select) self.result_lst.bind('', self.goto) --- 1209,1214 ---- self.search_ent.focus_set() ! font = ('helvetica', sys.platform in ['win32', 'win', 'nt'] and 8 or 10) ! self.result_lst = Tkinter.Listbox(window, font=font, height=6) self.result_lst.bind('', self.select) self.result_lst.bind('', self.goto) *************** *** 1245,1251 **** self.quit_btn.config(state='normal') ! def open(self, event=None): ! import webbrowser ! webbrowser.open(self.server.url) def quit(self, event=None): --- 1247,1266 ---- self.quit_btn.config(state='normal') ! def open(self, event=None, url=None): ! url = url or self.server.url ! try: ! import webbrowser ! webbrowser.open(url) ! except ImportError: # pre-webbrowser.py compatibility ! if sys.platform in ['win', 'win32', 'nt']: ! os.system('start "%s"' % url) ! elif sys.platform == 'mac': ! try: ! import ic ! ic.launchurl(url) ! except ImportError: pass ! else: ! rc = os.system('netscape -remote "openURL(%s)" &' % url) ! if rc: os.system('netscape "%s" &' % url) def quit(self, event=None): *************** *** 1297,1303 **** selection = self.result_lst.curselection() if selection: - import webbrowser modname = split(self.result_lst.get(selection[0]))[0] ! webbrowser.open(self.server.url + modname + '.html') def collapse(self): --- 1312,1317 ---- selection = self.result_lst.curselection() if selection: modname = split(self.result_lst.get(selection[0]))[0] ! self.open(url=self.server.url + modname + '.html') def collapse(self): From tim_one@users.sourceforge.net Fri Mar 2 02:53:10 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 01 Mar 2001 18:53:10 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib __future__.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv17770/python/dist/src/Lib Modified Files: __future__.py Log Message: Make names in __future__.py bind to class instances instead of 2-tuples. Suggested on c.l.py by William Tanksley, and I like it. Index: __future__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/__future__.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** __future__.py 2001/02/28 08:26:44 1.2 --- __future__.py 2001/03/02 02:53:08 1.3 *************** *** 3,12 **** Each line is of the form: ! FeatureName = ReleaseInfo - ReleaseInfo is a pair of the form: - - (OptionalRelease, MandatoryRelease) - where, normally, OptionalRelease < MandatoryRelease, and both are 5-tuples of the same form as sys.version_info: --- 3,8 ---- Each line is of the form: ! FeatureName = "_Feature(" OptionalRelease "," MandatoryRelease) ")" where, normally, OptionalRelease < MandatoryRelease, and both are 5-tuples of the same form as sys.version_info: *************** *** 38,44 **** MandatoryRelease may also be None, meaning that a planned feature got dropped. ! No line is ever to be deleted from this file. """ ! nested_scopes = (2, 1, 0, "beta", 1), (2, 2, 0, "final", 0) --- 34,69 ---- MandatoryRelease may also be None, meaning that a planned feature got dropped. + + Instances of class _Feature have two corresponding methods, + .getOptionalRelease() and .getMandatoryRelease(). ! No feature line is ever to be deleted from this file. """ + + class _Feature: + def __init__(self, optionalRelease, mandatoryRelease): + self.optional = optionalRelease + self.mandatory = mandatoryRelease + + def getOptionalRelease(self): + """Return first release in which this feature was recognized. + + This is a 5-tuple, of the same form as sys.version_info. + """ + + return self.optional + + def getMandatoryRelease(self): + """Return release in which this feature will become mandatory. + + This is a 5-tuple, of the same form as sys.version_info, or, if + the feature was dropped, is None. + """ + + return self.mandatory + + def __repr__(self): + return "Feature(" + `self.getOptionalRelease()` + ", " + \ + `self.getMandatoryRelease()` + ")" ! nested_scopes = _Feature((2, 1, 0, "beta", 1), (2, 2, 0, "final", 0)) From tim_one@users.sourceforge.net Fri Mar 2 02:53:10 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 01 Mar 2001 18:53:10 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0236.txt,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv17770/python/nondist/peps Modified Files: pep-0236.txt Log Message: Make names in __future__.py bind to class instances instead of 2-tuples. Suggested on c.l.py by William Tanksley, and I like it. Index: pep-0236.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0236.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** pep-0236.txt 2001/02/27 23:39:23 1.3 --- pep-0236.txt 2001/03/02 02:53:08 1.4 *************** *** 166,175 **** Each statment in __future__.py is of the form: ! FeatureName = ReleaseInfo - ReleaseInfo is a pair of the form: - - (OptionalRelease, MandatoryRelease) - where, normally, OptionalRelease < MandatoryRelease, and both are 5-tuples of the same form as sys.version_info: --- 166,171 ---- Each statment in __future__.py is of the form: ! FeatureName = "_Feature(" OptionalRelease "," MandatoryRelease) ")" where, normally, OptionalRelease < MandatoryRelease, and both are 5-tuples of the same form as sys.version_info: *************** *** 201,210 **** MandatoryRelease may also be None, meaning that a planned feature got dropped. ! No line will ever be deleted from __future__.py. Example line: ! nested_scopes = (2, 1, 0, "beta", 1), (2, 2, 0, "final", 0) This means that --- 197,209 ---- MandatoryRelease may also be None, meaning that a planned feature got dropped. + + Instances of class _Feature have two corresponding methods, + .getOptionalRelease() and .getMandatoryRelease(). ! No feature line will ever be deleted from __future__.py. Example line: ! nested_scopes = _Feature((2, 1, 0, "beta", 1), (2, 2, 0, "final", 0)) This means that From tim_one@users.sourceforge.net Fri Mar 2 02:53:10 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 01 Mar 2001 18:53:10 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test___future__.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv17770/python/dist/src/Lib/test Modified Files: test___future__.py Log Message: Make names in __future__.py bind to class instances instead of 2-tuples. Suggested on c.l.py by William Tanksley, and I like it. Index: test___future__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test___future__.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** test___future__.py 2001/02/26 21:14:49 1.1 --- test___future__.py 2001/03/02 02:53:08 1.2 *************** *** 11,18 **** if verbose: print "Checking __future__ ", feature, "value", value - verify(type(value) is TupleType, "feature value isn't tuple") - verify(len(value) == 2, "feature value isn't 2-tuple") ! optional, mandatory = value verify(type(optional) is TupleType, "optional isn't tuple") --- 11,17 ---- if verbose: print "Checking __future__ ", feature, "value", value ! optional = value.getOptionalRelease() ! mandatory = value.getMandatoryRelease() verify(type(optional) is TupleType, "optional isn't tuple") From tim_one@users.sourceforge.net Fri Mar 2 02:54:29 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 01 Mar 2001 18:54:29 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc ACKS,1.83,1.84 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv18000/python/dist/src/misc Modified Files: ACKS Log Message: Added William Tanksley. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.83 retrieving revision 1.84 diff -C2 -r1.83 -r1.84 *** ACKS 2001/03/01 20:36:48 1.83 --- ACKS 2001/03/02 02:54:27 1.84 *************** *** 369,372 **** --- 369,373 ---- Peter Stoehr Ken Stox + William Tanksley Christian Tanzer Amy Taylor From tim_one@users.sourceforge.net Fri Mar 2 03:11:55 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 01 Mar 2001 19:11:55 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib __future__.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv21438/python/dist/src/Lib Modified Files: __future__.py Log Message: Typo repair. Index: __future__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/__future__.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** __future__.py 2001/03/02 02:53:08 1.3 --- __future__.py 2001/03/02 03:11:53 1.4 *************** *** 3,7 **** Each line is of the form: ! FeatureName = "_Feature(" OptionalRelease "," MandatoryRelease) ")" where, normally, OptionalRelease < MandatoryRelease, and both are 5-tuples --- 3,7 ---- Each line is of the form: ! FeatureName = "_Feature(" OptionalRelease "," MandatoryRelease ")" where, normally, OptionalRelease < MandatoryRelease, and both are 5-tuples From tim_one@users.sourceforge.net Fri Mar 2 03:11:55 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 01 Mar 2001 19:11:55 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0236.txt,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv21438/python/nondist/peps Modified Files: pep-0236.txt Log Message: Typo repair. Index: pep-0236.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0236.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** pep-0236.txt 2001/03/02 02:53:08 1.4 --- pep-0236.txt 2001/03/02 03:11:53 1.5 *************** *** 166,170 **** Each statment in __future__.py is of the form: ! FeatureName = "_Feature(" OptionalRelease "," MandatoryRelease) ")" where, normally, OptionalRelease < MandatoryRelease, and both are --- 166,170 ---- Each statment in __future__.py is of the form: ! FeatureName = "_Feature(" OptionalRelease "," MandatoryRelease ")" where, normally, OptionalRelease < MandatoryRelease, and both are From tim_one@users.sourceforge.net Fri Mar 2 03:28:05 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 01 Mar 2001 19:28:05 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python import.c,2.170,2.171 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv22850/python/dist/src/Python Modified Files: import.c Log Message: Thanks to Steven Majewski, finally putting MacOS X imports to bed for 2.1b1. Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.170 retrieving revision 2.171 diff -C2 -r2.170 -r2.171 *** import.c 2001/03/01 18:12:00 2.170 --- import.c 2001/03/02 03:28:03 2.171 *************** *** 1119,1130 **** strncmp(name, (char *)fss.name+1, namelen) == 0; ! /* new-fangled macintosh (macosx) ! * ! * XXX This seems prone to obscure errors, like suppose someone does ! * XXX "import xyz", and in some directory there's both "XYZ.py" and ! * XXX "xyz.txt". fopen("xyz.py") will open XYZ.py, but when marching thru ! * XXX the directory we'll eventually "succeed" on "xyz.txt" because the ! * XXX extension is never checked. ! */ #elif defined(__MACH__) && defined(__APPLE__) && defined(HAVE_DIRENT_H) DIR *dirp; --- 1119,1123 ---- strncmp(name, (char *)fss.name+1, namelen) == 0; ! /* new-fangled macintosh (macosx) */ #elif defined(__MACH__) && defined(__APPLE__) && defined(HAVE_DIRENT_H) DIR *dirp; *************** *** 1149,1152 **** --- 1142,1146 ---- dirp = opendir(dirname); if (dirp) { + char *nameWithExt = buf + len - namelen; while ((dp = readdir(dirp)) != NULL) { const int thislen = *************** *** 1157,1161 **** #endif if (thislen >= namelen && ! strncmp(dp->d_name, name, namelen) == 0) { (void)closedir(dirp); return 1; /* Found */ --- 1151,1155 ---- #endif if (thislen >= namelen && ! strcmp(dp->d_name, nameWithExt) == 0) { (void)closedir(dirp); return 1; /* Found */ From gvanrossum@users.sourceforge.net Fri Mar 2 03:30:43 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 01 Mar 2001 19:30:43 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python compile.c,2.185,2.186 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv23466 Modified Files: compile.c Log Message: Refactored the warning-issuing code more. Made sure that the warnings issued by symtable_check_unoptimized() (about import * and exec) contain the proper filename and line number, and are transformed into SyntaxError exceptions with -Werror. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.185 retrieving revision 2.186 diff -C2 -r2.185 -r2.186 *** compile.c 2001/03/01 22:59:14 2.185 --- compile.c 2001/03/02 03:30:41 2.186 *************** *** 4016,4031 **** } ! /* Helper function to issue symbol table warnings */ static int ! symtable_warn(struct symtable *st, char *msg) { ! if (PyErr_WarnExplicit(PyExc_SyntaxWarning, msg, st->st_filename, ! st->st_cur->ste_lineno, NULL, NULL) < 0) { if (PyErr_ExceptionMatches(PyExc_SyntaxWarning)) { PyErr_SetString(PyExc_SyntaxError, msg); ! PyErr_SyntaxLocation(st->st_filename, ! st->st_cur->ste_lineno); } st->st_errors++; return -1; --- 4016,4039 ---- } ! /* Helper functions to issue warnings */ static int ! issue_warning(char *msg, char *filename, int lineno) { ! if (PyErr_WarnExplicit(PyExc_SyntaxWarning, msg, filename, ! lineno, NULL, NULL) < 0) { if (PyErr_ExceptionMatches(PyExc_SyntaxWarning)) { PyErr_SetString(PyExc_SyntaxError, msg); ! PyErr_SyntaxLocation(filename, lineno); } + return -1; + } + return 0; + } + + static int + symtable_warn(struct symtable *st, char *msg) + { + if (issue_warning(msg, st->st_filename, st->st_cur->ste_lineno) < 0) { st->st_errors++; return -1; *************** *** 4196,4204 **** ste->ste_lineno); return -1; ! } else { ! /* XXX if the warning becomes an exception, we should ! attached more info to it. */ ! if (PyErr_Warn(PyExc_SyntaxWarning, buf) < 0) ! return -1; } return 0; --- 4204,4210 ---- ste->ste_lineno); return -1; ! } ! else { ! return issue_warning(buf, c->c_filename, ste->ste_lineno); } return 0; From gvanrossum@users.sourceforge.net Fri Mar 2 04:27:10 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 01 Mar 2001 20:27:10 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv30400 Modified Files: pydoc.py Log Message: Believe it or not, but "more" on Windows requires "more Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv1843 Modified Files: python20.wse Log Message: Add a new item to the Python 2.1 start menu: "Module Docs". This brings up Ping's pydoc server. (XXX The icons for this and for IDLE seem screwed. Oh well.) Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -r1.28 -r1.29 *** python20.wse 2001/03/01 02:43:40 1.28 --- python20.wse 2001/03/02 04:59:38 1.29 *************** *** 953,956 **** --- 953,962 ---- end item: Install File + Source=%_SRC_%\Tools\scripts\pydoc + Destination=%MAINDIR%\pydoc + Description=Utility Scripts + Flags=0000000000000010 + end + item: Install File Source=%_SRC_%\Tools\scripts\*.doc Destination=%MAINDIR%\Tools\Scripts *************** *** 1331,1334 **** --- 1337,1348 ---- Destination=%GROUP%\IDLE (Python GUI).lnk Command Options=%MAINDIR%\Tools\idle\idle.pyw + Working Directory=%MAINDIR% + Key Type=1536 + Flags=00000001 + end + item: Create Shortcut + Source=%MAINDIR%\pythonw.exe + Destination=%GROUP%\Module Docs.lnk + Command Options=%MAINDIR%\pydoc Working Directory=%MAINDIR% Key Type=1536 From gvanrossum@users.sourceforge.net Fri Mar 2 05:46:20 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 01 Mar 2001 21:46:20 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_mailbox.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv6980 Modified Files: test_mailbox.py Log Message: When catching errors from os.rmdir(), test for os.error, not IOError! Index: test_mailbox.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mailbox.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** test_mailbox.py 2000/10/23 13:39:13 1.1 --- test_mailbox.py 2001/03/02 05:46:17 1.2 *************** *** 22,28 **** finally: try: os.rmdir(newdir) ! except IOError: pass try: os.rmdir(curdir) ! except IOError: pass try: os.rmdir(test_support.TESTFN) ! except IOError: pass --- 22,28 ---- finally: try: os.rmdir(newdir) ! except os.error: pass try: os.rmdir(curdir) ! except os.error: pass try: os.rmdir(test_support.TESTFN) ! except os.error: pass From ping@users.sourceforge.net Fri Mar 2 05:48:13 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Thu, 01 Mar 2001 21:48:13 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_inspect.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv7205/test Modified Files: test_inspect.py Log Message: Replace literal '@test' with TESTFN. Index: test_inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_inspect.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** test_inspect.py 2001/02/27 14:43:21 1.1 --- test_inspect.py 2001/03/02 05:48:10 1.2 *************** *** 169,189 **** test(len(git.tr) == 2, 'trace() length') ! test(git.tr[0][1:] == ('@test', 9, 'spam', [' eggs(b + d, c + f)\n'], 0), 'trace() row 1') ! test(git.tr[1][1:] == ('@test', 18, 'eggs', [' q = y / 0\n'], 0), 'trace() row 2') test(len(mod.st) >= 5, 'stack() length') test(mod.st[0][1:] == ! ('@test', 16, 'eggs', [' st = inspect.stack()\n'], 0), 'stack() row 1') test(mod.st[1][1:] == ! ('@test', 9, 'spam', [' eggs(b + d, c + f)\n'], 0), 'stack() row 2') test(mod.st[2][1:] == ! ('@test', 43, 'argue', [' spam(a, b, c)\n'], 0), 'stack() row 3') test(mod.st[3][1:] == ! ('@test', 39, 'abuse', [' self.argue(a, b, c)\n'], 0), 'stack() row 4') # row 4 is in test_inspect.py --- 169,189 ---- test(len(git.tr) == 2, 'trace() length') ! test(git.tr[0][1:] == (TESTFN, 9, 'spam', [' eggs(b + d, c + f)\n'], 0), 'trace() row 1') ! test(git.tr[1][1:] == (TESTFN, 18, 'eggs', [' q = y / 0\n'], 0), 'trace() row 2') test(len(mod.st) >= 5, 'stack() length') test(mod.st[0][1:] == ! (TESTFN, 16, 'eggs', [' st = inspect.stack()\n'], 0), 'stack() row 1') test(mod.st[1][1:] == ! (TESTFN, 9, 'spam', [' eggs(b + d, c + f)\n'], 0), 'stack() row 2') test(mod.st[2][1:] == ! (TESTFN, 43, 'argue', [' spam(a, b, c)\n'], 0), 'stack() row 3') test(mod.st[3][1:] == ! (TESTFN, 39, 'abuse', [' self.argue(a, b, c)\n'], 0), 'stack() row 4') # row 4 is in test_inspect.py From ping@users.sourceforge.net Fri Mar 2 05:50:36 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Thu, 01 Mar 2001 21:50:36 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib inspect.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv7296 Modified Files: inspect.py Log Message: Make getsourcefile() succeed even if the filename doesn't end in '.py' -- as long as the filename also doesn't end in a suffix that indicates a binary file (according to the flags in imp.get_suffixes()). Shrink try...except clauses and replace some of them with explicit checks. Index: inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** inspect.py 2001/03/02 02:08:53 1.6 --- inspect.py 2001/03/02 05:50:34 1.7 *************** *** 198,215 **** if string.lower(filename[-4:]) in ['.pyc', '.pyo']: filename = filename[:-4] + '.py' ! if string.lower(filename[-3:]) == '.py' and os.path.exists(filename): return filename def getabsfile(object): ! """Return an absolute path to the source file or compiled file for an object. ! The idea is for each object to have a unique origin, so this routine normalizes ! the result as much as possible.""" ! return os.path.normcase(os.path.abspath(getsourcefile(object) or getfile(object))) modulesbyfile = {} def getmodule(object): ! """Try to guess which module an object was defined in.""" if isclass(object): return sys.modules.get(object.__module__) --- 198,220 ---- if string.lower(filename[-4:]) in ['.pyc', '.pyo']: filename = filename[:-4] + '.py' ! for suffix, mode, kind in imp.get_suffixes(): ! if 'b' in mode and string.lower(filename[-len(suffix):]) == suffix: ! # Looks like a binary file. We want to only return a text file. ! return None ! if os.path.exists(filename): return filename def getabsfile(object): ! """Return an absolute path to the source or compiled file for an object. ! The idea is for each object to have a unique origin, so this routine ! normalizes the result as much as possible.""" ! return os.path.normcase( ! os.path.abspath(getsourcefile(object) or getfile(object))) modulesbyfile = {} def getmodule(object): ! """Return the module an object was defined in, or None if not found.""" if isclass(object): return sys.modules.get(object.__module__) *************** *** 226,238 **** return sys.modules[modulesbyfile[file]] main = sys.modules['__main__'] ! try: mainobject = getattr(main, object.__name__) ! if mainobject is object: return main ! except AttributeError: pass builtin = sys.modules['__builtin__'] ! try: builtinobject = getattr(builtin, object.__name__) ! if builtinobject is object: return builtin ! except AttributeError: pass def findsource(object): --- 231,243 ---- return sys.modules[modulesbyfile[file]] main = sys.modules['__main__'] ! if hasattr(main, object.__name__): mainobject = getattr(main, object.__name__) ! if mainobject is object: ! return main builtin = sys.modules['__builtin__'] ! if hasattr(builtin, object.__name__): builtinobject = getattr(builtin, object.__name__) ! if builtinobject is object: ! return builtin def findsource(object): *************** *** 245,252 **** try: file = open(getsourcefile(object)) - lines = file.readlines() - file.close() except (TypeError, IOError): raise IOError, 'could not get source code' if ismodule(object): --- 250,257 ---- try: file = open(getsourcefile(object)) except (TypeError, IOError): raise IOError, 'could not get source code' + lines = file.readlines() + file.close() if ismodule(object): *************** *** 270,287 **** object = object.f_code if iscode(object): ! try: ! lnum = object.co_firstlineno - 1 ! except AttributeError: raise IOError, 'could not find function definition' ! else: ! while lnum > 0: ! if string.split(lines[lnum])[:1] == ['def']: break ! lnum = lnum - 1 ! return lines, lnum def getcomments(object): """Get lines of comments immediately preceding an object's source code.""" try: lines, lnum = findsource(object) ! except: return None if ismodule(object): --- 275,290 ---- object = object.f_code if iscode(object): ! if not hasattr(object, 'co_firstlineno'): raise IOError, 'could not find function definition' ! lnum = object.co_firstlineno - 1 ! while lnum > 0: ! if string.split(lines[lnum])[:1] == ['def']: break ! lnum = lnum - 1 ! return lines, lnum def getcomments(object): """Get lines of comments immediately preceding an object's source code.""" try: lines, lnum = findsource(object) ! except IOError: return None if ismodule(object): *************** *** 575,584 **** try: lines, lnum = findsource(frame) start = max(start, 1) start = min(start, len(lines) - context) lines = lines[start:start+context] index = lineno - 1 - start - except IOError: - lines = index = None else: lines = index = None --- 578,588 ---- try: lines, lnum = findsource(frame) + except IOError: + lines = index = None + else: start = max(start, 1) start = min(start, len(lines) - context) lines = lines[start:start+context] index = lineno - 1 - start else: lines = index = None From gvanrossum@users.sourceforge.net Fri Mar 2 05:51:18 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 01 Mar 2001 21:51:18 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib tempfile.py,1.29,1.30 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv7564 Modified Files: tempfile.py Log Message: Search /tmp before /var/tmp and /usr/tmp -- this seems preferred. SF patch #404564, Gregor Hoffleit. Index: tempfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/tempfile.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -r1.29 -r1.30 *** tempfile.py 2001/03/01 04:27:19 1.29 --- tempfile.py 2001/03/02 05:51:16 1.30 *************** *** 22,26 **** except (AttributeError, os.error): pwd = os.curdir ! attempdirs = ['/var/tmp', '/usr/tmp', '/tmp', pwd] if os.name == 'nt': attempdirs.insert(0, 'C:\\TEMP') --- 22,26 ---- except (AttributeError, os.error): pwd = os.curdir ! attempdirs = ['/tmp', '/var/tmp', '/usr/tmp', pwd] if os.name == 'nt': attempdirs.insert(0, 'C:\\TEMP') From gvanrossum@users.sourceforge.net Fri Mar 2 05:54:31 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 01 Mar 2001 21:54:31 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/plat-riscos - New directory Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-riscos In directory usw-pr-cvs1:/tmp/cvs-serv8328/plat-riscos Log Message: Directory /cvsroot/python/python/dist/src/Lib/plat-riscos added to the repository From ping@users.sourceforge.net Fri Mar 2 05:54:38 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Thu, 01 Mar 2001 21:54:38 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv8287 Modified Files: pydoc.py Log Message: The sys.platform identifier for Windows is just 'win32' (for all varieties). Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** pydoc.py 2001/03/02 04:27:08 1.13 --- pydoc.py 2001/03/02 05:54:35 1.14 *************** *** 802,807 **** if os.environ.has_key('PAGER'): return lambda a: pipepager(a, os.environ['PAGER']) ! if sys.platform in ['win', 'win32', 'nt']: ! return lambda a: tempfilepager(a, 'more') if hasattr(os, 'system') and os.system('less 2>/dev/null') == 0: return lambda a: pipepager(a, 'less') --- 802,807 ---- if os.environ.has_key('PAGER'): return lambda a: pipepager(a, os.environ['PAGER']) ! if sys.platform == 'win32': ! return lambda a: tempfilepager(a, 'more <') if hasattr(os, 'system') and os.system('less 2>/dev/null') == 0: return lambda a: pipepager(a, 'less') *************** *** 836,840 **** file.close() try: ! os.system(cmd + ' <' + filename) finally: os.unlink(filename) --- 836,840 ---- file.close() try: ! os.system(cmd + ' ' + filename) finally: os.unlink(filename) *************** *** 1194,1198 **** text='stop', pady=0, command=self.stop, state='disabled') if sys.platform == 'win32': ! # Attempting to hide and show this button crashes under Windows. self.stop_btn.pack(side='right') --- 1194,1198 ---- text='stop', pady=0, command=self.stop, state='disabled') if sys.platform == 'win32': ! # Trying to hide and show this button crashes under Windows. self.stop_btn.pack(side='right') *************** *** 1209,1213 **** self.search_ent.focus_set() ! font = ('helvetica', sys.platform in ['win32', 'win', 'nt'] and 8 or 10) self.result_lst = Tkinter.Listbox(window, font=font, height=6) self.result_lst.bind('', self.select) --- 1209,1213 ---- self.search_ent.focus_set() ! font = ('helvetica', sys.platform == 'win32' and 8 or 10) self.result_lst = Tkinter.Listbox(window, font=font, height=6) self.result_lst.bind('', self.select) *************** *** 1253,1257 **** webbrowser.open(url) except ImportError: # pre-webbrowser.py compatibility ! if sys.platform in ['win', 'win32', 'nt']: os.system('start "%s"' % url) elif sys.platform == 'mac': --- 1253,1257 ---- webbrowser.open(url) except ImportError: # pre-webbrowser.py compatibility ! if sys.platform == 'win32': os.system('start "%s"' % url) elif sys.platform == 'mac': *************** *** 1354,1359 **** try: ! if sys.platform in ['mac', 'win', 'win32', 'nt'] and not sys.argv[1:]: ! # CLI-less platforms gui() return --- 1354,1359 ---- try: ! if sys.platform in ['mac', 'win32'] and not sys.argv[1:]: ! # graphical platforms with threading (and no CLI) gui() return From gvanrossum@users.sourceforge.net Fri Mar 2 05:55:09 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 01 Mar 2001 21:55:09 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/plat-riscos riscosenviron.py,NONE,1.1 riscospath.py,NONE,1.1 rourl2path.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-riscos In directory usw-pr-cvs1:/tmp/cvs-serv8479 Added Files: riscosenviron.py riscospath.py rourl2path.py Log Message: RISCOS files by dschwertberger --- NEW FILE: riscosenviron.py --- """A more or less complete user-defined wrapper around dictionary objects.""" import riscos class _Environ: def __init__(self): pass def __repr__(self): return repr(riscos.getenvdict()) def __cmp__(self, dict): if isinstance(dict, UserDict): return cmp(riscos.getenvdict(), dict) def __len__(self): return len(riscos.getenvdict()) def __getitem__(self, key): ret = riscos.getenv(key) if ret<>None: return ret else: raise KeyError def __setitem__(self, key, item): riscos.setenv(key, item) def __delitem__(self, key): riscos.delenv(key) def clear(self): # too dangerous on RISC OS pass def copy(self): return riscos.getenvdict() def keys(self): return riscos.getenvdict().keys() def items(self): return riscos.getenvdict().items() def values(self): return riscos.getenvdict().values() def has_key(self, key): value = riscos.getenv(key) return value<>None def update(self, dict): for k, v in dict.items(): riscos.putenv(k, v) def get(self, key, failobj=None): value = riscos.getenv(key) if value<>None: return value else: return failobj environ = _Environ() --- NEW FILE: riscospath.py --- # Module 'riscospath' -- common operations on RISC OS pathnames. # contributed by Andrew Clover ( andrew@oaktree.co.uk ) # The "os.path" name is an alias for this module on RISC OS systems; # on other systems (e.g. Mac, Windows), os.path provides the same # operations in a manner specific to that platform, and is an alias # to another module (e.g. macpath, ntpath). """ Instead of importing this module directly, import os and refer to this module as os.path. """ # Imports - make an error-generating swi object if the swi module is not # available (ie. we are not running on RISC OS Python) import os, stat, string try: import swi except ImportError: class _swi: def swi(*a): raise AttributeError, 'This function only available under RISC OS' block= swi swi= _swi() [_false, _true]= range(2) _roots= ['$', '&', '%', '@', '\\'] # _allowMOSFSNames # After importing riscospath, set _allowMOSFSNames true if you want the module # to understand the "-SomeFS-" notation left over from the old BBC Master MOS, # as well as the standard "SomeFS:" notation. Set this to be fully backwards # compatible but remember that "-SomeFS-" can also be a perfectly valid file # name so care must be taken when splitting and joining paths. _allowMOSFSNames= _false ## Path manipulation, RISC OS stylee. def _split(p): """ split filing system name (including special field) and drive specifier from rest of path. This is needed by many riscospath functions. """ dash= _allowMOSFSNames and p[:1]=='-' if dash: q= string.find(p, '-', 1)+1 else: if p[:1]==':': q= 0 else: q= string.find(p, ':')+1 # q= index of start of non-FS portion of path s= string.find(p, '#') if s==-1 or s>q: s= q # find end of main FS name, not including special field else: for c in p[dash:s]: if c not in string.letters: q= 0 break # disallow invalid non-special-field characters in FS name r= q if p[q:q+1]==':': r= string.find(p, '.', q+1)+1 if r==0: r= len(p) # find end of drive name (if any) following FS name (if any) return (p[:q], p[q:r], p[r:]) def normcase(p): """ Normalize the case of a pathname. This converts to lowercase as the native RISC OS filesystems are case-insensitive. However, not all filesystems have to be, and there's no simple way to find out what type an FS is argh. """ return string.lower(p) def isabs(p): """ Return whether a path is absolute. Under RISC OS, a file system specifier does not make a path absolute, but a drive name or number does, and so does using the symbol for root, URD, library, CSD or PSD. This means it is perfectly possible to have an "absolute" URL dependent on the current working directory, and equally you can have a "relative" URL that's on a completely different device to the current one argh. """ (fs, drive, path)= _split(p) return drive!='' or path[:1] in _roots def join(a, *p): """ Join path elements with the directory separator, replacing the entire path when an absolute or FS-changing path part is found. """ j= a for b in p: (fs, drive, path)= _split(b) if fs!='' or drive!='' or path[:1] in _roots: j= b else: j= j+'.'+b return j def split(p): """ Split a path in head (everything up to the last '.') and tail (the rest). FS name must still be dealt with separately since special field may contain '.'. """ (fs, drive, path)= _split(p) q= string.rfind(path, '.') if q!=-1: return (fs+drive+path[:q], path[q+1:]) return ('', p) def splitext(p): """ Split a path in root and extension. This assumes the 'using slash for dot and dot for slash with foreign files' convention common in RISC OS is in force. """ (tail, head)= split(p) if '/' in head: q= len(head)-string.rfind(head, '/') return (p[:-q], p[-q:]) return (p, '') def splitdrive(p): """ Split a pathname into a drive specification (including FS name) and the rest of the path. The terminating dot of the drive name is included in the drive specification. """ (fs, drive, path)= _split(p) return (fs+drive, p) def basename(p): """ Return the tail (basename) part of a path. """ return split(p)[1] def dirname(p): """ Return the head (dirname) part of a path. """ return split(p)[0] def commonprefix(ps): """ Return the longest prefix of all list elements. Purely string-based; does not separate any path parts. Why am I in os.path? """ if len(ps)==0: return '' prefix= ps[0] for p in ps[1:]: prefix= prefix[:len(p)] for i in range(len(prefix)): if prefix[i] <> p[i]: prefix= prefix[:i] if i==0: return '' break return prefix ## File access functions. Why are we in os.path? def getsize(p): """ Return the size of a file, reported by os.stat(). """ st= os.stat(p) return st[stat.ST_SIZE] def getmtime(p): """ Return the last modification time of a file, reported by os.stat(). """ st = os.stat(p) return st[stat.ST_MTIME] getatime= getmtime # RISC OS-specific file access functions def exists(p): """ Test whether a path exists. """ return swi.swi('OS_File', '5s;i', p)!=0 def isdir(p): """ Is a path a directory? Includes image files. """ return swi.swi('OS_File', '5s;i', p) in [2, 3] def isfile(p): """ Test whether a path is a file, including image files. """ return swi.swi('OS_File', '5s;i', p) in [1, 3] def islink(p): """ RISC OS has no links or mounts. """ return _false ismount= islink # Same-file testing. # samefile works on filename comparison since there is no ST_DEV and ST_INO is # not reliably unique (esp. directories). First it has to normalise the # pathnames, which it can do 'properly' using OS_FSControl since samefile can # assume it's running on RISC OS (unlike normpath). def samefile(fa, fb): """ Test whether two pathnames reference the same actual file. """ l= 512 b= swi.block(l) swi.swi('OS_FSControl', 'isb..i', 37, fa, b, l) fa= b.ctrlstring() swi.swi('OS_FSControl', 'isb..i', 37, fb, b, l) fb= b.ctrlstring() return fa==fb def sameopenfile(a, b): """ Test whether two open file objects reference the same file. """ return os.fstat(a)[stat.ST_INO]==os.fstat(b)[stat.ST_INO] ## Path canonicalisation # 'user directory' is taken as meaning the User Root Directory, which is in # practice never used, for anything. def expanduser(p): (fs, drive, path)= _split(p) l= 512 b= swi.block(l) if path[:1]!='@': return p if fs=='': fsno= swi.swi('OS_Args', '00;i') swi.swi('OS_FSControl', 'iibi', 33, fsno, b, l) fsname= b.ctrlstring() else: if fs[:1]=='-': fsname= fs[1:-1] else: fsname= fs[:-1] fsname= string.split(fsname, '#', 1)[0] # remove special field from fs x= swi.swi('OS_FSControl', 'ib2s.i;.....i', 54, b, fsname, l) if x0: ups= ups-1 else: if rhs=='': rhs= el else: rhs= el+'.'+rhs while ups>0: ups= ups-1 rhs= '^.'+rhs return fs+drive+rhs # Directory tree walk. # Independent of host system. Why am I in os.path? def walk(top, func, arg): """ walk(top,func,args) calls func(arg, d, files) for each directory "d" in the tree rooted at "top" (including "top" itself). "files" is a list of all the files and subdirs in directory "d". """ try: names= os.listdir(top) except os.error: return func(arg, top, names) for name in names: name= join(top, name) if isdir(name) and not islink(name): walk(name, func, arg) --- NEW FILE: rourl2path.py --- """riscos specific module for conversion between pathnames and URLs. Based on macurl2path. Do not import directly, use urllib instead.""" import string import urllib import os def url2pathname(pathname): "Convert /-delimited pathname to mac pathname" # # XXXX The .. handling should be fixed... # tp = urllib.splittype(pathname)[0] if tp and tp <> 'file': raise RuntimeError, 'Cannot convert non-local URL to pathname' components = string.split(pathname, '/') # Remove . and embedded .. i = 0 while i < len(components): if components[i] == '.': del components[i] elif components[i] == '..' and i > 0 and \ components[i-1] not in ('', '..'): del components[i-1:i+1] i = i-1 elif components[i] == '' and i > 0 and components[i-1] <> '': del components[i] else: if components[i]<>'..' and string.find(components[i], '.')<>-1 : components[i] = string.join(string.split(components[i],'.'),'/') i = i+1 if not components[0]: # Absolute unix path, don't start with colon return string.join(components[1:], '.') else: # relative unix path, start with colon. First replace # leading .. by empty strings (giving ::file) i = 0 while i < len(components) and components[i] == '..': components[i] = '^' i = i + 1 return string.join(components, '.') def pathname2url(pathname): "convert mac pathname to /-delimited pathname" if '/' in pathname: raise RuntimeError, "Cannot convert pathname containing slashes" components = string.split(pathname, ':') # Replace empty string ('::') by .. (will result in '/../' later) for i in range(1, len(components)): if components[i] == '': components[i] = '..' # Truncate names longer than 31 bytes components = map(lambda x: x[:31], components) if os.path.isabs(pathname): return '/' + string.join(components, '/') else: return string.join(components, '/') def test(): for url in ["index.html", "/SCSI::SCSI4/$/Anwendung/Comm/Apps/!Fresco/Welcome", "../index.html", "bar/index.html", "/foo/bar/index.html", "/foo/bar/", "/"]: print `url`, '->', `url2pathname(url)` for path in ["drive:", "drive:dir:", "drive:dir:file", "drive:file", "file", ":file", ":dir:", ":dir:file"]: print `path`, '->', `pathname2url(path)` if __name__ == '__main__': test() From gvanrossum@users.sourceforge.net Fri Mar 2 05:55:21 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 01 Mar 2001 21:55:21 -0800 Subject: [Python-checkins] CVS: python/dist/src/RISCOS - New directory Message-ID: Update of /cvsroot/python/python/dist/src/RISCOS In directory usw-pr-cvs1:/tmp/cvs-serv8503/RISCOS Log Message: Directory /cvsroot/python/python/dist/src/RISCOS added to the repository From gvanrossum@users.sourceforge.net Fri Mar 2 05:57:04 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 01 Mar 2001 21:57:04 -0800 Subject: [Python-checkins] CVS: python/dist/src/RISCOS/Modules - New directory Message-ID: Update of /cvsroot/python/python/dist/src/RISCOS/Modules In directory usw-pr-cvs1:/tmp/cvs-serv8685/Modules Log Message: Directory /cvsroot/python/python/dist/src/RISCOS/Modules added to the repository From gvanrossum@users.sourceforge.net Fri Mar 2 05:57:04 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 01 Mar 2001 21:57:04 -0800 Subject: [Python-checkins] CVS: python/dist/src/RISCOS/Python - New directory Message-ID: Update of /cvsroot/python/python/dist/src/RISCOS/Python In directory usw-pr-cvs1:/tmp/cvs-serv8685/Python Log Message: Directory /cvsroot/python/python/dist/src/RISCOS/Python added to the repository From gvanrossum@users.sourceforge.net Fri Mar 2 05:57:56 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 01 Mar 2001 21:57:56 -0800 Subject: [Python-checkins] CVS: python/dist/src/RISCOS/Python dynload_riscos.c,NONE,1.1 getcwd_riscos.c,NONE,1.1 getmtime_riscos.c,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/RISCOS/Python In directory usw-pr-cvs1:/tmp/cvs-serv8816/Python Added Files: dynload_riscos.c getcwd_riscos.c getmtime_riscos.c Log Message: RISCOS files by dschwertberger --- NEW FILE: dynload_riscos.c --- /*********************************************************** Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam, The Netherlands. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Stichting Mathematisch Centrum or CWI or Corporation for National Research Initiatives or CNRI not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. While CWI is the initial source for this software, a modified version is made available by the Corporation for National Research Initiatives (CNRI) at the Internet address ftp://ftp.python.org. STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* This module provides the necessary stubs for when dynamic loading is not present. */ #include "Python.h" #include "importdl.h" #include "dlk.h" const struct filedescr _PyImport_DynLoadFiletab[] = { {"/pyd", "rb", C_EXTENSION}, {0, 0} }; void dynload_init_dummy() { } dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, char *pathname, FILE *fp) { int err; char errstr[256]; err = dlk_load(pathname); if (err) { sprintf(errstr, "dlk failure %d", err); PyErr_SetString(PyExc_ImportError, errstr); } return dynload_init_dummy; } --- NEW FILE: getcwd_riscos.c --- char *getcwd(char *buf, int size) { buf[0] = '\0'; return buf; } --- NEW FILE: getmtime_riscos.c --- #include #define __swi #include "osfile.h" long PyOS_GetLastModificationTime(char *path, FILE *fp) { int obj; bits load, exec, ftype; if (xosfile_read_stamped_no_path(path, &obj, &load, &exec, 0, 0, &ftype)) return -1; if (obj != osfile_IS_FILE) return -1; if (ftype == osfile_TYPE_UNTYPED) return -1; load &= 0xFF; load -= 51; if (exec < 1855548004U) load--; exec -= 1855548004U; return exec/100+42949672*load+(95*load)/100; } From gvanrossum@users.sourceforge.net Fri Mar 2 05:57:56 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 01 Mar 2001 21:57:56 -0800 Subject: [Python-checkins] CVS: python/dist/src/RISCOS README,NONE,1.1 config.h,NONE,1.1 unixstuff.c,NONE,1.1 unixstuff.h,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/RISCOS In directory usw-pr-cvs1:/tmp/cvs-serv8816 Added Files: README config.h unixstuff.c unixstuff.h Log Message: RISCOS files by dschwertberger --- NEW FILE: README --- This directory contains files for the RISC OS port of Python. For more information about RISC OS see http://www.riscos.com/ . This port is currently being maintained by Dietmar Schwertberger, dietmar@schwertberger.de . On http://www.schwertberger.de you may find compiled versions and libraries as well as RISC OS specific documentation and extensions. ========================================================================== Compiling: 1. Extract Files from archive directory 'Python-...' to a directory named '!Python'. 2. Use a tool like Rename to change filenames from '*/[ch]' into '[ch].*'. 3. Create missing directories with 'amu cdirs'. 4. Build with 'amu'. I've only tested Acorn C/C++ 5.06 and amu. You will also need some additional libraries: DLK ftp://ftp.infc.ulst.ac.uk/pub/users/chris/ OSLib http://www.mk-net.demon.co.uk/oslib zlib (optional) ftp://ftp.freesoftware.com/pub/infozip/zlib/ sockets (optional) http://www.mirror.ac.uk/sites/ftp.acorn.co.uk/pub/riscos/releases/networking/tcpip/sockets.arc expat (optional) http://sourceforge.net/projects/expat/ (makefile and config.h available from http://www.schwertberger.de/riscos_expat.zip --- NEW FILE: config.h --- /* config.h.in. Generated automatically from configure.in by autoheader. */ /* Define if on AIX 3. System headers sometimes define this. We just want to avoid a redefinition error message. */ #ifndef _ALL_SOURCE #undef _ALL_SOURCE #endif /* Define if type char is unsigned and you are not using gcc. */ #undef __CHAR_UNSIGNED__ /* Define to empty if the keyword does not work. */ #undef const /* Define to `int' if doesn't define. */ #define gid_t int /* Define if your struct tm has tm_zone. */ #undef HAVE_TM_ZONE /* Define if you don't have tm_zone but do have the external array tzname. */ #undef HAVE_TZNAME /* Define if on MINIX. */ #undef _MINIX /* Define to `int' if doesn't define. */ #define mode_t int /* Define to `long' if doesn't define. */ #define off_t long /* Define to `int' if doesn't define. */ #define pid_t int /* Define if the system does not provide POSIX.1 features except with this defined. */ #undef _POSIX_1_SOURCE /* Define if you need to in order for stat and other things to work. */ #undef _POSIX_SOURCE /* Define as the return type of signal handlers (int or void). */ #define RETSIGTYPE void /* Define to `unsigned' if doesn't define. */ #undef size_t /* Define if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Define if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Define if your declares struct tm. */ #define TM_IN_SYS_TIME 1 /* Define to `int' if doesn't define. */ #define uid_t int /* Define if your contains bad prototypes for exec*() (as it does on SGI IRIX 4.x) */ #undef BAD_EXEC_PROTOTYPES /* Define if your compiler botches static forward declarations (as it does on SCI ODT 3.0) */ #undef BAD_STATIC_FORWARD /* Define this if you have BeOS threads */ #undef BEOS_THREADS /* Define if you have the Mach cthreads package */ #undef C_THREADS /* Define to `long' if doesn't define. */ #undef clock_t /* Used for BeOS configuration */ #undef DL_EXPORT_HEADER #ifdef DL_EXPORT_HEADER #include DL_EXPORT_HEADER #endif /* Define if getpgrp() must be called as getpgrp(0). */ #undef GETPGRP_HAVE_ARG /* Define if gettimeofday() does not have second (timezone) argument This is the case on Motorola V4 (R40V4.2) */ #undef GETTIMEOFDAY_NO_TZ /* Define this if your time.h defines altzone */ #undef HAVE_ALTZONE /* Define this if you have some version of gethostbyname_r() */ #undef HAVE_GETHOSTBYNAME_R /* Define this if you have the 3-arg version of gethostbyname_r() */ #undef HAVE_GETHOSTBYNAME_R_3_ARG /* Define this if you have the 5-arg version of gethostbyname_r() */ #undef HAVE_GETHOSTBYNAME_R_5_ARG /* Define this if you have the 6-arg version of gethostbyname_r() */ #undef HAVE_GETHOSTBYNAME_R_6_ARG /* Define this if you have the type long long */ #undef HAVE_LONG_LONG /* Define this if you have a K&R style C preprocessor */ #undef HAVE_OLD_CPP /* Define if your compiler supports function prototypes */ #define HAVE_PROTOTYPES 1 /* Define if your compiler supports variable length function prototypes (e.g. void fprintf(FILE *, char *, ...);) *and* */ #define HAVE_STDARG_PROTOTYPES 1 /* Define if malloc(0) returns a NULL pointer */ #undef MALLOC_ZERO_RETURNS_NULL /* Define if you have POSIX threads */ #undef _POSIX_THREADS /* Define to force use of thread-safe errno, h_errno, and other functions */ #undef _REENTRANT /* Define if setpgrp() must be called as setpgrp(0, 0). */ #undef SETPGRP_HAVE_ARG /* Define to empty if the keyword does not work. */ #undef signed /* Define if you can safely include both and (which you can't on SCO ODT 3.0). */ #undef SYS_SELECT_WITH_SYS_TIME /* Define if a va_list is an array of some kind */ #define VA_LIST_IS_ARRAY 1 /* Define to empty if the keyword does not work. */ #undef volatile /* Define if you want SIGFPE handled (see Include/pyfpe.h). */ #undef WANT_SIGFPE_HANDLER /* Define if you want to use SGI (IRIX 4) dynamic linking. This requires the "dl" library by Jack Jansen, ftp://ftp.cwi.nl/pub/dynload/dl-1.6.tar.Z. Don't bother on IRIX 5, it already has dynamic linking using SunOS style shared libraries */ #undef WITH_SGI_DL /* Define if you want to emulate SGI (IRIX 4) dynamic linking. This is rumoured to work on VAX (Ultrix), Sun3 (SunOS 3.4), Sequent Symmetry (Dynix), and Atari ST. This requires the "dl-dld" library, ftp://ftp.cwi.nl/pub/dynload/dl-dld-1.1.tar.Z, as well as the "GNU dld" library, ftp://ftp.cwi.nl/pub/dynload/dld-3.2.3.tar.Z. Don't bother on SunOS 4 or 5, they already have dynamic linking using shared libraries */ #undef WITH_DL_DLD /* Define if you want to use the new-style (Openstep, Rhapsody, MacOS) dynamic linker (dyld) instead of the old-style (NextStep) dynamic linker (rld). Dyld is necessary to support frameworks. */ #undef WITH_DYLD /* Define if you want to compile in rudimentary thread support */ #undef WITH_THREAD /* Define if you want to produce an OpenStep/Rhapsody framework (shared library plus accessory files). */ #undef WITH_NEXT_FRAMEWORK /* The number of bytes in an off_t. */ #undef SIZEOF_OFF_T /* Defined to enable large file support when an off_t is bigger than a long and long long is available and at least as big as an off_t. You may need to add some flags for configuration and compilation to enable this mode. E.g, for Solaris 2.7: CFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" OPT="-O2 $CFLAGS" \ configure */ #undef HAVE_LARGEFILE_SUPPORT /* The number of bytes in a time_t. */ #define SIZEOF_TIME_T 4 /* The number of bytes in a int. */ #define SIZEOF_INT 4 /* The number of bytes in a long. */ #define SIZEOF_LONG 4 /* The number of bytes in a long long. */ #undef SIZEOF_LONG_LONG /* The number of bytes in a void *. */ #define SIZEOF_VOID_P 4 /* Define if you have the alarm function. */ #undef HAVE_ALARM /* Define if you have the chown function. */ #undef HAVE_CHOWN /* Define if you have the clock function. */ #define HAVE_CLOCK 1 /* Define if you have the dlopen function. */ #undef HAVE_DLOPEN /* Define if you have the dup2 function. */ #undef HAVE_DUP2 /* Define if you have the execv function. */ #undef HAVE_EXECV /* Define if you have the fdatasync function. */ #undef HAVE_FDATASYNC /* Define if you have the flock function. */ #undef HAVE_FLOCK /* Define if you have the fork function. */ #undef HAVE_FORK /* Define if you have the fseek64 function. */ #undef HAVE_FSEEK64 /* Define if you have the fseeko function. */ #undef HAVE_FSEEKO /* Define if you have the fstatvfs function. */ #undef HAVE_FSTATVFS /* Define if you have the fsync function. */ #undef HAVE_FSYNC /* Define if you have the ftell64 function. */ #undef HAVE_FTELL64 /* Define if you have the ftello function. */ #undef HAVE_FTELLO /* Define if you have the ftime function. */ #undef HAVE_FTIME /* Define if you have the ftruncate function. */ #undef HAVE_FTRUNCATE /* Define if you have the getcwd function. */ #undef HAVE_GETCWD /* Define if you have the getpeername function. */ #undef HAVE_GETPEERNAME /* Define if you have the getpgrp function. */ #undef HAVE_GETPGRP /* Define if you have the getpid function. */ #undef HAVE_GETPID /* Define if you have the getpwent function. */ #undef HAVE_GETPWENT /* Define if you have the gettimeofday function. */ #undef HAVE_GETTIMEOFDAY /* Define if you have the getwd function. */ #undef HAVE_GETWD /* Define if you have the hypot function. */ #undef HAVE_HYPOT /* Define if you have the kill function. */ #undef HAVE_KILL /* Define if you have the link function. */ #undef HAVE_LINK /* Define if you have the lstat function. */ #undef HAVE_LSTAT /* Define if you have the memmove function. */ #define HAVE_MEMMOVE 1 /* Define if you have the mkfifo function. */ #undef HAVE_MKFIFO /* Define if you have the mktime function. */ #define HAVE_MKTIME 1 /* Define if you have the nice function. */ #undef HAVE_NICE /* Define if you have the pause function. */ #undef HAVE_PAUSE /* Define if you have the plock function. */ #undef HAVE_PLOCK /* Define if you have the pthread_init function. */ #undef HAVE_PTHREAD_INIT /* Define if you have the putenv function. */ #undef HAVE_PUTENV /* Define if you have the readlink function. */ #undef HAVE_READLINK /* Define if you have the select function. */ #undef HAVE_SELECT /* Define if you have the setgid function. */ #undef HAVE_SETGID /* Define if you have the setlocale function. */ #undef HAVE_SETLOCALE /* Define if you have the setpgid function. */ #undef HAVE_SETPGID /* Define if you have the setpgrp function. */ #undef HAVE_SETPGRP /* Define if you have the setsid function. */ #undef HAVE_SETSID /* Define if you have the setuid function. */ #undef HAVE_SETUID /* Define if you have the setvbuf function. */ #undef HAVE_SETVBUF /* Define if you have the sigaction function. */ #undef HAVE_SIGACTION /* Define if you have the siginterrupt function. */ #undef HAVE_SIGINTERRUPT /* Define if you have the sigrelse function. */ #undef HAVE_SIGRELSE /* Define if you have the statvfs function. */ #undef HAVE_STATVFS /* Define if you have the strdup function. */ #undef HAVE_STRDUP /* Define if you have the strerror function. */ #define HAVE_STRERROR 1 /* Define if you have the strftime function. */ #define HAVE_STRFTIME 1 /* Define if you have the strptime function. */ #undef HAVE_STRPTIME /* Define if you have the symlink function. */ #undef HAVE_SYMLINK /* Define if you have the tcgetpgrp function. */ #undef HAVE_TCGETPGRP /* Define if you have the tcsetpgrp function. */ #undef HAVE_TCSETPGRP /* Define if you have the timegm function. */ #undef HAVE_TIMEGM /* Define if you have the times function. */ #undef HAVE_TIMES /* Define if you have the truncate function. */ #undef HAVE_TRUNCATE /* Define if you have the uname function. */ #undef HAVE_UNAME /* Define if you have the waitpid function. */ #undef HAVE_WAITPID /* Define if you have the header file. */ #undef HAVE_DIRENT_H /* Define if you have the header file. */ #undef HAVE_DLFCN_H /* Define if you have the header file. */ #undef HAVE_FCNTL_H /* Define if you have the header file. */ #define HAVE_LIMITS_H 1 /* Define if you have the header file. */ #define HAVE_LOCALE_H 1 /* Define if you have the header file. */ #undef HAVE_NCURSES_H /* Define if you have the header file. */ #undef HAVE_NDIR_H /* Define if you have the header file. */ #undef HAVE_PTHREAD_H /* Define if you have the header file. */ #define HAVE_SIGNAL_H 1 /* Define if you have the header file. */ #define HAVE_STDARG_H 1 /* Define if you have the header file. */ #define HAVE_STDDEF_H 1 /* Define if you have the header file. */ #define HAVE_STDLIB_H 1 /* Define if you have the header file. */ #undef HAVE_SYS_AUDIOIO_H /* Define if you have the header file. */ #undef HAVE_SYS_DIR_H /* Define if you have the header file. */ #undef HAVE_SYS_FILE_H /* Define if you have the header file. */ #undef HAVE_SYS_LOCK_H /* Define if you have the header file. */ #undef HAVE_SYS_NDIR_H /* Define if you have the header file. */ #undef HAVE_SYS_PARAM_H /* Define if you have the header file. */ #undef HAVE_SYS_SELECT_H /* Define if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define if you have the header file. */ #undef HAVE_SYS_TIMES_H /* Define if you have the header file. */ #undef HAVE_SYS_UN_H /* Define if you have the header file. */ #undef HAVE_SYS_UTSNAME_H /* Define if you have the header file. */ #undef HAVE_SYS_WAIT_H /* Define if you have the header file. */ #undef HAVE_THREAD_H /* Define if you have the header file. */ #undef HAVE_UNISTD_H /* Define if you have the header file. */ #undef HAVE_UTIME_H /* Define if you have the dl library (-ldl). */ #undef HAVE_LIBDL /* Define if you have the dld library (-ldld). */ #undef HAVE_LIBDLD /* Define if you have the ieee library (-lieee). */ #undef HAVE_LIBIEEE #define DONT_HAVE_SYS_TYPES_H 1 #define DONT_HAVE_FSTAT 1 #define DONT_HAVE_STAT 1 #define DONT_HAVE_SYS_STAT_H 1 #define PLATFORM "RISCOS" #define socklen_t int #define HAVE_DYNAMIC_LOADING --- NEW FILE: unixstuff.c --- /* Fudge unix isatty and fileno for RISCOS */ #include "h.unixstuff" #include #include "h.osfile" int fileno(FILE *f) { return (int)f; } int isatty(int fn) { return (fn==fileno(stdin)); } bits unixtime(bits ld,bits ex) { ld&=0xFF; ld-=51; if(ex<1855548004U) ld--; ex-=1855548004U; return ex/100+42949672*ld+(95*ld)/100; } int unlink(char *fname) { remove(fname); return 0; } /*#define RET(k) {printf(" %d\n",k);return k;}*/ #define RET(k) return k int isdir(char *fn) { int ob; /* printf("isdir %s",fn);*/ if(xosfile_read_stamped_no_path(fn,&ob,0,0,0,0,0)) RET(0); switch (ob) { case osfile_IS_DIR:RET(1); case osfile_IS_IMAGE:RET(1); } RET(0); } int isfile(char *fn) { int ob; /*printf("isfile %s",fn);*/ if(xosfile_read_stamped_no_path(fn,&ob,0,0,0,0,0)) RET(0); switch (ob) { case osfile_IS_FILE:RET(1); case osfile_IS_IMAGE:RET(1); } RET(0); } int exists(char *fn) { int ob; /*printf("exists %s",fn);*/ if(xosfile_read_stamped_no_path(fn,&ob,0,0,0,0,0)) RET(0); switch (ob) { case osfile_IS_FILE:RET(1); case osfile_IS_DIR:RET(1); case osfile_IS_IMAGE:RET(1); } RET(0); } --- NEW FILE: unixstuff.h --- /* Fudge unix isatty and fileno for RISCOS */ #include int fileno(FILE *f); int isatty(int fn); unsigned int unixtime(unsigned int ld,unsigned int ex); /*long PyOS_GetLastModificationTime(char *name);*/ int unlink(char *fname); int isdir(char *fn); int isfile(char *fn); int exists(char *fn); From gvanrossum@users.sourceforge.net Fri Mar 2 05:57:56 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 01 Mar 2001 21:57:56 -0800 Subject: [Python-checkins] CVS: python/dist/src/RISCOS/Modules config.c,NONE,1.1 drawfmodule.c,NONE,1.1 getpath_riscos.c,NONE,1.1 riscosmodule.c,NONE,1.1 swimodule.c,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/RISCOS/Modules In directory usw-pr-cvs1:/tmp/cvs-serv8816/Modules Added Files: config.c drawfmodule.c getpath_riscos.c riscosmodule.c swimodule.c Log Message: RISCOS files by dschwertberger --- NEW FILE: config.c --- /* -*- C -*- *********************************************** Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam, The Netherlands. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Stichting Mathematisch Centrum or CWI or Corporation for National Research Initiatives or CNRI not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. While CWI is the initial source for this software, a modified version is made available by the Corporation for National Research Initiatives (CNRI) at the Internet address ftp://ftp.python.org. STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* Module configuration */ /* !!! !!! !!! This file is edited by the makesetup script !!! !!! !!! */ /* This file contains the table of built-in modules. See init_builtin() in import.c. */ #include "Python.h" /* -- ADDMODULE MARKER 1 -- */ extern void PyMarshal_Init(); extern void initimp(); extern void initriscos(); extern void initswi(); struct _inittab _PyImport_Inittab[] = { {"riscos", initriscos}, /* -- ADDMODULE MARKER 2 -- */ /* This module "lives in" with marshal.c */ {"marshal", PyMarshal_Init}, /* This lives it with import.c */ {"imp", initimp}, /* These entries are here for sys.builtin_module_names */ {"__main__", NULL}, {"__builtin__", NULL}, {"sys", NULL}, /* Sentinel */ {0, 0} }; --- NEW FILE: drawfmodule.c --- /* drawf DrawFile functions */ #include "h.os" #include "h.osfile" #include "h.drawfile" #include "Python.h" #include #define PyDrawF_Check(op) ((op)->ob_type == &PyDrawFType) #define HDRSIZE 40 #define GRPHDRSIZE 36 #define DRAWTYPE 0xaff #define NEXT(d) ((drawfile_object*)((char*)(d)+(d)->size)) typedef struct { PyObject_HEAD drawfile_diagram *drawf; int size; /*length in bytes*/ int nobjs; /* no of objects */ } PyDrawFObject; typedef struct dheader { char tag [4]; int major_version; int minor_version; char source [12]; os_box bbox; } dheader; static PyObject *DrawFError; /* Exception drawf.error */ static os_error *e; static PyTypeObject PyDrawFType; static dheader header= { {'D','r','a','w'}, 201,0, {'P','y','t','h','o','n',' ',' ',' ',' ',' ',' '}, {INT_MAX,INT_MAX,INT_MIN,INT_MIN} }; static PyObject *drawf_oserror(void) { PyErr_SetString(DrawFError,e->errmess); return 0; } static PyObject *drawf_error(char *s) { PyErr_SetString(DrawFError,s); return 0; } /* DrawFile commands */ static void countobjs(PyDrawFObject *pd) { int k=0,q; drawfile_diagram *dd=pd->drawf; drawfile_object *d=dd->objects; char *end=(char*)dd+pd->size; pd->nobjs=-1; while((char*)dsize; if(q<=0||q&3) return ; d=NEXT(d); } if ((char*)d==end) pd->nobjs=k; } static drawfile_object *findobj(PyDrawFObject *pd,int n) { drawfile_diagram *dd=pd->drawf; drawfile_object *d=dd->objects; for(;n>0;n--) d=NEXT(d); return d; } static PyDrawFObject* new(int size) { PyDrawFObject *b=PyObject_NEW(PyDrawFObject,&PyDrawFType); if(!b) return NULL; size+=HDRSIZE; b->drawf=malloc(size); if(!b->drawf) { Py_DECREF(b); return (PyDrawFObject*)PyErr_NoMemory(); } b->size=size; return b; } static void extend(os_box *b,os_box *c) { if(b->x0>c->x0) b->x0=c->x0; if(b->y0>c->y0) b->y0=c->y0; if(b->x1x1) b->x1=c->x1; if(b->y1y1) b->y1=c->y1; } static PyObject *DrawF_New(PyObject *self,PyObject *args) { PyDrawFObject *b; if(!PyArg_ParseTuple(args,"")) return NULL; b=new(0); if(!b) return NULL; *((dheader*)b->drawf)=header; b->nobjs=0; return (PyObject *)b; } static PyObject *DrawF_Load(PyObject *self,PyObject *args) { int size; char *fname; PyDrawFObject *b; fileswitch_object_type ot; if(!PyArg_ParseTuple(args,"s",&fname)) return NULL; e=xosfile_read_no_path(fname,&ot,0,0,&size,0); if(e) return drawf_oserror(); size-=HDRSIZE; if(ot!=osfile_IS_FILE||size<0||size&3) return drawf_error("Bad draw file"); b=new(size); if(!b) return NULL; e=xosfile_load_stamped_no_path(fname,(byte*)(b->drawf),0,0,0,0,0); if(e) { Py_DECREF(b); return drawf_oserror(); } countobjs(b); if(b->nobjs>=0) return (PyObject *)b; Py_DECREF(b); return drawf_error("Corrupt draw file"); } static PyObject *DrawF_Save(PyDrawFObject *self,PyObject *arg) { char *fname; if(!PyArg_ParseTuple(arg,"s",&fname)) return NULL; e=xosfile_save_stamped(fname,DRAWTYPE, (byte*)(self->drawf),(byte*)(self->drawf)+self->size); if (e) return drawf_oserror(); Py_INCREF(Py_None);return Py_None; } static PyObject *DrawF_Render(PyDrawFObject *self,PyObject *arg) { int flags,trans,clip,flat; if(!PyArg_ParseTuple(arg,"iiii",&flags,&trans,&clip,&flat)) return NULL; e=xdrawfile_render((drawfile_render_flags)flags,self->drawf,self->size, (os_trfm*)trans,(os_box*)clip,flat); if(e) return drawf_oserror(); Py_INCREF(Py_None);return Py_None; } static PyObject *DrawF_Path(PyDrawFObject *self,PyObject *arg) { PyObject *pl; PyObject *dp=0; os_colour fill; os_colour outline; int width,start=0; drawfile_path_style style; int size=40; int n,i,element_count; drawfile_diagram *diag; drawfile_object *dobj; drawfile_path *dpath; draw_path *thepath; draw_line_style line_style; draw_dash_pattern *dash_pattern=0; os_box *box; long *pe; if(!PyArg_ParseTuple(arg,"O!(iiii)|O!i",&PyList_Type,&pl,(int*)&fill, (int*)&outline,&width,(int*)&style,&PyTuple_Type,&dp,&start)) return NULL; if(dp) { element_count=PyTuple_Size(dp); size+=4*element_count+8; style.flags|=drawfile_PATH_DASHED; } else style.flags&=~drawfile_PATH_DASHED; n=PyList_Size(pl); size+=4*n+8; for(i=0;idrawf,self->size+size); if(!diag) return PyErr_NoMemory(); self->drawf=diag; dobj=(drawfile_object*)((char*)diag+self->size); dobj->type=drawfile_TYPE_PATH; dobj->size=size; dpath=&dobj->data.path; self->size+=size; self->nobjs++; box=&dpath->bbox; dpath->fill=fill;dpath->outline=outline; dpath->width=width;dpath->style=style; pe=(long*)&(dpath->path); if(dp) { dash_pattern=&(((drawfile_path_with_pattern*)dpath)->pattern); dash_pattern->start=start; dash_pattern->element_count=element_count; for(i=0;ielements[i]=(int)PyInt_AsLong(PyTuple_GetItem(dp,i)); } pe+=element_count+2; } thepath=(draw_path*)pe; *pe++=draw_MOVE_TO; for(i=0;i>2; line_style.start_cap_style=(style.flags&3)>>4; line_style.reserved=0; line_style.mitre_limit=10; line_style.start_cap_width=style.cap_width; line_style.end_cap_width=style.cap_width; line_style.start_cap_length=style.cap_length; line_style.end_cap_length=style.cap_length; e=xdraw_process_path(thepath,0x70000000,0,0,width,&line_style,dash_pattern, (draw_output_path)((char*)box+0x80000000),0); if(e) return drawf_oserror(); /* draw_process_path seems to have a bug: If the bounding box size is zero, it returns 0x7FFFFFFF, ..., 0x80000000 instead of the correct size. */ if (box->x0==0x7FFFFFFF) { /* path has zero extension, so forget it; it would be invisible anyway */ self->size-=size; self->nobjs--; diag=realloc(self->drawf,self->size); if(!diag) return PyErr_NoMemory(); self->drawf=diag; } else extend(&(diag->bbox),box); Py_INCREF(Py_None);return Py_None; } static PyObject *DrawF_Text(PyDrawFObject *self,PyObject *arg) { os_colour fill,bg_hint; drawfile_text_style style; int xsize,ysize,x,y; int size,len; char *text; drawfile_diagram *diag; drawfile_object *dobj; drawfile_text *dtext; os_box *box; if(!PyArg_ParseTuple(arg,"(ii)s(iiiii)",&x,&y,&text, (int*)&fill,(int*)&bg_hint,(int*)&style,&xsize,&ysize)) return NULL; len=strlen(text); size=((len+4)&(~3))+52; diag=realloc(self->drawf,self->size+size); if(!diag) return PyErr_NoMemory(); self->drawf=diag; dobj=(drawfile_object*)((char*)diag+self->size); dobj->type=drawfile_TYPE_TEXT; dobj->size=size; dtext=&dobj->data.text; self->size+=size; self->nobjs++; dtext->fill=fill; dtext->bg_hint=bg_hint; dtext->style=style; dtext->xsize=xsize; dtext->ysize=ysize; dtext->base.x=x; dtext->base.y=y; memset(dtext->text,0,(len+4)&(~3)); sprintf(dtext->text,"%s",text); box=&(dtext->bbox); box->x0=x;box->y0=y;box->x1=x+len*xsize;box->y1=y+ysize; extend(&(diag->bbox),box); Py_INCREF(Py_None);return Py_None; } static PyObject *DrawF_TText(PyDrawFObject *self,PyObject *arg) { os_colour fill,bg_hint; drawfile_text_style style; int xsize,ysize,x,y; int t1,t2,t3,t4,t5,t6; int size,len; char *text; drawfile_diagram *diag; drawfile_object *dobj; drawfile_trfm_text *dtext; os_box *box; t1=1<<16;t2=0; t3=0;t4=1<<16; t5=t6=0; if(!PyArg_ParseTuple(arg,"(ii)s(iiiii)|(iiiiii)",&x,&y,&text, (int*)&fill,(int*)&bg_hint,(int*)&style,&xsize,&ysize,&t1,&t2,&t3,&t4,&t5,&t6)) return NULL; len=strlen(text); size=((len+4)&(~3))+52+28; diag=realloc(self->drawf,self->size+size); if(!diag) return PyErr_NoMemory(); self->drawf=diag; dobj=(drawfile_object*)((char*)diag+self->size); dobj->type=drawfile_TYPE_TRFM_TEXT; dobj->size=size; dtext=&dobj->data.trfm_text; self->size+=size; self->nobjs++; dtext->trfm.entries[0][0]=t1; dtext->trfm.entries[0][1]=t2; dtext->trfm.entries[1][0]=t3; dtext->trfm.entries[1][1]=t4; dtext->trfm.entries[2][0]=t5; dtext->trfm.entries[2][1]=t6; dtext->flags=0; dtext->fill=fill; dtext->bg_hint=bg_hint; dtext->style=style; dtext->xsize=xsize; dtext->ysize=ysize; dtext->base.x=x; dtext->base.y=y; memset(dtext->text,0,(len+4)&(~3)); sprintf(dtext->text,"%s",text); box=&(dtext->bbox); box->x0=x;box->y0=y;box->x1=x+len*xsize;box->y1=y+ysize; extend(&(diag->bbox),box); Py_INCREF(Py_None);return Py_None; } static PyObject *DrawF_FontTable(PyDrawFObject *self,PyObject *arg) { int size=8,n=0; PyObject *d,*key,*value; drawfile_diagram *diag; drawfile_object *dobj; char *dtable; if(!PyArg_ParseTuple(arg,"O!",&PyDict_Type,&d)) return NULL; while(PyDict_Next(d,&n,&key,&value)) { int m=PyString_Size(value); if(m<0||!PyInt_Check(key)) return NULL; size+=m+2; } size=(size+3)&(~3); diag=realloc(self->drawf,self->size+size); if(!diag) return PyErr_NoMemory(); self->drawf=diag; dobj=(drawfile_object*)((char*)diag+self->size); dobj->type=drawfile_TYPE_FONT_TABLE; dobj->size=size; dtable=(char*)(&dobj->data.font_table); self->size+=size; self->nobjs++; memset(dtable,0,size-8); n=0; while(PyDict_Next(d,&n,&key,&value)) { int m=PyString_Size(value); *dtable=(char)PyInt_AsLong(key); strcpy(dtable+1,PyString_AsString(value)); dtable+=m+2; } Py_INCREF(Py_None);return Py_None; } static PyObject *DrawF_Group(PyDrawFObject *self,PyObject *arg) { int size,n; PyDrawFObject *g; char *name=""; drawfile_diagram *diag; drawfile_object *dobj; drawfile_group *dgroup; if(!PyArg_ParseTuple(arg,"O!|s",&PyDrawFType,(PyObject*)&g,&name)) return NULL; size=g->size-4; diag=realloc(self->drawf,self->size+size); if(!diag) return PyErr_NoMemory(); self->drawf=diag; self->nobjs++; dobj=(drawfile_object*)((char*)diag+self->size); self->size+=size; dobj->type=drawfile_TYPE_GROUP; dobj->size=g->size-4; dgroup=&dobj->data.group; dgroup->bbox=g->drawf->bbox; memset(dgroup->name,' ',12); n=strlen(name); if(n>12) n=12; memcpy(dgroup->name,name,n); memcpy((char*)dgroup->objects,(char*)g->drawf+40,g->size-40); extend(&(diag->bbox),&(dgroup->bbox)); Py_INCREF(Py_None);return Py_None; } static PyObject *DrawF_Find(PyDrawFObject *self,PyObject *arg) { int x,y,n=0; int r=-1; drawfile_object *d; if(!PyArg_ParseTuple(arg,"ii|i",&x,&y,&n)) return NULL; if(nnobjs&&n>=0) { d=findobj(self,n); while(nnobjs) { if(x>=d->data.text.bbox.x0&&x<=d->data.text.bbox.x1&& y>=d->data.text.bbox.y0&&y<=d->data.text.bbox.y1) { r=n;break;} n++; d=NEXT(d); } } return PyInt_FromLong(r); } static PyObject *DrawF_Box(PyDrawFObject *self,PyObject *arg) { int n=-1; os_box *box; if(!PyArg_ParseTuple(arg,"|i",&n)) return NULL; if(n>=self->nobjs|n<0) box=&(self->drawf->bbox); else box=&(findobj(self,n)->data.text.bbox); return Py_BuildValue("iiii",box->x0,box->y0,box->x1,box->y1); } static void SetBlock(drawfile_object *d,int size,int type,int offset,int value) { char *end=(char*)d+size; printf("s%d t%d o%d v%d\n",size,type,offset,value); for(;(char*)dtype==type) ((int*)(d))[offset]=value; else if(d->type==drawfile_TYPE_GROUP) SetBlock((drawfile_object*)&d->data.group.objects, d->size,type,offset,value); printf("SetBlock Done\n"); } static PyObject *SetWord(PyDrawFObject *self,PyObject *arg,int type,int offset) { int n=PyTuple_Size(arg); int m,value,q; PyObject *par; drawfile_object *e,*d=self->drawf->objects; if(n==0) return drawf_error("Value Required"); par=PyTuple_GetItem(arg,0); if(!PyInt_Check(par)) { PyErr_SetString(PyExc_TypeError,"Int Required"); return 0; } value=(int)PyInt_AsLong(par); if(n==1) SetBlock(d,self->size-HDRSIZE,type,offset,value); else { for(m=1;m=self->nobjs) { PyErr_SetString(PyExc_ValueError,"Object out of range"); return 0; } e=d; for(;q>0;q--) e=NEXT(e); if(e->type==type) { ((int*)(e))[offset]=value; } else if(e->type==drawfile_TYPE_GROUP) SetBlock((drawfile_object*)&e->data.group.objects, e->size-GRPHDRSIZE,type,offset,value); } } Py_INCREF(Py_None);return Py_None; } static PyObject *DrawF_PathFill(PyDrawFObject *self,PyObject *arg) { return SetWord(self,arg,drawfile_TYPE_PATH,6); } static PyObject *DrawF_PathColour(PyDrawFObject *self,PyObject *arg) { return SetWord(self,arg,drawfile_TYPE_PATH,7); } static PyObject *DrawF_TextColour(PyDrawFObject *self,PyObject *arg) { return SetWord(self,arg,drawfile_TYPE_TEXT,6); } static PyObject *DrawF_TextBackground(PyDrawFObject *self,PyObject *arg) { return SetWord(self,arg,drawfile_TYPE_TEXT,7); } static struct PyMethodDef PyDrawF_Methods[]= { { "render",(PyCFunction)DrawF_Render,1}, { "save",(PyCFunction)DrawF_Save,1}, { "path",(PyCFunction)DrawF_Path,1}, { "text",(PyCFunction)DrawF_Text,1}, { "ttext",(PyCFunction)DrawF_TText,1}, { "fonttable",(PyCFunction)DrawF_FontTable,1}, { "group",(PyCFunction)DrawF_Group,1}, { "find",(PyCFunction)DrawF_Find,1}, { "box",(PyCFunction)DrawF_Box,1}, { "pathfill",(PyCFunction)DrawF_PathFill,1}, { "pathcolour",(PyCFunction)DrawF_PathColour,1}, { "textcolour",(PyCFunction)DrawF_TextColour,1}, { "textbackground",(PyCFunction)DrawF_TextBackground,1}, { NULL,NULL} /* sentinel */ }; static int drawf_len(PyDrawFObject *b) { return b->nobjs; } static PyObject *drawf_concat(PyDrawFObject *b,PyDrawFObject *c) { int size=b->size+c->size-2*HDRSIZE; PyDrawFObject *p=new(size); drawfile_diagram *dd; drawfile_object *d; int n; if(!p) return NULL; dd=p->drawf; d=(drawfile_object*)((char*)dd+b->size); memcpy((char*)dd,(char*)(b->drawf),b->size); memcpy(d,(char*)(c->drawf)+HDRSIZE,c->size-HDRSIZE); p->nobjs=b->nobjs+c->nobjs; for(n=c->nobjs;n>0;n--) { extend(&(dd->bbox),&(d->data.path.bbox)); d=NEXT(d); } return (PyObject*)p; } static PyObject *drawf_repeat(PyDrawFObject *b,int i) { PyErr_SetString(PyExc_IndexError,"drawf repetition not implemented"); return NULL; } static PyObject *drawf_item(PyDrawFObject *b,int i) { PyDrawFObject *c; int size; drawfile_diagram *dd; drawfile_object *d; if(i<0||i>=b->nobjs) { PyErr_SetString(PyExc_IndexError,"drawf index out of range"); return NULL; } d=findobj(b,i); size=(char*)findobj(b,i+1)-(char*)d; c=new(size); if(!c) return NULL; dd=c->drawf; *((dheader*)dd)=header; memcpy(dd->objects,d,size); c->nobjs=1; extend(&(dd->bbox),&(d->data.path.bbox)); return (PyObject*)c; } static PyObject *drawf_slice(PyDrawFObject *b,int i,int j) { PyDrawFObject *c; int size,n; drawfile_diagram *dd; drawfile_object *d; if(i<0||j>b->nobjs) { PyErr_SetString(PyExc_IndexError,"drawf index out of range"); return NULL; } d=findobj(b,i); size=(char*)findobj(b,j)-(char*)d; c=new(size); if(!c) return NULL; dd=c->drawf; *((dheader*)dd)=header; memcpy(dd->objects,d,size); c->nobjs=j-i; for(n=j-i;n>0;n--) { extend(&(dd->bbox),&(d->data.path.bbox)); d=NEXT(d); } return (PyObject*)c; } static int drawf_ass_item(PyDrawFObject *b,int i,PyObject *v) { PyErr_SetString(PyExc_IndexError,"drawf ass not implemented"); return NULL; } /*{ if(i<0||4*i>=b->length) { PyErr_SetString(PyExc_IndexError,"drawf index out of range"); return -1; } if(!PyInt_Check(v)) { PyErr_SetString(PyExc_TypeError,"drawf item must be integer"); return -1; } ((long*)(b->drawf))[i]=PyInt_AsLong(v); return 0; } */ static int drawf_ass_slice(PyDrawFObject *b,int i,int j,PyObject *v) { PyErr_SetString(PyExc_IndexError,"drawf ass_slice not implemented"); return NULL; } static PySequenceMethods drawf_as_sequence= { (inquiry)drawf_len, (binaryfunc)drawf_concat, (intargfunc)drawf_repeat, (intargfunc)drawf_item, (intintargfunc)drawf_slice, (intobjargproc)drawf_ass_item, (intintobjargproc)drawf_ass_slice, }; static PyObject *PyDrawF_GetAttr(PyDrawFObject *s,char *name) { if (!strcmp(name, "size")) return PyInt_FromLong((long)s->size); if (!strcmp(name, "start")) return PyInt_FromLong((long)s->drawf); if (!strcmp(name, "__members__")) { PyObject *list = PyList_New(2); if (list) { PyList_SetItem(list, 0, PyString_FromString("size")); PyList_SetItem(list, 1, PyString_FromString("start")); if (PyErr_Occurred()) { Py_DECREF(list);list = NULL;} } return list; } return Py_FindMethod(PyDrawF_Methods, (PyObject*) s,name); } static void PyDrawF_Dealloc(PyDrawFObject *b) { if (b->drawf) ; else PyMem_DEL(b->drawf); PyMem_DEL(b); } static PyTypeObject PyDrawFType= { PyObject_HEAD_INIT(&PyType_Type) 0, /*ob_size*/ "drawf", /*tp_name*/ sizeof(PyDrawFObject), /*tp_size*/ 0, /*tp_itemsize*/ /* methods */ (destructor)PyDrawF_Dealloc, /*tp_dealloc*/ 0, /*tp_print*/ (getattrfunc)PyDrawF_GetAttr, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ &drawf_as_sequence, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ }; static PyMethodDef DrawFMethods[]= { { "load",DrawF_Load,1}, { "new",DrawF_New,1}, { NULL,NULL} /* Sentinel */ }; void initdrawf() { PyObject *m, *d; m = Py_InitModule("drawf", DrawFMethods); d = PyModule_GetDict(m); DrawFError=PyString_FromString("drawf.error"); PyDict_SetItemString(d,"error",DrawFError); } --- NEW FILE: getpath_riscos.c --- #include "Python.h" #include "osdefs.h" static char *prefix,*exec_prefix,*progpath,*module_search_path=0; static void calculate_path() { char *pypath=getenv("Python$Path"); if(pypath) { module_search_path=malloc(strlen(pypath)+1); if (module_search_path) sprintf(module_search_path,"%s",pypath); else { /* We can't exit, so print a warning and limp along */ fprintf(stderr, "Not enough memory for dynamic PYTHONPATH.\n"); fprintf(stderr, "Using default static PYTHONPATH.\n"); } } if(!module_search_path) module_search_path = ".Lib"; prefix=""; exec_prefix=prefix; progpath=""; } /* External interface */ char * Py_GetPath() { if (!module_search_path) calculate_path(); return module_search_path; } char * Py_GetPrefix() { if (!module_search_path) calculate_path(); return prefix; } char * Py_GetExecPrefix() { if (!module_search_path) calculate_path(); return exec_prefix; } char * Py_GetProgramFullPath() { if (!module_search_path) calculate_path(); return progpath; } --- NEW FILE: riscosmodule.c --- /* RISCOS module implementation */ #include "h.osfscontrol" #include "h.osgbpb" #include "h.os" #include "h.osfile" #include "Python.h" #include static os_error *e; static PyObject *RiscosError; /* Exception riscos.error */ static PyObject *riscos_oserror(void) { PyErr_SetString(RiscosError,e->errmess); return 0; } static PyObject *riscos_error(char *s) { PyErr_SetString(RiscosError,s);return 0;} /* RISCOS file commands */ static PyObject *riscos_remove(PyObject *self,PyObject *args) { char *path1; if (!PyArg_Parse(args, "s", &path1)) return NULL; if (remove(path1)) return PyErr_SetFromErrno(RiscosError); Py_INCREF(Py_None); return Py_None; } static PyObject *riscos_rename(PyObject *self,PyObject *args) { char *path1, *path2; if (!PyArg_Parse(args, "(ss)", &path1, &path2)) return NULL; if (rename(path1,path2)) return PyErr_SetFromErrno(RiscosError);; Py_INCREF(Py_None); return Py_None; } static PyObject *riscos_system(PyObject *self,PyObject *args) { char *command; if (!PyArg_Parse(args, "s", &command)) return NULL; return PyInt_FromLong(system(command)); } static PyObject *riscos_chdir(PyObject *self,PyObject *args) { char *path; if (!PyArg_Parse(args, "s", &path)) return NULL; e=xosfscontrol_dir(path); if(e) return riscos_oserror(); Py_INCREF(Py_None); return Py_None; } static PyObject *canon(char *path) { int len; PyObject *obj; char *buf; e=xosfscontrol_canonicalise_path(path,0,0,0,0,&len); if(e) return riscos_oserror(); obj=PyString_FromStringAndSize(NULL,-len); if(obj==NULL) return NULL; buf=PyString_AsString(obj); e=xosfscontrol_canonicalise_path(path,buf,0,0,1-len,&len); if(len!=1) return riscos_error("Error expanding path"); if(!e) return obj; Py_DECREF(obj); return riscos_oserror(); } static PyObject *riscos_getcwd(PyObject *self,PyObject *args) { if(!PyArg_NoArgs(args)) return NULL; return canon("@"); } static PyObject *riscos_expand(PyObject *self,PyObject *args) { char *path; if (!PyArg_Parse(args, "s", &path)) return NULL; return canon(path); } static PyObject *riscos_mkdir(PyObject *self,PyObject *args) { char *path; int mode; if (!PyArg_ParseTuple(args, "s|i", &path, &mode)) return NULL; e=xosfile_create_dir(path,0); if(e) return riscos_oserror(); Py_INCREF(Py_None); return Py_None; } static PyObject *riscos_listdir(PyObject *self,PyObject *args) { char *path,buf[256]; PyObject *d, *v; int c=0,count; if (!PyArg_Parse(args, "s", &path)) return NULL; d=PyList_New(0); if(!d) return NULL; for(;;) { e=xosgbpb_dir_entries(path,(osgbpb_string_list*)buf, 1,c,256,0,&count,&c); if(e) { Py_DECREF(d);return riscos_oserror(); } if(count) { v=PyString_FromString(buf); if(!v) { Py_DECREF(d);return 0;} if(PyList_Append(d,v)) {Py_DECREF(d);Py_DECREF(v);return 0;} } if(c==-1) break; } return d; } static PyObject *riscos_stat(PyObject *self,PyObject *args) { char *path; int ob,len; bits t=0; bits ld,ex,at,ft,mode; if (!PyArg_Parse(args, "s", &path)) return NULL; e=xosfile_read_stamped_no_path(path,&ob,&ld,&ex,&len,&at,&ft); if(e) return riscos_oserror(); switch (ob) { case osfile_IS_FILE:mode=0100000;break; /* OCTAL */ case osfile_IS_DIR:mode=040000;break; case osfile_IS_IMAGE:mode=0140000;break; default:return riscos_error("Not found"); } if(ft!=-1) t=unixtime(ld,ex); mode|=(at&7)<<6; mode|=((at&112)*9)>>4; return Py_BuildValue("(lllllllllllll)", (long)mode,/*st_mode*/ 0,/*st_ino*/ 0,/*st_dev*/ 0,/*st_nlink*/ 0,/*st_uid*/ 0,/*st_gid*/ (long)len,/*st_size*/ (long)t,/*st_atime*/ (long)t,/*st_mtime*/ (long)t,/*st_ctime*/ (long)ft,/*file type*/ (long)at,/*attributes*/ (long)ob/*object type*/ ); } static PyObject *riscos_chmod(PyObject *self,PyObject *args) { char *path; bits mode; bits attr; attr=(mode&0x700)>>8; attr|=(mode&7)<<4; if (!PyArg_Parse(args, "(si)", &path,(int*)&mode)) return NULL; e=xosfile_write_attr(path,attr); if(e) return riscos_oserror(); Py_INCREF(Py_None); return Py_None; } static PyObject *riscos_utime(PyObject *self,PyObject *args) { char *path; int x,y; if (!PyArg_Parse(args, "(s(ii))", &path,&x,&y)) return NULL; e=xosfile_stamp(path); if(e) return riscos_oserror(); Py_INCREF(Py_None); return Py_None; } static PyObject *riscos_settype(PyObject *self,PyObject *args) { char *path,*name; int type; if (!PyArg_Parse(args, "(si)", &path,&type)) { PyErr_Clear(); if (!PyArg_Parse(args, "(ss)", &path,&name)) return NULL; e=xosfscontrol_file_type_from_string(name,(bits*)&type); if(e) return riscos_oserror(); } e=xosfile_set_type(path,type); if(e) return riscos_oserror(); Py_INCREF(Py_None); return Py_None; } static PyObject *riscos_getenv(PyObject *self,PyObject *args) { char *name,*value; if(!PyArg_Parse(args,"s",&name)) return NULL; value=getenv(name); if(value) return PyString_FromString(value); Py_INCREF(Py_None); return Py_None; } static PyObject *riscos_putenv(PyObject *self,PyObject *args) { char *name,*value; int len; os_var_type type=os_VARTYPE_LITERAL_STRING; if(!PyArg_ParseTuple(args,"ss|i",&name,&value,&type)) return NULL; if(type!=os_VARTYPE_STRING&&type!=os_VARTYPE_MACRO&&type!=os_VARTYPE_EXPANDED &&type!=os_VARTYPE_LITERAL_STRING) return riscos_error("Bad putenv type"); len=strlen(value); if(type!=os_VARTYPE_LITERAL_STRING) len++; /* Other types need null terminator! */ e=xos_set_var_val(name,(byte*)value,len,0,type,0,0); if(e) return riscos_oserror(); Py_INCREF(Py_None); return Py_None; } static PyObject *riscos_delenv(PyObject *self,PyObject *args) { char *name; if(!PyArg_Parse(args,"s",&name)) return NULL; e=xos_set_var_val(name,NULL,-1,0,0,0,0); if(e) return riscos_oserror(); Py_INCREF(Py_None); return Py_None; } static PyObject *riscos_getenvdict(PyObject *self,PyObject *args) { PyObject *dict; char value[257]; char *which="*"; int size; char *context=NULL; if(!PyArg_ParseTuple(args,"|s",&which)) return NULL; dict = PyDict_New(); if (!dict) return NULL; /* XXX This part ignores errors */ while(!xos_read_var_val(which,value,sizeof(value)-1,(int)context, os_VARTYPE_EXPANDED,&size,(int *)&context,0)) { PyObject *v; value[size]='\0'; v = PyString_FromString(value); if (v == NULL) continue; PyDict_SetItemString(dict, context, v); Py_DECREF(v); } return dict; } static PyMethodDef riscos_methods[] = { {"unlink", riscos_remove}, {"remove", riscos_remove}, {"rename", riscos_rename}, {"system", riscos_system}, {"rmdir", riscos_remove}, {"chdir", riscos_chdir}, {"getcwd", riscos_getcwd}, {"expand", riscos_expand}, {"mkdir", riscos_mkdir,1}, {"listdir", riscos_listdir}, {"stat", riscos_stat}, {"lstat", riscos_stat}, {"chmod", riscos_chmod}, {"utime", riscos_utime}, {"settype", riscos_settype}, {"getenv", riscos_getenv}, {"putenv", riscos_putenv}, {"delenv", riscos_delenv}, {"getenvdict", riscos_getenvdict,1}, {NULL, NULL} /* Sentinel */ }; void initriscos() { PyObject *m, *d; m = Py_InitModule("riscos", riscos_methods); d = PyModule_GetDict(m); /* Initialize riscos.error exception */ RiscosError = PyString_FromString("riscos.error"); if (RiscosError == NULL || PyDict_SetItemString(d, "error", RiscosError) != 0) Py_FatalError("can't define riscos.error"); } --- NEW FILE: swimodule.c --- /* swi RISC OS swi functions 1.00 Chris Stretch 1.01 12 May 1999 Laurence Tratt * Changed swi.error to be a class based exception rather than string based * Added swi.ArgError which is generated for errors when the user passes invalid arguments to functions etc * Added "errnum" attribute to swi.error, so one can now check to see what the error number was */ #include "h.os" #include "h.kernel" #include "Python.h" #include #define PyBlock_Check(op) ((op)->ob_type == &PyBlockType) static PyObject *SwiError; /* Exception swi.error */ static PyObject *ArgError; /* Exception swi.ArgError */ static os_error *e; static PyObject *swi_oserror(void) { PyErr_SetString(SwiError,e->errmess); PyObject_SetAttrString(PyErr_Occurred(), "errnum", PyInt_FromLong(e->errnum)); return 0; } static PyObject *swi_error(char *s) { PyErr_SetString(ArgError,s); return 0; } typedef struct { PyObject_HEAD void *block; int length; /*length in bytes*/ int heap; } PyBlockObject; static PyTypeObject PyBlockType; /* block commands */ static PyObject *PyBlock_New(PyObject *self,PyObject *args) { int size; PyBlockObject *b; PyObject *init=0; if(!PyArg_ParseTuple(args,"i|O",&size,&init)) return NULL; if(size<1) size=1; b=PyObject_NEW(PyBlockObject,&PyBlockType); if(!b) return NULL; b->block=malloc(4*size); if(!b->block) { Py_DECREF(b); return PyErr_NoMemory(); } b->length=4*size; b->heap=1; if(init) { if(PyString_Check(init)) { int n=PyString_Size(init); if (n>4*size) n=4*size; memcpy(b->block,PyString_AsString(init),n); memset((char*)b->block+n,0,4*size-n); } else { int n,k; long *p=(long*)b->block; if(!PyList_Check(init)) goto fail; n=PyList_Size(init); if (n>size) n=size; for(k=0;kblock=(void*)ptr; b->length=4*size; b->heap=0; return (PyObject *)b; } static PyObject *PyBlock_ToString(PyBlockObject *self,PyObject *arg) { int s=0,e=self->length; if(!PyArg_ParseTuple(arg,"|ii",&s,&e)) return NULL; if(s<0||e>self->length||s>e) { PyErr_SetString(PyExc_IndexError,"block index out of range"); return NULL; } return PyString_FromStringAndSize((char*)self->block+s,e-s); } static PyObject *PyBlock_NullString(PyBlockObject *self,PyObject *arg) { int s=0,e=self->length,i; char *p=(char*)self->block; if(!PyArg_ParseTuple(arg,"|ii",&s,&e)) return NULL; if(s<0||e>self->length||s>e) { PyErr_SetString(PyExc_IndexError,"block index out of range"); return NULL; } for(i=s;iblock+s,i-s); } static PyObject *PyBlock_CtrlString(PyBlockObject *self,PyObject *arg) { int s=0,e=self->length,i; char *p=(char*)self->block; if(!PyArg_ParseTuple(arg,"|ii",&s,&e)) return NULL; if(s<0||e>self->length||s>e) { PyErr_SetString(PyExc_IndexError,"block index out of range"); return NULL; } for(i=s;iblock+s,i-s); } static PyObject *PyBlock_PadString(PyBlockObject *self,PyObject *arg) { int s=0,e=self->length,n,m; char *str; char c; char *p=(char*)self->block; if(!PyArg_ParseTuple(arg,"s#c|ii",&str,&n,&c,&s,&e)) return NULL; if(s<0||e>self->length||s>e) { PyErr_SetString(PyExc_IndexError,"block index out of range"); return NULL; } m=e-s; if(n>m) n=m; memcpy(p+s,str,n);memset(p+s+n,c,m-n); Py_INCREF(Py_None);return Py_None; } static PyObject *PyBlock_BitSet(PyBlockObject *self,PyObject *arg) { int i,x,y; int *p=(int*)self->block; if(!PyArg_ParseTuple(arg,"iii",&i,&x,&y)) return NULL; if(i<0||i>=self->length/4) { PyErr_SetString(PyExc_IndexError,"block index out of range"); return NULL; } p[i]=(p[i]&y)^x; Py_INCREF(Py_None);return Py_None; } static PyObject *PyBlock_Resize(PyBlockObject *self,PyObject *arg) { int n; if(!PyArg_ParseTuple(arg,"i",&n)) return NULL; if(n<1) n=1; if(self->heap) { void *v=realloc(self->block,4*n); if (!v) return PyErr_NoMemory(); self->block=v; } self->length=4*n; Py_INCREF(Py_None);return Py_None; } static PyObject *PyBlock_ToFile(PyBlockObject *self,PyObject *arg) { int s=0,e=self->length/4; PyObject *f; FILE *fp; if(!PyArg_ParseTuple(arg,"O|ii",&f,&s,&e)) return NULL; fp=PyFile_AsFile(f); if (!fp) { PyErr_SetString(PyExc_TypeError, "arg must be open file"); return NULL; } fwrite((int*)(self->block)+s,4,e-s,fp); Py_INCREF(Py_None);return Py_None; } static struct PyMethodDef PyBlock_Methods[]= { { "tostring",(PyCFunction)PyBlock_ToString,1}, { "padstring",(PyCFunction)PyBlock_PadString,1}, { "nullstring",(PyCFunction)PyBlock_NullString,1}, { "ctrlstring",(PyCFunction)PyBlock_CtrlString,1}, { "bitset",(PyCFunction)PyBlock_BitSet,1}, { "resize",(PyCFunction)PyBlock_Resize,1}, { "tofile",(PyCFunction)PyBlock_ToFile,1}, { NULL,NULL} /* sentinel */ }; static int block_len(PyBlockObject *b) { return b->length/4; } static PyObject *block_concat(PyBlockObject *b,PyBlockObject *c) { PyErr_SetString(PyExc_IndexError,"block concatenation not implemented"); return NULL; } static PyObject *block_repeat(PyBlockObject *b,int i) { PyErr_SetString(PyExc_IndexError,"block repetition not implemented"); return NULL; } static PyObject *block_item(PyBlockObject *b,int i) { if(i<0||4*i>=b->length) { PyErr_SetString(PyExc_IndexError,"block index out of range"); return NULL; } return PyInt_FromLong(((long*)(b->block))[i]); } static PyObject *block_slice(PyBlockObject *b,int i,int j) { int n,k; long *p=b->block; PyObject *result; if(j>b->length/4) j=b->length/4; if(i<0||i>j) { PyErr_SetString(PyExc_IndexError,"block index out of range"); return NULL; } n=j-i; result=PyList_New(n); for(k=0;k=b->length/4) { PyErr_SetString(PyExc_IndexError,"block index out of range"); return -1; } if(!PyInt_Check(v)) { PyErr_SetString(PyExc_TypeError,"block item must be integer"); return -1; } ((long*)(b->block))[i]=PyInt_AsLong(v); return 0; } static int block_ass_slice(PyBlockObject *b,int i,int j,PyObject *v) { int n,k; long *p=b->block; if(j>b->length/4) j=b->length/4; if(i<0||i>j) { PyErr_SetString(PyExc_IndexError,"block index out of range"); return -1; } if(!PyList_Check(v)) goto fail; n=PyList_Size(v); if(n>j-i) n=j-i; for(k=0;klength); if (!strcmp(name, "start")) return PyInt_FromLong((long)s->block); if (!strcmp(name,"end")) return PyInt_FromLong(((long)(s->block)+s->length)); if (!strcmp(name, "__members__")) { PyObject *list = PyList_New(3); if (list) { PyList_SetItem(list, 0, PyString_FromString("length")); PyList_SetItem(list, 1, PyString_FromString("start")); PyList_SetItem(list, 2, PyString_FromString("end")); if (PyErr_Occurred()) { Py_DECREF(list);list = NULL;} } return list; } return Py_FindMethod(PyBlock_Methods, (PyObject*) s,name); } static void PyBlock_Dealloc(PyBlockObject *b) { if(b->heap) { if (b->heap) ; else PyMem_DEL(b->block); } PyMem_DEL(b); } static PyTypeObject PyBlockType= { PyObject_HEAD_INIT(&PyType_Type) 0, /*ob_size*/ "block", /*tp_name*/ sizeof(PyBlockObject), /*tp_size*/ 0, /*tp_itemsize*/ /* methods */ (destructor)PyBlock_Dealloc, /*tp_dealloc*/ 0, /*tp_print*/ (getattrfunc)PyBlock_GetAttr, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ &block_as_sequence, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ }; /* swi commands */ static PyObject *swi_swi(PyObject *self,PyObject *args) { PyObject *name,*format,*result,*v; int swino,carry,rno=0,j,n; char *swiname,*fmt,*outfmt; _kernel_swi_regs r; PyBlockObject *ao; if(args==NULL||!PyTuple_Check(args)||(n=PyTuple_Size(args))<2) { PyErr_BadArgument(); return NULL;} name=PyTuple_GetItem(args,0); if(!PyArg_Parse(name,"i",&swino)) { PyErr_Clear(); if(!PyArg_Parse(name,"s",&swiname)) return NULL; e=xos_swi_number_from_string(swiname,&swino); if(e) return swi_oserror(); } format=PyTuple_GetItem(args,1); if(!PyArg_Parse(format,"s",&fmt)) return NULL; j=2; for(;;fmt++) { switch(*fmt) { case '.': rno++;continue; case ';':case 0: goto swicall; case '0':case '1':case '2':case '3':case '4': case '5':case '6':case '7':case '8':case '9': r.r[rno++]=*fmt-'0';continue; case '-':r.r[rno++]=-1;continue; } if(j>=n) return swi_error("Too few arguments"); v=PyTuple_GetItem(args,j++); switch(*fmt) { case 'i':if(!PyArg_Parse(v,"i",&r.r[rno])) return NULL; break; case 's':if(!PyArg_Parse(v,"s",(char**)(&r.r[rno]))) return NULL; break; case 'b':if(!PyArg_Parse(v,"O",(PyObject**)&ao)) return NULL; if(!PyBlock_Check(v)) return swi_error("Not a block"); r.r[rno]=(int)(ao->block); break; case 'e':if(!PyArg_Parse(v,"O",(PyObject**)&ao)) return NULL; if(!PyBlock_Check(v)) return swi_error("Not a block"); r.r[rno]=(int)(ao->block)+ao->length; break; default:return swi_error("Odd format character"); } rno++; } swicall:e=(os_error*)_kernel_swi_c(swino,&r,&r,&carry); if(e) return swi_oserror(); if(*fmt==0) { Py_INCREF(Py_None);return Py_None;} n=0; for(outfmt=++fmt;*outfmt;outfmt++) switch(*outfmt) { case 'i':case 's':case '*':n++;break; case '.':break; default:return swi_error("Odd format character"); } if(n==0) { Py_INCREF(Py_None);return Py_None;} if(n!=1) { result=PyTuple_New(n); if(!result) return NULL; } rno=0;j=0; for(;*fmt;fmt++) { switch(*fmt) { case 'i':v=PyInt_FromLong((long)r.r[rno++]); break; case 's':v=PyString_FromString((char*)(r.r[rno++])); break; case '.':rno++; continue; case '*':v=PyInt_FromLong((long)carry); break; } if(!v) goto fail; if(n==1) return v; PyTuple_SetItem(result,j,v); j++; } return result; fail:Py_DECREF(result);return 0; } static PyMethodDef SwiMethods[]= { { "swi",swi_swi,1}, { "block",PyBlock_New,1}, { "register",PyRegister,1}, { NULL,NULL} /* Sentinel */ }; void initswi() { PyObject *m, *d; m = Py_InitModule("swi", SwiMethods); d = PyModule_GetDict(m); SwiError=PyErr_NewException("swi.error", NULL, NULL); PyDict_SetItemString(d,"error",SwiError); ArgError=PyErr_NewException("swi.ArgError", NULL, NULL); PyDict_SetItemString(d,"ArgError",ArgError); } From gvanrossum@users.sourceforge.net Fri Mar 2 05:58:13 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 01 Mar 2001 21:58:13 -0800 Subject: [Python-checkins] CVS: python/dist/src/RISCOS Makefile,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/RISCOS In directory usw-pr-cvs1:/tmp/cvs-serv8927 Added Files: Makefile Log Message: RISCOS files by dschwertberger --- NEW FILE: Makefile --- # RISC OS Python LIBSROOT = $.AcornC_C++.Libraries # You may need to change some of the following OSLIB = $(LIBSROOT).OSLib CLIB = $(LIBSROOT).clib SOCKLIB = $(LIBSROOT).netlib DLKLIB = $(LIBSROOT).dlk ZLIB = $(LIBSROOT).zlib EXPAT = $(LIBSROOT).expat.lib OBJSCAN = $(DLKLIB).objscan MAKEDLK = $(DLKLIB).makedlk # change from time to time TARGET=Python21 BUILD=10 # # You shouldn't need to change anything below this line # OSLIBS = OSLib:Computer,OSLib:Core,OSLib:User DLKFLAG= -DDLK DLKOBJS = $(DLKLIB).o.dlk_load o.linktab HEADERS = @,@.^.Include,@.^.Modules,@.^.Objects,@.^.Python,$(CLIB),$(OSLIBS),$(DLKLIB) CC = cc -c -j$(HEADERS) $(DLKFLAG) -DRISCOS -DHAVE_CONFIG_H -wad -throwback #-depend !Depend CCEXPAT = cc -c -j$(HEADERS),$(EXPAT) $(DLKFLAG) -DHAVE_EXPAT_H -DRISCOS -DHAVE_CONFIG_H -wad -throwback LINK = link LINKFLAGS = -aif -NOUNUSED #-d LOADLIBS = $(CLIB).o.Stubs $(OSLIB).o.OSLib $(DLKOBJS) .c.o : $(CC) -o $@ $*.c # code for main Python binary MODULES_STATIC = \ @.^.Modules.o.python \ @.^.Modules.o.main \ Modules.o.config \ @.^.Modules.o.getbuildinfo \ Modules.o.getpath_riscos \ Modules.o.riscosmodule \ @.^.Modules.o._sre # dynamic Modules MODULES_DYNAMIC = \ @.^.Lib.array/pyd \ @.^.Lib.audioop/pyd \ @.^.Lib.binascii/pyd \ @.^.Lib.cmath/pyd \ @.^.Lib.cPickle/pyd \ @.^.Lib.cStringIO/pyd \ @.^.Lib.errno/pyd \ @.^.Lib.imageop/pyd \ @.^.Lib.math/pyd \ @.^.Lib.md5/pyd \ @.^.Lib.new/pyd \ @.^.Lib.operator/pyd \ @.^.Lib.parser/pyd \ @.^.Lib.pcre/pyd \ @.^.Lib.regex/pyd \ @.^.Lib.rgbimg/pyd \ @.^.Lib.rotor/pyd \ @.^.Lib.sha/pyd \ @.^.Lib.signal/pyd \ @.^.Lib.struct/pyd \ @.^.Lib.time/pyd \ @.^.Lib._locale/pyd \ @.^.Lib.zlib/pyd \ @.^.Lib.select/pyd \ @.^.Lib._socket/pyd \ @.^.Lib._codecs/pyd \ @.^.Lib._weakref/pyd \ @.^.Lib._testcapi/pyd \ @.^.Lib.unicodedata/pyd \ @.^.Lib.xreadlines/pyd \ @.^.Lib.pyexpat/pyd \ @.^.Lib.plat-riscos.drawf/pyd \ @.^.Lib.plat-riscos.swi/pyd # @.^.Lib.soundex/pyd \ # leave strop out? It's no longer in use for string operations # @.^.Lib.mmap/pyd would it make sense? I read about a mmap # implementation for RISC OS recently in usenet news. #@.^.Lib.strop/pyd \ #@.^.Lib._sre/pyd \ OBJECTS_PYTHON = \ @.^.Python.o.traceback \ @.^.Python.o.sysmodule \ @.^.Python.o.structmember \ @.^.Python.o.strdup \ @.^.Python.o.sigcheck \ @.^.Python.o.pythonrun \ @.^.Python.o.pystate \ @.^.Python.o.pyfpe \ @.^.Python.o.mystrtoul \ @.^.Python.o.modsupport \ @.^.Python.o.marshal \ @.^.Python.o.importdl \ @.^.Python.o.import \ @.^.Python.o.graminit \ @.^.Python.o.getversion \ @.^.Python.o.getplatform \ @.^.Python.o.getopt \ @.^.Python.o.getcopyright \ @.^.Python.o.getcompiler \ @.^.Python.o.getargs \ @.^.Python.o.frozenmain \ @.^.Python.o.frozen \ @.^.Python.o.errors \ @.^.Python.o.compile \ @.^.Python.o.ceval \ @.^.Python.o.bltinmodule \ @.^.Python.o.exceptions \ @.^.Python.o.hypot \ @.^.Python.o.codecs \ @.^.Python.o.symtable # @.^.Python.o.atof @.^.Python.o.strerror OBJECTS_RISCOS = \ @.Python.o.dynload_riscos \ @.Python.o.getcwd_riscos \ @.Python.o.getmtime_riscos \ @.o.unixstuff OBJECTS_OBJECTS = \ @.^.Objects.o.typeobject \ @.^.Objects.o.tupleobject \ @.^.Objects.o.stringobject \ @.^.Objects.o.sliceobject \ @.^.Objects.o.rangeobject \ @.^.Objects.o.object \ @.^.Objects.o.moduleobject \ @.^.Objects.o.methodobject \ @.^.Objects.o.longobject \ @.^.Objects.o.listobject \ @.^.Objects.o.intobject \ @.^.Objects.o.funcobject \ @.^.Objects.o.frameobject \ @.^.Objects.o.floatobject \ @.^.Objects.o.fileobject \ @.^.Objects.o.dictobject \ @.^.Objects.o.complexobject \ @.^.Objects.o.cobject \ @.^.Objects.o.classobject \ @.^.Objects.o.cellobject \ @.^.Objects.o.bufferobject \ @.^.Objects.o.abstract \ @.^.Objects.o.unicodectype \ @.^.Objects.o.unicodeobject OBJECTS_PARSER = \ @.^.Parser.o.tokenizer \ @.^.Parser.o.printgrammar \ @.^.Parser.o.parsetok \ @.^.Parser.o.parser \ @.^.Parser.o.node \ @.^.Parser.o.myreadline \ @.^.Parser.o.metagrammar \ @.^.Parser.o.listnode \ @.^.Parser.o.intrcheck \ @.^.Parser.o.grammar1 \ @.^.Parser.o.grammar \ @.^.Parser.o.firstsets \ @.^.Parser.o.bitset \ @.^.Parser.o.acceler SUPPORT_FILES = @.^.!Boot @.^.!Run @.^.!Sprites @.^.!Sprites22 @.^.AddToPath OBJECTS = $(OBJECTS_PYTHON) $(OBJECTS_PARSER) $(MODULES_STATIC) $(OBJECTS_OBJECTS) $(OBJECTS_RISCOS) all: @.^.$(TARGET) $(MODULES_DYNAMIC) $(SUPPORT_FILES) @.^.Modules.o.getbuildinfo: @.^.Modules.c.getbuildinfo $(CC) -DBUILD=$(BUILD) -o @.^.Modules.o.getbuildinfo @.^.Modules.c.getbuildinfo @.^.$(TARGET): $(OBJECTS) o.linktab $(LINK) -o @.^.$(TARGET) $(OBJECTS) $(LOADLIBS) ######################################################################### # Support files @.^.!Boot: support.!Boot copy support.!Boot @.^.!Boot ~C~VF settype @.^.!Boot feb @.^.!Run: support.!Run copy support.!Run @.^.!Run ~C~VF settype @.^.!Run feb @.^.!Sprites: support.!Sprites copy support.!Sprites @.^.!Sprites ~C~VF settype @.^.!Sprites ff9 @.^.!Sprites22: support.!Sprites22 copy support.!Sprites22 @.^.!Sprites22 ~C~VF settype @.^.!Sprites22 ff9 @.^.AddToPath: support.AddToPath copy support.AddToPath @.^.AddToPath ~C~VF settype @.^.AddToPath ffc ######################################################################### # Dynamic Modules # @.^.Lib.array/pyd: @.^.Modules.o.arraymodule s.linktab $(MAKEDLK) -d @.^.Lib.array/pyd -s s.linktab -o @.^.Modules.o.arraymodule -e initarray @.^.Lib.audioop/pyd: @.^.Modules.o.audioop # s.linktab $(MAKEDLK) -d @.^.Lib.audioop/pyd -s s.linktab -o @.^.Modules.o.audioop -e initaudioop @.^.Lib.binascii/pyd: @.^.Modules.o.binascii s.linktab $(MAKEDLK) -d @.^.Lib.binascii/pyd -s s.linktab -o @.^.Modules.o.binascii -e initbinascii @.^.Lib.cmath/pyd: @.^.Modules.o.cmathmodule s.linktab $(MAKEDLK) -d @.^.Lib.cmath/pyd -s s.linktab -o @.^.Modules.o.cmathmodule -e initcmath @.^.Lib.cPickle/pyd: @.^.Modules.o.cPickle s.linktab $(MAKEDLK) -d @.^.Lib.cPickle/pyd -s s.linktab -o @.^.Modules.o.cPickle -e initcPickle @.^.Lib.cStringIO/pyd: @.^.Modules.o.cStringIO s.linktab $(MAKEDLK) -d @.^.Lib.cStringIO/pyd -s s.linktab -o @.^.Modules.o.cStringIO -e initcStringIO @.^.Lib.plat-riscos.drawf/pyd: Modules.o.drawfmodule #s.linktab $(LINK) -aof -o Modules.o.drawflink Modules.o.drawfmodule $(OSLIB).o.OSLIB $(MAKEDLK) -d @.^.Lib.plat-riscos.drawf/pyd -s s.linktab -o Modules.o.drawflink -e initdrawf @.^.Lib.errno/pyd: @.^.Modules.o.errnomodule #s.linktab $(MAKEDLK) -d @.^.Lib.errno/pyd -s s.linktab -o @.^.Modules.o.errnomodule -e initerrno @.^.Lib.imageop/pyd: @.^.Modules.o.imageop s.linktab $(MAKEDLK) -d @.^.Lib.imageop/pyd -s s.linktab -o @.^.Modules.o.imageop -e initimageop @.^.Lib.math/pyd: @.^.Modules.o.mathmodule s.linktab $(MAKEDLK) -d @.^.Lib.math/pyd -s s.linktab -o @.^.Modules.o.mathmodule -e initmath @.^.Lib.mmap/pyd: @.^.Modules.o.mmapmodule s.linktab $(MAKEDLK) -d @.^.Lib.mmap/pyd -s s.linktab -o @.^.Modules.o.mmapmodule -e initmmap @.^.Lib.md5/pyd: @.^.Modules.o.md5c @.^.Modules.o.md5module s.linktab $(LINK) -aof -o @.^.Modules.o.md5link @.^.Modules.o.md5c @.^.Modules.o.md5module $(MAKEDLK) -d @.^.Lib.md5/pyd -s s.linktab -o @.^.Modules.o.md5link -e initmd5 @.^.Lib.new/pyd: @.^.Modules.o.newmodule s.linktab $(MAKEDLK) -d @.^.Lib.new/pyd -s s.linktab -o @.^.Modules.o.newmodule -e initnew @.^.Lib.operator/pyd: @.^.Modules.o.operator s.linktab $(MAKEDLK) -d @.^.Lib.operator/pyd -s s.linktab -o @.^.Modules.o.operator -e initoperator @.^.Lib.parser/pyd: @.^.Modules.o.parsermodule s.linktab $(MAKEDLK) -d @.^.Lib.parser/pyd -s s.linktab -o @.^.Modules.o.parsermodule -e initparser @.^.Lib.pcre/pyd: @.^.Modules.o.pcremodule @.^.Modules.o.pypcre s.linktab $(LINK) -aof -o @.^.Modules.o.pcrelink @.^.Modules.o.pcremodule @.^.Modules.o.pypcre $(MAKEDLK) -d @.^.Lib.pcre/pyd -s s.linktab -o @.^.Modules.o.pcrelink -e initpcre @.^.Lib.regex/pyd: @.^.Modules.o.regexmodule @.^.Modules.o.regexpr s.linktab $(LINK) -aof -o @.^.Modules.o.regexlink @.^.Modules.o.regexmodule @.^.Modules.o.regexpr $(MAKEDLK) -d @.^.Lib.regex/pyd -s s.linktab -o @.^.Modules.o.regexlink -e initregex @.^.Lib.rgbimg/pyd: @.^.Modules.o.rgbimgmodule s.linktab $(MAKEDLK) -d @.^.Lib.rgbimg/pyd -s s.linktab -o @.^.Modules.o.rgbimgmodule -e initrgbimg @.^.Lib.rotor/pyd: @.^.Modules.o.rotormodule s.linktab $(MAKEDLK) -d @.^.Lib.rotor/pyd -s s.linktab -o @.^.Modules.o.rotormodule -e initrotor @.^.Lib.sha/pyd: @.^.Modules.o.shamodule s.linktab $(MAKEDLK) -d @.^.Lib.sha/pyd -s s.linktab -o @.^.Modules.o.shamodule -e initsha @.^.Lib.signal/pyd: @.^.Modules.o.signalmodule s.linktab $(MAKEDLK) -d @.^.Lib.signal/pyd -s s.linktab -o @.^.Modules.o.signalmodule -e initsignal #@.^.Lib.soundex/pyd: @.^.Modules.o.soundex s.linktab # $(MAKEDLK) -d @.^.Lib.soundex/pyd -s s.linktab -o @.^.Modules.o.soundex -e initsoundex @.^.Lib.strop/pyd: @.^.Modules.o.stropmodule s.linktab $(MAKEDLK) -d @.^.Lib.strop/pyd -s s.linktab -o @.^.Modules.o.stropmodule -e initstrop @.^.Lib.struct/pyd: @.^.Modules.o.structmodule s.linktab $(MAKEDLK) -d @.^.Lib.struct/pyd -s s.linktab -o @.^.Modules.o.structmodule -e initstruct @.^.Lib.plat-riscos.swi/pyd: Modules.o.swimodule s.linktab $(LINK) -aof -o Modules.o.swilink Modules.o.swimodule $(OSLIB).o.OSLIB $(MAKEDLK) -d @.^.Lib.plat-riscos.swi/pyd -s s.linktab -o Modules.o.swilink -e initswi @.^.Lib.time/pyd: @.^.Modules.o.timemodule s.linktab $(MAKEDLK) -d @.^.Lib.time/pyd -s s.linktab -o @.^.Modules.o.timemodule -e inittime @.^.Lib._locale/pyd: @.^.Modules.o._localemodule s.linktab $(MAKEDLK) -d @.^.Lib._locale/pyd -s s.linktab -o @.^.Modules.o._localemodule -e init_locale @.^.Lib._sre/pyd: @.^.Modules.o._sre s.linktab $(MAKEDLK) -d @.^.Lib._sre/pyd -s s.linktab -o @.^.Modules.o._sre -e init_sre @.^.Lib._codecs/pyd: @.^.Modules.o._codecsmodule s.linktab $(MAKEDLK) -d @.^.Lib._codecs/pyd -s s.linktab -o @.^.Modules.o._codecsmodule -e init_codecs @.^.Lib._weakref/pyd: @.^.Modules.o._weakref s.linktab $(MAKEDLK) -d @.^.Lib._weakref/pyd -s s.linktab -o @.^.Modules.o._weakref -e init_weakref @.^.Lib._testcapi/pyd: @.^.Modules.o._testcapimodule s.linktab $(MAKEDLK) -d @.^.Lib._testcapi/pyd -s s.linktab -o @.^.Modules.o._testcapimodule -e init_testcapi @.^.Lib.unicodedata/pyd: @.^.Modules.o.unicodedata s.linktab $(MAKEDLK) -d @.^.Lib.unicodedata/pyd -s s.linktab -o @.^.Modules.o.unicodedata -e initunicodedata @.^.Lib.xreadlines/pyd: @.^.Modules.o.xreadlinesmodule s.linktab $(MAKEDLK) -d @.^.Lib.xreadlines/pyd -s s.linktab -o @.^.Modules.o.xreadlinesmodule -e initxreadlines ##@.^.Lib.mmap/pyd: @.^.Modules.o.mmapmodule s.linktab ## $(MAKEDLK) -d @.^.Lib.mmap/pyd -s s.linktab -o @.^.Modules.o.mmapmodule -e initmmap ############################################################################ # Dynamic Modules with other dependencies # @.^.Lib.select/pyd: @.^.Modules.o.selectmodule s.linktab $(LINK) -aof -o @.^.Modules.o.selectlink @.^.Modules.o.selectmodule $(SOCKLIB).o.socklib $(MAKEDLK) -d @.^.Lib.select/pyd -s s.linktab -o @.^.Modules.o.selectlink -e initselect @.^.Modules.o.selectmodule: @.^.Modules.c.selectmodule $(CC) -I$(SOCKLIB).include -o $@ @.^.Modules.c.selectmodule @.^.Lib._socket/pyd: @.^.Modules.o.socketmodule s.linktab $(LINK) -aof -o @.^.Modules.o._socketlink @.^.Modules.o.socketmodule $(SOCKLIB).o.inetlib $(SOCKLIB).o.unixlib $(SOCKLIB).o.socklib $(MAKEDLK) -d @.^.Lib._socket/pyd -s s.linktab -o @.^.Modules.o._socketlink -e init_socket @.^.Modules.o.socketmodule: @.^.Modules.c.socketmodule $(CC) -I$(SOCKLIB).include -o $@ @.^.Modules.c.socketmodule @.^.Lib.zlib/pyd: @.^.Modules.o.zlibmodule s.linktab $(LINK) -aof -o @.^.Modules.o.zliblink @.^.Modules.o.zlibmodule $(ZLIB).zlib_lib $(MAKEDLK) -d @.^.Lib.zlib/pyd -s s.linktab -o @.^.Modules.o.zliblink -e initzlib @.^.Modules.o.zlibmodule: @.^.Modules.c.zlibmodule $(CC) -I$(ZLIB) -o $@ @.^.Modules.c.zlibmodule @.^.Lib.pyexpat/pyd: @.^.Modules.o.pyexpat s.linktab $(LINK) -aof -o @.^.Modules.o.pyexpatlink @.^.Modules.o.pyexpat $(EXPAT).expat_lib $(MAKEDLK) -d @.^.Lib.pyexpat/pyd -s s.linktab -o @.^.Modules.o.pyexpatlink -e initpyexpat @.^.Modules.o.pyexpat: @.^.Modules.c.pyexpat $(CCEXPAT) -o $@ @.^.Modules.c.pyexpat ########################################################################## o.linktab: s.linktab ObjAsm s.linktab o.linktab s.linktab: $(OBJECTS) $(OBJSCAN) -s s.linktab -o $(OBJECTS) $(clib).o.stubs clean: create @.^.Objects.o.dummy create @.^.Parser.o.dummy create @.^.Modules.o.dummy create o.dummy create @.^.Python.o.dummy create @.^.Lib.dummy/pyc create @.^.Lib.dummy/pyo create @.^.Lib.plat-riscos.dummy/pyc create @.^.Lib.plat-riscos.dummy/pyo create @.^.Lib.test.dummy/pyc wipe @.^.Modules.o.* ~C ~V wipe @.^.Objects.o.* ~C ~V wipe @.^.Parser.o.* ~C ~V wipe @.^.Python.o.* ~C ~V wipe o.* ~C ~V wipe @.^.Lib.*/pyc ~C~V wipe @.^.Lib.*/pyo ~C~V wipe @.^.Lib.plat-riscos.*/pyc ~C~V wipe @.^.Lib.plat-riscos.*/pyo ~C~V wipe @.^.Lib.test.*/pyc ~C~V rebuild: clean create @.^.Lib.dummy/pyd create @.^.$(TARGET) create @.^.Lib.plat-riscos.dummy/pyd create s.linktab create o.linktab wipe @.^.$(TARGET) ~C~V wipe @.^.Lib.*/pyd ~C ~V wipe @.^.Lib.plat-riscos.*/pyd ~C~V wipe s.linktab ~C~V wipe o.linktab ~C~V cdirs: cdir @.Modules.o cdir @.Python.o cdir @.s cdir @.o cdir @.^.Python.o cdir @.^.Parser.o cdir @.^.Objects.o cdir @.^.Modules.o # Dynamic dependencies: From ping@users.sourceforge.net Fri Mar 2 05:58:19 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Thu, 01 Mar 2001 21:58:19 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv8895 Modified Files: pydoc.py Log Message: Use '127.0.0.1' only on Mac; for other, sane platforms, use 'localhost'. Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** pydoc.py 2001/03/02 05:54:35 1.14 --- pydoc.py 2001/03/02 05:58:17 1.15 *************** *** 1143,1148 **** class DocServer(BaseHTTPServer.HTTPServer): def __init__(self, port, callback): ! self.address = ('127.0.0.1', port) ! self.url = 'http://127.0.0.1:%d/' % port self.callback = callback self.base.__init__(self, self.address, self.handler) --- 1143,1149 ---- class DocServer(BaseHTTPServer.HTTPServer): def __init__(self, port, callback): ! host = (sys.platform == 'mac') and '127.0.0.1' or 'localhost' ! self.address = (host, port) ! self.url = 'http://%s:%d/' % (host, port) self.callback = callback self.base.__init__(self, self.address, self.handler) From gvanrossum@users.sourceforge.net Fri Mar 2 06:10:19 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 01 Mar 2001 22:10:19 -0800 Subject: [Python-checkins] CVS: python/dist/src/Include osdefs.h,2.13,2.14 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv10385 Modified Files: osdefs.h Log Message: RISCOS patch by dschwertberger Index: osdefs.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/osdefs.h,v retrieving revision 2.13 retrieving revision 2.14 diff -C2 -r2.13 -r2.14 *** osdefs.h 2000/09/01 23:29:26 2.13 --- osdefs.h 2001/03/02 06:10:17 2.14 *************** *** 25,28 **** --- 25,35 ---- #endif + #ifdef RISCOS + #define SEP '.' + #define MAXPATHLEN 256 + #define DELIM ',' + #endif + + /* Filename separator */ #ifndef SEP From gvanrossum@users.sourceforge.net Fri Mar 2 06:18:05 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 01 Mar 2001 22:18:05 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules main.c,1.49,1.50 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv11045 Modified Files: main.c Log Message: RISCOS changes by dschwertberger. Index: main.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/main.c,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -r1.49 -r1.50 *** main.c 2001/02/23 16:46:39 1.49 --- main.c 2001/03/02 06:18:03 1.50 *************** *** 27,30 **** --- 27,35 ---- static int orig_argc; + /* For my_readline when running under RISCOS */ + #ifdef RISCOS + extern int Py_RISCOSWimpFlag; + #endif + /* Short usage message (with %s for argv0) */ static char *usage_line = *************** *** 99,102 **** --- 104,111 ---- orig_argv = argv; + #ifdef RISCOS + Py_RISCOSWimpFlag = 0; + #endif + if ((p = getenv("PYTHONINSPECT")) && *p != '\0') inspect = 1; *************** *** 106,110 **** --- 115,123 ---- PySys_ResetWarnOptions(); + #ifdef RISCOS + while ((c = getopt(argc, argv, "c:diOStuUvwxXhV")) != EOF) { + #else while ((c = _PyOS_GetOpt(argc, argv, "c:diOStuUvxXhVW:")) != EOF) { + #endif if (c == 'c') { /* -c is the last option; following arguments *************** *** 151,154 **** --- 164,173 ---- break; + #ifdef RISCOS + case 'w': + Py_RISCOSWimpFlag = 1; + break; + #endif + case 'x': skipfirstline = 1; *************** *** 302,305 **** --- 321,328 ---- Py_Finalize(); + #ifdef RISCOS + if(Py_RISCOSWimpFlag) + fprintf(stderr, "\x0cq\x0c"); /* make frontend quit */ + #endif #ifdef __INSURE__ From akuchling@users.sourceforge.net Fri Mar 2 06:24:16 2001 From: akuchling@users.sourceforge.net (A.M. Kuchling) Date: Thu, 01 Mar 2001 22:24:16 -0800 Subject: [Python-checkins] CVS: python/dist/src setup.py,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv11905 Modified Files: setup.py Log Message: Disable the dl module Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -r1.34 -r1.35 *** setup.py 2001/02/28 22:49:26 1.34 --- setup.py 2001/03/02 06:24:14 1.35 *************** *** 389,393 **** # Generic dynamic loading module ! exts.append( Extension('dl', ['dlmodule.c']) ) # Sun yellow pages. Some systems have the functions in libc. --- 389,393 ---- # Generic dynamic loading module ! #exts.append( Extension('dl', ['dlmodule.c']) ) # Sun yellow pages. Some systems have the functions in libc. From gvanrossum@users.sourceforge.net Fri Mar 2 06:26:43 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 01 Mar 2001 22:26:43 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules timemodule.c,2.105,2.106 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv12146 Modified Files: timemodule.c Log Message: RISCOS changes by dschwertberger. Index: timemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/timemodule.c,v retrieving revision 2.105 retrieving revision 2.106 diff -C2 -r2.105 -r2.106 *** timemodule.c 2001/01/19 23:16:56 2.105 --- timemodule.c 2001/03/02 06:26:41 2.106 *************** *** 17,21 **** --- 17,23 ---- #endif /* USE_GUSI2 */ #else + #ifndef RISCOS #include + #endif /* RISCOS */ #endif *************** *** 39,43 **** #else #ifdef MS_WINDOWS ! #include #ifdef MS_WIN16 /* These overrides not needed for Win32 */ --- 41,45 ---- #else #ifdef MS_WINDOWS ! include #ifdef MS_WIN16 /* These overrides not needed for Win32 */ *************** *** 748,752 **** --- 750,756 ---- /* XXX Can't interrupt this sleep */ Py_BEGIN_ALLOW_THREADS + #ifndef RISCOS delay((int)(secs * 1000 + 0.5)); /* delay() uses milliseconds */ + #endif Py_END_ALLOW_THREADS #else /* !__WATCOMC__ || __QNX__ */ From gvanrossum@users.sourceforge.net Fri Mar 2 06:27:14 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 01 Mar 2001 22:27:14 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules socketmodule.c,1.137,1.138 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv12191 Modified Files: socketmodule.c Log Message: RISCOS changes by dschwertberger. Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.137 retrieving revision 1.138 diff -C2 -r1.137 -r1.138 *** socketmodule.c 2001/02/07 20:41:17 1.137 --- socketmodule.c 2001/03/02 06:27:12 1.138 *************** *** 124,127 **** --- 124,142 ---- #endif + #ifdef RISCOS + #define NO_DUP + #undef off_t + #undef uid_t + #undef gid_t + #undef errno + #include + #include "socklib.h" + #include "inetlib.h" + #include "netdb.h" + #include "unixlib.h" + #include "netinet/in.h" + #include "sys/ioctl.h" + #else /*RISCOS*/ + #include *************** *** 149,152 **** --- 164,170 ---- #include #endif + + #endif /*RISCOS*/ + #ifdef HAVE_SYS_UN_H #include *************** *** 219,222 **** --- 237,246 ---- + #ifdef RISCOS + /* Global variable which is !=0 if Python is running in a RISC OS taskwindow */ + static int taskwindow; + #endif + + /* Convenience function to raise an error according to errno and return a NULL pointer from a function. */ *************** *** 235,239 **** { WSAEINVAL, "Invalid argument" }, { WSAEMFILE, "Too many open files" }, ! { WSAEWOULDBLOCK, "The socket operation could not complete " "without blocking" }, --- 259,263 ---- { WSAEINVAL, "Invalid argument" }, { WSAEMFILE, "Too many open files" }, ! { WSAEWOULDBLOCK, "The socket operation could not complete " "without blocking" }, *************** *** 255,261 **** { WSAENETDOWN, "Network is down" }, { WSAENETUNREACH, "Network is unreachable" }, ! { WSAENETRESET, "Network dropped connection on reset" }, ! { WSAECONNABORTED, "Software caused connection abort" }, { WSAECONNRESET, "Connection reset by peer" }, --- 279,285 ---- { WSAENETDOWN, "Network is down" }, { WSAENETUNREACH, "Network is unreachable" }, ! { WSAENETRESET, "Network dropped connection on reset" }, ! { WSAECONNABORTED, "Software caused connection abort" }, { WSAECONNRESET, "Connection reset by peer" }, *************** *** 282,286 **** { WSAVERNOTSUPPORTED, "WinSock version is not supported" }, ! { WSANOTINITIALISED, "Successful WSAStartup() not yet performed" }, { WSAEDISCON, "Graceful shutdown in progress" }, --- 306,310 ---- { WSAVERNOTSUPPORTED, "WinSock version is not supported" }, ! { WSANOTINITIALISED, "Successful WSAStartup() not yet performed" }, { WSAEDISCON, "Graceful shutdown in progress" }, *************** *** 296,300 **** PyObject *v; const char *msg = "winsock error"; ! for (msgp = msgs; msgp->msg; msgp++) { if (err_no == msgp->no) { --- 320,324 ---- PyObject *v; const char *msg = "winsock error"; ! for (msgp = msgs; msgp->msg; msgp++) { if (err_no == msgp->no) { *************** *** 364,368 **** #if defined(linux) && defined(AF_PACKET) struct sockaddr_ll ll; ! #endif } sock_addr; } PySocketSockObject; --- 388,392 ---- #if defined(linux) && defined(AF_PACKET) struct sockaddr_ll ll; ! #endif } sock_addr; } PySocketSockObject; *************** *** 390,394 **** #endif /* USE_SSL */ ! /* A forward reference to the Socktype type object. The Socktype variable contains pointers to various functions, --- 414,418 ---- #endif /* USE_SSL */ ! /* A forward reference to the Socktype type object. The Socktype variable contains pointers to various functions, *************** *** 407,410 **** --- 431,437 ---- PySocketSock_New(SOCKET_T fd, int family, int type, int proto) { + #ifdef RISCOS + int block = 1; + #endif PySocketSockObject *s; PySocketSock_Type.ob_type = &PyType_Type; *************** *** 415,418 **** --- 442,450 ---- s->sock_type = type; s->sock_proto = proto; + #ifdef RISCOS + if(taskwindow) { + socketioctl(s->sock_fd, 0x80046679, (u_long*)&block); + } + #endif } return s; *************** *** 420,424 **** ! /* Lock to allow python interpreter to continue, but only allow one thread to be in gethostbyname */ #ifdef USE_GETHOSTBYNAME_LOCK --- 452,456 ---- ! /* Lock to allow python interpreter to continue, but only allow one thread to be in gethostbyname */ #ifdef USE_GETHOSTBYNAME_LOCK *************** *** 492,497 **** if (hp == NULL) { #ifdef HAVE_HSTRERROR ! /* Let's get real error message to return */ ! extern int h_errno; PyErr_SetString(PySocket_Error, (char *)hstrerror(h_errno)); #else --- 524,529 ---- if (hp == NULL) { #ifdef HAVE_HSTRERROR ! /* Let's get real error message to return */ ! extern int h_errno; PyErr_SetString(PySocket_Error, (char *)hstrerror(h_errno)); #else *************** *** 583,591 **** } return Py_BuildValue("shbhs#", ifname, ntohs(a->sll_protocol), ! a->sll_pkttype, a->sll_hatype, ! a->sll_addr, a->sll_halen); } #endif ! /* More cases here... */ --- 615,623 ---- } return Py_BuildValue("shbhs#", ifname, ntohs(a->sll_protocol), ! a->sll_pkttype, a->sll_hatype, ! a->sll_addr, a->sll_halen); } #endif ! /* More cases here... */ *************** *** 608,612 **** static int ! getsockaddrarg(PySocketSockObject *s, PyObject *args, struct sockaddr **addr_ret, int *len_ret) { --- 640,644 ---- static int ! getsockaddrarg(PySocketSockObject *s, PyObject *args, struct sockaddr **addr_ret, int *len_ret) { *************** *** 669,673 **** int pkttype = 0; char *haddr; ! if (!PyArg_ParseTuple(args, "si|iis", &interfaceName, &protoNumber, &pkttype, &hatype, &haddr)) --- 701,705 ---- int pkttype = 0; char *haddr; ! if (!PyArg_ParseTuple(args, "si|iis", &interfaceName, &protoNumber, &pkttype, &hatype, &haddr)) *************** *** 689,695 **** return 1; } ! #endif ! ! /* More cases here... */ --- 721,727 ---- return 1; } ! #endif ! ! /* More cases here... */ *************** *** 702,706 **** ! /* Get the address length according to the socket object's address family. Return 1 if the family is known, 0 otherwise. The length is returned through len_ret. */ --- 734,738 ---- ! /* Get the address length according to the socket object's address family. Return 1 if the family is known, 0 otherwise. The length is returned through len_ret. */ *************** *** 732,736 **** } #endif ! /* More cases here... */ --- 764,768 ---- } #endif ! /* More cases here... */ *************** *** 779,783 **** goto finally; } ! addr = makesockaddr(s->sock_fd, (struct sockaddr *)addrbuf, addrlen); if (addr == NULL) --- 811,815 ---- goto finally; } ! addr = makesockaddr(s->sock_fd, (struct sockaddr *)addrbuf, addrlen); if (addr == NULL) *************** *** 806,812 **** --- 838,846 ---- { int block; + #ifndef RISCOS #ifndef MS_WINDOWS int delay_flag; #endif + #endif if (!PyArg_ParseTuple(args, "i:setblocking", &block)) return NULL; *************** *** 817,820 **** --- 851,855 ---- (void *)(&block), sizeof( int ) ); #else + #ifndef RISCOS #ifndef MS_WINDOWS #ifdef PYOS_OS2 *************** *** 834,837 **** --- 869,873 ---- #endif /* MS_WINDOWS */ #endif /* __BEOS__ */ + #endif /* RISCOS */ Py_END_ALLOW_THREADS *************** *** 847,850 **** --- 883,910 ---- + #ifdef RISCOS + /* s.sleeptaskw(1 | 0) method */ + + static PyObject * + PySocketSock_sleeptaskw(PySocketSockObject *s,PyObject *args) + { + int block; + int delay_flag; + if (!PyArg_GetInt(args, &block)) + return NULL; + Py_BEGIN_ALLOW_THREADS + socketioctl(s->sock_fd, 0x80046679, (u_long*)&block); + Py_END_ALLOW_THREADS + + Py_INCREF(Py_None); + return Py_None; + } + static char sleeptaskw_doc[] = + "sleeptaskw(flag)\n\ + \n\ + Allow sleeps in taskwindows."; + #endif + + /* s.setsockopt() method. With an integer third argument, sets an integer option. *************** *** 910,914 **** &level, &optname, &buflen)) return NULL; ! if (buflen == 0) { int flag = 0; --- 970,974 ---- &level, &optname, &buflen)) return NULL; ! if (buflen == 0) { int flag = 0; *************** *** 1216,1220 **** #else int fd; ! #endif FILE *fp; PyObject *f; --- 1276,1280 ---- #else int fd; ! #endif FILE *fp; PyObject *f; *************** *** 1246,1251 **** #endif /* NO_DUP */ - /* s.recv(nbytes [,flags]) method */ --- 1306,1311 ---- #endif /* NO_DUP */ + /* s.recv(nbytes [,flags]) method */ *************** *** 1319,1323 **** if (n != len && _PyString_Resize(&buf, n) < 0) return NULL; ! if (!(addr = makesockaddr(s->sock_fd, (struct sockaddr *)addrbuf, addrlen))) goto finally; --- 1379,1383 ---- if (n != len && _PyString_Resize(&buf, n) < 0) return NULL; ! if (!(addr = makesockaddr(s->sock_fd, (struct sockaddr *)addrbuf, addrlen))) goto finally; *************** *** 1421,1468 **** static PyMethodDef PySocketSock_methods[] = { ! {"accept", (PyCFunction)PySocketSock_accept, METH_VARARGS, ! accept_doc}, ! {"bind", (PyCFunction)PySocketSock_bind, METH_VARARGS, ! bind_doc}, ! {"close", (PyCFunction)PySocketSock_close, METH_VARARGS, ! close_doc}, ! {"connect", (PyCFunction)PySocketSock_connect, METH_VARARGS, ! connect_doc}, ! {"connect_ex", (PyCFunction)PySocketSock_connect_ex, METH_VARARGS, ! connect_ex_doc}, #ifndef NO_DUP ! {"dup", (PyCFunction)PySocketSock_dup, METH_VARARGS, ! dup_doc}, #endif ! {"fileno", (PyCFunction)PySocketSock_fileno, METH_VARARGS, ! fileno_doc}, #ifdef HAVE_GETPEERNAME ! {"getpeername", (PyCFunction)PySocketSock_getpeername, METH_VARARGS, ! getpeername_doc}, #endif ! {"getsockname", (PyCFunction)PySocketSock_getsockname, METH_VARARGS, ! getsockname_doc}, ! {"getsockopt", (PyCFunction)PySocketSock_getsockopt, METH_VARARGS, ! getsockopt_doc}, ! {"listen", (PyCFunction)PySocketSock_listen, METH_VARARGS, ! listen_doc}, #ifndef NO_DUP ! {"makefile", (PyCFunction)PySocketSock_makefile, METH_VARARGS, ! makefile_doc}, #endif ! {"recv", (PyCFunction)PySocketSock_recv, METH_VARARGS, ! recv_doc}, ! {"recvfrom", (PyCFunction)PySocketSock_recvfrom, METH_VARARGS, ! recvfrom_doc}, ! {"send", (PyCFunction)PySocketSock_send, METH_VARARGS, ! send_doc}, ! {"sendto", (PyCFunction)PySocketSock_sendto, METH_VARARGS, ! sendto_doc}, ! {"setblocking", (PyCFunction)PySocketSock_setblocking, METH_VARARGS, ! setblocking_doc}, ! {"setsockopt", (PyCFunction)PySocketSock_setsockopt, METH_VARARGS, ! setsockopt_doc}, ! {"shutdown", (PyCFunction)PySocketSock_shutdown, METH_VARARGS, ! shutdown_doc}, {NULL, NULL} /* sentinel */ }; --- 1481,1532 ---- static PyMethodDef PySocketSock_methods[] = { ! {"accept", (PyCFunction)PySocketSock_accept, METH_VARARGS, ! accept_doc}, ! {"bind", (PyCFunction)PySocketSock_bind, METH_VARARGS, ! bind_doc}, ! {"close", (PyCFunction)PySocketSock_close, METH_VARARGS, ! close_doc}, ! {"connect", (PyCFunction)PySocketSock_connect, METH_VARARGS, ! connect_doc}, ! {"connect_ex", (PyCFunction)PySocketSock_connect_ex, METH_VARARGS, ! connect_ex_doc}, #ifndef NO_DUP ! {"dup", (PyCFunction)PySocketSock_dup, METH_VARARGS, ! dup_doc}, #endif ! {"fileno", (PyCFunction)PySocketSock_fileno, METH_VARARGS, ! fileno_doc}, #ifdef HAVE_GETPEERNAME ! {"getpeername", (PyCFunction)PySocketSock_getpeername, METH_VARARGS, ! getpeername_doc}, #endif ! {"getsockname", (PyCFunction)PySocketSock_getsockname, METH_VARARGS, ! getsockname_doc}, ! {"getsockopt", (PyCFunction)PySocketSock_getsockopt, METH_VARARGS, ! getsockopt_doc}, ! {"listen", (PyCFunction)PySocketSock_listen, METH_VARARGS, ! listen_doc}, #ifndef NO_DUP ! {"makefile", (PyCFunction)PySocketSock_makefile, METH_VARARGS, ! makefile_doc}, #endif ! {"recv", (PyCFunction)PySocketSock_recv, METH_VARARGS, ! recv_doc}, ! {"recvfrom", (PyCFunction)PySocketSock_recvfrom, METH_VARARGS, ! recvfrom_doc}, ! {"send", (PyCFunction)PySocketSock_send, METH_VARARGS, ! send_doc}, ! {"sendto", (PyCFunction)PySocketSock_sendto, METH_VARARGS, ! sendto_doc}, ! {"setblocking", (PyCFunction)PySocketSock_setblocking, METH_VARARGS, ! setblocking_doc}, ! {"setsockopt", (PyCFunction)PySocketSock_setsockopt, METH_VARARGS, ! setsockopt_doc}, ! {"shutdown", (PyCFunction)PySocketSock_shutdown, METH_VARARGS, ! shutdown_doc}, ! #ifdef RISCOS ! {"sleeptaskw", (PyCFunction)PySocketSock_sleeptaskw, METH_VARARGS, ! sleeptaskw_doc}, ! #endif {NULL, NULL} /* sentinel */ }; *************** *** 1504,1509 **** } #endif ! sprintf(buf, ! "", (long)s->sock_fd, s->sock_family, s->sock_type, s->sock_proto); return PyString_FromString(buf); --- 1568,1573 ---- } #endif ! sprintf(buf, ! "", (long)s->sock_fd, s->sock_family, s->sock_type, s->sock_proto); return PyString_FromString(buf); *************** *** 1589,1594 **** if (h == NULL) { #ifdef HAVE_HSTRERROR ! /* Let's get real error message to return */ ! extern int h_errno; PyErr_SetString(PySocket_Error, (char *)hstrerror(h_errno)); #else --- 1653,1658 ---- if (h == NULL) { #ifdef HAVE_HSTRERROR ! /* Let's get real error message to return */ ! extern int h_errno; PyErr_SetString(PySocket_Error, (char *)hstrerror(h_errno)); #else *************** *** 1695,1699 **** PySocket_gethostbyaddr(PyObject *self, PyObject *args) { ! struct sockaddr_in addr; char *ip_num; struct hostent *h; --- 1759,1763 ---- PySocket_gethostbyaddr(PyObject *self, PyObject *args) { ! struct sockaddr_in addr; char *ip_num; struct hostent *h; *************** *** 1727,1731 **** h = gethostbyaddr_r((char *)&addr.sin_addr, sizeof(addr.sin_addr), ! AF_INET, &hp_allocated, buf, buf_len, &errnop); #else /* HAVE_GETHOSTBYNAME_R_3_ARG */ --- 1791,1795 ---- h = gethostbyaddr_r((char *)&addr.sin_addr, sizeof(addr.sin_addr), ! AF_INET, &hp_allocated, buf, buf_len, &errnop); #else /* HAVE_GETHOSTBYNAME_R_3_ARG */ *************** *** 1851,1857 **** /* From now on, ignore SIGPIPE and let the error checking do the work. */ ! #ifdef SIGPIPE (void) signal(SIGPIPE, SIG_IGN); ! #endif return (PyObject *) s; } --- 1915,1921 ---- /* From now on, ignore SIGPIPE and let the error checking do the work. */ ! #ifdef SIGPIPE (void) signal(SIGPIPE, SIG_IGN); ! #endif return (PyObject *) s; } *************** *** 1889,1895 **** /* From now on, ignore SIGPIPE and let the error checking do the work. */ ! #ifdef SIGPIPE (void) signal(SIGPIPE, SIG_IGN); ! #endif return (PyObject *) s; } --- 1953,1959 ---- /* From now on, ignore SIGPIPE and let the error checking do the work. */ ! #ifdef SIGPIPE (void) signal(SIGPIPE, SIG_IGN); ! #endif return (PyObject *) s; } *************** *** 1982,1986 **** */ ! static char inet_aton_doc[] = "inet_aton(string) -> packed 32-bit IP representation\n\ \n\ --- 2046,2050 ---- */ ! static char inet_aton_doc[] = "inet_aton(string) -> packed 32-bit IP representation\n\ \n\ *************** *** 2018,2022 **** } ! static char inet_ntoa_doc[] = "inet_ntoa(packed_ip) -> ip_address_string\n\ \n\ --- 2082,2086 ---- } ! static char inet_ntoa_doc[] = "inet_ntoa(packed_ip) -> ip_address_string\n\ \n\ *************** *** 2033,2037 **** return NULL; } ! if (addr_len != sizeof(packed_addr)) { PyErr_SetString(PySocket_Error, --- 2097,2101 ---- return NULL; } ! if (addr_len != sizeof(packed_addr)) { PyErr_SetString(PySocket_Error, *************** *** 2061,2066 **** } memset(self->server, '\0', sizeof(char) * 256); ! memset(self->issuer, '\0', sizeof(char) * 256); ! self->x_attr = PyDict_New(); self->ctx = SSL_CTX_new(SSLv23_method()); /* Set up context */ --- 2125,2130 ---- } memset(self->server, '\0', sizeof(char) * 256); ! memset(self->issuer, '\0', sizeof(char) * 256); ! self->x_attr = PyDict_New(); self->ctx = SSL_CTX_new(SSLv23_method()); /* Set up context */ *************** *** 2139,2148 **** char *key_file; char *cert_file; ! if (!PyArg_ParseTuple(args, "O!zz:ssl", &PySocketSock_Type, (PyObject*)&Sock, &key_file, &cert_file) ) return NULL; ! rv = newSSLObject(Sock, key_file, cert_file); if ( rv == NULL ) --- 2203,2212 ---- char *key_file; char *cert_file; ! if (!PyArg_ParseTuple(args, "O!zz:ssl", &PySocketSock_Type, (PyObject*)&Sock, &key_file, &cert_file) ) return NULL; ! rv = newSSLObject(Sock, key_file, cert_file); if ( rv == NULL ) *************** *** 2218,2225 **** char *data; size_t len; ! if (!PyArg_ParseTuple(args, "s#:write", &data, &len)) return NULL; ! len = SSL_write(self->ssl, data, len); return PyInt_FromLong((long)len); --- 2282,2289 ---- char *data; size_t len; ! if (!PyArg_ParseTuple(args, "s#:write", &data, &len)) return NULL; ! len = SSL_write(self->ssl, data, len); return PyInt_FromLong((long)len); *************** *** 2232,2241 **** int len = 1024; int res; ! PyArg_ParseTuple(args, "|i:read", &len); ! if (!(buf = PyString_FromStringAndSize((char *) 0, len))) return NULL; /* Error object should already be set */ ! count = SSL_read(self->ssl, PyString_AsString(buf), len); res = SSL_get_error(self->ssl, count); --- 2296,2305 ---- int len = 1024; int res; ! PyArg_ParseTuple(args, "|i:read", &len); ! if (!(buf = PyString_FromStringAndSize((char *) 0, len))) return NULL; /* Error object should already be set */ ! count = SSL_read(self->ssl, PyString_AsString(buf), len); res = SSL_get_error(self->ssl, count); *************** *** 2251,2262 **** return PyErr_SetFromErrno(SSLErrorObject); } ! fflush(stderr); ! if (count < 0) { Py_DECREF(buf); return PyErr_SetFromErrno(SSLErrorObject); } ! if (count != len && _PyString_Resize(&buf, count) < 0) return NULL; --- 2315,2326 ---- return PyErr_SetFromErrno(SSLErrorObject); } ! fflush(stderr); ! if (count < 0) { Py_DECREF(buf); return PyErr_SetFromErrno(SSLErrorObject); } ! if (count != len && _PyString_Resize(&buf, count) < 0) return NULL; *************** *** 2270,2305 **** static PyMethodDef PySocket_methods[] = { ! {"gethostbyname", PySocket_gethostbyname, METH_VARARGS, gethostbyname_doc}, ! {"gethostbyname_ex", PySocket_gethostbyname_ex, METH_VARARGS, ghbn_ex_doc}, ! {"gethostbyaddr", PySocket_gethostbyaddr, METH_VARARGS, gethostbyaddr_doc}, ! {"gethostname", PySocket_gethostname, METH_VARARGS, gethostname_doc}, ! {"getservbyname", PySocket_getservbyname, METH_VARARGS, getservbyname_doc}, ! {"getprotobyname", PySocket_getprotobyname, METH_VARARGS,getprotobyname_doc}, ! {"socket", PySocket_socket, METH_VARARGS, socket_doc}, #ifndef NO_DUP ! {"fromfd", PySocket_fromfd, METH_VARARGS, fromfd_doc}, #endif ! {"ntohs", PySocket_ntohs, METH_VARARGS, ntohs_doc}, ! {"ntohl", PySocket_ntohl, METH_VARARGS, ntohl_doc}, ! {"htons", PySocket_htons, METH_VARARGS, htons_doc}, ! {"htonl", PySocket_htonl, METH_VARARGS, htonl_doc}, ! {"inet_aton", PySocket_inet_aton, METH_VARARGS, inet_aton_doc}, ! {"inet_ntoa", PySocket_inet_ntoa, METH_VARARGS, inet_ntoa_doc}, #ifdef USE_SSL ! {"ssl", PySocket_ssl, METH_VARARGS, ssl_doc}, #endif /* USE_SSL */ --- 2334,2369 ---- static PyMethodDef PySocket_methods[] = { ! {"gethostbyname", PySocket_gethostbyname, METH_VARARGS, gethostbyname_doc}, ! {"gethostbyname_ex", PySocket_gethostbyname_ex, METH_VARARGS, ghbn_ex_doc}, ! {"gethostbyaddr", PySocket_gethostbyaddr, METH_VARARGS, gethostbyaddr_doc}, ! {"gethostname", PySocket_gethostname, METH_VARARGS, gethostname_doc}, ! {"getservbyname", PySocket_getservbyname, METH_VARARGS, getservbyname_doc}, ! {"getprotobyname", PySocket_getprotobyname, METH_VARARGS,getprotobyname_doc}, ! {"socket", PySocket_socket, METH_VARARGS, socket_doc}, #ifndef NO_DUP ! {"fromfd", PySocket_fromfd, METH_VARARGS, fromfd_doc}, #endif ! {"ntohs", PySocket_ntohs, METH_VARARGS, ntohs_doc}, ! {"ntohl", PySocket_ntohl, METH_VARARGS, ntohl_doc}, ! {"htons", PySocket_htons, METH_VARARGS, htons_doc}, ! {"htonl", PySocket_htonl, METH_VARARGS, htonl_doc}, ! {"inet_aton", PySocket_inet_aton, METH_VARARGS, inet_aton_doc}, ! {"inet_ntoa", PySocket_inet_ntoa, METH_VARARGS, inet_ntoa_doc}, #ifdef USE_SSL ! {"ssl", PySocket_ssl, METH_VARARGS, ssl_doc}, #endif /* USE_SSL */ *************** *** 2446,2449 **** --- 2510,2519 ---- { PyObject *m, *d; + #ifdef RISCOS + _kernel_swi_regs r; + r.r[0]=0; + _kernel_swi(0x43380, &r, &r); + taskwindow = r.r[0]; + #else #ifdef MS_WINDOWS if (!NTinit()) *************** *** 2455,2458 **** --- 2525,2529 ---- #endif /* __TOS_OS2__ */ #endif /* MS_WINDOWS */ + #endif /* RISCOS */ #ifdef USE_SSL SSL_Type.ob_type = &PyType_Type; *************** *** 2528,2532 **** insint(d, "PACKET_LOOPBACK", PACKET_LOOPBACK); insint(d, "PACKET_FASTROUTE", PACKET_FASTROUTE); ! #endif /* Socket types */ --- 2599,2603 ---- insint(d, "PACKET_LOOPBACK", PACKET_LOOPBACK); insint(d, "PACKET_FASTROUTE", PACKET_FASTROUTE); ! #endif /* Socket types */ From gvanrossum@users.sourceforge.net Fri Mar 2 06:28:19 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 01 Mar 2001 22:28:19 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules selectmodule.c,2.49,2.50 _localemodule.c,2.18,2.19 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv12306 Modified Files: selectmodule.c _localemodule.c Log Message: RISCOS changes by dschwertberger Index: selectmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/selectmodule.c,v retrieving revision 2.49 retrieving revision 2.50 diff -C2 -r2.49 -r2.50 *** selectmodule.c 2000/12/12 01:18:41 2.49 --- selectmodule.c 2001/03/02 06:28:17 2.50 *************** *** 51,54 **** --- 51,63 ---- #endif + #ifdef RISCOS + #define NO_DUP + #undef off_t + #undef uid_t + #undef gid_t + #undef errno + #include "socklib.h" + #endif /* RISCOS */ + static PyObject *SelectError; Index: _localemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_localemodule.c,v retrieving revision 2.18 retrieving revision 2.19 diff -C2 -r2.18 -r2.19 *** _localemodule.c 2000/09/26 05:46:01 2.18 --- _localemodule.c 2001/03/02 06:28:17 2.19 *************** *** 27,30 **** --- 27,34 ---- #endif + #ifdef RISCOS + char *strdup(const char *); + #endif + static char locale__doc__[] = "Support for POSIX locales."; From gvanrossum@users.sourceforge.net Fri Mar 2 06:29:53 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 01 Mar 2001 22:29:53 -0800 Subject: [Python-checkins] CVS: python/dist/src/Parser myreadline.c,2.25,2.26 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory usw-pr-cvs1:/tmp/cvs-serv12432 Modified Files: myreadline.c Log Message: RISCOS changes by dschwertberger. Index: myreadline.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/myreadline.c,v retrieving revision 2.25 retrieving revision 2.26 diff -C2 -r2.25 -r2.26 *** myreadline.c 2000/09/26 05:46:01 2.25 --- myreadline.c 2001/03/02 06:29:51 2.26 *************** *** 14,17 **** --- 14,21 ---- int (*PyOS_InputHook)(void) = NULL; + #ifdef RISCOS + int Py_RISCOSWimpFlag; + #endif + /* This function restarts a fgets() after an EINTR error occurred except if PyOS_InterruptOccurred() returns true. */ *************** *** 59,64 **** --- 63,77 ---- return NULL; fflush(stdout); + #ifndef RISCOS if (prompt) fprintf(stderr, "%s", prompt); + #else + if (prompt) { + if(Py_RISCOSWimpFlag) + fprintf(stderr, "\x0cr%s\x0c", prompt); + else + fprintf(stderr, "%s", prompt); + } + #endif fflush(stderr); switch (my_fgets(p, (int)n, stdin)) { From gvanrossum@users.sourceforge.net Fri Mar 2 06:31:19 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 01 Mar 2001 22:31:19 -0800 Subject: [Python-checkins] CVS: python/dist/src/Parser intrcheck.c,2.42,2.43 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory usw-pr-cvs1:/tmp/cvs-serv12632 Modified Files: intrcheck.c Log Message: RISCOS changes by dschwertberger. Index: intrcheck.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/intrcheck.c,v retrieving revision 2.42 retrieving revision 2.43 diff -C2 -r2.42 -r2.43 *** intrcheck.c 2000/09/01 23:29:28 2.42 --- intrcheck.c 2001/03/02 06:31:17 2.43 *************** *** 138,142 **** --- 138,146 ---- break; case 1: + #ifdef RISCOS + fprintf(stderr, message); + #else write(2, message, strlen(message)); + #endif break; case 2: From gvanrossum@users.sourceforge.net Fri Mar 2 06:34:16 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 01 Mar 2001 22:34:16 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python import.c,2.171,2.172 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv13155 Modified Files: import.c Log Message: RISCOS changes by dschwertberger. Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.171 retrieving revision 2.172 diff -C2 -r2.171 -r2.172 *** import.c 2001/03/02 03:28:03 2.171 --- import.c 2001/03/02 06:34:14 2.172 *************** *** 61,64 **** --- 61,72 ---- /* these tables define the module suffixes that Python recognizes */ struct filedescr * _PyImport_Filetab = NULL; + + #ifdef RISCOS + static const struct filedescr _PyImport_StandardFiletab[] = { + {"/py", "r", PY_SOURCE}, + {"/pyc", "rb", PY_COMPILED}, + {0, 0} + }; + #else static const struct filedescr _PyImport_StandardFiletab[] = { {".py", "r", PY_SOURCE}, *************** *** 66,69 **** --- 74,78 ---- {0, 0} }; + #endif /* Initialize things */ *************** *** 96,101 **** --- 105,115 ---- /* Replace ".pyc" with ".pyo" in _PyImport_Filetab */ for (; filetab->suffix != NULL; filetab++) { + #ifndef RISCOS if (strcmp(filetab->suffix, ".pyc") == 0) filetab->suffix = ".pyo"; + #else + if (strcmp(filetab->suffix, "/pyc") == 0) + filetab->suffix = "/pyo"; + #endif } } *************** *** 843,847 **** --- 857,863 ---- struct filedescr *fdp = NULL; FILE *fp = NULL; + #ifndef RISCOS struct stat statbuf; + #endif static struct filedescr fd_frozen = {"", "", PY_FROZEN}; static struct filedescr fd_builtin = {"", "", C_BUILTIN}; *************** *** 952,955 **** --- 968,980 ---- #else /* XXX How are you going to test for directories? */ + #ifdef RISCOS + { + static struct filedescr fd = {"", "", PKG_DIRECTORY}; + if (isdir(buf)) { + if (find_init_module(buf)) + return &fd; + } + } + #endif #endif #ifdef macintosh *************** *** 1197,1200 **** --- 1222,1258 ---- return 0; } + + #else + + #ifdef RISCOS + static int + find_init_module(buf) + char *buf; + { + int save_len = strlen(buf); + int i = save_len; + + if (save_len + 13 >= MAXPATHLEN) + return 0; + buf[i++] = SEP; + strcpy(buf+i, "__init__/py"); + if (isfile(buf)) { + buf[save_len] = '\0'; + return 1; + } + + if (Py_OptimizeFlag) + strcpy(buf+i, "o"); + else + strcpy(buf+i, "c"); + if (isfile(buf)) { + buf[save_len] = '\0'; + return 1; + } + buf[save_len] = '\0'; + return 0; + } + #endif /*RISCOS*/ + #endif /* HAVE_STAT */ From gvanrossum@users.sourceforge.net Fri Mar 2 06:42:36 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 01 Mar 2001 22:42:36 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib smtpd.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv14466 Modified Files: smtpd.py Log Message: Use != instead of <>. Sorry, Barry. Index: smtpd.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/smtpd.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** smtpd.py 2001/02/15 22:15:13 1.3 --- smtpd.py 2001/03/02 06:42:34 1.4 *************** *** 154,158 **** return else: ! if self.__state <> self.DATA: self.push('451 Internal confusion') return --- 154,158 ---- return else: ! if self.__state != self.DATA: self.push('451 Internal confusion') return *************** *** 207,211 **** if arg[:keylen].upper() == keyword: address = arg[keylen:].strip() ! if address[0] == '<' and address[-1] == '>' and address <> '<>': # Addresses can be in the form but watch out # for null address, e.g. <> --- 207,211 ---- if arg[:keylen].upper() == keyword: address = arg[keylen:].strip() ! if address[0] == '<' and address[-1] == '>' and address != '<>': # Addresses can be in the form but watch out # for null address, e.g. <> *************** *** 519,523 **** os.setuid(nobody) except OSError, e: ! if e.errno <> errno.EPERM: raise print >> sys.stderr, \ 'Cannot setuid "nobody"; try running with -n option.' --- 519,523 ---- os.setuid(nobody) except OSError, e: ! if e.errno != errno.EPERM: raise print >> sys.stderr, \ 'Cannot setuid "nobody"; try running with -n option.' From gvanrossum@users.sourceforge.net Fri Mar 2 06:43:51 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 01 Mar 2001 22:43:51 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib site.py,1.24,1.25 socket.py,1.7,1.8 urllib.py,1.120,1.121 dumbdbm.py,1.9,1.10 os.py,1.42,1.43 whichdb.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv14767 Modified Files: site.py socket.py urllib.py dumbdbm.py os.py whichdb.py Log Message: RISCOS changes by dschwertberger. Index: site.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/site.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -r1.24 -r1.25 *** site.py 2001/01/19 21:54:59 1.24 --- site.py 2001/03/02 06:43:49 1.25 *************** *** 60,63 **** --- 60,69 ---- import sys, os + if os.sep==".": + endsep = "/" + else: + endsep = "." + + def makepath(*paths): dir = os.path.join(*paths) *************** *** 100,104 **** names.sort() for name in names: ! if name[-4:] == ".pth": addpackage(sitedir, name) --- 106,110 ---- names.sort() for name in names: ! if name[-4:] == endsep + "pth": addpackage(sitedir, name) Index: socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/socket.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** socket.py 2001/02/15 22:15:13 1.7 --- socket.py 2001/03/02 06:43:49 1.8 *************** *** 49,53 **** if (sys.platform.lower().startswith("win") ! or (hasattr(os, 'uname') and os.uname()[0] == "BeOS")): # be sure this happens only once, even in the face of reload(): --- 49,54 ---- if (sys.platform.lower().startswith("win") ! or (hasattr(os, 'uname') and os.uname()[0] == "BeOS") ! or (sys.platform=="RISCOS")): # be sure this happens only once, even in the face of reload(): Index: urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib.py,v retrieving revision 1.120 retrieving revision 1.121 diff -C2 -r1.120 -r1.121 *** urllib.py 2001/03/01 04:27:19 1.120 --- urllib.py 2001/03/02 06:43:49 1.121 *************** *** 42,45 **** --- 42,47 ---- elif os.name == 'nt': from nturl2path import url2pathname, pathname2url + elif os.name == 'riscos': + from rourl2path import url2pathname, pathname2url else: def url2pathname(pathname): Index: dumbdbm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/dumbdbm.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** dumbdbm.py 2001/02/18 03:30:53 1.9 --- dumbdbm.py 2001/03/02 06:43:49 1.10 *************** *** 34,40 **** def __init__(self, file): ! self._dirfile = file + '.dir' ! self._datfile = file + '.dat' ! self._bakfile = file + '.bak' # Mod by Jack: create data file if needed try: --- 34,44 ---- def __init__(self, file): ! if _os.sep == '.': ! endsep = '/' ! else: ! endsep = '.' ! self._dirfile = file + endsep + 'dir' ! self._datfile = file + endsep + 'dat' ! self._bakfile = file + endsep + 'bak' # Mod by Jack: create data file if needed try: Index: os.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/os.py,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -r1.42 -r1.43 *** os.py 2001/02/28 01:00:58 1.42 --- os.py 2001/03/02 06:43:49 1.43 *************** *** 4,8 **** - all functions from posix, nt, dos, os2, mac, or ce, e.g. unlink, stat, etc. - os.path is one of the modules posixpath, ntpath, macpath, or dospath ! - os.name is 'posix', 'nt', 'dos', 'os2', 'mac', or 'ce' - os.curdir is a string representing the current directory ('.' or ':') - os.pardir is a string representing the parent directory ('..' or '::') --- 4,8 ---- - all functions from posix, nt, dos, os2, mac, or ce, e.g. unlink, stat, etc. - os.path is one of the modules posixpath, ntpath, macpath, or dospath ! - os.name is 'posix', 'nt', 'dos', 'os2', 'mac', 'ce' or 'riscos' - os.curdir is a string representing the current directory ('.' or ':') - os.pardir is a string representing the parent directory ('..' or '::') *************** *** 148,151 **** --- 148,170 ---- del ce + elif 'riscos' in _names: + name = 'riscos' + linesep = '\n' + curdir = '@'; pardir = '^'; sep = '.'; pathsep = ',' + defpath = '' + from riscos import * + try: + from riscos import _exit + except ImportError: + pass + import riscospath + path = riscospath + del riscospath + from riscosenviron import environ + + import riscos + __all__.extend(_get_exports_list(riscos)) + del ce + else: raise ImportError, 'no os specific module found' *************** *** 318,330 **** raise exc, arg - # Change environ to automatically call putenv() if it exists - try: - # This will fail if there's no putenv - putenv - except NameError: - pass - else: - import UserDict if name in ('os2', 'nt', 'dos'): # Where Env Var Names Must Be UPPERCASE # But we store them as upper case --- 337,351 ---- raise exc, arg + if name != "riscos": + # Change environ to automatically call putenv() if it exists + try: + # This will fail if there's no putenv + putenv + except NameError: + pass + else: + import UserDict + if name in ('os2', 'nt', 'dos'): # Where Env Var Names Must Be UPPERCASE # But we store them as upper case *************** *** 363,373 **** environ = _Environ(environ) - - def getenv(key, default=None): - """Get an environment variable, return None if it doesn't exist. ! The optional second argument can specify an alternate default.""" ! return environ.get(key, default) ! __all__.append("getenv") def _exists(name): --- 384,393 ---- environ = _Environ(environ) ! def getenv(key, default=None): ! """Get an environment variable, return None if it doesn't exist. ! The optional second argument can specify an alternate default.""" ! return environ.get(key, default) ! __all__.append("getenv") def _exists(name): Index: whichdb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/whichdb.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** whichdb.py 2001/03/01 04:13:51 1.9 --- whichdb.py 2001/03/02 06:43:49 1.10 *************** *** 1,4 **** --- 1,11 ---- """Guess which db package to use to open a db file.""" + import os + + if os.sep==".": + endsep = "/" + else: + endsep = "." + def whichdb(filename): """Guess which db package to use to open a db file. *************** *** 18,24 **** # Check for dbm first -- this has a .pag and a .dir file try: ! f = open(filename + ".pag", "rb") f.close() ! f = open(filename + ".dir", "rb") f.close() return "dbm" --- 25,31 ---- # Check for dbm first -- this has a .pag and a .dir file try: ! f = open(filename + endsep + "pag", "rb") f.close() ! f = open(filename + endsep + "dir", "rb") f.close() return "dbm" *************** *** 28,34 **** # Check for dumbdbm next -- this has a .dir and and a .dat file try: ! f = open(filename + ".dat", "rb") f.close() ! f = open(filename + ".dir", "rb") try: if f.read(1) in ["'", '"']: --- 35,41 ---- # Check for dumbdbm next -- this has a .dir and and a .dat file try: ! f = open(filename + endsep + "dat", "rb") f.close() ! f = open(filename + endsep + "dir", "rb") try: if f.read(1) in ["'", '"']: From gvanrossum@users.sourceforge.net Fri Mar 2 06:48:08 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 01 Mar 2001 22:48:08 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc ACKS,1.84,1.85 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv15416 Modified Files: ACKS Log Message: Dietmar Schwertberger; shuffled a bunch of Sch* names in alphabetical order. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -r1.84 -r1.85 *** ACKS 2001/03/02 02:54:27 1.84 --- ACKS 2001/03/02 06:48:06 1.85 *************** *** 332,340 **** Ben Sayer Michael Scharf - Peter Schneider-Kamp - Sam Schulenburg Neil Schemenauer David Scherer Gregor Schmid Barry Scott Nick Seidenman --- 332,341 ---- Ben Sayer Michael Scharf Neil Schemenauer David Scherer Gregor Schmid + Peter Schneider-Kamp + Sam Schulenburg + Dietmar Schwertberger Barry Scott Nick Seidenman From gvanrossum@users.sourceforge.net Fri Mar 2 06:49:52 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 01 Mar 2001 22:49:52 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.131,1.132 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv15600 Modified Files: NEWS Log Message: ROSCOS change. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.131 retrieving revision 1.132 diff -C2 -r1.131 -r1.132 *** NEWS 2001/03/01 22:19:38 1.131 --- NEWS 2001/03/02 06:49:50 1.132 *************** *** 81,84 **** --- 81,92 ---- Tishler! + - 2.1 contains new files and patches for RISCOS, thanks to Dietmar + Schwertberger! See RISCOS/README for more information -- it seems + that because of the bizarre filename conventions on RISCOS, no port + to that platform is easy. Note that the new variable os.endsep is + silently supported in order to make life easier on this platform, + but we don't advertise it because it's not worth for most folks to + care about RISCOS portability. + What's New in Python 2.1 alpha 2? From fdrake@users.sourceforge.net Fri Mar 2 06:51:01 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 01 Mar 2001 22:51:01 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules termios.c,2.17,2.18 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv15762 Modified Files: termios.c Log Message: Add more protection around the VSWTC/VSWTCH, CRTSCTS, and XTABS symbols; these can be missing on some (all?) Irix and Tru64 versions. Protect the CRTSCTS value with a cast; this can be a larger value on Solaris/SPARC. This should fix SF tracker items #405092, #405350, and #405355. Index: termios.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/termios.c,v retrieving revision 2.17 retrieving revision 2.18 diff -C2 -r2.17 -r2.18 *** termios.c 2001/03/01 21:54:49 2.17 --- termios.c 2001/03/02 06:50:58 2.18 *************** *** 392,396 **** --- 392,398 ---- {"TAB2", TAB2}, {"TAB3", TAB3}, + #ifdef XTABS {"XTABS", XTABS}, + #endif {"BS0", BS0}, {"BS1", BS1}, *************** *** 410,415 **** #ifdef CIBAUD {"CIBAUD", CIBAUD}, #endif - {"CRTSCTS", CRTSCTS}, /* struct termios.c_cflag-related values (character size) */ --- 412,419 ---- #ifdef CIBAUD {"CIBAUD", CIBAUD}, + #endif + #ifdef CRTSCTS + {"CRTSCTS", (long)CRTSCTS}, #endif /* struct termios.c_cflag-related values (character size) */ *************** *** 450,455 **** --- 454,463 ---- {"VTIME", VTIME}, {"VMIN", VMIN}, + #ifdef VSWTC + /* The #defines above ensure that if either is defined, both are, + * but both may be omitted by the system headers. ;-( */ {"VSWTC", VSWTC}, {"VSWTCH", VSWTCH}, + #endif {"VSTART", VSTART}, {"VSTOP", VSTOP}, From gvanrossum@users.sourceforge.net Fri Mar 2 06:53:31 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 01 Mar 2001 22:53:31 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules timemodule.c,2.106,2.107 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv16070 Modified Files: timemodule.c Log Message: Fix typo in RISCOS patch inside MS #ifdef. (Probably my own fingers.) Index: timemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/timemodule.c,v retrieving revision 2.106 retrieving revision 2.107 diff -C2 -r2.106 -r2.107 *** timemodule.c 2001/03/02 06:26:41 2.106 --- timemodule.c 2001/03/02 06:53:29 2.107 *************** *** 41,45 **** #else #ifdef MS_WINDOWS ! include #ifdef MS_WIN16 /* These overrides not needed for Win32 */ --- 41,45 ---- #else #ifdef MS_WINDOWS ! #include #ifdef MS_WIN16 /* These overrides not needed for Win32 */ From gvanrossum@users.sourceforge.net Fri Mar 2 07:04:53 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 01 Mar 2001 23:04:53 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib os.py,1.43,1.44 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv17563 Modified Files: os.py Log Message: Fix by Donn Cave for BeOS (SF #403642): UNIX style fork/execve/wait are not fully compatible with thread support on BeOS. For Python, that means neither fork() from import nor import from a fork work reliably. os._execvpe() does the latter, importing tempfile to set up a tantalizing target for hackers. This patch replaces both the tempfile name generation and the exec that uses it, in case we're on BeOS. Need this for setup:distutils:execvp(); symptoms are random crashes and internal BeOS error messages about th name, in case we're on BeOS. It's an issue because setup.py + distutils calls os.execvp(); symptoms are random crashes during setup.py, and internal BeOS error messages about thread IDs. Index: os.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/os.py,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -r1.43 -r1.44 *** os.py 2001/03/02 06:43:49 1.43 --- os.py 2001/03/02 07:04:51 1.44 *************** *** 323,330 **** PATH = envpath.split(pathsep) if not _notfound: ! import tempfile ! # Exec a file that is guaranteed not to exist ! try: execv(tempfile.mktemp(), ('blah',)) ! except error, _notfound: pass exc, arg = error, _notfound for dir in PATH: --- 323,339 ---- PATH = envpath.split(pathsep) if not _notfound: ! if sys.platform[:4] == 'beos': ! # Process handling (fork, wait) under BeOS (up to 5.0) ! # doesn't interoperate reliably with the thread interlocking ! # that happens during an import. The actual error we need ! # is the same on BeOS for posix.open() et al., ENOENT. ! try: unlink('/_#.# ## #.#') ! except error, _notfound: pass ! else: ! import tempfile ! t = tempfile.mktemp() ! # Exec a file that is guaranteed not to exist ! try: execv(t, ('blah',)) ! except error, _notfound: pass exc, arg = error, _notfound for dir in PATH: From gvanrossum@users.sourceforge.net Fri Mar 2 07:09:56 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 01 Mar 2001 23:09:56 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules makesetup,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv18301 Modified Files: makesetup Log Message: Extra fix from bbum (SF #402357) for his previous patch: It should use the normal CC referenced compiler as ObjC is integrated directly into gcc and enabled through the use of the -ObjC flag. Index: makesetup =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/makesetup,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -r1.34 -r1.35 *** makesetup 2001/01/27 21:43:40 1.34 --- makesetup 2001/03/02 07:09:54 1.35 *************** *** 205,209 **** *.cxx) obj=`basename $src .cxx`.o; cc='$(CXX)';; *.cpp) obj=`basename $src .cpp`.o; cc='$(CXX)';; ! *.m) obj=`basename $src .m`.o; cc='$(CXX)';; # Obj-C *) continue;; esac --- 205,209 ---- *.cxx) obj=`basename $src .cxx`.o; cc='$(CXX)';; *.cpp) obj=`basename $src .cpp`.o; cc='$(CXX)';; ! *.m) obj=`basename $src .m`.o; cc='$(CC)';; # Obj-C *) continue;; esac From fdrake@users.sourceforge.net Fri Mar 2 07:28:05 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 01 Mar 2001 23:28:05 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/distutils/command build_scripts.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory usw-pr-cvs1:/tmp/cvs-serv20973 Modified Files: build_scripts.py Log Message: When not copying a file because the output is up to date, make the message slightly more brief, and more like the message that an extension will not be built because the built copy is up to date. Index: build_scripts.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/build_scripts.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** build_scripts.py 2001/02/28 20:59:33 1.7 --- build_scripts.py 2001/03/02 07:28:03 1.8 *************** *** 46,50 **** self.copy_scripts() ! def copy_scripts (self): """Copy each script listed in 'self.scripts'; if it's marked as a --- 46,50 ---- self.copy_scripts() ! def copy_scripts (self): """Copy each script listed in 'self.scripts'; if it's marked as a *************** *** 60,64 **** if not self.force and not newer(script, outfile): ! self.announce("not copying %s (output up-to-date)" % script) continue --- 60,64 ---- if not self.force and not newer(script, outfile): ! self.announce("not copying %s (up-to-date)" % script) continue From fredrik@effbot.org Fri Mar 2 08:46:15 2001 From: fredrik@effbot.org (Fredrik Lundh) Date: Fri, 2 Mar 2001 09:46:15 +0100 Subject: [Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.9,1.10 References: <20010301230633.N9678@xs4all.nl> Message-ID: <063d01c0a2f5$3fbdbb60$e46940d5@hagrid> > On Thu, Mar 01, 2001 at 11:31:27AM -0800, Ka-Ping Yee wrote: > > > --- 128,135 ---- > > """Return the Python module name for a given path, or None.""" > > filename = os.path.basename(path) > > ! for ending in ['.py', '.pyc', '.pyd', '.pyo', > > ! 'module.so', 'module.so.1', '.so']: > > ! if len(filename) > len(ending) and filename[-len(ending):] == ending: > > ! return filename[:-len(ending)] > > Out of curiosity, why are you specialcasing 'module.so.1' ? Shouldn't that > be r'module\.so\.\d+' ? Or even better, r'module\.so(\.\d+)*' ? or "for ending in [x[0] in imp.get_suffixes()]" ? Cheers /F From ping@lfw.org Fri Mar 2 11:00:30 2001 From: ping@lfw.org (Ka-Ping Yee) Date: Fri, 2 Mar 2001 03:00:30 -0800 (PST) Subject: [Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.9,1.10 In-Reply-To: <063d01c0a2f5$3fbdbb60$e46940d5@hagrid> Message-ID: On Fri, 2 Mar 2001, Fredrik Lundh wrote: > > > > Out of curiosity, why are you specialcasing 'module.so.1' ? Shouldn't that > > be r'module\.so\.\d+' ? Or even better, r'module\.so(\.\d+)*' ? > > or "for ending in [x[0] in imp.get_suffixes()]" ? Yup, i did that a few hours ago. Check out the current version in CVS... suffixes = map(lambda (suffix, mode, kind): (len(suffix), suffix), imp.get_suffixes()) suffixes.sort() suffixes.reverse() # try longest suffixes first, in case they overlap for length, suffix in suffixes: if len(filename) > length and filename[-length:] == suffix: return filename[:-length] -- ?!ng "I've been listening to my gut since i was 14, and frankly speaking, i've come to the conclusion that my guts have shit for brains." -- Rob, High Fidelity From gvanrossum@users.sourceforge.net Fri Mar 2 13:35:39 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 02 Mar 2001 05:35:39 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib dircache.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv20570 Modified Files: dircache.py Log Message: Patch by Itamar S.T. (SF#305470): add reset() method. Index: dircache.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/dircache.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** dircache.py 2001/01/20 19:54:20 1.8 --- dircache.py 2001/03/02 13:35:37 1.9 *************** *** 7,13 **** import os ! __all__ = ["listdir","opendir","annotate"] cache = {} def listdir(path): --- 7,18 ---- import os ! __all__ = ["listdir", "opendir", "annotate", "reset"] cache = {} + + def reset(): + """Reset the cache completely.""" + global cache + cache = {} def listdir(path): From gvanrossum@users.sourceforge.net Fri Mar 2 13:37:44 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 02 Mar 2001 05:37:44 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc ACKS,1.85,1.86 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv20818 Modified Files: ACKS Log Message: Itamar S.T. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.85 retrieving revision 1.86 diff -C2 -r1.85 -r1.86 *** ACKS 2001/03/02 06:48:06 1.85 --- ACKS 2001/03/02 13:37:42 1.86 *************** *** 189,192 **** --- 189,193 ---- Jeremy Hylton John Interrante + S.T. Itamar Ben Jackson Paul Jackson From gvanrossum@users.sourceforge.net Fri Mar 2 14:00:34 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 02 Mar 2001 06:00:34 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.132,1.133 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv23870 Modified Files: NEWS Log Message: Add big news item about nested scopes, __future__, and compile-time warnings. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.132 retrieving revision 1.133 diff -C2 -r1.132 -r1.133 *** NEWS 2001/03/02 06:49:50 1.132 --- NEWS 2001/03/02 14:00:32 1.133 *************** *** 4,7 **** --- 4,43 ---- Core language, builtins, and interpreter + - Following an outcry from the community about the amount of code + broken by the nested scopes feature introduced in 2.1a2, we decided + to make this feature optional, and to wait until Python 2.2 (or at + least 6 months) to make it standard. The option can be enabled on a + per-module basis by adding "from __future__ import nested_scopes" at + the beginning of a module (before any other statements, but after + comments and an optional docstring). See PEP 236 (Back to the + __future__) for a description of the __future__ statement. PEP 227 + (Statically Nested Scopes) has been updated to reflect this change, + and to clarify the semantics in a number of endcases. + + - The nested scopes code, when enabled, has been hardened, and most + bugs and memory leaks in it have been fixed. + + - Compile-time warnings are now generated for a number of conditions + that will break or change in meaning when nested scopes are enabled: + + - Using "from...import *" or "exec" without in-clause in a function + scope that also defines a lambda or nested function with one or + more free (non-local) variables. The presence of the import* or + bare exec makes it impossible for the compiler to determine the + exact set of local variables in the outer scope, which makes it + impossible to determine the bindings for free variables in the + inner scope. To avoid the warning about import *, change it into + an import of explicitly name object, or move the import* statement + to the global scope; to avoid the warning about bare exec, use + exec...in... (a good idea anyway -- there's a possibility that + bare exec will be deprecated in the future). + + - Use of a global variable in a nested scope with the same name as a + local variable in a surrounding scope. This will change in + meaning with nested scopes: the name in the inner scope will + reference the variable in the outer scope rather than the global + of the same name. To avoid the warning, either rename the outer + variable, or use a global statement in the inner function. + - An optional object allocator has been included. This allocator is optimized for Python objects and should be faster and use less memory From gvanrossum@users.sourceforge.net Fri Mar 2 14:06:01 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 02 Mar 2001 06:06:01 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.133,1.134 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv24970 Modified Files: NEWS Log Message: Add some more info about pydoc. (Can you see I'm excited?) Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.133 retrieving revision 1.134 diff -C2 -r1.133 -r1.134 *** NEWS 2001/03/02 14:00:32 1.133 --- NEWS 2001/03/02 14:05:59 1.134 *************** *** 72,76 **** Tools/scripts/pydoc, which is now automatically installed into /bin, uses pydoc.py to display documentation; try running ! 'pydoc' for the instructions. - New library module difflib.py, primarily packaging the SequenceMatcher --- 72,77 ---- Tools/scripts/pydoc, which is now automatically installed into /bin, uses pydoc.py to display documentation; try running ! "pydoc -h" for instructions. "pydoc -g" pops up a small GUI that ! lets you browse the module docstrings using a web browser. - New library module difflib.py, primarily packaging the SequenceMatcher *************** *** 81,84 **** --- 82,89 ---- Windows changes + + - A new entry in the Start menu, "Module Docs", runs "pydoc -g" -- a + small GUI that lets you browse the module docstrings using your + default web browser. - Import is now case-sensitive. PEP 235 (Import on Case-Insensitive From fdrake@users.sourceforge.net Fri Mar 2 16:26:47 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 02 Mar 2001 08:26:47 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/tools mkhowto,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv25676 Modified Files: mkhowto Log Message: Job.build_html(): When formatting HTML into more than one HTML page, and not doing the \label{foo} --> foo.html transformation (--numeric was specified on the command line), still look to see if there is an "About this document..." node and copy that to "about.html", since the page footers use that as the target. Index: mkhowto =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/mkhowto,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -r1.23 -r1.24 *** mkhowto 2001/02/19 19:18:09 1.23 --- mkhowto 2001/03/02 16:26:45 1.24 *************** *** 369,379 **** shutil.copyfile(os.path.join(builddir, self.doc + ".html"), os.path.join(builddir, "index.html")) ! if max_split_depth != 1 and not self.options.numeric: ! pwd = os.getcwd() ! try: ! os.chdir(builddir) ! self.run("%s %s *.html" % (PERL_BINARY, NODE2LABEL_SCRIPT)) ! finally: ! os.chdir(pwd) def build_text(self, tempdir=None): --- 369,397 ---- shutil.copyfile(os.path.join(builddir, self.doc + ".html"), os.path.join(builddir, "index.html")) ! if max_split_depth != 1: ! if self.options.numeric: ! label_file = os.path.join(builddir, "labels.pl") ! fp = open(label_file) ! about_node = None ! target = " = q/about/;\n" ! x = len(target) ! while 1: ! line = fp.readline() ! if not line: ! break ! if line[-x:] == target: ! line = fp.readline() ! m = re.search(r"\|(node\d+\.[a-z]+)\|", line) ! about_node = m.group(1) ! shutil.copyfile(os.path.join(builddir, about_node), ! os.path.join(builddir, "about.html")) ! break ! else: ! pwd = os.getcwd() ! try: ! os.chdir(builddir) ! self.run("%s %s *.html" % (PERL_BINARY, NODE2LABEL_SCRIPT)) ! finally: ! os.chdir(pwd) def build_text(self, tempdir=None): From fdrake@users.sourceforge.net Fri Mar 2 16:46:45 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 02 Mar 2001 08:46:45 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libshutil.tex,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv31181/lib Modified Files: libshutil.tex Log Message: For copyfile(), be explicit that src and dst are file names; that was only implied. Index: libshutil.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libshutil.tex,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** libshutil.tex 2000/07/31 15:45:46 1.6 --- libshutil.tex 2001/03/02 16:46:42 1.7 *************** *** 20,25 **** \begin{funcdesc}{copyfile}{src, dst} ! Copy the contents of \var{src} to \var{dst}. If \var{dst} exists, ! it will be replaced, otherwise it will be created. \end{funcdesc} --- 20,26 ---- \begin{funcdesc}{copyfile}{src, dst} ! Copy the contents of the file named \var{src} to a file named ! \var{dst}. If \var{dst} exists, it will be replaced, otherwise it ! will be created. \end{funcdesc} From bwarsaw@users.sourceforge.net Fri Mar 2 16:53:56 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Fri, 02 Mar 2001 08:53:56 -0800 Subject: [Python-checkins] CVS: python/dist/src/Tools/i18n msgfmt.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/i18n In directory usw-pr-cvs1:/tmp/cvs-serv873 Modified Files: msgfmt.py Log Message: Added -o/--output-file option as per GNU msgfmt to specify the output file instead of using inputfilename.mo Index: msgfmt.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/i18n/msgfmt.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** msgfmt.py 2000/09/01 08:10:08 1.1 --- msgfmt.py 2001/03/02 16:53:54 1.2 *************** *** 12,15 **** --- 12,20 ---- Options: + -o file + --output-file=file + Specify the output file to write to. If omitted, output will go to a + file named filename.mo (based off the input file name). + -h --help *************** *** 19,31 **** --version Display version information and exit. - """ import sys import getopt import struct import array ! __version__ = "1.0" MESSAGES = {} --- 24,36 ---- --version Display version information and exit. """ import sys + import os import getopt import struct import array ! __version__ = "1.1" MESSAGES = {} *************** *** 92,106 **** ! def make(filename): ID = 1 STR = 2 ! # Compute .mo name from .po name if filename.endswith('.po'): infile = filename - outfile = filename[:-2] + 'mo' else: infile = filename + '.po' ! outfile = filename + '.mo' try: lines = open(infile).readlines() --- 97,112 ---- ! def make(filename, outfile): ID = 1 STR = 2 ! # Compute .mo name from .po name and arguments if filename.endswith('.po'): infile = filename else: infile = filename + '.po' ! if outfile is None: ! outfile = os.path.splitext(infile)[0] + '.mo' ! try: lines = open(infile).readlines() *************** *** 160,164 **** output = generate() - # Save output try: open(outfile,"wb").write(output) --- 166,169 ---- *************** *** 170,177 **** def main(): try: ! opts, args = getopt.getopt(sys.argv[1:], 'hV', ['help','version']) except getopt.error, msg: usage(1, msg) # parse options for opt, arg in opts: --- 175,184 ---- def main(): try: ! opts, args = getopt.getopt(sys.argv[1:], 'hVo:', ! ['help', 'version', 'output-file=']) except getopt.error, msg: usage(1, msg) + outfile = None # parse options for opt, arg in opts: *************** *** 181,184 **** --- 188,193 ---- print >> sys.stderr, "msgfmt.py", __version__ sys.exit(0) + elif opt in ('-o', '--output-file'): + outfile = arg # do it if not args: *************** *** 188,192 **** for filename in args: ! make(filename) --- 197,201 ---- for filename in args: ! make(filename, outfile) From fdrake@users.sourceforge.net Fri Mar 2 18:15:14 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 02 Mar 2001 10:15:14 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/ext ext.tex,1.91,1.92 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory usw-pr-cvs1:/tmp/cvs-serv19724/ext Modified Files: ext.tex Log Message: There is no longer a -X option to the interpreter, so remove the comments on how PyErr_NewException() behaves in that case. Clarify why an owned reference is kept in an extension module's variable that refers to the result of PyErr_NewException(); one reader thought that was a leak. Clean up some tabs and simplify some markup. Index: ext.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/ext.tex,v retrieving revision 1.91 retrieving revision 1.92 diff -C2 -r1.91 -r1.92 *** ext.tex 2001/02/19 19:22:00 1.91 --- ext.tex 2001/03/02 18:15:11 1.92 *************** *** 278,290 **** Note that the Python name for the exception object is \exception{spam.error}. The \cfunction{PyErr_NewException()} function ! may create either a string or class, depending on whether the ! \programopt{-X} flag was passed to the interpreter. If ! \programopt{-X} was used, \cdata{SpamError} will be a string object, ! otherwise it will be a class object with the base class being ! \exception{Exception}, described in the \citetitle[../lib/lib.html]{Python Library Reference} under ``Built-in Exceptions.'' \section{Back to the Example \label{backToExample}} --- 278,295 ---- Note that the Python name for the exception object is \exception{spam.error}. The \cfunction{PyErr_NewException()} function ! may create a class with the base class being \exception{Exception} ! (unless another class is passed in instead of \NULL), described in the \citetitle[../lib/lib.html]{Python Library Reference} under ``Built-in Exceptions.'' + Note also that the \cdata{SpamError} variable retains a reference to + the newly created exception class; this is intentional! Since the + exception could be removed from the module by external code, an owned + reference to the class is needed to ensure that it will not be + discarded, causing \cdata{SpamError} to become a dangling pointer. + Should it become a dangling pointer, C code which raises the exception + could cause a core dump or other unintended side effects. + \section{Back to the Example \label{backToExample}} *************** *** 2127,2147 **** will implement. - \begin{verbatim} - destructor tp_dealloc; - \end{verbatim} - \begin{verbatim} - printfunc tp_print; - \end{verbatim} - \begin{verbatim} - getattrfunc tp_getattr; - \end{verbatim} - \begin{verbatim} - setattrfunc tp_setattr; - \end{verbatim} \begin{verbatim} ! cmpfunc tp_compare; ! \end{verbatim} ! \begin{verbatim} ! reprfunc tp_repr; \end{verbatim} --- 2132,2142 ---- will implement. \begin{verbatim} ! destructor tp_dealloc; ! printfunc tp_print; ! getattrfunc tp_getattr; ! setattrfunc tp_setattr; ! cmpfunc tp_compare; ! reprfunc tp_repr; \end{verbatim} From fdrake@users.sourceforge.net Fri Mar 2 18:57:07 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 02 Mar 2001 10:57:07 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/texinputs python.sty,1.71,1.72 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory usw-pr-cvs1:/tmp/cvs-serv27726/texinputs Modified Files: python.sty Log Message: Label classes and exceptions explicitly in the documentation (for their *desc environments). Index: python.sty =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/python.sty,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -r1.71 -r1.72 *** python.sty 2001/01/22 17:50:42 1.71 --- python.sty 2001/03/02 18:57:05 1.72 *************** *** 117,124 **** \parindent = 0mm \parskip = 2mm ! \hbadness = 5000 % don't print trivial gripes ! \pagestyle{empty} % start this way; change for ! \pagenumbering{roman} % ToC & chapters % Use this to set the font family for headers and other decor: --- 117,124 ---- \parindent = 0mm \parskip = 2mm ! \hbadness = 5000 % don't print trivial gripes ! \pagestyle{empty} % start this way; change for ! \pagenumbering{roman} % ToC & chapters % Use this to set the font family for headers and other decor: *************** *** 599,603 **** \global\def\py@thisclass{#1} \begin{fulllineitems} ! \item[\code{\bfcode{#1}(\py@varvars{#2})}% \index{#1@{\py@idxcode{#1}} (class in \py@thismodule)}] }{\end{fulllineitems}} --- 599,603 ---- \global\def\py@thisclass{#1} \begin{fulllineitems} ! \item[\strong{class }\code{\bfcode{#1}(\py@varvars{#2})}% \index{#1@{\py@idxcode{#1}} (class in \py@thismodule)}] }{\end{fulllineitems}} *************** *** 609,613 **** \global\def\py@thisclass{#1} \begin{fulllineitems} ! \item[\code{\bfcode{#1}(\py@varvars{#2})}% \index{#1@{\py@idxcode{#1}} (exception in \py@thismodule)}] }{\end{fulllineitems}} --- 609,613 ---- \global\def\py@thisclass{#1} \begin{fulllineitems} ! \item[\strong{exception }\code{\bfcode{#1}(\py@varvars{#2})}% \index{#1@{\py@idxcode{#1}} (exception in \py@thismodule)}] }{\end{fulllineitems}} *************** *** 679,683 **** \newenvironment{excdesc}[1]{ \begin{fulllineitems} ! \item[\bfcode{#1}% \index{#1@{\py@idxcode{#1}} (exception in \py@thismodule)}] }{\end{fulllineitems}} --- 679,683 ---- \newenvironment{excdesc}[1]{ \begin{fulllineitems} ! \item[\strong{exception }\bfcode{#1}% \index{#1@{\py@idxcode{#1}} (exception in \py@thismodule)}] }{\end{fulllineitems}} *************** *** 754,762 **** \newcommand{\py@url}[1]{{% \pdfannotlink attr{/Border [0 0 0]} user{/S /URI /URI (#1)}% ! \py@LinkColor% color of the link text \mbox{\small\textsf{#1}}% ! \py@NormalColor% Turn it back off; these are declarative ! \pdfendlink}% and don't appear bound to the current ! }% formatting "box". } \let\url=\py@url --- 754,762 ---- \newcommand{\py@url}[1]{{% \pdfannotlink attr{/Border [0 0 0]} user{/S /URI /URI (#1)}% ! \py@LinkColor% color of the link text \mbox{\small\textsf{#1}}% ! \py@NormalColor% Turn it back off; these are declarative ! \pdfendlink}% and don't appear bound to the current ! }% formatting "box". } \let\url=\py@url *************** *** 792,800 **** \newcommand{\method}[1]{\texttt{#1}} ! \newcommand{\pytype}[1]{#1} % built-in Python type \newcommand{\cfunction}[1]{\texttt{#1}} ! \newcommand{\ctype}[1]{\texttt{#1}} % C struct or typedef name ! \newcommand{\cdata}[1]{\texttt{#1}} % C variable, typically global \newcommand{\mimetype}[1]{{\small\textsf{#1}}} --- 792,800 ---- \newcommand{\method}[1]{\texttt{#1}} ! \newcommand{\pytype}[1]{#1} % built-in Python type \newcommand{\cfunction}[1]{\texttt{#1}} ! \newcommand{\ctype}[1]{\texttt{#1}} % C struct or typedef name ! \newcommand{\cdata}[1]{\texttt{#1}} % C variable, typically global \newcommand{\mimetype}[1]{{\small\textsf{#1}}} *************** *** 810,818 **** \index{environment variables!{#1}}% } ! \newcommand{\makevar}[1]{#1} % variable in a Makefile \newcommand{\character}[1]{\samp{#1}} % constants defined in Python modules or C headers, not language constants: ! \newcommand{\constant}[1]{\code{#1}} % manifest constant, not syntactic \newcommand{\manpage}[2]{{\emph{#1}(#2)}} --- 810,818 ---- \index{environment variables!{#1}}% } ! \newcommand{\makevar}[1]{#1} % variable in a Makefile \newcommand{\character}[1]{\samp{#1}} % constants defined in Python modules or C headers, not language constants: ! \newcommand{\constant}[1]{\code{#1}} % manifest constant, not syntactic \newcommand{\manpage}[2]{{\emph{#1}(#2)}} From fdrake@users.sourceforge.net Fri Mar 2 18:57:07 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 02 Mar 2001 10:57:07 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/perl python.perl,1.94,1.95 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/perl In directory usw-pr-cvs1:/tmp/cvs-serv27726/perl Modified Files: python.perl Log Message: Label classes and exceptions explicitly in the documentation (for their *desc environments). Index: python.perl =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/perl/python.perl,v retrieving revision 1.94 retrieving revision 1.95 diff -C2 -r1.94 -r1.95 *** python.perl 2001/01/22 17:33:24 1.94 --- python.perl 2001/03/02 18:57:05 1.95 *************** *** 883,887 **** my $excname = next_argument(); my $idx = make_str_index_entry("$excname"); ! return "

$idx\n
" . $_ . '
' } --- 883,887 ---- my $excname = next_argument(); my $idx = make_str_index_entry("$excname"); ! return "
exception $idx\n
" . $_ . '
' } *************** *** 896,900 **** "$THIS_CLASS ($what in $THIS_MODULE)" ); $idx =~ s/ \(.*\)//; ! return "
$idx ($arg_list)\n
" . $_ . '
'; } --- 896,902 ---- "$THIS_CLASS ($what in $THIS_MODULE)" ); $idx =~ s/ \(.*\)//; ! return ("
$what $idx ($arg_list)\n
" ! . $_ ! . '
'); } From tim.one@home.com Fri Mar 2 19:38:42 2001 From: tim.one@home.com (Tim Peters) Date: Fri, 2 Mar 2001 14:38:42 -0500 Subject: [Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.9,1.10 In-Reply-To: Message-ID: [Ka-Ping Yee] > Yup, i did that a few hours ago. Check out the current version in CVS... > > suffixes = map(lambda (suffix, mode, kind): (len(suffix), suffix), > imp.get_suffixes()) > suffixes.sort() > suffixes.reverse() # try longest suffixes first, in case they overlap > for length, suffix in suffixes: > if len(filename) > length and filename[-length:] == suffix: > return filename[:-length] FYI, it could be a bit crisper: # try longest suffixes first, in case they overlap suffixes = [(-len(s), s) for (s, mode, kind) in imp.getsuffixes()] suffixes.sort() for neglen, s in suffixes: if filename.endswith(s): return filename[:neglen] From fdrake@users.sourceforge.net Fri Mar 2 19:48:08 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 02 Mar 2001 11:48:08 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/ext ext.tex,1.92,1.93 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory usw-pr-cvs1:/tmp/cvs-serv2726/ext Modified Files: ext.tex Log Message: There was a real leak in the "export a C API" example; fix that one. (There are too many initspam() functions; they need to be renamed post-beta.) Index: ext.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/ext.tex,v retrieving revision 1.92 retrieving revision 1.93 diff -C2 -r1.92 -r1.93 *** ext.tex 2001/03/02 18:15:11 1.92 --- ext.tex 2001/03/02 19:48:06 1.93 *************** *** 1620,1626 **** initspam() { ! PyObject *m, *d; static void *PySpam_API[PySpam_API_pointers]; PyObject *c_api_object; m = Py_InitModule("spam", SpamMethods); --- 1620,1627 ---- initspam() { ! PyObject *m; static void *PySpam_API[PySpam_API_pointers]; PyObject *c_api_object; + m = Py_InitModule("spam", SpamMethods); *************** *** 1630,1637 **** /* Create a CObject containing the API pointer array's address */ c_api_object = PyCObject_FromVoidPtr((void *)PySpam_API, NULL); ! /* Create a name for this object in the module's namespace */ ! d = PyModule_GetDict(m); ! PyDict_SetItemString(d, "_C_API", c_api_object); } \end{verbatim} --- 1631,1642 ---- /* Create a CObject containing the API pointer array's address */ c_api_object = PyCObject_FromVoidPtr((void *)PySpam_API, NULL); + + if (c_api_object != NULL) { + /* Create a name for this object in the module's namespace */ + PyObject *d = PyModule_GetDict(m); ! PyDict_SetItemString(d, "_C_API", c_api_object); ! Py_DECREF(c_api_object); ! } } \end{verbatim} From fdrake@users.sourceforge.net Fri Mar 2 20:39:37 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 02 Mar 2001 12:39:37 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib liburllib2.tex,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv14056/lib Modified Files: liburllib2.tex Log Message: Lots of organizational changes for consistency with the rest of the documentation. Fix a few small markup nits. Index: liburllib2.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liburllib2.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** liburllib2.tex 2001/03/01 08:40:42 1.1 --- liburllib2.tex 2001/03/02 20:39:34 1.2 *************** *** 3,7 **** \declaremodule{standard}{urllib2} - \moduleauthor{Jeremy Hylton}{jhylton@users.sourceforge.net} \sectionauthor{Moshe Zadka}{moshez@users.sourceforge.net} --- 3,6 ---- *************** *** 11,15 **** The \module{urllib2} module defines functions and classes which help ! in opening URLs (mostly HTTP) in a complex world -- basic and digest authentication, redirections and more. --- 10,14 ---- The \module{urllib2} module defines functions and classes which help ! in opening URLs (mostly HTTP) in a complex world --- basic and digest authentication, redirections and more. *************** *** 19,37 **** Open the url \var{url}, which can either a string or a \class{Request} object (currently the code checks that it really is a \class{Request} ! instance, or an instance of a subclass of \class{Request}. \var{data} should be a string, which specifies additional data to send to the server. In HTTP requests, which are the only ones that support \var{data}, it should be a buffer in the format of ! \code{application/x-www-form-urlencoded}, for example one returned ! from \function{urllib.urlencode}. This function returns a file-like object with two additional methods: \begin{itemize} ! ! \item \code{geturl()} --- return the URL of the resource retrieved ! \item \code{info()} --- return the meta-information of the page, as ! a dictionary-like object \end{itemize} --- 18,35 ---- Open the url \var{url}, which can either a string or a \class{Request} object (currently the code checks that it really is a \class{Request} ! instance, or an instance of a subclass of \class{Request}). \var{data} should be a string, which specifies additional data to send to the server. In HTTP requests, which are the only ones that support \var{data}, it should be a buffer in the format of ! \mimetype{application/x-www-form-urlencoded}, for example one returned ! from \function{urllib.urlencode()}. This function returns a file-like object with two additional methods: \begin{itemize} ! \item \method{geturl()} --- return the URL of the resource retrieved ! \item \method{info()} --- return the meta-information of the page, as ! a dictionary-like object \end{itemize} *************** *** 45,50 **** \end{funcdesc} ! \begin{funcdesc}{build_opener}{\optional{handler\optional{, ! handler\optional{, ...}}}} Return an \class{OpenerDirector} instance, which chains the handlers in the order given. \var{handler}s can be either instances --- 43,47 ---- \end{funcdesc} ! \begin{funcdesc}{build_opener}{\optional{handler, \moreargs}} Return an \class{OpenerDirector} instance, which chains the handlers in the order given. \var{handler}s can be either instances *************** *** 58,75 **** HTTPRedirectHandler, FTPHandler, FileHandler} ! If the Python installation has SSL support (\code{socket.ssl} exists), ! \class{HTTPSHandler} will also be added. \end{funcdesc} \begin{excdesc}{URLError} ! The error handlers raise when they run into a problem. It is a subclass ! of \exception{IOError}. \end{excdesc} \begin{excdesc}{HTTPError} A subclass of \exception{URLError}, it can also function as a ! non-exceptional file-like return value (the same thing that \function{urlopen} ! returns). This is useful when handling exotic HTTP errors, such as ! requests for authentications. \end{excdesc} --- 55,75 ---- HTTPRedirectHandler, FTPHandler, FileHandler} ! If the Python installation has SSL support (\function{socket.ssl()} ! exists), \class{HTTPSHandler} will also be added. \end{funcdesc} + + The following exceptions are raised as appropriate: + \begin{excdesc}{URLError} ! The error handlers raise when they run into a problem. It is a ! subclass of \exception{IOError}. \end{excdesc} \begin{excdesc}{HTTPError} A subclass of \exception{URLError}, it can also function as a ! non-exceptional file-like return value (the same thing that ! \function{urlopen()} returns). This is useful when handling exotic ! HTTP errors, such as requests for authentication. \end{excdesc} *************** *** 79,91 **** \end{excdesc} ! \begin{classdesc}{Request}{url\optional{data, \optional{, headers}}} This class is an abstraction of a URL request. \var{url} should be a string which is a valid URL. For descrtion ! of \var{data} see the \method{add_data} description. \var{headers} should be a dictionary, and will be treated as if ! \method{add_header} was called with each key and value as arguments. \end{classdesc} The following methods describe all of \class{Request}'s public interface, and so all must be overridden in subclasses. --- 79,207 ---- \end{excdesc} ! ! The following classes are provided: ! ! \begin{classdesc}{Request}{url\optional{, data\optional{, headers}}} This class is an abstraction of a URL request. \var{url} should be a string which is a valid URL. For descrtion ! of \var{data} see the \method{add_data()} description. \var{headers} should be a dictionary, and will be treated as if ! \method{add_header()} was called with each key and value as arguments. \end{classdesc} + \begin{classdesc}{OpenerDirector}{} + The \class{OpenerDirector} class opens URLs via \class{BaseHandler}s + chained together. It manages the chaining of handlers, and recovery + from errors. + \end{classdesc} + + \begin{classdesc}{BaseHandler}{} + This is the base class for all registered handlers --- and handles only + the simple mechanics of registration. + \end{classdesc} + + \begin{classdesc}{HTTPDefaultErrorHandler}{} + A class which defines a default handler for HTTP error responses; all + responses are turned into \exception{HTTPError} exceptions. + \end{classdesc} + + \begin{classdesc}{HTTPRedirectHandler}{} + A class to handle redirections. + \end{classdesc} + + \begin{classdesc}{ProxyHandler}{\optional{proxies}} + Cause requests to go through a proxy. + If \var{proxies} is given, it must be a dictionary mapping + protocol names to URLs of proxies. + The default is to read the list of proxies from the environment + variables \envvar{\var{protocol}_proxy}. + \end{classdesc} + + \begin{classdesc}{HTTPPasswordMgr}{} + Keep a database of + \code{(\var{realm}, \var{uri}) -> (\var{user}, \var{password})} + mappings. + \end{classdesc} + + \begin{classdesc}{HTTPPasswordMgrWithDefaultRealm}{} + Keep a database of + \code{(\var{realm}, \var{uri}) -> (\var{user}, \var{password})} mappings. + A realm of \code{None} is considered a catch-all realm, which is searched + if no other realm fits. + \end{classdesc} + + \begin{classdesc}{AbstractBasicAuthHandler}{\optional{password_mgr}} + This is a mixin class that helps with HTTP authentication, both + to the remote host and to a proxy. + + \var{password_mgr} should be something that is compatible with + \class{HTTPPasswordMgr} --- supplies the documented interface above. + \end{classdesc} + + \begin{classdesc}{HTTPBasicAuthHandler}{\optional{password_mgr}} + Handle authentication with the remote host. + Valid \var{password_mgr}, if given, are the same as for + \class{AbstractBasicAuthHandler}. + \end{classdesc} + + \begin{classdesc}{ProxyBasicAuthHandler}{\optional{password_mgr}} + Handle authentication with the proxy. + Valid \var{password_mgr}, if given, are the same as for + \class{AbstractBasicAuthHandler}. + \end{classdesc} + + \begin{classdesc}{AbstractDigestAuthHandler}{\optional{password_mgr}} + This is a mixin class, that helps with HTTP authentication, both + to the remote host and to a proxy. + + \var{password_mgr} should be something that is compatible with + \class{HTTPPasswordMgr} --- supplies the documented interface above. + \end{classdesc} + + \begin{classdesc}{HTTPDigestAuthHandler}{\optional{password_mgr}} + Handle authentication with the remote host. + Valid \var{password_mgr}, if given, are the same as for + \class{AbstractBasicAuthHandler}. + \end{classdesc} + + \begin{classdesc}{ProxyDigestAuthHandler}{\optional{password_mgr}} + Handle authentication with the proxy. + \var{password_mgr}, if given, shoudl be the same as for + the constructor of \class{AbstractDigestAuthHandler}. + \end{classdesc} + + \begin{classdesc}{HTTPHandler}{} + A class to handle opening of HTTP URLs. + \end{classdesc} + + \begin{classdesc}{HTTPSHandler}{} + A class to handle opening of HTTPS URLs. + \end{classdesc} + + \begin{classdesc}{FileHandler}{} + Open local files. + \end{classdesc} + + \begin{classdesc}{FTPHandler}{} + Open FTP URLs. + \end{classdesc} + + \begin{classdesc}{CacheFTPHandler}{} + Open FTP URLs, keeping a cache of open FTP connections to minimize + delays. + \end{classdesc} + + \begin{classdesc}{GopherHandler}{} + Open gopher URLs. + \end{classdesc} + + \begin{classdesc}{UnknownHandler}{} + A catch-all class to handle unknown URLs. + \end{classdesc} + + + \subsection{Request Objects \label{request-objects}} + The following methods describe all of \class{Request}'s public interface, and so all must be overridden in subclasses. *************** *** 94,98 **** Set the \class{Request} data to \var{data} is ignored by all handlers except HTTP handlers --- and there it should be an ! \code{application/x-www-form-encoded} buffer, and will change the request to be \code{POST} rather then \code{GET}. \end{methoddesc} --- 210,214 ---- Set the \class{Request} data to \var{data} is ignored by all handlers except HTTP handlers --- and there it should be an ! \mimetype{application/x-www-form-encoded} buffer, and will change the request to be \code{POST} rather then \code{GET}. \end{methoddesc} *************** *** 107,116 **** \begin{methoddesc}[Request]{add_header}{key, val} ! Add another header to the request. Headers ! are currently ignored by all handlers except HTTP handlers, where they ! are added to the list of headers sent to the server. Note that there ! cannot be more then one header with the same name, and later calls ! will overwrite previous calls in case the \var{key} collides. Currently, ! this is no loss of HTTP functionality, since all headers which have meaning when used more then once have a (header-specific) way of gaining the same functionality using only one header. --- 223,232 ---- \begin{methoddesc}[Request]{add_header}{key, val} ! Add another header to the request. Headers are currently ignored by ! all handlers except HTTP handlers, where they are added to the list ! of headers sent to the server. Note that there cannot be more then ! one header with the same name, and later calls will overwrite ! previous calls in case the \var{key} collides. Currently, this is ! no loss of HTTP functionality, since all headers which have meaning when used more then once have a (header-specific) way of gaining the same functionality using only one header. *************** *** 122,126 **** \begin{methoddesc}[Request]{get_type}{} ! Return the type of the URL --- also known as the schema. \end{methoddesc} --- 238,242 ---- \begin{methoddesc}[Request]{get_type}{} ! Return the type of the URL --- also known as the scheme. \end{methoddesc} *************** *** 135,160 **** \begin{methoddesc}[Request]{set_proxy}{host, type} ! Make the request by connecting to a proxy server. The \var{host} and \var{type} ! will replace those of the instance, and the instance's selector will be ! the original URL given in the constructor. \end{methoddesc} - \begin{classdesc}{OpenerDirector}{} - The \class{OpenerDirector} class opens URLs via \class{BaseHandler}s chained - together. It manages the chaining of handlers, and recovery from errors. - \end{classdesc} \begin{methoddesc}[OpenerDirector]{add_handler}{handler} ! \var{handler} should be an instance of \class{BaseHandler}. The following ! methods are searched, and added to the possible chains. \begin{itemize} ! \item \code{{\em protocol}_open} --- signal that the handler knows how ! to open {\em protocol} URLs. ! \item \code{{\em protocol}_error_{\em type}} -- signal that the handler ! knows how to handle {\em type} ! errors from {\em protocol}. \end{itemize} - \end{methoddesc} --- 251,275 ---- \begin{methoddesc}[Request]{set_proxy}{host, type} ! Make the request by connecting to a proxy server. The \var{host} and ! \var{type} will replace those of the instance, and the instance's ! selector will be the original URL given in the constructor. \end{methoddesc} + \subsection{OpenerDirector Objects \label{opener-director-objects}} + + \class{OpenerDirector} instances have the following methods: + \begin{methoddesc}[OpenerDirector]{add_handler}{handler} ! \var{handler} should be an instance of \class{BaseHandler}. The ! following methods are searched, and added to the possible chains. \begin{itemize} ! \item \method{\var{protocol}_open()} --- ! signal that the handler knows how to open \var{protocol} URLs. ! \item \method{\var{protocol}_error_\var{type}()} --- ! signal that the handler knows how to handle \var{type} errors from ! \var{protocol}. \end{itemize} \end{methoddesc} *************** *** 172,180 **** optionally passing the given \var{data}. Arguments, return values and exceptions raised are the same as those ! of \function{urlopen} (which simply calls the \method{open()} method on the default installed \class{OpenerDirector}. \end{methoddesc} ! \begin{methoddesc}[OpenerDirector]{error}{proto\optional{, arg\optional{, ...}}} Handle an error in a given protocol. The HTTP protocol is special cased to use the code as the error. This will call the registered error handlers --- 287,296 ---- optionally passing the given \var{data}. Arguments, return values and exceptions raised are the same as those ! of \function{urlopen()} (which simply calls the \method{open()} method on the default installed \class{OpenerDirector}. \end{methoddesc} ! \begin{methoddesc}[OpenerDirector]{error}{proto\optional{, ! arg\optional{, \moreargs}}} Handle an error in a given protocol. The HTTP protocol is special cased to use the code as the error. This will call the registered error handlers *************** *** 182,193 **** Return values and exceptions raised are the same as those ! of \function{urlopen}. \end{methoddesc} - \begin{classdesc}{BaseHandler}{} - This is the base class for all registered handlers --- and handles only - the simple mechanics of registration. - \end{classdesc} \begin{methoddesc}[BaseHandler]{add_parent}{director} Add a director as parent. --- 298,311 ---- Return values and exceptions raised are the same as those ! of \function{urlopen()}. \end{methoddesc} + \subsection{BaseHandler Objects \label{base-handler-objects}} + + \class{BaseHandler} objects provide a couple of methods that are + directly useful, and others that are meant to be used by derived + classes. These are intended for direct use: + \begin{methoddesc}[BaseHandler]{add_parent}{director} Add a director as parent. *************** *** 198,345 **** \end{methoddesc} ! The following members and methods should be used only be classes derived ! from \class{BaseHandler}: \begin{memberdesc}[BaseHandler]{parent} ! A valid \class{OpenerDirector}, which can be used to open using a different ! protocol, or handle errors. \end{memberdesc} \begin{methoddesc}[BaseHandler]{default_open}{req} ! This method is {\em not} defined in \class{BaseHandler}, but subclasses ! should define it if they want to catch all URLs. ! This method, if exists, will be called by the \member{parent} ! \class{OpenerDirector}. It should return a file-like object as described ! in the return value of the \method{open} of \class{OpenerDirector} or ! \code{None}. It should raise \exception{URLError}, unless a truly exceptional ! thing happens (for example, \exception{MemoryError} should not be mapped ! to \exception{URLError}. This method will be called before any protocol-specific open method. \end{methoddesc} - - \begin{methoddesc}[BaseHandler]{{\em protocol}_open}{req} - This method is {\em not} defined in \class{BaseHandler}, but subclasses - should define it if they want to handle URLs with the given protocol. ! This method, if exists, will be called by the \member{parent} ! \class{OpenerDirector}. Return values should be the same as for ! \method{default_open}. \end{methoddesc} \begin{methoddesc}[BaseHandler]{unknown_open}{req} ! This method is {\em not} defined in \class{BaseHandler}, but subclasses ! should define it if they want to catch all URLs with no specific ! registerd handler to open it. This method, if exists, will be called by the \member{parent} ! \class{OpenerDirector}. Return values should be the same as for ! \method{default_open}. \end{methoddesc} \begin{methoddesc}[BaseHandler]{http_error_default}{req, fp, code, msg, hdrs} ! This method is {\em not} defined in \class{BaseHandler}, but subclasses ! should override it if they intend to provide a catch-all for otherwise ! unhandled HTTP errors. It will be called automatically by the ! \class{OpenerDirector} getting the error, and should not normally be called ! in other circumstances. ! ! \var{req} will be a \class{Request} object, \var{fp} will be a file-like ! object with the HTTP error body, \var{code} will be the three-digit code ! of the error, \var{msg} will be the user-visible explanation of the ! code and \var{hdrs} will be a dictionary-like object with the headers of ! the error. Return values and exceptions raised should be the same as those ! of \function{urlopen}. \end{methoddesc} ! \begin{methoddesc}[BaseHandler]{http_error_{\em nnn}}{req, fp, code, msg, hdrs} ! \code{nnn} should be a three-digit HTTP error code. This method is also ! not defined in \class{BaseHandler}, but will be called, if it exists, on ! an instance of a subclass, when an HTTP error with code \code{nnn} occurse. ! Subclasses should override this method to handle specific HTTP errors. ! Arguments, return values and exceptions raised shoudl be the same as for ! \method{http_error_default} \end{methoddesc} ! \begin{classdesc}{HTTPDefaultErrorHandler}{} ! A class which catches all HTTP errors. ! \end{classdesc} ! \begin{methoddesc}[HTTPDefaultErrorHandler]{http_error_default}{req, fp, code, ! msg, hdrs} ! Raise an \exception{HTTPError} ! \end{methoddesc} ! ! \begin{classdesc}{HTTPRedirectHandler}{} ! A class to handle redirections. ! \end{classdesc} ! \begin{methoddesc}[HTTPRedirectHandler]{http_error_301}{req, fp, code, ! msg, hdrs} ! Redirect to the \code{Location:} URL. This method gets called by ! the parent \class{OpenerDirector} when getting an HTTP permanent-redirect ! error. \end{methoddesc} ! \begin{methoddesc}[HTTPRedirectHandler]{http_error_302}{req, fp, code, ! msg, hdrs} ! The same as \method{http_error_301}. \end{methoddesc} - \strong{Note:} 303 redirection is not supported by this version of - \module{urllib2}. ! \begin{classdesc}{ProxyHandler}{\optional{proxies}} ! Cause requests to go through a proxy. ! If \var{proxies} is given, it must be a dictionary mapping ! protocol names to URLs of proxies. ! The default is to read the list of proxies from the environment ! variables \code{{\em protocol}_proxy}. ! \end{classdesc} ! \begin{methoddesc}[ProxyHandler]{{\em protocol}_open}{request} ! The \class{ProxyHandler} will have a method \code{{\em protocol}_open} for ! every {\em protocol} which has a proxy in the \var{proxies} dictionary ! given in the constructor. The method will modify requests to go ! through the proxy, by calling \code{request.set_proxy()}, and call the next ! handler in the chain to actually execute the protocol. \end{methoddesc} - \begin{classdesc}{HTTPPasswordMgr}{} - Keep a database of - \code{(\var{realm}, \var{uri}) -> (\var{user}, \var{password})} mapping. - \end{classdesc} ! \begin{methoddesc}[HTTPPasswordMgr]{add_password}{realm, uri, user, passwd} ! \var{uri} can be either a single URI, or a sequene of URIs. \var{realm}, ! \var{user} and \var{passwd} must be strings. This causes ! \code{(\var{user}, \var{passwd})} to be used as authentication tokens ! when authentication for \var{realm} and a super-URI of any of the ! given URIs is given. ! \end{methoddesc} ! ! \begin{methoddesc}[HTTPPasswordMgr]{find_user_password}{realm, authuri} ! Get user/password for given realm and URI, if any. This method will ! return \code{(None, None)} if there is no user/password is known. ! \end{methoddesc} ! \begin{classdesc}{HTTPPasswordMgrWithDefaultRealm}{} ! Keep a database of ! \code{(\var{realm}, \var{uri}) -> (\var{user}, \var{password})} mapping. ! A realm of \code{None} is considered a catch-all realm, which is searched ! if no other realm fits. ! \end{classdesc} ! \begin{methoddesc}[HTTPPasswordMgrWithDefaultRealm]{add_password} ! {realm, uri, user, passwd} \var{uri} can be either a single URI, or a sequene of URIs. \var{realm}, \var{user} and \var{passwd} must be strings. This causes ! \code{(\var{user}, \var{passwd})} to be used as authentication tokens when authentication for \var{realm} and a super-URI of any of the given URIs is given. --- 316,433 ---- \end{methoddesc} ! The following members and methods should be used only be classes ! derived from \class{BaseHandler}: \begin{memberdesc}[BaseHandler]{parent} ! A valid \class{OpenerDirector}, which can be used to open using a ! different protocol, or handle errors. \end{memberdesc} \begin{methoddesc}[BaseHandler]{default_open}{req} ! This method is \emph{not} defined in \class{BaseHandler}, but ! subclasses should define it if they want to catch all URLs. ! This method, if exists, will be called by the \member{parent} ! \class{OpenerDirector}. It should return a file-like object as ! described in the return value of the \method{open()} of ! \class{OpenerDirector} or \code{None}. It should raise ! \exception{URLError}, unless a truly exceptional thing happens (for ! example, \exception{MemoryError} should not be mapped to ! \exception{URLError}. This method will be called before any protocol-specific open method. \end{methoddesc} ! \begin{methoddesc}[BaseHandler]{\var{protocol}_open}{req} ! This method is \emph{not} defined in \class{BaseHandler}, but ! subclasses should define it if they want to handle URLs with the given ! protocol. ! ! This method, if defined, will be called by the \member{parent} ! \class{OpenerDirector}. Return values should be the same as for ! \method{default_open()}. \end{methoddesc} \begin{methoddesc}[BaseHandler]{unknown_open}{req} ! This method is \var{not} defined in \class{BaseHandler}, but ! subclasses should define it if they want to catch all URLs with no ! specific registerd handler to open it. This method, if exists, will be called by the \member{parent} ! \class{OpenerDirector}. Return values should be the same as for ! \method{default_open()}. \end{methoddesc} \begin{methoddesc}[BaseHandler]{http_error_default}{req, fp, code, msg, hdrs} ! This method is \emph{not} defined in \class{BaseHandler}, but ! subclasses should override it if they intend to provide a catch-all ! for otherwise unhandled HTTP errors. It will be called automatically ! by the \class{OpenerDirector} getting the error, and should not ! normally be called in other circumstances. ! ! \var{req} will be a \class{Request} object, \var{fp} will be a ! file-like object with the HTTP error body, \var{code} will be the ! three-digit code of the error, \var{msg} will be the user-visible ! explanation of the code and \var{hdrs} will be a mapping object with ! the headers of the error. Return values and exceptions raised should be the same as those ! of \function{urlopen()}. \end{methoddesc} ! \begin{methoddesc}[BaseHandler]{http_error_\var{nnn}}{req, fp, code, msg, hdrs} ! \var{nnn} should be a three-digit HTTP error code. This method is ! also not defined in \class{BaseHandler}, but will be called, if it ! exists, on an instance of a subclass, when an HTTP error with code ! \var{nnn} occurs. ! Subclasses should override this method to handle specific HTTP ! errors. ! Arguments, return values and exceptions raised should be the same as ! for \method{http_error_default()}. \end{methoddesc} ! \subsection{HTTPRedirectHandler Objects \label{http-redirect-handler}} ! \strong{Note:} 303 redirection is not supported by this version of ! \module{urllib2}. ! \begin{methoddesc}[HTTPRedirectHandler]{http_error_301}{req, ! fp, code, msg, hdrs} ! Redirect to the \code{Location:} URL. This method is called by ! the parent \class{OpenerDirector} when getting an HTTP ! permanent-redirect response. \end{methoddesc} ! \begin{methoddesc}[HTTPRedirectHandler]{http_error_302}{req, ! fp, code, msg, hdrs} ! The same as \method{http_error_301()}, but called for the ! temporary-redirect response. \end{methoddesc} ! \subsection{ProxyHandler Objects \label{proxy-handler}} ! \begin{methoddesc}[ProxyHandler]{\var{protocol}_open}{request} ! The \class{ProxyHandler} will have a method ! \method{\var{protocol}_open()} for every \var{protocol} which has a ! proxy in the \var{proxies} dictionary given in the constructor. The ! method will modify requests to go through the proxy, by calling ! \code{request.set_proxy()}, and call the next handler in the chain to ! actually execute the protocol. \end{methoddesc} ! \subsection{HTTPPasswordMgr Objects \label{http-password-mgr}} ! These methods are available on \class{HTTPPasswordMgr} and ! \class{HTTPPasswordMgrWithDefaultRealm} objects. ! \begin{methoddesc}[HTTPPasswordMgr]{add_password}{realm, uri, user, passwd} \var{uri} can be either a single URI, or a sequene of URIs. \var{realm}, \var{user} and \var{passwd} must be strings. This causes ! \code{(\var{user}, \var{passwd})} to be used as authentication tokens when authentication for \var{realm} and a super-URI of any of the given URIs is given. *************** *** 347,363 **** \begin{methoddesc}[HTTPPasswordMgr]{find_user_password}{realm, authuri} ! Get user/password for given realm and URI, if any. This method will ! return \code{(None, None)} if there is no user/password is known. ! If the given \var{realm} has no user/password, the realm \code{None} ! will be searched. \end{methoddesc} - \begin{classdesc}[AbstractBasicAuthHandler]{\optional{password_mgr}} - This is a mixin class, that helps with HTTP authentication, both - to the remote host and to a proxy. ! \var{password_mgr} should be something that is compatible with ! \class{HTTPPasswordMgr} --- supplies the documented interface above. ! \end{classdesc} \begin{methoddesc}[AbstractBasicAuthHandler]{handle_authentication_request} --- 435,449 ---- \begin{methoddesc}[HTTPPasswordMgr]{find_user_password}{realm, authuri} ! Get user/password for given realm and URI, if any. This method will ! return \code{(None, None)} if there is no matching user/password. ! ! For \class{HTTPPasswordMgrWithDefaultRealm} objects, the realm ! \code{None} will be searched if the given \var{realm} has no matching ! user/password. \end{methoddesc} ! \subsection{AbstractBasicAuthHandler Objects ! \label{abstract-basic-auth-handler}} \begin{methoddesc}[AbstractBasicAuthHandler]{handle_authentication_request} *************** *** 369,377 **** \end{methoddesc} ! \begin{classdesc}{HTTPBasicAuthHandler}{\optional{password_mgr}} ! Handle authentication with the remote host. ! Valid \var{password_mgr}, if given, are the same as for ! \class{AbstractBasicAuthHandler}. ! \end{classdesc} \begin{methoddesc}[HTTPBasicAuthHandler]{http_error_401}{req, fp, code, --- 455,461 ---- \end{methoddesc} ! ! \subsection{HTTPBasicAuthHandler Objects ! \label{http-basic-auth-handler}} \begin{methoddesc}[HTTPBasicAuthHandler]{http_error_401}{req, fp, code, *************** *** 380,389 **** \end{methoddesc} - \begin{classdesc}{ProxyBasicAuthHandler}{\optional{password_mgr}} - Handle authentication with the proxy. - Valid \var{password_mgr}, if given, are the same as for - \class{AbstractBasicAuthHandler}. - \end{classdesc} \begin{methoddesc}[ProxyBasicAuthHandler]{http_error_407}{req, fp, code, msg, hdrs} --- 464,471 ---- \end{methoddesc} + \subsection{ProxyBasicAuthHandler Objects + \label{proxy-basic-auth-handler}} + \begin{methoddesc}[ProxyBasicAuthHandler]{http_error_407}{req, fp, code, msg, hdrs} *************** *** 391,403 **** \end{methoddesc} - \begin{classdesc}{AbstractDigestAuthHandler}{\optional{password_mgr}} - This is a mixin class, that helps with HTTP authentication, both - to the remote host and to a proxy. ! \var{password_mgr} should be something that is compatible with ! \class{HTTPPasswordMgr} --- supplies the documented interface above. ! \end{classdesc} ! \begin{methoddesc}[AbstractBasicAuthHandler]{handle_authentication_request} {authreq, host, req, headers} \var{authreq} should be the name of the header where the information about --- 473,481 ---- \end{methoddesc} ! \subsection{AbstractDigestAuthHandler Objects ! \label{abstract-digest-auth-handler}} ! \begin{methoddesc}[AbstractDigestAuthHandler]{handle_authentication_request} {authreq, host, req, headers} \var{authreq} should be the name of the header where the information about *************** *** 407,415 **** \end{methoddesc} ! \begin{classdesc}{HTTPDigestAuthHandler}{\optional{password_mgr}} ! Handle authentication with the remote host. ! Valid \var{password_mgr}, if given, are the same as for ! \class{AbstractBasicAuthHandler}. ! \end{classdesc} \begin{methoddesc}[HTTPDigestAuthHandler]{http_error_401}{req, fp, code, --- 485,491 ---- \end{methoddesc} ! ! \subsection{HTTPDigestAuthHandler Objects ! \label{http-digest-auth-handler}} \begin{methoddesc}[HTTPDigestAuthHandler]{http_error_401}{req, fp, code, *************** *** 418,473 **** \end{methoddesc} - \begin{classdesc}{ProxyDigestAuthHandler}{\optional{password_mgr}} - Handle authentication with the proxy. - \var{password_mgr}, if given, shoudl be the same as for - the constructor of \class{AbstractDigestAuthHandler}. - \end{classdesc} \begin{methoddesc}[ProxyDigestAuthHandler]{http_error_407}{req, fp, code, msg, hdrs} ! Retry the request with authentication info, if available. \end{methoddesc} - \begin{classdesc}{HTTPHandler}{} - A class to handle opening of HTTP URLs - \end{classdesc} \begin{methoddesc}[HTTPHandler]{http_open}{req} ! Send an HTTP request (either GET or POST, depending on whether ! \code{req.has_data()}. \end{methoddesc} - \begin{classdesc}{HTTPSHandler}{} - A class to handle opening of HTTPS URLs - \end{classdesc} \begin{methoddesc}[HTTPSHandler]{https_open}{req} ! Send an HTTPS request (either GET or POST, depending on whether ! \code{req.has_data()}. \end{methoddesc} - \begin{classdesc}{UknownHandler}{} - A catch-all class to handle unknown URLs. - \end{classdesc} ! \begin{methoddesc}[UknownHandler]{unknown_open} ! Raise a \exception{URLError} exception ! \end{methoddesc} ! ! \begin{classdesc}{FileHandler}{} ! Open local files. ! \end{classdesc} \begin{methoddesc}[FileHandler]{file_open}{req} Open the file locally, if there is no host name, or ! the host name is \code{"localhost"}. Change the protocol to \code{ftp} otherwise, and retry opening it using \member{parent}. \end{methoddesc} - \begin{classdesc}{FTPHandler}{} - Open FTP URLs. - \end{classdesc} \begin{methoddesc}[FTPHandler]{ftp_open}{req} Open the FTP file indicated by \var{req}. --- 494,535 ---- \end{methoddesc} + \subsection{ProxyDigestAuthHandler Objects + \label{proxy-digest-auth-handler}} + \begin{methoddesc}[ProxyDigestAuthHandler]{http_error_407}{req, fp, code, msg, hdrs} ! Retry the request with authentication information, if available. \end{methoddesc} + \subsection{HTTPHandler Objects \label{http-handler-objects}} + \begin{methoddesc}[HTTPHandler]{http_open}{req} ! Send an HTTP request, whcih can be either GET or POST, depending on ! \code{\var{req}.has_data()}. \end{methoddesc} + \subsection{HTTPSHandler Objects \label{https-handler-objects}} + \begin{methoddesc}[HTTPSHandler]{https_open}{req} ! Send an HTTPS request, which can be either GET or POST, depending on ! \code{\var{req}.has_data()}. \end{methoddesc} ! \subsection{FileHandler Objects \label{file-handler-objects}} \begin{methoddesc}[FileHandler]{file_open}{req} Open the file locally, if there is no host name, or ! the host name is \code{'localhost'}. Change the protocol to \code{ftp} otherwise, and retry opening it using \member{parent}. \end{methoddesc} + \subsection{FTPHandler Objects \label{ftp-handler-objects}} + \begin{methoddesc}[FTPHandler]{ftp_open}{req} Open the FTP file indicated by \var{req}. *************** *** 475,487 **** \end{methoddesc} - \begin{classdesc}{CacheFTPHandler}{} - Open FTP URLs, keeping a cache of open FTP connections to minimize - delays. - \end{classdesc} ! \begin{methoddesc}[CacheFTPHandler]{ftp_open}{req} ! Open the FTP file indicated by \var{req}. ! The login is always done with empty username and password. ! \end{methoddesc} \begin{methoddesc}[CacheFTPHandler]{setTimeout}{t} --- 537,545 ---- \end{methoddesc} ! \subsection{CacheFTPHandler Objects \label{cacheftp-handler-objects}} ! ! \class{CacheFTPHandler} objects are \class{FTPHandler} objects with ! the following additional methods: \begin{methoddesc}[CacheFTPHandler]{setTimeout}{t} *************** *** 493,501 **** \end{methoddesc} - \begin{classdesc}{GopherHandler}{} - Open gopher URLs. - \end{classdesc} \begin{methoddesc}[GopherHandler]{gopher_open}{req} Open the gopher resource indicated by \var{req}. \end{methoddesc} --- 551,565 ---- \end{methoddesc} + \subsection{GopherHandler Objects \label{gopher-handler}} + \begin{methoddesc}[GopherHandler]{gopher_open}{req} Open the gopher resource indicated by \var{req}. + \end{methoddesc} + + + \subsection{UnknownHandler Objects \label{unknown-handler-objects}} + + \begin{methoddesc}[UnknownHandler]{unknown_open} + Raise a \exception{URLError} exception. \end{methoddesc} From fdrake@users.sourceforge.net Fri Mar 2 21:06:01 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 02 Mar 2001 13:06:01 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/tools push-docs.sh,1.3,1.4 update-docs.sh,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv24749 Modified Files: push-docs.sh update-docs.sh Log Message: Revise the scripts I use to update the documentation on the SourceForge site. These now seem (slightly) more reliable, and easier to work with since update-docs.sh no longer needs to be installed ahead of time on my account at SF. Index: push-docs.sh =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/push-docs.sh,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** push-docs.sh 2000/11/30 07:38:58 1.3 --- push-docs.sh 2001/03/02 21:05:58 1.4 *************** *** 4,11 **** # update-docs.sh script unpacks them into their final destination. ! TARGET=python.sourceforge.net:/home/users/fdrake ! if [ "$1" ] ; then ! scp "$1" $TARGET/python-docs-update.txt || exit $? fi --- 4,22 ---- # update-docs.sh script unpacks them into their final destination. ! TARGET=python.sourceforge.net:/home/users/fdrake/tmp ! ADDRESSES='python-dev@python.org doc-sig@python.org python-list@python.org' ! ! ! set -x ! ! EXPLANATION='' ! ! if [ "$1" = '-m' ] ; then ! EXPLANATION="$2" ! shift 2 ! elif [ "$1" ] ; then ! EXPLANATION="`cat $1`" ! shift 1 fi *************** *** 14,23 **** cd "$MYDIR" MYDIR="`pwd`" - HTMLDIR="${HTMLDIR:-html}" - cd "../$HTMLDIR" - make --no-print-directory || exit $? cd .. RELEASE=`grep '^RELEASE=' Makefile | sed 's|RELEASE=||'` ! make --no-print-directory HTMLDIR="$HTMLDIR" bziphtml ! scp "html-$RELEASE.tar.bz2" $TARGET/python-docs-update.tar.bz2 --- 25,45 ---- cd "$MYDIR" MYDIR="`pwd`" cd .. + + # now in .../Doc/ + make --no-print-directory || exit $? + make --no-print-directory bziphtml || exit $? RELEASE=`grep '^RELEASE=' Makefile | sed 's|RELEASE=||'` ! scp "html-$RELEASE.tar.bz2" $TARGET/python-docs-update.tar.bz2 || exit $? ! scp tools/update-docs.sh $TARGET/update-docs.sh || exit $? ! ssh python.sourceforge.net 'tmp/update-docs.sh && rm tmp/update-docs.sh' || exit $? ! ! Mail -s '[development doc updates]' $ADDRESSES < Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv5544 Modified Files: pep-0226.txt Log Message: Update release status. Close several open issues. Index: pep-0226.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0226.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** pep-0226.txt 2001/02/10 00:19:20 1.5 --- pep-0226.txt 2001/03/02 22:57:05 1.6 *************** *** 22,26 **** Tentative future release dates - 01-Mar-2001: First 2.1 beta release XX-Mar-2001: Second beta as needed 13-Apr-2001: 2.1 final release --- 22,25 ---- *************** *** 28,45 **** Past release dates: ! 01-Feb-2001: Python 2.1 alpha 2 release 22-Jan-2001: Python 2.1 alpha 1 release 16-Oct-2000: Python 2.0 final release ! Open issues for Python 2.0 beta 1 ! ! Include Vladimir Marangozov's memory allocator as an optional ! feature. It would normally be disabled, but could be enable at ! configure time. ! ! Fix the compiler to raise SyntaxErrors with full tracebacks. ! ! Resolve import issues on case-insensitive, case-preserving file ! systems. Add a default unit testing framework to the standard library. --- 27,36 ---- Past release dates: ! 02-Mar-2001: First 2.1 beta release ! 02-Feb-2001: Python 2.1 alpha 2 release 22-Jan-2001: Python 2.1 alpha 1 release 16-Oct-2000: Python 2.0 final release ! Open issues for Python 2.0 beta 2 Add a default unit testing framework to the standard library. From ping@users.sourceforge.net Fri Mar 2 23:31:46 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Fri, 02 Mar 2001 15:31:46 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib os.py,1.44,1.45 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv23495 Modified Files: os.py Log Message: Use r""" instead of """ for the docstring so that backslashes are preserved. Index: os.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/os.py,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -r1.44 -r1.45 *** os.py 2001/03/02 07:04:51 1.44 --- os.py 2001/03/02 23:31:43 1.45 *************** *** 1,3 **** ! """OS routines for Mac, DOS, NT, or Posix depending on what system we're on. This exports: --- 1,3 ---- ! r"""OS routines for Mac, DOS, NT, or Posix depending on what system we're on. This exports: From bwarsaw@users.sourceforge.net Sat Mar 3 04:14:23 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Fri, 02 Mar 2001 20:14:23 -0800 Subject: [Python-checkins] CVS: python/dist/src Makefile.pre.in,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv2032 Modified Files: Makefile.pre.in Log Message: Added `memtest' target which excludes the quicktest modules plus test_dl, test___all__, test_fork1, and test_longexp. All these either take way too long with Insure or crash it. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -r1.27 -r1.28 *** Makefile.pre.in 2001/03/01 00:36:53 1.27 --- Makefile.pre.in 2001/03/03 04:14:21 1.28 *************** *** 474,477 **** --- 474,484 ---- PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS) + MEMTESTOPTS= $(QUICKTESTOPTS) -x test_dl test___all__ test_fork1 \ + test_longexp + memtest: all platform + -rm -f $(srcdir)/Lib/test/*.py[co] + -PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS) + PYTHONPATH= $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS) + # Install everything install: altinstall bininstall maninstall From fdrake@users.sourceforge.net Sat Mar 3 18:08:54 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Sat, 03 Mar 2001 10:08:54 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules termios.c,2.18,2.19 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv17494 Modified Files: termios.c Log Message: Wrap several more of the constants in #ifdef/#endif for FreeBSD; at least some fairly recent versions have an anaemic selection of terminal-control symbols. This closes SF bug #405567. Index: termios.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/termios.c,v retrieving revision 2.18 retrieving revision 2.19 diff -C2 -r2.18 -r2.19 *** termios.c 2001/03/02 06:50:58 2.18 --- termios.c 2001/03/03 18:08:52 2.19 *************** *** 359,363 **** --- 359,365 ---- {"IGNCR", IGNCR}, {"ICRNL", ICRNL}, + #ifdef IUCLC {"IUCLC", IUCLC}, + #endif {"IXON", IXON}, {"IXANY", IXANY}, *************** *** 367,404 **** --- 369,462 ---- /* struct termios.c_oflag constants */ {"OPOST", OPOST}, + #ifdef OLCUC {"OLCUC", OLCUC}, + #endif {"ONLCR", ONLCR}, + #ifdef OCRNL {"OCRNL", OCRNL}, + #endif + #ifdef ONOCR {"ONOCR", ONOCR}, + #endif + #ifdef ONLRET {"ONLRET", ONLRET}, + #endif + #ifdef OFILL {"OFILL", OFILL}, + #endif + #ifdef OFDEL {"OFDEL", OFDEL}, + #endif + #ifdef NLDLY {"NLDLY", NLDLY}, + #endif + #ifdef CRDLY {"CRDLY", CRDLY}, + #endif + #ifdef TABDLY {"TABDLY", TABDLY}, + #endif + #ifdef BSDLY {"BSDLY", BSDLY}, + #endif + #ifdef VTDLY {"VTDLY", VTDLY}, + #endif + #ifdef FFDLY {"FFDLY", FFDLY}, + #endif /* struct termios.c_oflag-related values (delay mask) */ + #ifdef NL0 {"NL0", NL0}, + #endif + #ifdef NL1 {"NL1", NL1}, + #endif + #ifdef CR0 {"CR0", CR0}, + #endif + #ifdef CR1 {"CR1", CR1}, + #endif + #ifdef CR2 {"CR2", CR2}, + #endif + #ifdef CR3 {"CR3", CR3}, + #endif + #ifdef TAB0 {"TAB0", TAB0}, + #endif + #ifdef TAB1 {"TAB1", TAB1}, + #endif + #ifdef TAB2 {"TAB2", TAB2}, + #endif + #ifdef TAB3 {"TAB3", TAB3}, + #endif #ifdef XTABS {"XTABS", XTABS}, #endif + #ifdef BS0 {"BS0", BS0}, + #endif + #ifdef BS1 {"BS1", BS1}, + #endif + #ifdef VT0 {"VT0", VT0}, + #endif + #ifdef VT1 {"VT1", VT1}, + #endif + #ifdef FF0 {"FF0", FF0}, + #endif + #ifdef FF1 {"FF1", FF1}, + #endif /* struct termios.c_cflag constants */ From fdrake@users.sourceforge.net Sat Mar 3 19:18:03 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Sat, 03 Mar 2001 11:18:03 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/inst inst.tex,1.29,1.30 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/inst In directory usw-pr-cvs1:/tmp/cvs-serv27193/inst Modified Files: inst.tex Log Message: Rene Liebscher : Added information on using non-Microsoft compilers on Windows. [Minor edits for markup consistency. --FLD] Index: inst.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/inst/inst.tex,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -r1.29 -r1.30 *** inst.tex 2001/03/01 18:37:52 1.29 --- inst.tex 2001/03/03 19:18:01 1.30 *************** *** 429,437 **** ! \subsection{Using non-Microsoft compilers on Windows} ! \label{non-ms-compilers} \XXX{One place to look: \url{http://www.cyberus.ca/~g_will/pyExtenDL.shtml}} --- 429,547 ---- ! \subsection{Using non-Microsoft compilers on Windows \label{non-ms-compilers}} ! \sectionauthor{Rene Liebscher}{R.Liebscher@gmx.de} + \subsubsection{Borland C++} + + This subsection describes the necessary steps to use Distutils with the + Borland C++ compiler version + 5.5.\footnote{Check + \url{http://www.borland.com/bcppbuilder/freecompiler/} for download} + %Should we mention that users have to create cfg-files for the compiler + %see also http://community.borland.com/article/0,1410,21205,00.html + + First you have to know that the Borland's object file format(OMF) is + different from what is used by the Python version you can download + from the Python web site. (Python is built with Microsoft Visual C++, + which uses COFF as object file format.) For this reason you have to + convert Python's library \file{python20.lib} into the Borland format. + You can do this as follows: + + \begin{verbatim} + coff2omf python20.lib python20_bcpp.lib + \end{verbatim} + + The \file{coff2omf} program comes with the Borland compiler. The file + \file{python20.lib} is in the \file{Libs} directory of your Python + installation. If your extension uses other libraries (zlib,...) you + have to convert them too. + + The converted files have to reside in the same directories as the normal + libraries do. + + How does Distutils manage to use these libraries with their changed + names? If the extension needs a library (eg. \file{foo}) Distutils + checks first if it finds a library with suffix \file{_bcpp} + (eg. \file{foo_bcpp.lib}) and then uses this library. In the case it + doesn't find such a special library it uses the default name + (\file{foo.lib}.)\footnote{This also means you could replace all + existing COFF-libraries with OMF-libraries of the same name.} + + To let Distutils compile your extension with Borland C++ you now have + to type: + + \begin{verbatim} + python setup.py build --compiler=bcpp + \end{verbatim} + + If you want to use the Borland \Cpp{} compiler as default, you should + consider to write it in your personal or system-wide configuration + file for Distutils (see section~\ref{config-files}.) + \XXX{One place to look: \url{http://www.cyberus.ca/~g_will/pyExtenDL.shtml}} + + \subsubsection{GNU C / Cygwin / MinGW32} + + This section describes the necessary steps to use Distutils with the + GNU C/C++ compilers in their Cygwin and MinGW32 + distributions\footnote{Check + \url{http://sources.redhat.com/cygwin/} and + \url{http://www.mingw.org} for more information}. + + \XXX{For a Python which was built with Cygwin, all should work without + any of these following steps.} + + For these compilers we have to create some special libraries too. + This task is more complex as for Borland's C++, because there is no + program to convert the library (inclusive the references on data structures.) + + First you have to create a list of symbols which the Python DLL exports. + (You can find a good program for this task at + \url{http://starship.python.net/crew/kernr/mingw32/Notes.html}, see at + PExports 0.42h there.) + + \begin{verbatim} + pexports python20.dll >python20.def + \end{verbatim} + + Then you can create from these information an import library for gcc. + + \begin{verbatim} + dlltool --dllname python20.dll --def python20.def --output-lib libpython20.a + \end{verbatim} + The resulting library has to be placed in the same directory as + \file{python20.lib}. (Should be the \file{libs} directory under your + Python installation directory.) + + If your extension uses other libraries (zlib,...) you might + have to convert them too. + The converted files have to reside in the same directories as the normal + libraries do. + + To let Distutils compile your extension with Cygwin you now have to type + + \begin{verbatim} + python setup.py build --compiler=cygwin + \end{verbatim} + + and for Cygwin in no-cygwin mode\footnote{Then you have no POSIX emulation + available, but you also don't need \file{cygwin1.dll}.} or for MinGW32 type + + \begin{verbatim} + python setup.py build --compiler=mingw32 + \end{verbatim} + + If you want to use any of these options/compilers as default, you should + consider to write it in your personal or system-wide configuration file + for Distutils (see section~\ref{config-files}.) + + \XXX{One place to look: \url{http://www.zope.org/Members/als/tips/win32_mingw_modules}} + + \XXX{For converted import libraries for python20, tcl83 and tk83 in + cygwin/mingw32 and bcpp format, see + \url{http://www.htw-dresden.de/~liebschr/PyOpenGL/py2.0-libs.tgz} + and for the missing header files of the in python2.0 included tcl/tk, + see \url{http://www.htw-dresden.de/\%7Eliebschr/PyOpenGL/py2.0-tk8.3-header.tgz}.} From fdrake@users.sourceforge.net Sat Mar 3 19:41:58 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Sat, 03 Mar 2001 11:41:58 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules unicodedata.c,2.11,2.12 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv30269 Modified Files: unicodedata.c Log Message: Be a bit more strict in setting up the export of the C API for this module; do not attempt to insert the API object into the module dict if there was an error creating it. Index: unicodedata.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/unicodedata.c,v retrieving revision 2.11 retrieving revision 2.12 diff -C2 -r2.11 -r2.12 *** unicodedata.c 2001/02/18 22:06:17 2.11 --- unicodedata.c 2001/03/03 19:41:55 2.12 *************** *** 464,470 **** PyObject *m, *d, *v; ! m = Py_InitModule4( ! "unicodedata", unicodedata_functions, ! unicodedata_docstring, NULL, PYTHON_API_VERSION); if (!m) return; --- 464,469 ---- PyObject *m, *d, *v; ! m = Py_InitModule3( ! "unicodedata", unicodedata_functions, unicodedata_docstring); if (!m) return; *************** *** 476,481 **** /* Export C API */ v = PyCObject_FromVoidPtr((void *) &hashAPI, NULL); ! PyDict_SetItemString(d, "ucnhash_CAPI", v); ! Py_XDECREF(v); ! } --- 475,481 ---- /* Export C API */ v = PyCObject_FromVoidPtr((void *) &hashAPI, NULL); ! if (v != NULL) { ! PyDict_SetItemString(d, "ucnhash_CAPI", v); ! Py_DECREF(v); ! } } From fdrake@users.sourceforge.net Sat Mar 3 19:47:26 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Sat, 03 Mar 2001 11:47:26 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/inst inst.tex,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/inst In directory usw-pr-cvs1:/tmp/cvs-serv30946/inst Modified Files: inst.tex Log Message: Fix a few minor markup nits. Index: inst.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/inst/inst.tex,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -r1.30 -r1.31 *** inst.tex 2001/03/03 19:18:01 1.30 --- inst.tex 2001/03/03 19:47:24 1.31 *************** *** 292,296 **** \file{lib} directory, is used for ``pure module distributions''---that is, module distributions that include only pure Python modules. If a ! module distribution contains any extensions (modules written in C/C++), then the second form, with two \code{} directories, is used. In that case, the \file{temp.\filevar{plat}} directory holds temporary --- 292,296 ---- \file{lib} directory, is used for ``pure module distributions''---that is, module distributions that include only pure Python modules. If a ! module distribution contains any extensions (modules written in C/\Cpp), then the second form, with two \code{} directories, is used. In that case, the \file{temp.\filevar{plat}} directory holds temporary *************** *** 435,440 **** This subsection describes the necessary steps to use Distutils with the ! Borland C++ compiler version ! 5.5.\footnote{Check \url{http://www.borland.com/bcppbuilder/freecompiler/} for download} %Should we mention that users have to create cfg-files for the compiler --- 435,439 ---- This subsection describes the necessary steps to use Distutils with the ! Borland \Cpp{} compiler version 5.5.\footnote{Check \url{http://www.borland.com/bcppbuilder/freecompiler/} for download} %Should we mention that users have to create cfg-files for the compiler *************** *** 443,447 **** First you have to know that the Borland's object file format(OMF) is different from what is used by the Python version you can download ! from the Python web site. (Python is built with Microsoft Visual C++, which uses COFF as object file format.) For this reason you have to convert Python's library \file{python20.lib} into the Borland format. --- 442,446 ---- First you have to know that the Borland's object file format(OMF) is different from what is used by the Python version you can download ! from the Python web site. (Python is built with Microsoft Visual \Cpp, which uses COFF as object file format.) For this reason you have to convert Python's library \file{python20.lib} into the Borland format. *************** *** 457,462 **** have to convert them too. ! The converted files have to reside in the same directories as the normal ! libraries do. How does Distutils manage to use these libraries with their changed --- 456,461 ---- have to convert them too. ! The converted files have to reside in the same directories as the ! normal libraries. How does Distutils manage to use these libraries with their changed *************** *** 468,472 **** existing COFF-libraries with OMF-libraries of the same name.} ! To let Distutils compile your extension with Borland C++ you now have to type: --- 467,471 ---- existing COFF-libraries with OMF-libraries of the same name.} ! To let Distutils compile your extension with Borland \Cpp{} you now have to type: *************** *** 485,492 **** This section describes the necessary steps to use Distutils with the ! GNU C/C++ compilers in their Cygwin and MinGW32 ! distributions\footnote{Check \url{http://sources.redhat.com/cygwin/} and ! \url{http://www.mingw.org} for more information}. \XXX{For a Python which was built with Cygwin, all should work without --- 484,491 ---- This section describes the necessary steps to use Distutils with the ! GNU C/\Cpp{} compilers in their Cygwin and MinGW32 ! distributions.\footnote{Check \url{http://sources.redhat.com/cygwin/} and ! \url{http://www.mingw.org} for more information} \XXX{For a Python which was built with Cygwin, all should work without *************** *** 494,504 **** For these compilers we have to create some special libraries too. ! This task is more complex as for Borland's C++, because there is no ! program to convert the library (inclusive the references on data structures.) First you have to create a list of symbols which the Python DLL exports. (You can find a good program for this task at \url{http://starship.python.net/crew/kernr/mingw32/Notes.html}, see at ! PExports 0.42h there.) \begin{verbatim} --- 493,504 ---- For these compilers we have to create some special libraries too. ! This task is more complex as for Borland's \Cpp, because there is no ! program to convert the library (inclusive the references on data ! structures.) First you have to create a list of symbols which the Python DLL exports. (You can find a good program for this task at \url{http://starship.python.net/crew/kernr/mingw32/Notes.html}, see at ! PExports 0.42h there.) \begin{verbatim} From fdrake@users.sourceforge.net Sat Mar 3 19:57:28 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Sat, 03 Mar 2001 11:57:28 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/tools push-docs.sh,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv31981/tools Modified Files: push-docs.sh Log Message: Remove debugging "set -x". Index: push-docs.sh =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/push-docs.sh,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** push-docs.sh 2001/03/02 21:05:58 1.4 --- push-docs.sh 2001/03/03 19:57:26 1.5 *************** *** 8,14 **** ADDRESSES='python-dev@python.org doc-sig@python.org python-list@python.org' - - set -x - EXPLANATION='' --- 8,11 ---- From tim_one@users.sourceforge.net Sun Mar 4 00:30:27 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sat, 03 Mar 2001 16:30:27 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_inspect.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv1906/python/dist/src/lib/test Modified Files: test_inspect.py Log Message: Clean up junk files left behind by imp.load_source(). Index: test_inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_inspect.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** test_inspect.py 2001/03/02 05:48:10 1.2 --- test_inspect.py 2001/03/04 00:30:25 1.3 *************** *** 76,80 **** --- 76,82 ---- file.close() + # Note that load_source creates file TESTFN+'c' or TESTFN+'o'. mod = imp.load_source('testmod', TESTFN) + files_to_clean_up = [TESTFN, TESTFN + 'c', TESTFN + 'o'] def istest(func, exp): *************** *** 205,207 **** 'mod.fr.f_back formatted argvalues') ! os.unlink(TESTFN) --- 207,213 ---- 'mod.fr.f_back formatted argvalues') ! for fname in files_to_clean_up: ! try: ! os.unlink(fname) ! except: ! pass From nascheme@users.sourceforge.net Sun Mar 4 06:39:35 2001 From: nascheme@users.sourceforge.net (Neil Schemenauer) Date: Sat, 03 Mar 2001 22:39:35 -0800 Subject: [Python-checkins] CVS: python/dist/src configure,1.199,1.200 configure.in,1.207,1.208 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv7037 Modified Files: configure configure.in Log Message: Add Python/ prefix to files in LIBOBJS. This closes SF bug "[ #404827 ] Python Makefile: LIBOBJS incorrect". Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.199 retrieving revision 1.200 diff -C2 -r1.199 -r1.200 *** configure 2001/02/27 04:45:05 1.199 --- configure 2001/03/04 06:39:33 1.200 *************** *** 1,5 **** #! /bin/sh ! # From configure.in Revision: 1.206 # Guess values for system-dependent variables and create Makefiles. --- 1,5 ---- #! /bin/sh ! # From configure.in Revision: 1.207 # Guess values for system-dependent variables and create Makefiles. *************** *** 3420,3424 **** EOF ! LIBOBJS="$LIBOBJS Python/thread.o" else echo "$ac_t""no" 1>&6 --- 3420,3424 ---- EOF ! LIBOBJS="$LIBOBJS thread.o" else echo "$ac_t""no" 1>&6 *************** *** 3440,3444 **** LIBS="-lpth $LIBS" ! LIBOBJS="$LIBOBJS Python/thread.o" else --- 3440,3444 ---- LIBS="-lpth $LIBS" ! LIBOBJS="$LIBOBJS thread.o" else *************** *** 3488,3492 **** LIBS="-lpthread $LIBS" ! LIBOBJS="$LIBOBJS Python/thread.o" else echo "$ac_t""no" 1>&6 --- 3488,3492 ---- LIBS="-lpthread $LIBS" ! LIBOBJS="$LIBOBJS thread.o" else echo "$ac_t""no" 1>&6 *************** *** 3546,3550 **** ;; esac ! LIBOBJS="$LIBOBJS Python/thread.o" else echo "$ac_t""no" 1>&6 --- 3546,3550 ---- ;; esac ! LIBOBJS="$LIBOBJS thread.o" else echo "$ac_t""no" 1>&6 *************** *** 3586,3590 **** EOF ! LIBOBJS="$LIBOBJS Python/thread.o" else echo "$ac_t""no" 1>&6 --- 3586,3590 ---- EOF ! LIBOBJS="$LIBOBJS thread.o" else echo "$ac_t""no" 1>&6 *************** *** 3634,3638 **** LIBS="$LIBS -lpthreads" ! LIBOBJS="$LIBOBJS Python/thread.o" else echo "$ac_t""no" 1>&6 --- 3634,3638 ---- LIBS="$LIBS -lpthreads" ! LIBOBJS="$LIBOBJS thread.o" else echo "$ac_t""no" 1>&6 *************** *** 3682,3686 **** LIBS="$LIBS -lc_r" ! LIBOBJS="$LIBOBJS Python/thread.o" else echo "$ac_t""no" 1>&6 --- 3682,3686 ---- LIBS="$LIBS -lc_r" ! LIBOBJS="$LIBOBJS thread.o" else echo "$ac_t""no" 1>&6 *************** *** 3730,3734 **** LIBS="$LIBS -lthread" ! LIBOBJS="$LIBOBJS Python/thread.o" else echo "$ac_t""no" 1>&6 --- 3730,3734 ---- LIBS="$LIBS -lthread" ! LIBOBJS="$LIBOBJS thread.o" else echo "$ac_t""no" 1>&6 *************** *** 3778,3782 **** LIBS="$LIBS -lpthread" ! LIBOBJS="$LIBOBJS Python/thread.o" else echo "$ac_t""no" 1>&6 --- 3778,3782 ---- LIBS="$LIBS -lpthread" ! LIBOBJS="$LIBOBJS thread.o" else echo "$ac_t""no" 1>&6 *************** *** 3826,3830 **** LIBS="$LIBS -lcma" ! LIBOBJS="$LIBOBJS Python/thread.o" else echo "$ac_t""no" 1>&6 --- 3826,3830 ---- LIBS="$LIBS -lcma" ! LIBOBJS="$LIBOBJS thread.o" else echo "$ac_t""no" 1>&6 *************** *** 3893,3897 **** LIBS="$LIBS -lmpc" ! LIBOBJS="$LIBOBJS Python/thread.o" USE_THREAD_MODULE="" else --- 3893,3897 ---- LIBS="$LIBS -lmpc" ! LIBOBJS="$LIBOBJS thread.o" USE_THREAD_MODULE="" else *************** *** 3939,3943 **** LIBS="$LIBS -lthread" ! LIBOBJS="$LIBOBJS Python/thread.o" USE_THREAD_MODULE="" else --- 3939,3943 ---- LIBS="$LIBS -lthread" ! LIBOBJS="$LIBOBJS thread.o" USE_THREAD_MODULE="" else *************** *** 6157,6160 **** --- 6157,6167 ---- + # Add Python/ prefix to LIBOBJS + libobjs=$LIBOBJS + LIBOBJS= + for obj in $libobjs; do + LIBOBJS="$LIBOBJS Python/$obj" + done + #AC_MSG_CHECKING(for Modules/Setup) #if test ! -f Modules/Setup ; then *************** *** 6171,6175 **** SRCDIRS="Parser Grammar Objects Python Modules" echo $ac_n "checking for build directories""... $ac_c" 1>&6 ! echo "configure:6174: checking for build directories" >&5 for dir in $SRCDIRS; do if test ! -d $dir; then --- 6178,6182 ---- SRCDIRS="Parser Grammar Objects Python Modules" echo $ac_n "checking for build directories""... $ac_c" 1>&6 ! echo "configure:6181: checking for build directories" >&5 for dir in $SRCDIRS; do if test ! -d $dir; then Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.207 retrieving revision 1.208 diff -C2 -r1.207 -r1.208 *** configure.in 2001/02/27 04:45:05 1.207 --- configure.in 2001/03/04 06:39:33 1.208 *************** *** 774,778 **** AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD) AC_DEFINE(C_THREADS) ! LIBOBJS="$LIBOBJS Python/thread.o"],[ AC_MSG_CHECKING(for --with-pth) AC_ARG_WITH(pth, --- 774,778 ---- AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD) AC_DEFINE(C_THREADS) ! LIBOBJS="$LIBOBJS thread.o"],[ AC_MSG_CHECKING(for --with-pth) AC_ARG_WITH(pth, *************** *** 782,791 **** AC_DEFINE(HAVE_PTH) LIBS="-lpth $LIBS" ! LIBOBJS="$LIBOBJS Python/thread.o"],[ AC_MSG_RESULT(no) AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD) AC_DEFINE(_POSIX_THREADS) LIBS="-lpthread $LIBS" ! LIBOBJS="$LIBOBJS Python/thread.o"],[ AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD) case $ac_sys_system in --- 782,791 ---- AC_DEFINE(HAVE_PTH) LIBS="-lpth $LIBS" ! LIBOBJS="$LIBOBJS thread.o"],[ AC_MSG_RESULT(no) AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD) AC_DEFINE(_POSIX_THREADS) LIBS="-lpthread $LIBS" ! LIBOBJS="$LIBOBJS thread.o"],[ AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD) case $ac_sys_system in *************** *** 793,820 **** *) AC_DEFINE(_POSIX_THREADS);; esac ! LIBOBJS="$LIBOBJS Python/thread.o"],[ AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD) AC_DEFINE(BEOS_THREADS) ! LIBOBJS="$LIBOBJS Python/thread.o"],[ AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD) AC_DEFINE(_POSIX_THREADS) LIBS="$LIBS -lpthreads" ! LIBOBJS="$LIBOBJS Python/thread.o"], [ AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD) AC_DEFINE(_POSIX_THREADS) LIBS="$LIBS -lc_r" ! LIBOBJS="$LIBOBJS Python/thread.o"], [ AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD) AC_DEFINE(_POSIX_THREADS) LIBS="$LIBS -lthread" ! LIBOBJS="$LIBOBJS Python/thread.o"], [ AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD) AC_DEFINE(_POSIX_THREADS) LIBS="$LIBS -lpthread" ! LIBOBJS="$LIBOBJS Python/thread.o"], [ AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD) AC_DEFINE(_POSIX_THREADS) LIBS="$LIBS -lcma" ! LIBOBJS="$LIBOBJS Python/thread.o"],[ USE_THREAD_MODULE="#"]) ])])])])])])])])]) --- 793,820 ---- *) AC_DEFINE(_POSIX_THREADS);; esac ! LIBOBJS="$LIBOBJS thread.o"],[ AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD) AC_DEFINE(BEOS_THREADS) ! LIBOBJS="$LIBOBJS thread.o"],[ AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD) AC_DEFINE(_POSIX_THREADS) LIBS="$LIBS -lpthreads" ! LIBOBJS="$LIBOBJS thread.o"], [ AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD) AC_DEFINE(_POSIX_THREADS) LIBS="$LIBS -lc_r" ! LIBOBJS="$LIBOBJS thread.o"], [ AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD) AC_DEFINE(_POSIX_THREADS) LIBS="$LIBS -lthread" ! LIBOBJS="$LIBOBJS thread.o"], [ AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD) AC_DEFINE(_POSIX_THREADS) LIBS="$LIBS -lpthread" ! LIBOBJS="$LIBOBJS thread.o"], [ AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD) AC_DEFINE(_POSIX_THREADS) LIBS="$LIBS -lcma" ! LIBOBJS="$LIBOBJS thread.o"],[ USE_THREAD_MODULE="#"]) ])])])])])])])])]) *************** *** 822,830 **** AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD) LIBS="$LIBS -lmpc" ! LIBOBJS="$LIBOBJS Python/thread.o" USE_THREAD_MODULE=""]) AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD) LIBS="$LIBS -lthread" ! LIBOBJS="$LIBOBJS Python/thread.o" USE_THREAD_MODULE=""]) --- 822,830 ---- AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD) LIBS="$LIBS -lmpc" ! LIBOBJS="$LIBOBJS thread.o" USE_THREAD_MODULE=""]) AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD) LIBS="$LIBS -lthread" ! LIBOBJS="$LIBOBJS thread.o" USE_THREAD_MODULE=""]) *************** *** 1293,1296 **** --- 1293,1303 ---- EOF AC_CHECK_TYPE(socklen_t, int) + + # Add Python/ prefix to LIBOBJS + libobjs=$LIBOBJS + LIBOBJS= + for obj in $libobjs; do + LIBOBJS="$LIBOBJS Python/$obj" + done #AC_MSG_CHECKING(for Modules/Setup) From jackjansen@users.sourceforge.net Mon Mar 5 13:41:17 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Mon, 05 Mar 2001 05:41:17 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib urllib.py,1.121,1.122 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv25738 Modified Files: urllib.py Log Message: Added url2pathname and pathname2url to __all__. Index: urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib.py,v retrieving revision 1.121 retrieving revision 1.122 diff -C2 -r1.121 -r1.122 *** urllib.py 2001/03/02 06:43:49 1.121 --- urllib.py 2001/03/05 13:41:14 1.122 *************** *** 31,35 **** __all__ = ["urlopen", "URLopener", "FancyURLopener", "urlretrieve", "urlcleanup", "quote", "quote_plus", "unquote", "unquote_plus", ! "urlencode"] __version__ = '1.15' # XXX This version is not always updated :-( --- 31,35 ---- __all__ = ["urlopen", "URLopener", "FancyURLopener", "urlretrieve", "urlcleanup", "quote", "quote_plus", "unquote", "unquote_plus", ! "urlencode", "url2pathname", "pathname2url"] __version__ = '1.15' # XXX This version is not always updated :-( From jackjansen@users.sourceforge.net Mon Mar 5 13:45:40 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Mon, 05 Mar 2001 05:45:40 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib urllib.py,1.122,1.123 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv26039 Modified Files: urllib.py Log Message: Grr, splittag was also missing from __all__. Index: urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib.py,v retrieving revision 1.122 retrieving revision 1.123 diff -C2 -r1.122 -r1.123 *** urllib.py 2001/03/05 13:41:14 1.122 --- urllib.py 2001/03/05 13:45:38 1.123 *************** *** 31,35 **** __all__ = ["urlopen", "URLopener", "FancyURLopener", "urlretrieve", "urlcleanup", "quote", "quote_plus", "unquote", "unquote_plus", ! "urlencode", "url2pathname", "pathname2url"] __version__ = '1.15' # XXX This version is not always updated :-( --- 31,35 ---- __all__ = ["urlopen", "URLopener", "FancyURLopener", "urlretrieve", "urlcleanup", "quote", "quote_plus", "unquote", "unquote_plus", ! "urlencode", "url2pathname", "pathname2url", "splittag"] __version__ = '1.15' # XXX This version is not always updated :-( From fdrake@users.sourceforge.net Tue Mar 6 05:52:19 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 05 Mar 2001 21:52:19 -0800 Subject: [Python-checkins] CVS: python/dist/src Makefile.pre.in,1.28,1.29 configure.in,1.208,1.209 configure,1.200,1.201 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv12130 Modified Files: Makefile.pre.in configure.in configure Log Message: Move all knowledge that $(MAINOBJ) is built in the Modules/ directory into Makefile.pre.in; the configure script will only determine the basename of the file. This fixes installation of a Python built using C++, reported by Greg Wilson. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -r1.28 -r1.29 *** Makefile.pre.in 2001/03/03 04:14:21 1.28 --- Makefile.pre.in 2001/03/06 05:52:16 1.29 *************** *** 273,278 **** # Build the interpreter ! $(PYTHON): $(MAINOBJ) $(LDLIBRARY) ! $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ $(MAINOBJ) \ $(LDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) --- 273,279 ---- # Build the interpreter ! $(PYTHON): Modules/$(MAINOBJ) $(LDLIBRARY) ! $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \ ! Modules/$(MAINOBJ) \ $(LDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) *************** *** 452,456 **** Include/pyfpe.h ! $(LIBRARY_OBJS) $(MODOBJS) $(MAINOBJ): $(PYTHON_HEADERS) --- 453,457 ---- Include/pyfpe.h ! $(LIBRARY_OBJS) $(MODOBJS) Modules/$(MAINOBJ): $(PYTHON_HEADERS) *************** *** 662,666 **** fi $(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c ! $(INSTALL_DATA) Modules/python.o $(LIBPL)/python.o $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in $(INSTALL_DATA) Makefile $(LIBPL)/Makefile --- 663,667 ---- fi $(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c ! $(INSTALL_DATA) Modules/$(MAINOBJ) $(LIBPL)/$(MAINOBJ) $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in $(INSTALL_DATA) Makefile $(LIBPL)/Makefile Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.208 retrieving revision 1.209 diff -C2 -r1.208 -r1.209 *** configure.in 2001/03/04 06:39:33 1.208 --- configure.in 2001/03/06 05:52:16 1.209 *************** *** 129,133 **** AC_SUBST(CXX) AC_SUBST(MAINOBJ) ! MAINOBJ=Modules/python.o AC_MSG_CHECKING(for --with-cxx=) AC_ARG_WITH(cxx, [ --with-cxx= enable C++ support],[ --- 129,133 ---- AC_SUBST(CXX) AC_SUBST(MAINOBJ) ! MAINOBJ=python.o AC_MSG_CHECKING(for --with-cxx=) AC_ARG_WITH(cxx, [ --with-cxx= enable C++ support],[ *************** *** 137,141 **** with_cxx=no;; *) CXX=$withval ! MAINOBJ=Modules/ccpython.o with_cxx=$withval;; esac], [ --- 137,141 ---- with_cxx=no;; *) CXX=$withval ! MAINOBJ=ccpython.o with_cxx=$withval;; esac], [ Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.200 retrieving revision 1.201 diff -C2 -r1.200 -r1.201 *** configure 2001/03/04 06:39:33 1.200 --- configure 2001/03/06 05:52:16 1.201 *************** *** 1,5 **** #! /bin/sh ! # From configure.in Revision: 1.207 # Guess values for system-dependent variables and create Makefiles. --- 1,5 ---- #! /bin/sh ! # From configure.in Revision: 1.208 # Guess values for system-dependent variables and create Makefiles. *************** *** 718,722 **** ! MAINOBJ=Modules/python.o echo $ac_n "checking for --with-cxx=""... $ac_c" 1>&6 echo "configure:723: checking for --with-cxx=" >&5 --- 718,722 ---- ! MAINOBJ=python.o echo $ac_n "checking for --with-cxx=""... $ac_c" 1>&6 echo "configure:723: checking for --with-cxx=" >&5 *************** *** 730,734 **** with_cxx=no;; *) CXX=$withval ! MAINOBJ=Modules/ccpython.o with_cxx=$withval;; esac --- 730,734 ---- with_cxx=no;; *) CXX=$withval ! MAINOBJ=ccpython.o with_cxx=$withval;; esac *************** *** 5042,5046 **** /* Ultrix mips cc rejects this. */ ! typedef int charset[2]; const charset x = {0,0}; /* SunOS 4.1.1 cc rejects this. */ char const *const *ccp; --- 5042,5046 ---- /* Ultrix mips cc rejects this. */ ! typedef int charset[2]; const charset x; /* SunOS 4.1.1 cc rejects this. */ char const *const *ccp; From fdrake@users.sourceforge.net Tue Mar 6 06:31:17 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 05 Mar 2001 22:31:17 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python import.c,2.172,2.173 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv13885/Python Modified Files: import.c Log Message: Add some spaces around the "=" in assignments. Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.172 retrieving revision 2.173 diff -C2 -r2.172 -r2.173 *** import.c 2001/03/02 06:34:14 2.172 --- import.c 2001/03/06 06:31:15 2.173 *************** *** 1944,1950 **** /* Get the __import__ function from the builtins */ if (PyDict_Check(builtins)) ! import=PyObject_GetItem(builtins, import_str); else ! import=PyObject_GetAttr(builtins, import_str); if (import == NULL) goto err; --- 1944,1950 ---- /* Get the __import__ function from the builtins */ if (PyDict_Check(builtins)) ! import = PyObject_GetItem(builtins, import_str); else ! import = PyObject_GetAttr(builtins, import_str); if (import == NULL) goto err; From fdrake@users.sourceforge.net Tue Mar 6 06:33:10 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 05 Mar 2001 22:33:10 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib netrc.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv14003/Lib Modified Files: netrc.py Log Message: Define & use NetrcParseError instead of improperly overloading SyntaxError. Always has the lineno and filename of the source text. Index: netrc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/netrc.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** netrc.py 2001/02/06 01:07:01 1.10 --- netrc.py 2001/03/06 06:33:08 1.11 *************** *** 5,10 **** import os, shlex ! __all__ = ["netrc"] class netrc: def __init__(self, file=None): --- 5,23 ---- import os, shlex ! __all__ = ["netrc", "NetrcParseError"] + + class NetrcParseError(Exception): + """Exception raised on syntax errors in the .netrc file.""" + def __init__(self, msg, filename=None, lineno=None): + self.filename = file + self.lineno = lineno + self.msg = msg + Exception.__init__(self, msg) + + def __str__(self): + return "%s (%s, line %s)" % (self.msg, self.filename, self.lineno) + + class netrc: def __init__(self, file=None): *************** *** 38,43 **** self.macros[entryname].append(line) else: ! raise SyntaxError, "bad toplevel token %s, file %s, line %d" \ ! % (tt, file, lexer.lineno) # We're looking at start of an entry for a named machine or default. --- 51,56 ---- self.macros[entryname].append(line) else: ! raise NetrcParseError( ! "bad toplevel token %r" % tt, file, lexer.lineno) # We're looking at start of an entry for a named machine or default. *************** *** 55,59 **** break else: ! raise SyntaxError, "malformed %s entry %s terminated by %s" % (toplevel, entryname, repr(tt)) elif tt == 'login' or tt == 'user': login = lexer.get_token() --- 68,75 ---- break else: ! raise NetrcParseError( ! "malformed %s entry %s terminated by %s" ! % (toplevel, entryname, repr(tt)), ! file, lexer.lineno) elif tt == 'login' or tt == 'user': login = lexer.get_token() *************** *** 63,67 **** password = lexer.get_token() else: ! raise SyntaxError, "bad follower token %s, file %s, line %d"%(tt,file,lexer.lineno) def authenticators(self, host): --- 79,84 ---- password = lexer.get_token() else: ! raise NetrcParseError("bad follower token %r" % tt, ! file, lexer.lineno) def authenticators(self, host): From fdrake@users.sourceforge.net Tue Mar 6 06:55:20 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 05 Mar 2001 22:55:20 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libnetrc.tex,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv14846/lib Modified Files: libnetrc.tex Log Message: Update documentation to reflect the shift to NetrcParseError instead of SyntaxError. Index: libnetrc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libnetrc.tex,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** libnetrc.tex 2000/07/16 19:01:09 1.7 --- libnetrc.tex 2001/03/06 06:55:18 1.8 *************** *** 19,25 **** file to parse. If no argument is given, the file \file{.netrc} in the user's home directory will be read. Parse errors will raise ! \exception{SyntaxError} with diagnostic information including the file ! name, line number, and terminating token. \end{classdesc} --- 19,33 ---- file to parse. If no argument is given, the file \file{.netrc} in the user's home directory will be read. Parse errors will raise ! \exception{NetrcParseError} with diagnostic information including the ! file name, line number, and terminating token. \end{classdesc} + + \begin{excdesc}{NetrcParseError} + Exception raised by the \class{netrc} class when syntactical errors + are encountered in source text. Instances of this exception provide + three interesting attributes: \member{msg} is a textual explanation + of the error, \member{filename} is the name of the source file, and + \member{lineno} gives the line number on which the error was found. + \end{excdesc} From fdrake@users.sourceforge.net Tue Mar 6 07:19:36 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 05 Mar 2001 23:19:36 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/tut tut.tex,1.128,1.129 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory usw-pr-cvs1:/tmp/cvs-serv15830/tut Modified Files: tut.tex Log Message: Correct typos in Ping's email address. Remove premature use of negative indexes in string operation examples; negative indexes have not been explained at that point, and the use of negative indexes are not necessary for the examples. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.128 retrieving revision 1.129 diff -C2 -r1.128 -r1.129 *** tut.tex 2001/02/14 03:20:18 1.128 --- tut.tex 2001/03/06 07:19:34 1.129 *************** *** 621,625 **** File "", line 1, in ? TypeError: object doesn't support item assignment ! >>> word[:-1] = 'Splat' Traceback (most recent call last): File "", line 1, in ? --- 621,625 ---- File "", line 1, in ? TypeError: object doesn't support item assignment ! >>> word[:1] = 'Splat' Traceback (most recent call last): File "", line 1, in ? *************** *** 633,637 **** >>> 'x' + word[1:] 'xelpA' ! >>> 'Splat' + word[-1:] 'SplatA' \end{verbatim} --- 633,637 ---- >>> 'x' + word[1:] 'xelpA' ! >>> 'Splat' + word[4] 'SplatA' \end{verbatim} *************** *** 1646,1650 **** \subsection{Using Lists as Stacks \label{lists-as-stacks}} ! \sectionauthor{Ka-Ping Yee}{ping@lfs.org} The list methods make it very easy to use a list as a stack, where the --- 1646,1650 ---- \subsection{Using Lists as Stacks \label{lists-as-stacks}} ! \sectionauthor{Ka-Ping Yee}{ping@lfw.org} The list methods make it very easy to use a list as a stack, where the *************** *** 1674,1678 **** \subsection{Using Lists as Queues \label{lists-as-queues}} ! \sectionauthor{Ka-Ping Yee}{ping@lfs.org} You can also use a list conveniently as a queue, where the first --- 1674,1678 ---- \subsection{Using Lists as Queues \label{lists-as-queues}} ! \sectionauthor{Ka-Ping Yee}{ping@lfw.org} You can also use a list conveniently as a queue, where the first From fdrake@users.sourceforge.net Tue Mar 6 07:22:18 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 05 Mar 2001 23:22:18 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc Makefile,1.212,1.213 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory usw-pr-cvs1:/tmp/cvs-serv16015 Modified Files: Makefile Log Message: Make sure the README files that contain page count information land in the right directory (which actually exists). Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile,v retrieving revision 1.212 retrieving revision 1.213 diff -C2 -r1.212 -r1.213 *** Makefile 2001/03/01 18:38:56 1.212 --- Makefile 2001/03/06 07:22:16 1.213 *************** *** 308,312 **** paper-$(PAPER)/README: ps $(TOOLSDIR)/getpagecounts ! (cd paper-$(PAPER); ../$(TOOLSDIR)/getpagecounts >$@) info-$(RELEASE).tgz: info --- 308,312 ---- paper-$(PAPER)/README: ps $(TOOLSDIR)/getpagecounts ! (cd paper-$(PAPER); ../$(TOOLSDIR)/getpagecounts >../$@) info-$(RELEASE).tgz: info From fdrake@users.sourceforge.net Tue Mar 6 07:28:22 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 05 Mar 2001 23:28:22 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/html index.html.in,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/html In directory usw-pr-cvs1:/tmp/cvs-serv16265/html Modified Files: index.html.in Log Message: Turn "Python Documentation Central" into just "Documentation Central"; some Web browsers tried to wrap lines in bad ways, so we avoid the problem by putting fewer words on the page. Index: index.html.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/html/index.html.in,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** index.html.in 2001/02/12 16:04:24 1.13 --- index.html.in 2001/03/06 07:28:20 1.14 *************** *** 92,96 **** --- 92,96 ---- From fdrake@users.sourceforge.net Tue Mar 6 07:32:13 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 05 Mar 2001 23:32:13 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/ref ref5.tex,1.41,1.42 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv16492 Modified Files: ref5.tex Log Message: Re-word the explanation of the in/not in operators for increased content and clarity. Add a footnote to the information on the possibility of shadowing builtins with locals & module globals. Index: ref5.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref5.tex,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -r1.41 -r1.42 *** ref5.tex 2001/01/14 02:57:14 1.41 --- ref5.tex 2001/03/06 07:32:11 1.42 *************** *** 66,70 **** in the block, or when it is assigned to but also explicitly listed in a \keyword{global} statement, it refers to a global name if one exists, ! else to a built-in name (and this binding may dynamically change). \indexii{name}{binding} \index{code block} --- 66,75 ---- in the block, or when it is assigned to but also explicitly listed in a \keyword{global} statement, it refers to a global name if one exists, ! else to a built-in name (and this binding may dynamically ! change).\footnote{The Python interpreter provides a useful set of ! predefined built-in functions. It is not recommended to reuse ! (hide) these names with self defined objects. See the ! \citetitle[../lib/built-in-funcs.html]{Python Library Reference} for ! the descriptions of built-in functions and methods.} \indexii{name}{binding} \index{code block} *************** *** 758,768 **** The operators \keyword{in} and \keyword{not in} test for set ! membership: every type can define membership in whatever way is ! appropriate. Traditionally, this interface has been tightly bound to ! the sequence interface, which is related in that presence in a sequence ! can be usefully interpreted as membership in a set. For the list and tuple types, \code{\var{x} in \var{y}} is true if and ! only if there exists such an index \var{i} such that \code{\var{x} == \var{y}[\var{i}]} is true. --- 763,776 ---- The operators \keyword{in} and \keyword{not in} test for set ! membership. \code{\var{x} in \var{s}} evaluates to true if \var{x} ! is a member of the set \var{s}, and false otherwise. \code{\var{x} ! not in \var{s}} returns the negation of \code{\var{x} in \var{s}}. ! The set membership test has traditionally been bound to sequences; an ! object is a member of a set if the set is a sequence and contains an ! element equal to that object. However, it is possible for an object ! to support membership tests without being a sequence. For the list and tuple types, \code{\var{x} in \var{y}} is true if and ! only if there exists an index \var{i} such that \code{\var{x} == \var{y}[\var{i}]} is true. From fdrake@users.sourceforge.net Tue Mar 6 07:34:02 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 05 Mar 2001 23:34:02 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/ref ref6.tex,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv16651 Modified Files: ref6.tex Log Message: Do not refer to "sub-modules" since that is not a defined term. Index: ref6.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref6.tex,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -r1.34 -r1.35 *** ref6.tex 2001/01/30 01:25:15 1.34 --- ref6.tex 2001/03/06 07:34:00 1.35 *************** *** 549,559 **** begin. ! The first form of \keyword{import} statement binds the module name in the ! local namespace to the module object, and then goes on to import the ! next identifier, if any. If the module name is followed by \keyword{as}, ! the name following \keyword{as} is used as the local name for the module. To ! avoid confusion, you cannot import sub-modules 'as' a different ! local name. So 'import module as m' is legal, but 'import module.submod as ! s' is not. The latter should be written as 'from module import submod as s', see below. --- 549,560 ---- begin. ! The first form of \keyword{import} statement binds the module name in ! the local namespace to the module object, and then goes on to import ! the next identifier, if any. If the module name is followed by ! \keyword{as}, the name following \keyword{as} is used as the local ! name for the module. To avoid confusion, you cannot import modules ! with dotted names \keyword{as} a different local name. So \code{import ! module as m} is legal, but \code{import module.submod as s} is not. ! The latter should be written as \code{from module import submod as s}; see below. From loewis@users.sourceforge.net Tue Mar 6 12:07:30 2001 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Tue, 06 Mar 2001 04:07:30 -0800 Subject: [Python-checkins] CVS: python/dist/src README,1.115,1.116 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv12728 Modified Files: README Log Message: Document that _REENTRANT is not needed explicitly. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.115 retrieving revision 1.116 diff -C2 -r1.115 -r1.116 *** README 2001/02/27 03:24:24 1.115 --- README 2001/03/06 12:07:27 1.116 *************** *** 415,428 **** ............................. OS/Compiler/threads Switches for use with threads ! (POSIX is draft 10, DCE is draft 4) (1) compile only (2) compile & link ! SunOS 5.{1-5}/{gcc,SunPro cc}/solaris (1) -D_REENTRANT (2) -mt ! SunOS 5.5/{gcc,SunPro cc}/POSIX (1) -D_REENTRANT ! DEC OSF/1 3.x/cc/DCE (1) -D_REENTRANT (2) -threads (butenhof@zko.dec.com) ! Digital UNIX 4.x/cc/DCE (1) -D_REENTRANT (2) -threads (butenhof@zko.dec.com) ! Digital UNIX 4.x/cc/POSIX (1) -D_REENTRANT (2) -pthread (butenhof@zko.dec.com) AIX 4.1.4/cc_r/d7 (nothing) --- 415,432 ---- ............................. + The definition of _REENTRANT should be configured automatically, if + that does not work on your system, or if _REENTRANT is defined + incorrectly, please report that as a bug. + OS/Compiler/threads Switches for use with threads ! (POSIX is draft 10, DCE is draft 4) compile & link ! SunOS 5.{1-5}/{gcc,SunPro cc}/solaris -mt ! SunOS 5.5/{gcc,SunPro cc}/POSIX (nothing) ! DEC OSF/1 3.x/cc/DCE -threads (butenhof@zko.dec.com) ! Digital UNIX 4.x/cc/DCE -threads (butenhof@zko.dec.com) ! Digital UNIX 4.x/cc/POSIX -pthread (butenhof@zko.dec.com) AIX 4.1.4/cc_r/d7 (nothing) From loewis@users.sourceforge.net Tue Mar 6 12:09:09 2001 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Tue, 06 Mar 2001 04:09:09 -0800 Subject: [Python-checkins] CVS: python/dist/src acconfig.h,1.44,1.45 config.h.in,2.88,2.89 configure.in,1.209,1.210 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv12877 Modified Files: acconfig.h config.h.in configure.in Log Message: Define __EXTENSIONS__ on Solaris. Fixes posixmodule error in bug #232787. Index: acconfig.h =================================================================== RCS file: /cvsroot/python/python/dist/src/acconfig.h,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -r1.44 -r1.45 *** acconfig.h 2001/02/27 04:45:05 1.44 --- acconfig.h 2001/03/06 12:09:07 1.45 *************** *** 26,29 **** --- 26,32 ---- #undef clock_t + /* Defined on Solaris to see additional function prototypes. */ + #undef __EXTENSIONS__ + /* Define if getpgrp() must be called as getpgrp(0). */ #undef GETPGRP_HAVE_ARG Index: config.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/config.h.in,v retrieving revision 2.88 retrieving revision 2.89 diff -C2 -r2.88 -r2.89 *** config.h.in 2001/02/27 04:45:05 2.88 --- config.h.in 2001/03/06 12:09:07 2.89 *************** *** 91,94 **** --- 91,97 ---- #undef clock_t + /* Defined on Solaris to see additional function prototypes. */ + #undef __EXTENSIONS__ + /* Define if getpgrp() must be called as getpgrp(0). */ #undef GETPGRP_HAVE_ARG Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.209 retrieving revision 1.210 diff -C2 -r1.209 -r1.210 *** configure.in 2001/03/06 05:52:16 1.209 --- configure.in 2001/03/06 12:09:07 1.210 *************** *** 195,199 **** --- 195,204 ---- cc) CC="$CC -Wl,-Bexport";; esac;; + SunOS*) + # Some functions have a prototype only with that define, e.g. confstr + AC_DEFINE(__EXTENSIONS__) + ;; esac + AC_SUBST(LIBRARY) From loewis@users.sourceforge.net Tue Mar 6 12:10:23 2001 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Tue, 06 Mar 2001 04:10:23 -0800 Subject: [Python-checkins] CVS: python/dist/src configure,1.201,1.202 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv12969 Modified Files: configure Log Message: Regenerate. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.201 retrieving revision 1.202 diff -C2 -r1.201 -r1.202 *** configure 2001/03/06 05:52:16 1.201 --- configure 2001/03/06 12:10:20 1.202 *************** *** 1,5 **** #! /bin/sh ! # From configure.in Revision: 1.208 # Guess values for system-dependent variables and create Makefiles. --- 1,5 ---- #! /bin/sh ! # From configure.in Revision: 1.210 [...3820 lines suppressed...] if eval "test \"`echo '$''{'ac_cv_type_socklen_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < *************** *** 6178,6182 **** SRCDIRS="Parser Grammar Objects Python Modules" echo $ac_n "checking for build directories""... $ac_c" 1>&6 ! echo "configure:6181: checking for build directories" >&5 for dir in $SRCDIRS; do if test ! -d $dir; then --- 6186,6190 ---- SRCDIRS="Parser Grammar Objects Python Modules" echo $ac_n "checking for build directories""... $ac_c" 1>&6 ! echo "configure:6189: checking for build directories" >&5 for dir in $SRCDIRS; do if test ! -d $dir; then From loewis@users.sourceforge.net Tue Mar 6 12:12:04 2001 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Tue, 06 Mar 2001 04:12:04 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules timemodule.c,2.107,2.108 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv13004/Modules Modified Files: timemodule.c Log Message: Use Py_CHARMASK for ctype macros. Fixes bug #232787. Index: timemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/timemodule.c,v retrieving revision 2.107 retrieving revision 2.108 diff -C2 -r2.107 -r2.108 *** timemodule.c 2001/03/02 06:53:29 2.107 --- timemodule.c 2001/03/06 12:12:02 2.108 *************** *** 398,402 **** return NULL; } ! while (*s && isspace(*s)) s++; if (*s) { --- 398,402 ---- return NULL; } ! while (*s && isspace(Py_CHARMASK(*s))) s++; if (*s) { From loewis@users.sourceforge.net Tue Mar 6 12:12:04 2001 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Tue, 06 Mar 2001 04:12:04 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python errors.c,2.61,2.62 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv13004/Python Modified Files: errors.c Log Message: Use Py_CHARMASK for ctype macros. Fixes bug #232787. Index: errors.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/errors.c,v retrieving revision 2.61 retrieving revision 2.62 diff -C2 -r2.61 -r2.62 *** errors.c 2001/02/28 21:46:24 2.61 --- errors.c 2001/03/06 12:12:02 2.62 *************** *** 403,407 **** if (*f == '%') { const char* p = f; ! while (*++f && *f != '%' && !isalpha(*f)) ; switch (*f) { --- 403,407 ---- if (*f == '%') { const char* p = f; ! while (*++f && *f != '%' && !isalpha(Py_CHARMASK(*f))) ; switch (*f) { *************** *** 458,470 **** interested in the precision value, if any) */ n = 0; ! while (isdigit(*f)) n = (n*10) + *f++ - '0'; if (*f == '.') { f++; n = 0; ! while (isdigit(*f)) n = (n*10) + *f++ - '0'; } ! while (*f && *f != '%' && !isalpha(*f)) f++; switch (*f) { --- 458,470 ---- interested in the precision value, if any) */ n = 0; ! while (isdigit(Py_CHARMASK(*f))) n = (n*10) + *f++ - '0'; if (*f == '.') { f++; n = 0; ! while (isdigit(Py_CHARMASK(*f))) n = (n*10) + *f++ - '0'; } ! while (*f && *f != '%' && !isalpha(Py_CHARMASK(*f))) f++; switch (*f) { From loewis@users.sourceforge.net Tue Mar 6 12:12:04 2001 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Tue, 06 Mar 2001 04:12:04 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects intobject.c,2.55,2.56 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv13004/Objects Modified Files: intobject.c Log Message: Use Py_CHARMASK for ctype macros. Fixes bug #232787. Index: intobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/intobject.c,v retrieving revision 2.55 retrieving revision 2.56 diff -C2 -r2.55 -r2.56 *** intobject.c 2001/01/17 15:32:23 2.55 --- intobject.c 2001/03/06 12:12:02 2.56 *************** *** 183,187 **** else x = PyOS_strtol(s, &end, base); ! if (end == s || !isalnum(end[-1])) goto bad; while (*end && isspace(Py_CHARMASK(*end))) --- 183,187 ---- else x = PyOS_strtol(s, &end, base); ! if (end == s || !isalnum(Py_CHARMASK(end[-1]))) goto bad; while (*end && isspace(Py_CHARMASK(*end))) From loewis@users.sourceforge.net Tue Mar 6 12:13:58 2001 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Tue, 06 Mar 2001 04:13:58 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules signalmodule.c,2.57,2.58 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv13187/Modules Modified Files: signalmodule.c Log Message: Document SIG_* warning causes on Solaris. Index: signalmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/signalmodule.c,v retrieving revision 2.57 retrieving revision 2.58 diff -C2 -r2.57 -r2.58 *** signalmodule.c 2000/09/19 00:46:46 2.57 --- signalmodule.c 2001/03/06 12:13:56 2.58 *************** *** 86,89 **** --- 86,94 ---- static PyObject *IntHandler; + /* On Solaris 8, gcc will produce a warning that the function + declaration is not a prototype. This is caused by the definition of + SIG_DFL as (void (*)())0; the correct declaration would have been + (void (*)(int))0. */ + static PyOS_sighandler_t old_siginthandler = SIG_DFL; From loewis@users.sourceforge.net Tue Mar 6 12:14:56 2001 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Tue, 06 Mar 2001 04:14:56 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects floatobject.c,2.79,2.80 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv13275/Objects Modified Files: floatobject.c Log Message: Avoid giving prototypes on Solaris. Index: floatobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/floatobject.c,v retrieving revision 2.79 retrieving revision 2.80 diff -C2 -r2.79 -r2.80 *** floatobject.c 2001/02/01 23:53:05 2.79 --- floatobject.c 2001/03/06 12:14:54 2.80 *************** *** 29,33 **** #endif ! #ifdef sun /* On SunOS4.1 only libm.a exists. Make sure that references to all needed math functions exist in the executable, so that dynamic --- 29,33 ---- #endif ! #if defined(sun) && !defined(__SVR4) /* On SunOS4.1 only libm.a exists. Make sure that references to all needed math functions exist in the executable, so that dynamic From montanaro@users.sourceforge.net Tue Mar 6 15:26:09 2001 From: montanaro@users.sourceforge.net (Skip Montanaro) Date: Tue, 06 Mar 2001 07:26:09 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib os.py,1.45,1.46 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv1747 Modified Files: os.py Log Message: fix typo in extending __all__ for riscos platform - closes bug 406296 Index: os.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/os.py,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -r1.45 -r1.46 *** os.py 2001/03/02 23:31:43 1.45 --- os.py 2001/03/06 15:26:07 1.46 *************** *** 165,169 **** import riscos __all__.extend(_get_exports_list(riscos)) ! del ce else: --- 165,169 ---- import riscos __all__.extend(_get_exports_list(riscos)) ! del riscos else: From loewis@users.sourceforge.net Wed Mar 7 09:05:47 2001 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Wed, 07 Mar 2001 01:05:47 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/plat-riscos riscosenviron.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-riscos In directory usw-pr-cvs1:/tmp/cvs-serv11717/plat-riscos Modified Files: riscosenviron.py Log Message: Unify _Environ processing on riscos with other platforms. Index: riscosenviron.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-riscos/riscosenviron.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** riscosenviron.py 2001/03/02 05:55:07 1.1 --- riscosenviron.py 2001/03/07 09:05:45 1.2 *************** *** 4,8 **** class _Environ: ! def __init__(self): pass def __repr__(self): --- 4,8 ---- class _Environ: ! def __init__(self, initial = None): pass def __repr__(self): *************** *** 44,46 **** return failobj - environ = _Environ() --- 44,45 ---- From loewis@users.sourceforge.net Wed Mar 7 09:05:47 2001 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Wed, 07 Mar 2001 01:05:47 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib os.py,1.46,1.47 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv11717 Modified Files: os.py Log Message: Unify _Environ processing on riscos with other platforms. Index: os.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/os.py,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -r1.46 -r1.47 *** os.py 2001/03/06 15:26:07 1.46 --- os.py 2001/03/07 09:05:44 1.47 *************** *** 161,165 **** path = riscospath del riscospath - from riscosenviron import environ import riscos --- 161,164 ---- *************** *** 347,361 **** ! if name != "riscos": ! # Change environ to automatically call putenv() if it exists ! try: ! # This will fail if there's no putenv ! putenv ! except NameError: ! pass ! else: ! import UserDict ! if name in ('os2', 'nt', 'dos'): # Where Env Var Names Must Be UPPERCASE # But we store them as upper case class _Environ(UserDict.UserDict): --- 346,362 ---- ! # Change environ to automatically call putenv() if it exists ! try: ! # This will fail if there's no putenv ! putenv ! except NameError: ! pass ! else: ! import UserDict ! if name == "riscos": ! # On RISC OS, all env access goes through getenv and putenv ! from riscosenviron import _Environ ! elif name in ('os2', 'nt', 'dos'): # Where Env Var Names Must Be UPPERCASE # But we store them as upper case class _Environ(UserDict.UserDict): From loewis@users.sourceforge.net Wed Mar 7 09:08:13 2001 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Wed, 07 Mar 2001 01:08:13 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/plat-riscos riscosenviron.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-riscos In directory usw-pr-cvs1:/tmp/cvs-serv12099 Modified Files: riscosenviron.py Log Message: Replace setenv with putenv. Reported by Dietmar Schwertberger. Index: riscosenviron.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-riscos/riscosenviron.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** riscosenviron.py 2001/03/07 09:05:45 1.2 --- riscosenviron.py 2001/03/07 09:08:11 1.3 *************** *** 20,24 **** raise KeyError def __setitem__(self, key, item): ! riscos.setenv(key, item) def __delitem__(self, key): riscos.delenv(key) --- 20,24 ---- raise KeyError def __setitem__(self, key, item): ! riscos.putenv(key, item) def __delitem__(self, key): riscos.delenv(key) From loewis@users.sourceforge.net Wed Mar 7 10:22:23 2001 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Wed, 07 Mar 2001 02:22:23 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules fpectlmodule.c,2.13,2.14 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv27107 Modified Files: fpectlmodule.c Log Message: Define sunmath prototypes if sunmath.h was not included. Index: fpectlmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/fpectlmodule.c,v retrieving revision 2.13 retrieving revision 2.14 diff -C2 -r2.13 -r2.14 *** fpectlmodule.c 2001/01/04 01:01:12 2.13 --- fpectlmodule.c 2001/03/07 10:22:20 2.14 *************** *** 141,144 **** --- 141,150 ---- */ #include + #ifndef _SUNMATH_H + extern void nonstandard_arithmetic(void); + extern int ieee_flags(const char*, const char*, const char*, char **); + extern long ieee_handler(const char*, const char*, sigfpe_handler_type); + #endif + char *mode="exception", *in="all", *out; (void) nonstandard_arithmetic(); From jackjansen@users.sourceforge.net Thu Mar 8 16:06:34 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 08 Mar 2001 08:06:34 -0800 Subject: [Python-checkins] CVS: python/nondist/sandbox test.txt,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/sandbox In directory usw-pr-cvs1:/tmp/cvs-serv21034/python/nondist/sandbox Added Files: test.txt Log Message: Testing SSH access from the Mac with MacCVS Pro. --- NEW FILE: test.txt --- Testing ssh with MacCVS Pro. From jackjansen@users.sourceforge.net Thu Mar 8 16:07:10 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 08 Mar 2001 08:07:10 -0800 Subject: [Python-checkins] CVS: python/nondist/sandbox test.txt,1.1,NONE Message-ID: Update of /cvsroot/python/python/nondist/sandbox In directory usw-pr-cvs1:/tmp/cvs-serv21161/python/nondist/sandbox Removed Files: test.txt Log Message: Testing SSH access from the Mac with MacCVS Pro. It seems to work:-) --- test.txt DELETED --- From fdrake@usw-pr-cvs1.sourceforge.net Thu Mar 8 22:17:56 2001 From: fdrake@usw-pr-cvs1.sourceforge.net (Fred L. Drake) Date: Thu, 08 Mar 2001 14:17:56 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/html style.css,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/html In directory usw-pr-cvs1:/tmp/cvs-serv21007/html Modified Files: style.css Log Message: Add more font flavors for elements; the previous incarnation caused some NT/IE5.5 users to see only boxes for these characters. This might be specific to NT Service Pack 6. Index: style.css =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/html/style.css,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** style.css 2000/10/26 20:01:09 1.13 --- style.css 2001/03/08 22:17:54 1.14 *************** *** 43,47 **** h3, h4 { font-size: 120% } code, tt { font-family: monospace } ! var { font-family: serif; font-style: italic; font-weight: normal } --- 43,47 ---- h3, h4 { font-size: 120% } code, tt { font-family: monospace } ! var { font-family: times, serif; font-style: italic; font-weight: normal } From fdrake@usw-pr-cvs1.sourceforge.net Thu Mar 8 22:46:43 2001 From: fdrake@usw-pr-cvs1.sourceforge.net (Fred L. Drake) Date: Thu, 08 Mar 2001 14:46:43 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libmultifile.tex,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv24820 Modified Files: libmultifile.tex Log Message: Re-order some method descriptions for a more logical grouping. (Based on reader comment!) Index: libmultifile.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmultifile.tex,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** libmultifile.tex 2000/09/30 17:04:40 1.10 --- libmultifile.tex 2001/03/08 22:46:41 1.11 *************** *** 40,56 **** A \class{MultiFile} instance has the following methods: - \begin{methoddesc}{push}{str} - Push a boundary string. When an appropriately decorated version of - this boundary is found as an input line, it will be interpreted as a - section-divider or end-marker. All subsequent - reads will return the empty string to indicate end-of-file, until a - call to \method{pop()} removes the boundary a or \method{next()} call - reenables it. - - It is possible to push more than one boundary. Encountering the - most-recently-pushed boundary will return EOF; encountering any other - boundary will raise an error. - \end{methoddesc} - \begin{methoddesc}{readline}{str} Read a line. If the line is data (not a section-divider or end-marker --- 40,43 ---- *************** *** 72,87 **** \end{methoddesc} - \begin{methoddesc}{next}{} - Skip lines to the next section (that is, read lines until a - section-divider or end-marker has been consumed). Return true if - there is such a section, false if an end-marker is seen. Re-enable - the most-recently-pushed boundary. - \end{methoddesc} - - \begin{methoddesc}{pop}{} - Pop a section boundary. This boundary will no longer be interpreted - as EOF. - \end{methoddesc} - \begin{methoddesc}{seek}{pos\optional{, whence}} Seek. Seek indices are relative to the start of the current section. --- 59,62 ---- *************** *** 94,97 **** --- 69,79 ---- \end{methoddesc} + \begin{methoddesc}{next}{} + Skip lines to the next section (that is, read lines until a + section-divider or end-marker has been consumed). Return true if + there is such a section, false if an end-marker is seen. Re-enable + the most-recently-pushed boundary. + \end{methoddesc} + \begin{methoddesc}{is_data}{str} Return true if \var{str} is data and false if it might be a section *************** *** 103,106 **** --- 85,106 ---- boundary tests; if it always returns false it will merely slow processing, not cause it to fail. + \end{methoddesc} + + \begin{methoddesc}{push}{str} + Push a boundary string. When an appropriately decorated version of + this boundary is found as an input line, it will be interpreted as a + section-divider or end-marker. All subsequent + reads will return the empty string to indicate end-of-file, until a + call to \method{pop()} removes the boundary a or \method{next()} call + reenables it. + + It is possible to push more than one boundary. Encountering the + most-recently-pushed boundary will return EOF; encountering any other + boundary will raise an error. + \end{methoddesc} + + \begin{methoddesc}{pop}{} + Pop a section boundary. This boundary will no longer be interpreted + as EOF. \end{methoddesc} From fdrake@usw-pr-cvs1.sourceforge.net Sat Mar 10 02:15:39 2001 From: fdrake@usw-pr-cvs1.sourceforge.net (Fred L. Drake) Date: Fri, 09 Mar 2001 18:15:39 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python future.c,2.4,2.5 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv18700/Python Modified Files: future.c Log Message: When iterating over the names imported in a future statement, ignore the commas in the concrete syntax; checking those causes a segfault. This fixes SF bug #407394. Index: future.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/future.c,v retrieving revision 2.4 retrieving revision 2.5 diff -C2 -r2.4 -r2.5 *** future.c 2001/02/28 17:47:12 2.4 --- future.c 2001/03/10 02:15:37 2.5 *************** *** 20,24 **** REQ(n, import_stmt); /* must by from __future__ import ... */ ! for (i = 3; i < NCH(n); ++i) { ch = CHILD(n, i); if (TYPE(ch) == STAR) { --- 20,24 ---- REQ(n, import_stmt); /* must by from __future__ import ... */ ! for (i = 3; i < NCH(n); i += 2) { ch = CHILD(n, i); if (TYPE(ch) == STAR) { From fdrake@usw-pr-cvs1.sourceforge.net Sat Mar 10 02:18:49 2001 From: fdrake@usw-pr-cvs1.sourceforge.net (Fred L. Drake) Date: Fri, 09 Mar 2001 18:18:49 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_future1.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv19185 Modified Files: test_future1.py Log Message: Import the nested_scopes feature twice, to exercise the patch introduced to avoid segfaults when more than one feature is named in the future statement. This tests for regression of SF bug #407394. Index: test_future1.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_future1.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** test_future1.py 2001/02/28 17:48:06 1.1 --- test_future1.py 2001/03/10 02:18:47 1.2 *************** *** 1,4 **** """This is a test""" ! from __future__ import nested_scopes def f(x): --- 1,6 ---- """This is a test""" ! ! # Import the name nested_scopes twice to trigger SF bug #407394 (regression). ! from __future__ import nested_scopes, nested_scopes def f(x): From ping@usw-pr-cvs1.sourceforge.net Sat Mar 10 09:31:57 2001 From: ping@usw-pr-cvs1.sourceforge.net (Ka-Ping Yee) Date: Sat, 10 Mar 2001 01:31:57 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib inspect.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv8232 Modified Files: inspect.py Log Message: Fix findsource() to work for derived classes. Index: inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** inspect.py 2001/03/02 05:50:34 1.7 --- inspect.py 2001/03/10 09:31:55 1.8 *************** *** 28,32 **** __date__ = '1 Jan 2001' ! import sys, os, types, string, dis, imp, tokenize # ----------------------------------------------------------- type-checking --- 28,32 ---- __date__ = '1 Jan 2001' ! import sys, os, types, string, re, dis, imp, tokenize # ----------------------------------------------------------- type-checking *************** *** 260,267 **** if isclass(object): name = object.__name__ ! matches = (['class', name], ['class', name + ':']) for i in range(len(lines)): ! if string.split(lines[i])[:2] in matches: ! return lines, i else: raise IOError, 'could not find class definition' --- 260,266 ---- if isclass(object): name = object.__name__ ! pat = re.compile(r'^\s*class\s*' + name + r'\b') for i in range(len(lines)): ! if pat.match(lines[i]): return lines, i else: raise IOError, 'could not find class definition' *************** *** 278,283 **** raise IOError, 'could not find function definition' lnum = object.co_firstlineno - 1 while lnum > 0: ! if string.split(lines[lnum])[:1] == ['def']: break lnum = lnum - 1 return lines, lnum --- 277,283 ---- raise IOError, 'could not find function definition' lnum = object.co_firstlineno - 1 + pat = re.compile(r'^\s*def\s') while lnum > 0: ! if pat.match(lines[lnum]): break lnum = lnum - 1 return lines, lnum From ping@usw-pr-cvs1.sourceforge.net Sat Mar 10 09:33:17 2001 From: ping@usw-pr-cvs1.sourceforge.net (Ka-Ping Yee) Date: Sat, 10 Mar 2001 01:33:17 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib pre.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv10600 Modified Files: pre.py Log Message: Make docstrings raw, since they contain literal backslashes. Index: pre.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pre.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** pre.py 2001/02/15 22:15:13 1.8 --- pre.py 2001/03/10 09:33:14 1.9 *************** *** 1,5 **** # module 're' -- A collection of regular expression operations ! """Support for regular expressions (RE). This module provides regular expression matching operations similar to --- 1,5 ---- # module 're' -- A collection of regular expression operations ! r"""Support for regular expressions (RE). This module provides regular expression matching operations similar to From ping@usw-pr-cvs1.sourceforge.net Sat Mar 10 09:33:17 2001 From: ping@usw-pr-cvs1.sourceforge.net (Ka-Ping Yee) Date: Sat, 10 Mar 2001 01:33:17 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/distutils/command build_ext.py,1.72,1.73 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory usw-pr-cvs1:/tmp/cvs-serv10600/distutils/command Modified Files: build_ext.py Log Message: Make docstrings raw, since they contain literal backslashes. Index: build_ext.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/build_ext.py,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -r1.72 -r1.73 *** build_ext.py 2001/02/17 04:48:41 1.72 --- build_ext.py 2001/03/10 09:33:14 1.73 *************** *** 546,550 **** def get_ext_filename (self, ext_name): ! """Convert the name of an extension (eg. "foo.bar") into the name of the file from which it will be loaded (eg. "foo/bar.so", or "foo\bar.pyd"). --- 546,550 ---- def get_ext_filename (self, ext_name): ! r"""Convert the name of an extension (eg. "foo.bar") into the name of the file from which it will be loaded (eg. "foo/bar.so", or "foo\bar.pyd"). From tim_one@usw-pr-cvs1.sourceforge.net Sat Mar 10 21:48:26 2001 From: tim_one@usw-pr-cvs1.sourceforge.net (Tim Peters) Date: Sat, 10 Mar 2001 13:48:26 -0800 Subject: [Python-checkins] CVS: python/dist/src/Tools/idle idle.bat,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv619/python/dist/src/tools/idle Modified Files: idle.bat Log Message: Get rid of hardcoded Python path (can't guess where the user installed IDLE, and it likely changes across releases anyway). Index: idle.bat =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/idle.bat,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** idle.bat 2000/04/06 20:09:17 1.2 --- idle.bat 2001/03/10 21:48:24 1.3 *************** *** 1,3 **** rem idle.bat ! "C:\Python16\python.exe" "idle.pyw" %1 %2 %3 %4 %5 %6 %7 %8 %9 --- 1,3 ---- rem idle.bat ! start idle.pyw %1 %2 %3 %4 %5 %6 %7 %8 %9 From fdrake@usw-pr-cvs1.sourceforge.net Sun Mar 11 03:03:09 2001 From: fdrake@usw-pr-cvs1.sourceforge.net (Fred L. Drake) Date: Sat, 10 Mar 2001 19:03:09 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules grpmodule.c,2.14,2.15 pwdmodule.c,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv7979 Modified Files: grpmodule.c pwdmodule.c Log Message: Make sure we close the group and password databases when we are done with them; this closes SF bug #407504. Index: grpmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/grpmodule.c,v retrieving revision 2.14 retrieving revision 2.15 diff -C2 -r2.14 -r2.15 *** grpmodule.c 2000/09/01 23:29:26 2.14 --- grpmodule.c 2001/03/11 03:03:07 2.15 *************** *** 88,91 **** --- 88,92 ---- Py_DECREF(v); } + endgrent(); return d; } Index: pwdmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/pwdmodule.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -r1.24 -r1.25 *** pwdmodule.c 2000/09/01 23:29:27 1.24 --- pwdmodule.c 2001/03/11 03:03:07 1.25 *************** *** 103,106 **** --- 103,107 ---- Py_DECREF(v); } + endpwent(); return d; } From tim_one@usw-pr-cvs1.sourceforge.net Sun Mar 11 04:30:37 2001 From: tim_one@usw-pr-cvs1.sourceforge.net (Tim Peters) Date: Sat, 10 Mar 2001 20:30:37 -0800 Subject: [Python-checkins] CVS: python/dist/src/PC python_nt.rc,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/PC In directory usw-pr-cvs1:/tmp/cvs-serv15357/python/dist/src/PC Modified Files: python_nt.rc Log Message: Magic strings in both Python and the Wise installer define the registry key to be used in Windows. They got out of synch. Repaired that, and added comments to each one pointing at the other. Index: python_nt.rc =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/python_nt.rc,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** python_nt.rc 2001/02/09 07:02:22 1.12 --- python_nt.rc 2001/03/11 04:30:35 1.13 *************** *** 12,15 **** --- 12,16 ---- * MS_DLL_ID if the minor version number changes. * PYTHON_DLL_NAME ditto. + * MS_DLL_ID must match PY_VERSION in the Windows install script. */ #define MS_DLL_ID "2.1" From tim_one@usw-pr-cvs1.sourceforge.net Sun Mar 11 04:30:37 2001 From: tim_one@usw-pr-cvs1.sourceforge.net (Tim Peters) Date: Sat, 10 Mar 2001 20:30:37 -0800 Subject: [Python-checkins] CVS: python/dist/src/PCbuild python20.wse,1.29,1.30 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv15357/python/dist/src/PCbuild Modified Files: python20.wse Log Message: Magic strings in both Python and the Wise installer define the registry key to be used in Windows. They got out of synch. Repaired that, and added comments to each one pointing at the other. Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -r1.29 -r1.30 *** python20.wse 2001/03/02 04:59:38 1.29 --- python20.wse 2001/03/11 04:30:35 1.30 *************** *** 71,77 **** Value=Python 2.1 end item: Set Variable Variable=PY_VERSION ! Value=2.1b1 end item: Set Variable --- 71,80 ---- Value=Python 2.1 end + item: Remark + Text=PY_VERSION should be major.minor only; used to create the registry key; must match MS_DLL_ID in python_nt.rc + end item: Set Variable Variable=PY_VERSION ! Value=2.1 end item: Set Variable From tim_one@usw-pr-cvs1.sourceforge.net Sun Mar 11 07:34:20 2001 From: tim_one@usw-pr-cvs1.sourceforge.net (Tim Peters) Date: Sat, 10 Mar 2001 23:34:20 -0800 Subject: [Python-checkins] CVS: python/dist/src/PCbuild python20.wse,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv30288/python/dist/src/PCbuild Modified Files: python20.wse Log Message: SF bug Win32: pydoc command isn't executable. As the bug report notes, the Windows installer creates a useless pydoc file in the base directory. Changed the installer to rename it pydoc.pyw instead. Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -r1.30 -r1.31 *** python20.wse 2001/03/11 04:30:35 1.30 --- python20.wse 2001/03/11 07:34:18 1.31 *************** *** 957,961 **** item: Install File Source=%_SRC_%\Tools\scripts\pydoc ! Destination=%MAINDIR%\pydoc Description=Utility Scripts Flags=0000000000000010 --- 957,961 ---- item: Install File Source=%_SRC_%\Tools\scripts\pydoc ! Destination=%MAINDIR%\pydoc.pyw Description=Utility Scripts Flags=0000000000000010 From tim_one@usw-pr-cvs1.sourceforge.net Sun Mar 11 08:06:27 2001 From: tim_one@usw-pr-cvs1.sourceforge.net (Tim Peters) Date: Sun, 11 Mar 2001 00:06:27 -0800 Subject: [Python-checkins] CVS: python/dist/src/PCbuild python20.wse,1.31,1.32 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv886/python/dist/src/PCbuild Modified Files: python20.wse Log Message: Windows: Fallout from renaming the pydoc file. Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -r1.31 -r1.32 *** python20.wse 2001/03/11 07:34:18 1.31 --- python20.wse 2001/03/11 08:06:25 1.32 *************** *** 1347,1351 **** Source=%MAINDIR%\pythonw.exe Destination=%GROUP%\Module Docs.lnk ! Command Options=%MAINDIR%\pydoc Working Directory=%MAINDIR% Key Type=1536 --- 1347,1351 ---- Source=%MAINDIR%\pythonw.exe Destination=%GROUP%\Module Docs.lnk ! Command Options=%MAINDIR%\pydoc.pyw Working Directory=%MAINDIR% Key Type=1536 From tim_one@usw-pr-cvs1.sourceforge.net Sun Mar 11 08:37:33 2001 From: tim_one@usw-pr-cvs1.sourceforge.net (Tim Peters) Date: Sun, 11 Mar 2001 00:37:33 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects complexobject.c,2.33,2.34 floatobject.c,2.80,2.81 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv3566/python/dist/src/Objects Modified Files: complexobject.c floatobject.c Log Message: When 1.6 boosted the # of digits produced by repr(float), repr(complex) apparently forgot to play along. Make complex act like float. Index: complexobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/complexobject.c,v retrieving revision 2.33 retrieving revision 2.34 diff -C2 -r2.33 -r2.34 *** complexobject.c 2001/01/18 01:12:39 2.33 --- complexobject.c 2001/03/11 08:37:29 2.34 *************** *** 10,14 **** --- 10,29 ---- #include "Python.h" + /* Precisions used by repr() and str(), respectively. + The repr() precision (17 significant decimal digits) is the minimal number + that is guaranteed to have enough precision so that if the number is read + back in the exact same binary value is recreated. This is true for IEEE + floating point by design, and also happens to work for all other modern + hardware. + + The str() precision is chosen so that in most cases, the rounding noise + created by various operations is suppressed, while giving plenty of + precision for practical use. + */ + + #define PREC_REPR 17 + #define PREC_STR 12 + /* elementary operations on complex numbers */ *************** *** 174,178 **** cv.imag = 0.; return cv; ! } } --- 189,193 ---- cv.imag = 0.; return cv; ! } } *************** *** 185,202 **** static void ! complex_buf_repr(char *buf, PyComplexObject *v) { if (v->cval.real == 0.) ! sprintf(buf, "%.12gj", v->cval.imag); else ! sprintf(buf, "(%.12g%+.12gj)", v->cval.real, v->cval.imag); } static int complex_print(PyComplexObject *v, FILE *fp, int flags) - /* flags -- not used but required by interface */ { char buf[100]; ! complex_buf_repr(buf, v); fputs(buf, fp); return 0; --- 200,218 ---- static void ! complex_to_buf(char *buf, PyComplexObject *v, int precision) { if (v->cval.real == 0.) ! sprintf(buf, "%.*gj", precision, v->cval.imag); else ! sprintf(buf, "(%.*g%+.*gj)", precision, v->cval.real, ! precision, v->cval.imag); } static int complex_print(PyComplexObject *v, FILE *fp, int flags) { char buf[100]; ! complex_to_buf(buf, v, ! (flags & Py_PRINT_RAW) ? PREC_STR : PREC_REPR); fputs(buf, fp); return 0; *************** *** 206,211 **** complex_repr(PyComplexObject *v) { char buf[100]; ! complex_buf_repr(buf, v); return PyString_FromString(buf); } --- 222,235 ---- complex_repr(PyComplexObject *v) { + char buf[100]; + complex_to_buf(buf, v, PREC_REPR); + return PyString_FromString(buf); + } + + static PyObject * + complex_str(PyComplexObject *v) + { char buf[100]; ! complex_to_buf(buf, v, PREC_STR); return PyString_FromString(buf); } *************** *** 542,546 **** (hashfunc)complex_hash, /* tp_hash */ 0, /* tp_call */ ! 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ --- 566,570 ---- (hashfunc)complex_hash, /* tp_hash */ 0, /* tp_call */ ! (reprfunc)complex_str, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ Index: floatobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/floatobject.c,v retrieving revision 2.80 retrieving revision 2.81 diff -C2 -r2.80 -r2.81 *** floatobject.c 2001/03/06 12:14:54 2.80 --- floatobject.c 2001/03/11 08:37:29 2.81 *************** *** 315,319 **** static int float_print(PyFloatObject *v, FILE *fp, int flags) - /* flags -- not used but required by interface */ { char buf[100]; --- 315,318 ---- From tim_one@usw-pr-cvs1.sourceforge.net Sun Mar 11 18:36:15 2001 From: tim_one@usw-pr-cvs1.sourceforge.net (Tim Peters) Date: Sun, 11 Mar 2001 10:36:15 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects obmalloc.c,2.1,2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv15820/python/dist/src/Objects Modified Files: obmalloc.c Log Message: Identifiers matching _[A-Z_]\w* are reserved for C implementations. May or may not be related to bug 407680 (obmalloc.c - looks like it's corrupted). This repairs the illegal vrbl names, but leaves a pile of illegal macro names (_THIS_xxx, _SYSTEM_xxx, _SET_HOOKS, _FETCH_HOOKS). Index: obmalloc.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/obmalloc.c,v retrieving revision 2.1 retrieving revision 2.2 diff -C2 -r2.1 -r2.2 *** obmalloc.c 2001/02/27 04:45:05 2.1 --- obmalloc.c 2001/03/11 18:36:13 2.2 *************** *** 287,291 **** /* Pool for small blocks */ struct pool_header { ! union { block *__padding; uint count; } ref; /* number of allocated blocks */ block *freeblock; /* pool's free list head */ --- 287,291 ---- /* Pool for small blocks */ struct pool_header { ! union { block *_padding; uint count; } ref; /* number of allocated blocks */ block *freeblock; /* pool's free list head */ *************** *** 311,319 **** * This malloc lock */ ! SIMPLELOCK_DECL(__malloc_lock); ! #define LOCK() SIMPLELOCK_LOCK(__malloc_lock) ! #define UNLOCK() SIMPLELOCK_UNLOCK(__malloc_lock) ! #define LOCK_INIT() SIMPLELOCK_INIT(__malloc_lock) ! #define LOCK_FINI() SIMPLELOCK_FINI(__malloc_lock) /* --- 311,319 ---- * This malloc lock */ ! SIMPLELOCK_DECL(_malloc_lock); ! #define LOCK() SIMPLELOCK_LOCK(_malloc_lock) ! #define UNLOCK() SIMPLELOCK_UNLOCK(_malloc_lock) ! #define LOCK_INIT() SIMPLELOCK_INIT(_malloc_lock) ! #define LOCK_FINI() SIMPLELOCK_FINI(_malloc_lock) /* From fdrake@usw-pr-cvs1.sourceforge.net Mon Mar 12 02:56:17 2001 From: fdrake@usw-pr-cvs1.sourceforge.net (Fred L. Drake) Date: Sun, 11 Mar 2001 18:56:17 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib multifile.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv17173 Modified Files: multifile.py Log Message: Multifile.read(): Fix a broken conversion to string methods. This closes SF bug #407777. Index: multifile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/multifile.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** multifile.py 2001/02/09 16:52:55 1.16 --- multifile.py 2001/03/12 02:56:15 1.17 *************** *** 118,122 **** def read(self): # Note: no size argument -- read until EOF only! ! return self.readlines().join('') def next(self): --- 118,122 ---- def read(self): # Note: no size argument -- read until EOF only! ! return ''.join(self.readlines()) def next(self): From bwarsaw@usw-pr-cvs1.sourceforge.net Mon Mar 12 20:30:49 2001 From: bwarsaw@usw-pr-cvs1.sourceforge.net (Barry Warsaw) Date: Mon, 12 Mar 2001 12:30:49 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0000.txt,1.71,1.72 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv20776 Modified Files: pep-0000.txt Log Message: Paul Barrett requests moving PEP 209 to Pie-in-the-sky, from Future. Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -r1.71 -r1.72 *** pep-0000.txt 2001/02/26 20:22:47 1.71 --- pep-0000.txt 2001/03/12 20:30:47 1.72 *************** *** 43,47 **** S 234 pep-0234.txt Iterators Yee - S 209 pep-0209.txt Adding Multidimensional Arrays Barrett, Oliphant S 232 pep-0232.txt Function Attributes Warsaw --- 43,46 ---- *************** *** 49,52 **** --- 48,52 ---- I 206 pep-0206.txt 2.0 Batteries Included Zadka + S 209 pep-0209.txt Adding Multidimensional Arrays Barrett, Oliphant SD 211 pep-0211.txt Adding New Linear Algebra Operators Wilson SD 212 pep-0212.txt Loop Counter Iteration Schneider-Kamp From gvanrossum@usw-pr-cvs1.sourceforge.net Mon Mar 12 20:45:26 2001 From: gvanrossum@usw-pr-cvs1.sourceforge.net (Guido van Rossum) Date: Mon, 12 Mar 2001 12:45:26 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0219.txt,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv30887 Modified Files: pep-0219.txt Log Message: Christian handed this out at Python9. Might as well save it for posterity. It was written by Gordon. Index: pep-0219.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0219.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** pep-0219.txt 2000/08/23 05:52:49 1.2 --- pep-0219.txt 2001/03/12 20:45:24 1.3 *************** *** 5,22 **** Status: Draft Type: Standards Track ! Python-Version: 2.1 ! Created: 14-Aug-2000 Post-History: ! Abstract ! Argues for changes (mostly to ceval.c and frameobject.c) that ! disentangle Python's stack usage from the C stack. Each frame ! gets its own stacklet (just enough for its requirements). Also ! changes ceval.c so that the ceval.c does not cause the interpreter ! to recurse (although other C code may still do so). No impact on ! Python's syntax or semantics. --- 5,168 ---- Status: Draft Type: Standards Track ! Python-Version: 2.1 Created: 14-Aug-2000 Post-History: ! Introduction ! This PEP discusses changes required to core Python in order to ! efficiently support generators, microthreads and coroutines. It ! is related to PEP 220, which describes how Python should be extended ! to support these facilities. The focus of this PEP is strictly on ! the changes required to allow these extensions to work. + While these PEPs are based on Christian Tismer's Stackless[1] + implementation, they do not regard Stackless as a reference + implementation. Stackless (with an extension module) implements + continuations, and from continuations one can implement coroutines, + microthreads (as has been done by Will Ware[2]) and generators. But + in more that a year, no one has found any other productive use of + continuations, so there seems to be no demand for their support. + + However, Stackless support for continuations is a relatively minor + piece of the implementation, so one might regard it as "a" reference + implementation (rather than "the" reference implementation). + + Background + + Generators and coroutines have been implmented in a number of languages in + a number of ways. Indeed, Tim Peters has done pure Python implementations + of generators[3] and coroutines[4] using threads (and a thread-based + coroutine implementation exists for Java). However, the horrendous + overhead of a thread-based implementation severely limits the usefulness + of this approach. + + Microthreads (a.k.a "green" or "user" threads) and coroutines involve + transfers of control that are difficult to accomodate in a language + implementation based on a single stack. (Generators can be done on a + single stack, but they can also be regarded as a very simple case of + coroutines.) + + Real threads allocate a full-sized stack for each thread of control, and + this is the major source of overhead. However, coroutines and microthreads + can be implemented in Python in a way that involves almost no overhead. + This PEP, therefor, offers a way for making Python able to realistically + manage thousands of separate "threads" of activity (vs. todays limit of + perhaps dozens of separate threads of activity). + + Another justification for this PEP (explored in PEP 220) is that + coroutines and generators often allow a more direct expression of an + algorithm than is possible in today's Python. + + Discussion + + The first thing to note is that Python, while it mingles interpreter data + (normal C stack usage) with Python data (the state of the interpreted + program) on the stack, the two are logically separate. They just happen to + use the same stack. + + A real thread gets something approaching a process-sized stack because the + implementation has no way of knowing how much stack space the thread will + require. The stack space required for an individual frame is likely to be + reasonable, but stack switching is an arcane and non-portable process, + not supported by C. + + Once Python stops putting Python data on the C stack, however, stack + switching becomes easy. + + The fundamental approach of the PEP is based on these two ideas. First, + separate C's stack usage from Python's stack usage. Secondly, associate + with each frame enough stack space to handle that frame's execution. + + In the normal usage, Stackless Python has a normal stack structure, + except that it is broken into chunks. But in the presence of a + coroutine / microthread extension, this same mechanism supports a stack + with a tree structure. That is, an extension can support transfers of + control between frames outside the normal "call / return" path. + + Problems + + The major difficulty with this approach is C calling Python. The problem + is that the C stack now holds a nested execution of the byte-code + interpreter. In that situation, a coroutine / microthread extension cannot + be permitted to transfer control to a frame in a different invocation of the + byte-code interpreter. If a frame were to complete and exit back to C from + the wrong interpreter, the C stack could be trashed. + + The ideal solution is to create a mechanism where nested executions of the + byte code interpreter are never needed. The easy solution is for the + coroutine / microthread extension(s) to recognize the situation and refuse + to allow transfers outside the current invocation. + + We can categorize code that involves C calling Python into two camps: + Python's implementation, and C extensions. And hopefully we can offer a + compromise: Python's internal usage (and C extension writers who want to + go to the effort) will no longer use a nested invocation of the + interpreter. Extensions which do not go to the effort will still be + safe, but will not play well with coroutines / microthreads. + + Generally, when a recursive call is transformed into a loop, a bit of + extra bookkeeping is required. The loop will need to keep it's own + "stack" of arguments and results since the real stack can now only hold + the most recent. The code will be more verbose, because it's not quite + as obvious when we're done. While Stackless is not implemented this way, + it has to deal with the same issues. + + In normal Python, PyEval_EvalCode is used to build a frame and execute + it. Stackless Python introduces the concept of a FrameDispatcher. Like + PyEval_EvalCode, it executes one frame. But the interpreter may signal + the FrameDispatcher that a new frame has been swapped in, and the new + frame should be executed. When a frame completes, the FrameDispatcher + follows the back pointer to resume the "calling" frame. + + So Stackless transforms recursions into a loop, but it is not the + FrameDispatcher that manages the frames. This is done by the interpreter + (or an extension that knows what it's doing). + + The general idea is that where C code needs to execute Python code, it + creates a frame for the Python code, setting its back pointer to the + current frame. Then it swaps in the frame, signals the FrameDispatcher + and gets out of the way. The C stack is now clean - the Python code can + transfer control to any other frame (if an extension gives it the means + to do so). + + In the vanilla case, this magic can be hidden from the programmer (even, + in most cases, from the Python-internals programmer). Many situations + present another level of difficulty, however. + + The map builtin function involves two obstacles to this approach. It + cannot simply construct a frame and get out of the way, not just because + there's a loop involved, but each pass through the loop requires some + "post" processing. In order to play well with others, Stackless + constructs a frame object for map itself. + + Most recursions of the interpreter are not this complex, but fairly + frequently, some "post" operations are required. Stackless does not + fix these situations because of amount of code changes required. Instead, + Stackless prohibits transfers out of a nested interpreter. While not + ideal (and sometimes puzzling), this limitation is hardly crippling. + + + Advantages + + For normal Python, the advantage to this approach is that C stack usage + becomes much smaller and more predictable. Unbounded recursion in Python + code becomes a memory error, instead of a stack error (and thus, in + non-Cupertino operating systems, something that can be recovered from). + The price, of course, is the added complexity that comes from transforming + recursions of the byte-code interpreter loop into a higher order loop + (and the attendant bookkeeping involved). + + The big advantage comes from realizing that the Python stack is really + a tree, and the frame dispatcher can transfer control freely between + leaf nodes of the tree, thus allowing things like microthreads and + coroutines. + + References + + [1] www.stackless.com + [2] http://world.std.com/~wware/uthread.html + [3] Demo/threads/Generator.py in the source distribution + [4] http://www.stackless.com/coroutines.tim.peters.html From fdrake@usw-pr-cvs1.sourceforge.net Mon Mar 12 21:03:29 2001 From: fdrake@usw-pr-cvs1.sourceforge.net (Fred L. Drake) Date: Mon, 12 Mar 2001 13:03:29 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python modsupport.c,2.54,2.55 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv11569/Python Modified Files: modsupport.c Log Message: Py_BuildValue(): Add "D" conversion to create a Python complex value from a Py_complex C value. Patch by Walter Dörwald. This partially closes SF patch #407148. Index: modsupport.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/modsupport.c,v retrieving revision 2.54 retrieving revision 2.55 diff -C2 -r2.54 -r2.55 *** modsupport.c 2000/09/26 05:46:01 2.54 --- modsupport.c 2001/03/12 21:03:26 2.55 *************** *** 287,290 **** --- 287,296 ---- (double)va_arg(*p_va, va_double)); + #ifndef WITHOUT_COMPLEX + case 'D': + return PyComplex_FromCComplex( + *((Py_complex *)va_arg(*p_va, Py_complex *))); + #endif /* WITHOUT_COMPLEX */ + case 'c': { From fdrake@usw-pr-cvs1.sourceforge.net Mon Mar 12 21:06:34 2001 From: fdrake@usw-pr-cvs1.sourceforge.net (Fred L. Drake) Date: Mon, 12 Mar 2001 13:06:34 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/ext ext.tex,1.93,1.94 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory usw-pr-cvs1:/tmp/cvs-serv11895/ext Modified Files: ext.tex Log Message: Py_BuildValue(): Add "D" conversion to create a Python complex value from a Py_complex C value. Patch by Walter Dörwald. This closes SF patch #407148. Index: ext.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/ext.tex,v retrieving revision 1.93 retrieving revision 1.94 diff -C2 -r1.93 -r1.94 *** ext.tex 2001/03/02 19:48:06 1.93 --- ext.tex 2001/03/12 21:06:31 1.94 *************** *** 1129,1132 **** --- 1129,1135 ---- Same as \samp{d}. + \item[\samp{D} (complex) {[Py_complex *]}] + Convert a C \ctype{Py_complex} structure to a Python complex number. + \item[\samp{O} (object) {[PyObject *]}] Pass a Python object untouched (except for its reference count, which From jhylton@usw-pr-cvs1.sourceforge.net Tue Mar 13 01:58:23 2001 From: jhylton@usw-pr-cvs1.sourceforge.net (Jeremy Hylton) Date: Mon, 12 Mar 2001 17:58:23 -0800 Subject: [Python-checkins] CVS: python/dist/src/Include frameobject.h,2.30,2.31 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv30486/Include Modified Files: frameobject.h Log Message: Variety of small INC/DECREF patches that fix reported memory leaks with free variables. Thanks to Martin v. Loewis for finding two of the problems. This fixes SF buf 405583. There is also a C API change: PyFrame_New() is reverting to its pre-2.1 signature. The change introduced by nested scopes was a mistake. XXX Is this okay between beta releases? cell_clear(), the GC helper, must decref its reference to break cycles. frame_dealloc() must dealloc all cell vars and free vars in addition to locals. eval_code2() setup code must INCREF cells it copies out of the closure. The STORE_DEREF opcode implementation must DECREF the object it passes to PyCell_Set(). Index: frameobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/frameobject.h,v retrieving revision 2.30 retrieving revision 2.31 diff -C2 -r2.30 -r2.31 *** frameobject.h 2001/01/29 22:51:52 2.30 --- frameobject.h 2001/03/13 01:58:21 2.31 *************** *** 47,52 **** DL_IMPORT(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *, ! PyObject *, PyObject *, ! PyObject *); --- 47,51 ---- DL_IMPORT(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *, ! PyObject *, PyObject *); From jhylton@usw-pr-cvs1.sourceforge.net Tue Mar 13 01:58:23 2001 From: jhylton@usw-pr-cvs1.sourceforge.net (Jeremy Hylton) Date: Mon, 12 Mar 2001 17:58:23 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects cellobject.c,1.1,1.2 frameobject.c,2.45,2.46 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv30486/Objects Modified Files: cellobject.c frameobject.c Log Message: Variety of small INC/DECREF patches that fix reported memory leaks with free variables. Thanks to Martin v. Loewis for finding two of the problems. This fixes SF buf 405583. There is also a C API change: PyFrame_New() is reverting to its pre-2.1 signature. The change introduced by nested scopes was a mistake. XXX Is this okay between beta releases? cell_clear(), the GC helper, must decref its reference to break cycles. frame_dealloc() must dealloc all cell vars and free vars in addition to locals. eval_code2() setup code must INCREF cells it copies out of the closure. The STORE_DEREF opcode implementation must DECREF the object it passes to PyCell_Set(). Index: cellobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/cellobject.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** cellobject.c 2001/01/25 20:04:14 1.1 --- cellobject.c 2001/03/13 01:58:21 1.2 *************** *** 84,87 **** --- 84,88 ---- cell_clear(PyCellObject *op) { + Py_XDECREF(op->ob_ref); op->ob_ref = NULL; return 0; Index: frameobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/frameobject.c,v retrieving revision 2.45 retrieving revision 2.46 diff -C2 -r2.45 -r2.46 *** frameobject.c 2001/01/29 22:51:52 2.45 --- frameobject.c 2001/03/13 01:58:21 2.46 *************** *** 66,76 **** frame_dealloc(PyFrameObject *f) { ! int i; PyObject **fastlocals; Py_TRASHCAN_SAFE_BEGIN(f) /* Kill all local variables */ fastlocals = f->f_localsplus; ! for (i = f->f_nlocals; --i >= 0; ++fastlocals) { Py_XDECREF(*fastlocals); } --- 66,77 ---- frame_dealloc(PyFrameObject *f) { ! int i, slots; PyObject **fastlocals; Py_TRASHCAN_SAFE_BEGIN(f) /* Kill all local variables */ + slots = f->f_nlocals + f->f_ncells + f->f_nfreevars; fastlocals = f->f_localsplus; ! for (i = slots; --i >= 0; ++fastlocals) { Py_XDECREF(*fastlocals); } *************** *** 109,113 **** PyFrameObject * PyFrame_New(PyThreadState *tstate, PyCodeObject *code, PyObject *globals, ! PyObject *locals, PyObject *closure) { PyFrameObject *back = tstate->frame; --- 110,114 ---- PyFrameObject * PyFrame_New(PyThreadState *tstate, PyCodeObject *code, PyObject *globals, ! PyObject *locals) { PyFrameObject *back = tstate->frame; From jhylton@usw-pr-cvs1.sourceforge.net Tue Mar 13 01:58:24 2001 From: jhylton@usw-pr-cvs1.sourceforge.net (Jeremy Hylton) Date: Mon, 12 Mar 2001 17:58:24 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python ceval.c,2.230,2.231 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv30486/Python Modified Files: ceval.c Log Message: Variety of small INC/DECREF patches that fix reported memory leaks with free variables. Thanks to Martin v. Loewis for finding two of the problems. This fixes SF buf 405583. There is also a C API change: PyFrame_New() is reverting to its pre-2.1 signature. The change introduced by nested scopes was a mistake. XXX Is this okay between beta releases? cell_clear(), the GC helper, must decref its reference to break cycles. frame_dealloc() must dealloc all cell vars and free vars in addition to locals. eval_code2() setup code must INCREF cells it copies out of the closure. The STORE_DEREF opcode implementation must DECREF the object it passes to PyCell_Set(). Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.230 retrieving revision 2.231 diff -C2 -r2.230 -r2.231 *** ceval.c 2001/02/16 11:52:31 2.230 --- ceval.c 2001/03/13 01:58:21 2.231 *************** *** 431,435 **** f = PyFrame_New(tstate, /*back*/ co, /*code*/ ! globals, locals, closure); if (f == NULL) return NULL; --- 431,435 ---- f = PyFrame_New(tstate, /*back*/ co, /*code*/ ! globals, locals); if (f == NULL) return NULL; *************** *** 579,584 **** if (f->f_nfreevars) { int i; ! for (i = 0; i < f->f_nfreevars; ++i) ! freevars[f->f_ncells + i] = PyTuple_GET_ITEM(closure, i); } --- 579,587 ---- if (f->f_nfreevars) { int i; ! for (i = 0; i < f->f_nfreevars; ++i) { ! PyObject *o = PyTuple_GET_ITEM(closure, i); ! Py_INCREF(o); ! freevars[f->f_ncells + i] = o; ! } } *************** *** 1663,1667 **** break; } - Py_INCREF(w); PUSH(w); break; --- 1666,1669 ---- *************** *** 1671,1674 **** --- 1673,1677 ---- x = freevars[oparg]; PyCell_Set(x, w); + Py_DECREF(w); continue; From jhylton@usw-pr-cvs1.sourceforge.net Tue Mar 13 01:58:24 2001 From: jhylton@usw-pr-cvs1.sourceforge.net (Jeremy Hylton) Date: Mon, 12 Mar 2001 17:58:24 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules pyexpat.c,2.43,2.44 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv30486/Modules Modified Files: pyexpat.c Log Message: Variety of small INC/DECREF patches that fix reported memory leaks with free variables. Thanks to Martin v. Loewis for finding two of the problems. This fixes SF buf 405583. There is also a C API change: PyFrame_New() is reverting to its pre-2.1 signature. The change introduced by nested scopes was a mistake. XXX Is this okay between beta releases? cell_clear(), the GC helper, must decref its reference to break cycles. frame_dealloc() must dealloc all cell vars and free vars in addition to locals. eval_code2() setup code must INCREF cells it copies out of the closure. The STORE_DEREF opcode implementation must DECREF the object it passes to PyCell_Set(). Index: pyexpat.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/pyexpat.c,v retrieving revision 2.43 retrieving revision 2.44 diff -C2 -r2.43 -r2.44 *** pyexpat.c 2001/03/01 20:48:17 2.43 --- pyexpat.c 2001/03/13 01:58:22 2.44 *************** *** 357,363 **** tstate->frame->f_globals, /*globals*/ NULL /*locals*/ - #if PYTHON_API_VERSION >= 1010 - ,NULL /*closure*/ - #endif ); if (f == NULL) --- 357,360 ---- From jhylton@usw-pr-cvs1.sourceforge.net Tue Mar 13 02:01:15 2001 From: jhylton@usw-pr-cvs1.sourceforge.net (Jeremy Hylton) Date: Mon, 12 Mar 2001 18:01:15 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_scope,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv30749/Lib/test/output Modified Files: test_scope Log Message: Add test to verify that nested functions with free variables don't cause the free variables to leak. Index: test_scope =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_scope,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** test_scope 2001/03/01 20:35:45 1.4 --- test_scope 2001/03/13 02:01:12 1.5 *************** *** 15,16 **** --- 15,17 ---- 14. complex definitions 15. scope of global statements + 16. check leaks From jhylton@usw-pr-cvs1.sourceforge.net Tue Mar 13 02:01:14 2001 From: jhylton@usw-pr-cvs1.sourceforge.net (Jeremy Hylton) Date: Mon, 12 Mar 2001 18:01:14 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_scope.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv30749/Lib/test Modified Files: test_scope.py Log Message: Add test to verify that nested functions with free variables don't cause the free variables to leak. Index: test_scope.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_scope.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** test_scope.py 2001/03/01 20:35:45 1.10 --- test_scope.py 2001/03/13 02:01:12 1.11 *************** *** 384,385 **** --- 384,408 ---- verify(f() == 2) verify(x == 2) + + print "16. check leaks" + + class Foo: + count = 0 + + def __init__(self): + Foo.count += 1 + + def __del__(self): + Foo.count -= 1 + + def f1(): + x = Foo() + def f2(): + return x + f2() + + for i in range(100): + f1() + + verify(Foo.count == 0) + From gvanrossum@usw-pr-cvs1.sourceforge.net Tue Mar 13 09:31:09 2001 From: gvanrossum@usw-pr-cvs1.sourceforge.net (Guido van Rossum) Date: Tue, 13 Mar 2001 01:31:09 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_support.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv10881 Modified Files: test_support.py Log Message: Oops. A RISCOS patch I forgot to check in. Index: test_support.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_support.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** test_support.py 2001/02/21 07:29:48 1.16 --- test_support.py 2001/03/13 09:31:07 1.17 *************** *** 56,60 **** return cmp(x, y) ! TESTFN = '@test' # Filename used for testing from os import unlink --- 56,66 ---- return cmp(x, y) ! import os ! if os.name !='riscos': ! TESTFN = '@test' # Filename used for testing ! else: ! TESTFN = 'test' # Filename used for testing ! del os ! from os import unlink From gvanrossum@usw-pr-cvs1.sourceforge.net Tue Mar 13 10:07:44 2001 From: gvanrossum@usw-pr-cvs1.sourceforge.net (Guido van Rossum) Date: Tue, 13 Mar 2001 02:07:44 -0800 Subject: [Python-checkins] CVS: python/dist/src Makefile.pre.in,1.29,1.29.2.1 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv16532 Modified Files: Tag: iter-branch Makefile.pre.in Log Message: This is the first iteration of my iterator patches. Don't worry, this is on a branch (iter-branch), and it may still change. Caveats: - It's incomplete: class instances don't support __iter__ yet. - It's currently using call notation to get the next item from the iterator; there have been arguments for making this use the next() method. - The iter() built-in function is overloaded: iter(x) returns the iterator from x, iter(func, value) returns an iterator that calls a function until it returns or raises value. Note: the 'raises' part is experimental. - There is no test suite or documentation yet. Enjoy! Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.29 retrieving revision 1.29.2.1 diff -C2 -r1.29 -r1.29.2.1 *** Makefile.pre.in 2001/03/06 05:52:16 1.29 --- Makefile.pre.in 2001/03/13 10:07:40 1.29.2.1 *************** *** 241,244 **** --- 241,245 ---- Objects/intobject.o \ Objects/listobject.o \ + Objects/iterobject.o \ Objects/longobject.o \ Objects/dictobject.o \ *************** *** 432,435 **** --- 433,437 ---- Include/tupleobject.h \ Include/listobject.h \ + Include/iterobject.h \ Include/dictobject.h \ Include/methodobject.h \ From gvanrossum@usw-pr-cvs1.sourceforge.net Tue Mar 13 10:07:44 2001 From: gvanrossum@usw-pr-cvs1.sourceforge.net (Guido van Rossum) Date: Tue, 13 Mar 2001 02:07:44 -0800 Subject: [Python-checkins] CVS: python/dist/src/Include iterobject.h,NONE,1.1.2.1 Python.h,2.31,2.31.2.1 abstract.h,2.28,2.28.2.1 object.h,2.77,2.77.2.1 opcode.h,2.34,2.34.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv16532/Include Modified Files: Tag: iter-branch Python.h abstract.h object.h opcode.h Added Files: Tag: iter-branch iterobject.h Log Message: This is the first iteration of my iterator patches. Don't worry, this is on a branch (iter-branch), and it may still change. Caveats: - It's incomplete: class instances don't support __iter__ yet. - It's currently using call notation to get the next item from the iterator; there have been arguments for making this use the next() method. - The iter() built-in function is overloaded: iter(x) returns the iterator from x, iter(func, value) returns an iterator that calls a function until it returns or raises value. Note: the 'raises' part is experimental. - There is no test suite or documentation yet. Enjoy! --- NEW FILE: iterobject.h --- /* Iterators (the basic kind, over a sequence) */ extern DL_IMPORT(PyTypeObject) PyIter_Type; #define PyIter_Check(op) ((op)->ob_type == &PyIter_Type) extern DL_IMPORT(PyObject *) PyIter_New(PyObject *); extern DL_IMPORT(PyTypeObject) PyCallIter_Type; #define PyCallIter_Check(op) ((op)->ob_type == &PyCallIter_Type) extern DL_IMPORT(PyObject *) PyCallIter_New(PyObject *, PyObject *); Index: Python.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/Python.h,v retrieving revision 2.31 retrieving revision 2.31.2.1 diff -C2 -r2.31 -r2.31.2.1 *** Python.h 2001/01/25 20:04:14 2.31 --- Python.h 2001/03/13 10:07:41 2.31.2.1 *************** *** 83,86 **** --- 83,87 ---- #include "sliceobject.h" #include "cellobject.h" + #include "iterobject.h" #include "codecs.h" Index: abstract.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/abstract.h,v retrieving revision 2.28 retrieving revision 2.28.2.1 diff -C2 -r2.28 -r2.28.2.1 *** abstract.h 2001/01/17 17:09:53 2.28 --- abstract.h 2001/03/13 10:07:41 2.28.2.1 *************** *** 471,474 **** --- 471,479 ---- */ + DL_IMPORT(PyObject *) PyObject_GetIter(PyObject *); + /* Takes an object and returns an iterator for it. + This is typically a new iterator but of the argument + is an iterator, this returns itself. */ + /* Number Protocol:*/ Index: object.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/object.h,v retrieving revision 2.77 retrieving revision 2.77.2.1 diff -C2 -r2.77 -r2.77.2.1 *** object.h 2001/02/26 18:56:37 2.77 --- object.h 2001/03/13 10:07:41 2.77.2.1 *************** *** 201,204 **** --- 201,205 ---- typedef long (*hashfunc)(PyObject *); typedef PyObject *(*richcmpfunc) (PyObject *, PyObject *, int); + typedef PyObject *(*getiterfunc) (PyObject *); typedef struct _typeobject { *************** *** 250,255 **** long tp_weaklistoffset; #ifdef COUNT_ALLOCS ! /* these must be last */ int tp_alloc; int tp_free; --- 251,259 ---- long tp_weaklistoffset; + /* Iterators */ + getiterfunc tp_iter; + #ifdef COUNT_ALLOCS ! /* these must be last and never explicitly initialized */ int tp_alloc; int tp_free; *************** *** 343,354 **** #define Py_TPFLAGS_CHECKTYPES (1L<<4) #define Py_TPFLAGS_HAVE_RICHCOMPARE (1L<<5) /* Objects which are weakly referencable if their tp_weaklistoffset is >0 */ - /* XXX Should this have the same value as Py_TPFLAGS_HAVE_RICHCOMPARE? - * These both indicate a feature that appeared in the same alpha release. - */ #define Py_TPFLAGS_HAVE_WEAKREFS (1L<<6) #define Py_TPFLAGS_DEFAULT ( \ Py_TPFLAGS_HAVE_GETCHARBUFFER | \ --- 347,359 ---- #define Py_TPFLAGS_CHECKTYPES (1L<<4) + /* tp_richcompare is defined */ #define Py_TPFLAGS_HAVE_RICHCOMPARE (1L<<5) /* Objects which are weakly referencable if their tp_weaklistoffset is >0 */ #define Py_TPFLAGS_HAVE_WEAKREFS (1L<<6) + /* tp_iter is defined */ + #define Py_TPFLAGS_HAVE_ITER (1L<<7) + #define Py_TPFLAGS_DEFAULT ( \ Py_TPFLAGS_HAVE_GETCHARBUFFER | \ *************** *** 357,360 **** --- 362,366 ---- Py_TPFLAGS_HAVE_RICHCOMPARE | \ Py_TPFLAGS_HAVE_WEAKREFS | \ + Py_TPFLAGS_HAVE_ITER | \ 0) Index: opcode.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/opcode.h,v retrieving revision 2.34 retrieving revision 2.34.2.1 diff -C2 -r2.34 -r2.34.2.1 *** opcode.h 2001/02/01 22:48:12 2.34 --- opcode.h 2001/03/13 10:07:41 2.34.2.1 *************** *** 54,57 **** --- 54,58 ---- #define BINARY_OR 66 #define INPLACE_POWER 67 + #define GET_ITER 68 #define PRINT_EXPR 70 *************** *** 81,84 **** --- 82,86 ---- #define DELETE_NAME 91 /* "" */ #define UNPACK_SEQUENCE 92 /* Number of sequence items */ + #define FOR_ITER 93 #define STORE_ATTR 95 /* Index in name list */ From gvanrossum@usw-pr-cvs1.sourceforge.net Tue Mar 13 10:07:44 2001 From: gvanrossum@usw-pr-cvs1.sourceforge.net (Guido van Rossum) Date: Tue, 13 Mar 2001 02:07:44 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects iterobject.c,NONE,1.1.2.1 abstract.c,2.57,2.57.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv16532/Objects Modified Files: Tag: iter-branch abstract.c Added Files: Tag: iter-branch iterobject.c Log Message: This is the first iteration of my iterator patches. Don't worry, this is on a branch (iter-branch), and it may still change. Caveats: - It's incomplete: class instances don't support __iter__ yet. - It's currently using call notation to get the next item from the iterator; there have been arguments for making this use the next() method. - The iter() built-in function is overloaded: iter(x) returns the iterator from x, iter(func, value) returns an iterator that calls a function until it returns or raises value. Note: the 'raises' part is experimental. - There is no test suite or documentation yet. Enjoy! --- NEW FILE: iterobject.c --- /* Iterator objects */ #include "Python.h" typedef struct { PyObject_HEAD long it_index; PyObject *it_seq; } iterobject; PyObject * PyIter_New(PyObject *seq) { iterobject *it; it = PyObject_NEW(iterobject, &PyIter_Type); if (it == NULL) return NULL; it->it_index = 0; Py_INCREF(seq); it->it_seq = seq; return (PyObject *)it; } static void iter_dealloc(iterobject *it) { Py_DECREF(it->it_seq); PyObject_DEL(it); } static PyObject * iter_call(iterobject *it, PyObject *args) { PyObject *seq = it->it_seq; if (PyList_Check(seq)) { PyObject *item; if (it->it_index >= PyList_GET_SIZE(seq)) { PyErr_SetObject(PyExc_IndexError, Py_None); return NULL; } item = PyList_GET_ITEM(seq, it->it_index); it->it_index++; Py_INCREF(item); return item; } return PySequence_GetItem(seq, it->it_index++); } static PyObject * iter_getiter(PyObject *it) { Py_INCREF(it); return it; } PyTypeObject PyIter_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ "iterator", /* tp_name */ sizeof(iterobject), /* tp_basicsize */ 0, /* tp_itemsize */ /* methods */ (destructor)iter_dealloc, /* tp_dealloc */ 0, /* tp_print */ (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ iter_call, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ 0, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ (getiterfunc)iter_getiter, /* tp_iter */ }; /* -------------------------------------- */ typedef struct { PyObject_HEAD PyObject *it_callable; PyObject *it_sentinel; } calliterobject; PyObject * PyCallIter_New(PyObject *callable, PyObject *sentinel) { calliterobject *it; it = PyObject_NEW(calliterobject, &PyCallIter_Type); if (it == NULL) return NULL; Py_INCREF(callable); it->it_callable = callable; Py_INCREF(sentinel); it->it_sentinel = sentinel; return (PyObject *)it; } static void calliter_dealloc(calliterobject *it) { Py_DECREF(it->it_callable); Py_DECREF(it->it_sentinel); PyObject_DEL(it); } static PyObject * calliter_call(calliterobject *it, PyObject *args) { PyObject *result = PyObject_CallObject(it->it_callable, NULL); if (result != NULL) { if (PyObject_RichCompareBool(result, it->it_sentinel, Py_EQ)) { PyErr_SetObject(PyExc_IndexError, Py_None); Py_DECREF(result); result = NULL; } } else { if (PyErr_ExceptionMatches(it->it_sentinel)) PyErr_SetObject(PyExc_IndexError, Py_None); else if (PyErr_ExceptionMatches(PyExc_IndexError) && !PyErr_GivenExceptionMatches( PyExc_IndexError, it->it_sentinel)) PyErr_SetString(PyExc_TypeError, "callable in iterator raised unexpected IndexError"); } return result; } PyTypeObject PyCallIter_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ "callable-iterator", /* tp_name */ sizeof(calliterobject), /* tp_basicsize */ 0, /* tp_itemsize */ /* methods */ (destructor)calliter_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ calliter_call, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ 0, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ (getiterfunc)iter_getiter, /* tp_iter */ }; Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.57 retrieving revision 2.57.2.1 diff -C2 -r2.57 -r2.57.2.1 *** abstract.c 2001/01/17 15:29:42 2.57 --- abstract.c 2001/03/13 10:07:42 2.57.2.1 *************** *** 1627,1628 **** --- 1627,1652 ---- return retval; } + + PyObject * + PyObject_GetIter(PyObject *o) + { + PyTypeObject *t = o->ob_type; + getiterfunc f = NULL; + if (PyType_HasFeature(t, Py_TPFLAGS_HAVE_ITER)) + f = t->tp_iter; + if (f == NULL) { + #if 0 + if (PyCallable_Check(o)) { + Py_INCREF(o); + return o; + } + #endif + if (PySequence_Check(o)) + return PyIter_New(o); + PyErr_SetString(PyExc_TypeError, + "getiter() of non-sequence"); + return NULL; + } + else + return (*f)(o); + } From gvanrossum@usw-pr-cvs1.sourceforge.net Tue Mar 13 10:07:44 2001 From: gvanrossum@usw-pr-cvs1.sourceforge.net (Guido van Rossum) Date: Tue, 13 Mar 2001 02:07:44 -0800 Subject: [Python-checkins] CVS: python/dist/src/PCbuild pythoncore.dsp,1.9,1.9.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv16532/PCbuild Modified Files: Tag: iter-branch pythoncore.dsp Log Message: This is the first iteration of my iterator patches. Don't worry, this is on a branch (iter-branch), and it may still change. Caveats: - It's incomplete: class instances don't support __iter__ yet. - It's currently using call notation to get the next item from the iterator; there have been arguments for making this use the next() method. - The iter() built-in function is overloaded: iter(x) returns the iterator from x, iter(func, value) returns an iterator that calls a function until it returns or raises value. Note: the 'raises' part is experimental. - There is no test suite or documentation yet. Enjoy! Index: pythoncore.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/pythoncore.dsp,v retrieving revision 1.9 retrieving revision 1.9.2.1 diff -C2 -r1.9 -r1.9.2.1 *** pythoncore.dsp 2001/03/01 02:43:40 1.9 --- pythoncore.dsp 2001/03/13 10:07:42 1.9.2.1 *************** *** 969,972 **** --- 969,987 ---- # Begin Source File + SOURCE=..\Objects\iterobject.c + + !IF "$(CFG)" == "pythoncore - Win32 Release" + + !ELSEIF "$(CFG)" == "pythoncore - Win32 Debug" + + !ELSEIF "$(CFG)" == "pythoncore - Win32 Alpha Debug" + + !ELSEIF "$(CFG)" == "pythoncore - Win32 Alpha Release" + + !ENDIF + + # End Source File + # Begin Source File + SOURCE=..\Parser\listnode.c From gvanrossum@usw-pr-cvs1.sourceforge.net Tue Mar 13 10:07:44 2001 From: gvanrossum@usw-pr-cvs1.sourceforge.net (Guido van Rossum) Date: Tue, 13 Mar 2001 02:07:44 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_weakref.py,1.3,1.3.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv16532/Lib/test Modified Files: Tag: iter-branch test_weakref.py Log Message: This is the first iteration of my iterator patches. Don't worry, this is on a branch (iter-branch), and it may still change. Caveats: - It's incomplete: class instances don't support __iter__ yet. - It's currently using call notation to get the next item from the iterator; there have been arguments for making this use the next() method. - The iter() built-in function is overloaded: iter(x) returns the iterator from x, iter(func, value) returns an iterator that calls a function until it returns or raises value. Note: the 'raises' part is experimental. - There is no test suite or documentation yet. Enjoy! Index: test_weakref.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_weakref.py,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -r1.3 -r1.3.2.1 *** test_weakref.py 2001/03/01 03:06:53 1.3 --- test_weakref.py 2001/03/13 10:07:42 1.3.2.1 *************** *** 181,184 **** --- 181,185 ---- del items1, items2 del objects, o + print dict.items() verify(len(dict)==0, "deleting the keys did not clear the dictionary") print "weak key dict test complete" From gvanrossum@usw-pr-cvs1.sourceforge.net Tue Mar 13 10:07:45 2001 From: gvanrossum@usw-pr-cvs1.sourceforge.net (Guido van Rossum) Date: Tue, 13 Mar 2001 02:07:45 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.194,2.194.2.1 ceval.c,2.230,2.230.2.1 compile.c,2.186,2.186.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv16532/Python Modified Files: Tag: iter-branch bltinmodule.c ceval.c compile.c Log Message: This is the first iteration of my iterator patches. Don't worry, this is on a branch (iter-branch), and it may still change. Caveats: - It's incomplete: class instances don't support __iter__ yet. - It's currently using call notation to get the next item from the iterator; there have been arguments for making this use the next() method. - The iter() built-in function is overloaded: iter(x) returns the iterator from x, iter(func, value) returns an iterator that calls a function until it returns or raises value. Note: the 'raises' part is experimental. - There is no test suite or documentation yet. Enjoy! Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.194 retrieving revision 2.194.2.1 diff -C2 -r2.194 -r2.194.2.1 *** bltinmodule.c 2001/01/19 21:36:19 2.194 --- bltinmodule.c 2001/03/13 10:07:42 2.194.2.1 *************** *** 1301,1304 **** --- 1301,1330 ---- static PyObject * + builtin_iter(PyObject *self, PyObject *args) + { + PyObject *v, *w = NULL; + + if (!PyArg_ParseTuple(args, "O|O:iter", &v, &w)) + return NULL; + if (w == NULL) + return PyObject_GetIter(v); + if (!PyCallable_Check(v)) { + PyErr_SetString(PyExc_TypeError, + "iter(v, w): v must be callable"); + return NULL; + } + return PyCallIter_New(v, w); + } + + static char iter_doc[] = + "iter(object[, sentinel]) -> iterator\n\ + \n\ + Get an iterator from an object. If the sentinel argument is omitted,\n\ + the object must supply its own iterator, or be a sequence.\n\ + If a sentinel is given, the object must be callable and the iterator\n\ + calls it until it returns or raises the sentinel."; + + + static PyObject * builtin_len(PyObject *self, PyObject *args) { *************** *** 2227,2230 **** --- 2253,2257 ---- {"isinstance", builtin_isinstance, 1, isinstance_doc}, {"issubclass", builtin_issubclass, 1, issubclass_doc}, + {"iter", builtin_iter, 1, iter_doc}, {"len", builtin_len, 1, len_doc}, {"list", builtin_list, 1, list_doc}, Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.230 retrieving revision 2.230.2.1 diff -C2 -r2.230 -r2.230.2.1 *** ceval.c 2001/02/16 11:52:31 2.230 --- ceval.c 2001/03/13 10:07:42 2.230.2.1 *************** *** 1823,1826 **** --- 1823,1857 ---- continue; + case GET_ITER: + /* before: [obj]; after [getiter(obj)] */ + v = POP(); + x = PyObject_GetIter(v); + Py_DECREF(v); + if (x != NULL) { + PUSH(x); + continue; + } + break; + + case FOR_ITER: + /* before: [iter]; after: [iter, iter()] *or* [] */ + v = TOP(); + if (PyIter_Check(v)) /* Speed-up common case */ + x = v->ob_type->tp_call(v, NULL, NULL); + else + x = PyObject_CallObject(v, NULL); + if (x == NULL) { + if (PyErr_ExceptionMatches(PyExc_IndexError)) { + PyErr_Clear(); + x = v = POP(); + Py_DECREF(v); + JUMPBY(oparg); + continue; + } + break; + } + PUSH(x); + continue; + case FOR_LOOP: /* for v in s: ... Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.186 retrieving revision 2.186.2.1 diff -C2 -r2.186 -r2.186.2.1 *** compile.c 2001/03/02 03:30:41 2.186 --- compile.c 2001/03/13 10:07:42 2.186.2.1 *************** *** 1230,1234 **** com_list_for(struct compiling *c, node *n, node *e, char *t) { - PyObject *v; int anchor = 0; int save_begin = c->c_begin; --- 1230,1233 ---- *************** *** 1236,1248 **** /* list_iter: for v in expr [list_iter] */ com_node(c, CHILD(n, 3)); /* expr */ ! v = PyInt_FromLong(0L); ! if (v == NULL) ! c->c_errors++; ! com_addoparg(c, LOAD_CONST, com_addconst(c, v)); ! com_push(c, 1); ! Py_XDECREF(v); c->c_begin = c->c_nexti; com_addoparg(c, SET_LINENO, n->n_lineno); ! com_addfwref(c, FOR_LOOP, &anchor); com_push(c, 1); com_assign(c, CHILD(n, 1), OP_ASSIGN, NULL); --- 1235,1242 ---- /* list_iter: for v in expr [list_iter] */ com_node(c, CHILD(n, 3)); /* expr */ ! com_addbyte(c, GET_ITER); c->c_begin = c->c_nexti; com_addoparg(c, SET_LINENO, n->n_lineno); ! com_addfwref(c, FOR_ITER, &anchor); com_push(c, 1); com_assign(c, CHILD(n, 1), OP_ASSIGN, NULL); *************** *** 1253,1257 **** c->c_begin = save_begin; com_backpatch(c, anchor); ! com_pop(c, 2); /* FOR_LOOP has popped these */ } --- 1247,1251 ---- c->c_begin = save_begin; com_backpatch(c, anchor); ! com_pop(c, 1); /* FOR_ITER has popped this */ } *************** *** 2871,2875 **** com_for_stmt(struct compiling *c, node *n) { - PyObject *v; int break_anchor = 0; int anchor = 0; --- 2865,2868 ---- *************** *** 2880,2892 **** block_push(c, SETUP_LOOP); com_node(c, CHILD(n, 3)); ! v = PyInt_FromLong(0L); ! if (v == NULL) ! c->c_errors++; ! com_addoparg(c, LOAD_CONST, com_addconst(c, v)); ! com_push(c, 1); ! Py_XDECREF(v); c->c_begin = c->c_nexti; com_addoparg(c, SET_LINENO, n->n_lineno); ! com_addfwref(c, FOR_LOOP, &anchor); com_push(c, 1); com_assign(c, CHILD(n, 1), OP_ASSIGN, NULL); --- 2873,2880 ---- block_push(c, SETUP_LOOP); com_node(c, CHILD(n, 3)); ! com_addbyte(c, GET_ITER); c->c_begin = c->c_nexti; com_addoparg(c, SET_LINENO, n->n_lineno); ! com_addfwref(c, FOR_ITER, &anchor); com_push(c, 1); com_assign(c, CHILD(n, 1), OP_ASSIGN, NULL); *************** *** 2897,2901 **** c->c_begin = save_begin; com_backpatch(c, anchor); ! com_pop(c, 2); /* FOR_LOOP has popped these */ com_addbyte(c, POP_BLOCK); block_pop(c, SETUP_LOOP); --- 2885,2889 ---- c->c_begin = save_begin; com_backpatch(c, anchor); ! com_pop(c, 1); /* FOR_ITER has popped this */ com_addbyte(c, POP_BLOCK); block_pop(c, SETUP_LOOP); From loewis@usw-pr-cvs1.sourceforge.net Tue Mar 13 10:50:15 2001 From: loewis@usw-pr-cvs1.sourceforge.net (Martin v. L?wis) Date: Tue, 13 Mar 2001 02:50:15 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/xml/dom minidom.py,1.27,1.28 pulldom.py,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/xml/dom In directory usw-pr-cvs1:/tmp/cvs-serv23893 Modified Files: minidom.py pulldom.py Log Message: Patch #407965: Improve Level 2 conformance of minidom - addition of a DocumentFragment implementation and createDocumentFragment method - proper setting of ownerDocument for all nodes - setting of namespaceURI to None in Element as a class attribute - addition of setAttributeNodeNS and removeAttributeNodeNS as aliases for setAttributeNode and removeAttributeNode - support for inheriting from DOMImplementation to extend it with additional features (to override the Document class) in pulldom: - support for nodes (comment and PI) that occur before he document element; that became necessary as pulldom now delays creation of the document until it has the document element. Index: minidom.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xml/dom/minidom.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -r1.27 -r1.28 *** minidom.py 2001/02/22 14:04:09 1.27 --- minidom.py 2001/03/13 10:50:13 1.28 *************** *** 39,46 **** debug = None childNodeTypes = () def __init__(self): self.childNodes = [] ! self.parentNode = None if Node._debug: index = repr(id(self)) + repr(self.__class__) --- 39,47 ---- debug = None childNodeTypes = () + namespaceURI = None # this is non-null only for elements and attributes def __init__(self): self.childNodes = [] ! self.parentNode = self.ownerDocument = None if Node._debug: index = repr(id(self)) + repr(self.__class__) *************** *** 108,111 **** --- 109,117 ---- def insertBefore(self, newChild, refChild): + if newChild.nodeType == self.DOCUMENT_FRAGMENT_NODE: + for c in newChild.childNodes: + self.insertBefore(c, refChild) + ### The DOM does not clearly specify what to return in this case + return newChild if newChild.nodeType not in self.childNodeTypes: raise HierarchyRequestErr, \ *************** *** 131,134 **** --- 137,145 ---- def appendChild(self, node): + if node.nodeType == self.DOCUMENT_FRAGMENT_NODE: + for c in node.childNodes: + self.appendChild(c) + ### The DOM does not clearly specify what to return in this case + return node if node.nodeType not in self.childNodeTypes: raise HierarchyRequestErr, \ *************** *** 149,152 **** --- 160,167 ---- def replaceChild(self, newChild, oldChild): + if newChild.nodeType == self.DOCUMENT_FRAGMENT_NODE: + refChild = oldChild.nextSibling + self.removeChild(oldChild) + return self.insertBefore(newChild, refChild) if newChild.nodeType not in self.childNodeTypes: raise HierarchyRequestErr, \ *************** *** 234,238 **** def unlink(self): ! self.parentNode = None for child in self.childNodes: child.unlink() --- 249,253 ---- def unlink(self): ! self.parentNode = self.ownerDocument = None for child in self.childNodes: child.unlink() *************** *** 271,274 **** --- 286,304 ---- return rc + class DocumentFragment(Node): + nodeType = Node.DOCUMENT_FRAGMENT_NODE + nodeName = "#document-fragment" + nodeValue = None + attributes = None + parentNode = None + childNodeTypes = (Node.ELEMENT_NODE, + Node.TEXT_NODE, + Node.CDATA_SECTION_NODE, + Node.ENTITY_REFERENCE_NODE, + Node.PROCESSING_INSTRUCTION_NODE, + Node.COMMENT_NODE, + Node.NOTATION_NODE) + + class Attr(Node): nodeType = Node.ATTRIBUTE_NODE *************** *** 410,414 **** Node.CDATA_SECTION_NODE, Node.ENTITY_REFERENCE_NODE) ! def __init__(self, tagName, namespaceURI="", prefix="", localName=None): Node.__init__(self) --- 440,444 ---- Node.CDATA_SECTION_NODE, Node.ENTITY_REFERENCE_NODE) ! def __init__(self, tagName, namespaceURI=None, prefix="", localName=None): Node.__init__(self) *************** *** 495,498 **** --- 525,530 ---- return old + setAttributeNodeNS = setAttributeNode + def removeAttribute(self, name): attr = self._attrs[name] *************** *** 508,511 **** --- 540,545 ---- del self._attrsNS[(node.namespaceURI, node.localName)] + removeAttributeNodeNS = removeAttributeNode + def hasAttribute(self, name): return self._attrs.has_key(name) *************** *** 652,656 **** raise xml.dom.WrongDocumentErr( "doctype object owned by another DOM tree") ! doc = Document() if doctype is None: doctype = self.createDocumentType(qualifiedName, None, None) --- 686,690 ---- raise xml.dom.WrongDocumentErr( "doctype object owned by another DOM tree") ! doc = self._createDocument() if doctype is None: doctype = self.createDocumentType(qualifiedName, None, None) *************** *** 672,676 **** element = doc.createElementNS(namespaceURI, qualifiedName) doc.appendChild(element) ! doctype.parentNode = doc doc.doctype = doctype doc.implementation = self --- 706,710 ---- element = doc.createElementNS(namespaceURI, qualifiedName) doc.appendChild(element) ! doctype.parentNode = doctype.ownerDocument = doc doc.doctype = doctype doc.implementation = self *************** *** 683,686 **** --- 717,723 ---- return doctype + # internal + def _createDocument(self): + return Document() class Document(Node): *************** *** 691,694 **** --- 728,732 ---- doctype = None parentNode = None + previousSibling = nextSibling = None implementation = DOMImplementation() *************** *** 728,751 **** self.doctype = None Node.unlink(self) - - createElement = Element - - createTextNode = Text - - createComment = Comment - - createProcessingInstruction = ProcessingInstruction ! createAttribute = Attr def createElementNS(self, namespaceURI, qualifiedName): prefix, localName = _nssplit(qualifiedName) ! return self.createElement(qualifiedName, namespaceURI, ! prefix, localName) def createAttributeNS(self, namespaceURI, qualifiedName): prefix, localName = _nssplit(qualifiedName) ! return self.createAttribute(qualifiedName, namespaceURI, ! localName, prefix) def getElementsByTagNameNS(self, namespaceURI, localName): --- 766,811 ---- self.doctype = None Node.unlink(self) ! def createDocumentFragment(self): ! d = DocumentFragment() ! d.ownerDoc = self ! return d ! ! def createElement(self, tagName): ! e = Element(tagName) ! e.ownerDocument = self ! return e ! ! def createTextNode(self, data): ! t = Text(data) ! t.ownerDocument = self ! return t ! ! def createComment(self, data): ! c = Comment(data) ! c.ownerDocument = self ! return c ! ! def createProcessingInstruction(self, target, data): ! p = ProcessingInstruction(target, data) ! p.ownerDocument = self ! return p ! ! def createAttribute(self, qName): ! a = Attr(qName) ! a.ownerDocument = self ! return a def createElementNS(self, namespaceURI, qualifiedName): prefix, localName = _nssplit(qualifiedName) ! e = Element(qualifiedName, namespaceURI, prefix, localName) ! e.ownerDocument = self ! return e def createAttributeNS(self, namespaceURI, qualifiedName): prefix, localName = _nssplit(qualifiedName) ! a = Attr(qualifiedName, namespaceURI, localName, prefix) ! a.ownerDocument = self ! return a def getElementsByTagNameNS(self, namespaceURI, localName): Index: pulldom.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xml/dom/pulldom.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -r1.19 -r1.20 *** pulldom.py 2001/02/06 01:16:06 1.19 --- pulldom.py 2001/03/13 10:50:13 1.20 *************** *** 34,37 **** --- 34,38 ---- self._ns_contexts = [{}] # contains uri -> prefix dicts self._current_context = self._ns_contexts[-1] + self.pending_events = [] def pop(self): *************** *** 116,128 **** def comment(self, s): ! node = self.document.createComment(s) ! self.lastEvent[1] = [(COMMENT, node), None] ! self.lastEvent = self.lastEvent[1] def processingInstruction(self, target, data): ! node = self.document.createProcessingInstruction(target, data) ! ! self.lastEvent[1] = [(PROCESSING_INSTRUCTION, node), None] ! self.lastEvent = self.lastEvent[1] def ignorableWhitespace(self, chars): --- 117,136 ---- def comment(self, s): ! if self.document: ! node = self.document.createComment(s) ! self.lastEvent[1] = [(COMMENT, node), None] ! self.lastEvent = self.lastEvent[1] ! else: ! event = [(COMMENT, s), None] ! self.pending_events.append(event) def processingInstruction(self, target, data): ! if self.document: ! node = self.document.createProcessingInstruction(target, data) ! self.lastEvent[1] = [(PROCESSING_INSTRUCTION, node), None] ! self.lastEvent = self.lastEvent[1] ! else: ! event = [(PROCESSING_INSTRUCTION, target, data), None] ! self.pending_events.append(event) def ignorableWhitespace(self, chars): *************** *** 149,152 **** --- 157,174 ---- self.lastEvent = self.lastEvent[1] self.push(node) + # Put everything we have seen so far into the document + for e in self.pending_events: + if e[0][0] == PROCESSING_INSTRUCTION: + _,target,data = e[0] + n = self.document.createProcessingInstruction(target, data) + e[0] = (PROCESSING_INSTRUCTION, n) + elif e[0][0] == COMMENT: + n = self.document.createComment(e[0][1]) + e[0] = (COMMENT, n) + else: + raise AssertionError("Unknown pending event ",e[0][0]) + self.lastEvent[1] = e + self.lastEvent = e + self.pending_events = None return node.firstChild From gvanrossum@usw-pr-cvs1.sourceforge.net Tue Mar 13 12:01:28 2001 From: gvanrossum@usw-pr-cvs1.sourceforge.net (Guido van Rossum) Date: Tue, 13 Mar 2001 04:01:28 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects abstract.c,2.57.2.1,2.57.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv3568 Modified Files: Tag: iter-branch abstract.c Log Message: A callable is not an iterator, not even inside #if 0. Don't reference getiter() -- it's iter() now. Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.57.2.1 retrieving revision 2.57.2.2 diff -C2 -r2.57.2.1 -r2.57.2.2 *** abstract.c 2001/03/13 10:07:42 2.57.2.1 --- abstract.c 2001/03/13 12:01:26 2.57.2.2 *************** *** 1636,1649 **** f = t->tp_iter; if (f == NULL) { - #if 0 - if (PyCallable_Check(o)) { - Py_INCREF(o); - return o; - } - #endif if (PySequence_Check(o)) return PyIter_New(o); ! PyErr_SetString(PyExc_TypeError, ! "getiter() of non-sequence"); return NULL; } --- 1636,1642 ---- f = t->tp_iter; if (f == NULL) { if (PySequence_Check(o)) return PyIter_New(o); ! PyErr_SetString(PyExc_TypeError, "iter() of non-sequence"); return NULL; } From gvanrossum@usw-pr-cvs1.sourceforge.net Tue Mar 13 12:04:40 2001 From: gvanrossum@usw-pr-cvs1.sourceforge.net (Guido van Rossum) Date: Tue, 13 Mar 2001 04:04:40 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects classobject.c,2.123,2.123.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv3980 Modified Files: Tag: iter-branch classobject.c Log Message: More specific error message when an instance supports neither __iter__ nor __getitem__. Index: classobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/classobject.c,v retrieving revision 2.123 retrieving revision 2.123.2.1 diff -C2 -r2.123 -r2.123.2.1 *** classobject.c 2001/02/26 18:56:37 2.123 --- classobject.c 2001/03/13 12:04:38 2.123.2.1 *************** *** 848,852 **** } ! static PyObject *getitemstr, *setitemstr, *delitemstr, *lenstr; static int --- 848,852 ---- } ! static PyObject *getitemstr, *setitemstr, *delitemstr, *lenstr, *iterstr; static int *************** *** 1712,1715 **** --- 1712,1741 ---- + /* Get the iterator */ + static PyObject * + instance_getiter(PyInstanceObject *self) + { + PyObject *func; + + if (iterstr == NULL) + iterstr = PyString_InternFromString("__iter__"); + if (getitemstr == NULL) + getitemstr = PyString_InternFromString("__getitem__"); + + if ((func = instance_getattr(self, iterstr)) != NULL) { + PyObject *res = PyEval_CallObject(func, (PyObject *)NULL); + Py_DECREF(func); + return res; + } + PyErr_Clear(); + if ((func = instance_getattr(self, getitemstr)) == NULL) { + PyErr_SetString(PyExc_TypeError, "iter() of non-sequence"); + return NULL; + } + Py_DECREF(func); + return PyIter_New((PyObject *)self); + } + + static PyNumberMethods instance_as_number = { (binaryfunc)instance_add, /* nb_add */ *************** *** 1775,1779 **** 0, /* tp_clear */ instance_richcompare, /* tp_richcompare */ ! offsetof(PyInstanceObject, in_weakreflist) /* tp_weaklistoffset */ }; --- 1801,1806 ---- 0, /* tp_clear */ instance_richcompare, /* tp_richcompare */ ! offsetof(PyInstanceObject, in_weakreflist), /* tp_weaklistoffset */ ! (getiterfunc)instance_getiter, /* tp_iter */ }; From gvanrossum@usw-pr-cvs1.sourceforge.net Tue Mar 13 12:15:47 2001 From: gvanrossum@usw-pr-cvs1.sourceforge.net (Guido van Rossum) Date: Tue, 13 Mar 2001 04:15:47 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects iterobject.c,1.1.2.1,1.1.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv5217 Modified Files: Tag: iter-branch iterobject.c Log Message: The call-wrapping iterator should not overload 'value' as either a return value or an exception. It should turn IndexError, if raised, into a TypeError to avoid silently terminating the sequence. Also added two missing casts to the type structure initializers. Index: iterobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/Attic/iterobject.c,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -r1.1.2.1 -r1.1.2.2 *** iterobject.c 2001/03/13 10:07:42 1.1.2.1 --- iterobject.c 2001/03/13 12:15:44 1.1.2.2 *************** *** 71,75 **** 0, /* tp_as_mapping */ 0, /* tp_hash */ ! iter_call, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ --- 71,75 ---- 0, /* tp_as_mapping */ 0, /* tp_hash */ ! (ternaryfunc)iter_call, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ *************** *** 125,135 **** } else { ! if (PyErr_ExceptionMatches(it->it_sentinel)) ! PyErr_SetObject(PyExc_IndexError, Py_None); ! else if (PyErr_ExceptionMatches(PyExc_IndexError) && ! !PyErr_GivenExceptionMatches( ! PyExc_IndexError, it->it_sentinel)) PyErr_SetString(PyExc_TypeError, ! "callable in iterator raised unexpected IndexError"); } return result; --- 125,132 ---- } else { ! if (PyErr_ExceptionMatches(PyExc_IndexError)) PyErr_SetString(PyExc_TypeError, ! "callable in iterator raised " ! "unexpected IndexError"); } return result; *************** *** 153,157 **** 0, /* tp_as_mapping */ 0, /* tp_hash */ ! calliter_call, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ --- 150,154 ---- 0, /* tp_as_mapping */ 0, /* tp_hash */ ! (ternaryfunc)calliter_call, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ From gvanrossum@usw-pr-cvs1.sourceforge.net Tue Mar 13 13:20:43 2001 From: gvanrossum@usw-pr-cvs1.sourceforge.net (Guido van Rossum) Date: Tue, 13 Mar 2001 05:20:43 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.194.2.1,2.194.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv15761 Modified Files: Tag: iter-branch bltinmodule.c Log Message: Fix docstring for iter(v, w), removing mention of v() raising w. Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.194.2.1 retrieving revision 2.194.2.2 diff -C2 -r2.194.2.1 -r2.194.2.2 *** bltinmodule.c 2001/03/13 10:07:42 2.194.2.1 --- bltinmodule.c 2001/03/13 13:20:40 2.194.2.2 *************** *** 1323,1327 **** the object must supply its own iterator, or be a sequence.\n\ If a sentinel is given, the object must be callable and the iterator\n\ ! calls it until it returns or raises the sentinel."; --- 1323,1327 ---- the object must supply its own iterator, or be a sequence.\n\ If a sentinel is given, the object must be callable and the iterator\n\ ! calls it until it returns the sentinel."; From gvanrossum@usw-pr-cvs1.sourceforge.net Tue Mar 13 13:26:15 2001 From: gvanrossum@usw-pr-cvs1.sourceforge.net (Guido van Rossum) Date: Tue, 13 Mar 2001 05:26:15 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.194.2.2,2.194.2.3 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv16873 Modified Files: Tag: iter-branch bltinmodule.c Log Message: Slight improvement of the docstring for iter(), showing the two forms separately rathern than one form with an optional second argument. Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.194.2.2 retrieving revision 2.194.2.3 diff -C2 -r2.194.2.2 -r2.194.2.3 *** bltinmodule.c 2001/03/13 13:20:40 2.194.2.2 --- bltinmodule.c 2001/03/13 13:26:13 2.194.2.3 *************** *** 1318,1327 **** static char iter_doc[] = ! "iter(object[, sentinel]) -> iterator\n\ \n\ ! Get an iterator from an object. If the sentinel argument is omitted,\n\ ! the object must supply its own iterator, or be a sequence.\n\ ! If a sentinel is given, the object must be callable and the iterator\n\ ! calls it until it returns the sentinel."; --- 1318,1327 ---- static char iter_doc[] = ! "iter(collection) -> iterator\n\ ! iter(callable, sentinel) -> iterator\n\ \n\ ! Get an iterator from an object. In the first form, the argument must\n\ ! supply its own iterator, or be a sequence.\n\ ! In the second form, the callable is called until it returns the sentinel."; From gvanrossum@usw-pr-cvs1.sourceforge.net Tue Mar 13 13:44:38 2001 From: gvanrossum@usw-pr-cvs1.sourceforge.net (Guido van Rossum) Date: Tue, 13 Mar 2001 05:44:38 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_weakref.py,1.3.2.1,1.3.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv20220 Modified Files: Tag: iter-branch test_weakref.py Log Message: Delete a print statement that I shouldn't have checked in. Will try cvs admin -o... to get rid of these checkins next. Index: test_weakref.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_weakref.py,v retrieving revision 1.3.2.1 retrieving revision 1.3.2.2 diff -C2 -r1.3.2.1 -r1.3.2.2 *** test_weakref.py 2001/03/13 10:07:42 1.3.2.1 --- test_weakref.py 2001/03/13 13:44:36 1.3.2.2 *************** *** 181,185 **** del items1, items2 del objects, o - print dict.items() verify(len(dict)==0, "deleting the keys did not clear the dictionary") print "weak key dict test complete" --- 181,184 ---- From gvanrossum@usw-pr-cvs1.sourceforge.net Tue Mar 13 13:48:23 2001 From: gvanrossum@usw-pr-cvs1.sourceforge.net (Guido van Rossum) Date: Tue, 13 Mar 2001 05:48:23 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects iterobject.c,1.1.2.2,1.1.2.3 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv20878/Objects Modified Files: Tag: iter-branch iterobject.c Log Message: Switch to using it.next() instead of it() to get the next value. Index: iterobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/Attic/iterobject.c,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -r1.1.2.2 -r1.1.2.3 *** iterobject.c 2001/03/13 12:15:44 1.1.2.2 --- iterobject.c 2001/03/13 13:48:20 1.1.2.3 *************** *** 29,33 **** static PyObject * ! iter_call(iterobject *it, PyObject *args) { PyObject *seq = it->it_seq; --- 29,33 ---- static PyObject * ! iter_next(iterobject *it, PyObject *args) { PyObject *seq = it->it_seq; *************** *** 54,57 **** --- 54,69 ---- } + static PyMethodDef iter_methods[] = { + {"next", (PyCFunction)iter_next, METH_VARARGS, + "it.next() -- get the next value, or raise IndexError"}, + {NULL, NULL} /* sentinel */ + }; + + static PyObject * + iter_getattr(iterobject *it, char *name) + { + return Py_FindMethod(iter_methods, (PyObject *)it, name); + } + PyTypeObject PyIter_Type = { PyObject_HEAD_INIT(&PyType_Type) *************** *** 63,68 **** (destructor)iter_dealloc, /* tp_dealloc */ 0, /* tp_print */ ! (getattrfunc)0, /* tp_getattr */ ! (setattrfunc)0, /* tp_setattr */ 0, /* tp_compare */ 0, /* tp_repr */ --- 75,80 ---- (destructor)iter_dealloc, /* tp_dealloc */ 0, /* tp_print */ ! (getattrfunc)iter_getattr, /* tp_getattr */ ! 0, /* tp_setattr */ 0, /* tp_compare */ 0, /* tp_repr */ *************** *** 71,75 **** 0, /* tp_as_mapping */ 0, /* tp_hash */ ! (ternaryfunc)iter_call, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ --- 83,87 ---- 0, /* tp_as_mapping */ 0, /* tp_hash */ ! 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ *************** *** 114,118 **** } static PyObject * ! calliter_call(calliterobject *it, PyObject *args) { PyObject *result = PyObject_CallObject(it->it_callable, NULL); --- 126,130 ---- } static PyObject * ! calliter_next(calliterobject *it, PyObject *args) { PyObject *result = PyObject_CallObject(it->it_callable, NULL); *************** *** 133,136 **** --- 145,160 ---- } + static PyMethodDef calliter_methods[] = { + {"next", (PyCFunction)calliter_next, METH_VARARGS, + "it.next() -- get the next value, or raise IndexError"}, + {NULL, NULL} /* sentinel */ + }; + + static PyObject * + calliter_getattr(calliterobject *it, char *name) + { + return Py_FindMethod(calliter_methods, (PyObject *)it, name); + } + PyTypeObject PyCallIter_Type = { PyObject_HEAD_INIT(&PyType_Type) *************** *** 142,146 **** (destructor)calliter_dealloc, /* tp_dealloc */ 0, /* tp_print */ ! 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ --- 166,170 ---- (destructor)calliter_dealloc, /* tp_dealloc */ 0, /* tp_print */ ! (getattrfunc)iter_getattr, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ *************** *** 150,154 **** 0, /* tp_as_mapping */ 0, /* tp_hash */ ! (ternaryfunc)calliter_call, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ --- 174,178 ---- 0, /* tp_as_mapping */ 0, /* tp_hash */ ! 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ From gvanrossum@usw-pr-cvs1.sourceforge.net Tue Mar 13 13:48:23 2001 From: gvanrossum@usw-pr-cvs1.sourceforge.net (Guido van Rossum) Date: Tue, 13 Mar 2001 05:48:23 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python ceval.c,2.230.2.1,2.230.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv20878/Python Modified Files: Tag: iter-branch ceval.c Log Message: Switch to using it.next() instead of it() to get the next value. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.230.2.1 retrieving revision 2.230.2.2 diff -C2 -r2.230.2.1 -r2.230.2.2 *** ceval.c 2001/03/13 10:07:42 2.230.2.1 --- ceval.c 2001/03/13 13:48:21 2.230.2.2 *************** *** 377,380 **** --- 377,381 ---- char *filename = PyString_AsString(co->co_filename); #endif + static PyObject *nextstr; /* Code access macros */ *************** *** 412,415 **** --- 413,421 ---- /* Start of code */ + if (nextstr == NULL) { + nextstr = PyString_InternFromString("next"); + if (nextstr == NULL) + return NULL; + } #ifdef USE_STACKCHECK *************** *** 1829,1834 **** Py_DECREF(v); if (x != NULL) { ! PUSH(x); ! continue; } break; --- 1835,1845 ---- Py_DECREF(v); if (x != NULL) { ! w = x; ! x = PyObject_GetAttr(w, nextstr); ! Py_DECREF(w); ! if (x != NULL) { ! PUSH(x); ! continue; ! } } break; From gvanrossum@usw-pr-cvs1.sourceforge.net Tue Mar 13 13:53:59 2001 From: gvanrossum@usw-pr-cvs1.sourceforge.net (Guido van Rossum) Date: Tue, 13 Mar 2001 05:53:59 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python ceval.c,2.230.2.2,2.230.2.3 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv22229 Modified Files: Tag: iter-branch ceval.c Log Message: Oops. There was a speed-up for the common case that made no sense with next() methods. Alas, it doesn't fix the slight performance degradation compared to the old code. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.230.2.2 retrieving revision 2.230.2.3 diff -C2 -r2.230.2.2 -r2.230.2.3 *** ceval.c 2001/03/13 13:48:21 2.230.2.2 --- ceval.c 2001/03/13 13:53:57 2.230.2.3 *************** *** 1848,1855 **** /* before: [iter]; after: [iter, iter()] *or* [] */ v = TOP(); ! if (PyIter_Check(v)) /* Speed-up common case */ ! x = v->ob_type->tp_call(v, NULL, NULL); ! else ! x = PyObject_CallObject(v, NULL); if (x == NULL) { if (PyErr_ExceptionMatches(PyExc_IndexError)) { --- 1848,1852 ---- /* before: [iter]; after: [iter, iter()] *or* [] */ v = TOP(); ! x = PyObject_CallObject(v, NULL); if (x == NULL) { if (PyErr_ExceptionMatches(PyExc_IndexError)) { From bwarsaw@usw-pr-cvs1.sourceforge.net Tue Mar 13 15:40:50 2001 From: bwarsaw@usw-pr-cvs1.sourceforge.net (Barry Warsaw) Date: Tue, 13 Mar 2001 07:40:50 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0000.txt,1.72,1.73 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv5658 Modified Files: pep-0000.txt Log Message: Feeling flush from IPC9, several new PEP numbers are handed out: PEP 237 Unifying Long Integers and Integers, Zadka PEP 238 Non-integer Division, Zadka PEP 239 Adding a Rational Type to Python, Zadka PEP 240 Adding a Rational Literal to Python, Zadka PEP 241 Metadata for Python Software Packages, Kuchling Moshe in the lead... The authors will check-in their individual PEPs. Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -r1.72 -r1.73 *** pep-0000.txt 2001/03/12 20:30:47 1.72 --- pep-0000.txt 2001/03/13 15:40:47 1.73 *************** *** 44,47 **** --- 44,52 ---- S 234 pep-0234.txt Iterators Yee S 232 pep-0232.txt Function Attributes Warsaw + S 237 pep-0237.txt Unifying Long Integers and Integers Zadka + S 238 pep-0238.txt Non-integer Division Zadka + S 239 pep-0239.txt Adding a Rational Type to Python Zadka + S 240 pep-0240.txt Adding a Rational Literal to Python Zadka + S 241 pep-0241.txt Metadata for Python Software Packages Kuchling Pie-in-the-sky PEPs (not ready; may become active yet) *************** *** 141,144 **** --- 146,154 ---- S 235 pep-0235.txt Import on Case-Insensitive Platforms Peters S 236 pep-0236.txt Back to the __future__ Peters + S 237 pep-0237.txt Unifying Long Integers and Integers Zadka + S 238 pep-0238.txt Non-integer Division Zadka + S 239 pep-0239.txt Adding a Rational Type to Python Zadka + S 240 pep-0240.txt Adding a Rational Literal to Python Zadka + S 241 pep-0241.txt Metadata for Python Software Packages Kuchling Key From akuchling@usw-pr-cvs1.sourceforge.net Tue Mar 13 15:48:08 2001 From: akuchling@usw-pr-cvs1.sourceforge.net (A.M. Kuchling) Date: Tue, 13 Mar 2001 07:48:08 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0241.txt,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv6746 Added Files: pep-0241.txt Log Message: First draft of metadata PEP --- NEW FILE: pep-0241.txt --- PEP: XXX Title: Metadata for Python Software Packages Version: $Revision: 1.1 $ Author: A.M. Kuchling Type: Standards Track Created: 12-Mar-2001 Status: Draft Post-History: Introduction This PEP specifies the names and semantics of the fields used to store metadata about Python software packages. Including Metadata in Packages The Distutils 'sdist' command will be modified to extract the metadata fields from the arguments and write them to a file in the generated zipfile or tarball. This file will be named METADATA and will be placed in the top directory of the source distribution (where the README, INSTALL, and other files usually go). Authors might expect to include a METADATA file of their own that would be used instead of the generated file, but this will not be permitted. It would be confusing if person B makes a custom release of person A's software, modifies setup.py accordingly, but uses identical metadata because person B didn't delete the METADATA file. When running the 'sdist' command, a user-supplied METADATA file will be ignored and a warning about this action will be printed. XXX are we sure RFC-822 is enough? The METADATA file format is a single set of RFC-822 headers parseable by the rfc822.py module. The field names listed in the following section are used as the header names. Fields This section specifies the names and semantics of each of the supported metadata fields. Name The name of the package. XXX what's the set of legal characters? Example: 'BeagleVote' Version A string containing the package's version number. This field should be parseable by one of the Version classes (StrictVersion or LooseVersion) in the distutils.version module. Example: '1.0a2' Platforms A (XXX whitespace? comma?)-separated list of platform specifications. Platform specifications are limited to the following list: XXX copy list from PPD? SourceForge? Example: 'XXX' Description A one-line summary of what the package does. Example: "A module for collecting votes from beagles." Long-Description (optional) A longer description of the package that can run to several paragraphs. (Software that deals with metadata should not assume any maximum size for this field, though one hopes that people won't include their instruction manual as the long-description.) Example: 'This module collects votes from beagles in order to determine their electoral wishes. Do NOT try to use this module with basset hounds; it makes them grumpy.' Keywords A list of additional keywords to be used to assist searching for this package in a larger catalog. XXX Keywords should probably be constrained to be from a fixed list, but I don't think this can be enforced by the 'sdist' command. (The list might be large, and it could only be updated with new Distutils releases, which seems too inflexible.) Example: 'dog puppy voting election' Home-page (optional) A string containing the URL for the package's home page. Example: 'http://www.example.com/~cschultz/bvote/' Author (optional) A string containing at a minimum the author's name. Contact information can also be added, separating each line with newlines. Example: 'C. Schultz\nUniversal Features Syndicate\nLos Angeles, CA' Author-email A string containing the author's e-mail address. It can contain a name and e-mail address in the legal forms for a RFC-822 'From:' header ("name " or "email (name)"). It's not optional because cataloging systems can use the e-mail portion of this field as a unique key representing the author. A catalog might provide authors the ability to store their GPG key, personal home page, and other additional metadata *about the author*. Author-related metadata fields are not covered by this PEP. (XXX should they be? I think not, since nothing in this PEP will deal with author data at all.) Example: 'C. Schultz ' License A string selected from a short list of choices, specifying the license covering the package. Some licenses result in the software being freely redistributable, so packagers and resellers can automatically know that they're free to redistribute the software. Other licenses will require a careful reading by a human to determine the software can be repackaged and resold. The choices are: XXX copy list from SourceForge, + 'Other' Copyright This document has been placed in the public domain. Local Variables: mode: indented-text indent-tabs-mode: nil End: From akuchling@usw-pr-cvs1.sourceforge.net Tue Mar 13 16:09:10 2001 From: akuchling@usw-pr-cvs1.sourceforge.net (A.M. Kuchling) Date: Tue, 13 Mar 2001 08:09:10 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0241.txt,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv10444 Modified Files: pep-0241.txt Log Message: Updating the PEP number would be good... Index: pep-0241.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0241.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** pep-0241.txt 2001/03/13 15:48:04 1.1 --- pep-0241.txt 2001/03/13 16:09:08 1.2 *************** *** 1,3 **** ! PEP: XXX Title: Metadata for Python Software Packages Version: $Revision$ --- 1,3 ---- ! PEP: 241 Title: Metadata for Python Software Packages Version: $Revision$ From gvanrossum@usw-pr-cvs1.sourceforge.net Tue Mar 13 16:14:26 2001 From: gvanrossum@usw-pr-cvs1.sourceforge.net (Guido van Rossum) Date: Tue, 13 Mar 2001 08:14:26 -0800 Subject: [Python-checkins] CVS: python/dist/src/Include abstract.h,2.28.2.1,2.28.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv11739 Modified Files: Tag: iter-branch abstract.h Log Message: Typo in comment. Index: abstract.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/abstract.h,v retrieving revision 2.28.2.1 retrieving revision 2.28.2.2 diff -C2 -r2.28.2.1 -r2.28.2.2 *** abstract.h 2001/03/13 10:07:41 2.28.2.1 --- abstract.h 2001/03/13 16:14:24 2.28.2.2 *************** *** 473,477 **** DL_IMPORT(PyObject *) PyObject_GetIter(PyObject *); /* Takes an object and returns an iterator for it. ! This is typically a new iterator but of the argument is an iterator, this returns itself. */ --- 473,477 ---- DL_IMPORT(PyObject *) PyObject_GetIter(PyObject *); /* Takes an object and returns an iterator for it. ! This is typically a new iterator but if the argument is an iterator, this returns itself. */ From gvanrossum@usw-pr-cvs1.sourceforge.net Tue Mar 13 16:22:19 2001 From: gvanrossum@usw-pr-cvs1.sourceforge.net (Guido van Rossum) Date: Tue, 13 Mar 2001 08:22:19 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects iterobject.c,1.1.2.3,1.1.2.4 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv13281 Modified Files: Tag: iter-branch iterobject.c Log Message: Oops, the type struct for callable-iterator had a reference to plain iterator's getattr function. Index: iterobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/Attic/iterobject.c,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -r1.1.2.3 -r1.1.2.4 *** iterobject.c 2001/03/13 13:48:20 1.1.2.3 --- iterobject.c 2001/03/13 16:22:16 1.1.2.4 *************** *** 166,170 **** (destructor)calliter_dealloc, /* tp_dealloc */ 0, /* tp_print */ ! (getattrfunc)iter_getattr, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ --- 166,170 ---- (destructor)calliter_dealloc, /* tp_dealloc */ 0, /* tp_print */ ! (getattrfunc)calliter_getattr, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ From gvanrossum@usw-pr-cvs1.sourceforge.net Tue Mar 13 16:32:05 2001 From: gvanrossum@usw-pr-cvs1.sourceforge.net (Guido van Rossum) Date: Tue, 13 Mar 2001 08:32:05 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects dictobject.c,2.73,2.73.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv15136 Modified Files: Tag: iter-branch dictobject.c Log Message: Another *EXPERIMENTAL* feature on the "iter-branch" branch: implement "if key in dict" and "for key in dict". Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.73 retrieving revision 2.73.2.1 diff -C2 -r2.73 -r2.73.2.1 *** dictobject.c 2001/01/18 00:39:02 2.73 --- dictobject.c 2001/03/13 16:32:03 2.73.2.1 *************** *** 1219,1222 **** --- 1219,1256 ---- } + static int + dict_contains(dictobject *mp, PyObject *key) + { + long hash; + + #ifdef CACHE_HASH + if (!PyString_Check(key) || + (hash = ((PyStringObject *) key)->ob_shash) == -1) + #endif + { + hash = PyObject_Hash(key); + if (hash == -1) + return -1; + } + return (mp->ma_size != 0 + && (mp->ma_lookup)(mp, key, hash)->me_value != NULL); + } + + staticforward PyObject *dictiter_new(dictobject *); + + /* Hack to implement "key in dict" */ + static PySequenceMethods dict_as_sequence = { + 0, /* sq_length */ + 0, /* sq_concat */ + 0, /* sq_repeat */ + 0, /* sq_item */ + 0, /* sq_slice */ + 0, /* sq_ass_item */ + 0, /* sq_ass_slice */ + (objobjproc)dict_contains, /* sq_contains */ + 0, /* sq_inplace_concat */ + 0, /* sq_inplace_repeat */ + }; + PyTypeObject PyDict_Type = { PyObject_HEAD_INIT(&PyType_Type) *************** *** 1232,1236 **** (reprfunc)dict_repr, /* tp_repr */ 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ &dict_as_mapping, /* tp_as_mapping */ 0, /* tp_hash */ --- 1266,1270 ---- (reprfunc)dict_repr, /* tp_repr */ 0, /* tp_as_number */ ! &dict_as_sequence, /* tp_as_sequence */ &dict_as_mapping, /* tp_as_mapping */ 0, /* tp_hash */ *************** *** 1245,1248 **** --- 1279,1284 ---- (inquiry)dict_tp_clear, /* tp_clear */ 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + (getiterfunc)dictiter_new, /* tp_iter */ }; *************** *** 1287,1288 **** --- 1323,1423 ---- return err; } + + /* Dictionary iterator type */ + + extern PyTypeObject PyDictIter_Type; /* Forward */ + + typedef struct { + PyObject_HEAD + dictobject *di_dict; + int di_size; + int di_pos; + } dictiterobject; + + static PyObject * + dictiter_new(dictobject *dict) + { + dictiterobject *di; + di = PyObject_NEW(dictiterobject, &PyDictIter_Type); + if (di == NULL) + return NULL; + Py_INCREF(dict); + di->di_dict = dict; + di->di_size = dict->ma_size; + di->di_pos = 0; + return (PyObject *)di; + } + + static void + dictiter_dealloc(dictiterobject *di) + { + Py_DECREF(di->di_dict); + PyObject_DEL(di); + } + + static PyObject * + dictiter_next(dictiterobject *di, PyObject *args) + { + PyObject *key; + if (di->di_size != di->di_dict->ma_size) { + PyErr_SetString(PyExc_RuntimeError, + "dictionary changed size during iteration"); + return NULL; + } + if (PyDict_Next((PyObject *)(di->di_dict), &di->di_pos, &key, NULL)) { + Py_INCREF(key); + return key; + } + PyErr_SetObject(PyExc_IndexError, Py_None); + return NULL; + } + + static PyObject * + dictiter_getiter(PyObject *it) + { + Py_INCREF(it); + return it; + } + + static PyMethodDef dictiter_methods[] = { + {"next", (PyCFunction)dictiter_next, METH_VARARGS, + "it.next() -- get the next value, or raise IndexError"}, + {NULL, NULL} /* sentinel */ + }; + + static PyObject * + dictiter_getattr(dictiterobject *it, char *name) + { + return Py_FindMethod(dictiter_methods, (PyObject *)it, name); + } + + PyTypeObject PyDictIter_Type = { + PyObject_HEAD_INIT(&PyType_Type) + 0, /* ob_size */ + "dictionary-iterator", /* tp_name */ + sizeof(dictiterobject), /* tp_basicsize */ + 0, /* tp_itemsize */ + /* methods */ + (destructor)dictiter_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + (getattrfunc)dictiter_getattr, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_compare */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ + 0, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + (getiterfunc)dictiter_getiter, /* tp_iter */ + }; From gvanrossum@usw-pr-cvs1.sourceforge.net Tue Mar 13 16:54:18 2001 From: gvanrossum@usw-pr-cvs1.sourceforge.net (Guido van Rossum) Date: Tue, 13 Mar 2001 08:54:18 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects fileobject.c,2.109,2.109.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv19919 Modified Files: Tag: iter-branch fileobject.c Log Message: Another *EXPERIMENTAL* quickie on the "iter-branch" branch: implement "for line in file" (but not "if line in file"). Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.109 retrieving revision 2.109.2.1 diff -C2 -r2.109 -r2.109.2.1 *** fileobject.c 2001/03/01 18:26:53 2.109 --- fileobject.c 2001/03/13 16:54:15 2.109.2.1 *************** *** 1298,1301 **** --- 1298,1316 ---- } + static PyObject * + file_getiter(PyFileObject *f) + { + static PyObject *es; + PyObject *iter; + PyObject *rl = Py_FindMethod(file_methods, (PyObject *)f, "readline"); + if (rl == NULL) + return NULL; + if (es == NULL) + es = PyString_FromString(""); + iter = PyCallIter_New(rl, es); + Py_DECREF(rl); + return iter; + } + PyTypeObject PyFile_Type = { PyObject_HEAD_INIT(&PyType_Type) *************** *** 1304,1313 **** sizeof(PyFileObject), 0, ! (destructor)file_dealloc, /*tp_dealloc*/ ! 0, /*tp_print*/ ! (getattrfunc)file_getattr, /*tp_getattr*/ ! (setattrfunc)file_setattr, /*tp_setattr*/ ! 0, /*tp_compare*/ ! (reprfunc)file_repr, /*tp_repr*/ }; --- 1319,1344 ---- sizeof(PyFileObject), 0, ! (destructor)file_dealloc, /* tp_dealloc */ ! 0, /* tp_print */ ! (getattrfunc)file_getattr, /* tp_getattr */ ! (setattrfunc)file_setattr, /* tp_setattr */ ! 0, /* tp_compare */ ! (reprfunc)file_repr, /* tp_repr */ ! 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! 0, /* tp_hash */ ! 0, /* tp_call */ ! 0, /* tp_str */ ! 0, /* tp_getattro */ ! 0, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT, /* tp_flags */ ! 0, /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ ! 0, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ ! (getiterfunc)file_getiter, /* tp_iter */ }; *************** *** 1478,1482 **** return fd; } - - - --- 1509,1510 ---- From fdrake@usw-pr-cvs1.sourceforge.net Tue Mar 13 17:56:12 2001 From: fdrake@usw-pr-cvs1.sourceforge.net (Fred L. Drake) Date: Tue, 13 Mar 2001 09:56:12 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/tut tut.tex,1.129,1.130 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory usw-pr-cvs1:/tmp/cvs-serv1219/tut Modified Files: tut.tex Log Message: Add some LaTeX magic so that Latin-1 characters do not get so badly trashed. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.129 retrieving revision 1.130 diff -C2 -r1.129 -r1.130 *** tut.tex 2001/03/06 07:19:34 1.129 --- tut.tex 2001/03/13 17:56:08 1.130 *************** *** 1,3 **** --- 1,4 ---- \documentclass{manual} + \usepackage[T1]{fontenc} % Things to do: From montanaro@usw-pr-cvs1.sourceforge.net Tue Mar 13 19:47:18 2001 From: montanaro@usw-pr-cvs1.sourceforge.net (Skip Montanaro) Date: Tue, 13 Mar 2001 11:47:18 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib urllib.py,1.123,1.124 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv22504 Modified Files: urllib.py Log Message: updated __all__ to include several other names Index: urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib.py,v retrieving revision 1.123 retrieving revision 1.124 diff -C2 -r1.123 -r1.124 *** urllib.py 2001/03/05 13:45:38 1.123 --- urllib.py 2001/03/13 19:47:16 1.124 *************** *** 31,35 **** __all__ = ["urlopen", "URLopener", "FancyURLopener", "urlretrieve", "urlcleanup", "quote", "quote_plus", "unquote", "unquote_plus", ! "urlencode", "url2pathname", "pathname2url", "splittag"] __version__ = '1.15' # XXX This version is not always updated :-( --- 31,39 ---- __all__ = ["urlopen", "URLopener", "FancyURLopener", "urlretrieve", "urlcleanup", "quote", "quote_plus", "unquote", "unquote_plus", ! "urlencode", "url2pathname", "pathname2url", "splittag", ! "localhost", "thishost", "ftperrors", "basejoin", "unwrap", ! "splittype", "splithost", "splituser", "splitpasswd", "splitport", ! "splitnport", "splitquery", "splitattr", "splitvalue", ! "splitgophertype", "getproxies"] __version__ = '1.15' # XXX This version is not always updated :-( From gvanrossum@usw-pr-cvs1.sourceforge.net Wed Mar 14 16:17:29 2001 From: gvanrossum@usw-pr-cvs1.sourceforge.net (Guido van Rossum) Date: Wed, 14 Mar 2001 08:17:29 -0800 Subject: [Python-checkins] CVS: python/dist/src/Include pyerrors.h,2.44,2.44.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv28608/Include Modified Files: Tag: iter-branch pyerrors.h Log Message: Switch from IndexError to StopIteration to end the sequence. Index: pyerrors.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pyerrors.h,v retrieving revision 2.44 retrieving revision 2.44.2.1 diff -C2 -r2.44 -r2.44.2.1 *** pyerrors.h 2001/02/28 21:44:20 2.44 --- pyerrors.h 2001/03/14 16:17:27 2.44.2.1 *************** *** 25,28 **** --- 25,29 ---- extern DL_IMPORT(PyObject *) PyExc_Exception; + extern DL_IMPORT(PyObject *) PyExc_StopIteration; extern DL_IMPORT(PyObject *) PyExc_StandardError; extern DL_IMPORT(PyObject *) PyExc_ArithmeticError; From gvanrossum@usw-pr-cvs1.sourceforge.net Wed Mar 14 16:17:29 2001 From: gvanrossum@usw-pr-cvs1.sourceforge.net (Guido van Rossum) Date: Wed, 14 Mar 2001 08:17:29 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python exceptions.c,1.22,1.22.2.1 ceval.c,2.230.2.3,2.230.2.4 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv28608/Python Modified Files: Tag: iter-branch exceptions.c ceval.c Log Message: Switch from IndexError to StopIteration to end the sequence. Index: exceptions.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/exceptions.c,v retrieving revision 1.22 retrieving revision 1.22.2.1 diff -C2 -r1.22 -r1.22.2.1 *** exceptions.c 2001/02/28 21:52:10 1.22 --- exceptions.c 2001/03/14 16:17:27 1.22.2.1 *************** *** 53,56 **** --- 53,57 ---- |\n\ +-- SystemExit\n\ + +-- StopIteration\n\ +-- StandardError\n\ | |\n\ *************** *** 370,373 **** --- 371,377 ---- TypeError__doc__[] = "Inappropriate argument type."; + static char + StopIteration__doc__[] = "Signal the end from iterator.next()."; + *************** *** 925,928 **** --- 929,933 ---- PyObject *PyExc_Exception; + PyObject *PyExc_StopIteration; PyObject *PyExc_StandardError; PyObject *PyExc_ArithmeticError; *************** *** 986,989 **** --- 991,996 ---- */ {"Exception", &PyExc_Exception}, + {"StopIteration", &PyExc_StopIteration, &PyExc_Exception, + StopIteration__doc__}, {"StandardError", &PyExc_StandardError, &PyExc_Exception, StandardError__doc__}, Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.230.2.3 retrieving revision 2.230.2.4 diff -C2 -r2.230.2.3 -r2.230.2.4 *** ceval.c 2001/03/13 13:53:57 2.230.2.3 --- ceval.c 2001/03/14 16:17:27 2.230.2.4 *************** *** 1850,1854 **** x = PyObject_CallObject(v, NULL); if (x == NULL) { ! if (PyErr_ExceptionMatches(PyExc_IndexError)) { PyErr_Clear(); x = v = POP(); --- 1850,1856 ---- x = PyObject_CallObject(v, NULL); if (x == NULL) { ! if (PyErr_ExceptionMatches( ! PyExc_StopIteration)) ! { PyErr_Clear(); x = v = POP(); From gvanrossum@usw-pr-cvs1.sourceforge.net Wed Mar 14 16:17:29 2001 From: gvanrossum@usw-pr-cvs1.sourceforge.net (Guido van Rossum) Date: Wed, 14 Mar 2001 08:17:29 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects iterobject.c,1.1.2.4,1.1.2.5 dictobject.c,2.73.2.1,2.73.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv28608/Objects Modified Files: Tag: iter-branch iterobject.c dictobject.c Log Message: Switch from IndexError to StopIteration to end the sequence. Index: iterobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/Attic/iterobject.c,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -C2 -r1.1.2.4 -r1.1.2.5 *** iterobject.c 2001/03/13 16:22:16 1.1.2.4 --- iterobject.c 2001/03/14 16:17:27 1.1.2.5 *************** *** 36,40 **** PyObject *item; if (it->it_index >= PyList_GET_SIZE(seq)) { ! PyErr_SetObject(PyExc_IndexError, Py_None); return NULL; } --- 36,40 ---- PyObject *item; if (it->it_index >= PyList_GET_SIZE(seq)) { ! PyErr_SetObject(PyExc_StopIteration, Py_None); return NULL; } *************** *** 44,48 **** return item; } ! return PySequence_GetItem(seq, it->it_index++); } --- 44,54 ---- return item; } ! else { ! PyObject *result = PySequence_GetItem(seq, it->it_index++); ! if (result == NULL && ! PyErr_ExceptionMatches(PyExc_IndexError)) ! PyErr_SetObject(PyExc_StopIteration, Py_None); ! return result; ! } } *************** *** 56,60 **** static PyMethodDef iter_methods[] = { {"next", (PyCFunction)iter_next, METH_VARARGS, ! "it.next() -- get the next value, or raise IndexError"}, {NULL, NULL} /* sentinel */ }; --- 62,66 ---- static PyMethodDef iter_methods[] = { {"next", (PyCFunction)iter_next, METH_VARARGS, ! "it.next() -- get the next value, or raise StopIteration"}, {NULL, NULL} /* sentinel */ }; *************** *** 131,145 **** if (result != NULL) { if (PyObject_RichCompareBool(result, it->it_sentinel, Py_EQ)) { ! PyErr_SetObject(PyExc_IndexError, Py_None); Py_DECREF(result); result = NULL; } } - else { - if (PyErr_ExceptionMatches(PyExc_IndexError)) - PyErr_SetString(PyExc_TypeError, - "callable in iterator raised " - "unexpected IndexError"); - } return result; } --- 137,145 ---- if (result != NULL) { if (PyObject_RichCompareBool(result, it->it_sentinel, Py_EQ)) { ! PyErr_SetObject(PyExc_StopIteration, Py_None); Py_DECREF(result); result = NULL; } } return result; } *************** *** 147,151 **** static PyMethodDef calliter_methods[] = { {"next", (PyCFunction)calliter_next, METH_VARARGS, ! "it.next() -- get the next value, or raise IndexError"}, {NULL, NULL} /* sentinel */ }; --- 147,151 ---- static PyMethodDef calliter_methods[] = { {"next", (PyCFunction)calliter_next, METH_VARARGS, ! "it.next() -- get the next value, or raise StopIteration"}, {NULL, NULL} /* sentinel */ }; Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.73.2.1 retrieving revision 2.73.2.2 diff -C2 -r2.73.2.1 -r2.73.2.2 *** dictobject.c 2001/03/13 16:32:03 2.73.2.1 --- dictobject.c 2001/03/14 16:17:27 2.73.2.2 *************** *** 1369,1373 **** return key; } ! PyErr_SetObject(PyExc_IndexError, Py_None); return NULL; } --- 1369,1373 ---- return key; } ! PyErr_SetObject(PyExc_StopIteration, Py_None); return NULL; } *************** *** 1382,1386 **** static PyMethodDef dictiter_methods[] = { {"next", (PyCFunction)dictiter_next, METH_VARARGS, ! "it.next() -- get the next value, or raise IndexError"}, {NULL, NULL} /* sentinel */ }; --- 1382,1386 ---- static PyMethodDef dictiter_methods[] = { {"next", (PyCFunction)dictiter_next, METH_VARARGS, ! "it.next() -- get the next value, or raise StopIteration"}, {NULL, NULL} /* sentinel */ }; From fdrake@usw-pr-cvs1.sourceforge.net Wed Mar 14 16:18:58 2001 From: fdrake@usw-pr-cvs1.sourceforge.net (Fred L. Drake) Date: Wed, 14 Mar 2001 08:18:58 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib sgmllib.py,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv29303 Modified Files: sgmllib.py Log Message: Change "[%s]" % string.whitespace to r"\s" in regular expressions. Index: sgmllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sgmllib.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -r1.27 -r1.28 *** sgmllib.py 2001/02/19 18:39:09 1.27 --- sgmllib.py 2001/03/14 16:18:56 1.28 *************** *** 34,43 **** special = re.compile(']*>') commentopen = re.compile(' Rejected --- 108,118 ---- this fact. + PEPs can also be replaced by a different PEP, rendering the + original obsolete. This is intended for Informational PEPs, where + version 2 of an API can replace version 1. + PEP work flow is as follows: ! Draft -> Accepted -> Final -> Replaced ^ +----> Rejected *************** *** 119,134 **** Each PEP should have the following parts: ! 1. Title -- a short, descriptive title ! 2. Author(s) -- names and contact info for each author ! 3. Abstract -- a short (~200 word) description of the technical issue ! being addressed ! ! 4. Copyright/public domain -- Each PEP must either be explicitly labelled in the public domain or the Open Publication ! License[2]. ! 5. Specification -- The technical specification should describe the syntax and semantics of any new language feature. The specification should be detailed enough to allow competing, --- 128,143 ---- Each PEP should have the following parts: ! 1. Preamble -- RFC822 style headers containing meta-data about the ! PEP, including the PEP number, a short descriptive title, the ! names contact info for each author, etc. ! 2. Abstract -- a short (~200 word) description of the technical ! issue being addressed. ! 3. Copyright/public domain -- Each PEP must either be explicitly labelled in the public domain or the Open Publication ! License[4]. ! 4. Specification -- The technical specification should describe the syntax and semantics of any new language feature. The specification should be detailed enough to allow competing, *************** *** 136,140 **** platforms (CPython, JPython, Python .NET). ! 6. Rationale -- The rationale fleshes out the specification by describing what motivated the design and why particular design decisions were made. It should describe alternate designs that --- 145,149 ---- platforms (CPython, JPython, Python .NET). ! 5. Rationale -- The rationale fleshes out the specification by describing what motivated the design and why particular design decisions were made. It should describe alternate designs that *************** *** 146,151 **** during discussion. ! 7. Reference Implementation -- The reference implementation must ! be completed before any PEP is given status 'final,' but it need not be completed before the PEP is accepted. It is better to finish the specification and rationale first and reach --- 155,160 ---- during discussion. ! 6. Reference Implementation -- The reference implementation must ! be completed before any PEP is given status 'Final,' but it need not be completed before the PEP is accepted. It is better to finish the specification and rationale first and reach *************** *** 161,168 **** PEPs are written in plain ASCII text, and should adhere to a rigid style. There is a Python script that parses this style and ! converts the plain text PEP to HTML for viewing on the web[3]. ! Each PEP begins with an RFC822 style header section. Required ! headers are as follows, and must appear in this order: PEP: --- 170,179 ---- PEPs are written in plain ASCII text, and should adhere to a rigid style. There is a Python script that parses this style and ! converts the plain text PEP to HTML for viewing on the web[5]. ! Each PEP must begin with an RFC822 style header preamble. The ! headers must appear in the following order. Headers marked with ! `*' are optional and are described below. All other headers are ! required. PEP: *************** *** 170,198 **** Version: Author: Status: Type: Created: Post-History: ! Standards track PEPs should additionally have a Python-Version: ! header which indicates the version of Python that the feature will ! be released with. While a PEP is in private discussions (usually during the initial Draft phase), a Discussions-To: header will indicate the mailing ! list or URL where the PEP is being discussed. ! ! PEP headings should begin in column zero and should be ! capitalized. The body of each section should be indented 4 spaces. Code samples inside body sections should be indented a further 4 spaces, and other indentation can be used as required to ! make the text readable. You should use two blank lines between ! the last line of a section's body and the next section heading. ! No tabs should appear in the document at all. A PEP should ! include the Emacs stanza included by example in this PEP to aid ! Emacs editors. ! A PEP must contain a Copyright heading, and it is strongly recommended to put the PEP in the public domain. --- 181,222 ---- Version: Author: + * Discussions-To: Status: Type: Created: + * Python-Version: Post-History: + * Replaces: + * Replaced-By: ! Standards track PEPs must have a Python-Version: header which ! indicates the version of Python that the feature will be released ! with. Informational PEPs do not need a Python-Version: header. While a PEP is in private discussions (usually during the initial Draft phase), a Discussions-To: header will indicate the mailing ! list or URL where the PEP is being discussed. No Discussions-To: ! header is necessary if the PEP is being discussed privately with ! the author, or on the python-list or python-dev email mailing ! lists. ! ! PEPs may also have a Replaced-By: header indicating that a PEP has ! been rendered obsolete by a later document; the value is the ! number of the PEP that replaces the current document. The newer ! PEP must have a Replaces: header containing the number of the PEP ! that it rendered obsolete. ! ! PEP headings must begin in column zero and the initial letter of ! each word must be capitalized as in book titles. Acronyms should ! be in all capitals. The body of each section must be indented 4 spaces. Code samples inside body sections should be indented a further 4 spaces, and other indentation can be used as required to ! make the text readable. You must use two blank lines between the ! last line of a section's body and the next section heading. ! Tab characters must never appear in the document at all. A PEP ! should include the Emacs stanza included by example in this PEP. ! A PEP must contain a Copyright section, and it is strongly recommended to put the PEP in the public domain. *************** *** 201,209 **** - Copyright - - This document has been placed in the public domain. - - References and Footnotes --- 225,228 ---- *************** *** 214,221 **** http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/python/nondist/peps/?cvsroot=python ! [2] http://www.opencontent.org/openpub/ ! [3] The script referred to here is pep2html.py, which lives in the same directory in the CVS tree as the PEPs themselves. Try "pep2html.py --help" for details. --- 233,244 ---- http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/python/nondist/peps/?cvsroot=python + + [2] http://sourceforge.net/tracker/?group_id=5470&atid=305470 ! [3] http://sourceforge.net/tracker/?atid=355470&group_id=5470&func=browse ! [4] http://www.opencontent.org/openpub/ ! ! [5] The script referred to here is pep2html.py, which lives in the same directory in the CVS tree as the PEPs themselves. Try "pep2html.py --help" for details. *************** *** 224,227 **** --- 247,254 ---- http://python.sourceforge.net/peps/ + + Copyright + + This document has been placed in the public domain. From bwarsaw@users.sourceforge.net Wed Mar 21 17:20:31 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 21 Mar 2001 09:20:31 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0001.txt,1.15,1.16 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv7438 Modified Files: pep-0001.txt Log Message: Status: can now also be "Replaced" (thanks AMK). Index: pep-0001.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0001.txt,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -r1.15 -r1.16 *** pep-0001.txt 2001/03/21 17:05:27 1.15 --- pep-0001.txt 2001/03/21 17:20:29 1.16 *************** *** 182,186 **** Author: * Discussions-To: ! Status: Type: Created: --- 182,186 ---- Author: * Discussions-To: ! Status: Type: Created: From moshez@users.sourceforge.net Wed Mar 21 17:24:52 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Wed, 21 Mar 2001 09:24:52 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/lib-tk Tix.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-tk In directory usw-pr-cvs1:/tmp/cvs-serv6561/Lib/lib-tk Modified Files: Tix.py Log Message: Fixed a bunch of Tabnanny errors Index: Tix.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/Tix.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Tix.py 2001/03/21 07:42:07 1.1 --- Tix.py 2001/03/21 17:24:49 1.2 *************** *** 4,14 **** # Tix.py -- Tix widget wrappers, part of PyTix. # ! # - Sudhir Shenoy (sshenoy@gol.com), Dec. 1995. ! # based on an idea (and a little code !!) of Jean-Marc Lugrin ! # (lugrin@ms.com) # # NOTE: In order to minimize changes to Tkinter.py, some of the code here ! # (TixWidget.__init__) has been taken from Tkinter (Widget.__init__) ! # and will break if there are major changes in Tkinter. # [...2270 lines suppressed...] ! self.subwidget_list['help'] = _dummyButton(self, 'help') class _dummyNoteBookFrame(NoteBookFrame, TixSubWidget): def __init__(self, master, name, destroy_physically=0): ! TixSubWidget.__init__(self, master, name, destroy_physically) ######################## *************** *** 1262,1266 **** s = '' for type in dict.keys(): ! s = s + '{{' + type + '} {' + type + ' - ' + dict[type] + '}} ' return s --- 1262,1266 ---- s = '' for type in dict.keys(): ! s = s + '{{' + type + '} {' + type + ' - ' + dict[type] + '}} ' return s From bwarsaw@users.sourceforge.net Wed Mar 21 17:26:07 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 21 Mar 2001 09:26:07 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep2html.py,1.21,1.22 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv8471 Modified Files: pep2html.py Log Message: fixfile(): Do the mailto: hacking on both the Author: and Discussions-To: headers. Also, apply SF patch #410223 by Andrew Kuchling, which does the PEP# href wrapping for Replaces: and Replaced-By: headers. Index: pep2html.py =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep2html.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -r1.21 -r1.22 *** pep2html.py 2001/03/21 14:52:13 1.21 --- pep2html.py 2001/03/21 17:26:05 1.22 *************** *** 124,128 **** '
\n\n') for k, v in header: ! if k.lower() == 'author': mailtos = [] for addr in v.split(): --- 124,128 ---- '
\n
\n') for k, v in header: ! if k.lower() in ('author', 'discussions-to'): mailtos = [] for addr in v.split(): *************** *** 134,137 **** --- 134,143 ---- mailtos.append(addr) v = ' '.join(mailtos) + elif k.lower() in ('replaces', 'replaced-by'): + peps = '' + for pep in v.split(): + pep = int(pep) + peps += '%i ' % (pep, pep) + v = peps else: v = cgi.escape(v) From bwarsaw@users.sourceforge.net Wed Mar 21 17:31:56 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 21 Mar 2001 09:31:56 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0000.txt,1.76,1.77 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv9568 Modified Files: pep-0000.txt Log Message: PEP 2 is moved to the Empty category and marked Deferred. Other empty PEPs 210, 220 are also moved to the Deferred category since they are effectively empty too. PEPs 215 and 219 moved to the Py-in-the-sky category for lack of a better idea. Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.76 retrieving revision 1.77 diff -C2 -r1.76 -r1.77 *** pep-0000.txt 2001/03/20 05:48:05 1.76 --- pep-0000.txt 2001/03/21 17:31:54 1.77 *************** *** 8,11 **** --- 8,12 ---- Post-History: + Introduction *************** *** 24,28 **** I 0 pep-0000.txt Index of Python Enhancement Proposals Warsaw I 1 pep-0001.txt PEP Guidelines Warsaw, Hylton - I 2 pep-0002.txt Procedure for Adding New Modules Raymond I 3 pep-0003.txt Guidelines for Handling Bug Reports Hylton I 4 pep-0004.txt Deprecation of Standard Modules von Loewis --- 25,28 ---- *************** *** 53,57 **** S 242 pep-0242.txt Numeric Kinds Dubois ! Pie-in-the-sky PEPs (not ready; may become active yet) I 206 pep-0206.txt 2.0 Batteries Included Zadka --- 53,57 ---- S 242 pep-0242.txt Numeric Kinds Dubois ! Py-in-the-sky PEPs (not ready; may become active yet) I 206 pep-0206.txt 2.0 Batteries Included Zadka *************** *** 60,65 **** --- 60,67 ---- SD 212 pep-0212.txt Loop Counter Iteration Schneider-Kamp SD 213 pep-0213.txt Attribute Access Handlers Prescod + S 215 pep-0215.txt String Interpolation Yee I 216 pep-0216.txt Docstring Format Zadka SD 218 pep-0218.txt Adding a Built-In Set Object Type Wilson + SD 219 pep-0219.txt Stackless Python McMillan S 222 pep-0222.txt Web Library Enhancements Kuchling SD 224 pep-0224.txt Attribute Docstrings Lemburg *************** *** 67,80 **** S 228 pep-0228.txt Reworking Python's Numeric Model Zadka - Incomplete PEPs (only an abstract) - - SD 219 pep-0219.txt Stackless Python McMillan - I 220 pep-0220.txt Coroutines, Generators, Continuations McMillan - - Empty PEPs (nothing written yet) - - SD 210 pep-0210.txt Decoupling the Interpreter Loop Ascher - SD 215 pep-0215.txt String Interpolation Yee - Finished PEPs (done, implemented) --- 69,72 ---- *************** *** 91,94 **** --- 83,92 ---- SF 223 pep-0223.txt Change the Meaning of \x Escapes Peters SF 230 pep-0230.txt Warning Framework van Rossum + + Empty PEPs (or containing only an abstract) + + ID 2 pep-0002.txt Procedure for Adding New Modules Raymond + SD 210 pep-0210.txt Decoupling the Interpreter Loop Ascher + ID 220 pep-0220.txt Coroutines, Generators, Continuations McMillan Rejected PEPs From bwarsaw@users.sourceforge.net Wed Mar 21 17:34:35 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 21 Mar 2001 09:34:35 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0219.txt,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv10144 Modified Files: pep-0219.txt Log Message: minor style conformance changes Index: pep-0219.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0219.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** pep-0219.txt 2001/03/12 20:45:24 1.3 --- pep-0219.txt 2001/03/21 17:34:33 1.4 *************** *** 5,9 **** Status: Draft Type: Standards Track ! Python-Version: 2.1 Created: 14-Aug-2000 Post-History: --- 5,10 ---- Status: Draft Type: Standards Track ! Created: 14-Aug-2000 ! Python-Version: 2.1 Post-History: *************** *** 12,168 **** This PEP discusses changes required to core Python in order to ! efficiently support generators, microthreads and coroutines. It ! is related to PEP 220, which describes how Python should be extended to support these facilities. The focus of this PEP is strictly on the changes required to allow these extensions to work. ! While these PEPs are based on Christian Tismer's Stackless[1] ! implementation, they do not regard Stackless as a reference ! implementation. Stackless (with an extension module) implements ! continuations, and from continuations one can implement coroutines, ! microthreads (as has been done by Will Ware[2]) and generators. But ! in more that a year, no one has found any other productive use of ! continuations, so there seems to be no demand for their support. However, Stackless support for continuations is a relatively minor ! piece of the implementation, so one might regard it as "a" reference ! implementation (rather than "the" reference implementation). Background - Generators and coroutines have been implmented in a number of languages in - a number of ways. Indeed, Tim Peters has done pure Python implementations - of generators[3] and coroutines[4] using threads (and a thread-based - coroutine implementation exists for Java). However, the horrendous - overhead of a thread-based implementation severely limits the usefulness - of this approach. - - Microthreads (a.k.a "green" or "user" threads) and coroutines involve - transfers of control that are difficult to accomodate in a language - implementation based on a single stack. (Generators can be done on a - single stack, but they can also be regarded as a very simple case of - coroutines.) - - Real threads allocate a full-sized stack for each thread of control, and - this is the major source of overhead. However, coroutines and microthreads - can be implemented in Python in a way that involves almost no overhead. - This PEP, therefor, offers a way for making Python able to realistically - manage thousands of separate "threads" of activity (vs. todays limit of - perhaps dozens of separate threads of activity). - - Another justification for this PEP (explored in PEP 220) is that - coroutines and generators often allow a more direct expression of an - algorithm than is possible in today's Python. Discussion - The first thing to note is that Python, while it mingles interpreter data - (normal C stack usage) with Python data (the state of the interpreted - program) on the stack, the two are logically separate. They just happen to - use the same stack. - - A real thread gets something approaching a process-sized stack because the - implementation has no way of knowing how much stack space the thread will - require. The stack space required for an individual frame is likely to be - reasonable, but stack switching is an arcane and non-portable process, - not supported by C. - - Once Python stops putting Python data on the C stack, however, stack - switching becomes easy. - - The fundamental approach of the PEP is based on these two ideas. First, - separate C's stack usage from Python's stack usage. Secondly, associate - with each frame enough stack space to handle that frame's execution. - - In the normal usage, Stackless Python has a normal stack structure, - except that it is broken into chunks. But in the presence of a - coroutine / microthread extension, this same mechanism supports a stack - with a tree structure. That is, an extension can support transfers of - control between frames outside the normal "call / return" path. Problems ! The major difficulty with this approach is C calling Python. The problem ! is that the C stack now holds a nested execution of the byte-code ! interpreter. In that situation, a coroutine / microthread extension cannot ! be permitted to transfer control to a frame in a different invocation of the ! byte-code interpreter. If a frame were to complete and exit back to C from ! the wrong interpreter, the C stack could be trashed. ! ! The ideal solution is to create a mechanism where nested executions of the ! byte code interpreter are never needed. The easy solution is for the ! coroutine / microthread extension(s) to recognize the situation and refuse ! to allow transfers outside the current invocation. ! ! We can categorize code that involves C calling Python into two camps: ! Python's implementation, and C extensions. And hopefully we can offer a ! compromise: Python's internal usage (and C extension writers who want to ! go to the effort) will no longer use a nested invocation of the ! interpreter. Extensions which do not go to the effort will still be ! safe, but will not play well with coroutines / microthreads. ! ! Generally, when a recursive call is transformed into a loop, a bit of ! extra bookkeeping is required. The loop will need to keep it's own ! "stack" of arguments and results since the real stack can now only hold ! the most recent. The code will be more verbose, because it's not quite ! as obvious when we're done. While Stackless is not implemented this way, ! it has to deal with the same issues. ! ! In normal Python, PyEval_EvalCode is used to build a frame and execute ! it. Stackless Python introduces the concept of a FrameDispatcher. Like ! PyEval_EvalCode, it executes one frame. But the interpreter may signal ! the FrameDispatcher that a new frame has been swapped in, and the new ! frame should be executed. When a frame completes, the FrameDispatcher ! follows the back pointer to resume the "calling" frame. ! ! So Stackless transforms recursions into a loop, but it is not the ! FrameDispatcher that manages the frames. This is done by the interpreter ! (or an extension that knows what it's doing). ! ! The general idea is that where C code needs to execute Python code, it ! creates a frame for the Python code, setting its back pointer to the ! current frame. Then it swaps in the frame, signals the FrameDispatcher ! and gets out of the way. The C stack is now clean - the Python code can ! transfer control to any other frame (if an extension gives it the means ! to do so). ! ! In the vanilla case, this magic can be hidden from the programmer (even, ! in most cases, from the Python-internals programmer). Many situations ! present another level of difficulty, however. ! ! The map builtin function involves two obstacles to this approach. It ! cannot simply construct a frame and get out of the way, not just because ! there's a loop involved, but each pass through the loop requires some ! "post" processing. In order to play well with others, Stackless ! constructs a frame object for map itself. ! ! Most recursions of the interpreter are not this complex, but fairly ! frequently, some "post" operations are required. Stackless does not ! fix these situations because of amount of code changes required. Instead, ! Stackless prohibits transfers out of a nested interpreter. While not ! ideal (and sometimes puzzling), this limitation is hardly crippling. Advantages ! For normal Python, the advantage to this approach is that C stack usage ! becomes much smaller and more predictable. Unbounded recursion in Python ! code becomes a memory error, instead of a stack error (and thus, in ! non-Cupertino operating systems, something that can be recovered from). ! The price, of course, is the added complexity that comes from transforming ! recursions of the byte-code interpreter loop into a higher order loop ! (and the attendant bookkeeping involved). ! ! The big advantage comes from realizing that the Python stack is really ! a tree, and the frame dispatcher can transfer control freely between ! leaf nodes of the tree, thus allowing things like microthreads and ! coroutines. References - [1] www.stackless.com - [2] http://world.std.com/~wware/uthread.html - [3] Demo/threads/Generator.py in the source distribution - [4] http://www.stackless.com/coroutines.tim.peters.html --- 13,186 ---- This PEP discusses changes required to core Python in order to ! efficiently support generators, microthreads and coroutines. It is ! related to PEP 220, which describes how Python should be extended to support these facilities. The focus of this PEP is strictly on the changes required to allow these extensions to work. ! While these PEPs are based on Christian Tismer's Stackless[1] ! implementation, they do not regard Stackless as a reference ! implementation. Stackless (with an extension module) implements ! continuations, and from continuations one can implement ! coroutines, microthreads (as has been done by Will Ware[2]) and ! generators. But in more that a year, no one has found any other ! productive use of continuations, so there seems to be no demand ! for their support. However, Stackless support for continuations is a relatively minor ! piece of the implementation, so one might regard it as "a" ! reference implementation (rather than "the" reference ! implementation). + Background + + Generators and coroutines have been implemented in a number of + languages in a number of ways. Indeed, Tim Peters has done pure + Python implementations of generators[3] and coroutines[4] using + threads (and a thread-based coroutine implementation exists for + Java). However, the horrendous overhead of a thread-based + implementation severely limits the usefulness of this approach. + + Microthreads (a.k.a "green" or "user" threads) and coroutines + involve transfers of control that are difficult to accommodate in + a language implementation based on a single stack. (Generators can + be done on a single stack, but they can also be regarded as a very + simple case of coroutines.) + + Real threads allocate a full-sized stack for each thread of + control, and this is the major source of overhead. However, + coroutines and microthreads can be implemented in Python in a way + that involves almost no overhead. This PEP, therefor, offers a + way for making Python able to realistically manage thousands of + separate "threads" of activity (vs. todays limit of perhaps dozens + of separate threads of activity). + + Another justification for this PEP (explored in PEP 220) is that + coroutines and generators often allow a more direct expression of + an algorithm than is possible in today's Python. Discussion + + The first thing to note is that Python, while it mingles + interpreter data (normal C stack usage) with Python data (the + state of the interpreted program) on the stack, the two are + logically separate. They just happen to use the same stack. + + A real thread gets something approaching a process-sized stack + because the implementation has no way of knowing how much stack + space the thread will require. The stack space required for an + individual frame is likely to be reasonable, but stack switching + is an arcane and non-portable process, not supported by C. + + Once Python stops putting Python data on the C stack, however, + stack switching becomes easy. + + The fundamental approach of the PEP is based on these two + ideas. First, separate C's stack usage from Python's stack + usage. Secondly, associate with each frame enough stack space to + handle that frame's execution. + + In the normal usage, Stackless Python has a normal stack + structure, except that it is broken into chunks. But in the + presence of a coroutine / microthread extension, this same + mechanism supports a stack with a tree structure. That is, an + extension can support transfers of control between frames outside + the normal "call / return" path. Problems ! The major difficulty with this approach is C calling Python. The ! problem is that the C stack now holds a nested execution of the ! byte-code interpreter. In that situation, a coroutine / ! microthread extension cannot be permitted to transfer control to a ! frame in a different invocation of the byte-code interpreter. If a ! frame were to complete and exit back to C from the wrong ! interpreter, the C stack could be trashed. ! ! The ideal solution is to create a mechanism where nested ! executions of the byte code interpreter are never needed. The easy ! solution is for the coroutine / microthread extension(s) to ! recognize the situation and refuse to allow transfers outside the ! current invocation. ! ! We can categorize code that involves C calling Python into two ! camps: Python's implementation, and C extensions. And hopefully we ! can offer a compromise: Python's internal usage (and C extension ! writers who want to go to the effort) will no longer use a nested ! invocation of the interpreter. Extensions which do not go to the ! effort will still be safe, but will not play well with coroutines ! / microthreads. ! ! Generally, when a recursive call is transformed into a loop, a bit ! of extra bookkeeping is required. The loop will need to keep it's ! own "stack" of arguments and results since the real stack can now ! only hold the most recent. The code will be more verbose, because ! it's not quite as obvious when we're done. While Stackless is not ! implemented this way, it has to deal with the same issues. ! ! In normal Python, PyEval_EvalCode is used to build a frame and ! execute it. Stackless Python introduces the concept of a ! FrameDispatcher. Like PyEval_EvalCode, it executes one frame. But ! the interpreter may signal the FrameDispatcher that a new frame ! has been swapped in, and the new frame should be executed. When a ! frame completes, the FrameDispatcher follows the back pointer to ! resume the "calling" frame. ! ! So Stackless transforms recursions into a loop, but it is not the ! FrameDispatcher that manages the frames. This is done by the ! interpreter (or an extension that knows what it's doing). ! ! The general idea is that where C code needs to execute Python ! code, it creates a frame for the Python code, setting its back ! pointer to the current frame. Then it swaps in the frame, signals ! the FrameDispatcher and gets out of the way. The C stack is now ! clean - the Python code can transfer control to any other frame ! (if an extension gives it the means to do so). ! ! In the vanilla case, this magic can be hidden from the programmer ! (even, in most cases, from the Python-internals programmer). Many ! situations present another level of difficulty, however. ! ! The map builtin function involves two obstacles to this ! approach. It cannot simply construct a frame and get out of the ! way, not just because there's a loop involved, but each pass ! through the loop requires some "post" processing. In order to play ! well with others, Stackless constructs a frame object for map ! itself. ! ! Most recursions of the interpreter are not this complex, but ! fairly frequently, some "post" operations are required. Stackless ! does not fix these situations because of amount of code changes ! required. Instead, Stackless prohibits transfers out of a nested ! interpreter. While not ideal (and sometimes puzzling), this ! limitation is hardly crippling. Advantages ! For normal Python, the advantage to this approach is that C stack ! usage becomes much smaller and more predictable. Unbounded ! recursion in Python code becomes a memory error, instead of a ! stack error (and thus, in non-Cupertino operating systems, ! something that can be recovered from). The price, of course, is ! the added complexity that comes from transforming recursions of ! the byte-code interpreter loop into a higher order loop (and the ! attendant bookkeeping involved). ! ! The big advantage comes from realizing that the Python stack is ! really a tree, and the frame dispatcher can transfer control ! freely between leaf nodes of the tree, thus allowing things like ! microthreads and coroutines. + References + + [1] www.stackless.com + [2] http://world.std.com/~wware/uthread.html + [3] Demo/threads/Generator.py in the source distribution + [4] http://www.stackless.com/coroutines.tim.peters.html From bwarsaw@users.sourceforge.net Wed Mar 21 17:35:07 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 21 Mar 2001 09:35:07 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0002.txt,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv10255 Modified Files: pep-0002.txt Log Message: Mark as Deferred since it seems like this will never get finished. Index: pep-0002.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0002.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** pep-0002.txt 2000/08/08 02:31:25 1.1 --- pep-0002.txt 2001/03/21 17:35:05 1.2 *************** *** 3,7 **** Version: $Revision$ Author: esr@snark.thyrsus.com (Eric S. Raymond) ! Status: Draft Type: Informational Created: 07-Aug-2000 --- 3,7 ---- Version: $Revision$ Author: esr@snark.thyrsus.com (Eric S. Raymond) ! Status: Deferred Type: Informational Created: 07-Aug-2000 From bwarsaw@users.sourceforge.net Wed Mar 21 17:35:24 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 21 Mar 2001 09:35:24 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0210.txt,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv10315 Modified Files: pep-0210.txt Log Message: Mark as Deferred since it seems like this will never get finished. Index: pep-0210.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0210.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** pep-0210.txt 2000/08/23 05:44:46 1.2 --- pep-0210.txt 2001/03/21 17:35:22 1.3 *************** *** 3,7 **** Version: $Revision$ Author: davida@activestate.com (David Ascher) ! Status: Draft Type: Standards Track Python-Version: 2.1 --- 3,7 ---- Version: $Revision$ Author: davida@activestate.com (David Ascher) ! Status: Deferred Type: Standards Track Python-Version: 2.1 From bwarsaw@users.sourceforge.net Wed Mar 21 17:36:37 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 21 Mar 2001 09:36:37 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0243.txt,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv10519 Modified Files: pep-0243.txt Log Message: De-tabbify, and minor fixup in preamble header order. Index: pep-0243.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0243.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** pep-0243.txt 2001/03/20 05:47:07 1.1 --- pep-0243.txt 2001/03/21 17:36:34 1.2 *************** *** 3,12 **** Version: $Revision$ Author: jafo-pep@tummy.com (Sean Reifschneider) Status: Draft Type: Standards Track Created: 18-Mar-2001 Python-Version: 2.1 ! Post-History: ! Discussions-To: distutils-sig@python.org --- 3,12 ---- Version: $Revision$ Author: jafo-pep@tummy.com (Sean Reifschneider) + Discussions-To: distutils-sig@python.org Status: Draft Type: Standards Track Created: 18-Mar-2001 Python-Version: 2.1 ! Post-History: 20-Mar-2001 *************** *** 40,66 **** 80/tcp. The form will consist of the following fields: ! distribution -- The file containing the module software (for ! example, a .tar.gz or .zip file). ! distmd5sum -- The MD5 hash of the uploaded distribution, ! encoded in ASCII representing the hexadecimal representation ! of the digest ("for byte in digest: s = s + ('%02x' % ! ord(byte))"). ! ! pkginfo -- The file containing the distribution meta-data (as ! specified in PEP-241 [1]). ! ! infomd5sum -- The MD5 hash of the uploaded meta-data, encoded ! in ASCII representing the hexadecimal representation of the ! digest ("for byte in digest: s = s + ('%02x' % ord(byte))"). ! ! platform (optional) -- A string representing the target ! platform for this distribution. This is only for binary ! distributions. It is encoded as ! "--". ! ! signature (optional) -- A GPG signature of the uploaded ! distribution as signed by the author. This may be used by the ! cataloging system to automate acceptance of uploads. --- 40,66 ---- 80/tcp. The form will consist of the following fields: ! distribution -- The file containing the module software (for ! example, a .tar.gz or .zip file). ! distmd5sum -- The MD5 hash of the uploaded distribution, ! encoded in ASCII representing the hexadecimal representation ! of the digest ("for byte in digest: s = s + ('%02x' % ! ord(byte))"). ! ! pkginfo -- The file containing the distribution meta-data (as ! specified in PEP-241 [1]). ! ! infomd5sum -- The MD5 hash of the uploaded meta-data, encoded ! in ASCII representing the hexadecimal representation of the ! digest ("for byte in digest: s = s + ('%02x' % ord(byte))"). ! ! platform (optional) -- A string representing the target ! platform for this distribution. This is only for binary ! distributions. It is encoded as ! "--". ! ! signature (optional) -- A GPG signature of the uploaded ! distribution as signed by the author. This may be used by the ! cataloging system to automate acceptance of uploads. *************** *** 70,82 **** string "Upload status:" followed by one of the following: ! SUCCESS -- Indicates that the upload has succeeded. ! FAILURE -- The upload is, for some reason, unable to be ! processed. ! TRYAGAIN -- The server is unable to accept the upload at this ! time, but the client should try again at a later time. ! Potential causes of this are resource shortages on the server, ! administrative down-time, etc... Following the above string may be a human-readable string --- 70,82 ---- string "Upload status:" followed by one of the following: ! SUCCESS -- Indicates that the upload has succeeded. ! FAILURE -- The upload is, for some reason, unable to be ! processed. ! TRYAGAIN -- The server is unable to accept the upload at this ! time, but the client should try again at a later time. ! Potential causes of this are resource shortages on the server, ! administrative down-time, etc... Following the above string may be a human-readable string *************** *** 94,108 **** with the following form: !

Upload file

!
!
!
!
!
!
!
! ! --- 94,108 ---- with the following form: !

Upload file

!
!
!
!
!
!
!
! ! *************** *** 111,122 **** The following are valid os names: ! debian ! hpux ! mandrake ! redhat ! solaris ! suse ! windows ! yellowdog The above include a number of different types of distributions of --- 111,122 ---- The following are valid os names: ! debian ! hpux ! mandrake ! redhat ! solaris ! suse ! windows ! yellowdog The above include a number of different types of distributions of *************** *** 132,141 **** The following are valid architectures: ! alpha ! hppa ! ix86 ! powerpc ! sparc ! ultrasparc --- 132,141 ---- The following are valid architectures: ! alpha ! hppa ! ix86 ! powerpc ! sparc ! ultrasparc From bwarsaw@users.sourceforge.net Wed Mar 21 17:44:53 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 21 Mar 2001 09:44:53 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0219.txt,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv11928 Modified Files: pep-0219.txt Log Message: Moshe caught a typo Index: pep-0219.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0219.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** pep-0219.txt 2001/03/21 17:34:33 1.4 --- pep-0219.txt 2001/03/21 17:44:50 1.5 *************** *** 178,182 **** References ! [1] www.stackless.com [2] http://world.std.com/~wware/uthread.html [3] Demo/threads/Generator.py in the source distribution --- 178,182 ---- References ! [1] http://www.stackless.com [2] http://world.std.com/~wware/uthread.html [3] Demo/threads/Generator.py in the source distribution From bwarsaw@users.sourceforge.net Wed Mar 21 17:50:47 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 21 Mar 2001 09:50:47 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0000.txt,1.77,1.78 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv12866 Modified Files: pep-0000.txt Log Message: PEP 224 is Rejected by BDFL decree. Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -r1.77 -r1.78 *** pep-0000.txt 2001/03/21 17:31:54 1.77 --- pep-0000.txt 2001/03/21 17:50:45 1.78 *************** *** 65,69 **** SD 219 pep-0219.txt Stackless Python McMillan S 222 pep-0222.txt Web Library Enhancements Kuchling - SD 224 pep-0224.txt Attribute Docstrings Lemburg SD 225 pep-0225.txt Elementwise/Objectwise Operators Zhu, Lielens S 228 pep-0228.txt Reworking Python's Numeric Model Zadka --- 65,68 ---- *************** *** 93,96 **** --- 92,96 ---- SR 204 pep-0204.txt Range Literals Wouters + SR 224 pep-0224.txt Attribute Docstrings Lemburg SR 231 pep-0231.txt __findattr__() Warsaw *************** *** 155,158 **** --- 155,159 ---- S 242 pep-0242.txt Numeric Kinds Dubois S 243 pep-0243.txt Module Repository Upload Mechanism Reifschneider + S 244 pep-0244.txt The `directive' Statement von Loewis From bwarsaw@users.sourceforge.net Wed Mar 21 17:51:56 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 21 Mar 2001 09:51:56 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0000.txt,1.78,1.79 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv13116 Modified Files: pep-0000.txt Log Message: Adding PEP 244, The `directive' Statement, von Loewis. Place this in the Future PEP category. Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -r1.78 -r1.79 *** pep-0000.txt 2001/03/21 17:50:45 1.78 --- pep-0000.txt 2001/03/21 17:51:54 1.79 *************** *** 52,55 **** --- 52,56 ---- S 241 pep-0241.txt Metadata for Python Software Packages Kuchling S 242 pep-0242.txt Numeric Kinds Dubois + S 244 pep-0244.txt The `directive' Statement von Loewis Py-in-the-sky PEPs (not ready; may become active yet) From bwarsaw@users.sourceforge.net Wed Mar 21 17:52:22 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 21 Mar 2001 09:52:22 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0224.txt,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv13176 Modified Files: pep-0224.txt Log Message: PEP 224 is Rejected by BDFL decree. Index: pep-0224.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0224.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** pep-0224.txt 2000/08/30 09:08:16 1.3 --- pep-0224.txt 2001/03/21 17:52:20 1.4 *************** *** 3,7 **** Version: $Revision$ Author: mal@lemburg.com (Marc-Andre Lemburg) ! Status: Draft Type: Standards Track Python-Version: 2.1 --- 3,7 ---- Version: $Revision$ Author: mal@lemburg.com (Marc-Andre Lemburg) ! Status: Rejected Type: Standards Track Python-Version: 2.1 From fdrake@users.sourceforge.net Wed Mar 21 18:05:50 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 21 Mar 2001 10:05:50 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib fnmatch.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv15932 Modified Files: fnmatch.py Log Message: Donovan Baarda : Patch to make "\" in a character group work properly. This closes SF bug #409651. Index: fnmatch.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/fnmatch.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** fnmatch.py 2001/01/20 23:34:12 1.10 --- fnmatch.py 2001/03/21 18:05:48 1.11 *************** *** 76,90 **** res = res + '\\[' else: ! stuff = pat[i:j] i = j+1 if stuff[0] == '!': ! stuff = '[^' + stuff[1:] + ']' ! elif stuff == '^'*len(stuff): ! stuff = '\\^' ! else: ! while stuff[0] == '^': ! stuff = stuff[1:] + stuff[0] ! stuff = '[' + stuff + ']' ! res = res + stuff else: res = res + re.escape(c) --- 76,86 ---- res = res + '\\[' else: ! stuff = pat[i:j].replace('\\','\\\\') i = j+1 if stuff[0] == '!': ! stuff = '^' + stuff[1:] ! elif stuff[0] == '^': ! stuff = '\\' + stuff ! res = '%s[%s]' % (res, stuff) else: res = res + re.escape(c) From fdrake@users.sourceforge.net Wed Mar 21 18:09:48 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 21 Mar 2001 10:09:48 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib unittest.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv16658 Added Files: unittest.py Log Message: The unittest module from PyUNIT, by Steve Purcell. --- NEW FILE: unittest.py --- #!/usr/bin/env python """ Python unit testing framework, based on Erich Gamma's JUnit and Kent Beck's Smalltalk testing framework. Further information is available in the bundled documentation, and from http://pyunit.sourceforge.net/ This module contains the core framework classes that form the basis of specific test cases and suites (TestCase, TestSuite etc.), and also a text-based utility class for running the tests and reporting the results (TextTestRunner). Copyright (c) 1999, 2000, 2001 Steve Purcell This module is free software, and you may redistribute it and/or modify it under the same terms as Python itself, so long as this copyright message and disclaimer are retained in their original form. IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. """ __author__ = "Steve Purcell (stephen_purcell@yahoo.com)" __version__ = "$Revision: 1.1 $"[11:-2] import time import sys import traceback import string import os ############################################################################## # A platform-specific concession to help the code work for JPython users ############################################################################## plat = string.lower(sys.platform) _isJPython = string.find(plat, 'java') >= 0 or string.find(plat, 'jdk') >= 0 del plat ############################################################################## # Test framework core ############################################################################## class TestResult: """Holder for test result information. Test results are automatically managed by the TestCase and TestSuite classes, and do not need to be explicitly manipulated by writers of tests. Each instance holds the total number of tests run, and collections of failures and errors that occurred among those test runs. The collections contain tuples of (testcase, exceptioninfo), where exceptioninfo is a tuple of values as returned by sys.exc_info(). """ def __init__(self): self.failures = [] self.errors = [] self.testsRun = 0 self.shouldStop = 0 def startTest(self, test): "Called when the given test is about to be run" self.testsRun = self.testsRun + 1 def stopTest(self, test): "Called when the given test has been run" pass def addError(self, test, err): "Called when an error has occurred" self.errors.append((test, err)) def addFailure(self, test, err): "Called when a failure has occurred" self.failures.append((test, err)) def wasSuccessful(self): "Tells whether or not this result was a success" return len(self.failures) == len(self.errors) == 0 def stop(self): "Indicates that the tests should be aborted" self.shouldStop = 1 def __repr__(self): return "<%s run=%i errors=%i failures=%i>" % \ (self.__class__, self.testsRun, len(self.errors), len(self.failures)) class TestCase: """A class whose instances are single test cases. Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test's environment ('fixture') can be implemented by overriding the 'setUp' and 'tearDown' methods respectively. By default, the test code itself should be placed in a method named 'runTest'. If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute. """ def __init__(self, methodName='runTest'): """Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name. """ try: self.__testMethod = getattr(self,methodName) except AttributeError: raise ValueError, "no such test method in %s: %s" % \ (self.__class__, methodName) def setUp(self): "Hook method for setting up the test fixture before exercising it." pass def tearDown(self): "Hook method for deconstructing the test fixture after testing it." pass def countTestCases(self): return 1 def defaultTestResult(self): return TestResult() def shortDescription(self): """Returns a one-line description of the test, or None if no description has been provided. The default implementation of this method returns the first line of the specified test method's docstring. """ doc = self.__testMethod.__doc__ return doc and string.strip(string.split(doc, "\n")[0]) or None def id(self): return "%s.%s" % (self.__class__, self.__testMethod.__name__) def __str__(self): return "%s (%s)" % (self.__testMethod.__name__, self.__class__) def __repr__(self): return "<%s testMethod=%s>" % \ (self.__class__, self.__testMethod.__name__) def run(self, result=None): return self(result) def __call__(self, result=None): if result is None: result = self.defaultTestResult() result.startTest(self) try: try: self.setUp() except: result.addError(self,self.__exc_info()) return try: self.__testMethod() except AssertionError, e: result.addFailure(self,self.__exc_info()) except: result.addError(self,self.__exc_info()) try: self.tearDown() except: result.addError(self,self.__exc_info()) finally: result.stopTest(self) def debug(self): self.setUp() self.__testMethod() self.tearDown() def assert_(self, expr, msg=None): """Equivalent of built-in 'assert', but is not optimised out when __debug__ is false. """ if not expr: raise AssertionError, msg failUnless = assert_ def failIf(self, expr, msg=None): "Fail the test if the expression is true." apply(self.assert_,(not expr,msg)) def assertRaises(self, excClass, callableObj, *args, **kwargs): """Assert that an exception of class excClass is thrown by callableObj when invoked with arguments args and keyword arguments kwargs. If a different type of exception is thrown, it will not be caught, and the test case will be deemed to have suffered an error, exactly as for an unexpected exception. """ try: apply(callableObj, args, kwargs) except excClass: return else: if hasattr(excClass,'__name__'): excName = excClass.__name__ else: excName = str(excClass) raise AssertionError, excName def fail(self, msg=None): """Fail immediately, with the given message.""" raise AssertionError, msg def __exc_info(self): """Return a version of sys.exc_info() with the traceback frame minimised; usually the top level of the traceback frame is not needed. """ exctype, excvalue, tb = sys.exc_info() newtb = tb.tb_next if newtb is None: return (exctype, excvalue, tb) return (exctype, excvalue, newtb) class TestSuite: """A test suite is a composite test consisting of a number of TestCases. For use, create an instance of TestSuite, then add test case instances. When all tests have been added, the suite can be passed to a test runner, such as TextTestRunner. It will run the individual test cases in the order in which they were added, aggregating the results. When subclassing, do not forget to call the base class constructor. """ def __init__(self, tests=()): self._tests = [] self.addTests(tests) def __repr__(self): return "<%s tests=%s>" % (self.__class__, self._tests) __str__ = __repr__ def countTestCases(self): cases = 0 for test in self._tests: cases = cases + test.countTestCases() return cases def addTest(self, test): self._tests.append(test) def addTests(self, tests): for test in tests: self.addTest(test) def run(self, result): return self(result) def __call__(self, result): for test in self._tests: if result.shouldStop: break test(result) return result def debug(self): for test in self._tests: test.debug() class FunctionTestCase(TestCase): """A test case that wraps a test function. This is useful for slipping pre-existing test functions into the PyUnit framework. Optionally, set-up and tidy-up functions can be supplied. As with TestCase, the tidy-up ('tearDown') function will always be called if the set-up ('setUp') function ran successfully. """ def __init__(self, testFunc, setUp=None, tearDown=None, description=None): TestCase.__init__(self) self.__setUpFunc = setUp self.__tearDownFunc = tearDown self.__testFunc = testFunc self.__description = description def setUp(self): if self.__setUpFunc is not None: self.__setUpFunc() def tearDown(self): if self.__tearDownFunc is not None: self.__tearDownFunc() def runTest(self): self.__testFunc() def id(self): return self.__testFunc.__name__ def __str__(self): return "%s (%s)" % (self.__class__, self.__testFunc.__name__) def __repr__(self): return "<%s testFunc=%s>" % (self.__class__, self.__testFunc) def shortDescription(self): if self.__description is not None: return self.__description doc = self.__testFunc.__doc__ return doc and string.strip(string.split(doc, "\n")[0]) or None ############################################################################## # Convenience functions ############################################################################## def getTestCaseNames(testCaseClass, prefix, sortUsing=cmp): """Extracts all the names of functions in the given test case class and its base classes that start with the given prefix. This is used by makeSuite(). """ testFnNames = filter(lambda n,p=prefix: n[:len(p)] == p, dir(testCaseClass)) for baseclass in testCaseClass.__bases__: testFnNames = testFnNames + \ getTestCaseNames(baseclass, prefix, sortUsing=None) if sortUsing: testFnNames.sort(sortUsing) return testFnNames def makeSuite(testCaseClass, prefix='test', sortUsing=cmp): """Returns a TestSuite instance built from all of the test functions in the given test case class whose names begin with the given prefix. The cases are sorted by their function names using the supplied comparison function, which defaults to 'cmp'. """ cases = map(testCaseClass, getTestCaseNames(testCaseClass, prefix, sortUsing)) return TestSuite(cases) def createTestInstance(name, module=None): """Finds tests by their name, optionally only within the given module. Return the newly-constructed test, ready to run. If the name contains a ':' then the portion of the name after the colon is used to find a specific test case within the test case class named before the colon. Examples: findTest('examples.listtests.suite') -- returns result of calling 'suite' findTest('examples.listtests.ListTestCase:checkAppend') -- returns result of calling ListTestCase('checkAppend') findTest('examples.listtests.ListTestCase:check-') -- returns result of calling makeSuite(ListTestCase, prefix="check") """ spec = string.split(name, ':') if len(spec) > 2: raise ValueError, "illegal test name: %s" % name if len(spec) == 1: testName = spec[0] caseName = None else: testName, caseName = spec parts = string.split(testName, '.') if module is None: if len(parts) < 2: raise ValueError, "incomplete test name: %s" % name constructor = __import__(string.join(parts[:-1],'.')) parts = parts[1:] else: constructor = module for part in parts: constructor = getattr(constructor, part) if not callable(constructor): raise ValueError, "%s is not a callable object" % constructor if caseName: if caseName[-1] == '-': prefix = caseName[:-1] if not prefix: raise ValueError, "prefix too short: %s" % name test = makeSuite(constructor, prefix=prefix) else: test = constructor(caseName) else: test = constructor() if not hasattr(test,"countTestCases"): raise TypeError, \ "object %s found with spec %s is not a test" % (test, name) return test ############################################################################## # Text UI ############################################################################## class _WritelnDecorator: """Used to decorate file-like objects with a handy 'writeln' method""" def __init__(self,stream): self.stream = stream if _isJPython: import java.lang.System self.linesep = java.lang.System.getProperty("line.separator") else: self.linesep = os.linesep def __getattr__(self, attr): return getattr(self.stream,attr) def writeln(self, *args): if args: apply(self.write, args) self.write(self.linesep) class _JUnitTextTestResult(TestResult): """A test result class that can print formatted text results to a stream. Used by JUnitTextTestRunner. """ def __init__(self, stream): self.stream = stream TestResult.__init__(self) def addError(self, test, error): TestResult.addError(self,test,error) self.stream.write('E') self.stream.flush() if error[0] is KeyboardInterrupt: self.shouldStop = 1 def addFailure(self, test, error): TestResult.addFailure(self,test,error) self.stream.write('F') self.stream.flush() def startTest(self, test): TestResult.startTest(self,test) self.stream.write('.') self.stream.flush() def printNumberedErrors(self,errFlavour,errors): if not errors: return if len(errors) == 1: self.stream.writeln("There was 1 %s:" % errFlavour) else: self.stream.writeln("There were %i %ss:" % (len(errors), errFlavour)) i = 1 for test,error in errors: errString = string.join(apply(traceback.format_exception,error),"") self.stream.writeln("%i) %s" % (i, test)) self.stream.writeln(errString) i = i + 1 def printErrors(self): self.printNumberedErrors("error",self.errors) def printFailures(self): self.printNumberedErrors("failure",self.failures) def printHeader(self): self.stream.writeln() if self.wasSuccessful(): self.stream.writeln("OK (%i tests)" % self.testsRun) else: self.stream.writeln("!!!FAILURES!!!") self.stream.writeln("Test Results") self.stream.writeln() self.stream.writeln("Run: %i ; Failures: %i ; Errors: %i" % (self.testsRun, len(self.failures), len(self.errors))) def printResult(self): self.printHeader() self.printErrors() self.printFailures() class JUnitTextTestRunner: """A test runner class that displays results in textual form. The display format approximates that of JUnit's 'textui' test runner. This test runner may be removed in a future version of PyUnit. """ def __init__(self, stream=sys.stderr): self.stream = _WritelnDecorator(stream) def run(self, test): "Run the given test case or test suite." result = _JUnitTextTestResult(self.stream) startTime = time.time() test(result) stopTime = time.time() self.stream.writeln() self.stream.writeln("Time: %.3fs" % float(stopTime - startTime)) result.printResult() return result ############################################################################## # Verbose text UI ############################################################################## class _VerboseTextTestResult(TestResult): """A test result class that can print formatted text results to a stream. Used by VerboseTextTestRunner. """ def __init__(self, stream, descriptions): TestResult.__init__(self) self.stream = stream self.lastFailure = None self.descriptions = descriptions def startTest(self, test): TestResult.startTest(self, test) if self.descriptions: self.stream.write(test.shortDescription() or str(test)) else: self.stream.write(str(test)) self.stream.write(" ... ") def stopTest(self, test): TestResult.stopTest(self, test) if self.lastFailure is not test: self.stream.writeln("ok") def addError(self, test, err): TestResult.addError(self, test, err) self._printError("ERROR", test, err) self.lastFailure = test if err[0] is KeyboardInterrupt: self.shouldStop = 1 def addFailure(self, test, err): TestResult.addFailure(self, test, err) self._printError("FAIL", test, err) self.lastFailure = test def _printError(self, flavour, test, err): errLines = [] separator1 = "\t" + '=' * 70 separator2 = "\t" + '-' * 70 if not self.lastFailure is test: self.stream.writeln() self.stream.writeln(separator1) self.stream.writeln("\t%s" % flavour) self.stream.writeln(separator2) for line in apply(traceback.format_exception, err): for l in string.split(line,"\n")[:-1]: self.stream.writeln("\t%s" % l) self.stream.writeln(separator1) class VerboseTextTestRunner: """A test runner class that displays results in textual form. It prints out the names of tests as they are run, errors as they occur, and a summary of the results at the end of the test run. """ def __init__(self, stream=sys.stderr, descriptions=1): self.stream = _WritelnDecorator(stream) self.descriptions = descriptions def run(self, test): "Run the given test case or test suite." result = _VerboseTextTestResult(self.stream, self.descriptions) startTime = time.time() test(result) stopTime = time.time() timeTaken = float(stopTime - startTime) self.stream.writeln("-" * 78) run = result.testsRun self.stream.writeln("Ran %d test%s in %.3fs" % (run, run > 1 and "s" or "", timeTaken)) self.stream.writeln() if not result.wasSuccessful(): self.stream.write("FAILED (") failed, errored = map(len, (result.failures, result.errors)) if failed: self.stream.write("failures=%d" % failed) if errored: if failed: self.stream.write(", ") self.stream.write("errors=%d" % errored) self.stream.writeln(")") else: self.stream.writeln("OK") return result # Which flavour of TextTestRunner is the default? TextTestRunner = VerboseTextTestRunner ############################################################################## # Facilities for running tests from the command line ############################################################################## class TestProgram: """A command-line program that runs a set of tests; this is primarily for making test modules conveniently executable. """ USAGE = """\ Usage: %(progName)s [-h|--help] [test[:(casename|prefix-)]] [...] Examples: %(progName)s - run default set of tests %(progName)s MyTestSuite - run suite 'MyTestSuite' %(progName)s MyTestCase:checkSomething - run MyTestCase.checkSomething %(progName)s MyTestCase:check- - run all 'check*' test methods in MyTestCase """ def __init__(self, module='__main__', defaultTest=None, argv=None, testRunner=None): if type(module) == type(''): self.module = __import__(module) for part in string.split(module,'.')[1:]: self.module = getattr(self.module, part) else: self.module = module if argv is None: argv = sys.argv self.defaultTest = defaultTest self.testRunner = testRunner self.progName = os.path.basename(argv[0]) self.parseArgs(argv) self.createTests() self.runTests() def usageExit(self, msg=None): if msg: print msg print self.USAGE % self.__dict__ sys.exit(2) def parseArgs(self, argv): import getopt try: options, args = getopt.getopt(argv[1:], 'hH', ['help']) opts = {} for opt, value in options: if opt in ('-h','-H','--help'): self.usageExit() if len(args) == 0 and self.defaultTest is None: raise getopt.error, "No default test is defined." if len(args) > 0: self.testNames = args else: self.testNames = (self.defaultTest,) except getopt.error, msg: self.usageExit(msg) def createTests(self): tests = [] for testName in self.testNames: tests.append(createTestInstance(testName, self.module)) self.test = TestSuite(tests) def runTests(self): if self.testRunner is None: self.testRunner = TextTestRunner() result = self.testRunner.run(self.test) sys.exit(not result.wasSuccessful()) main = TestProgram ############################################################################## # Executing this module from the command line ############################################################################## if __name__ == "__main__": main(module=None) From fdrake@users.sourceforge.net Wed Mar 21 18:26:36 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 21 Mar 2001 10:26:36 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_support.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv20393 Modified Files: test_support.py Log Message: Just import sys at the top instead of inside lots of functions. Add some helpers for supporting PyUNIT-based unit testing. Index: test_support.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_support.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** test_support.py 2001/03/13 09:31:07 1.17 --- test_support.py 2001/03/21 18:26:33 1.18 *************** *** 1,5 **** --- 1,7 ---- """Supporting definitions for the Python regression test.""" + import sys + class Error(Exception): """Base class for regression test exceptions.""" *************** *** 22,26 **** def unload(name): - import sys try: del sys.modules[name] --- 24,27 ---- *************** *** 30,34 **** def forget(modname): unload(modname) ! import sys, os for dirname in sys.path: try: --- 31,35 ---- def forget(modname): unload(modname) ! import os for dirname in sys.path: try: *************** *** 69,73 **** if os.path.isabs(file): return file - import sys path = sys.path path = [os.path.dirname(here)] + path --- 70,73 ---- *************** *** 94,95 **** --- 94,127 ---- else: print 'Missing SyntaxError: "%s"' % statement + + + + #======================================================================= + # Preliminary PyUNIT integration. + + import unittest + + + class BasicTestRunner(unittest.VerboseTextTestRunner): + def __init__(self, stream=sys.stderr): + unittest.VerboseTextTestRunner.__init__(self, stream, descriptions=0) + + def run(self, test): + result = unittest._VerboseTextTestResult(self.stream, descriptions=0) + test(result) + return result + + + def run_unittest(testclass): + """Run tests from a unittest.TestCase-derived class.""" + if verbose: + f = sys.stdout + else: + import StringIO + f = StringIO.StringIO() + + suite = unittest.makeSuite(testclass) + result = BasicTestRunner(stream=f).run(suite) + if result.errors or result.failures: + raise TestFailed("errors occurred in %s.%s" + % (testclass.__module__, testclass.__name__)) From fdrake@users.sourceforge.net Wed Mar 21 18:29:27 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 21 Mar 2001 10:29:27 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_fnmatch,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv21089/output Added Files: test_fnmatch Log Message: Add test cases for the fnmatch module. --- NEW FILE: test_fnmatch --- test_fnmatch From fdrake@users.sourceforge.net Wed Mar 21 18:29:27 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 21 Mar 2001 10:29:27 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_fnmatch.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv21089 Added Files: test_fnmatch.py Log Message: Add test cases for the fnmatch module. --- NEW FILE: test_fnmatch.py --- """Test cases for the fnmatch module.""" import re import test_support import unittest from fnmatch import fnmatch, fnmatchcase class FnmatchTestCase(unittest.TestCase): def check_match(self, filename, pattern, should_match=1): if should_match: self.assert_(fnmatch(filename, pattern), "expected %r to match pattern %r" % (filename, pattern)) else: self.assert_(not fnmatch(filename, pattern), "expected %r not to match pattern %r" % (filename, pattern)) def test_fnmatch(self): check = self.check_match check('abc', 'abc') check('abc', '?*?') check('abc', '???*') check('abc', '*???') check('abc', '???') check('abc', '*') check('abc', 'ab[cd]') check('abc', 'ab[!de]') check('abc', 'ab[de]', 0) check('a', '??', 0) check('a', 'b', 0) # these test that '\' is handled correctly in character sets; # see SF bug #??? check('\\', r'[\]') check('a', r'[!\]') check('\\', r'[!\]', 0) test_support.run_unittest(FnmatchTestCase) From moshez@users.sourceforge.net Wed Mar 21 18:40:31 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Wed, 21 Mar 2001 10:40:31 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0240.txt,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv23529 Modified Files: pep-0240.txt Log Message: Beef up the rationale a bit, as per Konrad Hinsen's request. Index: pep-0240.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0240.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** pep-0240.txt 2001/03/21 11:25:51 1.3 --- pep-0240.txt 2001/03/21 18:40:28 1.4 *************** *** 20,27 **** Rationale ! Rational numbers are useful, and are much harder to use without ! literals. Making the "obvious" non-integer type one with more predictable semantics will surprise new programmers less then ! using floating point numbers. --- 20,31 ---- Rationale ! Rational numbers are useful for exact and unsurprising arithmetic. ! They give the correct results people have been taught in various ! math classes. Making the "obvious" non-integer type one with more predictable semantics will surprise new programmers less then ! using floating point numbers. As quite a few posts on c.l.py and ! on tutor@python.org have shown, people often get bit by strange ! semantics of floating point numbers: for example, round(0.98, 2) ! still gives 0.97999999999999998. From gvanrossum@users.sourceforge.net Wed Mar 21 18:41:00 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 21 Mar 2001 10:41:00 -0800 Subject: [Python-checkins] CVS: python/dist/src/Include abstract.h,2.28,2.29 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv22880/Include Modified Files: abstract.h Log Message: Move the code implementing isinstance() and issubclass() to new C APIs, PyObject_IsInstance() and PyObject_IsSubclass() -- both returning an int, or -1 for errors. Index: abstract.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/abstract.h,v retrieving revision 2.28 retrieving revision 2.29 diff -C2 -r2.28 -r2.29 *** abstract.h 2001/01/17 17:09:53 2.28 --- abstract.h 2001/03/21 18:40:58 2.29 *************** *** 1075,1078 **** --- 1075,1085 ---- + DL_IMPORT(int) PyObject_IsInstance(PyObject *object, PyObject *typeorclass); + /* isinstance(object, typeorclass) */ + + DL_IMPORT(int) PyObject_IsSubclass(PyObject *object, PyObject *typeorclass); + /* issubclass(object, typeorclass) */ + + #ifdef __cplusplus } From gvanrossum@users.sourceforge.net Wed Mar 21 18:41:00 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 21 Mar 2001 10:41:00 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects abstract.c,2.57,2.58 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv22880/Objects Modified Files: abstract.c Log Message: Move the code implementing isinstance() and issubclass() to new C APIs, PyObject_IsInstance() and PyObject_IsSubclass() -- both returning an int, or -1 for errors. Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.57 retrieving revision 2.58 diff -C2 -r2.57 -r2.58 *** abstract.c 2001/01/17 15:29:42 2.57 --- abstract.c 2001/03/21 18:40:58 2.58 *************** *** 1627,1628 **** --- 1627,1740 ---- return retval; } + + + /* isinstance(), issubclass() */ + + static int + abstract_issubclass(PyObject *derived, PyObject *cls, int first) + { + static PyObject *__bases__ = NULL; + PyObject *bases; + int i, n; + int r = 0; + + if (__bases__ == NULL) { + __bases__ = PyString_FromString("__bases__"); + if (__bases__ == NULL) + return -1; + } + + if (first) { + bases = PyObject_GetAttr(cls, __bases__); + if (bases == NULL || !PyTuple_Check(bases)) { + Py_XDECREF(bases); + PyErr_SetString(PyExc_TypeError, + "issubclass() arg 2 must be a class"); + return -1; + } + Py_DECREF(bases); + } + + if (derived == cls) + return 1; + + bases = PyObject_GetAttr(derived, __bases__); + if (bases == NULL || !PyTuple_Check(bases)) { + Py_XDECREF(bases); + PyErr_SetString(PyExc_TypeError, + "issubclass() arg 1 must be a class"); + return -1; + } + + n = PyTuple_GET_SIZE(bases); + for (i = 0; i < n; i++) { + r = abstract_issubclass(PyTuple_GET_ITEM(bases, i), cls, 0); + if (r != 0) + break; + } + + Py_DECREF(bases); + + return r; + } + + int + PyObject_IsInstance(PyObject *inst, PyObject *cls) + { + PyObject *icls; + static PyObject *__class__ = NULL; + int retval = 0; + + if (PyClass_Check(cls)) { + if (PyInstance_Check(inst)) { + PyObject *inclass = + (PyObject*)((PyInstanceObject*)inst)->in_class; + retval = PyClass_IsSubclass(inclass, cls); + } + } + else if (PyType_Check(cls)) { + retval = ((PyObject *)(inst->ob_type) == cls); + } + else if (!PyInstance_Check(inst)) { + if (__class__ == NULL) { + __class__ = PyString_FromString("__class__"); + if (__class__ == NULL) + return -1; + } + icls = PyObject_GetAttr(inst, __class__); + if (icls != NULL) { + retval = abstract_issubclass(icls, cls, 1); + Py_DECREF(icls); + if (retval < 0 && + !PyErr_ExceptionMatches(PyExc_TypeError)) + return -1; + } + else + retval = -1; + } + else + retval = -1; + + if (retval < 0) { + PyErr_SetString(PyExc_TypeError, + "isinstance() arg 2 must be a class or type"); + } + return retval; + } + + int + PyObject_IsSubclass(PyObject *derived, PyObject *cls) + { + int retval; + + if (!PyClass_Check(derived) || !PyClass_Check(cls)) { + retval = abstract_issubclass(derived, cls, 1); + } + else { + /* shortcut */ + if (!(retval = (derived == cls))) + retval = PyClass_IsSubclass(derived, cls); + } + + return retval; + } From gvanrossum@users.sourceforge.net Wed Mar 21 18:41:00 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 21 Mar 2001 10:41:00 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.194,2.195 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv22880/Python Modified Files: bltinmodule.c Log Message: Move the code implementing isinstance() and issubclass() to new C APIs, PyObject_IsInstance() and PyObject_IsSubclass() -- both returning an int, or -1 for errors. Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.194 retrieving revision 2.195 diff -C2 -r2.194 -r2.195 *** bltinmodule.c 2001/01/19 21:36:19 2.194 --- bltinmodule.c 2001/03/21 18:40:58 2.195 *************** *** 2006,2057 **** With an argument, equivalent to object.__dict__."; - static int - abstract_issubclass(PyObject *derived, PyObject *cls, int first) - { - static PyObject *__bases__ = NULL; - PyObject *bases; - int i, n; - int r = 0; - - if (__bases__ == NULL) { - __bases__ = PyString_FromString("__bases__"); - if (__bases__ == NULL) - return -1; - } - - if (first) { - bases = PyObject_GetAttr(cls, __bases__); - if (bases == NULL || !PyTuple_Check(bases)) { - Py_XDECREF(bases); - PyErr_SetString(PyExc_TypeError, - "issubclass() arg 2 must be a class"); - return -1; - } - Py_DECREF(bases); - } - - if (derived == cls) - return 1; - - bases = PyObject_GetAttr(derived, __bases__); - if (bases == NULL || !PyTuple_Check(bases)) { - Py_XDECREF(bases); - PyErr_SetString(PyExc_TypeError, - "issubclass() arg 1 must be a class"); - return -1; - } - - n = PyTuple_GET_SIZE(bases); - for (i = 0; i < n; i++) { - r = abstract_issubclass(PyTuple_GET_ITEM(bases, i), cls, 0); - if (r != 0) - break; - } - - Py_DECREF(bases); - - return r; - } - static PyObject * builtin_isinstance(PyObject *self, PyObject *args) --- 2006,2009 ---- *************** *** 2059,2104 **** PyObject *inst; PyObject *cls; ! PyObject *icls; ! static PyObject *__class__ = NULL; ! int retval = 0; if (!PyArg_ParseTuple(args, "OO:isinstance", &inst, &cls)) return NULL; ! if (PyClass_Check(cls)) { ! if (PyInstance_Check(inst)) { ! PyObject *inclass = ! (PyObject*)((PyInstanceObject*)inst)->in_class; ! retval = PyClass_IsSubclass(inclass, cls); ! } ! } ! else if (PyType_Check(cls)) { ! retval = ((PyObject *)(inst->ob_type) == cls); ! } ! else if (!PyInstance_Check(inst)) { ! if (__class__ == NULL) { ! __class__ = PyString_FromString("__class__"); ! if (__class__ == NULL) ! return NULL; ! } ! icls = PyObject_GetAttr(inst, __class__); ! if (icls != NULL) { ! retval = abstract_issubclass(icls, cls, 1); ! Py_DECREF(icls); ! if (retval < 0 && ! !PyErr_ExceptionMatches(PyExc_TypeError)) ! return NULL; ! } ! else ! retval = -1; ! } ! else ! retval = -1; ! ! if (retval < 0) { ! PyErr_SetString(PyExc_TypeError, ! "isinstance() arg 2 must be a class or type"); return NULL; - } return PyInt_FromLong(retval); } --- 2011,2022 ---- PyObject *inst; PyObject *cls; ! int retval; if (!PyArg_ParseTuple(args, "OO:isinstance", &inst, &cls)) return NULL; ! retval = PyObject_IsInstance(inst, cls); ! if (retval < 0) return NULL; return PyInt_FromLong(retval); } *************** *** 2121,2135 **** return NULL; ! if (!PyClass_Check(derived) || !PyClass_Check(cls)) { ! retval = abstract_issubclass(derived, cls, 1); ! if (retval < 0) ! return NULL; ! } ! else { ! /* shortcut */ ! if (!(retval = (derived == cls))) ! retval = PyClass_IsSubclass(derived, cls); ! } ! return PyInt_FromLong(retval); } --- 2039,2045 ---- return NULL; ! retval = PyObject_IsSubclass(derived, cls); ! if (retval < 0) ! return NULL; return PyInt_FromLong(retval); } From bwarsaw@users.sourceforge.net Wed Mar 21 18:53:47 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 21 Mar 2001 10:53:47 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0245.txt,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv26077 Added Files: pep-0245.txt Log Message: PEP 245, Python Interfaces, Michel Pelletier (moderately superficial editorial & spell checking pass by Barry). --- NEW FILE: pep-0245.txt --- PEP: 245 Title: Python Interfaces Version: $Revision: 1.1 $ Author: michel@digicool.com (Michel Pelletier) Discussions-To: http://www.zope.org/Wikis/Interfaces Status: Draft Type: Standards Track Created: 11-Jan-2001 Python-Version: 2.2 Post-History: Introduction This PEP describes a Python interface model and a proposed syntax for creating interface objects in Python. Background [...1019 lines suppressed...] http://python.sourceforge.net/peps/pep-0236.html [7] PEP 230, Warning Framework, van Rossum http://python.sourceforge.net/peps/pep-0236.html [8] http://www.zope.org/Wikis/Interfaces [9] http://www.zope.org/Wikis/Interfaces/InterfacesUseCases Copyright This document has been placed in the public domain. Local Variables: mode: indented-text indent-tabs-mode: nil End: From bwarsaw@users.sourceforge.net Wed Mar 21 18:59:05 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 21 Mar 2001 10:59:05 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep2html.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv26896 Modified Files: pep2html.py Log Message: fixfile(): Discussions-To: can contain an address or a url. Adjust the text accordingly. Index: pep2html.py =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep2html.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -r1.22 -r1.23 *** pep2html.py 2001/03/21 17:26:05 1.22 --- pep2html.py 2001/03/21 18:59:03 1.23 *************** *** 131,134 **** --- 131,137 ---- '%s' % (addr, pep, addr)) + elif addr.startswith('http:'): + mailtos.append( + '%s' % (addr, addr)) else: mailtos.append(addr) From bwarsaw@users.sourceforge.net Wed Mar 21 18:59:56 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 21 Mar 2001 10:59:56 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0000.txt,1.79,1.80 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv27005 Modified Files: pep-0000.txt Log Message: PEP 245, Python Interfaces, Michel Pelletier Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -r1.79 -r1.80 *** pep-0000.txt 2001/03/21 17:51:54 1.79 --- pep-0000.txt 2001/03/21 18:59:54 1.80 *************** *** 53,56 **** --- 53,57 ---- S 242 pep-0242.txt Numeric Kinds Dubois S 244 pep-0244.txt The `directive' Statement von Loewis + S 245 pep-0245.txt Python Interfaces Pelletier Py-in-the-sky PEPs (not ready; may become active yet) *************** *** 157,160 **** --- 158,162 ---- S 243 pep-0243.txt Module Repository Upload Mechanism Reifschneider S 244 pep-0244.txt The `directive' Statement von Loewis + S 245 pep-0245.txt Python Interfaces Pelletier *************** *** 185,188 **** --- 187,191 ---- McMillan, Gordon gmcm@hypernet.com Oliphant, Travis oliphant@ee.byu.edu + Pelletier, Michel michel@digicool.com Peters, Tim tim@digicool.com Prescod, Paul paul@prescod.net From jhylton@users.sourceforge.net Wed Mar 21 19:01:36 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Wed, 21 Mar 2001 11:01:36 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python compile.c,2.189,2.190 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv27285/Python Modified Files: compile.c Log Message: Update PyNode_CompileSymtable() to understand future statements Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.189 retrieving revision 2.190 diff -C2 -r2.189 -r2.190 *** compile.c 2001/03/21 16:43:47 2.189 --- compile.c 2001/03/21 19:01:33 2.190 *************** *** 3781,3800 **** { struct symtable *st; st = symtable_init(); if (st == NULL) return NULL; ! assert(st->st_symbols != NULL); symtable_enter_scope(st, TOP, TYPE(n), n->n_lineno); ! if (st->st_errors > 0) { ! PySymtable_Free(st); ! return NULL; ! } symtable_node(st, n); ! if (st->st_errors > 0) { ! PySymtable_Free(st); ! return NULL; ! } return st; } --- 3781,3806 ---- { struct symtable *st; + PyFutureFeatures *ff; + ff = PyNode_Future(n, filename); + if (ff == NULL) + return NULL; st = symtable_init(); if (st == NULL) return NULL; ! st->st_future = ff; symtable_enter_scope(st, TOP, TYPE(n), n->n_lineno); ! if (st->st_errors > 0) ! goto fail; symtable_node(st, n); ! if (st->st_errors > 0) ! goto fail; ! return st; + fail: + PyMem_Free((void *)ff); + st->st_future = NULL; + PySymtable_Free(st); + return NULL; } From jhylton@users.sourceforge.net Wed Mar 21 19:09:34 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Wed, 21 Mar 2001 11:09:34 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib traceback.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv28379/Lib Modified Files: traceback.py Log Message: Reformat and edit docstrings to follow modern conventions. Single line summary followed by blank line and description. Index: traceback.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/traceback.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -r1.22 -r1.23 *** traceback.py 2001/03/01 04:27:19 1.22 --- traceback.py 2001/03/21 19:09:31 1.23 *************** *** 26,35 **** def format_list(extracted_list): ! """Given a list of tuples as returned by extract_tb() or extract_stack(), return a list of strings ready for printing. ! Each string in the resulting list corresponds to the item with ! the same index in the argument list. Each string ends in a ! newline; the strings may contain internal newlines as well, for ! those items whose source text line is not None.""" list = [] for filename, lineno, name, line in extracted_list: --- 26,38 ---- def format_list(extracted_list): ! """Format a list of traceback entry tuples for printing. ! ! Given a list of tuples as returned by extract_tb() or extract_stack(), return a list of strings ready for printing. ! Each string in the resulting list corresponds to the item with the ! same index in the argument list. Each string ends in a newline; ! the strings may contain internal newlines as well, for those items ! whose source text line is not None. ! """ list = [] for filename, lineno, name, line in extracted_list: *************** *** 43,49 **** def print_tb(tb, limit=None, file=None): """Print up to 'limit' stack trace entries from the traceback 'tb'. ! If 'limit' is omitted or None, all entries are printed. If 'file' is ! omitted or None, the output goes to sys.stderr; otherwise 'file' ! should be an open file or file-like object with a write() method.""" if not file: file = sys.stderr --- 46,55 ---- def print_tb(tb, limit=None, file=None): """Print up to 'limit' stack trace entries from the traceback 'tb'. ! ! If 'limit' is omitted or None, all entries are printed. If 'file' ! is omitted or None, the output goes to sys.stderr; otherwise ! 'file' should be an open file or file-like object with a write() ! method. ! """ if not file: file = sys.stderr *************** *** 70,81 **** def extract_tb(tb, limit = None): ! """Return a list of up to 'limit' pre-processed stack trace entries ! extracted from the traceback object 'traceback'. This is useful for ! alternate formatting of stack traces. If 'limit' is omitted or None, ! all entries are extracted. A pre-processed stack trace entry is a ! quadruple (filename, line number, function name, text) representing ! the information that is usually printed for a stack trace. The text ! is a string with leading and trailing whitespace stripped; if the ! source is not available it is None.""" if limit is None: if hasattr(sys, 'tracebacklimit'): --- 76,89 ---- def extract_tb(tb, limit = None): ! """Return list of up to limit pre-processed entries from traceback. ! ! This is useful for alternate formatting of stack traces. If ! 'limit' is omitted or None, all entries are extracted. A ! pre-processed stack trace entry is a quadruple (filename, line ! number, function name, text) representing the information that is ! usually printed for a stack trace. The text is a string with ! leading and trailing whitespace stripped; if the source is not ! available it is None. ! """ if limit is None: if hasattr(sys, 'tracebacklimit'): *************** *** 99,110 **** def print_exception(etype, value, tb, limit=None, file=None): ! """Print exception information and up to 'limit' stack trace entries ! from the traceback 'tb' to 'file'. This differs from print_tb() in ! the following ways: (1) if traceback is not None, it prints a header ! "Traceback (most recent call last):"; (2) it prints the exception type and ! value after the stack trace; (3) if type is SyntaxError and value has ! the appropriate format, it prints the line where the syntax error occurred with a caret on the next line indicating the approximate ! position of the error.""" if not file: file = sys.stderr --- 107,120 ---- def print_exception(etype, value, tb, limit=None, file=None): ! """Print exception up to 'limit' stack trace entries from 'tb' to 'file'. ! ! This differs from print_tb() in the following ways: (1) if ! traceback is not None, it prints a header "Traceback (most recent ! call last):"; (2) it prints the exception type and value after the ! stack trace; (3) if type is SyntaxError and value has the ! appropriate format, it prints the line where the syntax error occurred with a caret on the next line indicating the approximate ! position of the error. ! """ if not file: file = sys.stderr *************** *** 118,127 **** def format_exception(etype, value, tb, limit = None): ! """Format a stack trace and the exception information. The arguments ! have the same meaning as the corresponding arguments to ! print_exception(). The return value is a list of strings, each ending in a newline and some containing internal newlines. When these lines are concatenated and printed, exactly the same text is ! printed as does print_exception().""" if tb: list = ['Traceback (most recent call last):\n'] --- 128,139 ---- def format_exception(etype, value, tb, limit = None): ! """Format a stack trace and the exception information. ! ! The arguments have the same meaning as the corresponding arguments ! to print_exception(). The return value is a list of strings, each ending in a newline and some containing internal newlines. When these lines are concatenated and printed, exactly the same text is ! printed as does print_exception(). ! """ if tb: list = ['Traceback (most recent call last):\n'] *************** *** 133,144 **** def format_exception_only(etype, value): ! """Format the exception part of a traceback. The arguments are the ! exception type and value such as given by sys.last_type and ! sys.last_value. The return value is a list of strings, each ending ! in a newline. Normally, the list contains a single string; ! however, for SyntaxError exceptions, it contains several lines that ! (when printed) display detailed information about where the syntax ! error occurred. The message indicating which exception occurred is ! the always last string in the list.""" list = [] if type(etype) == types.ClassType: --- 145,158 ---- def format_exception_only(etype, value): ! """Format the exception part of a traceback. ! ! The arguments are the exception type and value such as given by ! sys.last_type and sys.last_value. The return value is a list of ! strings, each ending in a newline. Normally, the list contains a ! single string; however, for SyntaxError exceptions, it contains ! several lines that (when printed) display detailed information ! about where the syntax error occurred. The message indicating ! which exception occurred is the always last string in the list. ! """ list = [] if type(etype) == types.ClassType: *************** *** 185,190 **** def print_exc(limit=None, file=None): ! """This is a shorthand for 'print_exception(sys.exc_type, ! sys.exc_value, sys.exc_traceback, limit, file)'. (In fact, it uses sys.exc_info() to retrieve the same information in a thread-safe way.)""" --- 199,203 ---- def print_exc(limit=None, file=None): ! """Shorthand for 'print_exception(sys.exc_type, sys.exc_value, sys.exc_traceback, limit, file)'. (In fact, it uses sys.exc_info() to retrieve the same information in a thread-safe way.)""" *************** *** 207,214 **** def print_stack(f=None, limit=None, file=None): ! """This function prints a stack trace from its invocation point. ! The optional 'f' argument can be used to specify an alternate stack ! frame at which to start. The optional 'limit' and 'file' arguments ! have the same meaning as for print_exception().""" if f is None: try: --- 220,229 ---- def print_stack(f=None, limit=None, file=None): ! """Print a stack trace from its invocation point. ! ! The optional 'f' argument can be used to specify an alternate ! stack frame at which to start. The optional 'limit' and 'file' ! arguments have the same meaning as for print_exception(). ! """ if f is None: try: *************** *** 219,223 **** def format_stack(f=None, limit=None): ! """A shorthand for 'format_list(extract_stack(f, limit))'.""" if f is None: try: --- 234,238 ---- def format_stack(f=None, limit=None): ! """Shorthand for 'format_list(extract_stack(f, limit))'.""" if f is None: try: *************** *** 228,237 **** def extract_stack(f=None, limit = None): ! """Extract the raw traceback from the current stack frame. The ! return value has the same format as for extract_tb(). The optional ! 'f' and 'limit' arguments have the same meaning as for print_stack(). ! Each item in the list is a quadruple (filename, line number, ! function name, text), and the entries are in order from oldest ! to newest stack frame.""" if f is None: try: --- 243,254 ---- def extract_stack(f=None, limit = None): ! """Extract the raw traceback from the current stack frame. ! ! The return value has the same format as for extract_tb(). The ! optional 'f' and 'limit' arguments have the same meaning as for ! print_stack(). Each item in the list is a quadruple (filename, ! line number, function name, text), and the entries are in order ! from oldest to newest stack frame. ! """ if f is None: try: *************** *** 259,265 **** def tb_lineno(tb): ! """Calculate the correct line number of the traceback given in tb ! (even with -O on).""" # Coded by Marc-Andre Lemburg from the example of PyCode_Addr2Line() # in compile.c. --- 276,283 ---- def tb_lineno(tb): ! """Calculate correct line number of traceback given in tb. + Even works with -O on. + """ # Coded by Marc-Andre Lemburg from the example of PyCode_Addr2Line() # in compile.c. From gvanrossum@users.sourceforge.net Wed Mar 21 19:17:24 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 21 Mar 2001 11:17:24 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python ceval.c,2.232,2.233 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv29699 Modified Files: ceval.c Log Message: Use PyObject_IsInstance() to check whether the first argument to an unbound method is of the right type. Hopefully this solves SF patch #409355 (Meta-class inheritance problem); I have no easy way to test. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.232 retrieving revision 2.233 diff -C2 -r2.232 -r2.233 *** ceval.c 2001/03/21 16:43:46 2.232 --- ceval.c 2001/03/21 19:17:22 2.233 *************** *** 1403,1407 **** why = WHY_BREAK; break; ! case CONTINUE_LOOP: retval = PyInt_FromLong(oparg); --- 1403,1407 ---- why = WHY_BREAK; break; ! case CONTINUE_LOOP: retval = PyInt_FromLong(oparg); *************** *** 2182,2186 **** /* For a continue inside a try block, don't pop the block for the loop. */ ! PyFrame_BlockSetup(f, b->b_type, b->b_level, b->b_handler); why = WHY_NOT; --- 2182,2186 ---- /* For a continue inside a try block, don't pop the block for the loop. */ ! PyFrame_BlockSetup(f, b->b_type, b->b_level, b->b_handler); why = WHY_NOT; *************** *** 2826,2845 **** /* Unbound methods must be called with an instance of the class (or a derived class) as first argument */ if (PyTuple_Size(arg) >= 1) self = PyTuple_GET_ITEM(arg, 0); ! if (!(self != NULL && PyInstance_Check(self) ! && PyClass_IsSubclass((PyObject *) ! (((PyInstanceObject *)self)->in_class), ! class))) { ! PyObject* fn = ((PyFunctionObject*) func)->func_name; ! PyErr_Format(PyExc_TypeError, ! "unbound method %s%smust be " ! "called with instance as first argument", ! fn ? PyString_AsString(fn) : "", ! fn ? "() " : ""); return NULL; } Py_INCREF(arg); ! } else { int argcount = PyTuple_Size(arg); PyObject *newarg = PyTuple_New(argcount + 1); --- 2826,2851 ---- /* Unbound methods must be called with an instance of the class (or a derived class) as first argument */ + int ok; if (PyTuple_Size(arg) >= 1) self = PyTuple_GET_ITEM(arg, 0); ! if (self == NULL) ! ok = 0; ! else { ! ok = PyObject_IsInstance(self, class); ! if (ok < 0) ! return NULL; ! } ! if (!ok) { ! PyObject* fn = ((PyFunctionObject*) func)->func_name; ! PyErr_Format(PyExc_TypeError, ! "unbound method %s%smust be " ! "called with instance as first argument", ! fn ? PyString_AsString(fn) : "", ! fn ? "() " : ""); return NULL; } Py_INCREF(arg); ! } ! else { int argcount = PyTuple_Size(arg); PyObject *newarg = PyTuple_New(argcount + 1); From tim_one@users.sourceforge.net Wed Mar 21 19:23:58 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 21 Mar 2001 11:23:58 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects dictobject.c,2.73,2.74 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv30665/python/dist/src/Objects Modified Files: dictobject.c Log Message: Make PyDict_Next safe to use for loops that merely modify the values associated with existing dict keys. This is a variant of part of Michael Hudson's patch #409864 "lazy fix for Pings bizarre scoping crash". Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.73 retrieving revision 2.74 diff -C2 -r2.73 -r2.74 *** dictobject.c 2001/01/18 00:39:02 2.73 --- dictobject.c 2001/03/21 19:23:56 2.74 *************** *** 93,97 **** values == the number of Active items). To avoid slowing down lookups on a near-full table, we resize the table when ! it is more than half filled. */ typedef struct dictobject dictobject; --- 93,97 ---- values == the number of Active items). To avoid slowing down lookups on a near-full table, we resize the table when ! it's two-thirds full. */ typedef struct dictobject dictobject; *************** *** 487,497 **** return -1; } ! /* if fill >= 2/3 size, double in size */ ! if (mp->ma_fill*3 >= mp->ma_size*2) { ! if (dictresize(mp, mp->ma_used*2) != 0) { ! if (mp->ma_fill+1 > mp->ma_size) ! return -1; ! } ! } Py_INCREF(value); Py_INCREF(key); --- 487,499 ---- return -1; } ! /* If fill >= 2/3 size, adjust size. Normally, this doubles the ! * size, but it's also possible for the dict to shrink (if ma_fill is ! * much larger than ma_used, meaning a lot of dict keys have been ! * deleted). ! * CAUTION: this resize logic must match the logic in PyDict_Next. ! */ ! if (mp->ma_fill*3 >= mp->ma_size*2 && ! dictresize(mp, mp->ma_used*2) != 0) ! return -1; Py_INCREF(value); Py_INCREF(key); *************** *** 563,566 **** --- 565,573 ---- } + /* CAUTION: In general, it isn't safe to use PyDict_Next in a loop that + * mutates the dict. One exception: it is safe if the loop merely changes + * the values associated with the keys (but doesn't insert new keys or + * delete keys), via PyDict_SetItem(). + */ int PyDict_Next(PyObject *op, int *ppos, PyObject **pkey, PyObject **pvalue) *************** *** 574,577 **** --- 581,601 ---- if (i < 0) return 0; + + /* A hack to support loops that merely change values. + * The problem: PyDict_SetItem() can either grow or shrink the dict + * even when passed a key that's already in the dict. This was a + * repeated source of subtle bugs, bad enough to justify a hack here. + * Approach: If this is the first time PyDict_Next() is being called + * (i==0), first figure out whether PyDict_SetItem() *will* change the + * size, and if so get it changed before we start passing out internal + * indices. + */ + if (i == 0) { + /* This must be a clone of PyDict_SetItem's resize logic. */ + if (mp->ma_fill*3 >= mp->ma_size*2 && + dictresize(mp, mp->ma_used*2) != 0) + return -1; + } + while (i < mp->ma_size && mp->ma_table[i].me_value == NULL) i++; From jhylton@users.sourceforge.net Wed Mar 21 20:29:21 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Wed, 21 Mar 2001 12:29:21 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib traceback.py,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv9930/Lib Modified Files: traceback.py Log Message: Do not print caret when offset is None. Index: traceback.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/traceback.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -r1.23 -r1.24 *** traceback.py 2001/03/21 19:09:31 1.23 --- traceback.py 2001/03/21 20:29:18 1.24 *************** *** 176,186 **** i = i+1 list.append(' %s\n' % line.strip()) ! s = ' ' ! for c in line[i:offset-1]: ! if c.isspace(): ! s = s + c ! else: ! s = s + ' ' ! list.append('%s^\n' % s) value = msg s = _some_str(value) --- 176,187 ---- i = i+1 list.append(' %s\n' % line.strip()) ! if offset is not None: ! s = ' ' ! for c in line[i:offset-1]: ! if c.isspace(): ! s = s + c ! else: ! s = s + ' ' ! list.append('%s^\n' % s) value = msg s = _some_str(value) From jhylton@users.sourceforge.net Wed Mar 21 20:33:06 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Wed, 21 Mar 2001 12:33:06 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_traceback.py,NONE,1.1 nocaret.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv10619/test Added Files: test_traceback.py nocaret.py Log Message: Test that traceback module works with SyntaxErrors with or without carets. --- NEW FILE: test_traceback.py --- """Test cases for traceback module""" import unittest from test_support import run_unittest import traceback class TracebackCases(unittest.TestCase): # For now, a very minimal set of tests. I want to be sure that # formatting of SyntaxErrors works based on changes for 2.1. def get_exception_format(self, func, exc): try: func() except exc, value: return traceback.format_exception_only(exc, value) else: raise ValueError, "call did not raise exception" def syntax_error_with_caret(self): compile("def fact(x):\n\treturn x!\n", "?", "exec") def syntax_error_without_caret(self): # XXX why doesn't compile raise the same traceback? import nocaret def test_caret(self): err = self.get_exception_format(self.syntax_error_with_caret, SyntaxError) self.assert_(len(err) == 4) self.assert_("^" in err[2]) # third line has caret self.assert_(err[1].strip() == "return x!") def test_nocaret(self): err = self.get_exception_format(self.syntax_error_without_caret, SyntaxError) self.assert_(len(err) == 3) self.assert_(err[1].strip() == "[x for x in x] = x") run_unittest(TracebackCases) --- NEW FILE: nocaret.py --- def f(x): [x for x in x] = x From jhylton@users.sourceforge.net Wed Mar 21 20:33:06 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Wed, 21 Mar 2001 12:33:06 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_traceback,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv10619/test/output Added Files: test_traceback Log Message: Test that traceback module works with SyntaxErrors with or without carets. --- NEW FILE: test_traceback --- test_traceback From bwarsaw@users.sourceforge.net Wed Mar 21 21:50:50 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 21 Mar 2001 13:50:50 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0245.txt,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv25256 Modified Files: pep-0245.txt Log Message: Michel posted the pep today. Index: pep-0245.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0245.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** pep-0245.txt 2001/03/21 18:53:45 1.1 --- pep-0245.txt 2001/03/21 21:50:48 1.2 *************** *** 8,12 **** Created: 11-Jan-2001 Python-Version: 2.2 ! Post-History: --- 8,12 ---- Created: 11-Jan-2001 Python-Version: 2.2 ! Post-History: 21-Mar-2001 From bwarsaw@users.sourceforge.net Wed Mar 21 21:52:10 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 21 Mar 2001 13:52:10 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0001.txt,1.16,1.17 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv25433 Modified Files: pep-0001.txt Log Message: Terry Reedy points out the inconsistency of PEP 1's status. :) Index: pep-0001.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0001.txt,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** pep-0001.txt 2001/03/21 17:20:29 1.16 --- pep-0001.txt 2001/03/21 21:52:08 1.17 *************** *** 4,8 **** Author: barry@digicool.com (Barry A. Warsaw), jeremy@digicool.com (Jeremy Hylton) ! Status: Draft Type: Informational Created: 13-Jun-2000 --- 4,8 ---- Author: barry@digicool.com (Barry A. Warsaw), jeremy@digicool.com (Jeremy Hylton) ! Status: Active Type: Informational Created: 13-Jun-2000 From fdrake@users.sourceforge.net Wed Mar 21 22:15:05 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 21 Mar 2001 14:15:05 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/api api.tex,1.109,1.110 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv28897/api Modified Files: api.tex Log Message: Integrated an expanded version of some text from Neil Schemenauer about supporting cyclic garbage collection. (This is not all of it, but I'm taking a break!) Also fixed some markup nits. Index: api.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/api.tex,v retrieving revision 1.109 retrieving revision 1.110 diff -C2 -r1.109 -r1.110 *** api.tex 2001/03/16 15:41:29 1.109 --- api.tex 2001/03/21 22:15:01 1.110 *************** *** 4870,4875 **** \strong{Note:} It is very important that your ! \ctype{PyTypeObject} structure uses \code{Py_TPFLAGS_DEFAULT} for the ! value of the \member{tp_flags} member rather than \code{0}. This tells the Python runtime that your \ctype{PyBufferProcs} structure contains the \member{bf_getcharbuffer} slot. Older versions of Python --- 4870,4875 ---- \strong{Note:} It is very important that your ! \ctype{PyTypeObject} structure uses \constant{Py_TPFLAGS_DEFAULT} for ! the value of the \member{tp_flags} member rather than \code{0}. This tells the Python runtime that your \ctype{PyBufferProcs} structure contains the \member{bf_getcharbuffer} slot. Older versions of Python *************** *** 4899,4903 **** The last slot is \member{bf_getcharbuffer}, of type \ctype{getcharbufferproc}. This slot will only be present if the ! \code{Py_TPFLAGS_HAVE_GETCHARBUFFER} flag is present in the \member{tp_flags} field of the object's \ctype{PyTypeObject}. Before using this slot, the caller should test whether it is present by using the --- 4899,4903 ---- The last slot is \member{bf_getcharbuffer}, of type \ctype{getcharbufferproc}. This slot will only be present if the ! \constant{Py_TPFLAGS_HAVE_GETCHARBUFFER} flag is present in the \member{tp_flags} field of the object's \ctype{PyTypeObject}. Before using this slot, the caller should test whether it is present by using the *************** *** 4961,4964 **** --- 4961,5046 ---- \begin{ctypedesc}[getcharbufferproc]{int (*getcharbufferproc) (PyObject *self, int segment, const char **ptrptr)} + \end{ctypedesc} + + + \section{Supporting Cyclic Garbarge Collection + \label{supporting-cycle-detection}} + + Python's support for detecting and collecting garbage which involves + circular references requires support from object types which are + ``containers'' for other objects which may also be containers. Types + which do not store references to other objects, or which only store + references to atomic types (such as numbers or strings), do not need + to provide any explicit support for garbage collection. + + To create a container type, the \member{tp_flags} field of the type + object must include the \constant{Py_TPFLAGS_GC} and provide an + implementation of the \member{tp_traverse} handler. The value of the + \member{tp_basicsize} field must include \constant{PyGC_HEAD_SIZE} as + well. If instances of the type are mutable, a \member{tp_clear} + implementation must also be provided. + + \begin{datadesc}{Py_TPFLAGS_GC} + Objects with a type with this flag set must conform with the rules + documented here. For convenience these objects will be referred to + as container objects. + \end{datadesc} + + \begin{datadesc}{PyGC_HEAD_SIZE} + Extra memory needed for the garbage collector. Container objects + must include this in the calculation of their tp_basicsize. If the + collector is disabled at compile time then this is \code{0}. + \end{datadesc} + + \begin{cfuncdesc}{void}{PyObject_GC_Init}{PyObject *op} + Adds the object \var{op} to the set of container objects tracked by + the collector. The collector can run at unexpected times so objects + must be valid while being tracked. This should be called once all + the fields followed by the \member{tp_traverse} handler become valid, + usually near the end of the constructor. + \end{cfuncdesc} + + \begin{cfuncdesc}{void}{PyObject_GC_Fini}{PyObject *op} + Remove the object \var{op} from the set of container objects tracked + by the collector. Note that \cfunction{PyObject_GC_Init()} can be + called again on this object to add it back to the set of tracked + objects. The deallocator (\member{tp_dealloc} handler) should call + this for the object before any of the fields used by the + \member{tp_traverse} handler become invalid. + \end{cfuncdesc} + + The \member{tp_traverse} handler accepts a function parameter of this + type: + + \begin{ctypedesc}[visitproc]{int (*visitproc)(PyObject *object, void *arg)} + Type of the visitor function passed to the \member{tp_traverse} + handler. The function should be called with an object to traverse + as \var{object} and the third parameter to the \member{tp_traverse} + handler as \var{arg}. + \end{ctypedesc} + + The \member{tp_traverse} handler must have the following type: + + \begin{ctypedesc}[traverseproc]{int (*traverseproc)(PyObject *self, + visitproc visit, void *arg)} + Traversal function for a container object. Implementations must + call the \var{visit} function for each object directly contained by + \var{self}, with the parameters to \var{visit} being the contained + object and the \var{arg} value passed to the handler. If + \var{visit} returns a non-zero value then an error has occurred and + that value should be returned immediately. + \end{ctypedesc} + + The \member{tp_clear} handler must be of the \ctype{inquiry} type, or + \NULL{} if the object is immutable. + + \begin{ctypedesc}[inquiry]{int (*inquiry)(PyObject *self)} + Drop references that may have created reference cycles. Immutable + objects do not have to define this method since they can never + directly create reference cycles. Note that the object must still + be valid after calling this method (i.e., don't just call + \cfunction{Py_DECREF()} on a reference). The collector will call + this method if it detects that this object is involved in a + reference cycle. \end{ctypedesc} From bwarsaw@users.sourceforge.net Wed Mar 21 22:50:29 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 21 Mar 2001 14:50:29 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0244.txt,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv2100 Added Files: pep-0244.txt Log Message: PEP 244, The `directive' statement, Martin von Löwis (minor editorial pass by Barry) --- NEW FILE: pep-0244.txt --- PEP: 244 Title: The `directive' statement Version: $Revision: 1.1 $ Author: loewis@informatik.hu-berlin.de (Martin von Loewis) Status: Active Type: Standards Track Created: 20-Mar-2001 Python-Version: 2.1 Post-History: Motivation From time to time, Python makes an incompatible change to the advertised semantics of core language constructs, or changes their accidental (implementation-dependent) behavior in some way. While this is never done capriciously, and is always done with the aim of improving the language over the long term, over the short term it's contentious and disrupting. The "Guidelines for Language Evolution" PEP [1] suggests ways to ease the pain, and this PEP introduces some machinery in support of that. The "Statically Nested Scopes" PEP [2] is the first application, and will be used as an example here. When a new, potentially incompatible language feature is added, some modules and libraries may chose to use it, while others may not. This specification introduces a syntax where a module author can denote whether a certain language feature is used in the module or not. In discussion of this PEP, readers commented that there are two kinds of "settable" language features: - those that are designed to eventually become the only option, at which time specifying use of them is not necessary anymore. The features for which the syntax of the "Back to the __future__" PEP [3] was proposed fall into this category. This PEP supports declaring such features, and supports phasing out the "old" meaning of constructs whose semantics has changed under the new feature. However, it defines no policy as to what features must be phased out eventually. - those which are designed to stay optional forever, e.g. if they change some default setting in the interpreter. An example for such settings might be the request to always emit line-number instructions for a certain module; no specific flags of that kind are proposed in this specification. Since a primary goal of this PEP is to support new language constructs without immediately breaking old libraries, special care was taken not to break old libraries by introducing the new syntax. Syntax A directive_statement is a statement of the form directive_statement: 'directive' NAME [atom] [';'] NEWLINE The name in the directive indicates the kind of the directive; it defines whether the optional atom can be present, and whether there are further syntactical or semantical restrictions to the atom. In addition, depending on the name of the directive, certain additional syntactical or semantical restrictions may be placed on the directive (e.g. placement of the directive in the module may be restricted to the top of the module). In the directive_statement, 'directive' is a new keyword. According to [1], this keyword is initially considered as a keyword only when used in a directive statement, see "Backwards Compatibility" below. Semantics A directive statement instructs the Python interpreter to process a source file in a different way; the specific details of that processing depend on the directive name. The optional atom is typically interpreted when the source code is processed; details of that interpretation depend on the directive. Specific Directives: transitional If a syntactical or semantical change is added to Python which is incompatible, [1] mandates a transitional evolution of the language, where the new feature is initially available alongside with the old one. Such a transition is possible by means of the transitional directive. In a transitional directive, the NAME is 'transitional'. The atom MUST be present, and it MUST be a NAME. The possible values for that name are defined when the language change is defined. One example for such a directive is directive transitional nested_scopes The transitional directive MUST occur at before any other statement in a module, except for the documentation string (i.e. it may appear as the second statement of a module only if the first statement is a STRING+). Backwards Compatibility Introducing 'directive' as a new keyword might cause incompatibilities with existing code. Following the guideline in [1], in the initial implementation of this specification, directive is a new keyword only if it was used in a valid directive_statement (i.e. if it appeared as the first non-string token in a module). Unresolved Problems: directive as the first identifier Using directive in a module as directive = 1 (i.e. the name directive appears as the first thing in a module) will treat it as keyword, not as identifier. It would be possible to classify it as a NAME with an additional look-ahead token, but such look-ahead is not available in the Python tokenizer. Questions and Answers Q: It looks like this PEP was written to allow definition of source code character sets. Is that true? A: No. Even though the directive facility can be extended to allow source code encodings, no specific directive is proposed. Q: Then why was this PEP written at all? A: It acts as a counter-proposal to [3], which proposes to overload the import statement with a new meaning. This PEP allows to solve the problem in a more general way. Q: But isn't mixing source encodings and language changes like mixing apples and oranges? A: Perhaps. To address the difference, the predefined "transitional" directive has been defined. References and Footnotes [1] http://python.sourceforge.net/peps/pep-0005.html [2] http://python.sourceforge.net/peps/pep-0227.html [3] http://python.sourceforge.net/peps/pep-0236.html Copyright This document has been placed in the public domain. Local Variables: mode: indented-text indent-tabs-mode: nil End: From tim_one@users.sourceforge.net Wed Mar 21 23:08:01 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 21 Mar 2001 15:08:01 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib doctest.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv4225/python/dist/src/Lib Modified Files: doctest.py Log Message: Changed doctest to run tests in alphabetic order of name. This makes verbose-mode output easier to dig thru, and removes an accidental dependence on the order of dict.items() (made visible by recent changes to dictobject.c). Index: doctest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/doctest.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** doctest.py 2001/03/18 17:05:58 1.9 --- doctest.py 2001/03/21 23:07:59 1.10 *************** *** 814,818 **** `d`) f = t = 0 ! for thisname, value in d.items(): if type(value) in (_FunctionType, _ClassType): f2, t2 = self.__runone(value, name + "." + thisname) --- 814,823 ---- `d`) f = t = 0 ! # Run the tests by alpha order of names, for consistency in ! # verbose-mode output. ! names = d.keys() ! names.sort() ! for thisname in names: ! value = d[thisname] if type(value) in (_FunctionType, _ClassType): f2, t2 = self.__runone(value, name + "." + thisname) *************** *** 833,837 **** try: self.isprivate = lambda *args: 0 ! for k, v in d.items(): thisname = prefix + k if type(v) is _StringType: --- 838,847 ---- try: self.isprivate = lambda *args: 0 ! # Run the tests by alpha order of names, for consistency in ! # verbose-mode output. ! keys = d.keys() ! keys.sort() ! for k in keys: ! v = d[k] thisname = prefix + k if type(v) is _StringType: From tim_one@users.sourceforge.net Wed Mar 21 23:08:01 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 21 Mar 2001 15:08:01 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_difflib,1.1,1.2 test_doctest,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv4225/python/dist/src/Lib/test/output Modified Files: test_difflib test_doctest Log Message: Changed doctest to run tests in alphabetic order of name. This makes verbose-mode output easier to dig thru, and removes an accidental dependence on the order of dict.items() (made visible by recent changes to dictobject.c). Index: test_difflib =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_difflib,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** test_difflib 2001/02/10 08:00:53 1.1 --- test_difflib 2001/03/21 23:07:59 1.2 *************** *** 157,160 **** --- 157,168 ---- ok 0 of 6 examples failed in difflib.SequenceMatcher.find_longest_match.__doc__ + Running difflib.SequenceMatcher.get_matching_blocks.__doc__ + Trying: s = SequenceMatcher(None, "abxcd", "abcd") + Expecting: nothing + ok + Trying: s.get_matching_blocks() + Expecting: [(0, 0, 2), (3, 2, 2), (5, 4, 0)] + ok + 0 of 2 examples failed in difflib.SequenceMatcher.get_matching_blocks.__doc__ Running difflib.SequenceMatcher.get_opcodes.__doc__ Trying: a = "qabxcd" *************** *** 181,189 **** Running difflib.SequenceMatcher.quick_ratio.__doc__ 0 of 0 examples failed in difflib.SequenceMatcher.quick_ratio.__doc__ ! Running difflib.SequenceMatcher.set_seqs.__doc__ ! Trying: s = SequenceMatcher() ! Expecting: nothing ! ok ! Trying: s.set_seqs("abcd", "bcde") Expecting: nothing ok --- 189,194 ---- Running difflib.SequenceMatcher.quick_ratio.__doc__ 0 of 0 examples failed in difflib.SequenceMatcher.quick_ratio.__doc__ ! Running difflib.SequenceMatcher.ratio.__doc__ ! Trying: s = SequenceMatcher(None, "abcd", "bcde") Expecting: nothing ok *************** *** 191,196 **** Expecting: 0.75 ok ! 0 of 3 examples failed in difflib.SequenceMatcher.set_seqs.__doc__ ! Running difflib.SequenceMatcher.set_seq2.__doc__ Trying: s = SequenceMatcher(None, "abcd", "bcde") Expecting: nothing --- 196,209 ---- Expecting: 0.75 ok ! Trying: s.quick_ratio() ! Expecting: 0.75 ! ok ! Trying: s.real_quick_ratio() ! Expecting: 1.0 ! ok ! 0 of 4 examples failed in difflib.SequenceMatcher.ratio.__doc__ ! Running difflib.SequenceMatcher.real_quick_ratio.__doc__ ! 0 of 0 examples failed in difflib.SequenceMatcher.real_quick_ratio.__doc__ ! Running difflib.SequenceMatcher.set_seq1.__doc__ Trying: s = SequenceMatcher(None, "abcd", "bcde") Expecting: nothing *************** *** 199,203 **** Expecting: 0.75 ok ! Trying: s.set_seq2("abcd") Expecting: nothing ok --- 212,216 ---- Expecting: 0.75 ok ! Trying: s.set_seq1("bcde") Expecting: nothing ok *************** *** 205,210 **** Expecting: 1.0 ok ! 0 of 4 examples failed in difflib.SequenceMatcher.set_seq2.__doc__ ! Running difflib.SequenceMatcher.set_seq1.__doc__ Trying: s = SequenceMatcher(None, "abcd", "bcde") Expecting: nothing --- 218,223 ---- Expecting: 1.0 ok ! 0 of 4 examples failed in difflib.SequenceMatcher.set_seq1.__doc__ ! Running difflib.SequenceMatcher.set_seq2.__doc__ Trying: s = SequenceMatcher(None, "abcd", "bcde") Expecting: nothing *************** *** 213,217 **** Expecting: 0.75 ok ! Trying: s.set_seq1("bcde") Expecting: nothing ok --- 226,230 ---- Expecting: 0.75 ok ! Trying: s.set_seq2("abcd") Expecting: nothing ok *************** *** 219,247 **** Expecting: 1.0 ok ! 0 of 4 examples failed in difflib.SequenceMatcher.set_seq1.__doc__ ! Running difflib.SequenceMatcher.get_matching_blocks.__doc__ ! Trying: s = SequenceMatcher(None, "abxcd", "abcd") Expecting: nothing - ok - Trying: s.get_matching_blocks() - Expecting: [(0, 0, 2), (3, 2, 2), (5, 4, 0)] ok ! 0 of 2 examples failed in difflib.SequenceMatcher.get_matching_blocks.__doc__ ! Running difflib.SequenceMatcher.real_quick_ratio.__doc__ ! 0 of 0 examples failed in difflib.SequenceMatcher.real_quick_ratio.__doc__ ! Running difflib.SequenceMatcher.ratio.__doc__ ! Trying: s = SequenceMatcher(None, "abcd", "bcde") Expecting: nothing ok Trying: s.ratio() Expecting: 0.75 - ok - Trying: s.quick_ratio() - Expecting: 0.75 ok ! Trying: s.real_quick_ratio() ! Expecting: 1.0 ! ok ! 0 of 4 examples failed in difflib.SequenceMatcher.ratio.__doc__ Running difflib.get_close_matches.__doc__ Trying: get_close_matches("appel", ["ape", "apple", "peach", "puppy"]) --- 232,247 ---- Expecting: 1.0 ok ! 0 of 4 examples failed in difflib.SequenceMatcher.set_seq2.__doc__ ! Running difflib.SequenceMatcher.set_seqs.__doc__ ! Trying: s = SequenceMatcher() Expecting: nothing ok ! Trying: s.set_seqs("abcd", "bcde") Expecting: nothing ok Trying: s.ratio() Expecting: 0.75 ok ! 0 of 3 examples failed in difflib.SequenceMatcher.set_seqs.__doc__ Running difflib.get_close_matches.__doc__ Trying: get_close_matches("appel", ["ape", "apple", "peach", "puppy"]) Index: test_doctest =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_doctest,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** test_doctest 2001/03/18 20:14:25 1.4 --- test_doctest 2001/03/21 23:07:59 1.5 *************** *** 89,151 **** Running doctest.Tester.__init__.__doc__ 0 of 0 examples failed in doctest.Tester.__init__.__doc__ - Running doctest.Tester.run__test__.__doc__ - 0 of 0 examples failed in doctest.Tester.run__test__.__doc__ - Running doctest.Tester.runstring.__doc__ - Trying: t = Tester(globs={}, verbose=1) - Expecting: nothing - ok - Trying: - test = r''' - # just an example - >>> x = 1 + 2 - >>> x - 3 - ''' - Expecting: nothing - ok - Trying: t.runstring(test, "Example") - Expecting: - Running string Example - Trying: x = 1 + 2 - Expecting: nothing - ok - Trying: x - Expecting: 3 - ok - 0 of 2 examples failed in string Example - (0, 2) - ok - 0 of 3 examples failed in doctest.Tester.runstring.__doc__ - Running doctest.Tester.summarize.__doc__ - 0 of 0 examples failed in doctest.Tester.summarize.__doc__ - Running doctest.Tester.rundict.__doc__ - Trying: - def _f(): - '''>>> assert 1 == 1 - ''' - Expecting: nothing - ok - Trying: - def g(): - '''>>> assert 2 != 1 - ''' - Expecting: nothing - ok - Trying: d = {"_f": _f, "g": g} - Expecting: nothing - ok - Trying: t = Tester(globs={}, verbose=0) - Expecting: nothing - ok - Trying: t.rundict(d, "rundict_test") # _f is skipped - Expecting: (0, 1) - ok - Trying: t = Tester(globs={}, verbose=0, isprivate=lambda x,y: 0) - Expecting: nothing - ok - Trying: t.rundict(d, "rundict_test_pvt") # both are searched - Expecting: (0, 2) - ok - 0 of 7 examples failed in doctest.Tester.rundict.__doc__ Running doctest.Tester.merge.__doc__ Trying: from doctest import Tester --- 89,92 ---- *************** *** 198,201 **** --- 139,173 ---- ok 0 of 10 examples failed in doctest.Tester.merge.__doc__ + Running doctest.Tester.run__test__.__doc__ + 0 of 0 examples failed in doctest.Tester.run__test__.__doc__ + Running doctest.Tester.rundict.__doc__ + Trying: + def _f(): + '''>>> assert 1 == 1 + ''' + Expecting: nothing + ok + Trying: + def g(): + '''>>> assert 2 != 1 + ''' + Expecting: nothing + ok + Trying: d = {"_f": _f, "g": g} + Expecting: nothing + ok + Trying: t = Tester(globs={}, verbose=0) + Expecting: nothing + ok + Trying: t.rundict(d, "rundict_test") # _f is skipped + Expecting: (0, 1) + ok + Trying: t = Tester(globs={}, verbose=0, isprivate=lambda x,y: 0) + Expecting: nothing + ok + Trying: t.rundict(d, "rundict_test_pvt") # both are searched + Expecting: (0, 2) + ok + 0 of 7 examples failed in doctest.Tester.rundict.__doc__ Running doctest.Tester.rundoc.__doc__ Trying: t = Tester(globs={}, verbose=0) *************** *** 214,217 **** --- 186,217 ---- ok 0 of 3 examples failed in doctest.Tester.rundoc.__doc__ + Running doctest.Tester.runstring.__doc__ + Trying: t = Tester(globs={}, verbose=1) + Expecting: nothing + ok + Trying: + test = r''' + # just an example + >>> x = 1 + 2 + >>> x + 3 + ''' + Expecting: nothing + ok + Trying: t.runstring(test, "Example") + Expecting: + Running string Example + Trying: x = 1 + 2 + Expecting: nothing + ok + Trying: x + Expecting: 3 + ok + 0 of 2 examples failed in string Example + (0, 2) + ok + 0 of 3 examples failed in doctest.Tester.runstring.__doc__ + Running doctest.Tester.summarize.__doc__ + 0 of 0 examples failed in doctest.Tester.summarize.__doc__ Running doctest.is_private.__doc__ Trying: is_private("a.b", "my_func") *************** *** 249,260 **** ok 0 of 2 examples failed in doctest.__test__._TestClass.__doc__ - Running doctest.__test__._TestClass.get.__doc__ - Trying: x = _TestClass(-42) - Expecting: nothing - ok - Trying: print x.get() - Expecting: -42 - ok - 0 of 2 examples failed in doctest.__test__._TestClass.get.__doc__ Running doctest.__test__._TestClass.__init__.__doc__ Trying: t = _TestClass(123) --- 249,252 ---- *************** *** 265,268 **** --- 257,268 ---- ok 0 of 2 examples failed in doctest.__test__._TestClass.__init__.__doc__ + Running doctest.__test__._TestClass.get.__doc__ + Trying: x = _TestClass(-42) + Expecting: nothing + ok + Trying: print x.get() + Expecting: -42 + ok + 0 of 2 examples failed in doctest.__test__._TestClass.get.__doc__ Running doctest.__test__._TestClass.square.__doc__ Trying: _TestClass(13).square().get() From bwarsaw@users.sourceforge.net Wed Mar 21 23:21:51 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 21 Mar 2001 15:21:51 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0245.txt,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv6576 Modified Files: pep-0245.txt Log Message: minor nits Index: pep-0245.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0245.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** pep-0245.txt 2001/03/21 21:50:48 1.2 --- pep-0245.txt 2001/03/21 23:21:49 1.3 *************** *** 50,53 **** --- 50,54 ---- see[5]. + The Problem *************** *** 1007,1010 **** --- 1008,1012 ---- This PEP proposes adding one new keyword to the Python language, `interface'. This will break code. + Open Issues From gvanrossum@users.sourceforge.net Thu Mar 22 00:19:24 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 21 Mar 2001 16:19:24 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules bsddbmodule.c,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv13649 Modified Files: bsddbmodule.c Log Message: Don't raise MemoryError in keys() when the database is empty. This fixes SF bug #410146 (python 2.1b shelve is broken). Index: bsddbmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/bsddbmodule.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -r1.28 -r1.29 *** bsddbmodule.c 2001/02/27 18:56:46 1.28 --- bsddbmodule.c 2001/03/22 00:19:22 1.29 *************** *** 428,432 **** } BSDDB_END_SAVE(dp) ! if (data==NULL) return PyErr_NoMemory(); while (status == 0) { if (dp->di_type == DB_RECNO) --- 428,432 ---- } BSDDB_END_SAVE(dp) ! if (status == 0 && data==NULL) return PyErr_NoMemory(); while (status == 0) { if (dp->di_type == DB_RECNO) From nascheme@users.sourceforge.net Thu Mar 22 00:29:57 2001 From: nascheme@users.sourceforge.net (Neil Schemenauer) Date: Wed, 21 Mar 2001 16:29:57 -0800 Subject: [Python-checkins] CVS: python/dist/src configure.in,1.212,1.213 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv14975 Modified Files: configure.in Log Message: Add CONFIG_ARGS Makefile variable (saves the arguments passed to configure). Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.212 retrieving revision 1.213 diff -C2 -r1.212 -r1.213 *** configure.in 2001/03/21 15:57:54 1.212 --- configure.in 2001/03/22 00:29:55 1.213 *************** *** 9,12 **** --- 9,16 ---- VERSION=2.1 + # Arguments passed to configure. + AC_SUBST(CONFIG_ARGS) + CONFIG_ARGS="$ac_configure_args" + # NEXTSTEP|MacOSX|Darwin stuff if test -f /usr/lib/NextStep/software_version -o -f /System/Library/CoreServices/software_version ; then From nascheme@users.sourceforge.net Thu Mar 22 00:32:34 2001 From: nascheme@users.sourceforge.net (Neil Schemenauer) Date: Wed, 21 Mar 2001 16:32:34 -0800 Subject: [Python-checkins] CVS: python/dist/src Makefile.pre.in,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv15295 Modified Files: Makefile.pre.in Log Message: - Remove WITH makefile variable. Its not used for anything. - Add CONFIG_ARGS variable and use it to re-run configure rather than using config.status. This prevents an infinite loop if configure dies while re-configuring. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -r1.30 -r1.31 *** Makefile.pre.in 2001/03/16 11:50:43 1.30 --- Makefile.pre.in 2001/03/22 00:32:32 1.31 *************** *** 106,113 **** FILEMODE= 644 ! # --with-PACKAGE options for configure script ! # e.g. --with-readline --with-svr5 --with-solaris --with-thread ! # (see README for an explanation) ! WITH= --- 106,111 ---- FILEMODE= 644 ! # configure script arguments ! CONFIG_ARGS= @CONFIG_ARGS@ *************** *** 710,723 **** $(MAKE) -f Makefile.pre Makefile ! # Run the configure script. If config.status already exists, ! # call it with the --recheck argument, which reruns configure with the ! # same options as it was run last time; otherwise run the configure ! # script with options taken from the $(WITH) variable config.status: $(srcdir)/configure ! if test -f config.status; \ ! then $(SHELL) config.status --recheck; \ ! $(SHELL) config.status; \ ! else $(SHELL) $(srcdir)/configure $(WITH); \ ! fi .PRECIOUS: config.status $(PYTHON) Makefile Makefile.pre --- 708,714 ---- $(MAKE) -f Makefile.pre Makefile ! # Run the configure script. config.status: $(srcdir)/configure ! $(SHELL) $(srcdir)/configure $(CONFIG_ARGS) .PRECIOUS: config.status $(PYTHON) Makefile Makefile.pre From nascheme@users.sourceforge.net Thu Mar 22 00:34:06 2001 From: nascheme@users.sourceforge.net (Neil Schemenauer) Date: Wed, 21 Mar 2001 16:34:06 -0800 Subject: [Python-checkins] CVS: python/dist/src configure,1.204,1.205 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv15420 Modified Files: configure Log Message: Add CONFIG_ARGS Makefile variable (saves the arguments passed to configure). Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.204 retrieving revision 1.205 diff -C2 -r1.204 -r1.205 *** configure 2001/03/21 15:57:53 1.204 --- configure 2001/03/22 00:34:03 1.205 *************** *** 1,5 **** #! /bin/sh ! # From configure.in Revision: 1.211 # Guess values for system-dependent variables and create Makefiles. --- 1,5 ---- #! /bin/sh ! # From configure.in Revision: 1.213 [...4173 lines suppressed...] *** 6175,6179 **** SRCDIRS="Parser Grammar Objects Python Modules" echo $ac_n "checking for build directories""... $ac_c" 1>&6 ! echo "configure:6178: checking for build directories" >&5 for dir in $SRCDIRS; do if test ! -d $dir; then --- 6179,6183 ---- SRCDIRS="Parser Grammar Objects Python Modules" echo $ac_n "checking for build directories""... $ac_c" 1>&6 ! echo "configure:6182: checking for build directories" >&5 for dir in $SRCDIRS; do if test ! -d $dir; then *************** *** 6318,6321 **** --- 6322,6326 ---- s%@mandir@%$mandir%g s%@VERSION@%$VERSION%g + s%@CONFIG_ARGS@%$CONFIG_ARGS%g s%@MACHDEP@%$MACHDEP%g s%@SGI_ABI@%$SGI_ABI%g From gvanrossum@users.sourceforge.net Thu Mar 22 00:38:43 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 21 Mar 2001 16:38:43 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_bsddb.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv15908 Modified Files: test_bsddb.py Log Message: Check that f.keys() == [] right after creation -- this prevents bugs like the one I just fixed to come back and haunt us. Index: test_bsddb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bsddb.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** test_bsddb.py 2001/01/17 21:51:36 1.7 --- test_bsddb.py 2001/03/22 00:38:40 1.8 *************** *** 7,11 **** import bsddb import tempfile ! from test_support import verbose def test(openmethod, what): --- 7,11 ---- import bsddb import tempfile ! from test_support import verbose, verify def test(openmethod, what): *************** *** 16,19 **** --- 16,20 ---- fname = tempfile.mktemp() f = openmethod(fname, 'c') + verify(f.keys() == []) if verbose: print 'creation...' From gvanrossum@users.sourceforge.net Thu Mar 22 00:39:47 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 21 Mar 2001 16:39:47 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_dbm.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv16024 Modified Files: test_dbm.py Log Message: Check that f.keys() == [] right after creation -- this prevents bugs like the one I just fixed to come back and haunt us. Index: test_dbm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_dbm.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** test_dbm.py 2001/01/17 21:51:35 1.6 --- test_dbm.py 2001/03/22 00:39:45 1.7 *************** *** 5,13 **** import dbm from dbm import error ! from test_support import verbose filename = '/tmp/delete_me' d = dbm.open(filename, 'c') d['a'] = 'b' d['12345678910'] = '019237410982340912840198242' --- 5,14 ---- import dbm from dbm import error ! from test_support import verbose, verify filename = '/tmp/delete_me' d = dbm.open(filename, 'c') + verify(d.keys() == []) d['a'] = 'b' d['12345678910'] = '019237410982340912840198242' From gvanrossum@users.sourceforge.net Thu Mar 22 00:40:26 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 21 Mar 2001 16:40:26 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_gdbm.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv16116 Modified Files: test_gdbm.py Log Message: Check that f.keys() == [] right after creation -- this prevents bugs like the one I just fixed to come back and haunt us. Index: test_gdbm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gdbm.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** test_gdbm.py 2001/01/17 21:51:35 1.7 --- test_gdbm.py 2001/03/22 00:40:23 1.8 *************** *** 6,14 **** import gdbm from gdbm import error ! from test_support import verbose, TestFailed filename= '/tmp/delete_me' g = gdbm.open(filename, 'c') g['a'] = 'b' g['12345678910'] = '019237410982340912840198242' --- 6,15 ---- import gdbm from gdbm import error ! from test_support import verbose, verify, TestFailed filename= '/tmp/delete_me' g = gdbm.open(filename, 'c') + verify(g.keys() == []) g['a'] = 'b' g['12345678910'] = '019237410982340912840198242' From jhylton@users.sourceforge.net Thu Mar 22 02:32:50 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Wed, 21 Mar 2001 18:32:50 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python ceval.c,2.233,2.234 compile.c,2.190,2.191 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv28707/Python Modified Files: ceval.c compile.c Log Message: If a code object is compiled with nested scopes, define the CO_NESTED flag. Add PyEval_GetNestedScopes() which returns a non-zero value if the code for the current interpreter frame has CO_NESTED defined. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.233 retrieving revision 2.234 diff -C2 -r2.233 -r2.234 *** ceval.c 2001/03/21 19:17:22 2.233 --- ceval.c 2001/03/22 02:32:48 2.234 *************** *** 2668,2671 **** --- 2668,2679 ---- int + PyEval_GetNestedScopes(void) + { + PyFrameObject *current_frame = PyThreadState_Get()->frame; + return current_frame == NULL ? 0 : + current_frame->f_code->co_flags & CO_NESTED; + } + + int Py_FlushLine(void) { *************** *** 3449,3453 **** FILE *fp = PyFile_AsFile(prog); char *name = PyString_AsString(PyFile_Name(prog)); ! v = PyRun_File(fp, name, Py_file_input, globals, locals); } else { --- 3457,3461 ---- FILE *fp = PyFile_AsFile(prog); char *name = PyString_AsString(PyFile_Name(prog)); ! v = PyRun_File(fp, name, Py_file_input, globals, locals); } else { Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.190 retrieving revision 2.191 diff -C2 -r2.190 -r2.191 *** compile.c 2001/03/21 19:01:33 2.190 --- compile.c 2001/03/22 02:32:48 2.191 *************** *** 4277,4280 **** --- 4277,4282 ---- struct symbol_info *si) { + if (c->c_future && c->c_future->ff_nested_scopes) + c->c_flags |= CO_NESTED; if (ste->ste_type != TYPE_MODULE) c->c_flags |= CO_NEWLOCALS; From jhylton@users.sourceforge.net Thu Mar 22 02:32:50 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Wed, 21 Mar 2001 18:32:50 -0800 Subject: [Python-checkins] CVS: python/dist/src/Include ceval.h,2.40,2.41 compile.h,2.28,2.29 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv28707/Include Modified Files: ceval.h compile.h Log Message: If a code object is compiled with nested scopes, define the CO_NESTED flag. Add PyEval_GetNestedScopes() which returns a non-zero value if the code for the current interpreter frame has CO_NESTED defined. Index: ceval.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/ceval.h,v retrieving revision 2.40 retrieving revision 2.41 diff -C2 -r2.40 -r2.41 *** ceval.h 2000/09/15 18:19:27 2.40 --- ceval.h 2001/03/22 02:32:48 2.41 *************** *** 29,32 **** --- 29,33 ---- DL_IMPORT(PyObject *) PyEval_GetFrame(void); DL_IMPORT(int) PyEval_GetRestricted(void); + DL_IMPORT(int) PyEval_GetNestedScopes(void); DL_IMPORT(int) Py_FlushLine(void); Index: compile.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/compile.h,v retrieving revision 2.28 retrieving revision 2.29 diff -C2 -r2.28 -r2.29 *** compile.h 2001/03/01 22:59:14 2.28 --- compile.h 2001/03/22 02:32:48 2.29 *************** *** 33,36 **** --- 33,37 ---- #define CO_VARARGS 0x0004 #define CO_VARKEYWORDS 0x0008 + #define CO_NESTED 0x0010 extern DL_IMPORT(PyTypeObject) PyCode_Type; From jhylton@users.sourceforge.net Thu Mar 22 02:47:59 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Wed, 21 Mar 2001 18:47:59 -0800 Subject: [Python-checkins] CVS: python/dist/src/Include pythonrun.h,2.39,2.40 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv30456/Include Modified Files: pythonrun.h Log Message: Extend support for from __future__ import nested_scopes If a module has a future statement enabling nested scopes, they are also enable for the exec statement and the functions compile() and execfile() if they occur in the module. If Python is run with the -i option, which enters interactive mode after executing a script, and the script it runs enables nested scopes, they are also enabled in interactive mode. XXX The use of -i with -c "from __future__ import nested_scopes" is not supported. What's the point? To support these changes, many function variants have been added to pythonrun.c. All the variants names end with Flags and they take an extra PyCompilerFlags * argument. It is possible that this complexity will be eliminated in a future version of the interpreter in which nested scopes are not optional. Index: pythonrun.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pythonrun.h,v retrieving revision 2.39 retrieving revision 2.40 diff -C2 -r2.39 -r2.40 *** pythonrun.h 2001/03/01 22:59:14 2.39 --- pythonrun.h 2001/03/22 02:47:57 2.40 *************** *** 27,36 **** --- 27,41 ---- DL_IMPORT(int) PyRun_AnyFileEx(FILE *, char *, int); + DL_IMPORT(int) PyRun_AnyFileFlags(FILE *, char *, PyCompilerFlags *); + DL_IMPORT(int) PyRun_AnyFileExFlags(FILE *, char *, int, PyCompilerFlags *); + DL_IMPORT(int) PyRun_SimpleString(char *); DL_IMPORT(int) PyRun_SimpleFile(FILE *, char *); DL_IMPORT(int) PyRun_SimpleFileEx(FILE *, char *, int); + DL_IMPORT(int) PyRun_SimpleFileExFlags(FILE *, char *, int, PyCompilerFlags *); DL_IMPORT(int) PyRun_InteractiveOne(FILE *, char *); DL_IMPORT(int) PyRun_InteractiveOneFlags(FILE *, char *, PyCompilerFlags *); DL_IMPORT(int) PyRun_InteractiveLoop(FILE *, char *); + DL_IMPORT(int) PyRun_InteractiveLoopFlags(FILE *, char *, PyCompilerFlags *); DL_IMPORT(struct _node *) PyParser_SimpleParseString(char *, int); *************** *** 41,46 **** --- 46,59 ---- DL_IMPORT(PyObject *) PyRun_FileEx(FILE *, char *, int, PyObject *, PyObject *, int); + DL_IMPORT(PyObject *) PyRun_StringFlags(char *, int, PyObject *, PyObject *, + PyCompilerFlags *); + DL_IMPORT(PyObject *) PyRun_FileFlags(FILE *, char *, int, PyObject *, + PyObject *, PyCompilerFlags *); + DL_IMPORT(PyObject *) PyRun_FileExFlags(FILE *, char *, int, PyObject *, + PyObject *, int, PyCompilerFlags *); DL_IMPORT(PyObject *) Py_CompileString(char *, char *, int); + DL_IMPORT(PyObject *) Py_CompileStringFlags(char *, char *, int, + PyCompilerFlags *); DL_IMPORT(struct symtable *) Py_SymtableString(char *, char *, int); From jhylton@users.sourceforge.net Thu Mar 22 02:48:00 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Wed, 21 Mar 2001 18:48:00 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules main.c,1.50,1.51 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv30456/Modules Modified Files: main.c Log Message: Extend support for from __future__ import nested_scopes If a module has a future statement enabling nested scopes, they are also enable for the exec statement and the functions compile() and execfile() if they occur in the module. If Python is run with the -i option, which enters interactive mode after executing a script, and the script it runs enables nested scopes, they are also enabled in interactive mode. XXX The use of -i with -c "from __future__ import nested_scopes" is not supported. What's the point? To support these changes, many function variants have been added to pythonrun.c. All the variants names end with Flags and they take an extra PyCompilerFlags * argument. It is possible that this complexity will be eliminated in a future version of the interpreter in which nested scopes are not optional. Index: main.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/main.c,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -r1.50 -r1.51 *** main.c 2001/03/02 06:18:03 1.50 --- main.c 2001/03/22 02:47:57 1.51 *************** *** 100,103 **** --- 100,104 ---- int help = 0; int version = 0; + PyCompilerFlags cf; orig_argc = argc; /* For Py_GetArgcArgv() */ *************** *** 294,297 **** --- 295,300 ---- } + cf.cf_nested_scopes = 0; + if (command) { sts = PyRun_SimpleString(command) != 0; *************** *** 310,322 **** } } ! sts = PyRun_AnyFileEx( fp, filename == NULL ? "" : filename, ! filename != NULL) != 0; } if (inspect && stdin_is_interactive && (filename != NULL || command != NULL)) ! sts = PyRun_AnyFile(stdin, "") != 0; Py_Finalize(); --- 313,327 ---- } } ! /* XXX */ ! sts = PyRun_AnyFileExFlags( fp, filename == NULL ? "" : filename, ! filename != NULL, &cf) != 0; } if (inspect && stdin_is_interactive && (filename != NULL || command != NULL)) ! /* XXX */ ! sts = PyRun_AnyFileFlags(stdin, "", &cf) != 0; Py_Finalize(); From jhylton@users.sourceforge.net Thu Mar 22 02:48:00 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Wed, 21 Mar 2001 18:48:00 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.195,2.196 ceval.c,2.234,2.235 pythonrun.c,2.126,2.127 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv30456/Python Modified Files: bltinmodule.c ceval.c pythonrun.c Log Message: Extend support for from __future__ import nested_scopes If a module has a future statement enabling nested scopes, they are also enable for the exec statement and the functions compile() and execfile() if they occur in the module. If Python is run with the -i option, which enters interactive mode after executing a script, and the script it runs enables nested scopes, they are also enabled in interactive mode. XXX The use of -i with -c "from __future__ import nested_scopes" is not supported. What's the point? To support these changes, many function variants have been added to pythonrun.c. All the variants names end with Flags and they take an extra PyCompilerFlags * argument. It is possible that this complexity will be eliminated in a future version of the interpreter in which nested scopes are not optional. Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.195 retrieving revision 2.196 diff -C2 -r2.195 -r2.196 *** bltinmodule.c 2001/03/21 18:40:58 2.195 --- bltinmodule.c 2001/03/22 02:47:58 2.196 *************** *** 374,378 **** return NULL; } ! return Py_CompileString(str, filename, start); } --- 374,383 ---- return NULL; } ! if (PyEval_GetNestedScopes()) { ! PyCompilerFlags cf; ! cf.cf_nested_scopes = 1; ! return Py_CompileStringFlags(str, filename, start, &cf); ! } else ! return Py_CompileString(str, filename, start); } *************** *** 809,813 **** return NULL; } ! res = PyRun_FileEx(fp, filename, Py_file_input, globals, locals, 1); return res; } --- 814,825 ---- return NULL; } ! if (PyEval_GetNestedScopes()) { ! PyCompilerFlags cf; ! cf.cf_nested_scopes = 1; ! res = PyRun_FileExFlags(fp, filename, Py_file_input, globals, ! locals, 1, &cf); ! } else ! res = PyRun_FileEx(fp, filename, Py_file_input, globals, ! locals, 1); return res; } Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.234 retrieving revision 2.235 diff -C2 -r2.234 -r2.235 *** ceval.c 2001/03/22 02:32:48 2.234 --- ceval.c 2001/03/22 02:47:58 2.235 *************** *** 3457,3461 **** FILE *fp = PyFile_AsFile(prog); char *name = PyString_AsString(PyFile_Name(prog)); ! v = PyRun_File(fp, name, Py_file_input, globals, locals); } else { --- 3457,3469 ---- FILE *fp = PyFile_AsFile(prog); char *name = PyString_AsString(PyFile_Name(prog)); ! if (PyEval_GetNestedScopes()) { ! PyCompilerFlags cf; ! cf.cf_nested_scopes = 1; ! v = PyRun_FileFlags(fp, name, Py_file_input, globals, ! locals, &cf); ! } else { ! v = PyRun_File(fp, name, Py_file_input, globals, ! locals); ! } } else { *************** *** 3463,3467 **** if (PyString_AsStringAndSize(prog, &str, NULL)) return -1; ! v = PyRun_String(str, Py_file_input, globals, locals); } if (plain) --- 3471,3481 ---- if (PyString_AsStringAndSize(prog, &str, NULL)) return -1; ! if (PyEval_GetNestedScopes()) { ! PyCompilerFlags cf; ! cf.cf_nested_scopes = 1; ! v = PyRun_StringFlags(str, Py_file_input, globals, ! locals, &cf); ! } else ! v = PyRun_String(str, Py_file_input, globals, locals); } if (plain) Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.126 retrieving revision 2.127 diff -C2 -r2.126 -r2.127 *** pythonrun.c 2001/03/01 22:59:14 2.126 --- pythonrun.c 2001/03/22 02:47:58 2.127 *************** *** 41,45 **** static PyObject *run_node(node *, char *, PyObject *, PyObject *, PyCompilerFlags *); ! static PyObject *run_pyc_file(FILE *, char *, PyObject *, PyObject *); static void err_input(perrdetail *); static void initsigs(void); --- 41,46 ---- static PyObject *run_node(node *, char *, PyObject *, PyObject *, PyCompilerFlags *); ! static PyObject *run_pyc_file(FILE *, char *, PyObject *, PyObject *, ! PyCompilerFlags *); static void err_input(perrdetail *); static void initsigs(void); *************** *** 448,461 **** PyRun_AnyFile(FILE *fp, char *filename) { ! return PyRun_AnyFileEx(fp, filename, 0); } int PyRun_AnyFileEx(FILE *fp, char *filename, int closeit) { if (filename == NULL) filename = "???"; if (Py_FdIsInteractive(fp, filename)) { ! int err = PyRun_InteractiveLoop(fp, filename); if (closeit) fclose(fp); --- 449,475 ---- PyRun_AnyFile(FILE *fp, char *filename) { ! return PyRun_AnyFileExFlags(fp, filename, 0, NULL); } int + PyRun_AnyFileFlags(FILE *fp, char *filename, PyCompilerFlags *flags) + { + return PyRun_AnyFileExFlags(fp, filename, 0, flags); + } + + int PyRun_AnyFileEx(FILE *fp, char *filename, int closeit) { + return PyRun_AnyFileExFlags(fp, filename, closeit, NULL); + } + + int + PyRun_AnyFileExFlags(FILE *fp, char *filename, int closeit, + PyCompilerFlags *flags) + { if (filename == NULL) filename = "???"; if (Py_FdIsInteractive(fp, filename)) { ! int err = PyRun_InteractiveLoopFlags(fp, filename, flags); if (closeit) fclose(fp); *************** *** 463,467 **** } else ! return PyRun_SimpleFileEx(fp, filename, closeit); } --- 477,481 ---- } else ! return PyRun_SimpleFileExFlags(fp, filename, closeit, flags); } *************** *** 469,477 **** PyRun_InteractiveLoop(FILE *fp, char *filename) { PyObject *v; int ret; ! PyCompilerFlags flags; ! flags.cf_nested_scopes = 0; v = PySys_GetObject("ps1"); if (v == NULL) { --- 483,500 ---- PyRun_InteractiveLoop(FILE *fp, char *filename) { + return PyRun_InteractiveLoopFlags(fp, filename, NULL); + } + + int + PyRun_InteractiveLoopFlags(FILE *fp, char *filename, PyCompilerFlags *flags) + { PyObject *v; int ret; ! PyCompilerFlags local_flags; ! if (flags == NULL) { ! flags = &local_flags; ! local_flags.cf_nested_scopes = 0; ! } v = PySys_GetObject("ps1"); if (v == NULL) { *************** *** 485,489 **** } for (;;) { ! ret = PyRun_InteractiveOneFlags(fp, filename, &flags); #ifdef Py_REF_DEBUG fprintf(stderr, "[%ld refs]\n", _Py_RefTotal); --- 508,512 ---- } for (;;) { ! ret = PyRun_InteractiveOneFlags(fp, filename, flags); #ifdef Py_REF_DEBUG fprintf(stderr, "[%ld refs]\n", _Py_RefTotal); *************** *** 612,615 **** --- 635,645 ---- PyRun_SimpleFileEx(FILE *fp, char *filename, int closeit) { + return PyRun_SimpleFileExFlags(fp, filename, closeit, NULL); + } + + int + PyRun_SimpleFileExFlags(FILE *fp, char *filename, int closeit, + PyCompilerFlags *flags) + { PyObject *m, *d, *v; char *ext; *************** *** 631,637 **** if (strcmp(ext, ".pyo") == 0) Py_OptimizeFlag = 1; ! v = run_pyc_file(fp, filename, d, d); } else { ! v = PyRun_FileEx(fp, filename, Py_file_input, d, d, closeit); } if (v == NULL) { --- 661,668 ---- if (strcmp(ext, ".pyo") == 0) Py_OptimizeFlag = 1; ! v = run_pyc_file(fp, filename, d, d, flags); } else { ! v = PyRun_FileExFlags(fp, filename, Py_file_input, d, d, ! closeit, flags); } if (v == NULL) { *************** *** 927,931 **** PyObject * PyRun_FileEx(FILE *fp, char *filename, int start, PyObject *globals, ! PyObject *locals, int closeit) { node *n = PyParser_SimpleParseFile(fp, filename, start); --- 958,962 ---- PyObject * PyRun_FileEx(FILE *fp, char *filename, int start, PyObject *globals, ! PyObject *locals, int closeit) { node *n = PyParser_SimpleParseFile(fp, filename, start); *************** *** 935,938 **** --- 966,995 ---- } + PyObject * + PyRun_StringFlags(char *str, int start, PyObject *globals, PyObject *locals, + PyCompilerFlags *flags) + { + return run_err_node(PyParser_SimpleParseString(str, start), + "", globals, locals, flags); + } + + PyObject * + PyRun_FileFlags(FILE *fp, char *filename, int start, PyObject *globals, + PyObject *locals, PyCompilerFlags *flags) + { + return PyRun_FileExFlags(fp, filename, start, globals, locals, 0, + flags); + } + + PyObject * + PyRun_FileExFlags(FILE *fp, char *filename, int start, PyObject *globals, + PyObject *locals, int closeit, PyCompilerFlags *flags) + { + node *n = PyParser_SimpleParseFile(fp, filename, start); + if (closeit) + fclose(fp); + return run_err_node(n, filename, globals, locals, flags); + } + static PyObject * run_err_node(node *n, char *filename, PyObject *globals, PyObject *locals, *************** *** 950,954 **** PyCodeObject *co; PyObject *v; - /* XXX pass sess->ss_nested_scopes to PyNode_Compile */ co = PyNode_CompileFlags(n, filename, flags); PyNode_Free(n); --- 1007,1010 ---- *************** *** 961,965 **** static PyObject * ! run_pyc_file(FILE *fp, char *filename, PyObject *globals, PyObject *locals) { PyCodeObject *co; --- 1017,1022 ---- static PyObject * ! run_pyc_file(FILE *fp, char *filename, PyObject *globals, PyObject *locals, ! PyCompilerFlags *flags) { PyCodeObject *co; *************** *** 985,988 **** --- 1042,1051 ---- co = (PyCodeObject *)v; v = PyEval_EvalCode(co, globals, locals); + if (v && flags) { + if (co->co_flags & CO_NESTED) + flags->cf_nested_scopes = 1; + fprintf(stderr, "run_pyc_file: nested_scopes: %d\n", + flags->cf_nested_scopes); + } Py_DECREF(co); return v; *************** *** 991,994 **** --- 1054,1064 ---- PyObject * Py_CompileString(char *str, char *filename, int start) + { + return Py_CompileStringFlags(str, filename, start, NULL); + } + + PyObject * + Py_CompileStringFlags(char *str, char *filename, int start, + PyCompilerFlags *flags) { node *n; From akuchling@users.sourceforge.net Thu Mar 22 03:03:43 2001 From: akuchling@users.sourceforge.net (A.M. Kuchling) Date: Wed, 21 Mar 2001 19:03:43 -0800 Subject: [Python-checkins] CVS: distutils/distutils util.py,1.61,1.62 Message-ID: Update of /cvsroot/python/distutils/distutils In directory usw-pr-cvs1:/tmp/cvs-serv32511 Modified Files: util.py Log Message: Patch #407434: add rfc822_escape utility function Index: util.py =================================================================== RCS file: /cvsroot/python/distutils/distutils/util.py,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -r1.61 -r1.62 *** util.py 2001/02/27 19:25:42 1.61 --- util.py 2001/03/22 03:03:41 1.62 *************** *** 444,445 **** --- 444,455 ---- # byte_compile () + + def rfc822_escape (header): + """Return a version of the string escaped for inclusion in an + RFC-822 header, by adding a space after each newline. + """ + header = string.rstrip(header) + header = string.replace(header, '\n', '\n ') + return header + + From akuchling@users.sourceforge.net Thu Mar 22 03:06:54 2001 From: akuchling@users.sourceforge.net (A.M. Kuchling) Date: Wed, 21 Mar 2001 19:06:54 -0800 Subject: [Python-checkins] CVS: distutils/distutils dist.py,1.44,1.45 Message-ID: Update of /cvsroot/python/distutils/distutils In directory usw-pr-cvs1:/tmp/cvs-serv329 Modified Files: dist.py Log Message: Add 'platforms' and 'keywords' attributes to the DistributionMetadata class, along with options to print them. Add a finalize_options() method to Distribution to do final processing on the platform and keyword attributes Add DistributionMetadata.write_pkg_info() method to write a PKG-INFO file into the release tree. Index: dist.py =================================================================== RCS file: /cvsroot/python/distutils/distutils/dist.py,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -r1.44 -r1.45 *** dist.py 2001/03/17 19:59:26 1.44 --- dist.py 2001/03/22 03:06:52 1.45 *************** *** 16,20 **** from distutils import sysconfig from distutils.fancy_getopt import FancyGetopt, translate_longopt ! from distutils.util import check_environ, strtobool --- 16,20 ---- from distutils import sysconfig from distutils.fancy_getopt import FancyGetopt, translate_longopt ! from distutils.util import check_environ, strtobool, rfc822_escape *************** *** 86,89 **** --- 86,93 ---- ('long-description', None, "print the long package description"), + ('platforms', None, + "print the list of platforms"), + ('keywords', None, + "print the list of keywords"), ] display_option_names = map(lambda x: translate_longopt(x[0]), *************** *** 207,213 **** "invalid distribution option '%s'" % key ! if self.metadata.version is None: ! raise DistutilsSetupError, \ ! "No version number specified for distribution" # __init__ () --- 211,215 ---- "invalid distribution option '%s'" % key ! self.finalize_options() # __init__ () *************** *** 527,530 **** --- 529,554 ---- + def finalize_options (self): + """Set final values for all the options on the Distribution + instance, analogous to the .finalize_options() method of Command + objects. + """ + + if self.metadata.version is None: + raise DistutilsSetupError, \ + "No version number specified for distribution" + + keywords = self.metadata.keywords + if keywords is not None: + if type(keywords) is StringType: + keywordlist = string.split(keywords, ',') + self.metadata.keywords = map(string.strip, keywordlist) + + platforms = self.metadata.platforms + if platforms is not None: + if type(platforms) is StringType: + platformlist = string.split(platforms, ',') + self.metadata.platforms = map(string.strip, platformlist) + def _show_help (self, parser, *************** *** 608,612 **** if val and is_display_option.get(opt): opt = translate_longopt(opt) ! print getattr(self.metadata, "get_"+opt)() any_display_options = 1 --- 632,640 ---- if val and is_display_option.get(opt): opt = translate_longopt(opt) ! value = getattr(self.metadata, "get_"+opt)() ! if opt in ['keywords', 'platforms']: ! print string.join(value, ',') ! else: ! print value any_display_options = 1 *************** *** 951,955 **** --- 979,1014 ---- self.description = None self.long_description = None + self.keywords = None + self.platforms = None + + def write_pkg_info (self, base_dir): + """Write the PKG-INFO file into the release tree. + """ + + pkg_info = open( os.path.join(base_dir, 'PKG-INFO'), 'w') + + pkg_info.write('Metadata-Version: 1.0\n') + pkg_info.write('Name: %s\n' % self.get_name() ) + pkg_info.write('Version: %s\n' % self.get_version() ) + pkg_info.write('Summary: %s\n' % self.get_description() ) + pkg_info.write('Home-page: %s\n' % self.get_url() ) + pkg_info.write('Author: %s\n' % self.get_maintainer() ) + pkg_info.write('Author-email: %s\n' % self.get_maintainer_email() ) + pkg_info.write('License: %s\n' % self.get_licence() ) + + long_desc = rfc822_escape( self.get_long_description() ) + pkg_info.write('Description: %s\n' % long_desc) + + keywords = string.join( self.get_keywords(), ',') + if keywords: + pkg_info.write('Keywords: %s\n' % keywords ) + + for platform in self.get_platforms(): + pkg_info.write('Platform: %s\n' % platform ) + + pkg_info.close() + # write_pkg_info () + # -- Metadata query methods ---------------------------------------- *************** *** 996,999 **** --- 1055,1064 ---- def get_long_description(self): return self.long_description or "UNKNOWN" + + def get_keywords(self): + return self.keywords or [] + + def get_platforms(self): + return self.platforms or ["UNKNOWN"] # class DistributionMetadata From akuchling@users.sourceforge.net Thu Mar 22 03:10:07 2001 From: akuchling@users.sourceforge.net (A.M. Kuchling) Date: Wed, 21 Mar 2001 19:10:07 -0800 Subject: [Python-checkins] CVS: distutils/distutils/command sdist.py,1.51,1.52 Message-ID: Update of /cvsroot/python/distutils/distutils/command In directory usw-pr-cvs1:/tmp/cvs-serv766 Modified Files: sdist.py Log Message: Call the write_pkg_info method Index: sdist.py =================================================================== RCS file: /cvsroot/python/distutils/distutils/command/sdist.py,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -r1.51 -r1.52 *** sdist.py 2000/10/14 04:06:40 1.51 --- sdist.py 2001/03/22 03:10:05 1.52 *************** *** 32,36 **** "List of available source distribution formats:") - class sdist (Command): --- 32,35 ---- *************** *** 440,445 **** self.copy_file(file, dest, link=link) # make_release_tree () - def make_distribution (self): --- 439,445 ---- self.copy_file(file, dest, link=link) + self.distribution.metadata.write_pkg_info(base_dir) + # make_release_tree () def make_distribution (self): From akuchling@users.sourceforge.net Thu Mar 22 03:13:05 2001 From: akuchling@users.sourceforge.net (A.M. Kuchling) Date: Wed, 21 Mar 2001 19:13:05 -0800 Subject: [Python-checkins] CVS: distutils CHANGES.txt,1.17,1.18 Message-ID: Update of /cvsroot/python/distutils In directory usw-pr-cvs1:/tmp/cvs-serv966 Modified Files: CHANGES.txt Log Message: Add PKG-INFO to changes Index: CHANGES.txt =================================================================== RCS file: /cvsroot/python/distutils/CHANGES.txt,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** CHANGES.txt 2000/10/15 19:20:56 1.17 --- CHANGES.txt 2001/03/22 03:13:03 1.18 *************** *** 1,2 **** --- 1,8 ---- + Relase 1.0.2pre(XXX, 2001): + -------------------------------- + * the sdist command now writes a PKG-INFO file, as described in PEP 241, + into the release tree. + + Relase 1.0.1 (15 October, 2000): -------------------------------- From akuchling@users.sourceforge.net Thu Mar 22 03:36:50 2001 From: akuchling@users.sourceforge.net (A.M. Kuchling) Date: Wed, 21 Mar 2001 19:36:50 -0800 Subject: [Python-checkins] CVS: distutils CHANGES.txt,1.18,1.19 Message-ID: Update of /cvsroot/python/distutils In directory usw-pr-cvs1:/tmp/cvs-serv3010 Modified Files: CHANGES.txt Log Message: List additional changes made on my watch Index: CHANGES.txt =================================================================== RCS file: /cvsroot/python/distutils/CHANGES.txt,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -r1.18 -r1.19 *** CHANGES.txt 2001/03/22 03:13:03 1.18 --- CHANGES.txt 2001/03/22 03:36:48 1.19 *************** *** 1,6 **** --- 1,36 ---- Relase 1.0.2pre(XXX, 2001): -------------------------------- + * fixes to accommodate the major revisions made to Python's build system + for 2.1. (This will break the Distutils for 1.5.2 and 2.0, though; + it should be made backward compatible.) + + * from Thomas Heller: the installer generated by bdist_wininst now + includes an uninstaller. Other enhancements are: + + --bitmap command line option allows to use a different bitmap + file instead of the built-in python powered logo. + + --title lets you specify the text to display on the + background. + + * from Jack Jansen: added 'get_command_list()' method, and + Mac-specific code to use it to generate a dialog for users to + specify the command-line (because providing a command-line with + MacPython is awkward). + + * applied patches from Jack Jansen for the Mac and the Metrowerks compiler + + * added 'platforms' and 'keywords' to the set of metadata that can be + specified for a distribution. + * the sdist command now writes a PKG-INFO file, as described in PEP 241, into the release tree. + + * applied patches from Jason Tishler to make the compiler class work with + Cygwin. + + * it's now compulsory to supply a version number. + + * various bugfixes From jhylton@users.sourceforge.net Thu Mar 22 03:58:00 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Wed, 21 Mar 2001 19:58:00 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python compile.c,2.192,2.193 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv4870/Python Modified Files: compile.c Log Message: Set the line number correctly for a nested function with an exec or import *. Mark the offending stmt rather than the function def line. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.192 retrieving revision 2.193 diff -C2 -r2.192 -r2.193 *** compile.c 2001/03/22 03:51:05 2.192 --- compile.c 2001/03/22 03:57:58 2.193 *************** *** 4242,4246 **** PyErr_SetString(PyExc_SyntaxError, buf); PyErr_SyntaxLocation(c->c_symtable->st_filename, ! ste->ste_lineno); return -1; } --- 4242,4246 ---- PyErr_SetString(PyExc_SyntaxError, buf); PyErr_SyntaxLocation(c->c_symtable->st_filename, ! ste->ste_opt_lineno); return -1; } *************** *** 4821,4826 **** if (NCH(n) > 2) symtable_node(st, CHILD(n, 3)); ! else st->st_cur->ste_optimized |= OPT_BARE_EXEC; if (NCH(n) > 4) symtable_node(st, CHILD(n, 5)); --- 4821,4828 ---- if (NCH(n) > 2) symtable_node(st, CHILD(n, 3)); ! else { st->st_cur->ste_optimized |= OPT_BARE_EXEC; + st->st_cur->ste_opt_lineno = n->n_lineno; + } if (NCH(n) > 4) symtable_node(st, CHILD(n, 5)); *************** *** 5107,5110 **** --- 5109,5113 ---- if (TYPE(CHILD(n, 3)) == STAR) { st->st_cur->ste_optimized |= OPT_IMPORT_STAR; + st->st_cur->ste_opt_lineno = n->n_lineno; } else { for (i = 3; i < NCH(n); i += 2) { From akuchling@users.sourceforge.net Thu Mar 22 03:48:33 2001 From: akuchling@users.sourceforge.net (A.M. Kuchling) Date: Wed, 21 Mar 2001 19:48:33 -0800 Subject: [Python-checkins] CVS: distutils/distutils cmd.py,1.26,1.27 cygwinccompiler.py,1.10,1.11 extension.py,1.7,1.8 version.py,1.4,1.5 Message-ID: Update of /cvsroot/python/distutils/distutils In directory usw-pr-cvs1:/tmp/cvs-serv3995 Modified Files: cmd.py cygwinccompiler.py extension.py version.py Log Message: Back out conversion to string methods; the Distutils is intended to work with 1.5.2 Index: cmd.py =================================================================== RCS file: /cvsroot/python/distutils/distutils/cmd.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -r1.26 -r1.27 *** cmd.py 2001/02/09 11:15:58 1.26 --- cmd.py 2001/03/22 03:48:31 1.27 *************** *** 10,14 **** __revision__ = "$Id$" ! import sys, os, re from types import * from distutils.errors import * --- 10,14 ---- __revision__ = "$Id$" ! import sys, os, string, re from types import * from distutils.errors import * *************** *** 162,166 **** indent = indent + " " for (option, _, _) in self.user_options: ! option = option.translate(longopt_xlate) if option[-1] == "=": option = option[:-1] --- 162,166 ---- indent = indent + " " for (option, _, _) in self.user_options: ! option = string.translate(option, longopt_xlate) if option[-1] == "=": option = option[:-1] *************** *** 422,426 **** if exec_msg is None: exec_msg = "generating %s from %s" % \ ! (outfile, ', '.join(infiles)) if skip_msg is None: skip_msg = "skipping %s (inputs unchanged)" % outfile --- 422,426 ---- if exec_msg is None: exec_msg = "generating %s from %s" % \ ! (outfile, string.join(infiles, ', ')) if skip_msg is None: skip_msg = "skipping %s (inputs unchanged)" % outfile Index: cygwinccompiler.py =================================================================== RCS file: /cvsroot/python/distutils/distutils/cygwinccompiler.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** cygwinccompiler.py 2001/02/09 12:14:02 1.10 --- cygwinccompiler.py 2001/03/22 03:48:31 1.11 *************** *** 366,373 **** from distutils import sysconfig ! import sys # if sys.version contains GCC then python was compiled with # GCC, and the config.h file should be OK ! if sys.version.find("GCC") >= 0: return (CONFIG_H_OK, "sys.version mentions 'GCC'") --- 366,373 ---- from distutils import sysconfig ! import string,sys # if sys.version contains GCC then python was compiled with # GCC, and the config.h file should be OK ! if string.find(sys.version,"GCC") >= 0: return (CONFIG_H_OK, "sys.version mentions 'GCC'") *************** *** 388,392 **** else: # "config.h" contains an "#ifdef __GNUC__" or something similar ! if s.find("__GNUC__") >= 0: return (CONFIG_H_OK, "'%s' mentions '__GNUC__'" % fn) else: --- 388,392 ---- else: # "config.h" contains an "#ifdef __GNUC__" or something similar ! if string.find(s,"__GNUC__") >= 0: return (CONFIG_H_OK, "'%s' mentions '__GNUC__'" % fn) else: Index: extension.py =================================================================== RCS file: /cvsroot/python/distutils/distutils/extension.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** extension.py 2001/02/09 12:20:51 1.7 --- extension.py 2001/03/22 03:48:31 1.8 *************** *** 8,12 **** __revision__ = "$Id$" ! import os from types import * --- 8,12 ---- __revision__ = "$Id$" ! import os, string from types import * *************** *** 169,173 **** ext.include_dirs.append(value) elif switch == "-D": ! equals = value.find("=") if equals == -1: # bare "-DFOO" -- no value ext.define_macros.append((value, None)) --- 169,173 ---- ext.include_dirs.append(value) elif switch == "-D": ! equals = string.find(value, "=") if equals == -1: # bare "-DFOO" -- no value ext.define_macros.append((value, None)) Index: version.py =================================================================== RCS file: /cvsroot/python/distutils/distutils/version.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** version.py 2001/02/09 12:19:54 1.4 --- version.py 2001/03/22 03:48:31 1.5 *************** *** 113,122 **** if patch: ! self.version = tuple(map(int, [major, minor, patch])) else: ! self.version = tuple(map(int, [major, minor]) + [0]) if prerelease: ! self.prerelease = (prerelease[0], int(prerelease_num)) else: self.prerelease = None --- 113,122 ---- if patch: ! self.version = tuple(map(string.atoi, [major, minor, patch])) else: ! self.version = tuple(map(string.atoi, [major, minor]) + [0]) if prerelease: ! self.prerelease = (prerelease[0], string.atoi(prerelease_num)) else: self.prerelease = None *************** *** 126,132 **** if self.version[2] == 0: ! vstring = '.'.join(map(str, self.version[0:2])) else: ! vstring = '.'.join(map(str, self.version)) if self.prerelease: --- 126,132 ---- if self.version[2] == 0: ! vstring = string.join(map(str, self.version[0:2]), '.') else: ! vstring = string.join(map(str, self.version), '.') if self.prerelease: From jhylton@users.sourceforge.net Thu Mar 22 03:58:00 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Wed, 21 Mar 2001 19:58:00 -0800 Subject: [Python-checkins] CVS: python/dist/src/Include symtable.h,2.6,2.7 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv4870/Include Modified Files: symtable.h Log Message: Set the line number correctly for a nested function with an exec or import *. Mark the offending stmt rather than the function def line. Index: symtable.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/symtable.h,v retrieving revision 2.6 retrieving revision 2.7 diff -C2 -r2.6 -r2.7 *** symtable.h 2001/02/28 23:03:39 2.6 --- symtable.h 2001/03/22 03:57:58 2.7 *************** *** 47,50 **** --- 47,51 ---- int ste_child_free; /* true if a child scope has free variables, including free refs to globals */ + int ste_opt_lineno; /* lineno of last exec or import * */ struct symtable *ste_table; } PySymtableEntryObject; From jhylton@users.sourceforge.net Thu Mar 22 03:51:07 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Wed, 21 Mar 2001 19:51:07 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python compile.c,2.191,2.192 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv4350/Python Modified Files: compile.c Log Message: Make error messages clearer for illegal combinations of nested functions and import */exec. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.191 retrieving revision 2.192 diff -C2 -r2.191 -r2.192 *** compile.c 2001/03/22 02:32:48 2.191 --- compile.c 2001/03/22 03:51:05 2.192 *************** *** 4192,4221 **** return 0; #define ILLEGAL_IMPORT_STAR \ ! "import * is not allowed in function '%.100s' " \ ! "because it contains a nested function with free variables" #define ILLEGAL_BARE_EXEC \ ! "unqualified exec is not allowed in function '%.100s' " \ ! "because it contains a nested function with free variables" #define ILLEGAL_EXEC_AND_IMPORT_STAR \ "function '%.100s' uses import * and bare exec, which are illegal" \ ! "because it contains a nested function with free variables" /* XXX perhaps the linenos for these opt-breaking statements should be stored so the exception can point to them. */ ! if (ste->ste_optimized == OPT_IMPORT_STAR) ! sprintf(buf, ILLEGAL_IMPORT_STAR, ! PyString_AS_STRING(ste->ste_name)); ! else if (ste->ste_optimized == (OPT_BARE_EXEC | OPT_EXEC)) ! sprintf(buf, ILLEGAL_BARE_EXEC, ! PyString_AS_STRING(ste->ste_name)); ! else { ! sprintf(buf, ILLEGAL_EXEC_AND_IMPORT_STAR, ! PyString_AS_STRING(ste->ste_name)); } ! if (c->c_symtable->st_nested_scopes) { PyErr_SetString(PyExc_SyntaxError, buf); --- 4192,4242 ---- return 0; + #define ILLEGAL_CONTAINS "contains a nested function with free variables" + + #define ILLEGAL_IS "is a nested function" + #define ILLEGAL_IMPORT_STAR \ ! "import * is not allowed in function '%.100s' because it %s" #define ILLEGAL_BARE_EXEC \ ! "unqualified exec is not allowed in function '%.100s' it %s" #define ILLEGAL_EXEC_AND_IMPORT_STAR \ "function '%.100s' uses import * and bare exec, which are illegal" \ ! "because it %s" /* XXX perhaps the linenos for these opt-breaking statements should be stored so the exception can point to them. */ ! if (ste->ste_child_free) { ! if (ste->ste_optimized == OPT_IMPORT_STAR) ! sprintf(buf, ILLEGAL_IMPORT_STAR, ! PyString_AS_STRING(ste->ste_name), ! ILLEGAL_CONTAINS); ! else if (ste->ste_optimized == (OPT_BARE_EXEC | OPT_EXEC)) ! sprintf(buf, ILLEGAL_BARE_EXEC, ! PyString_AS_STRING(ste->ste_name), ! ILLEGAL_CONTAINS); ! else { ! sprintf(buf, ILLEGAL_EXEC_AND_IMPORT_STAR, ! PyString_AS_STRING(ste->ste_name), ! ILLEGAL_CONTAINS); ! } ! } else { ! if (ste->ste_optimized == OPT_IMPORT_STAR) ! sprintf(buf, ILLEGAL_IMPORT_STAR, ! PyString_AS_STRING(ste->ste_name), ! ILLEGAL_IS); ! else if (ste->ste_optimized == (OPT_BARE_EXEC | OPT_EXEC)) ! sprintf(buf, ILLEGAL_BARE_EXEC, ! PyString_AS_STRING(ste->ste_name), ! ILLEGAL_IS); ! else { ! sprintf(buf, ILLEGAL_EXEC_AND_IMPORT_STAR, ! PyString_AS_STRING(ste->ste_name), ! ILLEGAL_IS); ! } } ! if (c->c_symtable->st_nested_scopes) { PyErr_SetString(PyExc_SyntaxError, buf); From akuchling@users.sourceforge.net Thu Mar 22 03:50:11 2001 From: akuchling@users.sourceforge.net (A.M. Kuchling) Date: Wed, 21 Mar 2001 19:50:11 -0800 Subject: [Python-checkins] CVS: distutils/distutils cygwinccompiler.py,1.11,1.12 Message-ID: Update of /cvsroot/python/distutils/distutils In directory usw-pr-cvs1:/tmp/cvs-serv4237 Modified Files: cygwinccompiler.py Log Message: Remove redundant import Index: cygwinccompiler.py =================================================================== RCS file: /cvsroot/python/distutils/distutils/cygwinccompiler.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** cygwinccompiler.py 2001/03/22 03:48:31 1.11 --- cygwinccompiler.py 2001/03/22 03:50:09 1.12 *************** *** 366,370 **** from distutils import sysconfig ! import string,sys # if sys.version contains GCC then python was compiled with # GCC, and the config.h file should be OK --- 366,370 ---- from distutils import sysconfig ! import string # if sys.version contains GCC then python was compiled with # GCC, and the config.h file should be OK From purcell@users.sourceforge.net Thu Mar 22 08:45:38 2001 From: purcell@users.sourceforge.net (Steve Purcell) Date: Thu, 22 Mar 2001 00:45:38 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_support.py,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv32369/Lib/test Modified Files: test_support.py Log Message: Updated to latest PyUnit version (1.31 in PyUnit CVS); test_support.py changed accordingly. Index: test_support.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_support.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -r1.18 -r1.19 *** test_support.py 2001/03/21 18:26:33 1.18 --- test_support.py 2001/03/22 08:45:36 1.19 *************** *** 103,112 **** ! class BasicTestRunner(unittest.VerboseTextTestRunner): ! def __init__(self, stream=sys.stderr): ! unittest.VerboseTextTestRunner.__init__(self, stream, descriptions=0) ! def run(self, test): ! result = unittest._VerboseTextTestResult(self.stream, descriptions=0) test(result) return result --- 103,109 ---- ! class BasicTestRunner: def run(self, test): ! result = unittest.TestResult() test(result) return result *************** *** 116,127 **** """Run tests from a unittest.TestCase-derived class.""" if verbose: ! f = sys.stdout else: ! import StringIO ! f = StringIO.StringIO() suite = unittest.makeSuite(testclass) ! result = BasicTestRunner(stream=f).run(suite) ! if result.errors or result.failures: raise TestFailed("errors occurred in %s.%s" % (testclass.__module__, testclass.__name__)) --- 113,123 ---- """Run tests from a unittest.TestCase-derived class.""" if verbose: ! runner = unittest.TextTestRunner(sys.stdout, descriptions=0) else: ! runner = BasicTestRunner() suite = unittest.makeSuite(testclass) ! result = runner.run(suite) ! if not result.wasSuccessful(): raise TestFailed("errors occurred in %s.%s" % (testclass.__module__, testclass.__name__)) From purcell@users.sourceforge.net Thu Mar 22 08:45:38 2001 From: purcell@users.sourceforge.net (Steve Purcell) Date: Thu, 22 Mar 2001 00:45:38 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib unittest.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv32369/Lib Modified Files: unittest.py Log Message: Updated to latest PyUnit version (1.31 in PyUnit CVS); test_support.py changed accordingly. Index: unittest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/unittest.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** unittest.py 2001/03/21 18:09:46 1.1 --- unittest.py 2001/03/22 08:45:36 1.2 *************** *** 1,11 **** #!/usr/bin/env python ! """ Python unit testing framework, based on Erich Gamma's JUnit and Kent Beck's Smalltalk testing framework. - Further information is available in the bundled documentation, and from - - http://pyunit.sourceforge.net/ - This module contains the core framework classes that form the basis of specific test cases and suites (TestCase, TestSuite etc.), and also a --- 1,7 ---- #!/usr/bin/env python ! ''' Python unit testing framework, based on Erich Gamma's JUnit and Kent Beck's Smalltalk testing framework. This module contains the core framework classes that form the basis of specific test cases and suites (TestCase, TestSuite etc.), and also a *************** *** 13,16 **** --- 9,31 ---- (TextTestRunner). + Simple usage: + + import unittest + + class IntegerArithmenticTestCase(unittest.TestCase): + def testAdd(self): ## test method names begin 'test*' + self.assertEquals((1 + 2), 3) + self.assertEquals(0 + 1, 1) + def testMultiply(self); + self.assertEquals((0 * 10), 0) + self.assertEquals((5 * 8), 40) + + if __name__ == '__main__': + unittest.main() + + Further information is available in the bundled documentation, and from + + http://pyunit.sourceforge.net/ + Copyright (c) 1999, 2000, 2001 Steve Purcell This module is free software, and you may redistribute it and/or modify *************** *** 28,34 **** AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. ! """ ! __author__ = "Steve Purcell (stephen_purcell@yahoo.com)" __version__ = "$Revision$"[11:-2] --- 43,50 ---- AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. ! ''' ! __author__ = "Steve Purcell" ! __email__ = "stephen_purcell at yahoo dot com" __version__ = "$Revision$"[11:-2] *************** *** 38,52 **** import string import os ############################################################################## - # A platform-specific concession to help the code work for JPython users - ############################################################################## - - plat = string.lower(sys.platform) - _isJPython = string.find(plat, 'java') >= 0 or string.find(plat, 'jdk') >= 0 - del plat - - - ############################################################################## # Test framework core ############################################################################## --- 54,60 ---- import string import os + import types ############################################################################## # Test framework core ############################################################################## *************** *** 85,88 **** --- 93,100 ---- self.failures.append((test, err)) + def addSuccess(self, test): + "Called when a test has completed successfully" + pass + def wasSuccessful(self): "Tells whether or not this result was a success" *************** *** 102,116 **** """A class whose instances are single test cases. - Test authors should subclass TestCase for their own tests. Construction - and deconstruction of the test's environment ('fixture') can be - implemented by overriding the 'setUp' and 'tearDown' methods respectively. - By default, the test code itself should be placed in a method named 'runTest'. ! If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute. """ def __init__(self, methodName='runTest'): --- 114,134 ---- """A class whose instances are single test cases. By default, the test code itself should be placed in a method named 'runTest'. ! If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute. + + Test authors should subclass TestCase for their own tests. Construction + and deconstruction of the test's environment ('fixture') can be + implemented by overriding the 'setUp' and 'tearDown' methods respectively. + + If it is necessary to override the __init__ method, the base class + __init__ method must always be called. It is important that subclasses + should not change the signature of their __init__ method, since instances + of the classes are instantiated automatically by parts of the framework + in order to be run. """ def __init__(self, methodName='runTest'): *************** *** 120,124 **** """ try: ! self.__testMethod = getattr(self,methodName) except AttributeError: raise ValueError, "no such test method in %s: %s" % \ --- 138,144 ---- """ try: ! self.__testMethodName = methodName ! testMethod = getattr(self, methodName) ! self.__testMethodDoc = testMethod.__doc__ except AttributeError: raise ValueError, "no such test method in %s: %s" % \ *************** *** 146,161 **** the specified test method's docstring. """ ! doc = self.__testMethod.__doc__ return doc and string.strip(string.split(doc, "\n")[0]) or None def id(self): ! return "%s.%s" % (self.__class__, self.__testMethod.__name__) def __str__(self): ! return "%s (%s)" % (self.__testMethod.__name__, self.__class__) def __repr__(self): return "<%s testMethod=%s>" % \ ! (self.__class__, self.__testMethod.__name__) def run(self, result=None): --- 166,181 ---- the specified test method's docstring. """ ! doc = self.__testMethodDoc return doc and string.strip(string.split(doc, "\n")[0]) or None def id(self): ! return "%s.%s" % (self.__class__, self.__testMethodName) def __str__(self): ! return "%s (%s)" % (self.__testMethodName, self.__class__) def __repr__(self): return "<%s testMethod=%s>" % \ ! (self.__class__, self.__testMethodName) def run(self, result=None): *************** *** 165,168 **** --- 185,189 ---- if result is None: result = self.defaultTestResult() result.startTest(self) + testMethod = getattr(self, self.__testMethodName) try: try: *************** *** 172,177 **** return try: ! self.__testMethod() except AssertionError, e: result.addFailure(self,self.__exc_info()) --- 193,200 ---- return + ok = 0 try: ! testMethod() ! ok = 1 except AssertionError, e: result.addFailure(self,self.__exc_info()) *************** *** 183,192 **** except: result.addError(self,self.__exc_info()) finally: result.stopTest(self) def debug(self): self.setUp() ! self.__testMethod() self.tearDown() --- 206,218 ---- except: result.addError(self,self.__exc_info()) + ok = 0 + if ok: result.addSuccess(self) finally: result.stopTest(self) def debug(self): + """Run the test without collecting errors in a TestResult""" self.setUp() ! getattr(self, self.__testMethodName)() self.tearDown() *************** *** 221,228 **** raise AssertionError, excName def fail(self, msg=None): """Fail immediately, with the given message.""" raise AssertionError, msg ! def __exc_info(self): """Return a version of sys.exc_info() with the traceback frame --- 247,270 ---- raise AssertionError, excName + def assertEquals(self, first, second, msg=None): + """Assert that the two objects are equal as determined by the '==' + operator. + """ + self.assert_((first == second), msg or '%s != %s' % (first, second)) + + def assertNotEquals(self, first, second, msg=None): + """Assert that the two objects are unequal as determined by the '!=' + operator. + """ + self.assert_((first != second), msg or '%s == %s' % (first, second)) + + assertEqual = assertEquals + + assertNotEqual = assertNotEquals + def fail(self, msg=None): """Fail immediately, with the given message.""" raise AssertionError, msg ! def __exc_info(self): """Return a version of sys.exc_info() with the traceback frame *************** *** 279,284 **** def debug(self): for test in self._tests: test.debug() - --- 321,326 ---- def debug(self): + """Run the tests without collecting errors in a TestResult""" for test in self._tests: test.debug() *************** *** 328,412 **** ############################################################################## ! # Convenience functions ############################################################################## ! def getTestCaseNames(testCaseClass, prefix, sortUsing=cmp): ! """Extracts all the names of functions in the given test case class ! and its base classes that start with the given prefix. This is used ! by makeSuite(). """ ! testFnNames = filter(lambda n,p=prefix: n[:len(p)] == p, ! dir(testCaseClass)) ! for baseclass in testCaseClass.__bases__: ! testFnNames = testFnNames + \ ! getTestCaseNames(baseclass, prefix, sortUsing=None) ! if sortUsing: ! testFnNames.sort(sortUsing) ! return testFnNames ! def makeSuite(testCaseClass, prefix='test', sortUsing=cmp): ! """Returns a TestSuite instance built from all of the test functions ! in the given test case class whose names begin with the given ! prefix. The cases are sorted by their function names ! using the supplied comparison function, which defaults to 'cmp'. ! """ ! cases = map(testCaseClass, ! getTestCaseNames(testCaseClass, prefix, sortUsing)) ! return TestSuite(cases) ! ! ! def createTestInstance(name, module=None): ! """Finds tests by their name, optionally only within the given module. ! ! Return the newly-constructed test, ready to run. If the name contains a ':' ! then the portion of the name after the colon is used to find a specific ! test case within the test case class named before the colon. ! ! Examples: ! findTest('examples.listtests.suite') ! -- returns result of calling 'suite' ! findTest('examples.listtests.ListTestCase:checkAppend') ! -- returns result of calling ListTestCase('checkAppend') ! findTest('examples.listtests.ListTestCase:check-') ! -- returns result of calling makeSuite(ListTestCase, prefix="check") ! """ ! ! spec = string.split(name, ':') ! if len(spec) > 2: raise ValueError, "illegal test name: %s" % name ! if len(spec) == 1: ! testName = spec[0] ! caseName = None ! else: ! testName, caseName = spec ! parts = string.split(testName, '.') ! if module is None: ! if len(parts) < 2: ! raise ValueError, "incomplete test name: %s" % name ! constructor = __import__(string.join(parts[:-1],'.')) ! parts = parts[1:] ! else: ! constructor = module ! for part in parts: ! constructor = getattr(constructor, part) ! if not callable(constructor): ! raise ValueError, "%s is not a callable object" % constructor ! if caseName: ! if caseName[-1] == '-': ! prefix = caseName[:-1] ! if not prefix: ! raise ValueError, "prefix too short: %s" % name ! test = makeSuite(constructor, prefix=prefix) else: ! test = constructor(caseName) ! else: ! test = constructor() ! if not hasattr(test,"countTestCases"): ! raise TypeError, \ ! "object %s found with spec %s is not a test" % (test, name) ! return test ############################################################################## # Text UI ############################################################################## --- 370,470 ---- ############################################################################## ! # Locating and loading tests ############################################################################## ! class TestLoader: ! """This class is responsible for loading tests according to various ! criteria and returning them wrapped in a Test ! ! It can load all tests within a given, module """ ! testMethodPrefix = 'test' ! sortTestMethodsUsing = cmp ! suiteClass = TestSuite + def loadTestsFromTestCase(self, testCaseClass): + return self.suiteClass(map(testCaseClass, + self.getTestCaseNames(testCaseClass))) ! def loadTestsFromModule(self, module): ! tests = [] ! for name in dir(module): ! obj = getattr(module, name) ! if type(obj) == types.ClassType and issubclass(obj, TestCase): ! tests.append(self.loadTestsFromTestCase(obj)) ! return self.suiteClass(tests) ! ! def loadTestsFromName(self, name, module=None): ! parts = string.split(name, '.') ! if module is None: ! if not parts: ! raise ValueError, "incomplete test name: %s" % name ! else: ! module = __import__(parts) ! parts = parts[1:] ! obj = module ! for part in parts: ! obj = getattr(obj, part) ! ! if type(obj) == types.ModuleType: ! return self.loadTestsFromModule(obj) ! elif type(obj) == types.ClassType and issubclass(obj, TestCase): ! return self.loadTestsFromTestCase(obj) ! elif type(obj) == types.UnboundMethodType: ! return obj.im_class(obj.__name__) ! elif callable(obj): ! test = obj() ! if not isinstance(test, TestCase) and \ ! not isinstance(test, TestSuite): ! raise ValueError, \ ! "calling %s returned %s, not a test" % obj,test ! return test else: ! raise ValueError, "don't know how to make test from: %s" % obj ! ! def loadTestsFromNames(self, names, module=None): ! suites = [] ! for name in names: ! suites.append(self.loadTestsFromName(name, module)) ! return self.suiteClass(suites) ! ! def getTestCaseNames(self, testCaseClass): ! testFnNames = filter(lambda n,p=self.testMethodPrefix: n[:len(p)] == p, ! dir(testCaseClass)) ! for baseclass in testCaseClass.__bases__: ! for testFnName in self.getTestCaseNames(baseclass): ! if testFnName not in testFnNames: # handle overridden methods ! testFnNames.append(testFnName) ! if self.sortTestMethodsUsing: ! testFnNames.sort(self.sortTestMethodsUsing) ! return testFnNames ! ! + defaultTestLoader = TestLoader() + + ############################################################################## + # Patches for old functions: these functions should be considered obsolete ############################################################################## + + def _makeLoader(prefix, sortUsing, suiteClass=None): + loader = TestLoader() + loader.sortTestMethodsUsing = sortUsing + loader.testMethodPrefix = prefix + if suiteClass: loader.suiteClass = suiteClass + return loader + + def getTestCaseNames(testCaseClass, prefix, sortUsing=cmp): + return _makeLoader(prefix, sortUsing).getTestCaseNames(testCaseClass) + + def makeSuite(testCaseClass, prefix='test', sortUsing=cmp, suiteClass=TestSuite): + return _makeLoader(prefix, sortUsing, suiteClass).loadTestsFromTestCase(testCaseClass) + + def findTestCases(module, prefix='test', sortUsing=cmp, suiteClass=TestSuite): + return _makeLoader(prefix, sortUsing, suiteClass).loadTestsFromModule(module) + + + ############################################################################## # Text UI ############################################################################## *************** *** 416,424 **** def __init__(self,stream): self.stream = stream - if _isJPython: - import java.lang.System - self.linesep = java.lang.System.getProperty("line.separator") - else: - self.linesep = os.linesep def __getattr__(self, attr): --- 474,477 ---- *************** *** 427,550 **** def writeln(self, *args): if args: apply(self.write, args) ! self.write(self.linesep) ! ! ! class _JUnitTextTestResult(TestResult): ! """A test result class that can print formatted text results to a stream. ! ! Used by JUnitTextTestRunner. ! """ ! def __init__(self, stream): ! self.stream = stream ! TestResult.__init__(self) ! ! def addError(self, test, error): ! TestResult.addError(self,test,error) ! self.stream.write('E') ! self.stream.flush() ! if error[0] is KeyboardInterrupt: ! self.shouldStop = 1 ! ! def addFailure(self, test, error): ! TestResult.addFailure(self,test,error) ! self.stream.write('F') ! self.stream.flush() - def startTest(self, test): - TestResult.startTest(self,test) - self.stream.write('.') - self.stream.flush() - - def printNumberedErrors(self,errFlavour,errors): - if not errors: return - if len(errors) == 1: - self.stream.writeln("There was 1 %s:" % errFlavour) - else: - self.stream.writeln("There were %i %ss:" % - (len(errors), errFlavour)) - i = 1 - for test,error in errors: - errString = string.join(apply(traceback.format_exception,error),"") - self.stream.writeln("%i) %s" % (i, test)) - self.stream.writeln(errString) - i = i + 1 - - def printErrors(self): - self.printNumberedErrors("error",self.errors) - - def printFailures(self): - self.printNumberedErrors("failure",self.failures) - - def printHeader(self): - self.stream.writeln() - if self.wasSuccessful(): - self.stream.writeln("OK (%i tests)" % self.testsRun) - else: - self.stream.writeln("!!!FAILURES!!!") - self.stream.writeln("Test Results") - self.stream.writeln() - self.stream.writeln("Run: %i ; Failures: %i ; Errors: %i" % - (self.testsRun, len(self.failures), - len(self.errors))) - - def printResult(self): - self.printHeader() - self.printErrors() - self.printFailures() - - - class JUnitTextTestRunner: - """A test runner class that displays results in textual form. - - The display format approximates that of JUnit's 'textui' test runner. - This test runner may be removed in a future version of PyUnit. - """ - def __init__(self, stream=sys.stderr): - self.stream = _WritelnDecorator(stream) - - def run(self, test): - "Run the given test case or test suite." - result = _JUnitTextTestResult(self.stream) - startTime = time.time() - test(result) - stopTime = time.time() - self.stream.writeln() - self.stream.writeln("Time: %.3fs" % float(stopTime - startTime)) - result.printResult() - return result ! ! ############################################################################## ! # Verbose text UI ! ############################################################################## ! ! class _VerboseTextTestResult(TestResult): """A test result class that can print formatted text results to a stream. ! Used by VerboseTextTestRunner. """ ! def __init__(self, stream, descriptions): TestResult.__init__(self) self.stream = stream ! self.lastFailure = None self.descriptions = descriptions ! ! def startTest(self, test): ! TestResult.startTest(self, test) if self.descriptions: ! self.stream.write(test.shortDescription() or str(test)) else: ! self.stream.write(str(test)) ! self.stream.write(" ... ") ! def stopTest(self, test): ! TestResult.stopTest(self, test) ! if self.lastFailure is not test: self.stream.writeln("ok") def addError(self, test, err): TestResult.addError(self, test, err) ! self._printError("ERROR", test, err) ! self.lastFailure = test if err[0] is KeyboardInterrupt: self.shouldStop = 1 --- 480,526 ---- def writeln(self, *args): if args: apply(self.write, args) ! self.write('\n') # text-mode streams translate to \r\n if needed ! class _TextTestResult(TestResult): """A test result class that can print formatted text results to a stream. ! Used by TextTestRunner. """ ! separator1 = '=' * 70 ! separator2 = '-' * 70 ! ! def __init__(self, stream, descriptions, verbosity): TestResult.__init__(self) self.stream = stream ! self.showAll = verbosity > 1 ! self.dots = verbosity == 1 self.descriptions = descriptions ! ! def getDescription(self, test): if self.descriptions: ! return test.shortDescription() or str(test) else: ! return str(test) ! def startTest(self, test): ! TestResult.startTest(self, test) ! if self.showAll: ! self.stream.write(self.getDescription(test)) ! self.stream.write(" ... ") ! ! def addSuccess(self, test): ! TestResult.addSuccess(self, test) ! if self.showAll: self.stream.writeln("ok") + elif self.dots: + self.stream.write('.') def addError(self, test, err): TestResult.addError(self, test, err) ! if self.showAll: ! self.stream.writeln("ERROR") ! elif self.dots: ! self.stream.write('E') if err[0] is KeyboardInterrupt: self.shouldStop = 1 *************** *** 552,574 **** def addFailure(self, test, err): TestResult.addFailure(self, test, err) ! self._printError("FAIL", test, err) ! self.lastFailure = test ! def _printError(self, flavour, test, err): ! errLines = [] ! separator1 = "\t" + '=' * 70 ! separator2 = "\t" + '-' * 70 ! if not self.lastFailure is test: self.stream.writeln() ! self.stream.writeln(separator1) ! self.stream.writeln("\t%s" % flavour) ! self.stream.writeln(separator2) ! for line in apply(traceback.format_exception, err): ! for l in string.split(line,"\n")[:-1]: ! self.stream.writeln("\t%s" % l) ! self.stream.writeln(separator1) ! class VerboseTextTestRunner: """A test runner class that displays results in textual form. --- 528,553 ---- def addFailure(self, test, err): TestResult.addFailure(self, test, err) ! if self.showAll: ! self.stream.writeln("FAIL") ! elif self.dots: ! self.stream.write('F') ! def printErrors(self): ! if self.dots or self.showAll: self.stream.writeln() ! self.printErrorList('ERROR', self.errors) ! self.printErrorList('FAIL', self.failures) ! ! def printErrorList(self, flavour, errors): ! for test, err in errors: ! self.stream.writeln(self.separator1) ! self.stream.writeln("%s: %s" % (flavour,self.getDescription(test))) ! self.stream.writeln(self.separator2) ! for line in apply(traceback.format_exception, err): ! for l in string.split(line,"\n")[:-1]: ! self.stream.writeln("%s" % l) ! class TextTestRunner: """A test runner class that displays results in textual form. *************** *** 576,594 **** occur, and a summary of the results at the end of the test run. """ ! def __init__(self, stream=sys.stderr, descriptions=1): self.stream = _WritelnDecorator(stream) self.descriptions = descriptions def run(self, test): "Run the given test case or test suite." ! result = _VerboseTextTestResult(self.stream, self.descriptions) startTime = time.time() test(result) stopTime = time.time() timeTaken = float(stopTime - startTime) ! self.stream.writeln("-" * 78) run = result.testsRun self.stream.writeln("Ran %d test%s in %.3fs" % ! (run, run > 1 and "s" or "", timeTaken)) self.stream.writeln() if not result.wasSuccessful(): --- 555,578 ---- occur, and a summary of the results at the end of the test run. """ ! def __init__(self, stream=sys.stderr, descriptions=1, verbosity=1): self.stream = _WritelnDecorator(stream) self.descriptions = descriptions + self.verbosity = verbosity + def _makeResult(self): + return _TextTestResult(self.stream, self.descriptions, self.verbosity) + def run(self, test): "Run the given test case or test suite." ! result = self._makeResult() startTime = time.time() test(result) stopTime = time.time() timeTaken = float(stopTime - startTime) ! result.printErrors() ! self.stream.writeln(result.separator2) run = result.testsRun self.stream.writeln("Ran %d test%s in %.3fs" % ! (run, run == 1 and "" or "s", timeTaken)) self.stream.writeln() if not result.wasSuccessful(): *************** *** 606,612 **** - # Which flavour of TextTestRunner is the default? - TextTestRunner = VerboseTextTestRunner - ############################################################################## --- 590,593 ---- *************** *** 619,633 **** """ USAGE = """\ ! Usage: %(progName)s [-h|--help] [test[:(casename|prefix-)]] [...] Examples: %(progName)s - run default set of tests %(progName)s MyTestSuite - run suite 'MyTestSuite' ! %(progName)s MyTestCase:checkSomething - run MyTestCase.checkSomething ! %(progName)s MyTestCase:check- - run all 'check*' test methods in MyTestCase """ def __init__(self, module='__main__', defaultTest=None, ! argv=None, testRunner=None): if type(module) == type(''): self.module = __import__(module) --- 600,619 ---- """ USAGE = """\ ! Usage: %(progName)s [options] [test[:(casename|prefix-)]] [...] + Options: + -h, --help Show this message + -v, --verbose Verbose output + -q, --quiet Minimal output + Examples: %(progName)s - run default set of tests %(progName)s MyTestSuite - run suite 'MyTestSuite' ! %(progName)s MyTestCase.testSomething - run MyTestCase.testSomething ! %(progName)s MyTestCase - run all 'test*' test methods in MyTestCase """ def __init__(self, module='__main__', defaultTest=None, ! argv=None, testRunner=None, testLoader=defaultTestLoader): if type(module) == type(''): self.module = __import__(module) *************** *** 638,646 **** if argv is None: argv = sys.argv self.defaultTest = defaultTest self.testRunner = testRunner self.progName = os.path.basename(argv[0]) self.parseArgs(argv) - self.createTests() self.runTests() --- 624,633 ---- if argv is None: argv = sys.argv + self.verbosity = 1 self.defaultTest = defaultTest self.testRunner = testRunner + self.testLoader = testLoader self.progName = os.path.basename(argv[0]) self.parseArgs(argv) self.runTests() *************** *** 653,679 **** import getopt try: ! options, args = getopt.getopt(argv[1:], 'hH', ['help']) opts = {} for opt, value in options: if opt in ('-h','-H','--help'): self.usageExit() if len(args) == 0 and self.defaultTest is None: ! raise getopt.error, "No default test is defined." if len(args) > 0: self.testNames = args else: self.testNames = (self.defaultTest,) except getopt.error, msg: self.usageExit(msg) def createTests(self): ! tests = [] ! for testName in self.testNames: ! tests.append(createTestInstance(testName, self.module)) ! self.test = TestSuite(tests) def runTests(self): if self.testRunner is None: ! self.testRunner = TextTestRunner() result = self.testRunner.run(self.test) sys.exit(not result.wasSuccessful()) --- 640,671 ---- import getopt try: ! options, args = getopt.getopt(argv[1:], 'hHvq', ! ['help','verbose','quiet']) opts = {} for opt, value in options: if opt in ('-h','-H','--help'): self.usageExit() + if opt in ('-q','--quiet'): + self.verbosity = 0 + if opt in ('-v','--verbose'): + self.verbosity = 2 if len(args) == 0 and self.defaultTest is None: ! self.test = self.testLoader.loadTestsFromModule(self.module) ! return if len(args) > 0: self.testNames = args else: self.testNames = (self.defaultTest,) + self.createTests() except getopt.error, msg: self.usageExit(msg) def createTests(self): ! self.test = self.testLoader.loadTestsFromNames(self.testNames, ! self.module) def runTests(self): if self.testRunner is None: ! self.testRunner = TextTestRunner(verbosity=self.verbosity) result = self.testRunner.run(self.test) sys.exit(not result.wasSuccessful()) From gvanrossum@users.sourceforge.net Thu Mar 22 13:36:13 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 22 Mar 2001 05:36:13 -0800 Subject: [Python-checkins] CVS: python/dist/src/Demo/threads squasher.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Demo/threads In directory usw-pr-cvs1:/tmp/cvs-serv10374 Modified Files: squasher.py Log Message: Add more complete reference. Change a co.back() call to co.tran() -- that's all that's needed. Index: squasher.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/threads/squasher.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** squasher.py 2000/11/08 15:17:49 1.1 --- squasher.py 2001/03/22 13:36:11 1.2 *************** *** 2,5 **** --- 2,6 ---- # # The program is a variation of a Simula 67 program due to Dahl & Hoare, + # (Dahl/Dijkstra/Hoare, Structured Programming; Academic Press, 1972) # who in turn credit the original example to Conway. # *************** *** 44,48 **** def getline(text): for line in string.splitfields(text, '\n'): ! co.back(line) def disassembler(): --- 45,49 ---- def getline(text): for line in string.splitfields(text, '\n'): ! co.tran(codisassembler, line) def disassembler(): From gvanrossum@users.sourceforge.net Thu Mar 22 13:36:41 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 22 Mar 2001 05:36:41 -0800 Subject: [Python-checkins] CVS: python/dist/src/Demo/threads fcmp.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Demo/threads In directory usw-pr-cvs1:/tmp/cvs-serv10591 Modified Files: fcmp.py Log Message: Change co.detach() to co.back() call. Index: fcmp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/threads/fcmp.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** fcmp.py 2000/11/08 15:17:49 1.1 --- fcmp.py 2001/03/22 13:36:39 1.2 *************** *** 10,14 **** fringe(co, x) else: ! co.detach(x) def printinorder( list ): --- 10,14 ---- fringe(co, x) else: ! co.back(x) def printinorder( list ): From gvanrossum@users.sourceforge.net Thu Mar 22 13:43:27 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 22 Mar 2001 05:43:27 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc ACKS,1.86,1.87 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv13026 Modified Files: ACKS Log Message: Added Gordon McMillan. He should've been in there ages ago. Thanks Moshe for noticing! Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.86 retrieving revision 1.87 diff -C2 -r1.86 -r1.87 *** ACKS 2001/03/02 13:37:42 1.86 --- ACKS 2001/03/22 13:43:25 1.87 *************** *** 259,262 **** --- 259,263 ---- Greg McFarlane Michael McLay + Gordon McMillan Caolan McNamara Craig McPheeters From gvanrossum@users.sourceforge.net Thu Mar 22 14:17:24 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 22 Mar 2001 06:17:24 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.135,1.136 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv17393 Modified Files: NEWS Log Message: Add some news for 2.1b2. I'd still like someone else to add news about these packages: - distutils - xml Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.135 retrieving revision 1.136 diff -C2 -r1.135 -r1.136 *** NEWS 2001/03/21 08:01:39 1.135 --- NEWS 2001/03/22 14:17:21 1.136 *************** *** 2,12 **** ================================ Core language, builtins, and interpreter Standard library ! - A new module Tix was added, which wraps the Tix extension library for Tk. ! With that module, it is not necessary to statically link Tix with _tkinter, ! since Tix will be loaded with Tcl's "package require" command. What's New in Python 2.1 beta 1? --- 2,64 ---- ================================ + (Unlisted are many fixed bugs, more documentation, etc.) + Core language, builtins, and interpreter + - The nested scopes work (enabled by "from __future__ import + nested_scopes") is completed; in particular, the future now extends + into code executed through exec, eval() and execfile(), and into the + interactive interpreter. + + - When calling a base class method (e.g. BaseClass.__init__(self)), + this is now allowed even if self is not strictly spoken a class + instance (e.g. when using metaclasses or the Don Beaudry hook). + + - Slice objects are now comparable but not hashable; this prevents + dict[:] from being accepted but meaningless. + + - Complex division is now calculated using less braindead algorithms. + This doesn't change semantics except it's more likely to give useful + results in extreme cases. Complex repr() now uses full precision + like float repr(). + + - sgmllib.py now calls handle_decl() for simple declarations. + Standard library + + - unittest.py, a unit testing framework by Steve Purcell (PyUNIT, + inspired by JUnit), is now part of the standard library. You now + have a choice of two testing frameworks: unittest requires you to + write testcases as separate code, doctest gathers them from + docstrings. Both approaches have their advantages and + disadvantages. + + - A new module Tix was added, which wraps the Tix extension library + for Tk. With that module, it is not necessary to statically link + Tix with _tkinter, since Tix will be loaded with Tcl's "package + require" command. See Demo/tix/. + + - tzparse.py is now obsolete. + + - In gzip.py, the seek() and tell() methods are removed -- they were + non-functional anyway, and it's better if callers can test for their + existence with hasattr(). + + Python/C API + + - PyDict_Next(): it is now safe to call PyDict_SetItem() with a key + that's already in the dictionary during a PyDict_Next() iteration. + This used to fail occasionally when a dictionary resize operation + could be triggered that would rehash all the keys. All other + modifications to the dictionary are still off-limits during a + PyDict_Next() iteration! + + - New extended APIs related to passing compiler variables around. + + - New abstract APIs PyObject_IsInstance(), PyObject_IsSubclass() + implement isinstance() and issubclass(). ! - Py_BuildValue() now has a "D" conversion to create a Python complex ! number from a Py_complex C value. What's New in Python 2.1 beta 1? From twouters@users.sourceforge.net Thu Mar 22 14:50:27 2001 From: twouters@users.sourceforge.net (Thomas Wouters) Date: Thu, 22 Mar 2001 06:50:27 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_pty.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv20291/test Modified Files: test_pty.py Log Message: Allow the process of reading back what we wrote to a pty to transform linefeeds into carriagereturn-linefeeds (which is apparently what IRIX does.) Also add some comments, an extra test and reorganize it a bit. Index: test_pty.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pty.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** test_pty.py 2001/02/09 11:53:06 1.10 --- test_pty.py 2001/03/22 14:50:24 1.11 *************** *** 2,9 **** from test_support import verbose, TestFailed, TestSkipped ! TEST_STRING_1 = "I wish to buy a fish license." ! TEST_STRING_2 = "For my pet fish, Eric." ! TEST_STRING_3 = "And now for something completely different..." ! TEST_STRING_4 = "but you pronounce it throatwobbler mangrove." if verbose: --- 2,7 ---- from test_support import verbose, TestFailed, TestSkipped ! TEST_STRING_1 = "I wish to buy a fish license.\n" ! TEST_STRING_2 = "For my pet fish, Eric.\n" if verbose: *************** *** 31,41 **** raise TestFailed, "slave_fd is not a tty" debug("Writing to slave_fd") ! os.write(slave_fd, TEST_STRING_1) # should check return value ! print os.read(master_fd, 1024) os.write(slave_fd, TEST_STRING_2[:5]) os.write(slave_fd, TEST_STRING_2[5:]) ! print os.read(master_fd, 1024) os.close(slave_fd) --- 29,49 ---- raise TestFailed, "slave_fd is not a tty" + # IRIX apparently turns \n into \r\n. Allow that, but avoid allowing other + # differences (like extra whitespace, trailing garbage, etc.) + debug("Writing to slave_fd") ! os.write(slave_fd, TEST_STRING_1) ! s1 = os.read(master_fd, 1024) ! if s1[-2:] == "\r\n": ! s1 = s1[:-2] + "\n" ! sys.stdout.write(s1) + debug("Writing chunked output") os.write(slave_fd, TEST_STRING_2[:5]) os.write(slave_fd, TEST_STRING_2[5:]) ! s2 = os.read(master_fd, 1024) ! if s2[-2:] == "\r\n": ! s2 = s2[:-2] + "\n" ! sys.stdout.write(s2) os.close(slave_fd) *************** *** 47,70 **** pid, master_fd = pty.fork() if pid == pty.CHILD: ! ## # Please uncomment these when os.isatty() is added. ! ## if not os.isatty(1): ! ## debug("Child's fd 1 is not a tty?!") ! ## os._exit(3) try: - debug("In child, calling os.setsid()") os.setsid() except OSError: # Good, we already were session leader ! debug("OSError was raised.") pass except AttributeError: # Have pty, but not setsid() ? ! debug("AttributeError was raised.") pass except: ! # We don't want this error to propagate, escape the call to ! # os._exit(), and cause very peculiar behavior in the calling # regrtest.py ! ! debug("Some other error was raised.") os._exit(1) else: --- 55,82 ---- pid, master_fd = pty.fork() if pid == pty.CHILD: ! # stdout should be connected to a tty. ! if not os.isatty(1): ! debug("Child's fd 1 is not a tty?!") ! os._exit(3) ! ! # After pty.fork(), the child should already be a session leader. ! # (on those systems that have that concept.) ! debug("In child, calling os.setsid()") try: os.setsid() except OSError: # Good, we already were session leader ! debug("Good: OSError was raised.") pass except AttributeError: # Have pty, but not setsid() ? ! debug("No setsid() available ?") pass except: ! # We don't want this error to propagate, escaping the call to ! # os._exit() and causing very peculiar behavior in the calling # regrtest.py ! ! # Note: could add traceback printing here. ! debug("An unexpected error was raised.") os._exit(1) else: *************** *** 75,88 **** debug("Waiting for child (%d) to finish."%pid) (pid, status) = os.waitpid(pid, 0) ! debug("Child (%d) exited with status %d."%(pid, status)) ! if status / 256 == 1: raise TestFailed, "Child raised an unexpected exception in os.setsid()" ! elif status / 256 == 2: raise TestFailed, "pty.fork() failed to make child a session leader." ! elif status / 256 == 3: raise TestFailed, "Child spawned by pty.fork() did not have a tty as stdout" ! elif status / 256 != 4: ! raise TestFailed, "pty.fork() failed for unknown reasons:" ! print os.read(master_fd, 65536) os.close(master_fd) --- 87,100 ---- debug("Waiting for child (%d) to finish."%pid) (pid, status) = os.waitpid(pid, 0) ! res = status / 256 ! debug("Child (%d) exited with status %d (%d)."%(pid, res, status)) ! if res == 1: raise TestFailed, "Child raised an unexpected exception in os.setsid()" ! elif res == 2: raise TestFailed, "pty.fork() failed to make child a session leader." ! elif res == 3: raise TestFailed, "Child spawned by pty.fork() did not have a tty as stdout" ! elif res != 4: ! raise TestFailed, "pty.fork() failed for unknown reasons." os.close(master_fd) From gvanrossum@users.sourceforge.net Thu Mar 22 15:29:39 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 22 Mar 2001 07:29:39 -0800 Subject: [Python-checkins] CVS: python/dist/src README,1.116,1.117 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv26365 Modified Files: README Log Message: Set copyright to PSF. Don't bother with 2000. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.116 retrieving revision 1.117 diff -C2 -r1.116 -r1.117 *** README 2001/03/06 12:07:27 1.116 --- README 2001/03/22 15:29:37 1.117 *************** *** 2,6 **** ========================== ! Copyright (c) 2000, 2001 Guido van Rossum. All rights reserved. --- 2,6 ---- ========================== ! Copyright (c) 2001 Python Software Foundation. All rights reserved. From akuchling@users.sourceforge.net Thu Mar 22 15:32:26 2001 From: akuchling@users.sourceforge.net (A.M. Kuchling) Date: Thu, 22 Mar 2001 07:32:26 -0800 Subject: [Python-checkins] CVS: distutils/distutils dist.py,1.45,1.46 Message-ID: Update of /cvsroot/python/distutils/distutils In directory usw-pr-cvs1:/tmp/cvs-serv26837 Modified Files: dist.py Log Message: Use the get_contact*() accessors instead of get_maintainer*() Index: dist.py =================================================================== RCS file: /cvsroot/python/distutils/distutils/dist.py,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -r1.45 -r1.46 *** dist.py 2001/03/22 03:06:52 1.45 --- dist.py 2001/03/22 15:32:23 1.46 *************** *** 993,998 **** pkg_info.write('Summary: %s\n' % self.get_description() ) pkg_info.write('Home-page: %s\n' % self.get_url() ) ! pkg_info.write('Author: %s\n' % self.get_maintainer() ) ! pkg_info.write('Author-email: %s\n' % self.get_maintainer_email() ) pkg_info.write('License: %s\n' % self.get_licence() ) --- 993,998 ---- pkg_info.write('Summary: %s\n' % self.get_description() ) pkg_info.write('Home-page: %s\n' % self.get_url() ) ! pkg_info.write('Author: %s\n' % self.get_contact() ) ! pkg_info.write('Author-email: %s\n' % self.get_contact_email() ) pkg_info.write('License: %s\n' % self.get_licence() ) From loewis@users.sourceforge.net Thu Mar 22 15:34:05 2001 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Thu, 22 Mar 2001 07:34:05 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/xml/sax _exceptions.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/xml/sax In directory usw-pr-cvs1:/tmp/cvs-serv27104 Modified Files: _exceptions.py Log Message: Synchronize with 1.6 of PyXML: Retrieve relevant information at construction time, as it may be lost when the exception is printed. Index: _exceptions.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xml/sax/_exceptions.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** _exceptions.py 2001/01/27 08:56:24 1.8 --- _exceptions.py 2001/03/22 15:34:02 1.9 *************** *** 62,73 **** self._locator = locator def getColumnNumber(self): """The column number of the end of the text where the exception occurred.""" ! return self._locator.getColumnNumber() def getLineNumber(self): "The line number of the end of the text where the exception occurred." ! return self._locator.getLineNumber() def getPublicId(self): --- 62,81 ---- self._locator = locator + # We need to cache this stuff at construction time. + # If this exception is thrown, the objects through which we must + # traverse to get this information may be deleted by the time + # it gets caught. + self._systemId = self._locator.getSystemId() + self._colnum = self._locator.getColumnNumber() + self._linenum = self._locator.getLineNumber() + def getColumnNumber(self): """The column number of the end of the text where the exception occurred.""" ! return self._colnum def getLineNumber(self): "The line number of the end of the text where the exception occurred." ! return self._linenum def getPublicId(self): *************** *** 77,81 **** def getSystemId(self): "Get the system identifier of the entity where the exception occurred." ! return self._locator.getSystemId() def __str__(self): --- 85,89 ---- def getSystemId(self): "Get the system identifier of the entity where the exception occurred." ! return self._systemId def __str__(self): From gvanrossum@users.sourceforge.net Thu Mar 22 15:41:09 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 22 Mar 2001 07:41:09 -0800 Subject: [Python-checkins] CVS: python/dist/src LICENSE,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv28522 Modified Files: LICENSE Log Message: Updated history. Incorporated 1.6.1 license. Index: LICENSE =================================================================== RCS file: /cvsroot/python/python/dist/src/LICENSE,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** LICENSE 2001/01/18 14:39:49 1.9 --- LICENSE 2001/03/22 15:41:06 1.10 *************** *** 1,4 **** ! HISTORY OF THE SOFTWARE ! ======================= Python was created in the early 1990s by Guido van Rossum at Stichting --- 1,4 ---- ! A. HISTORY OF THE SOFTWARE ! ========================== Python was created in the early 1990s by Guido van Rossum at Stichting *************** *** 11,35 **** 1.6 was the last of the versions released by CNRI. In 2000, Guido and the Python core development team moved to BeOpen.com to form the ! BeOpen PythonLabs team (www.pythonlabs.com). Python 2.0 is the first ! release from PythonLabs. Thanks to the many outside volunteers who ! have worked under Guido's direction to make this release possible. After Python 2.0 was released by BeOpen.com, Guido van Rossum and the ! other PythonLabs developers joined Digital Creations. The intention ! is for all intellectual property added from this point on to be owned ! by the Python Software Foundation (PSF), a non-profit that will be ! created modeled after the Apache Software Foundation. We will also ! attempt to get the ownership in previous versions transferred to the ! PSF, and straighten out the license to remove the GPL-incompatibility ! introduced by CNRI's Python 1.6 license. In the interim, Guido van ! Rossum will own all new intellectual property, and no new license is ! added. ! BEOPEN.COM TERMS AND CONDITIONS FOR PYTHON 2.0 ! ============================================== BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1 - ----------------------------------------------------- 1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an --- 11,46 ---- 1.6 was the last of the versions released by CNRI. In 2000, Guido and the Python core development team moved to BeOpen.com to form the ! BeOpen PythonLabs team. Python 2.0 was the first and only release ! from BeOpen.com. + Following the release of Python 1.6, and after Guido van Rossum left + CNRI to work with commercial software developers, it became clear that + the ability to use Python with software available under the GNU Public + License (GPL) was very desirable. CNRI and the Free Software + Foundation (FSF)interacted to develop enabling wording changes to the + Python license. Python 1.6.1 is essentially the same as Python 1.6, + with a few minor bug fixes, and with a GPL compatible open source + license. Python 2.1 is a derivative work of Python 1.6.1, as well as + of Python 2.0. + After Python 2.0 was released by BeOpen.com, Guido van Rossum and the ! other PythonLabs developers joined Digital Creations. All ! intellectual property added from this point on, starting with Python ! 2.1 and its alpha and beta releases, is owned by the Python Software ! Foundation (PSF), a non-profit modeled after the Apache Software ! Foundation. See http://www.python.org/psf/ for more information about ! the PSF. ! ! Thanks to the many outside volunteers who have worked under Guido's ! direction to make these releases possible. ! + B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING Python 1.6.1 + ===================================================================== ! B.1. BEOPEN.COM TERMS AND CONDITIONS FOR PYTHON 2.0 ! --------------------------------------------------- BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1 1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an *************** *** 77,156 **** Agreement. - - CNRI OPEN SOURCE LICENSE AGREEMENT - ---------------------------------- ! Python 1.6 CNRI OPEN SOURCE LICENSE AGREEMENT - IMPORTANT: PLEASE READ THE FOLLOWING AGREEMENT CAREFULLY. BY CLICKING - ON "ACCEPT" WHERE INDICATED BELOW, OR BY COPYING, INSTALLING OR - OTHERWISE USING PYTHON 1.6 SOFTWARE, YOU ARE DEEMED TO HAVE AGREED TO - THE TERMS AND CONDITIONS OF THIS LICENSE AGREEMENT. - 1. This LICENSE AGREEMENT is between the Corporation for National Research Initiatives, having an office at 1895 Preston White Drive, Reston, VA 20191 ("CNRI"), and the Individual or Organization ! ("Licensee") accessing and otherwise using Python 1.6 software in ! source or binary form and its associated documentation, as released at ! the www.python.org Internet site on September 5, 2000 ("Python 1.6"). 2. Subject to the terms and conditions of this License Agreement, CNRI hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, ! prepare derivative works, distribute, and otherwise use Python 1.6 alone or in any derivative version, provided, however, that CNRI's License Agreement and CNRI's notice of copyright, i.e., "Copyright (c) ! 1995-2000 Corporation for National Research Initiatives; All Rights ! Reserved" are retained in Python 1.6 alone or in any derivative ! version prepared by ! ! Licensee. Alternately, in lieu of CNRI's License Agreement, Licensee ! may substitute the following text (omitting the quotes): "Python 1.6 ! is made available subject to the terms and conditions in CNRI's ! License Agreement. This Agreement together with Python 1.6 may be ! located on the Internet using the following unique, persistent ! identifier (known as a handle): 1895.22/1012. This Agreement may also ! be obtained from a proxy server on the Internet using the following ! URL: http://hdl.handle.net/1895.22/1012". 3. In the event Licensee prepares a derivative work that is based on ! or incorporates Python 1.6 or any part thereof, and wants to make the ! derivative work available to others as provided herein, then Licensee ! hereby agrees to include in any such work a brief summary of the ! changes made to Python 1.6. ! ! 4. CNRI is making Python 1.6 available to Licensee on an "AS IS" ! basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR ! IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS ! FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6 WILL NOT INFRINGE ANY THIRD PARTY RIGHTS. 5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON ! 1.6 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A ! RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6, OR ! ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. 6. This License Agreement will automatically terminate upon a material breach of its terms and conditions. ! 7. This License Agreement shall be governed by and interpreted in all ! respects by the law of the State of Virginia, excluding conflict of ! law provisions. Nothing in this License Agreement shall be deemed to ! create any relationship of agency, partnership, or joint venture ! between CNRI and Licensee. This License Agreement does not grant ! permission to use CNRI trademarks or trade name in a trademark sense ! to endorse or promote products or services of Licensee, or any third ! party. 8. By clicking on the "ACCEPT" button where indicated, or by copying, ! installing or otherwise using Python 1.6, Licensee agrees to be bound ! by the terms and conditions of this License Agreement. ! ACCEPT ! CWI PERMISSIONS STATEMENT AND DISCLAIMER ! ---------------------------------------- Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam, --- 88,165 ---- Agreement. ! B.2. CNRI OPEN SOURCE GPL-COMPATIBLE LICENSE AGREEMENT ! ------------------------------------------------------ 1. This LICENSE AGREEMENT is between the Corporation for National Research Initiatives, having an office at 1895 Preston White Drive, Reston, VA 20191 ("CNRI"), and the Individual or Organization ! ("Licensee") accessing and otherwise using Python 1.6.1 software in ! source or binary form and its associated documentation. 2. Subject to the terms and conditions of this License Agreement, CNRI hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, ! prepare derivative works, distribute, and otherwise use Python 1.6.1 alone or in any derivative version, provided, however, that CNRI's License Agreement and CNRI's notice of copyright, i.e., "Copyright (c) ! 1995-2001 Corporation for National Research Initiatives; All Rights ! Reserved" are retained in Python 1.6.1 alone or in any derivative ! version prepared by Licensee. Alternately, in lieu of CNRI's License ! Agreement, Licensee may substitute the following text (omitting the ! quotes): "Python 1.6.1 is made available subject to the terms and ! conditions in CNRI's License Agreement. This Agreement together with ! Python 1.6.1 may be located on the Internet using the following ! unique, persistent identifier (known as a handle): 1895.22/1013. This ! Agreement may also be obtained from a proxy server on the Internet ! using the following URL: http://hdl.handle.net/1895.22/1013". 3. In the event Licensee prepares a derivative work that is based on ! or incorporates Python 1.6.1 or any part thereof, and wants to make ! the derivative work available to others as provided herein, then ! Licensee hereby agrees to include in any such work a brief summary of ! the changes made to Python 1.6.1. ! ! 4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS" ! basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR ! IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS ! FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT INFRINGE ANY THIRD PARTY RIGHTS. 5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON ! 1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS ! A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1, ! OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. 6. This License Agreement will automatically terminate upon a material breach of its terms and conditions. ! 7. This License Agreement shall be governed by the federal ! intellectual property law of the United States, including without ! limitation the federal copyright law, and, to the extent such ! U.S. federal law does not apply, by the law of the Commonwealth of ! Virginia, excluding Virginia's conflict of law provisions. ! Notwithstanding the foregoing, with regard to derivative works based ! on Python 1.6.1 that incorporate non-separable material that was ! previously distributed under the GNU General Public License (GPL), the ! law of the Commonwealth of Virginia shall govern this License ! Agreement only as to issues arising under or with respect to ! Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this ! License Agreement shall be deemed to create any relationship of ! agency, partnership, or joint venture between CNRI and Licensee. This ! License Agreement does not grant permission to use CNRI trademarks or ! trade name in a trademark sense to endorse or promote products or ! services of Licensee, or any third party. 8. By clicking on the "ACCEPT" button where indicated, or by copying, ! installing or otherwise using Python 1.6.1, Licensee agrees to be ! bound by the terms and conditions of this License Agreement. ! ACCEPT ! B.3. CWI PERMISSIONS STATEMENT AND DISCLAIMER ! --------------------------------------------- Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam, From akuchling@users.sourceforge.net Thu Mar 22 15:42:10 2001 From: akuchling@users.sourceforge.net (A.M. Kuchling) Date: Thu, 22 Mar 2001 07:42:10 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.136,1.137 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv28675 Modified Files: NEWS Log Message: Added news items for the Distutils Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.136 retrieving revision 1.137 diff -C2 -r1.136 -r1.137 *** NEWS 2001/03/22 14:17:21 1.136 --- NEWS 2001/03/22 15:42:08 1.137 *************** *** 62,65 **** --- 62,86 ---- number from a Py_complex C value. + Distutils + + - the sdist command now writes a PKG-INFO file, as described in PEP 241, + into the release tree. + + - several enhancements to the bdist_wininst command from Thomas Heller + (an uninstaller, more customization of the installer's display) + + - from Jack Jansen: added Mac-specific code to generate a dialog for + users to specify the command-line (because providing a command-line with + MacPython is awkward). Jack also made various fixes for the Mac + and the Metrowerks compiler. + + - added 'platforms' and 'keywords' to the set of metadata that can be + specified for a distribution. Supplying a version number has been made + compulsory. + + - applied patches from Jason Tishler to make the compiler class work with + Cygwin. + + What's New in Python 2.1 beta 1? ================================ From effbot@users.sourceforge.net Thu Mar 22 15:50:12 2001 From: effbot@users.sourceforge.net (Fredrik Lundh) Date: Thu, 22 Mar 2001 07:50:12 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib sre.py,1.30,1.31 sre_compile.py,1.36,1.37 sre_parse.py,1.45,1.46 sre_constants.py,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv29581/Lib Modified Files: sre.py sre_compile.py sre_parse.py sre_constants.py Log Message: sre 2.1b2 update: - take locale into account for word boundary anchors (#410271) - restored 2.0's *? behaviour (#233283, #408936 and others) - speed up re.sub/re.subn Index: sre.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sre.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -r1.30 -r1.31 *** sre.py 2001/02/18 12:05:16 1.30 --- sre.py 2001/03/22 15:50:10 1.31 *************** *** 24,27 **** --- 24,29 ---- "UNICODE", "error" ] + __version__ = "2.1b2" + # this module works under 1.5.2 and later. don't use string methods import string *************** *** 91,94 **** --- 93,97 ---- "Clear the regular expression cache" _cache.clear() + _cache_repl.clear() def template(pattern, flags=0): *************** *** 112,115 **** --- 115,120 ---- _cache = {} + _cache_repl = {} + _MAXCACHE = 100 *************** *** 135,138 **** --- 140,158 ---- return p + def _compile_repl(*key): + # internal: compile replacement pattern + p = _cache_repl.get(key) + if p is not None: + return p + repl, pattern = key + try: + p = sre_parse.parse_template(repl, pattern) + except error, v: + raise error, v # invalid expression + if len(_cache_repl) >= _MAXCACHE: + _cache_repl.clear() + _cache_repl[key] = p + return p + def _expand(pattern, match, template): # internal: match.expand implementation hook *************** *** 149,153 **** filter = template else: ! template = sre_parse.parse_template(template, pattern) def filter(match, template=template): return sre_parse.expand_template(template, match) --- 169,173 ---- filter = template else: ! template = _compile_repl(template, pattern) def filter(match, template=template): return sre_parse.expand_template(template, match) Index: sre_compile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sre_compile.py,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -r1.36 -r1.37 *** sre_compile.py 2001/02/18 12:05:16 1.36 --- sre_compile.py 2001/03/22 15:50:10 1.37 *************** *** 106,112 **** emit(OPCODES[op]) if flags & SRE_FLAG_MULTILINE: ! emit(ATCODES[AT_MULTILINE.get(av, av)]) ! else: ! emit(ATCODES[av]) elif op is BRANCH: emit(OPCODES[op]) --- 106,115 ---- emit(OPCODES[op]) if flags & SRE_FLAG_MULTILINE: ! av = AT_MULTILINE.get(av, av) ! if flags & SRE_FLAG_LOCALE: ! av = AT_LOCALE.get(av, av) ! elif flags & SRE_FLAG_UNICODE: ! av = AT_UNICODE.get(av, av) ! emit(ATCODES[av]) elif op is BRANCH: emit(OPCODES[op]) *************** *** 125,133 **** emit(OPCODES[op]) if flags & SRE_FLAG_LOCALE: ! emit(CHCODES[CH_LOCALE[av]]) elif flags & SRE_FLAG_UNICODE: ! emit(CHCODES[CH_UNICODE[av]]) ! else: ! emit(CHCODES[av]) elif op is GROUPREF: if flags & SRE_FLAG_IGNORECASE: --- 128,135 ---- emit(OPCODES[op]) if flags & SRE_FLAG_LOCALE: ! av = CH_LOCALE[av] elif flags & SRE_FLAG_UNICODE: ! av = CH_UNICODE[av] ! emit(CHCODES[av]) elif op is GROUPREF: if flags & SRE_FLAG_IGNORECASE: Index: sre_parse.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sre_parse.py,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -r1.45 -r1.46 *** sre_parse.py 2001/02/18 21:04:48 1.45 --- sre_parse.py 2001/03/22 15:50:10 1.46 *************** *** 639,642 **** --- 639,652 ---- p = [] a = p.append + def literal(literal, p=p): + if p and p[-1][0] is LITERAL: + p[-1] = LITERAL, p[-1][1] + literal + else: + p.append((LITERAL, literal)) + sep = source[:0] + if type(sep) is type(""): + char = chr + else: + char = unichr while 1: this = s.get() *************** *** 682,713 **** if not code: this = this[1:] ! code = LITERAL, atoi(this[-6:], 8) & 0xff ! a(code) else: try: ! a(ESCAPES[this]) except KeyError: ! for c in this: ! a((LITERAL, ord(c))) else: ! a((LITERAL, ord(this))) ! return p def expand_template(template, match): ! # XXX: this is sooooo slow. drop in the slicelist code instead ! p = [] ! a = p.append sep = match.string[:0] ! if type(sep) is type(""): ! char = chr ! else: ! char = unichr ! for c, s in template: ! if c is LITERAL: ! a(char(s)) ! elif c is MARK: ! s = match.group(s) if s is None: ! raise error, "empty group" ! a(s) ! return string.join(p, sep) --- 692,732 ---- if not code: this = this[1:] ! code = LITERAL, char(atoi(this[-6:], 8) & 0xff) ! if code[0] is LITERAL: ! literal(code[1]) ! else: ! a(code) else: try: ! this = char(ESCAPES[this][1]) except KeyError: ! pass ! literal(this) else: ! literal(this) ! # convert template to groups and literals lists ! i = 0 ! groups = [] ! literals = [] ! for c, s in p: ! if c is MARK: ! groups.append((i, s)) ! literals.append(None) ! else: ! literals.append(s) ! i = i + 1 ! return groups, literals def expand_template(template, match): ! g = match.group sep = match.string[:0] ! groups, literals = template ! literals = literals[:] ! try: ! for index, group in groups: ! literals[index] = s = g(group) if s is None: ! raise IndexError ! except IndexError: ! raise error, "empty group" ! return string.join(literals, sep) Index: sre_constants.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sre_constants.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -r1.27 -r1.28 *** sre_constants.py 2001/02/18 12:05:16 1.27 --- sre_constants.py 2001/03/22 15:50:10 1.28 *************** *** 12,16 **** # update when constants are added or removed ! MAGIC = 20010115 # max code word in this release --- 12,16 ---- # update when constants are added or removed ! MAGIC = 20010320 # max code word in this release *************** *** 68,71 **** --- 68,75 ---- AT_END_LINE = "at_end_line" AT_END_STRING = "at_end_string" + AT_LOC_BOUNDARY = "at_loc_boundary" + AT_LOC_NON_BOUNDARY = "at_loc_non_boundary" + AT_UNI_BOUNDARY = "at_uni_boundary" + AT_UNI_NON_BOUNDARY = "at_uni_non_boundary" # categories *************** *** 120,124 **** ATCODES = [ AT_BEGINNING, AT_BEGINNING_LINE, AT_BEGINNING_STRING, AT_BOUNDARY, ! AT_NON_BOUNDARY, AT_END, AT_END_LINE, AT_END_STRING ] --- 124,130 ---- ATCODES = [ AT_BEGINNING, AT_BEGINNING_LINE, AT_BEGINNING_STRING, AT_BOUNDARY, ! AT_NON_BOUNDARY, AT_END, AT_END_LINE, AT_END_STRING, ! AT_LOC_BOUNDARY, AT_LOC_NON_BOUNDARY, AT_UNI_BOUNDARY, ! AT_UNI_NON_BOUNDARY ] *************** *** 156,159 **** --- 162,175 ---- AT_BEGINNING: AT_BEGINNING_LINE, AT_END: AT_END_LINE + } + + AT_LOCALE = { + AT_BOUNDARY: AT_LOC_BOUNDARY, + AT_NON_BOUNDARY: AT_LOC_NON_BOUNDARY + } + + AT_UNICODE = { + AT_BOUNDARY: AT_UNI_BOUNDARY, + AT_NON_BOUNDARY: AT_UNI_NON_BOUNDARY } From effbot@users.sourceforge.net Thu Mar 22 15:50:12 2001 From: effbot@users.sourceforge.net (Fredrik Lundh) Date: Thu, 22 Mar 2001 07:50:12 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_sre.py,1.22,1.23 re_tests.py,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv29581/Lib/test Modified Files: test_sre.py re_tests.py Log Message: sre 2.1b2 update: - take locale into account for word boundary anchors (#410271) - restored 2.0's *? behaviour (#233283, #408936 and others) - speed up re.sub/re.subn Index: test_sre.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sre.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -r1.22 -r1.23 *** test_sre.py 2001/02/18 12:05:16 1.22 --- test_sre.py 2001/03/22 15:50:10 1.23 *************** *** 330,333 **** --- 330,335 ---- except NameError: pass + except TypeError: + continue # skip unicode test strings else: result=obj.search(u) Index: re_tests.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/re_tests.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -r1.27 -r1.28 *** re_tests.py 2001/02/18 21:04:48 1.27 --- re_tests.py 2001/03/22 15:50:10 1.28 *************** *** 640,641 **** --- 640,652 ---- (r'^*', '', SYNTAX_ERROR), ] + + try: + u = eval("u'\N{LATIN CAPITAL LETTER A WITH DIAERESIS}'") + except SyntaxError: + pass + else: + tests.extend([ + # bug 410271: \b broken under locales + (r'\b.\b', 'a', SUCCEED, 'found', 'a'), + (r'(?u)\b.\b', u, SUCCEED, 'found', u), + ]) From effbot@users.sourceforge.net Thu Mar 22 15:50:12 2001 From: effbot@users.sourceforge.net (Fredrik Lundh) Date: Thu, 22 Mar 2001 07:50:12 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules _sre.c,2.53,2.54 sre_constants.h,2.11,2.12 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv29581/Modules Modified Files: _sre.c sre_constants.h Log Message: sre 2.1b2 update: - take locale into account for word boundary anchors (#410271) - restored 2.0's *? behaviour (#233283, #408936 and others) - speed up re.sub/re.subn Index: _sre.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_sre.c,v retrieving revision 2.53 retrieving revision 2.54 diff -C2 -r2.53 -r2.54 *** _sre.c 2001/02/28 16:44:18 2.53 --- _sre.c 2001/03/22 15:50:09 2.54 *************** *** 25,30 **** * 2000-12-21 fl fixed memory leak in groupdict * 2001-01-02 fl properly reset pointer after failed assertion in MIN_UNTIL ! * 2001-01-15 fl avoid recursion for MIN_UTIL; fixed uppercase literal bug * 2001-01-16 fl fixed memory leak in pattern destructor * * Copyright (c) 1997-2001 by Secret Labs AB. All rights reserved. --- 25,31 ---- * 2000-12-21 fl fixed memory leak in groupdict * 2001-01-02 fl properly reset pointer after failed assertion in MIN_UNTIL ! * 2001-01-15 fl avoid recursion for MIN_UNTIL; fixed uppercase literal bug * 2001-01-16 fl fixed memory leak in pattern destructor + * 2001-03-20 fl lots of fixes for 2.1b2 * * Copyright (c) 1997-2001 by Secret Labs AB. All rights reserved. *************** *** 41,45 **** #ifndef SRE_RECURSIVE ! char copyright[] = " SRE 2.1 Copyright (c) 1997-2001 by Secret Labs AB "; #include "Python.h" --- 42,46 ---- #ifndef SRE_RECURSIVE ! char copyright[] = " SRE 2.1b2 Copyright (c) 1997-2001 by Secret Labs AB "; #include "Python.h" *************** *** 142,150 **** 120, 121, 122, 123, 124, 125, 126, 127 }; - static unsigned int sre_lower(unsigned int ch) - { - return ((ch) < 128 ? sre_char_lower[ch] : ch); - } - #define SRE_IS_DIGIT(ch)\ ((ch) < 128 ? (sre_char_info[(ch)] & SRE_DIGIT_MASK) : 0) --- 143,146 ---- *************** *** 157,167 **** #define SRE_IS_WORD(ch)\ ((ch) < 128 ? (sre_char_info[(ch)] & SRE_WORD_MASK) : 0) - - /* locale-specific character predicates */ ! static unsigned int sre_lower_locale(unsigned int ch) { ! return ((ch) < 256 ? tolower((ch)) : ch); } #define SRE_LOC_IS_DIGIT(ch) ((ch) < 256 ? isdigit((ch)) : 0) #define SRE_LOC_IS_SPACE(ch) ((ch) < 256 ? isspace((ch)) : 0) --- 153,164 ---- #define SRE_IS_WORD(ch)\ ((ch) < 128 ? (sre_char_info[(ch)] & SRE_WORD_MASK) : 0) ! static unsigned int sre_lower(unsigned int ch) { ! return ((ch) < 128 ? sre_char_lower[ch] : ch); } + + /* locale-specific character predicates */ + #define SRE_LOC_IS_DIGIT(ch) ((ch) < 256 ? isdigit((ch)) : 0) #define SRE_LOC_IS_SPACE(ch) ((ch) < 256 ? isspace((ch)) : 0) *************** *** 170,180 **** #define SRE_LOC_IS_WORD(ch) (SRE_LOC_IS_ALNUM((ch)) || (ch) == '_') /* unicode-specific character predicates */ #if defined(HAVE_UNICODE) ! static unsigned int sre_lower_unicode(unsigned int ch) ! { ! return (unsigned int) Py_UNICODE_TOLOWER((Py_UNICODE)(ch)); ! } #define SRE_UNI_IS_DIGIT(ch) Py_UNICODE_ISDIGIT((Py_UNICODE)(ch)) #define SRE_UNI_IS_SPACE(ch) Py_UNICODE_ISSPACE((Py_UNICODE)(ch)) --- 167,179 ---- #define SRE_LOC_IS_WORD(ch) (SRE_LOC_IS_ALNUM((ch)) || (ch) == '_') + static unsigned int sre_lower_locale(unsigned int ch) + { + return ((ch) < 256 ? tolower((ch)) : ch); + } + /* unicode-specific character predicates */ #if defined(HAVE_UNICODE) ! #define SRE_UNI_IS_DIGIT(ch) Py_UNICODE_ISDIGIT((Py_UNICODE)(ch)) #define SRE_UNI_IS_SPACE(ch) Py_UNICODE_ISSPACE((Py_UNICODE)(ch)) *************** *** 182,185 **** --- 181,190 ---- #define SRE_UNI_IS_ALNUM(ch) Py_UNICODE_ISALNUM((Py_UNICODE)(ch)) #define SRE_UNI_IS_WORD(ch) (SRE_UNI_IS_ALNUM((ch)) || (ch) == '_') + + static unsigned int sre_lower_unicode(unsigned int ch) + { + return (unsigned int) Py_UNICODE_TOLOWER((Py_UNICODE)(ch)); + } + #endif *************** *** 419,422 **** --- 424,463 ---- SRE_IS_WORD((int) ptr[0]) : 0; return this == that; + + case SRE_AT_LOC_BOUNDARY: + if (state->beginning == state->end) + return 0; + that = ((void*) ptr > state->beginning) ? + SRE_LOC_IS_WORD((int) ptr[-1]) : 0; + this = ((void*) ptr < state->end) ? + SRE_LOC_IS_WORD((int) ptr[0]) : 0; + return this != that; + + case SRE_AT_LOC_NON_BOUNDARY: + if (state->beginning == state->end) + return 0; + that = ((void*) ptr > state->beginning) ? + SRE_LOC_IS_WORD((int) ptr[-1]) : 0; + this = ((void*) ptr < state->end) ? + SRE_LOC_IS_WORD((int) ptr[0]) : 0; + return this == that; + + case SRE_AT_UNI_BOUNDARY: + if (state->beginning == state->end) + return 0; + that = ((void*) ptr > state->beginning) ? + SRE_UNI_IS_WORD((int) ptr[-1]) : 0; + this = ((void*) ptr < state->end) ? + SRE_UNI_IS_WORD((int) ptr[0]) : 0; + return this != that; + + case SRE_AT_UNI_NON_BOUNDARY: + if (state->beginning == state->end) + return 0; + that = ((void*) ptr > state->beginning) ? + SRE_UNI_IS_WORD((int) ptr[-1]) : 0; + this = ((void*) ptr < state->end) ? + SRE_UNI_IS_WORD((int) ptr[0]) : 0; + return this == that; } *************** *** 1038,1042 **** /* see if the tail matches */ state->repeat = rp->prev; ! if (rp->pattern[2] == 65535) { /* unbounded repeat */ for (;;) { --- 1079,1084 ---- /* see if the tail matches */ state->repeat = rp->prev; ! /* FIXME: the following fix doesn't always work (#133283) */ ! if (0 && rp->pattern[2] == 65535) { /* unbounded repeat */ for (;;) { Index: sre_constants.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/sre_constants.h,v retrieving revision 2.11 retrieving revision 2.12 diff -C2 -r2.11 -r2.12 *** sre_constants.h 2001/01/15 12:46:09 2.11 --- sre_constants.h 2001/03/22 15:50:09 2.12 *************** *** 12,16 **** */ ! #define SRE_MAGIC 20010115 #define SRE_OP_FAILURE 0 #define SRE_OP_SUCCESS 1 --- 12,16 ---- */ ! #define SRE_MAGIC 20010320 #define SRE_OP_FAILURE 0 #define SRE_OP_SUCCESS 1 *************** *** 50,53 **** --- 50,57 ---- #define SRE_AT_END_LINE 6 #define SRE_AT_END_STRING 7 + #define SRE_AT_LOC_BOUNDARY 8 + #define SRE_AT_LOC_NON_BOUNDARY 9 + #define SRE_AT_UNI_BOUNDARY 10 + #define SRE_AT_UNI_NON_BOUNDARY 11 #define SRE_CATEGORY_DIGIT 0 #define SRE_CATEGORY_NOT_DIGIT 1 From effbot@users.sourceforge.net Thu Mar 22 15:51:30 2001 From: effbot@users.sourceforge.net (Fredrik Lundh) Date: Thu, 22 Mar 2001 07:51:30 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_re.py,1.29,1.30 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv30469/lib/test Modified Files: test_re.py Log Message: SRE 2.1b1: don't do unicode tests under 1.5.2, or on unicode strings/patterns. Index: test_re.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_re.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -r1.29 -r1.30 *** test_re.py 2001/02/09 11:54:48 1.29 --- test_re.py 2001/03/22 15:51:28 1.30 *************** *** 337,343 **** # Try the match on a unicode string, and check that it # still succeeds. ! result = obj.search(unicode(s, "latin-1")) ! if result is None: ! print '=== Fails on unicode match', t # Try the match on a unicode pattern, and check that it --- 337,348 ---- # Try the match on a unicode string, and check that it # still succeeds. ! try: ! result = obj.search(unicode(s, "latin-1")) ! if result is None: ! print '=== Fails on unicode match', t ! except NameError: ! continue # 1.5.2 ! except TypeError: ! continue # unicode test case # Try the match on a unicode pattern, and check that it From twouters@users.sourceforge.net Thu Mar 22 16:03:55 2001 From: twouters@users.sourceforge.net (Thomas Wouters) Date: Thu, 22 Mar 2001 08:03:55 -0800 Subject: [Python-checkins] CVS: python/dist/src LICENSE,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv477 Modified Files: LICENSE Log Message: Fix typo in history. Index: LICENSE =================================================================== RCS file: /cvsroot/python/python/dist/src/LICENSE,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** LICENSE 2001/03/22 15:41:06 1.10 --- LICENSE 2001/03/22 16:03:53 1.11 *************** *** 18,22 **** the ability to use Python with software available under the GNU Public License (GPL) was very desirable. CNRI and the Free Software ! Foundation (FSF)interacted to develop enabling wording changes to the Python license. Python 1.6.1 is essentially the same as Python 1.6, with a few minor bug fixes, and with a GPL compatible open source --- 18,22 ---- the ability to use Python with software available under the GNU Public License (GPL) was very desirable. CNRI and the Free Software ! Foundation (FSF) interacted to develop enabling wording changes to the Python license. Python 1.6.1 is essentially the same as Python 1.6, with a few minor bug fixes, and with a GPL compatible open source From fdrake@users.sourceforge.net Thu Mar 22 16:30:19 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 22 Mar 2001 08:30:19 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/api api.tex,1.110,1.111 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv6145/api Modified Files: api.tex Log Message: Be more clear about the specific rules for supporting the cyclic GC in an extension object. Also included an example showing exactly what needs to be done and nothing else. This closes SF bug #228591. Index: api.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/api.tex,v retrieving revision 1.110 retrieving revision 1.111 diff -C2 -r1.110 -r1.111 *** api.tex 2001/03/21 22:15:01 1.110 --- api.tex 2001/03/22 16:30:17 1.111 *************** *** 4976,4983 **** To create a container type, the \member{tp_flags} field of the type object must include the \constant{Py_TPFLAGS_GC} and provide an ! implementation of the \member{tp_traverse} handler. The value of the ! \member{tp_basicsize} field must include \constant{PyGC_HEAD_SIZE} as ! well. If instances of the type are mutable, a \member{tp_clear} ! implementation must also be provided. \begin{datadesc}{Py_TPFLAGS_GC} --- 4976,4983 ---- To create a container type, the \member{tp_flags} field of the type object must include the \constant{Py_TPFLAGS_GC} and provide an ! implementation of the \member{tp_traverse} handler. The computed ! value of the \member{tp_basicsize} field must include ! \constant{PyGC_HEAD_SIZE} as well. If instances of the type are ! mutable, a \member{tp_clear} implementation must also be provided. \begin{datadesc}{Py_TPFLAGS_GC} *************** *** 4993,4996 **** --- 4993,5007 ---- \end{datadesc} + Constructors for container types must conform to two rules: + + \begin{enumerate} + \item The memory for the object must be allocated using + \cfunction{PyObject_New()} or \cfunction{PyObject_VarNew()}. + + \item Once all the fields which may contain references to other + containers are initialized, it must call + \cfunction{PyObject_GC_Init()}. + \end{enumerate} + \begin{cfuncdesc}{void}{PyObject_GC_Init}{PyObject *op} Adds the object \var{op} to the set of container objects tracked by *************** *** 5001,5004 **** --- 5012,5026 ---- \end{cfuncdesc} + Similarly, the deallocator for the object must conform to a similar + pair of rules: + + \begin{enumerate} + \item Before fields which refer to other containers are invalidated, + \cfunction{PyObject_GC_Fini()} must be called. + + \item The object's memory must be deallocated using + \cfunction{PyObject_Del()}. + \end{enumerate} + \begin{cfuncdesc}{void}{PyObject_GC_Fini}{PyObject *op} Remove the object \var{op} from the set of container objects tracked *************** *** 5044,5047 **** --- 5066,5169 ---- reference cycle. \end{ctypedesc} + + + \subsection{Example Cycle Collector Support + \label{example-cycle-support}} + + This example shows only enough of the implementation of an extension + type to show how the garbage collector support needs to be added. It + shows the definition of the object structure, the + \member{tp_traverse}, \member{tp_clear} and \member{tp_dealloc} + implementations, the type structure, and a constructor --- the module + initialization needed to export the constructor to Python is not shown + as there are no special considerations there for the collector. To + make this interesting, assume that the module exposes ways for the + \member{container} field of the object to be modified. Note that + since no checks are made on the type of the object used to initialize + \member{container}, we have to assume that it may be a container. + + \begin{verbatim} + #include "Python.h" + + typedef struct { + PyObject_HEAD + PyObject *container; + } MyObject; + + static int + my_traverse(MyObject *self, visitproc visit, void *arg) + { + if (self->container != NULL) + return visit(self->container, arg); + else + return 0; + } + + static int + my_clear(MyObject *self) + { + Py_XDECREF(self->container); + self->container = NULL; + + return 0; + } + + static void + my_dealloc(MyObject *self) + { + PyObject_GC_Fini((PyObject *) self); + Py_XDECREF(self->container); + PyObject_Del(self); + } + \end{verbatim} + + \begin{verbatim} + statichere PyTypeObject + MyObject_Type = { + PyObject_HEAD_INIT(NULL) + 0, + "MyObject", + sizeof(MyObject) + PyGC_HEAD_SIZE, + 0, + (destructor)my_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_compare */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC, + 0, /* tp_doc */ + (traverseproc)my_traverse, /* tp_traverse */ + (inquiry)my_clear, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + }; + + /* This constructor should be made accessible from Python. */ + static PyObject * + new_object(PyObject *unused, PyObject *args) + { + PyObject *container = NULL; + MyObject *result = NULL; + + if (PyArg_ParseTuple(args, "|O:new_object", &container)) { + result = PyObject_New(MyObject, &MyObject_Type); + if (result != NULL) { + result->container = container; + PyObject_GC_Init(); + } + } + return (PyObject *) result; + } + \end{verbatim} From fdrake@users.sourceforge.net Thu Mar 22 17:00:09 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 22 Mar 2001 09:00:09 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/texinputs copyright.tex,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory usw-pr-cvs1:/tmp/cvs-serv12459/texinputs Modified Files: copyright.tex Log Message: Update to the current state of the universe. Index: copyright.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/copyright.tex,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** copyright.tex 2000/10/14 04:07:49 1.9 --- copyright.tex 2001/03/22 17:00:05 1.10 *************** *** 1,2 **** --- 1,15 ---- + Copyright \copyright{} 2001 Python Software Foundation. + All rights reserved. + + Copyright \copyright{} 2000 BeOpen.com. + All rights reserved. + + Copyright \copyright{} 1995-2000 Corporation for National Research Initiatives. + All rights reserved. + + Copyright \copyright{} 1991-1995 Stichting Mathematisch Centrum. + All rights reserved. + + \centerline{\strong{BEOPEN.COM TERMS AND CONDITIONS FOR PYTHON 2.0}} *************** *** 58,69 **** ! \centerline{\strong{CNRI OPEN SOURCE LICENSE AGREEMENT}} ! Python 1.6 is made available subject to the terms and conditions in ! CNRI's License Agreement. This Agreement together with Python 1.6 may be located on the Internet using the following unique, persistent ! identifier (known as a handle): 1895.22/1012. This Agreement may also be obtained from a proxy server on the Internet using the following ! URL: \url{http://hdl.handle.net/1895.22/1012}. --- 71,82 ---- ! \centerline{\strong{CNRI OPEN SOURCE GPL-COMPATIBLE LICENSE AGREEMENT}} ! Python 1.6.1 is made available subject to the terms and conditions in ! CNRI's License Agreement. This Agreement together with Python 1.6.1 may be located on the Internet using the following unique, persistent ! identifier (known as a handle): 1895.22/1013. This Agreement may also be obtained from a proxy server on the Internet using the following ! URL: \url{http://hdl.handle.net/1895.22/1013}. From fdrake@users.sourceforge.net Thu Mar 22 17:01:45 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 22 Mar 2001 09:01:45 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/texinputs boilerplate.tex,1.54,1.55 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory usw-pr-cvs1:/tmp/cvs-serv12812/texinputs Modified Files: boilerplate.tex Log Message: Bump the version number. Index: boilerplate.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/boilerplate.tex,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -r1.54 -r1.55 *** boilerplate.tex 2001/02/14 20:53:07 1.54 --- boilerplate.tex 2001/03/22 17:01:43 1.55 *************** *** 7,10 **** \date{\today} % XXX update before release! ! \release{2.1 beta 1} % software release, not documentation \setshortversion{2.1} % major.minor only for software --- 7,10 ---- \date{\today} % XXX update before release! ! \release{2.1 beta 2} % software release, not documentation \setshortversion{2.1} % major.minor only for software From gvanrossum@users.sourceforge.net Thu Mar 22 17:27:15 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 22 Mar 2001 09:27:15 -0800 Subject: [Python-checkins] CVS: python/dist/src/Tools/idle ColorDelegator.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv17150 Modified Files: ColorDelegator.py Log Message: Don't use __debug__ as if it were some module global. Use DEBUG instead. Index: ColorDelegator.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/ColorDelegator.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** ColorDelegator.py 2001/01/19 10:41:49 1.11 --- ColorDelegator.py 2001/03/22 17:27:13 1.12 *************** *** 11,15 **** #$ unix ! __debug__ = 0 --- 11,15 ---- #$ unix ! DEBUG = 0 *************** *** 85,95 **** self.tag_add("TODO", index1, index2) if self.after_id: ! if __debug__: print "colorizing already scheduled" return if self.colorizing: self.stop_colorizing = 1 ! if __debug__: print "stop colorizing" if self.allow_colorizing: ! if __debug__: print "schedule colorizing" self.after_id = self.after(1, self.recolorize) --- 85,95 ---- self.tag_add("TODO", index1, index2) if self.after_id: ! if DEBUG: print "colorizing already scheduled" return if self.colorizing: self.stop_colorizing = 1 ! if DEBUG: print "stop colorizing" if self.allow_colorizing: ! if DEBUG: print "schedule colorizing" self.after_id = self.after(1, self.recolorize) *************** *** 100,104 **** after_id = self.after_id self.after_id = None ! if __debug__: print "cancel scheduled recolorizer" self.after_cancel(after_id) self.allow_colorizing = 0 --- 100,104 ---- after_id = self.after_id self.after_id = None ! if DEBUG: print "cancel scheduled recolorizer" self.after_cancel(after_id) self.allow_colorizing = 0 *************** *** 114,126 **** after_id = self.after_id self.after_id = None ! if __debug__: print "cancel scheduled recolorizer" self.after_cancel(after_id) if self.allow_colorizing and self.colorizing: ! if __debug__: print "stop colorizing" self.stop_colorizing = 1 self.allow_colorizing = not self.allow_colorizing if self.allow_colorizing and not self.colorizing: self.after_id = self.after(1, self.recolorize) ! if __debug__: print "auto colorizing turned", self.allow_colorizing and "on" or "off" return "break" --- 114,126 ---- after_id = self.after_id self.after_id = None ! if DEBUG: print "cancel scheduled recolorizer" self.after_cancel(after_id) if self.allow_colorizing and self.colorizing: ! if DEBUG: print "stop colorizing" self.stop_colorizing = 1 self.allow_colorizing = not self.allow_colorizing if self.allow_colorizing and not self.colorizing: self.after_id = self.after(1, self.recolorize) ! if DEBUG: print "auto colorizing turned", self.allow_colorizing and "on" or "off" return "break" *************** *** 129,152 **** self.after_id = None if not self.delegate: ! if __debug__: print "no delegate" return if not self.allow_colorizing: ! if __debug__: print "auto colorizing is off" return if self.colorizing: ! if __debug__: print "already colorizing" return try: self.stop_colorizing = 0 self.colorizing = 1 ! if __debug__: print "colorizing..." t0 = time.clock() self.recolorize_main() t1 = time.clock() ! if __debug__: print "%.3f seconds" % (t1-t0) finally: self.colorizing = 0 if self.allow_colorizing and self.tag_nextrange("TODO", "1.0"): ! if __debug__: print "reschedule colorizing" self.after_id = self.after(1, self.recolorize) if self.close_when_done: --- 129,152 ---- self.after_id = None if not self.delegate: ! if DEBUG: print "no delegate" return if not self.allow_colorizing: ! if DEBUG: print "auto colorizing is off" return if self.colorizing: ! if DEBUG: print "already colorizing" return try: self.stop_colorizing = 0 self.colorizing = 1 ! if DEBUG: print "colorizing..." t0 = time.clock() self.recolorize_main() t1 = time.clock() ! if DEBUG: print "%.3f seconds" % (t1-t0) finally: self.colorizing = 0 if self.allow_colorizing and self.tag_nextrange("TODO", "1.0"): ! if DEBUG: print "reschedule colorizing" self.after_id = self.after(1, self.recolorize) if self.close_when_done: *************** *** 228,232 **** self.update() if self.stop_colorizing: ! if __debug__: print "colorizing stopped" return --- 228,232 ---- self.update() if self.stop_colorizing: ! if DEBUG: print "colorizing stopped" return From gvanrossum@users.sourceforge.net Thu Mar 22 17:37:54 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 22 Mar 2001 09:37:54 -0800 Subject: [Python-checkins] CVS: python/dist/src/Tools/idle idlever.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv19556 Modified Files: idlever.py Log Message: Make this IDLE version 0.8. (We have to skip 0.7 because that was a CNRI release in a corner of the basement of a government building on a planet circling Aldebaran.) Index: idlever.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/idlever.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** idlever.py 2000/03/30 20:30:34 1.5 --- idlever.py 2001/03/22 17:37:52 1.6 *************** *** 1 **** ! IDLE_VERSION = "0.6" --- 1 ---- ! IDLE_VERSION = "0.8" From fdrake@users.sourceforge.net Thu Mar 22 17:52:20 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 22 Mar 2001 09:52:20 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules cPickle.c,2.55,2.56 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv22886 Modified Files: cPickle.c Log Message: Make cPickle use the recently-added PyInstance_NewRaw() API to create instance objects without calling the constructor. This is the same as the new.instance() function. Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.55 retrieving revision 2.56 diff -C2 -r2.55 -r2.56 *** cPickle.c 2001/03/17 04:50:51 2.55 --- cPickle.c 2001/03/22 17:52:17 2.56 *************** *** 2923,2940 **** /* We have a class with no __getinitargs__, so bypass usual construction */ ! PyInstanceObject *inst; PyErr_Clear(); ! UNLESS (inst=PyObject_New(PyInstanceObject, &PyInstance_Type)) goto err; ! inst->in_class=(PyClassObject*)cls; ! Py_INCREF(cls); ! UNLESS (inst->in_dict=PyDict_New()) { ! inst = (PyInstanceObject *) PyObject_AS_GC(inst); ! PyObject_DEL(inst); ! goto err; ! } ! PyObject_GC_Init(inst); ! return (PyObject *)inst; } Py_DECREF(__getinitargs__); --- 2923,2932 ---- /* We have a class with no __getinitargs__, so bypass usual construction */ ! PyObject *inst; PyErr_Clear(); ! UNLESS (inst=PyInstance_NewRaw(cls, NULL)) goto err; ! return inst; } Py_DECREF(__getinitargs__); From fdrake@users.sourceforge.net Thu Mar 22 18:05:33 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 22 Mar 2001 10:05:33 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules _weakref.c,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv25542 Modified Files: _weakref.c Log Message: Inform the cycle-detector that the a weakref object no longer needs to be tracked as soon as it is clear; this can decrease the number of roots for the cycle detector sooner rather than later in applications which hold on to weak references beyond the time of the invalidation. Index: _weakref.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_weakref.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** _weakref.c 2001/02/27 18:36:56 1.7 --- _weakref.c 2001/03/22 18:05:30 1.8 *************** *** 60,63 **** --- 60,64 ---- PyWeakReference **list = GET_WEAKREFS_LISTPTR(self->wr_object); + PyObject_GC_Fini((PyObject *)self); if (*list == self) *list = self->wr_next; *************** *** 79,83 **** { clear_weakref(self); - PyObject_GC_Fini((PyObject *)self); self->wr_next = free_list; free_list = self; --- 80,83 ---- From fdrake@users.sourceforge.net Thu Mar 22 18:26:49 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 22 Mar 2001 10:26:49 -0800 Subject: [Python-checkins] CVS: python/dist/src/Include objimpl.h,2.33,2.34 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv30079/Include Modified Files: objimpl.h Log Message: A small change to the C API for weakly-referencable types: Such types must now initialize the extra field used by the weak-ref machinery to NULL themselves, to avoid having to require PyObject_INIT() to check if the type supports weak references and do it there. This causes less work to be done for all objects (the type object does not need to be consulted to check for the Py_TPFLAGS_HAVE_WEAKREFS bit). Index: objimpl.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/objimpl.h,v retrieving revision 2.33 retrieving revision 2.34 diff -C2 -r2.33 -r2.34 *** objimpl.h 2001/02/27 04:45:05 2.33 --- objimpl.h 2001/03/22 18:26:47 2.34 *************** *** 168,176 **** Note that these macros expect non-NULL object pointers.*/ #define PyObject_INIT(op, typeobj) \ ! ((op)->ob_type = (typeobj), _Py_NewReference((PyObject *)(op)), \ ! (PyType_SUPPORTS_WEAKREFS((typeobj)) \ ! ? *(PyObject_GET_WEAKREFS_LISTPTR(op)) = NULL \ ! : NULL), \ ! (op)) #define PyObject_INIT_VAR(op, typeobj, size) \ ( (op)->ob_size = (size), PyObject_INIT((op), (typeobj)) ) --- 168,172 ---- Note that these macros expect non-NULL object pointers.*/ #define PyObject_INIT(op, typeobj) \ ! ( (op)->ob_type = (typeobj), _Py_NewReference((PyObject *)(op)), (op) ) #define PyObject_INIT_VAR(op, typeobj, size) \ ( (op)->ob_size = (size), PyObject_INIT((op), (typeobj)) ) From fdrake@users.sourceforge.net Thu Mar 22 18:26:49 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 22 Mar 2001 10:26:49 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects classobject.c,2.123,2.124 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv30079/Objects Modified Files: classobject.c Log Message: A small change to the C API for weakly-referencable types: Such types must now initialize the extra field used by the weak-ref machinery to NULL themselves, to avoid having to require PyObject_INIT() to check if the type supports weak references and do it there. This causes less work to be done for all objects (the type object does not need to be consulted to check for the Py_TPFLAGS_HAVE_WEAKREFS bit). Index: classobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/classobject.c,v retrieving revision 2.123 retrieving revision 2.124 diff -C2 -r2.123 -r2.124 *** classobject.c 2001/02/26 18:56:37 2.123 --- classobject.c 2001/03/22 18:26:47 2.124 *************** *** 454,457 **** --- 454,458 ---- return NULL; } + inst->in_weakreflist = NULL; Py_INCREF(klass); inst->in_class = (PyClassObject *)klass; From fdrake@users.sourceforge.net Thu Mar 22 18:26:49 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 22 Mar 2001 10:26:49 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.137,1.138 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv30079/Misc Modified Files: NEWS Log Message: A small change to the C API for weakly-referencable types: Such types must now initialize the extra field used by the weak-ref machinery to NULL themselves, to avoid having to require PyObject_INIT() to check if the type supports weak references and do it there. This causes less work to be done for all objects (the type object does not need to be consulted to check for the Py_TPFLAGS_HAVE_WEAKREFS bit). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.137 retrieving revision 1.138 diff -C2 -r1.137 -r1.138 *** NEWS 2001/03/22 15:42:08 1.137 --- NEWS 2001/03/22 18:26:47 1.138 *************** *** 62,65 **** --- 62,71 ---- number from a Py_complex C value. + - Extensions types which support weak references must now set the + field allocated for the weak reference machinery to NULL themselves; + this is done to avoid the cost of checking each object for having a + weakly referencable type in PyObject_INIT(), since most types are + not weakly referencable. + Distutils From gvanrossum@users.sourceforge.net Thu Mar 22 21:59:22 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 22 Mar 2001 13:59:22 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib cmd.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv9037 Modified Files: cmd.py Log Message: This is SF patch #405952, by Anthony Baxter: cmd.py uses raw_input(); eats SIGCLD: I discovered a rather nasty side effect of the standard cmd.py library today. If it's sitting inside raw_input(), any SIGCLDs that get sent to your application get silently eaten and ignored. I'm assuming that this is something that readline is thoughtfully doing for me. This patch adds an instance attr that allows the user to select to not use raw_input(), but instead use sys.stdin.readline() [Changed slightly to catch EOFError only for raw_input().] Index: cmd.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/cmd.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -r1.22 -r1.23 *** cmd.py 2001/02/09 04:52:11 1.22 --- cmd.py 2001/03/22 21:59:20 1.23 *************** *** 36,40 **** """ ! import string __all__ = ["Cmd"] --- 36,40 ---- """ ! import string, sys __all__ = ["Cmd"] *************** *** 55,58 **** --- 55,59 ---- undoc_header = "Undocumented commands:" nohelp = "*** No help on %s" + use_rawinput = 1 def __init__(self): pass *************** *** 70,77 **** del self.cmdqueue[0] else: ! try: ! line = raw_input(self.prompt) ! except EOFError: ! line = 'EOF' line = self.precmd(line) stop = self.onecmd(line) --- 71,86 ---- del self.cmdqueue[0] else: ! if self.use_rawinput: ! try: ! line = raw_input(self.prompt) ! except EOFError: ! line = 'EOF' ! else: ! sys.stdout.write(self.prompt) ! line = sys.stdin.readline() ! if not len(line): ! line = 'EOF' ! else: ! line = line[:-1] # chop \n line = self.precmd(line) stop = self.onecmd(line) From gvanrossum@users.sourceforge.net Thu Mar 22 22:12:19 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 22 Mar 2001 14:12:19 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib socket.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv10021 Modified Files: socket.py Log Message: Add a wrapper function for ssl() on Windows. Inspired by SF patch # 409287, ssl fix when using _socketobject, by Robin Dunn. I took the opportunity to improve the way it deals with reload(socket) for the socket function as well. Index: socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/socket.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** socket.py 2001/03/18 19:53:21 1.9 --- socket.py 2001/03/22 22:12:17 1.10 *************** *** 46,50 **** import _socket __all__.extend(os._get_exports_list(_socket)) - del _socket if (sys.platform.lower().startswith("win") --- 46,49 ---- *************** *** 52,63 **** or (sys.platform=="RISCOS")): ! # be sure this happens only once, even in the face of reload(): ! try: ! _realsocketcall ! except NameError: ! _realsocketcall = socket def socket(family, type, proto=0): return _socketobject(_realsocketcall(family, type, proto)) --- 51,68 ---- or (sys.platform=="RISCOS")): ! _realsocketcall = _socket.socket def socket(family, type, proto=0): return _socketobject(_realsocketcall(family, type, proto)) + + try: + _realsslcall = _socket.ssl + except AttributeError: + pass # No ssl + else: + def ssl(sock, keyfile=None, certfile=None): + if hasattr(sock, "_sock"): + sock = sock._sock + return _realsslcall(sock, keyfile, certfile) From gvanrossum@users.sourceforge.net Thu Mar 22 22:18:57 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 22 Mar 2001 14:18:57 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules Setup.dist,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv12046 Modified Files: Setup.dist Log Message: Update the Tix version (long overdue :-). This is SF patch # #409044, by Internet Discovery: "Update tcl/tk/tix versions". Index: Setup.dist =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/Setup.dist,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -r1.20 -r1.21 *** Setup.dist 2001/02/27 03:29:52 1.20 --- Setup.dist 2001/03/22 22:18:55 1.21 *************** *** 300,303 **** --- 300,305 ---- # *** Always uncomment this (leave the leading underscore in!): # _tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \ + # *** Uncomment and edit to reflect where your Tcl/Tk libraries are: + # -L/usr/local/lib \ # *** Uncomment and edit to reflect where your Tcl/Tk headers are: # -I/usr/local/include \ *************** *** 307,311 **** # -I/usr/openwin/include \ # *** Uncomment and edit for Tix extension only: ! # -DWITH_TIX -ltix4.1.8.0 \ # *** Uncomment and edit for BLT extension only: # -DWITH_BLT -I/usr/local/blt/blt8.0-unoff/include -lBLT8.0 \ --- 309,313 ---- # -I/usr/openwin/include \ # *** Uncomment and edit for Tix extension only: ! # -DWITH_TIX -ltix8.1.8.2 \ # *** Uncomment and edit for BLT extension only: # -DWITH_BLT -I/usr/local/blt/blt8.0-unoff/include -lBLT8.0 \ *************** *** 315,322 **** # *** Uncomment and edit for TOGL extension only: # -DWITH_TOGL togl.c \ - # *** Uncomment and edit to reflect where your Tcl/Tk libraries are: - # -L/usr/local/lib \ # *** Uncomment and edit to reflect your Tcl/Tk versions: ! # -ltk8.0 -ltcl8.0 \ # *** Uncomment and edit to reflect where your X11 libraries are: # -L/usr/X11R6/lib \ --- 317,322 ---- # *** Uncomment and edit for TOGL extension only: # -DWITH_TOGL togl.c \ # *** Uncomment and edit to reflect your Tcl/Tk versions: ! # -ltk8.2 -ltcl8.2 \ # *** Uncomment and edit to reflect where your X11 libraries are: # -L/usr/X11R6/lib \ From gvanrossum@users.sourceforge.net Thu Mar 22 22:30:23 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 22 Mar 2001 14:30:23 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib quopri.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv13779 Modified Files: quopri.py Log Message: Strip \r as trailing whitespace as part of soft line endings. Inspired by SF patch #408597 (Walter Dörwald): quopri, soft line breaks and CRLF. (I changed (" ", "\t", "\r") into " \t\r".) Index: quopri.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/quopri.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** quopri.py 2001/02/12 02:00:42 1.10 --- quopri.py 2001/03/22 22:30:21 1.11 *************** *** 66,70 **** partial = 0; n = n-1 # Strip trailing whitespace ! while n > 0 and line[n-1] in (' ', '\t'): n = n-1 else: --- 66,70 ---- partial = 0; n = n-1 # Strip trailing whitespace ! while n > 0 and line[n-1] in " \t\r": n = n-1 else: From jhylton@users.sourceforge.net Thu Mar 22 23:10:46 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Thu, 22 Mar 2001 15:10:46 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules symtablemodule.c,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv20575 Modified Files: symtablemodule.c Log Message: add DEF_BOUND constant Index: symtablemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/symtablemodule.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** symtablemodule.c 2001/02/09 22:22:18 1.2 --- symtablemodule.c 2001/03/22 23:10:44 1.3 *************** *** 60,63 **** --- 60,64 ---- PyModule_AddIntConstant(m, "DEF_FREE_CLASS", DEF_FREE_CLASS); PyModule_AddIntConstant(m, "DEF_IMPORT", DEF_IMPORT); + PyModule_AddIntConstant(m, "DEF_BOUND", DEF_BOUND); PyModule_AddIntConstant(m, "TYPE_FUNCTION", TYPE_FUNCTION); From effbot@users.sourceforge.net Thu Mar 22 23:29:06 2001 From: effbot@users.sourceforge.net (Fredrik Lundh) Date: Thu, 22 Mar 2001 15:29:06 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_sre,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv22588/lib/test/output Modified Files: test_sre Log Message: SRE 2.1b2: forgot to update one output file (sorry, Fred!) Index: test_sre =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_sre,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** test_sre 2000/09/02 11:03:34 1.10 --- test_sre 2001/03/22 23:29:04 1.11 *************** *** 1 **** --- 1,9 ---- test_sre + sre.match(r'(x)*?y', 50000*'x'+'y').span() FAILED + Traceback (most recent call last): + File "../lib/test\test_sre.py", line 18, in test + r = eval(expression) + File "", line 0, in ? + File "c:\pythonware\py21\python-2.1\lib\sre.py", line 52, in match + return _compile(pattern, flags).match(string) + RuntimeError: maximum recursion limit exceeded From jhylton@users.sourceforge.net Thu Mar 22 23:32:24 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Thu, 22 Mar 2001 15:32:24 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib symtable.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv22849 Added Files: symtable.py Log Message: First cut at a high-level symbol table interface --- NEW FILE: symtable.py --- """Interface to the compiler's internal symbol tables""" from __future__ import nested_scopes import _symtable from _symtable import USE, DEF_GLOBAL, DEF_LOCAL, DEF_PARAM, \ DEF_STAR, DEF_DOUBLESTAR, DEF_INTUPLE, DEF_FREE, \ DEF_FREE_GLOBAL, DEF_FREE_CLASS, DEF_IMPORT, DEF_BOUND import weakref __all__ = ["symtable", "SymbolTable", "newSymbolTable"] def symtable(code, filename, compile_type): raw = _symtable.symtable(code, filename, compile_type) return newSymbolTable(raw[0], filename) class SymbolTableFactory: def __init__(self): self.__memo = weakref.WeakValueDictionary() def new(self, table, filename): if table.type == _symtable.TYPE_FUNCTION: return Function(table, filename) if table.type == _symtable.TYPE_CLASS: return Class(table, filename) return SymbolTable(table, filename) def __call__(self, table, filename): key = table, filename obj = self.__memo.get(key, None) if obj is None: obj = self.__memo[key] = self.new(table, filename) return obj newSymbolTable = SymbolTableFactory() def bool(x): """Helper to force boolean result to 1 or 0""" if x: return 1 return 0 def is_free(flags): if (flags & (USE | DEF_FREE)) \ and (flags & (DEF_LOCAL | DEF_PARAM | DEF_GLOBAL)): return 1 if flags & DEF_FREE_CLASS: return 1 return 0 class SymbolTable: def __init__(self, raw_table, filename): self._table = raw_table self._filename = filename self._symbols = {} def __repr__(self): if self.__class__ == SymbolTable: kind = "" else: kind = "%s " % self.__class__.__name__ if self._table.name == "global": return "<%sSymbolTable for module %s>" % (kind, self._filename) else: return "<%sSymbolTable for %s in %s>" % (kind, self._table.name, self._filename) def get_type(self): if self._table.type == _symtable.TYPE_MODULE: return "module" if self._table.type == _symtable.TYPE_FUNCTION: return "function" if self._table.type == _symtable.TYPE_CLASS: return "class" assert self._table.type in (1, 2, 3), \ "unexpected type: %s" % self._table.type def get_id(self): return self._table.id def get_name(self): return self._table.name def get_lineno(self): return self._table.lineno def is_optimized(self): return bool(self._table.type == _symtable.TYPE_FUNCTION and not self._table.optimized) def is_nested(self): return bool(self._table.nested) def has_children(self): return bool(self._table.children) def has_exec(self): return bool() def get_identifiers(self): return self._table.symbols.keys() def lookup(self, name): sym = self._symbols.get(name) if sym is None: flags = self._table.symbols[name] namespaces = self.__check_children(name) sym = self._symbols[name] = Symbol(name, flags, namespaces) return sym def get_symbols(self): return [self.lookup(ident) for ident in self.get_identifiers()] def __check_children(self, name): return [newSymbolTable(st, self._filename) for st in self._table.children if st.name == name] class Function(SymbolTable): # Default values for instance variables __params = None __locals = None __frees = None __globals = None def __idents_matching(self, test_func): return tuple([ident for ident in self.get_identifiers() if test_func(self._table.symbols[ident])]) def get_parameters(self): if self.__params is None: self.__params = self.__idents_matching(lambda x:x & DEF_PARAM) return self.__params def get_locals(self): if self.__locals is None: self.__locals = self.__idents_matching(lambda x:x & DEF_BOUND) return self.__locals def get_globals(self): if self.__globals is None: glob = DEF_GLOBAL | DEF_FREE_GLOBAL self.__globals = self.__idents_matching(lambda x:x & glob) return self.__globals def get_frees(self): if self.__frees is None: self.__frees = self.__idents_matching(is_free) return self.__frees class Class(SymbolTable): __methods = None def get_methods(self): if self.__methods is None: d = {} for st in self._table.children: d[st.name] = 1 self.__methods = tuple(d.keys()) return self.__methods class Symbol: def __init__(self, name, flags, namespaces=None): self.__name = name self.__flags = flags self.__namespaces = namespaces or () def __repr__(self): return "" % self.__name def get_name(self): return self.__name def is_referenced(self): return bool(self.__flags & _symtable.USE) def is_parameter(self): return bool(self.__flags & DEF_PARAM) def is_global(self): return bool((self.__flags & DEF_GLOBAL) or (self.__flags & DEF_FREE_GLOBAL)) def is_vararg(self): return bool(self.flag & DEF_STAR) def is_keywordarg(self): return bool(self.__flags & DEF_STARSTAR) def is_local(self): return bool(self.__flags & DEF_BOUND) def is_free(self): if (self.__flags & (USE | DEF_FREE)) \ and (self.__flags & (DEF_LOCAL | DEF_PARAM | DEF_GLOBAL)): return 1 if self.__flags & DEF_FREE_CLASS: return 1 return 0 def is_imported(self): return bool(self.__flags & DEF_IMPORT) def is_assigned(self): return bool(self.__flags & DEF_LOCAL) def is_in_tuple(self): return bool(self.__flags & DEF_INTUPLE) def is_namespace(self): """Returns true if name binding introduces new namespace. If the name is used as the target of a function or class statement, this will be true. Note that a single name can be bound to multiple objects. If is_namespace() is true, the name may also be bound to other objects, like an int or list, that does not introduce a new namespace. """ return bool(self.__namespaces) def get_namespaces(self): """Return a list of namespaces bound to this name""" return self.__namespaces def get_namespace(self): """Returns the single namespace bound to this name. Raises ValueError if the name is bound to multiple namespaces. """ if len(self.__namespaces) != 1: raise ValueError, "name is bound to multiple namespaces" return self.__namespaces[0] if __debug__: class Foo: version = 1 class Foo: version = 2 class Foo: version = 3 def execfunc(x): exec x in y if __name__ == "__main__": import os, sys src = open(sys.argv[0]).read() mod = symtable(src, os.path.split(sys.argv[0])[1], "exec") for ident in mod.get_identifiers(): info = mod.lookup(ident) print info, info.is_local(), info.is_namespace() From effbot@users.sourceforge.net Thu Mar 22 23:48:30 2001 From: effbot@users.sourceforge.net (Fredrik Lundh) Date: Thu, 22 Mar 2001 15:48:30 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_sre.py,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv24245/lib/test Modified Files: test_sre.py Log Message: SRE 2.1b2: increase the chances that the sre test works on other machines... Index: test_sre.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sre.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -r1.23 -r1.24 *** test_sre.py 2001/03/22 15:50:10 1.23 --- test_sre.py 2001/03/22 23:48:28 1.24 *************** *** 244,253 **** # Try nasty case that overflows the straightforward recursive # implementation of repeated groups. ! test(r"""sre.match(r'(x)*', 50000*'x').span()""", ! (0, 50000), RuntimeError) ! test(r"""sre.match(r'(x)*y', 50000*'x'+'y').span()""", ! (0, 50001), RuntimeError) ! test(r"""sre.match(r'(x)*?y', 50000*'x'+'y').span()""", ! (0, 50001)) # this works in 2.1 from re_tests import * --- 244,250 ---- # Try nasty case that overflows the straightforward recursive # implementation of repeated groups. ! test("sre.match('(x)*', 50000*'x').span()", (0, 50000), RuntimeError) ! test("sre.match(r'(x)*y', 50000*'x'+'y').span()", (0, 50001), RuntimeError) ! test("sre.match(r'(x)*?y', 50000*'x'+'y').span()", (0, 50001), RuntimeError) from re_tests import * From effbot@users.sourceforge.net Thu Mar 22 23:48:31 2001 From: effbot@users.sourceforge.net (Fredrik Lundh) Date: Thu, 22 Mar 2001 15:48:31 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_sre,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv24245/lib/test/output Modified Files: test_sre Log Message: SRE 2.1b2: increase the chances that the sre test works on other machines... Index: test_sre =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_sre,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** test_sre 2001/03/22 23:29:04 1.11 --- test_sre 2001/03/22 23:48:28 1.12 *************** *** 1,9 **** test_sre - sre.match(r'(x)*?y', 50000*'x'+'y').span() FAILED - Traceback (most recent call last): - File "../lib/test\test_sre.py", line 18, in test - r = eval(expression) - File "", line 0, in ? - File "c:\pythonware\py21\python-2.1\lib\sre.py", line 52, in match - return _compile(pattern, flags).match(string) - RuntimeError: maximum recursion limit exceeded --- 1 ---- From ping@users.sourceforge.net Fri Mar 23 00:12:55 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Thu, 22 Mar 2001 16:12:55 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv25567 Modified Files: pydoc.py Log Message: Fixes for various issues reported and discovered since Python 9: Factor description of import errors into DocImportError.__str__. Add "docother" and "fail" methods to Doc class. Factor formatting of constants into "docother". Increase max string repr limit to 100 characters. Factor page generation into HTMLDoc.page. Handle aliasing of names (objects appearing under an attribute name different from their intrinsic __name__) by passing the attribute name into each doc* method. Handle methods at top level of modules (e.g. in random). Try to do reloading efficiently. Important fixes still to do: Module reloading is broken by the unfortunate property that failed imports leave an incomplete module in sys. Still need to think of a good solution. Can't document modules in the current directory, due to the other unfortunate property that sys.path gets '.' when you run 'python' but it gets the script directory when you run a script. Need to ponder to find a solution. The synopsis() routine does not work on .so modules. Aliases cause duplicate copies of documentation to appear. This is easy to fix, just more work. Classes appear as their intrinsic name, not their attribute name, in the class hierarchy. This should be fixed. Inherited methods should be listed in class descriptions. Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** pydoc.py 2001/03/16 08:29:47 1.16 --- pydoc.py 2001/03/23 00:12:53 1.17 *************** *** 5,26 **** help. Calling help(thing) on a Python object documents the object. ! At the shell command line outside of Python: ! Run "pydoc " to show documentation on something. may be ! the name of a function, module, package, or a dotted reference to a ! class or function within a module or module in a package. If the ! argument contains a path segment delimiter (e.g. slash on Unix, ! backslash on Windows) it is treated as the path to a Python source file. ! ! Run "pydoc -k " to search for a keyword in the synopsis lines [...1179 lines suppressed...] except DocImportError, value: ! print 'Problem in %s - %s' % (value.filename, value.args) except (getopt.error, BadUsage): --- 1485,1499 ---- for arg in args: try: ! if ispath(arg) and os.path.isfile(arg): arg = importfile(arg) ! if writing: ! if ispath(arg) and os.path.isdir(arg): ! writedocs(arg) ! else: ! writedoc(arg) ! else: ! man(arg) except DocImportError, value: ! print value except (getopt.error, BadUsage): From ping@users.sourceforge.net Fri Mar 23 02:46:54 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Thu, 22 Mar 2001 18:46:54 -0800 Subject: [Python-checkins] CVS: python/dist/src/Include pythonrun.h,2.40,2.41 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv9091/Include Modified Files: pythonrun.h Log Message: Add sys.excepthook. Update docstring and library reference section on 'sys' module. New API PyErr_Display, just for displaying errors, called by excepthook. Uncaught exceptions now call sys.excepthook; if that fails, we fall back to calling PyErr_Display directly. Also comes with sys.__excepthook__ and sys.__displayhook__. Index: pythonrun.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pythonrun.h,v retrieving revision 2.40 retrieving revision 2.41 diff -C2 -r2.40 -r2.41 *** pythonrun.h 2001/03/22 02:47:57 2.40 --- pythonrun.h 2001/03/23 02:46:52 2.41 *************** *** 60,63 **** --- 60,64 ---- DL_IMPORT(void) PyErr_Print(void); DL_IMPORT(void) PyErr_PrintEx(int); + DL_IMPORT(void) PyErr_Display(PyObject *, PyObject *, PyObject *); DL_IMPORT(int) Py_AtExit(void (*func)(void)); From ping@users.sourceforge.net Fri Mar 23 02:46:54 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Thu, 22 Mar 2001 18:46:54 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libsys.tex,1.44,1.45 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv9091/Doc/lib Modified Files: libsys.tex Log Message: Add sys.excepthook. Update docstring and library reference section on 'sys' module. New API PyErr_Display, just for displaying errors, called by excepthook. Uncaught exceptions now call sys.excepthook; if that fails, we fall back to calling PyErr_Display directly. Also comes with sys.__excepthook__ and sys.__displayhook__. Index: libsys.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsys.tex,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -r1.44 -r1.45 *** libsys.tex 2001/01/11 05:41:27 1.44 --- libsys.tex 2001/03/23 02:46:52 1.45 *************** *** 49,56 **** \code{sys.stdout}, and saves it in \code{__builtin__._}. ! This function is called when an expression is entered at the prompt ! of an interactive Python session. It exists mainly so it can be ! overridden. \end{funcdesc} \begin{funcdesc}{exc_info}{} --- 49,77 ---- \code{sys.stdout}, and saves it in \code{__builtin__._}. ! \code{sys.displayhook} is called on the result of evaluating ! an expression entered in an interactive Python session. ! The display of these values can be customized by assigning ! another function to \code{sys.displayhook}. \end{funcdesc} + + \begin{funcdesc}{excepthook}{\var{type}, \var{value}, \var{traceback}} + This function prints out a given traceback and exception to + \code{sys.stderr}. + + \code{sys.excepthook} is called when an exception is raised + and uncaught. In an interactive session this happens just before + control is returned to the prompt; in a Python program this happens + just before the program exits. + The handling of such top-level exceptions can be customized by + assigning another function to \code{sys.excepthook}. + \end{funcdesc} + + \begin{datadesc}{__displayhook__} + \dataline{__excepthook__} + These objects contain the original values of \code{displayhook} + and \code{excepthook} at the start of the program. They are saved + so that \code{displayhook} and \code{excepthook} can be restored + in case they happen to get replaced with broken objects. + \end{datadesc} \begin{funcdesc}{exc_info}{} From ping@users.sourceforge.net Fri Mar 23 02:46:54 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Thu, 22 Mar 2001 18:46:54 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python pythonrun.c,2.127,2.128 sysmodule.c,2.83,2.84 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv9091/Python Modified Files: pythonrun.c sysmodule.c Log Message: Add sys.excepthook. Update docstring and library reference section on 'sys' module. New API PyErr_Display, just for displaying errors, called by excepthook. Uncaught exceptions now call sys.excepthook; if that fails, we fall back to calling PyErr_Display directly. Also comes with sys.__excepthook__ and sys.__displayhook__. Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.127 retrieving revision 2.128 diff -C2 -r2.127 -r2.128 *** pythonrun.c 2001/03/22 02:47:58 2.127 --- pythonrun.c 2001/03/23 02:46:52 2.128 *************** *** 802,807 **** PyErr_PrintEx(int set_sys_last_vars) { ! int err = 0; ! PyObject *exception, *v, *tb, *f; PyErr_Fetch(&exception, &v, &tb); PyErr_NormalizeException(&exception, &v, &tb); --- 802,806 ---- PyErr_PrintEx(int set_sys_last_vars) { ! PyObject *exception, *v, *tb, *hook; PyErr_Fetch(&exception, &v, &tb); PyErr_NormalizeException(&exception, &v, &tb); *************** *** 845,850 **** PySys_SetObject("last_value", v); PySys_SetObject("last_traceback", tb); } ! f = PySys_GetObject("stderr"); if (f == NULL) fprintf(stderr, "lost sys.stderr\n"); --- 844,881 ---- PySys_SetObject("last_value", v); PySys_SetObject("last_traceback", tb); + } + hook = PySys_GetObject("excepthook"); + if (hook) { + PyObject *args = Py_BuildValue("(OOO)", + exception, v ? v : Py_None, tb ? tb : Py_None); + PyObject *result = PyEval_CallObject(hook, args); + if (result == NULL) { + PyObject *exception2, *v2, *tb2; + PyErr_Fetch(&exception2, &v2, &tb2); + PyErr_NormalizeException(&exception2, &v2, &tb2); + if (Py_FlushLine()) + PyErr_Clear(); + fflush(stdout); + PySys_WriteStderr("Error in sys.excepthook:\n"); + PyErr_Display(exception2, v2, tb2); + PySys_WriteStderr("\nOriginal exception was:\n"); + PyErr_Display(exception, v, tb); + } + Py_XDECREF(result); + Py_XDECREF(args); + } else { + PySys_WriteStderr("sys.excepthook is missing\n"); + PyErr_Display(exception, v, tb); } ! Py_XDECREF(exception); ! Py_XDECREF(v); ! Py_XDECREF(tb); ! } ! ! void PyErr_Display(PyObject *exception, PyObject *value, PyObject *tb) ! { ! int err = 0; ! PyObject *v = value; ! PyObject *f = PySys_GetObject("stderr"); if (f == NULL) fprintf(stderr, "lost sys.stderr\n"); *************** *** 853,857 **** PyErr_Clear(); fflush(stdout); ! err = PyTraceBack_Print(tb, f); if (err == 0 && PyErr_GivenExceptionMatches(exception, PyExc_SyntaxError)) --- 884,889 ---- PyErr_Clear(); fflush(stdout); ! if (tb && tb != Py_None) ! err = PyTraceBack_Print(tb, f); if (err == 0 && PyErr_GivenExceptionMatches(exception, PyExc_SyntaxError)) *************** *** 876,881 **** if (text != NULL) print_error_text(f, offset, text); - Py_INCREF(message); - Py_DECREF(v); v = message; /* Can't be bothered to check all those --- 908,911 ---- *************** *** 933,939 **** err = PyFile_WriteString("\n", f); } - Py_XDECREF(exception); - Py_XDECREF(v); - Py_XDECREF(tb); /* If an error happened here, don't show it. XXX This is wrong, but too many callers rely on this behavior. */ --- 963,966 ---- Index: sysmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/sysmodule.c,v retrieving revision 2.83 retrieving revision 2.84 diff -C2 -r2.83 -r2.84 *** sysmodule.c 2001/01/13 22:06:05 2.83 --- sysmodule.c 2001/03/23 02:46:52 2.84 *************** *** 108,116 **** static char displayhook_doc[] = ! "displayhook(o) -> None\n" "\n" ! "Print o to the stdout, and save it in __builtin__._\n"; static PyObject * sys_exc_info(PyObject *self, PyObject *args) { --- 108,132 ---- static char displayhook_doc[] = ! "displayhook(object) -> None\n" "\n" ! "Print an object to sys.stdout and also save it in __builtin__._\n"; static PyObject * + sys_excepthook(PyObject* self, PyObject* args) + { + PyObject *exc, *value, *tb; + if (!PyArg_ParseTuple(args, "OOO:excepthook", &exc, &value, &tb)) + return NULL; + PyErr_Display(exc, value, tb); + Py_INCREF(Py_None); + return Py_None; + } + + static char excepthook_doc[] = + "excepthook(exctype, value, traceback) -> None\n" + "\n" + "Handle an exception by displaying it with a traceback on sys.stderr.\n"; + + static PyObject * sys_exc_info(PyObject *self, PyObject *args) { *************** *** 379,382 **** --- 395,399 ---- {"displayhook", sys_displayhook, 1, displayhook_doc}, {"exc_info", sys_exc_info, 1, exc_info_doc}, + {"excepthook", sys_excepthook, 1, excepthook_doc}, {"exit", sys_exit, 0, exit_doc}, {"getdefaultencoding", sys_getdefaultencoding, 1, *************** *** 478,488 **** path -- module search path; path[0] is the script directory, else ''\n\ modules -- dictionary of loaded modules\n\ ! exitfunc -- you may set this to a function to be called when Python exits\n\ \n\ stdin -- standard input file object; used by raw_input() and input()\n\ stdout -- standard output file object; used by the print statement\n\ stderr -- standard error object; used for error messages\n\ ! By assigning another file object (or an object that behaves like a file)\n\ ! to one of these, it is possible to redirect all of the interpreter's I/O.\n\ \n\ last_type -- type of last uncaught exception\n\ --- 495,512 ---- path -- module search path; path[0] is the script directory, else ''\n\ modules -- dictionary of loaded modules\n\ ! \n\ ! displayhook -- called to show results in an interactive session\n\ ! excepthook -- called to handle any uncaught exception other than SystemExit\n\ ! To customize printing in an interactive session or to install a custom\n\ ! top-level exception handler, assign other functions to replace these.\n\ ! \n\ ! exitfunc -- if sys.exitfunc exists, this routine is called when Python exits\n\ ! Assigning to sys.exitfunc is deprecated; use the atexit module instead.\n\ \n\ stdin -- standard input file object; used by raw_input() and input()\n\ stdout -- standard output file object; used by the print statement\n\ stderr -- standard error object; used for error messages\n\ ! By assigning other file objects (or objects that behave like files)\n\ ! to these, it is possible to redirect all of the interpreter's I/O.\n\ \n\ last_type -- type of last uncaught exception\n\ *************** *** 499,503 **** " #ifndef MS_WIN16 ! /* Concatenating string here */ "\n\ Static objects:\n\ --- 523,527 ---- " #ifndef MS_WIN16 ! /* concatenating string here */ "\n\ Static objects:\n\ *************** *** 513,525 **** prefix -- prefix used to find the Python library\n\ exec_prefix -- prefix used to find the machine-specific Python library\n\ ! dllhandle -- [Windows only] integer handle of the Python DLL\n\ winver -- [Windows only] version number of the Python DLL\n\ ! __stdin__ -- the original stdin; don't use!\n\ ! __stdout__ -- the original stdout; don't use!\n\ ! __stderr__ -- the original stderr; don't use!\n\ \n\ Functions:\n\ \n\ displayhook() -- print an object to the screen, and save it in __builtin__._\n\ exc_info() -- return thread-safe information about the current exception\n\ exit() -- exit the interpreter by raising SystemExit\n\ --- 537,557 ---- prefix -- prefix used to find the Python library\n\ exec_prefix -- prefix used to find the machine-specific Python library\n\ ! " ! #ifdef MS_WINDOWS ! /* concatenating string here */ ! "dllhandle -- [Windows only] integer handle of the Python DLL\n\ winver -- [Windows only] version number of the Python DLL\n\ ! " ! #endif /* MS_WINDOWS */ ! "__stdin__ -- the original stdin; don't touch!\n\ ! __stdout__ -- the original stdout; don't touch!\n\ ! __stderr__ -- the original stderr; don't touch!\n\ ! __displayhook__ -- the original displayhook; don't touch!\n\ ! __excepthook__ -- the original excepthook; don't touch!\n\ \n\ Functions:\n\ \n\ displayhook() -- print an object to the screen, and save it in __builtin__._\n\ + excepthook() -- print an exception and its traceback to sys.stderr\n\ exc_info() -- return thread-safe information about the current exception\n\ exit() -- exit the interpreter by raising SystemExit\n\ *************** *** 531,535 **** settrace() -- set the global debug tracing function\n\ " ! #endif /* end of sys_doc */ ; --- 563,567 ---- settrace() -- set the global debug tracing function\n\ " ! #endif /* MS_WIN16 */ /* end of sys_doc */ ; *************** *** 556,559 **** --- 588,595 ---- PyDict_SetItemString(sysdict, "__stdout__", sysout); PyDict_SetItemString(sysdict, "__stderr__", syserr); + PyDict_SetItemString(sysdict, "__displayhook__", + PyDict_GetItemString(sysdict, "displayhook")); + PyDict_SetItemString(sysdict, "__excepthook__", + PyDict_GetItemString(sysdict, "excepthook")); Py_XDECREF(sysin); Py_XDECREF(sysout); From tim_one@users.sourceforge.net Fri Mar 23 03:43:37 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 22 Mar 2001 19:43:37 -0800 Subject: [Python-checkins] CVS: python/dist/src/PCbuild python20.wse,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv13436/python/dist/src/PCbuild Modified Files: python20.wse Log Message: Add Jeremy's compiler to the Windows install. Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -r1.34 -r1.35 *** python20.wse 2001/03/21 06:09:14 1.34 --- python20.wse 2001/03/23 03:43:35 1.35 *************** *** 1024,1027 **** --- 1024,1045 ---- end item: Install File + Source=%_SRC_%\Tools\compiler\*.py + Destination=%MAINDIR%\Tools\compiler + Description=Python compiler written in Python + Flags=0000000000000010 + end + item: Install File + Source=%_SRC_%\Tools\compiler\compiler\*.py + Destination=%MAINDIR%\Tools\compiler\compiler + Description=Python compiler written in Python + Flags=0000000000000010 + end + item: Install File + Source=%_SRC_%\Tools\compiler\compiler\*.txt + Destination=%MAINDIR%\Tools\compiler\compiler + Description=Python compiler written in Python + Flags=0000000000000010 + end + item: Install File Source=%_SRC_%\Tools\pynche\*.py Destination=%MAINDIR%\Tools\pynche From gvanrossum@users.sourceforge.net Fri Mar 23 04:01:09 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 22 Mar 2001 20:01:09 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python pythonrun.c,2.128,2.129 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv15672 Modified Files: pythonrun.c Log Message: Fix memory leak with SyntaxError. (The DECREF was originally hidden inside a piece of code that was deemed reduntant; the DECREF was unfortunately *not* redundant!) Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.128 retrieving revision 2.129 diff -C2 -r2.128 -r2.129 *** pythonrun.c 2001/03/23 02:46:52 2.128 --- pythonrun.c 2001/03/23 04:01:07 2.129 *************** *** 1202,1205 **** --- 1202,1206 ---- } w = Py_BuildValue("(sO)", msg, v); + Py_XDECREF(v); PyErr_SetObject(errtype, w); Py_XDECREF(w); From fdrake@users.sourceforge.net Fri Mar 23 04:18:00 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 22 Mar 2001 20:18:00 -0800 Subject: [Python-checkins] CVS: python/dist/src/Include classobject.h,2.36,2.37 funcobject.h,2.22,2.23 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv17016/Include Modified Files: classobject.h funcobject.h Log Message: Add the necessary field for weak reference support to the function and method types. Index: classobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/classobject.h,v retrieving revision 2.36 retrieving revision 2.37 diff -C2 -r2.36 -r2.37 *** classobject.h 2001/02/01 05:25:27 2.36 --- classobject.h 2001/03/23 04:17:58 2.37 *************** *** 33,36 **** --- 33,37 ---- PyObject *im_self; /* The instance it is bound to, or NULL */ PyObject *im_class; /* The class that defined the method */ + PyObject *im_weakreflist; /* List of weak references */ } PyMethodObject; Index: funcobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/funcobject.h,v retrieving revision 2.22 retrieving revision 2.23 diff -C2 -r2.22 -r2.23 *** funcobject.h 2001/01/25 20:06:58 2.22 --- funcobject.h 2001/03/23 04:17:58 2.23 *************** *** 17,20 **** --- 17,21 ---- PyObject *func_name; PyObject *func_dict; + PyObject *func_weakreflist; } PyFunctionObject; From fdrake@users.sourceforge.net Fri Mar 23 04:19:29 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 22 Mar 2001 20:19:29 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects classobject.c,2.124,2.125 funcobject.c,2.36,2.37 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv17177/Objects Modified Files: classobject.c funcobject.c Log Message: Add support for weak references to the function and method types. Index: classobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/classobject.c,v retrieving revision 2.124 retrieving revision 2.125 diff -C2 -r2.124 -r2.125 *** classobject.c 2001/03/22 18:26:47 2.124 --- classobject.c 2001/03/23 04:19:27 2.125 *************** *** 1806,1809 **** --- 1806,1810 ---- return NULL; } + im->im_weakreflist = NULL; Py_INCREF(func); im->im_func = func; *************** *** 1903,1906 **** --- 1904,1908 ---- instancemethod_dealloc(register PyMethodObject *im) { + PyObject_ClearWeakRefs((PyObject *)im); PyObject_GC_Fini(im); Py_DECREF(im->im_func); *************** *** 2020,2026 **** (setattrofunc)instancemethod_setattro, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC, /* tp_flags */ 0, /* tp_doc */ (traverseproc)instancemethod_traverse, /* tp_traverse */ }; --- 2022,2031 ---- (setattrofunc)instancemethod_setattro, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC | Py_TPFLAGS_HAVE_WEAKREFS, 0, /* tp_doc */ (traverseproc)instancemethod_traverse, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + offsetof(PyMethodObject, im_weakreflist) /* tp_weaklistoffset */ }; Index: funcobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/funcobject.c,v retrieving revision 2.36 retrieving revision 2.37 diff -C2 -r2.36 -r2.37 *** funcobject.c 2001/03/01 06:06:37 2.36 --- funcobject.c 2001/03/23 04:19:27 2.37 *************** *** 14,17 **** --- 14,18 ---- PyObject *doc; PyObject *consts; + op->func_weakreflist = NULL; Py_INCREF(code); op->func_code = code; *************** *** 246,249 **** --- 247,251 ---- func_dealloc(PyFunctionObject *op) { + PyObject_ClearWeakRefs((PyObject *) op); PyObject_GC_Fini(op); Py_DECREF(op->func_code); *************** *** 328,332 **** 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ ! 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ --- 330,334 ---- 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ ! 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ *************** *** 334,339 **** (setattrofunc)func_setattro, /*tp_setattro*/ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC, /*tp_flags*/ 0, /* tp_doc */ (traverseproc)func_traverse, /* tp_traverse */ }; --- 336,344 ---- (setattrofunc)func_setattro, /*tp_setattro*/ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC | Py_TPFLAGS_HAVE_WEAKREFS, 0, /* tp_doc */ (traverseproc)func_traverse, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + offsetof(PyFunctionObject, func_weakreflist), /* tp_weaklistoffset */ }; From fdrake@users.sourceforge.net Fri Mar 23 04:21:19 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 22 Mar 2001 20:21:19 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_support.py,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv17445 Modified Files: test_support.py Log Message: When the regression test is run in verbose mode, make the PyUNIT-based tests a little noisier, providing more progress information. Index: test_support.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_support.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -r1.19 -r1.20 *** test_support.py 2001/03/22 08:45:36 1.19 --- test_support.py 2001/03/23 04:21:17 1.20 *************** *** 113,117 **** """Run tests from a unittest.TestCase-derived class.""" if verbose: ! runner = unittest.TextTestRunner(sys.stdout, descriptions=0) else: runner = BasicTestRunner() --- 113,117 ---- """Run tests from a unittest.TestCase-derived class.""" if verbose: ! runner = unittest.TextTestRunner(sys.stdout, verbosity=2) else: runner = BasicTestRunner() From fdrake@users.sourceforge.net Fri Mar 23 04:22:47 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 22 Mar 2001 20:22:47 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_weakref.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv17584 Modified Files: test_weakref.py Log Message: Convert the weakref test suite to PyUNIT, and add tests that exercise weak references on function objects and both bound and unbound methods. Index: test_weakref.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_weakref.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** test_weakref.py 2001/03/01 03:06:53 1.3 --- test_weakref.py 2001/03/23 04:22:45 1.4 *************** *** 1,136 **** import sys import weakref ! from test_support import TestFailed, verify class C: ! pass ! print "Basic Weak References" - print "-- Liveness and referent identity" ! o = C() ! ref = weakref.ref(o) ! verify(ref() is not None, "weak reference to live object should be live") ! o2 = ref() ! verify(ref() is not None, "weak ref should still be live") ! verify(o is o2, "() should return original object if live") ! del o, o2 ! del ref ! ! cbcalled = 0 ! def callback(o): ! global cbcalled ! cbcalled = 1 ! ! o = C() ! ref2 = weakref.ref(o, callback) ! del o ! verify(cbcalled, ! "callback did not properly set 'cbcalled'") ! verify(ref2() is None, ! "ref2 should be dead after deleting object reference") ! del ref2 ! ! ! print "-- Reference objects with callbacks" ! o = C() ! o.bar = 1 ! ref1 = weakref.ref(o, id) ! ref2 = weakref.ref(o, id) ! del o ! verify(ref1() is None, ! "expected reference to be invalidated") ! verify(ref2() is None, ! "expected reference to be invalidated") ! ! ! print "-- Proxy objects with callbacks" ! o = C() ! o.bar = 1 ! ref1 = weakref.proxy(o, id) ! ref2 = weakref.proxy(o, id) ! del o ! try: ! ref1.bar ! except weakref.ReferenceError: ! pass ! else: ! raise TestFailed("expected ReferenceError exception") ! try: ! ref2.bar ! except weakref.ReferenceError: ! pass ! else: ! raise TestFailed("expected ReferenceError exception") ! ! ! print "-- Re-use of weak reference objects" ! print " reference objects" ! ! o = C() ! ref1 = weakref.ref(o) ! # create a proxy to make sure that there's an intervening creation ! # between these two; it should make no difference ! proxy = weakref.proxy(o) ! ref2 = weakref.ref(o) ! verify(ref1 is ref2, ! "reference object w/out callback should have been re-used") ! ! o = C() ! proxy = weakref.proxy(o) ! ref1 = weakref.ref(o) ! ref2 = weakref.ref(o) ! verify(ref1 is ref2, ! "reference object w/out callback should have been re-used") ! verify(weakref.getweakrefcount(o) == 2, ! "wrong weak ref count for object") ! del proxy ! verify(weakref.getweakrefcount(o) == 1, ! "wrong weak ref count for object after deleting proxy") ! ! print " proxy objects" ! ! o = C() ! ref3 = weakref.proxy(o) ! ref4 = weakref.proxy(o) ! verify(ref3 is ref4, ! "proxy object w/out callback should have been re-used") ! ! ! def clearing1(r): ! print "clearing ref 1" ! ! def clearing2(r): ! print "clearing ref 2" ! ! o = C() ! ref1 = weakref.ref(o, clearing1) ! ref2 = weakref.ref(o, clearing2) ! verify(weakref.getweakrefcount(o) == 2, ! "got wrong number of weak reference objects") ! del o ! ! o = C() ! ref1 = weakref.ref(o, clearing1) ! ref2 = weakref.ref(o, clearing2) ! del ref1 ! verify(weakref.getweakrefs(o) == [ref2], ! "list of refs does not match") ! del o ! ! o = C() ! ref1 = weakref.ref(o, clearing1) ! ref2 = weakref.ref(o, clearing2) ! del ref2 ! verify(weakref.getweakrefs(o) == [ref1], ! "list of refs does not match") ! del o - print - print "Weak Valued Dictionaries" class Object: --- 1,201 ---- import sys + import unittest import weakref ! from test_support import run_unittest, verify class C: ! def method(self): ! pass ! class Callable: ! bar = None ! ! def __call__(self, x): ! self.bar = x ! def create_function(): ! def f(): pass ! return f ! ! def create_bound_method(): ! return C().method ! ! def create_unbound_method(): ! return C.method ! ! ! class TestBase(unittest.TestCase): ! ! def setUp(self): ! self.cbcalled = 0 ! ! def callback(self, ref): ! self.cbcalled += 1 ! ! ! class ReferencesTestCase(TestBase): ! ! def test_basic_ref(self): ! self.check_basic_ref(C) ! self.check_basic_ref(create_function) ! self.check_basic_ref(create_bound_method) ! self.check_basic_ref(create_unbound_method) ! ! def test_basic_callback(self): ! self.check_basic_callback(C) ! self.check_basic_callback(create_function) ! self.check_basic_callback(create_bound_method) ! self.check_basic_callback(create_unbound_method) ! ! def test_multiple_callbacks(self): ! o = C() ! ref1 = weakref.ref(o, self.callback) ! ref2 = weakref.ref(o, self.callback) ! del o ! self.assert_(ref1() is None, ! "expected reference to be invalidated") ! self.assert_(ref2() is None, ! "expected reference to be invalidated") ! self.assert_(self.cbcalled == 2, ! "callback not called the right number of times") ! ! def test_proxy_ref(self): ! o = C() ! o.bar = 1 ! ref1 = weakref.proxy(o, self.callback) ! ref2 = weakref.proxy(o, self.callback) ! del o ! ! def check(proxy): ! proxy.bar ! ! self.assertRaises(weakref.ReferenceError, check, ref1) ! self.assertRaises(weakref.ReferenceError, check, ref2) ! self.assert_(self.cbcalled == 2) ! ! def check_basic_ref(self, factory): ! o = factory() ! ref = weakref.ref(o) ! self.assert_(ref() is not None, ! "weak reference to live object should be live") ! o2 = ref() ! self.assert_(o is o2, ! "() should return original object if live") ! ! def check_basic_callback(self, factory): ! self.cbcalled = 0 ! o = factory() ! ref = weakref.ref(o, self.callback) ! del o ! verify(self.cbcalled == 1, ! "callback did not properly set 'cbcalled'") ! verify(ref() is None, ! "ref2 should be dead after deleting object reference") ! ! def test_ref_reuse(self): ! o = C() ! ref1 = weakref.ref(o) ! # create a proxy to make sure that there's an intervening creation ! # between these two; it should make no difference ! proxy = weakref.proxy(o) ! ref2 = weakref.ref(o) ! self.assert_(ref1 is ref2, ! "reference object w/out callback should be re-used") ! ! o = C() ! proxy = weakref.proxy(o) ! ref1 = weakref.ref(o) ! ref2 = weakref.ref(o) ! self.assert_(ref1 is ref2, ! "reference object w/out callback should be re-used") ! self.assert_(weakref.getweakrefcount(o) == 2, ! "wrong weak ref count for object") ! del proxy ! self.assert_(weakref.getweakrefcount(o) == 1, ! "wrong weak ref count for object after deleting proxy") ! ! def test_proxy_reuse(self): ! o = C() ! proxy1 = weakref.proxy(o) ! ref = weakref.ref(o) ! proxy2 = weakref.proxy(o) ! self.assert_(proxy1 is proxy2, ! "proxy object w/out callback should have been re-used") ! ! def test_basic_proxy(self): ! o = C() ! self.check_proxy(o, weakref.proxy(o)) ! ! def test_callable_proxy(self): ! o = Callable() ! ref1 = weakref.proxy(o) ! ! self.check_proxy(o, ref1) ! ! self.assert_(type(ref1) is weakref.CallableProxyType, ! "proxy is not of callable type") ! ref1('twinkies!') ! self.assert_(o.bar == 'twinkies!', ! "call through proxy not passed through to original") ! ! # expect due to too few args ! self.assertRaises(TypeError, ref1) ! ! # expect due to too many args ! self.assertRaises(TypeError, ref1, 1, 2, 3) ! ! def check_proxy(self, o, proxy): ! o.foo = 1 ! self.assert_(proxy.foo == 1, ! "proxy does not reflect attribute addition") ! o.foo = 2 ! self.assert_(proxy.foo == 2, ! "proxy does not reflect attribute modification") ! del o.foo ! self.assert_(not hasattr(proxy, 'foo'), ! "proxy does not reflect attribute removal") ! ! proxy.foo = 1 ! self.assert_(o.foo == 1, ! "object does not reflect attribute addition via proxy") ! proxy.foo = 2 ! self.assert_( ! o.foo == 2, ! "object does not reflect attribute modification via proxy") ! del proxy.foo ! self.assert_(not hasattr(o, 'foo'), ! "object does not reflect attribute removal via proxy") ! ! def test_getweakrefcount(self): ! o = C() ! ref1 = weakref.ref(o) ! ref2 = weakref.ref(o, self.callback) ! self.assert_(weakref.getweakrefcount(o) == 2, ! "got wrong number of weak reference objects") ! ! proxy1 = weakref.proxy(o) ! proxy2 = weakref.proxy(o, self.callback) ! self.assert_(weakref.getweakrefcount(o) == 4, ! "got wrong number of weak reference objects") ! ! def test_getweakrefs(self): ! o = C() ! ref1 = weakref.ref(o, self.callback) ! ref2 = weakref.ref(o, self.callback) ! del ref1 ! self.assert_(weakref.getweakrefs(o) == [ref2], ! "list of refs does not match") ! ! o = C() ! ref1 = weakref.ref(o, self.callback) ! ref2 = weakref.ref(o, self.callback) ! del ref2 ! self.assert_(weakref.getweakrefs(o) == [ref1], ! "list of refs does not match") class Object: *************** *** 140,250 **** return "" % self.arg - dict = weakref.mapping() - objects = map(Object, range(10)) - for o in objects: - dict[o.arg] = o - print "objects are stored in weak dict" - for o in objects: - verify(weakref.getweakrefcount(o) == 1, - "wrong number of weak references to %r!" % o) - verify(o is dict[o.arg], - "wrong object returned by weak dict!") - items1 = dict.items() - items2 = dict.copy().items() - items1.sort() - items2.sort() - verify(items1 == items2, - "cloning of weak-valued dictionary did not work!") - del items1, items2 - dict.clear() - print "weak dict test complete" - - print - print "Weak Keyed Dictionaries" - - dict = weakref.mapping(weakkeys=1) - objects = map(Object, range(10)) - for o in objects: - dict[o] = o.arg - print "objects are stored in weak dict" - for o in objects: - verify(weakref.getweakrefcount(o) == 1, - "wrong number of weak references to %r!" % o) - verify(o.arg is dict[o], - "wrong object returned by weak dict!") - items1 = dict.items() - items2 = dict.copy().items() - items1.sort() - items2.sort() - verify(items1 == items2, - "cloning of weak-keyed dictionary did not work!") - del items1, items2 - del objects, o - verify(len(dict)==0, "deleting the keys did not clear the dictionary") - print "weak key dict test complete" - - - print - print "Non-callable Proxy References" - print "XXX -- tests not written!" - - - def test_proxy(o, proxy): - o.foo = 1 - verify(proxy.foo == 1, - "proxy does not reflect attribute addition") - o.foo = 2 - verify(proxy.foo == 2, - "proxy does not reflect attribute modification") - del o.foo - verify(not hasattr(proxy, 'foo'), - "proxy does not reflect attribute removal") - - proxy.foo = 1 - verify(o.foo == 1, - "object does not reflect attribute addition via proxy") - proxy.foo = 2 - verify(o.foo == 2, - "object does not reflect attribute modification via proxy") - del proxy.foo - verify(not hasattr(o, 'foo'), - "object does not reflect attribute removal via proxy") - ! o = C() ! test_proxy(o, weakref.proxy(o)) ! print ! print "Callable Proxy References" ! ! class Callable: ! bar = None ! def __call__(self, x): ! self.bar = x ! o = Callable() ! ref1 = weakref.proxy(o) - test_proxy(o, ref1) ! verify(type(ref1) is weakref.CallableProxyType, ! "proxy is not of callable type") ! ref1('twinkies!') ! verify(o.bar == 'twinkies!', ! "call through proxy not passed through to original") ! ! try: ! ref1() ! except TypeError: ! # expect due to too few args ! pass ! else: ! raise TestFailed("did not catch expected TypeError -- too few args") ! ! try: ! ref1(1, 2, 3) ! except TypeError: ! # expect due to too many args ! pass ! else: ! raise TestFailed("did not catch expected TypeError -- too many args") --- 205,266 ---- return "" % self.arg ! class MappingTestCase(TestBase): ! COUNT = 10 ! def test_weak_values(self): ! dict = weakref.mapping() ! objects = map(Object, range(self.COUNT)) ! for o in objects: ! dict[o.arg] = o ! ! for o in objects: ! self.assert_(weakref.getweakrefcount(o) == 1, ! "wrong number of weak references to %r!" % o) ! self.assert_(o is dict[o.arg], ! "wrong object returned by weak dict!") ! items1 = dict.items() ! items2 = dict.copy().items() ! items1.sort() ! items2.sort() ! self.assert_(items1 == items2, ! "cloning of weak-valued dictionary did not work!") ! del items1, items2 ! self.assert_(len(dict) == self.COUNT) ! del objects[0] ! self.assert_(len(dict) == (self.COUNT - 1), ! "deleting object did not cause dictionary update") ! del objects, o ! self.assert_(len(dict) == 0, ! "deleting the values did not clear the dictionary") ! ! def test_weak_keys(self): ! dict = weakref.mapping(weakkeys=1) ! objects = map(Object, range(self.COUNT)) ! for o in objects: ! dict[o] = o.arg ! ! for o in objects: ! self.assert_(weakref.getweakrefcount(o) == 1, ! "wrong number of weak references to %r!" % o) ! self.assert_(o.arg is dict[o], ! "wrong object returned by weak dict!") ! items1 = dict.items() ! items2 = dict.copy().items() ! items1.sort() ! items2.sort() ! self.assert_(items1 == items2, ! "cloning of weak-keyed dictionary did not work!") ! del items1, items2 ! self.assert_(len(dict) == self.COUNT) ! del objects[0] ! self.assert_(len(dict) == (self.COUNT - 1), ! "deleting object did not cause dictionary update") ! del objects, o ! self.assert_(len(dict) == 0, ! "deleting the keys did not clear the dictionary") ! run_unittest(ReferencesTestCase) ! run_unittest(MappingTestCase) From fdrake@users.sourceforge.net Fri Mar 23 04:22:47 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 22 Mar 2001 20:22:47 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_weakref,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv17584/output Modified Files: test_weakref Log Message: Convert the weakref test suite to PyUNIT, and add tests that exercise weak references on function objects and both bound and unbound methods. Index: test_weakref =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_weakref,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** test_weakref 2001/02/27 18:36:56 1.2 --- test_weakref 2001/03/23 04:22:45 1.3 *************** *** 1,25 **** test_weakref - Basic Weak References - -- Liveness and referent identity - -- Reference objects with callbacks - -- Proxy objects with callbacks - -- Re-use of weak reference objects - reference objects - proxy objects - clearing ref 2 - clearing ref 1 - clearing ref 2 - clearing ref 1 - - Weak Valued Dictionaries - objects are stored in weak dict - weak dict test complete - - Weak Keyed Dictionaries - objects are stored in weak dict - weak key dict test complete - - Non-callable Proxy References - XXX -- tests not written! - - Callable Proxy References --- 1 ---- From fdrake@users.sourceforge.net Fri Mar 23 04:36:04 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 22 Mar 2001 20:36:04 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libweakref.tex,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv18730/lib Modified Files: libweakref.tex Log Message: Update to the most recent weakref changes. Index: libweakref.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libweakref.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** libweakref.tex 2001/02/27 18:36:55 1.3 --- libweakref.tex 2001/03/23 04:36:02 1.4 *************** *** 17,32 **** Not all objects can be weakly referenced; those objects which do ! include class instances and dictionaries. Extension types can easily be made to support weak references; see section \ref{weakref-extension}, ``Weak References in Extension Types,'' for more information. - \strong{Warning:} - The desired semantics of weak-reference proxy objects are not - completely clear; it is very difficult to create proxies which behave - exactly like the type of the referent. The details of these objects - are likely to change to some degree before the final release as - experience reports become available. - \begin{funcdesc}{ref}{object\optional{, callback}} Return a weak reference to \var{object}. If \var{callback} is --- 17,26 ---- Not all objects can be weakly referenced; those objects which do ! include class instances, functions written in Python (but not in C), ! and methods (both bound and unbound). Extension types can easily be made to support weak references; see section \ref{weakref-extension}, ``Weak References in Extension Types,'' for more information. \begin{funcdesc}{ref}{object\optional{, callback}} Return a weak reference to \var{object}. If \var{callback} is *************** *** 57,61 **** are equal (regardless of the \var{callback}). If the \var{object} has been deleted, they are equal iff they are identical. - \end{funcdesc} --- 51,54 ---- *************** *** 199,204 **** For an object to be weakly referencable, the extension must include a \ctype{PyObject *} field in the instance structure for the use of the ! weak reference mechanism; it will be initialized by Python's functions ! for object creation. It must also set the \code{tp_weaklistoffset} field of the corresponding type object to the offset of the field. For example, the instance type is defined with the following structure: --- 192,197 ---- For an object to be weakly referencable, the extension must include a \ctype{PyObject *} field in the instance structure for the use of the ! weak reference mechanism; it must be initialized to \NULL{} by the ! object's constructor. It must also set the \member{tp_weaklistoffset} field of the corresponding type object to the offset of the field. For example, the instance type is defined with the following structure: From fdrake@users.sourceforge.net Fri Mar 23 04:39:26 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 22 Mar 2001 20:39:26 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/xml/dom pulldom.py,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/xml/dom In directory usw-pr-cvs1:/tmp/cvs-serv18983/Lib/xml/dom Modified Files: pulldom.py Log Message: When creating an attribute node using createAttribute() or createAttributeNS(), use the parallel setAttributeNode() or setAttributeNodeNS() to add the node to the document -- do not assume that setAttributeNode() will operate properly for both. Index: pulldom.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xml/dom/pulldom.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -r1.20 -r1.21 *** pulldom.py 2001/03/13 10:50:13 1.20 --- pulldom.py 2001/03/23 04:39:24 1.21 *************** *** 84,91 **** qname = a_localname attr = self.document.createAttributeNS(a_uri, qname) else: attr = self.document.createAttribute(a_localname) attr.value = value - node.setAttributeNode(attr) self.lastEvent[1] = [(START_ELEMENT, node), None] --- 84,92 ---- qname = a_localname attr = self.document.createAttributeNS(a_uri, qname) + node.setAttributeNodeNS(attr) else: attr = self.document.createAttribute(a_localname) + node.setAttributeNode(attr) attr.value = value self.lastEvent[1] = [(START_ELEMENT, node), None] From ping@users.sourceforge.net Fri Mar 23 05:14:12 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Thu, 22 Mar 2001 21:14:12 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib inspect.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv21475/Lib Modified Files: inspect.py Log Message: Don't have trace() skip the top frame; return them all. Index: inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** inspect.py 2001/03/16 08:29:47 1.9 --- inspect.py 2001/03/23 05:14:09 1.10 *************** *** 621,625 **** Each record contains a frame object, filename, line number, function name, a list of lines of context, and index within the context.""" - tb = tb.tb_next framelist = [] while tb: --- 621,624 ---- From ping@users.sourceforge.net Fri Mar 23 05:14:12 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Thu, 22 Mar 2001 21:14:12 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_inspect.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv21475/Lib/test Modified Files: test_inspect.py Log Message: Don't have trace() skip the top frame; return them all. Index: test_inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_inspect.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** test_inspect.py 2001/03/04 00:30:25 1.3 --- test_inspect.py 2001/03/23 05:14:10 1.4 *************** *** 170,178 **** istest(inspect.isframe, 'mod.fr') ! test(len(git.tr) == 2, 'trace() length') ! test(git.tr[0][1:] == (TESTFN, 9, 'spam', [' eggs(b + d, c + f)\n'], 0), ! 'trace() row 1') ! test(git.tr[1][1:] == (TESTFN, 18, 'eggs', [' q = y / 0\n'], 0), 'trace() row 2') test(len(mod.st) >= 5, 'stack() length') --- 170,181 ---- istest(inspect.isframe, 'mod.fr') ! test(len(git.tr) == 3, 'trace() length') ! test(git.tr[0][1:] == (TESTFN, 46, 'argue', ! [' self.tr = inspect.trace()\n'], 0), 'trace() row 2') + test(git.tr[1][1:] == (TESTFN, 9, 'spam', [' eggs(b + d, c + f)\n'], 0), + 'trace() row 2') + test(git.tr[2][1:] == (TESTFN, 18, 'eggs', [' q = y / 0\n'], 0), + 'trace() row 3') test(len(mod.st) >= 5, 'stack() length') *************** *** 189,193 **** (TESTFN, 39, 'abuse', [' self.argue(a, b, c)\n'], 0), 'stack() row 4') - # row 4 is in test_inspect.py args, varargs, varkw, locals = inspect.getargvalues(mod.fr) --- 192,195 ---- From ping@users.sourceforge.net Fri Mar 23 05:17:43 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Thu, 22 Mar 2001 21:17:43 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libsys.tex,1.45,1.46 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv21825/Doc/lib Modified Files: libsys.tex Log Message: Give a slightly better explanation of excepthook. Index: libsys.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsys.tex,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -r1.45 -r1.46 *** libsys.tex 2001/03/23 02:46:52 1.45 --- libsys.tex 2001/03/23 05:17:41 1.46 *************** *** 52,56 **** an expression entered in an interactive Python session. The display of these values can be customized by assigning ! another function to \code{sys.displayhook}. \end{funcdesc} --- 52,56 ---- an expression entered in an interactive Python session. The display of these values can be customized by assigning ! another one-argument function to \code{sys.displayhook}. \end{funcdesc} *************** *** 59,68 **** \code{sys.stderr}. ! \code{sys.excepthook} is called when an exception is raised ! and uncaught. In an interactive session this happens just before control is returned to the prompt; in a Python program this happens just before the program exits. The handling of such top-level exceptions can be customized by ! assigning another function to \code{sys.excepthook}. \end{funcdesc} --- 59,70 ---- \code{sys.stderr}. ! When an exception is raised and uncaught, the interpreter calls ! \code{sys.excepthook} with three arguments, the exception class, ! exception instance, and a traceback object. ! In an interactive session this happens just before control is returned to the prompt; in a Python program this happens just before the program exits. The handling of such top-level exceptions can be customized by ! assigning another three-argument function to \code{sys.excepthook}. \end{funcdesc} From ping@users.sourceforge.net Fri Mar 23 05:22:14 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Thu, 22 Mar 2001 21:22:14 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libtokenize.tex,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv22211/lib Modified Files: libtokenize.tex Log Message: Explain the difference between NL and NEWLINE. Index: libtokenize.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtokenize.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** libtokenize.tex 2001/02/28 22:05:41 1.3 --- libtokenize.tex 2001/03/23 05:22:12 1.4 *************** *** 44,47 **** \end{datadesc} \begin{datadesc}{NL} ! Token value used to indicate a newline. \end{datadesc} --- 44,50 ---- \end{datadesc} \begin{datadesc}{NL} ! Token value used to indicate a non-terminating newline. The NEWLINE ! token indicates the end of a logical line of Python code; NL tokens ! are generated when a logical line of code is continued over multiple ! physical lines. \end{datadesc} From ping@users.sourceforge.net Fri Mar 23 05:22:51 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Thu, 22 Mar 2001 21:22:51 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib tokenize.py,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv22253 Modified Files: tokenize.py Log Message: Provide a StopTokenizing exception for conveniently exiting the loop. Index: tokenize.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/tokenize.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -r1.21 -r1.22 *** tokenize.py 2001/03/01 17:11:17 1.21 --- tokenize.py 2001/03/23 05:22:49 1.22 *************** *** 27,36 **** N_TOKENS += 2 - # Changes from 1.3: - # Ignore now accepts \f as whitespace. Operator now includes '**'. - # Ignore and Special now accept \n or \r\n at the end of a line. - # Imagnumber is new. Expfloat is corrected to reject '0e4'. - # Note: to quote a backslash in a regex, it must be doubled in a r'aw' string. - def group(*choices): return '(' + '|'.join(choices) + ')' def any(*choices): return apply(group, choices) + '*' --- 27,30 ---- *************** *** 103,109 **** tabsize = 8 ! class TokenError(Exception): ! pass def printtoken(type, token, (srow, scol), (erow, ecol), line): # for testing --- 97,104 ---- tabsize = 8 + + class TokenError(Exception): pass ! class StopTokenizing(Exception): pass def printtoken(type, token, (srow, scol), (erow, ecol), line): # for testing *************** *** 112,115 **** --- 107,116 ---- def tokenize(readline, tokeneater=printtoken): + try: + tokenize_loop(readline, tokeneater) + except StopTokenizing: + pass + + def tokenize_loop(readline, tokeneater): lnum = parenlev = continued = 0 namechars, numchars = string.letters + '_', string.digits *************** *** 179,184 **** token, initial = line[start:end], line[start] ! if initial in numchars \ ! or (initial == '.' and token != '.'): # ordinary number tokeneater(NUMBER, token, spos, epos, line) elif initial in '\r\n': --- 180,185 ---- token, initial = line[start:end], line[start] ! if initial in numchars or \ ! (initial == '.' and token != '.'): # ordinary number tokeneater(NUMBER, token, spos, epos, line) elif initial in '\r\n': From tim_one@users.sourceforge.net Fri Mar 23 06:14:30 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 22 Mar 2001 22:14:30 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules _weakref.c,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv27145 Modified Files: _weakref.c Log Message: Revert the 1.8 patch, since it's implicated in nasty blowups (see Pyhon-Dev). Index: _weakref.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_weakref.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** _weakref.c 2001/03/22 18:05:30 1.8 --- _weakref.c 2001/03/23 06:14:28 1.9 *************** *** 60,64 **** PyWeakReference **list = GET_WEAKREFS_LISTPTR(self->wr_object); - PyObject_GC_Fini((PyObject *)self); if (*list == self) *list = self->wr_next; --- 60,63 ---- *************** *** 80,83 **** --- 79,83 ---- { clear_weakref(self); + PyObject_GC_Fini((PyObject *)self); self->wr_next = free_list; free_list = self; From lemburg@users.sourceforge.net Fri Mar 23 11:46:47 2001 From: lemburg@users.sourceforge.net (M.-A. Lemburg) Date: Fri, 23 Mar 2001 03:46:47 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0224.txt,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv28499 Modified Files: pep-0224.txt Log Message: Added section about Guido's rejection comments. Index: pep-0224.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0224.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** pep-0224.txt 2001/03/21 17:52:20 1.4 --- pep-0224.txt 2001/03/23 11:46:44 1.5 *************** *** 169,173 **** attribute there is no breakage. ! Copyright --- 169,243 ---- attribute there is no breakage. ! ! Comments from our BDFL ! ! Early comments on the PEP from Guido: ! ! I "kinda" like the idea of having attribute docstrings (meaning ! it's not of great importance to me) but there are two things I ! don't like in your current proposal: ! ! 1. The syntax you propose is too ambiguous: as you say, ! stand-alone string literal are used for other purposes and could ! suddenly become attribute docstrings. ! ! 2. I don't like the access method either (__doc___). ! ! The author's reply: ! ! > 1. The syntax you propose is too ambiguous: as you say, stand-alone ! > string literal are used for other purposes and could suddenly ! > become attribute docstrings. ! ! This can be fixed by introducing some extra checks in the ! compiler to reset the "doc attribute" flag in the compiler ! struct. ! ! > 2. I don't like the access method either (__doc___). ! ! Any other name will do. It will only have to match these ! criteria: ! ! * must start with two underscores (to match __doc__) ! * must be extractable using some form of inspection (e.g. by using ! a naming convention which includes some fixed name part) ! * must be compatible with class inheritence (i.e. should be ! stored as attribute) ! ! Later on in March, Guido pronounced on this PEP in March 2001 (on ! python-dev). Here are his reasons for rejection mentioned in ! private mail to the author of this PEP: ! ! ... ! ! It might be useful, but I really hate the proposed syntax. ! ! a = 1 ! "foo bar" ! b = 1 ! ! I really have no way to know whether "foo bar" is a docstring ! for a or for b. ! ! ... ! ! You can use this convention: ! ! a = 1 ! __doc_a__ = "doc string for a" ! ! This makes it available at runtime. ! ! > Are you completely opposed to adding attribute documentation ! > to Python or is it just the way the implementation works ? I ! > find the syntax proposed in the PEP very intuitive and many ! > other users on c.l.p and in private emails have supported it ! > at the time I wrote the PEP. ! ! It's not the implementation, it's the syntax. It doesn't ! convey a clear enough coupling between the variable and the ! doc string. ! ! Copyright From fdrake@users.sourceforge.net Fri Mar 23 12:12:07 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 23 Mar 2001 04:12:07 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc Makefile,1.213,1.214 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory usw-pr-cvs1:/tmp/cvs-serv13646 Modified Files: Makefile Log Message: Bump version number. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile,v retrieving revision 1.213 retrieving revision 1.214 diff -C2 -r1.213 -r1.214 *** Makefile 2001/03/06 07:22:16 1.213 --- Makefile 2001/03/23 12:12:05 1.214 *************** *** 68,72 **** # This is the *documentation* release, and is used to construct the file # names of the downloadable tarballs. ! RELEASE=2.1b1 PYTHON= python --- 68,72 ---- # This is the *documentation* release, and is used to construct the file # names of the downloadable tarballs. ! RELEASE=2.1b2 PYTHON= python From ping@users.sourceforge.net Fri Mar 23 13:17:52 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Fri, 23 Mar 2001 05:17:52 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv26388 Modified Files: pydoc.py Log Message: Show inherited methods, with hyperlinks to the base class they came from. Font adjustment to improve viewing in Windows (the default monospaced font, Courier New, seems to have no reasonable size in IE!) Improve error handling. Try very hard to distinguish between failure to find a module and failure during the module importing process. Improve reloading behaviour. (Still needs some work.) Add '.' to sys.path when running as a script at the command-line. Don't automatically assume '-g' based on the platform. We'll just have the batch file supply -g. Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** pydoc.py 2001/03/23 00:12:53 1.17 --- pydoc.py 2001/03/23 13:17:50 1.18 *************** *** 42,46 **** import sys, imp, os, stat, re, types, inspect from repr import Repr ! from string import expandtabs, find, join, lower, split, strip, rstrip # --------------------------------------------------------- common routines --- 42,46 ---- import sys, imp, os, stat, re, types, inspect from repr import Repr ! from string import expandtabs, find, join, lower, split, strip, rfind, rstrip # --------------------------------------------------------- common routines *************** *** 85,92 **** def getdoc(object): """Get the doc string or comments for an object.""" ! result = inspect.getdoc(object) ! if not result: ! try: result = inspect.getcomments(object) ! except: pass return result and re.sub('^ *\n', '', rstrip(result)) or '' --- 85,89 ---- def getdoc(object): """Get the doc string or comments for an object.""" ! result = inspect.getdoc(object) or inspect.getcomments(object) return result and re.sub('^ *\n', '', rstrip(result)) or '' *************** *** 138,154 **** return filename[:-length] ! class DocImportError(Exception): ! """Class for errors while trying to import something to document it.""" ! def __init__(self, filename, (type, value, tb)): self.filename = filename ! self.type = type self.value = value self.tb = tb def __str__(self): ! t = self.type ! if type(t) is types.ClassType: ! t = t.__name__ ! return 'problem in %s - %s: %s' % (self.filename, t, self.value) def importfile(path): --- 135,161 ---- return filename[:-length] ! def allmethods(cl): ! methods = {} ! for key, value in inspect.getmembers(cl, inspect.ismethod): ! methods[key] = 1 ! for base in cl.__bases__: ! methods.update(allmethods(base)) # all your base are belong to us ! for key in methods.keys(): ! methods[key] = getattr(cl, key) ! return methods ! ! class ErrorDuringImport(Exception): ! """Errors that occurred while trying to import something to document it.""" ! def __init__(self, filename, (exc, value, tb)): self.filename = filename ! self.exc = exc self.value = value self.tb = tb def __str__(self): ! exc = self.exc ! if type(exc) is types.ClassType: ! exc = exc.__name__ ! return 'problem in %s - %s: %s' % (self.filename, exc, self.value) def importfile(path): *************** *** 167,171 **** module = imp.load_module(name, file, path, (ext, 'r', kind)) except: ! raise DocImportError(path, sys.exc_info()) file.close() return module --- 174,178 ---- module = imp.load_module(name, file, path, (ext, 'r', kind)) except: ! raise ErrorDuringImport(path, sys.exc_info()) file.close() return module *************** *** 251,255 **** return ''' ! Python: %s %s ''' % (title, contents) --- 258,264 ---- return ''' ! Python: %s ! ! %s ''' % (title, contents) *************** *** 280,288 **** result = result + '''
! ! ''' % (bgcol, marginalia, prelude) result = result + ''' ! ! ''' % (bgcol, marginalia, gap) return result + '
%s%s
%s%s%s
' % contents --- 289,295 ---- result = result + ''' %s ! %s''' % (bgcol, marginalia, prelude) result = result + ''' ! %s%s''' % (bgcol, marginalia, gap) return result + '%s' % contents *************** *** 307,311 **** for i in range(rows*col, rows*col+rows): if i < len(list): ! result = result + format(list[i]) + '
' result = result + '' return '%s
' % result --- 314,318 ---- for i in range(rows*col, rows*col+rows): if i < len(list): ! result = result + format(list[i]) + '
\n' result = result + '' return '%s
' % result *************** *** 355,360 **** results = [] here = 0 ! pattern = re.compile(r'\b(((http|ftp)://\S+[\w/])|' ! r'(RFC[- ]?(\d+))|' r'(self\.)?(\w+))\b') while 1: --- 362,367 ---- results = [] here = 0 ! pattern = re.compile(r'\b((http|ftp)://\S+[\w/]|' ! r'RFC[- ]?(\d+)|' r'(self\.)?(\w+))\b') while 1: *************** *** 364,380 **** results.append(escape(text[here:start])) ! all, url, scheme, rfc, rfcnum, selfdot, name = match.groups() ! if url: ! results.append('%s' % (url, escape(url))) elif rfc: ! url = 'http://www.rfc-editor.org/rfc/rfc%s.txt' % rfcnum ! results.append('%s' % (url, escape(rfc))) else: ! if text[end:end+1] == '(': ! results.append(self.namelink(name, methods, funcs, classes)) ! elif selfdot: ! results.append('self.%s' % name) ! else: ! results.append(self.namelink(name, classes)) here = end results.append(escape(text[here:])) --- 371,386 ---- results.append(escape(text[here:start])) ! all, scheme, rfc, selfdot, name = match.groups() ! if scheme: ! results.append('%s' % (all, escape(all))) elif rfc: ! url = 'http://www.rfc-editor.org/rfc/rfc%s.txt' % rfc ! results.append('%s' % (url, escape(all))) ! elif text[end:end+1] == '(': ! results.append(self.namelink(name, methods, funcs, classes)) ! elif selfdot: ! results.append('self.%s' % name) else: ! results.append(self.namelink(name, classes)) here = end results.append(escape(text[here:])) *************** *** 529,538 **** methods, mdict = [], {} ! for key, value in inspect.getmembers(object, inspect.ismethod): methods.append((key, value)) mdict[key] = mdict[value] = '#' + name + '-' + key for key, value in methods: contents = contents + self.document( ! value, key, funcs, classes, mdict, name) if name == realname: --- 535,545 ---- methods, mdict = [], {} ! for key, value in allmethods(object).items(): methods.append((key, value)) mdict[key] = mdict[value] = '#' + name + '-' + key + methods.sort() for key, value in methods: contents = contents + self.document( ! value, key, funcs, classes, mdict, object) if name == realname: *************** *** 542,546 **** title = '%s = class %s' % ( name, name, realname) - if bases: parents = [] --- 549,552 ---- *************** *** 551,555 **** doc = self.markup( getdoc(object), self.preformat, funcs, classes, mdict) ! if doc: doc = self.small('%s' % doc) return self.section(title, '#000000', '#ffc8d8', contents, 10, doc) --- 557,561 ---- doc = self.markup( getdoc(object), self.preformat, funcs, classes, mdict) ! doc = self.small('%s
 
' % doc) return self.section(title, '#000000', '#ffc8d8', contents, 10, doc) *************** *** 559,574 **** def docroutine(self, object, name=None, ! funcs={}, classes={}, methods={}, clname=''): """Produce HTML documentation for a function or method object.""" realname = object.__name__ name = name or realname ! anchor = clname + '-' + realname note = '' if inspect.ismethod(object): ! if not clname: ! note = self.small(self.grey( ! object.im_self and 'method of ' + self.repr(object.im_self) or ! ' unbound %s method' % object.im_class.__name__)) object = object.im_func --- 565,590 ---- def docroutine(self, object, name=None, ! funcs={}, classes={}, methods={}, cl=None): """Produce HTML documentation for a function or method object.""" realname = object.__name__ name = name or realname ! anchor = (cl and cl.__name__ or '') + '-' + name note = '' + skipdocs = 0 if inspect.ismethod(object): ! if cl: ! if not cl.__dict__.has_key(name): ! base = object.im_class ! url = '#%s-%s' % (base.__name__, name) ! basename = base.__name__ ! if base.__module__ != cl.__module__: ! url = base.__module__ + '.html' + url ! basename = base.__module__ + '.' + basename ! note = ' from %s' % (url, basename) ! skipdocs = 1 ! else: ! note = (object.im_self and 'method of ' + self.repr(object.im_self) or ! ' unbound %s method' % object.im_class.__name__) object = object.im_func *************** *** 576,581 **** title = '%s' % (anchor, realname) else: ! title = '%s = %s' % ( ! name, anchor, realname) if inspect.isbuiltin(object): argspec = '(...)' --- 592,604 ---- title = '%s' % (anchor, realname) else: ! if (cl and cl.__dict__.has_key(realname) and ! cl.__dict__[realname] is object): ! reallink = '%s' % ( ! cl.__name__ + '-' + realname, realname) ! skipdocs = 1 ! else: ! reallink = realname ! title = '%s = %s' % ( ! anchor, name, reallink) if inspect.isbuiltin(object): argspec = '(...)' *************** *** 588,598 **** argspec = argspec[1:-1] # remove parentheses ! decl = title + argspec + note ! doc = self.markup( ! getdoc(object), self.preformat, funcs, classes, methods) ! doc = replace(doc, ('
\n', '
')) ! doc = doc and '%s' % doc ! return '
%s
%s
' % (decl, self.small(doc)) def docother(self, object, name=None): --- 611,623 ---- argspec = argspec[1:-1] # remove parentheses ! decl = title + argspec + (note and self.small(self.grey(note))) ! if skipdocs: ! return '
%s
' % decl ! else: ! doc = self.markup( ! getdoc(object), self.preformat, funcs, classes, methods) ! doc = doc and '%s' % doc ! return '
%s
%s
' % (decl, self.small(doc)) def docother(self, object, name=None): *************** *** 704,715 **** """Produce text documentation for a given module object.""" name = object.__name__ # ignore the passed-in name lines = split(strip(getdoc(object)), '\n') if len(lines) == 1: ! if lines[0]: name = name + ' - ' + lines[0] lines = [] elif len(lines) >= 2 and not rstrip(lines[1]): ! if lines[0]: name = name + ' - ' + lines[0] lines = lines[2:] ! result = self.section('NAME', name) try: --- 729,741 ---- """Produce text documentation for a given module object.""" name = object.__name__ # ignore the passed-in name + namesec = name lines = split(strip(getdoc(object)), '\n') if len(lines) == 1: ! if lines[0]: namesec = namesec + ' - ' + lines[0] lines = [] elif len(lines) >= 2 and not rstrip(lines[1]): ! if lines[0]: namesec = namesec + ' - ' + lines[0] lines = lines[2:] ! result = self.section('NAME', namesec) try: *************** *** 792,802 **** title = self.bold(name) + ' = class ' + realname if bases: ! parents = map(lambda c, m=object.__module__: classname(c, m), bases) title = title + '(%s)' % join(parents, ', ') doc = getdoc(object) contents = doc and doc + '\n' ! for key, value in inspect.getmembers(object, inspect.ismethod): ! contents = contents + '\n' + self.document(value, key, name) if not contents: return title + '\n' --- 818,831 ---- title = self.bold(name) + ' = class ' + realname if bases: ! def makename(c, m=object.__module__): return classname(c, m) ! parents = map(makename, bases) title = title + '(%s)' % join(parents, ', ') doc = getdoc(object) contents = doc and doc + '\n' ! methods = allmethods(object).items() ! methods.sort() ! for key, value in methods: ! contents = contents + '\n' + self.document(value, key, object) if not contents: return title + '\n' *************** *** 807,817 **** return '=' + self.repr(object) ! def docroutine(self, object, name=None, clname=None): """Produce text documentation for a function or method object.""" realname = object.__name__ name = name or realname note = '' if inspect.ismethod(object): ! if not clname: if object.im_self: note = ' method of %s' % self.repr(object.im_self) --- 836,855 ---- return '=' + self.repr(object) ! def docroutine(self, object, name=None, cl=None): """Produce text documentation for a function or method object.""" realname = object.__name__ name = name or realname note = '' + skipdocs = 0 if inspect.ismethod(object): ! if cl: ! if not cl.__dict__.has_key(name): ! base = object.im_class ! basename = base.__name__ ! if base.__module__ != cl.__module__: ! basename = base.__module__ + '.' + basename ! note = ' from %s' % basename ! skipdocs = 1 ! else: if object.im_self: note = ' method of %s' % self.repr(object.im_self) *************** *** 823,826 **** --- 861,867 ---- title = self.bold(realname) else: + if (cl and cl.__dict__.has_key(realname) and + cl.__dict__[realname] is object): + skipdocs = 1 title = self.bold(name) + ' = ' + realname if inspect.isbuiltin(object): *************** *** 835,843 **** decl = title + argspec + note ! doc = getdoc(object) ! if doc: ! return decl + '\n' + rstrip(self.indent(doc)) + '\n' ! else: return decl + '\n' def docother(self, object, name=None, maxlen=None): --- 876,884 ---- decl = title + argspec + note ! if skipdocs: return decl + '\n' + else: + doc = getdoc(object) or '' + return decl + '\n' + (doc and rstrip(self.indent(doc)) + '\n') def docother(self, object, name=None, maxlen=None): *************** *** 952,956 **** def describe(thing): ! """Produce a short description of the given kind of thing.""" if inspect.ismodule(thing): if thing.__name__ in sys.builtin_module_names: --- 993,997 ---- def describe(thing): ! """Produce a short description of the given thing.""" if inspect.ismodule(thing): if thing.__name__ in sys.builtin_module_names: *************** *** 972,985 **** return type(thing).__name__ ! def freshimp(path, cache={}): """Import a module, reloading it if the source file has changed.""" ! module = __import__(path) ! if hasattr(module, '__file__'): ! file = module.__file__ ! info = (file, os.path.getmtime(file), os.path.getsize(file)) ! if cache.has_key(path): ! if cache[path] != info: module = reload(module) ! cache[path] = info return module --- 1013,1037 ---- return type(thing).__name__ ! def freshimport(name, cache={}): """Import a module, reloading it if the source file has changed.""" ! topmodule = __import__(name) ! module = None ! for component in split(name, '.'): ! if module == None: ! module = topmodule ! path = split(name, '.')[0] ! else: ! module = getattr(module, component) ! path = path + '.' + component ! if hasattr(module, '__file__'): ! file = module.__file__ ! if os.path.exists(file): ! info = (file, os.path.getmtime(file), os.path.getsize(file)) ! if cache.has_key(path) and cache[path] != info: module = reload(module) ! file = module.__file__ ! if os.path.exists(file): ! info = (file, os.path.getmtime(file), os.path.getsize(file)) ! cache[path] = info return module *************** *** 987,1021 **** """Locate an object by name (or dotted path), importing as necessary.""" if not path: # special case: imp.find_module('') strangely succeeds ! return None, None if type(path) is not types.StringType: ! return None, path parts = split(path, '.') ! n = 1 ! while n <= len(parts): path = join(parts[:n], '.') try: ! module = freshimp(path) except: ! # determine if error occurred before or after module was found if sys.modules.has_key(path): ! filename = sys.modules[path].__file__ ! elif sys.exc_type is SyntaxError: ! filename = sys.exc_value.filename else: ! # module not found, so stop looking ! break ! # error occurred in the imported module, so report it ! raise DocImportError(filename, sys.exc_info()) try: x = module ! for p in parts[1:]: x = getattr(x, p) ! return join(parts[:-1], '.'), x except AttributeError: ! n = n + 1 continue if hasattr(__builtins__, path): ! return None, getattr(__builtins__, path) ! return None, None # --------------------------------------- interactive interpreter interface --- 1039,1079 ---- """Locate an object by name (or dotted path), importing as necessary.""" if not path: # special case: imp.find_module('') strangely succeeds ! return None if type(path) is not types.StringType: ! return path parts = split(path, '.') ! n = len(parts) ! while n > 0: path = join(parts[:n], '.') try: ! module = freshimport(path) except: ! # Did the error occur before or after the module was found? ! (exc, value, tb) = info = sys.exc_info() if sys.modules.has_key(path): ! # An error occured while executing the imported module. ! raise ErrorDuringImport(sys.modules[path].__file__, info) ! elif exc is SyntaxError: ! # A SyntaxError occurred before we could execute the module. ! raise ErrorDuringImport(value.filename, info) ! elif exc is ImportError and \ ! split(lower(str(value)))[:2] == ['no', 'module']: ! # The module was not found. ! n = n - 1 ! continue else: ! # Some other error occurred before executing the module. ! raise DocImportError(filename, sys.exc_info()) try: x = module ! for p in parts[n:]: x = getattr(x, p) ! return x except AttributeError: ! n = n - 1 continue if hasattr(__builtins__, path): ! return getattr(__builtins__, path) ! return None # --------------------------------------- interactive interpreter interface *************** *** 1028,1037 **** if type(thing) is type(""): try: ! path, x = locate(thing) ! except DocImportError, value: print value return ! if x: ! thing = x else: print 'no Python documentation found for %s' % repr(thing) --- 1086,1095 ---- if type(thing) is type(""): try: ! object = locate(thing) ! except ErrorDuringImport, value: print value return ! if object: ! thing = object else: print 'no Python documentation found for %s' % repr(thing) *************** *** 1047,1052 **** """Write HTML documentation to a file in the current directory.""" try: ! path, object = locate(key) ! except DocImportError, value: print value else: --- 1105,1110 ---- """Write HTML documentation to a file in the current directory.""" try: ! object = locate(key) ! except ErrorDuringImport, value: print value else: *************** *** 1091,1098 **** def man(key): """Display documentation on an object in a form similar to man(1).""" ! path, object = locate(key) if object: title = 'Python Library Documentation: ' + describe(object) ! if path: title = title + ' in ' + path pager('\n' + title + '\n\n' + text.document(object, key)) found = 1 --- 1149,1157 ---- def man(key): """Display documentation on an object in a form similar to man(1).""" ! object = locate(key) if object: title = 'Python Library Documentation: ' + describe(object) ! lastdot = rfind(key, '.') ! if lastdot > 0: title = title + ' in ' + key[:lastdot] pager('\n' + title + '\n\n' + text.document(object, key)) found = 1 *************** *** 1150,1154 **** if modname != '__main__': seen[modname] = 1 ! desc = split(freshimp(modname).__doc__ or '', '\n')[0] if find(lower(modname + ' - ' + desc), lower(key)) >= 0: callback(None, modname, desc) --- 1209,1213 ---- if modname != '__main__': seen[modname] = 1 ! desc = split(freshimport(modname).__doc__ or '', '\n')[0] if find(lower(modname + ' - ' + desc), lower(key)) >= 0: callback(None, modname, desc) *************** *** 1206,1215 **** if path and path != '.': try: ! p, x = locate(path) ! except DocImportError, value: self.send_document(path, html.escape(str(value))) return ! if x: ! self.send_document(describe(x), html.document(x, path)) else: self.send_document(path, --- 1265,1274 ---- if path and path != '.': try: ! obj = locate(path) ! except ErrorDuringImport, value: self.send_document(path, html.escape(str(value))) return ! if obj: ! self.send_document(describe(obj), html.document(obj, path)) else: self.send_document(path, *************** *** 1221,1231 **** def bltinlink(name): return '%s' % (name, name) ! names = filter(lambda x: x != '__main__', sys.builtin_module_names) contents = html.multicolumn(names, bltinlink) indices = ['

' + html.bigsection( 'Built-in Modules', '#ffffff', '#ee77aa', contents)] - # for skip in ['', '.', os.getcwd(), os.path.dirname(sys.argv[0])]: - # if skip in sys.path: sys.path.remove(skip) seen = {} for dir in pathdirs(): --- 1280,1289 ---- def bltinlink(name): return '%s' % (name, name) ! names = filter(lambda x: x != '__main__', ! sys.builtin_module_names) contents = html.multicolumn(names, bltinlink) indices = ['

' + html.bigsection( 'Built-in Modules', '#ffffff', '#ee77aa', contents)] seen = {} for dir in pathdirs(): *************** *** 1454,1463 **** class BadUsage: pass ! try: ! if sys.platform in ['mac', 'win32'] and not sys.argv[1:]: ! # graphical platforms with threading (and no CLI) ! gui() ! return opts, args = getopt.getopt(sys.argv[1:], 'gk:p:w') writing = 0 --- 1512,1519 ---- class BadUsage: pass ! # Scripts don't get the current directory in their path by default. ! sys.path.insert(0, '.') + try: opts, args = getopt.getopt(sys.argv[1:], 'gk:p:w') writing = 0 *************** *** 1494,1498 **** else: man(arg) ! except DocImportError, value: print value --- 1550,1554 ---- else: man(arg) ! except ErrorDuringImport, value: print value From ping@users.sourceforge.net Fri Mar 23 13:35:47 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Fri, 23 Mar 2001 05:35:47 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv7800 Modified Files: pydoc.py Log Message: Small formatting improvements. Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -r1.18 -r1.19 *** pydoc.py 2001/03/23 13:17:50 1.18 --- pydoc.py 2001/03/23 13:35:45 1.19 *************** *** 270,276 ****  
 
%s
%s ''' % (bgcol, fgcol, title, fgcol, extras or ' ') --- 270,276 ----  
 
%s
%s ''' % (bgcol, fgcol, title, fgcol, extras or ' ') *************** *** 288,294 **** if prelude: result = result + ''' ! %s ! %s''' % (bgcol, marginalia, prelude) ! result = result + ''' %s%s''' % (bgcol, marginalia, gap) --- 288,296 ---- if prelude: result = result + ''' ! %s ! %s ! %s''' % (bgcol, marginalia, prelude, gap) ! else: ! result = result + ''' %s%s''' % (bgcol, marginalia, gap) *************** *** 557,561 **** doc = self.markup( getdoc(object), self.preformat, funcs, classes, mdict) ! doc = self.small('%s
 
' % doc) return self.section(title, '#000000', '#ffc8d8', contents, 10, doc) --- 559,563 ---- doc = self.markup( getdoc(object), self.preformat, funcs, classes, mdict) ! doc = self.small(doc and '%s
 
' % doc or ' ') return self.section(title, '#000000', '#ffc8d8', contents, 10, doc) *************** *** 585,589 **** else: note = (object.im_self and ! 'method of ' + self.repr(object.im_self) or ' unbound %s method' % object.im_class.__name__) object = object.im_func --- 587,591 ---- else: note = (object.im_self and ! ' method of ' + self.repr(object.im_self) or ' unbound %s method' % object.im_class.__name__) object = object.im_func *************** *** 611,623 **** argspec = argspec[1:-1] # remove parentheses ! decl = title + argspec + (note and self.small(self.grey(note))) if skipdocs: ! return '

%s
' % decl else: doc = self.markup( getdoc(object), self.preformat, funcs, classes, methods) doc = doc and '%s' % doc ! return '
%s
%s
' % (decl, self.small(doc)) def docother(self, object, name=None): --- 613,626 ---- argspec = argspec[1:-1] # remove parentheses ! decl = title + argspec + (note and self.small(self.grey( ! '%s' % note))) if skipdocs: ! return '
%s
\n' % decl else: doc = self.markup( getdoc(object), self.preformat, funcs, classes, methods) doc = doc and '%s' % doc ! return '
%s
%s
\n' % (decl, self.small(doc)) def docother(self, object, name=None): From jhylton@users.sourceforge.net Fri Mar 23 14:05:18 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Fri, 23 Mar 2001 06:05:18 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/ref ref4.tex,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv27243 Modified Files: ref4.tex Log Message: Revert to ver 1.22, which was the version before the nested scopes docs were introduced. This loses a few small changes, but Fred says that's okay. Index: ref4.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref4.tex,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -r1.25 -r1.26 *** ref4.tex 2001/02/02 02:43:18 1.25 --- ref4.tex 2001/03/23 14:05:16 1.26 *************** *** 25,31 **** function \function{execfile()} is a code block. The string argument passed to the built-in function \function{eval()} and to the ! \keyword{exec}\stindex{exec} statement is a code block. And finally, ! the expression read and evaluated by the built-in function ! \function{input()} is a code block. A code block is executed in an execution frame. An \dfn{execution --- 25,31 ---- function \function{execfile()} is a code block. The string argument passed to the built-in function \function{eval()} and to the ! \keyword{exec} statement is a code block. And finally, the expression ! read and evaluated by the built-in function \function{input()} is a ! code block. A code block is executed in an execution frame. An \dfn{execution *************** *** 33,143 **** information (used for debugging), determines where and how execution continues after the code block's execution has completed, and (perhaps ! most importantly) defines the environment in which names are resolved. ! A \dfn{namespace}\indexii{namespace} is a mapping from names ! (identifiers) to objects. An \dfn{environment}\index{environment} is ! a hierarchical collection of the namespaces that are visible to a ! particular code block. Python namespaces are statically scoped in the ! tradition of Algol, but also has \keyword{global} statement that can ! be used to access the top-level namespace on the environment. ! ! Names refers to objects. Names are introduced by name ! \dfn{binding}\indexii{binding}{name} operations. Each occurrence of a name ! in the program text refers to the binding of that name established in ! the innermost function namespace containing the use. Changing the ! mapping of a name to an object is called ! \dfn{rebinding}\indexii{rebinding}{name}; removing a name is \dfn{unbinding}\indexii{unbinding}{name}. Namespaces are functionally equivalent to dictionaries (and often implemented as dictionaries). ! When a name is bound, a mapping is created in the \dfn{local ! namespace}\indexii{local}{namespace} of the execution frame unless the ! name is declared global. If a name binding operation occurs anywhere ! within a code block, all uses of the name within the block are treated ! as references to the local namespace. (Note: This can lead to errors ! when a name is used within a block before it is bound.) ! ! The \dfn{global namespace}\indexii{global}{namespace} determines the ! place where names listed in \keyword{global}\stindex{global} ! statements are defined and searched. The global namespace of a block ! is the namespace of the module in which the block was defined. ! ! If a name is used within a code block, but it is not bound there and ! is not declared global, it is a \dfn{free variable} ! \indexii{free}{variable}. A free variable is resolved using the ! nearest enclosing function block that has a binding for the name. If ! no such block exists, the name is resolved in the global namespace. - When a name is not found at all, a - \exception{NameError}\withsubitem{(built-in - exception)}{\ttindex{NameError}} exception is raised. - - The local namespace of a class definition becomes the attribute - dictionary of the class. If a block is contained within a class - definition, the name bindings that occur in the containing class block - are not visible to enclosed blocks. - - The following constructs bind names: formal parameters to functions, - \keyword{import} statements, class and function definitions (these bind - the class or function name in the defining block), and identifiers - occurring as the target of an assignment, in a \keyword{for} loop header - (including list comprehensions), or in the second position of an - \keyword{except} clause. - Whether a name is local or global in a code block is determined by static inspection of the source text for the code block: in the ! absence of \keyword{global}\stindex{global} statements, a name that is ! bound anywhere in the code block is local in the entire code block; ! all other names are considered global. The \keyword{global} statement ! forces global interpretation of selected names throughout the code ! block. ! ! The following constructs bind names: formal parameters to functions, \keyword{import} statements, class and function definitions (these bind the class or function name in the defining block), and targets that are identifiers if occurring in an assignment, \keyword{for} loop header, or in the second position of an \keyword{except} clause ! header. The \keyword{import} statement of the form ``\samp{from ! \ldots import *}''\stindex{from} binds all names defined in the ! imported module, except those beginning with an underscore. This form ! may only be used at the module level. A target occurring in a \keyword{del} statement is also considered bound ! for this purpose (though the actual semantics are to unbind the ! name). It is illegal to unbind a name that is referenced by an ! enclosing scope; the compiler will report a \exception{SyntaxError}. When a global name is not found in the global namespace, it is searched in the built-in namespace (which is actually the global ! namespace of the module \module{__builtin__}\refbimodindex{__builtin__}). ! The built-in namespace associated with the execution of a code block ! is actually found by looking up the name \code{__builtins__} in its ! global namespace; this should be a dictionary or a module (in the ! latter case the module's dictionary is used). Normally, the ! \code{__builtins__} namespace is the dictionary of the built-in module ! \module{__builtin__} (note: no `s'). If it isn't, restricted ! execution\indexii{restricted}{execution} mode is in effect. ! ! The namespace for a module is automatically created the first time a ! module is imported. The main module for a script is always called ! \module{__main__}\refbimodindex{__main__}. ! ! The \function{eval()}, \function{execfile()}, and \function{input()} ! functions and the \keyword{exec} statement do not have access to the ! full environment for resolving names. Names may be resolved in the ! local and global namespaces of the caller. Free variables are not ! resolved in the nearest enclosing namespaces, but in the global ! namespace.\footnote{This limitation occurs because the code that is ! executed by these operations is not available at the time the ! module is compiled.} ! The \keyword{exec} statement and the \function{eval()} and \function{execfile()} functions have optional arguments to override the global and local namespace. If only one namespace is specified, it is used for both. ! The built-in functions \function{globals()} and \function{locals()} ! each return a dictionary, representing the current global and local ! namespace respectively. The effect of modifications to these ! dictionaries on the namespace are undefined.\footnote{ The current implementations return the dictionary actually used to implement the namespace, \emph{except} for functions, where the --- 33,158 ---- information (used for debugging), determines where and how execution continues after the code block's execution has completed, and (perhaps ! most importantly) defines two namespaces, the local and the global ! namespace, that affect execution of the code block. ! A \dfn{namespace}\index{namespace} is a mapping from names ! (identifiers) to objects. A particular namespace may be referenced by ! more than one execution frame, and from other places as well. Adding ! a name to a namespace is called \dfn{binding}\indexii{binding}{name} a ! name (to an object); changing the mapping of a name is called ! \dfn{rebinding}\indexii{rebinding}{name}; removing a name is \dfn{unbinding}\indexii{unbinding}{name}. Namespaces are functionally equivalent to dictionaries (and often implemented as dictionaries). ! The \dfn{local namespace}\indexii{local}{namespace} of an execution ! frame determines the default place where names are defined and ! searched. The ! \dfn{global namespace}\indexii{global}{namespace} determines the place ! where names listed in \keyword{global}\stindex{global} statements are ! defined and searched, and where names that are not bound anywhere in ! the current code block are searched. Whether a name is local or global in a code block is determined by static inspection of the source text for the code block: in the ! absence of \keyword{global} statements, a name that is bound anywhere ! in the code block is local in the entire code block; all other names ! are considered global. The \keyword{global} statement forces global ! interpretation of selected names throughout the code block. The ! following constructs bind names: formal parameters to functions, \keyword{import} statements, class and function definitions (these bind the class or function name in the defining block), and targets that are identifiers if occurring in an assignment, \keyword{for} loop header, or in the second position of an \keyword{except} clause ! header. Local names are searched only on the local namespace; global ! names are searched only in the global and built-in ! namespace.\footnote{ ! If the code block contains \keyword{exec} statements or the ! construct ``\samp{from \ldots import *}'', the semantics of local ! names change: local name lookup first searches the local namespace, ! then the global namespace and the built-in namespace.} A target occurring in a \keyword{del} statement is also considered bound ! for this purpose (though the actual semantics are to ``unbind'' the ! name). When a global name is not found in the global namespace, it is searched in the built-in namespace (which is actually the global ! namespace of the module ! \module{__builtin__}\refbimodindex{__builtin__}). The built-in ! namespace associated with the execution of a code block is actually ! found by looking up the name \code{__builtins__} is its global ! namespace; this should be a dictionary or a module (in the latter case ! its dictionary is used). Normally, the \code{__builtins__} namespace ! is the dictionary of the built-in module \module{__builtin__} (note: ! no `s'); if it isn't, restricted ! execution\indexii{restricted}{execution} mode is in effect. When a ! name is not found at all, a ! \exception{NameError}\withsubitem{(built-in ! exception)}{\ttindex{NameError}} exception is raised. ! \stindex{from} ! \stindex{exec} ! \stindex{global} ! ! The following table lists the meaning of the local and global ! namespace for various types of code blocks. The namespace for a ! particular module is automatically created when the module is first ! imported (i.e., when it is loaded). Note that in almost all cases, ! the global namespace is the namespace of the containing module --- ! scopes in Python do not nest! ! ! \begin{tableiv}{l|l|l|l}{textrm} ! {Code block type}{Global namespace}{Local namespace}{Notes} ! \lineiv{Module} ! {n.s. for this module} ! {same as global}{} ! \lineiv{Script (file or command)} ! {n.s. for \module{__main__}\refbimodindex{__main__}} ! {same as global}{(1)} ! \lineiv{Interactive command} ! {n.s. for \module{__main__}\refbimodindex{__main__}} ! {same as global}{} ! \lineiv{Class definition} ! {global n.s. of containing block} ! {new n.s.}{} ! \lineiv{Function body} ! {global n.s. of containing block} ! {new n.s.}{(2)} ! \lineiv{String passed to \keyword{exec} statement} ! {global n.s. of containing block} ! {local n.s. of containing block}{(2), (3)} ! \lineiv{String passed to \function{eval()}} ! {global n.s. of caller} ! {local n.s. of caller}{(2), (3)} ! \lineiv{File read by \function{execfile()}} ! {global n.s. of caller} ! {local n.s. of caller}{(2), (3)} ! \lineiv{Expression read by \function{input()}} ! {global n.s. of caller} ! {local n.s. of caller}{} ! \end{tableiv} ! ! Notes: ! ! \begin{description} ! ! \item[n.s.] means \emph{namespace} ! ! \item[(1)] The main module for a script is always called ! \module{__main__}; ``the filename don't enter into it.'' ! ! \item[(2)] The global and local namespace for these can be ! overridden with optional extra arguments. ! ! \item[(3)] The \keyword{exec} statement and the \function{eval()} and \function{execfile()} functions have optional arguments to override the global and local namespace. If only one namespace is specified, it is used for both. + + \end{description} ! The built-in functions \function{globals()} and \function{locals()} returns a ! dictionary representing the current global and local namespace, ! respectively. The effect of modifications to this dictionary on the ! namespace are undefined.\footnote{ The current implementations return the dictionary actually used to implement the namespace, \emph{except} for functions, where the From ping@users.sourceforge.net Fri Mar 23 14:05:55 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Fri, 23 Mar 2001 06:05:55 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv27728 Modified Files: pydoc.py Log Message: Browser compatibility fixes. Show methods aliased into a class from other classes. Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -r1.19 -r1.20 *** pydoc.py 2001/03/23 13:35:45 1.19 --- pydoc.py 2001/03/23 14:05:53 1.20 *************** *** 259,264 **** Python: %s ! ! %s ''' % (title, contents) --- 259,265 ---- Python: %s ! %s ''' % (title, contents) *************** *** 441,445 **** modules = inspect.getmembers(object, inspect.ismodule) ! if 0 and hasattr(object, '__all__'): visible = lambda key, all=object.__all__: key in all else: --- 442,446 ---- modules = inspect.getmembers(object, inspect.ismodule) ! if 0 and hasattr(object, '__all__'): # disabled for now visible = lambda key, all=object.__all__: key in all else: *************** *** 474,478 **** doc = self.markup(getdoc(object), self.preformat, fdict, cdict) doc = doc and '%s' % doc ! result = result + '

%s\n' % self.small(doc) if hasattr(object, '__path__'): --- 475,479 ---- doc = self.markup(getdoc(object), self.preformat, fdict, cdict) doc = doc and '%s' % doc ! result = result + '

%s

\n' % self.small(doc) if hasattr(object, '__path__'): *************** *** 576,580 **** if inspect.ismethod(object): if cl: ! if not cl.__dict__.has_key(name): base = object.im_class url = '#%s-%s' % (base.__name__, name) --- 577,581 ---- if inspect.ismethod(object): if cl: ! if object.im_class is not cl: base = object.im_class url = '#%s-%s' % (base.__name__, name) *************** *** 596,600 **** if (cl and cl.__dict__.has_key(realname) and cl.__dict__[realname] is object): ! reallink = '%s' % ( cl.__name__ + '-' + realname, realname) skipdocs = 1 --- 597,601 ---- if (cl and cl.__dict__.has_key(realname) and cl.__dict__[realname] is object): ! reallink = '%s' % ( cl.__name__ + '-' + realname, realname) skipdocs = 1 *************** *** 847,851 **** if inspect.ismethod(object): if cl: ! if not cl.__dict__.has_key(name): base = object.im_class basename = base.__name__ --- 848,852 ---- if inspect.ismethod(object): if cl: ! if object.im_class is not cl: base = object.im_class basename = base.__name__ From jhylton@users.sourceforge.net Fri Mar 23 14:08:40 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Fri, 23 Mar 2001 06:08:40 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python compile.c,2.193,2.194 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv28905/Python Modified Files: compile.c Log Message: Make it illegal to assign to __debug__ as per Guido's request. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.193 retrieving revision 2.194 diff -C2 -r2.193 -r2.194 *** compile.c 2001/03/22 03:57:58 2.193 --- compile.c 2001/03/23 14:08:38 2.194 *************** *** 67,70 **** --- 67,73 ---- "from __future__ imports must occur at the beginning of the file" + #define ASSIGN_DEBUG \ + "can not assign to __debug__" + #define MANGLE_LEN 256 *************** *** 5182,5187 **** n = CHILD(n, 1); goto loop; ! } else if (TYPE(tmp) == NAME) symtable_add_def(st, STR(tmp), DEF_LOCAL | flag); return; case dotted_as_name: --- 5185,5198 ---- n = CHILD(n, 1); goto loop; ! } else if (TYPE(tmp) == NAME) { ! if (strcmp(STR(tmp), "__debug__") == 0) { ! PyErr_SetString(PyExc_SyntaxError, ! ASSIGN_DEBUG); ! PyErr_SyntaxLocation(st->st_filename, ! n->n_lineno); ! st->st_errors++; ! } symtable_add_def(st, STR(tmp), DEF_LOCAL | flag); + } return; case dotted_as_name: From ping@users.sourceforge.net Fri Mar 23 14:10:41 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Fri, 23 Mar 2001 06:10:41 -0800 Subject: [Python-checkins] CVS: python/dist/src/Tools/scripts pydoc.pyw,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory usw-pr-cvs1:/tmp/cvs-serv28686 Added Files: pydoc.pyw Log Message: Script for starting pydoc with a GUI in Windows. --- NEW FILE: pydoc.pyw --- import pydoc pydoc.gui() From jhylton@users.sourceforge.net Fri Mar 23 14:18:29 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Fri, 23 Mar 2001 06:18:29 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.138,1.139 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv31693 Modified Files: NEWS Log Message: News items for my recent checkins Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.138 retrieving revision 1.139 diff -C2 -r1.138 -r1.139 *** NEWS 2001/03/22 18:26:47 1.138 --- NEWS 2001/03/23 14:18:27 1.139 *************** *** 25,28 **** --- 25,34 ---- - sgmllib.py now calls handle_decl() for simple declarations. + - It is illegal to assign to the name __debug__, which is set when the + interpreter starts. It is effectively a compile-time constant. + + - A warning will be issued if a global statement for a variable + follows a use or assignment of that variable. + Standard library *************** *** 67,70 **** --- 73,86 ---- weakly referencable type in PyObject_INIT(), since most types are not weakly referencable. + + - PyFrame_FastToLocals() and PyFrame_LocalsToFast() copy bindings for + free variables and cell variables to and from the frame's f_locals. + + - Variants of several functions defined in pythonrun.h have been added + to support the nested_scopes future statement. The variants all end + in Flags and take an extra argument, a PyCompilerFlags *; examples: + PyRun_AnyFileExFlags(), PyRun_InteractiveLoopFlags(). These + variants may be removed in Python 2.2, when nested scopes are + mandatory. Distutils From jhylton@users.sourceforge.net Fri Mar 23 14:34:09 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Fri, 23 Mar 2001 06:34:09 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/ref ref6.tex,1.35,1.36 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv3391 Modified Files: ref6.tex Log Message: Note that assignments to __debug__ are illegal Index: ref6.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref6.tex,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -r1.35 -r1.36 *** ref6.tex 2001/03/06 07:34:00 1.35 --- ref6.tex 2001/03/23 14:34:06 1.36 *************** *** 87,90 **** --- 87,92 ---- it will be displayed as part of the stack trace. + Assignments to \code{__debug__} are illegal. The value for the + built-in variable is determined when the interpreter starts. \section{Assignment statements \label{assignment}} From jhylton@users.sourceforge.net Fri Mar 23 15:29:57 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Fri, 23 Mar 2001 07:29:57 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/ref refa1.tex,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv13602 Added Files: refa1.tex Log Message: Add some initial text for the appendix on future statements and nested scopes. --- NEW FILE: refa1.tex --- \chapter{Appendix: Future statements and nested scopes} The semantics of Python's static scoping will change in version 2.2 to support resolution of unbound local names in enclosing functions' namespaces. The new semantics will be available in Python 2.1 through the use of a future statement. This appendix documents these two features for Python 2.1; it will be removed in Python 2.2 and the features will be documented in the main sections of this manual. \section{Future statements} \indexii{future}{statement} A \dfn{future statement} is a directive to the compiler that a particular module should be compiled using syntax or semantics that will be available in a specified future release of Python. The future statement is intended to ease migration to future versions of Python that introduce incompatible changes to the language. It allows use of the new features on a per-module basis before the release in which the feature becomes standard. \begin{verbatim} future_statement: "from" "__future__" "import" feature ["as" name] ("," feature ["as" name])* feature: identifier name: identifier \end{verbatim} A future statement must appear near the top of the module. The only lines that can appear before a future statement are: \begin{itemize} \item the module docstring (if any), \item comments, \item blank lines, and \item other future statements. \end{itemize} The only feature recognized by Python 2.1 is \samp{nested_scopes}. A future statement is recognized and treated specially at compile time: Changes to the semantics of core constructs are often implemented by generating different code. It may even be the case that a new feature introduces new incompatible syntax (such as a new reserved word), in which case the compiler may need to parse the module differently. Such decisions cannot be pushed off until runtime. For any given release, the compiler knows which feature names have been defined, and raises a compile-time error if a future statement contains a feature not known to it. The direct runtime semantics are the same as for any import statement: there is a standard module \file{__future__.py}, described later, and it will be imported in the usual way at the time the future statement is executed. The interesting runtime semantics depend on the specific feature enabled by the future statement. Note that there is nothing special about the statement: \begin{verbatim} import __future__ [as name] \end{verbatim} That is not a future statement; it's an ordinary import statement, with no special semantics or syntax restrictions. Code compiled by an exec statement or calls to the builtin functions \function{compile} and \function{execfile} that occur in a module M containing a future statement will use the new syntax or semantics associated with the future statement. A future statement typed at an interactive interpreter prompt will take effect for the rest of the interpreter session. If an interpreter is started with the \emph{-i} option, is passed a script name to execute, and the script includes a future statement, it will be in effect in the interactive session started after the script is executed. \section{\module{__future__} --- Future statement definitions} \declaremodule{standard}{__future__} \modulesynopsis{Future statement definitions} \file{__future__.py} is a real module, and serves three purposes: \begin{itemize} \item To avoid confusing existing tools that analyze import statements and expect to find the modules they're importing. \item To ensure that future_statements run under releases prior to 2.1 at least yield runtime exceptions (the import of \code{__future__} will fail, because there was no module of that name prior to 2.1). \item To document when incompatible changes were introduced, and when they will be --- or were --- made mandatory. This is a form of executable documentation, and can be inspected programatically via importing \code{__future__} and examining its contents. \end{itemize} Each statment in \file{__future__.py} is of the form: \begin{verbatim} FeatureName = "_Feature(" OptionalRelease "," MandatoryRelease ")" \end{verbatim} where, normally, OptionalRelease < MandatoryRelease, and both are 5-tuples of the same form as \code{sys.version_info}: \begin{verbatim} (PY_MAJOR_VERSION, # the 2 in 2.1.0a3; an int PY_MINOR_VERSION, # the 1; an int PY_MICRO_VERSION, # the 0; an int PY_RELEASE_LEVEL, # "alpha", "beta", "candidate" or "final"; string PY_RELEASE_SERIAL # the 3; an int ) \end{verbatim} OptionalRelease records the first release in which the feature was accepted. In the case of MandatoryReleases that have not yet occurred, MandatoryRelease predicts the release in which the feature will become part of the language. Else MandatoryRelease records when the feature became part of the language; in releases at or after that, modules no longer need a future statement to use the feature in question, but may continue to use such imports. MandatoryRelease may also be None, meaning that a planned feature got dropped. Instances of class \class{_Feature} have two corresponding methods, \member{getOptionalRelease()} and \member{getMandatoryRelease()}. No feature line will ever be deleted from \file{__future__.py}. \section{Nested scopes} \indexii{nested}{scopes} Nested scopes are left as an exercise for the reader. From ping@users.sourceforge.net Fri Mar 23 15:30:01 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Fri, 23 Mar 2001 07:30:01 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib inspect.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv13652 Modified Files: inspect.py Log Message: Extend isclass() to work for extension classes (by looking for __bases__). Index: inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** inspect.py 2001/03/23 05:14:09 1.10 --- inspect.py 2001/03/23 15:29:59 1.11 *************** *** 45,49 **** __doc__ documentation string __module__ name of module in which this class was defined""" ! return type(object) is types.ClassType def ismethod(object): --- 45,49 ---- __doc__ documentation string __module__ name of module in which this class was defined""" ! return type(object) is types.ClassType or hasattr(object, '__bases__') def ismethod(object): From ping@users.sourceforge.net Fri Mar 23 15:36:44 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Fri, 23 Mar 2001 07:36:44 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python pythonrun.c,2.129,2.130 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv14436 Modified Files: pythonrun.c Log Message: Allow sys.excepthook and sys.exitfunc to quietly exit with a sys.exit(). sys.exitfunc gets the last word on the exit status of the program. Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.129 retrieving revision 2.130 diff -C2 -r2.129 -r2.130 *** pythonrun.c 2001/03/23 04:01:07 2.129 --- pythonrun.c 2001/03/23 15:36:41 2.130 *************** *** 800,803 **** --- 800,832 ---- void + PyRun_HandleSystemExit(PyObject* value) + { + if (Py_FlushLine()) + PyErr_Clear(); + fflush(stdout); + if (value == NULL || value == Py_None) + Py_Exit(0); + if (PyInstance_Check(value)) { + /* The error code should be in the `code' attribute. */ + PyObject *code = PyObject_GetAttrString(value, "code"); + if (code) { + Py_DECREF(value); + value = code; + if (value == Py_None) + Py_Exit(0); + } + /* If we failed to dig out the 'code' attribute, + just let the else clause below print the error. */ + } + if (PyInt_Check(value)) + Py_Exit((int)PyInt_AsLong(value)); + else { + PyObject_Print(value, stderr, Py_PRINT_RAW); + PySys_WriteStderr("\n"); + Py_Exit(1); + } + } + + void PyErr_PrintEx(int set_sys_last_vars) { *************** *** 810,842 **** if (PyErr_GivenExceptionMatches(exception, PyExc_SystemExit)) { ! if (Py_FlushLine()) ! PyErr_Clear(); ! fflush(stdout); ! if (v == NULL || v == Py_None) ! Py_Exit(0); ! if (PyInstance_Check(v)) { ! /* we expect the error code to be store in the ! `code' attribute ! */ ! PyObject *code = PyObject_GetAttrString(v, "code"); ! if (code) { ! Py_DECREF(v); ! v = code; ! if (v == Py_None) ! Py_Exit(0); ! } ! /* if we failed to dig out the "code" attribute, ! then just let the else clause below print the ! error ! */ ! } ! if (PyInt_Check(v)) ! Py_Exit((int)PyInt_AsLong(v)); ! else { ! /* OK to use real stderr here */ ! PyObject_Print(v, stderr, Py_PRINT_RAW); ! fprintf(stderr, "\n"); ! Py_Exit(1); ! } } if (set_sys_last_vars) { --- 839,843 ---- if (PyErr_GivenExceptionMatches(exception, PyExc_SystemExit)) { ! PyRun_HandleSystemExit(v); } if (set_sys_last_vars) { *************** *** 854,857 **** --- 855,862 ---- PyErr_Fetch(&exception2, &v2, &tb2); PyErr_NormalizeException(&exception2, &v2, &tb2); + if (PyErr_GivenExceptionMatches( + exception2, PyExc_SystemExit)) { + PyRun_HandleSystemExit(v2); + } if (Py_FlushLine()) PyErr_Clear(); *************** *** 1255,1263 **** Py_INCREF(exitfunc); PySys_SetObject("exitfunc", (PyObject *)NULL); - f = PySys_GetObject("stderr"); res = PyEval_CallObject(exitfunc, (PyObject *)NULL); if (res == NULL) { ! if (f) ! PyFile_WriteString("Error in sys.exitfunc:\n", f); PyErr_Print(); } --- 1260,1268 ---- Py_INCREF(exitfunc); PySys_SetObject("exitfunc", (PyObject *)NULL); res = PyEval_CallObject(exitfunc, (PyObject *)NULL); if (res == NULL) { ! if (!PyErr_ExceptionMatches(PyExc_SystemExit)) { ! PySys_WriteStderr("Error in sys.exitfunc:\n"); ! } PyErr_Print(); } From jhylton@users.sourceforge.net Fri Mar 23 15:41:17 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Fri, 23 Mar 2001 07:41:17 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib symtable.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv15065 Modified Files: symtable.py Log Message: flesh out __all__ remove debugging code in if __debug__: add get_children() method on SymbolTable Index: symtable.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/symtable.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** symtable.py 2001/03/22 23:32:22 1.1 --- symtable.py 2001/03/23 15:41:14 1.2 *************** *** 9,13 **** import weakref ! __all__ = ["symtable", "SymbolTable", "newSymbolTable"] def symtable(code, filename, compile_type): --- 9,14 ---- import weakref ! __all__ = ["symtable", "SymbolTable", "newSymbolTable", "Class", ! "Function", "Symbol"] def symtable(code, filename, compile_type): *************** *** 118,121 **** --- 119,126 ---- if st.name == name] + def get_children(self): + return [newSymbolTable(st, self._filename) + for st in self._table.children] + class Function(SymbolTable): *************** *** 237,253 **** return self.__namespaces[0] - if __debug__: - class Foo: - version = 1 - - class Foo: - version = 2 - - class Foo: - version = 3 - - def execfunc(x): - exec x in y - if __name__ == "__main__": import os, sys --- 242,245 ---- From bwarsaw@users.sourceforge.net Fri Mar 23 16:13:32 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Fri, 23 Mar 2001 08:13:32 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_new.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv21571 Modified Files: test_new.py Log Message: Several changes for Jython portability. This closes SF patch #403666. Specifically, In codestr, force `c' to be global. It's unclear what the semantics should be for a code object compiled at module scope, but bound and run in a function. In CPython, `c' is global (by accident?) while in Jython, `c' is local. The intent of the test clearly is to make `c' global, so let's be explicit about it. Jython also does not have a __builtins__ name in the module's namespace, so we use a more portable alternative (though I'm not sure why the test requires "__builtins__" in the g namespace). Finally, skip the new.code() test if the new module doesn't have a `code' attribute. Jython will never have this. Index: test_new.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_new.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** test_new.py 2001/02/09 20:17:14 1.12 --- test_new.py 2001/03/23 16:13:30 1.13 *************** *** 48,52 **** --- 48,57 ---- 'Broken call of hand-crafted instance method') + # It's unclear what the semantics should be for a code object compiled at + # module scope, but bound and run in a function. In CPython, `c' is global + # (by accident?) while in Jython, `c' is local. The intent of the test + # clearly is to make `c' global, so let's be explicit about it. codestr = ''' + global c a = 1 b = 2 *************** *** 55,59 **** ccode = compile(codestr, '', 'exec') ! g = {'c': 0, '__builtins__': __builtins__} # this test could be more robust print 'new.function()' --- 60,66 ---- ccode = compile(codestr, '', 'exec') ! # Jython doesn't have a __builtins__, so use a portable alternative ! import __builtin__ ! g = {'c': 0, '__builtins__': __builtin__} # this test could be more robust print 'new.function()' *************** *** 66,75 **** # bogus test of new.code() ! print 'new.code()' ! d = new.code(3, 3, 3, 3, codestr, (), (), (), ! "", "", 1, "", (), ()) ! # test backwards-compatibility version with no freevars or cellvars ! d = new.code(3, 3, 3, 3, codestr, (), (), (), ! "", "", 1, "") ! if verbose: ! print d --- 73,84 ---- # bogus test of new.code() ! # Note: Jython will never have new.code() ! if hasattr(new, 'code'): ! print 'new.code()' ! d = new.code(3, 3, 3, 3, codestr, (), (), (), ! "", "", 1, "", (), ()) ! # test backwards-compatibility version with no freevars or cellvars ! d = new.code(3, 3, 3, 3, codestr, (), (), (), ! "", "", 1, "") ! if verbose: ! print d From fdrake@users.sourceforge.net Fri Mar 23 16:20:49 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 23 Mar 2001 08:20:49 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/ref refa1.tex,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv22735/ref Modified Files: refa1.tex Log Message: Revise the markup so that this formats and uses markup consistently with the rest of the documentation. Index: refa1.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/refa1.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** refa1.tex 2001/03/23 15:29:54 1.1 --- refa1.tex 2001/03/23 16:20:46 1.2 *************** *** 1,21 **** ! \chapter{Appendix: Future statements and nested scopes} The semantics of Python's static scoping will change in version 2.2 to support resolution of unbound local names in enclosing functions' namespaces. The new semantics will be available in Python 2.1 through ! the use of a future statement. This appendix documents these two features for Python 2.1; it will be removed in Python 2.2 and the features will be documented in the main sections of this manual. ! \section{Future statements} ! \indexii{future}{statement} ! A \dfn{future statement} is a directive to the compiler that a ! particular module should be compiled using syntax or semantics that ! will be available in a specified future release of Python. The future ! statement is intended to ease migration to future versions of Python ! that introduce incompatible changes to the language. It allows use of ! the new features on a per-module basis before the release in which the ! feature becomes standard. \begin{verbatim} --- 1,23 ---- ! \chapter{Future statements and nested scopes \label{futures}} ! \sectionauthor{Jeremy Hylton}{jeremy@alum.mit.edu} + The semantics of Python's static scoping will change in version 2.2 to support resolution of unbound local names in enclosing functions' namespaces. The new semantics will be available in Python 2.1 through ! the use of a ``future'' statement. This appendix documents these two features for Python 2.1; it will be removed in Python 2.2 and the features will be documented in the main sections of this manual. + ! \section{Future statements \label{future-statements}} ! A \dfn{future statement}\indexii{future}{statement} is a directive to ! the compiler that a particular module should be compiled using syntax ! or semantics that will be available in a specified future release of ! Python. The future statement is intended to ease migration to future ! versions of Python that introduce incompatible changes to the ! language. It allows use of the new features on a per-module basis ! before the release in which the feature becomes standard. \begin{verbatim} *************** *** 53,57 **** The direct runtime semantics are the same as for any import statement: ! there is a standard module \file{__future__.py}, described later, and it will be imported in the usual way at the time the future statement is executed. --- 55,59 ---- The direct runtime semantics are the same as for any import statement: ! there is a standard module \module{__future__}, described later, and it will be imported in the usual way at the time the future statement is executed. *************** *** 66,80 **** \end{verbatim} ! That is not a future statement; it's an ordinary import statement, with no special semantics or syntax restrictions. Code compiled by an exec statement or calls to the builtin functions ! \function{compile} and \function{execfile} that occur in a module M ! containing a future statement will use the new syntax or semantics ! associated with the future statement. A future statement typed at an interactive interpreter prompt will take effect for the rest of the interpreter session. If an ! interpreter is started with the \emph{-i} option, is passed a script name to execute, and the script includes a future statement, it will be in effect in the interactive session started after the script --- 68,82 ---- \end{verbatim} ! That is not a future statement; it's an ordinary import statement with no special semantics or syntax restrictions. Code compiled by an exec statement or calls to the builtin functions ! \function{compile()} and \function{execfile()} that occur in a module ! \module{M} containing a future statement will use the new syntax or ! semantics associated with the future statement. A future statement typed at an interactive interpreter prompt will take effect for the rest of the interpreter session. If an ! interpreter is started with the \programopt{-i} option, is passed a script name to execute, and the script includes a future statement, it will be in effect in the interactive session started after the script *************** *** 84,91 **** Future statement definitions} ! \declaremodule{standard}{__future__} \modulesynopsis{Future statement definitions} ! \file{__future__.py} is a real module, and serves three purposes: \begin{itemize} --- 86,93 ---- Future statement definitions} ! \declaremodule[future]{standard}{__future__} \modulesynopsis{Future statement definitions} ! \module{__future__} is a real module, and serves three purposes: \begin{itemize} *************** *** 96,100 **** \item To ensure that future_statements run under releases prior to 2.1 at least yield runtime exceptions (the import of ! \code{__future__} will fail, because there was no module of that name prior to 2.1). --- 98,102 ---- \item To ensure that future_statements run under releases prior to 2.1 at least yield runtime exceptions (the import of ! \module{__future__} will fail, because there was no module of that name prior to 2.1). *************** *** 102,106 **** will be --- or were --- made mandatory. This is a form of executable documentation, and can be inspected programatically via importing ! \code{__future__} and examining its contents. \end{itemize} --- 104,108 ---- will be --- or were --- made mandatory. This is a form of executable documentation, and can be inspected programatically via importing ! \module{__future__} and examining its contents. \end{itemize} *************** *** 112,117 **** \end{verbatim} ! where, normally, OptionalRelease < MandatoryRelease, and both are ! 5-tuples of the same form as \code{sys.version_info}: \begin{verbatim} --- 114,119 ---- \end{verbatim} ! where, normally, OptionalRelease is less then MandatoryRelease, and ! both are 5-tuples of the same form as \code{sys.version_info}: \begin{verbatim} *************** *** 136,148 **** use such imports. ! MandatoryRelease may also be None, meaning that a planned feature got ! dropped. Instances of class \class{_Feature} have two corresponding methods, ! \member{getOptionalRelease()} and \member{getMandatoryRelease()}. ! No feature line will ever be deleted from \file{__future__.py}. - \section{Nested scopes} \indexii{nested}{scopes} --- 138,152 ---- use such imports. ! MandatoryRelease may also be \code{None}, meaning that a planned ! feature got dropped. Instances of class \class{_Feature} have two corresponding methods, ! \method{getOptionalRelease()} and \method{getMandatoryRelease()}. ! ! No feature description will ever be deleted from \module{__future__}. ! ! \section{Nested scopes \label{nested-scopes}} \indexii{nested}{scopes} From fdrake@users.sourceforge.net Fri Mar 23 16:21:18 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 23 Mar 2001 08:21:18 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/ref ref.tex,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv22811/ref Modified Files: ref.tex Log Message: Include the futures appendix. Index: ref.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref.tex,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -r1.34 -r1.35 *** ref.tex 1999/11/10 16:13:25 1.34 --- ref.tex 2001/03/23 16:21:15 1.35 *************** *** 59,62 **** --- 59,65 ---- \input{ref8} % Top-level components + \appendix + \input{refa1} % Future statements and nested scopes + \input{ref.ind} From fdrake@users.sourceforge.net Fri Mar 23 16:23:23 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 23 Mar 2001 08:23:23 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc Makefile.deps,1.61,1.62 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory usw-pr-cvs1:/tmp/cvs-serv23271 Modified Files: Makefile.deps Log Message: Add entry for the futures appendix in the reference manual. Correct the comment at the top of the file. Index: Makefile.deps =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile.deps,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -r1.61 -r1.62 *** Makefile.deps 2001/03/01 19:54:29 1.61 --- Makefile.deps 2001/03/23 16:23:21 1.62 *************** *** 1,4 **** ! # LaTeX source dependencies; note that the files are named relative to a ! # child directory and not the directory this file is located in. COMMONSTYLES= texinputs/python.sty \ --- 1,3 ---- ! # LaTeX source dependencies. COMMONSTYLES= texinputs/python.sty \ *************** *** 39,43 **** ref/ref6.tex \ ref/ref7.tex \ ! ref/ref8.tex # LaTeX source files for the Python Library Reference --- 38,43 ---- ref/ref6.tex \ ref/ref7.tex \ ! ref/ref8.tex \ ! ref/refa1.tex # LaTeX source files for the Python Library Reference From fdrake@users.sourceforge.net Fri Mar 23 16:29:08 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 23 Mar 2001 08:29:08 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/tools/sgmlconv conversion.xml,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools/sgmlconv In directory usw-pr-cvs1:/tmp/cvs-serv24278 Modified Files: conversion.xml Log Message: Add conversions for more of the markup -- not all of this was around when this file was written! Index: conversion.xml =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/sgmlconv/conversion.xml,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** conversion.xml 2000/11/22 16:45:19 1.10 --- conversion.xml 2001/03/23 16:29:06 1.11 *************** *** 42,49 **** ! --- 42,55 ---- ! + + + + + + *************** *** 94,97 **** --- 100,106 ---- + + + *************** *** 264,267 **** --- 273,281 ---- + + + + + + + + + + + + + + + + + + + *************** *** 632,635 **** --- 660,666 ---- + + + From fdrake@users.sourceforge.net Fri Mar 23 16:38:14 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 23 Mar 2001 08:38:14 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/tools/sgmlconv esis2sgml.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools/sgmlconv In directory usw-pr-cvs1:/tmp/cvs-serv25685 Modified Files: esis2sgml.py Log Message: Pick the "escape" function from the standard library instead of from PyXML. Index: esis2sgml.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/sgmlconv/esis2sgml.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** esis2sgml.py 1999/08/26 17:50:26 1.13 --- esis2sgml.py 2001/03/23 16:38:12 1.14 *************** *** 18,22 **** import string ! from xml.utils import escape --- 18,22 ---- import string ! from xml.sax.saxutils import escape From fdrake@users.sourceforge.net Fri Mar 23 16:42:11 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 23 Mar 2001 08:42:11 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/tools/sgmlconv esistools.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools/sgmlconv In directory usw-pr-cvs1:/tmp/cvs-serv26376 Modified Files: esistools.py Log Message: Re-write to no longer depend on an old version of PyXML. This now implements a SAX XMLReader interface instead of the old Builder interface used with PyDOM (now obsolete). This only depends on the standard library, not PyXML. Index: esistools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/sgmlconv/esistools.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** esistools.py 1999/08/26 18:04:32 1.4 --- esistools.py 2001/03/23 16:42:08 1.5 *************** *** 4,21 **** import re import string - import sys - import xml.dom.core - import xml.dom.esis_builder ! _data_rx = re.compile(r"[^\\][^\\]*") def decode(s): r = '' while s: ! m = _data_rx.match(s) if m: r = r + m.group() ! s = s[len(m.group()):] elif s[1] == "\\": r = r + "\\" --- 4,24 ---- import re import string + import xml.dom.pulldom ! import xml.sax ! import xml.sax.handler ! import xml.sax.xmlreader + + _data_match = re.compile(r"[^\\][^\\]*").match + def decode(s): r = '' while s: ! m = _data_match(s) if m: r = r + m.group() ! s = s[m.end():] elif s[1] == "\\": r = r + "\\" *************** *** 24,27 **** --- 27,34 ---- r = r + "\n" s = s[2:] + elif s[1] == "%": + s = s[2:] + n, s = s.split(";", 1) + r = r + unichr(int(n)) else: raise ValueError, "can't handle " + `s` *************** *** 36,83 **** del c def encode(s): ! return string.join(map(_charmap.get, s), '') ! class ExtendedEsisBuilder(xml.dom.esis_builder.EsisBuilder): ! def __init__(self, *args, **kw): ! self.__empties = {} ! self.__is_empty = 0 ! apply(xml.dom.esis_builder.EsisBuilder.__init__, (self,) + args, kw) ! self.buildFragment() ! def feed(self, data): ! for line in string.split(data, '\n'): ! if not line: ! break ! event = line[0] ! text = line[1:] ! if event == '(': ! element = self.document.createElement(text, self.attr_store) ! self.attr_store = {} ! self.push(element) ! if self.__is_empty: ! self.__empties[text] = text ! self.__is_empty = 0 ! elif event == ')': ! self.pop() ! elif event == 'A': ! l = re.split(' ', text, 2) ! name = l[0] ! value = decode(l[2]) ! self.attr_store[name] = value ! elif event == '-': ! text = self.document.createText(decode(text)) ! self.push(text) ! elif event == 'C': ! return ! elif event == 'e': ! self.__is_empty = 1 ! elif event == '&': ! eref = self.document.createEntityReference(text) ! self.push(eref) ! else: ! sys.stderr.write('Unknown event: %s\n' % line) def get_empties(self): ! return self.__empties.keys() --- 43,310 ---- del c + _null_join = ''.join def encode(s): ! return _null_join(map(_charmap.get, s)) ! class ESISReader(xml.sax.xmlreader.XMLReader): ! """SAX Reader which reads from an ESIS stream. ! No verification of the document structure is performed by the ! reader; a general verifier could be used as the target ! ContentHandler instance. ! ! """ ! _decl_handler = None ! _lexical_handler = None + _public_id = None + _system_id = None + + _buffer = "" + _is_empty = 0 + _lineno = 0 + _started = 0 + + def __init__(self, contentHandler=None, errorHandler=None): + xml.sax.xmlreader.XMLReader.__init__(self) + self._attrs = {} + self._attributes = Attributes(self._attrs) + self._locator = Locator() + self._empties = {} + if contentHandler: + self.setContentHandler(contentHandler) + if errorHandler: + self.setErrorHandler(errorHandler) + def get_empties(self): ! return self._empties.keys() ! ! # ! # XMLReader interface ! # ! ! def parse(self, source): ! raise RuntimeError ! self._locator._public_id = source.getPublicId() ! self._locator._system_id = source.getSystemId() ! fp = source.getByteStream() ! handler = self.getContentHandler() ! if handler: ! handler.startDocument() ! lineno = 0 ! while 1: ! token, data = self._get_token(fp) ! if token is None: ! break ! lineno = lineno + 1 ! self._locator._lineno = lineno ! self._handle_token(token, data) ! handler = self.getContentHandler() ! if handler: ! handler.startDocument() ! ! def feed(self, data): ! if not self._started: ! handler = self.getContentHandler() ! if handler: ! handler.startDocument() ! self._started = 1 ! data = self._buffer + data ! self._buffer = None ! lines = data.split("\n") ! if lines: ! for line in lines[:-1]: ! self._lineno = self._lineno + 1 ! self._locator._lineno = self._lineno ! if not line: ! e = xml.sax.SAXParseException( ! "ESIS input line contains no token type mark", ! None, self._locator) ! self.getErrorHandler().error(e) ! else: ! self._handle_token(line[0], line[1:]) ! self._buffer = lines[-1] ! else: ! self._buffer = "" ! ! def close(self): ! handler = self.getContentHandler() ! if handler: ! handler.endDocument() ! self._buffer = "" ! ! def _get_token(self, fp): ! try: ! line = fp.readline() ! except IOError, e: ! e = SAXException("I/O error reading input stream", e) ! self.getErrorHandler().fatalError(e) ! return ! if not line: ! return None, None ! if line[-1] == "\n": ! line = line[:-1] ! if not line: ! e = xml.sax.SAXParseException( ! "ESIS input line contains no token type mark", ! None, self._locator) ! self.getErrorHandler().error(e) ! return ! return line[0], line[1:] ! ! def _handle_token(self, token, data): ! handler = self.getContentHandler() ! if token == '-': ! if data and handler: ! handler.characters(decode(data)) ! elif token == ')': ! if handler: ! handler.endElement(decode(data)) ! elif token == '(': ! if self._is_empty: ! self._empties[data] = 1 ! if handler: ! handler.startElement(data, self._attributes) ! self._attrs.clear() ! self._is_empty = 0 ! elif token == 'A': ! name, value = data.split(' ', 1) ! if value != "IMPLIED": ! type, value = value.split(' ', 1) ! self._attrs[name] = (decode(value), type) ! elif token == '&': ! # entity reference in SAX? ! pass ! elif token == '?': ! if handler: ! if ' ' in data: ! target, data = string.split(data, None, 1) ! else: ! target, data = data, "" ! handler.processingInstruction(target, decode(data)) ! elif token == 'N': ! handler = self.getDTDHandler() ! if handler: ! handler.notationDecl(data, self._public_id, self._system_id) ! self._public_id = None ! self._system_id = None ! elif token == 'p': ! self._public_id = decode(data) ! elif token == 's': ! self._system_id = decode(data) ! elif token == 'e': ! self._is_empty = 1 ! elif token == 'C': ! pass ! else: ! e = SAXParseException("unknown ESIS token in event stream", ! None, self._locator) ! self.getErrorHandler().error(e) ! ! def setContentHandler(self, handler): ! old = self.getContentHandler() ! if old: ! old.setDocumentLocator(None) ! if handler: ! handler.setDocumentLocator(self._locator) ! xml.sax.xmlreader.XMLReader.setContentHandler(self, handler) ! ! def getProperty(self, property): ! if property == xml.sax.handler.property_lexical_handler: ! return self._lexical_handler ! ! elif property == xml.sax.handler.property_declaration_handler: ! return self._decl_handler ! ! else: ! raise xml.sax.SAXNotRecognizedException("unknown property %s" ! % `property`) ! ! def setProperty(self, property, value): ! if property == xml.sax.handler.property_lexical_handler: ! if self._lexical_handler: ! self._lexical_handler.setDocumentLocator(None) ! if value: ! value.setDocumentLocator(self._locator) ! self._lexical_handler = value ! ! elif property == xml.sax.handler.property_declaration_handler: ! if self._decl_handler: ! self._decl_handler.setDocumentLocator(None) ! if value: ! value.setDocumentLocator(self._locator) ! self._decl_handler = value ! ! else: ! raise xml.sax.SAXNotRecognizedException() ! ! def getFeature(self, feature): ! if feature == xml.sax.handler.feature_namespaces: ! return 1 ! else: ! return xml.sax.xmlreader.XMLReader.getFeature(self, feature) ! ! def setFeature(self, feature, enabled): ! if feature == xml.sax.handler.feature_namespaces: ! pass ! else: ! xml.sax.xmlreader.XMLReader.setFeature(self, feature, enabled) ! ! ! class Attributes(xml.sax.xmlreader.AttributesImpl): ! # self._attrs has the form {name: (value, type)} ! ! def getType(self, name): ! return self._attrs[name][1] ! ! def getValue(self, name): ! return self._attrs[name][0] ! ! def getValueByQName(self, name): ! return self._attrs[name][0] ! ! def __getitem__(self, name): ! return self._attrs[name][0] ! ! def get(self, name, default=None): ! if self._attrs.has_key(name): ! return self._attrs[name][0] ! return default ! ! def items(self): ! L = [] ! for name, (value, type) in self._attrs.items(): ! L.append((name, value)) ! return L ! ! def values(self): ! L = [] ! for value, type in self._attrs.values(): ! L.append(value) ! return L ! ! ! class Locator(xml.sax.xmlreader.Locator): ! _lineno = -1 ! _public_id = None ! _system_id = None ! ! def getLineNumber(self): ! return self._lineno ! ! def getPublicId(self): ! return self._public_id ! ! def getSystemId(self): ! return self._system_id ! ! ! def parse(stream_or_string, parser=None): ! if type(stream_or_string) in [type(""), type(u"")]: ! stream = open(stream_or_string) ! else: ! stream = stream_or_string ! if not parser: ! parser = ESISReader() ! return xml.dom.pulldom.DOMEventStream(stream, parser, (2 ** 14) - 20) From fdrake@users.sourceforge.net Fri Mar 23 16:47:13 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 23 Mar 2001 08:47:13 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/ref refa1.tex,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv27517/ref Modified Files: refa1.tex Log Message: No quotes around the "future" in the first use of the term "future statement". Index: refa1.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/refa1.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** refa1.tex 2001/03/23 16:20:46 1.2 --- refa1.tex 2001/03/23 16:47:11 1.3 *************** *** 6,10 **** support resolution of unbound local names in enclosing functions' namespaces. The new semantics will be available in Python 2.1 through ! the use of a ``future'' statement. This appendix documents these two features for Python 2.1; it will be removed in Python 2.2 and the features will be documented in the main sections of this manual. --- 6,10 ---- support resolution of unbound local names in enclosing functions' namespaces. The new semantics will be available in Python 2.1 through ! the use of a future statement. This appendix documents these two features for Python 2.1; it will be removed in Python 2.2 and the features will be documented in the main sections of this manual. From fdrake@users.sourceforge.net Fri Mar 23 16:53:36 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 23 Mar 2001 08:53:36 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/tools/sgmlconv latex2esis.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools/sgmlconv In directory usw-pr-cvs1:/tmp/cvs-serv28505 Modified Files: latex2esis.py Log Message: Pick up the "encode" function from esistools instead of defining our own (broken) version. Remove Conversion.err_write() -- use dbgmsg() consistently. Index: latex2esis.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/sgmlconv/latex2esis.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -r1.22 -r1.23 *** latex2esis.py 2000/11/22 17:59:32 1.22 --- latex2esis.py 2001/03/23 16:53:34 1.23 *************** *** 33,36 **** --- 33,39 ---- + from esistools import encode + + DEBUG = 0 *************** *** 48,55 **** LaTeXFormatError.__init__(self, msg) - def encode(s): - s = xml.sax.saxutils.escape(s) - return s.replace("\n", "\\n\n-") - _begin_env_rx = re.compile(r"[\\]begin{([^}]*)}") --- 51,54 ---- *************** *** 86,90 **** raise LaTeXFormatError("cannot push non-string on stack: " + `entry`) ! sys.stderr.write("%s<%s>\n" % (" "*len(self.data), entry)) self.data.append(entry) --- 85,89 ---- raise LaTeXFormatError("cannot push non-string on stack: " + `entry`) ! #dbgmsg("%s<%s>" % (" "*len(self.data), entry)) self.data.append(entry) *************** *** 92,101 **** entry = self.data[index] del self.data[index] ! sys.stderr.write("%s\n" % (" "*len(self.data), entry)) def __delitem__(self, index): entry = self.data[index] del self.data[index] ! sys.stderr.write("%s\n" % (" "*len(self.data), entry)) --- 91,100 ---- entry = self.data[index] del self.data[index] ! #dbgmsg("%s" % (" "*len(self.data), entry)) def __delitem__(self, index): entry = self.data[index] del self.data[index] ! #dbgmsg("%s" % (" "*len(self.data), entry)) *************** *** 114,121 **** self.preamble = 1 - def err_write(self, msg): - if DEBUG: - sys.stderr.write(str(msg) + "\n") - def convert(self): self.subconvert() --- 113,116 ---- *************** *** 272,276 **** stack.append(entry.name) self.write("(%s\n" % entry.outputname) ! self.err_write("--- text: %s\n" % `pentry.text`) self.write("-%s\n" % encode(pentry.text)) elif pentry.type == "entityref": --- 267,271 ---- stack.append(entry.name) self.write("(%s\n" % entry.outputname) ! #dbgmsg("--- text: %s" % `pentry.text`) self.write("-%s\n" % encode(pentry.text)) elif pentry.type == "entityref": *************** *** 291,295 **** macroname = stack[-1] if macroname: ! conversion = self.table.get(macroname) if conversion.outputname: # otherwise, it was just a bare group --- 286,290 ---- macroname = stack[-1] if macroname: ! conversion = self.table[macroname] if conversion.outputname: # otherwise, it was just a bare group *************** *** 374,379 **** entry = self.table.get(name) if entry is None: ! self.err_write("get_entry(%s) failing; building default entry!" ! % `name`) # not defined; build a default entry: entry = TableEntry(name) --- 369,373 ---- entry = self.table.get(name) if entry is None: ! dbgmsg("get_entry(%s) failing; building default entry!" % `name`) # not defined; build a default entry: entry = TableEntry(name) From bwarsaw@users.sourceforge.net Fri Mar 23 17:00:09 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Fri, 23 Mar 2001 09:00:09 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib locale.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv29802 Modified Files: locale.py Log Message: setlocale(): In _locale-missing compatibility function, string comparison should be done with != instead of "is not". Index: locale.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/locale.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -r1.15 -r1.16 *** locale.py 2001/02/09 10:48:30 1.15 --- locale.py 2001/03/23 17:00:07 1.16 *************** *** 70,75 **** Activates/queries locale processing. """ ! if value is not None and \ ! value is not 'C': raise Error, '_locale emulation only supports "C" locale' return 'C' --- 70,74 ---- Activates/queries locale processing. """ ! if value is not None and value != 'C': raise Error, '_locale emulation only supports "C" locale' return 'C' From fdrake@users.sourceforge.net Fri Mar 23 17:01:50 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 23 Mar 2001 09:01:50 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/tools/sgmlconv docfixer.py,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools/sgmlconv In directory usw-pr-cvs1:/tmp/cvs-serv30077 Modified Files: docfixer.py Log Message: Lots of small changes to make this work with the Python DOM bindings (minidom in particular); it was using PyDOM which is now obsolete. Only write the output file on success -- this avoids updating the timestamp on the file on failure, which confuses "make". Index: docfixer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/sgmlconv/docfixer.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -r1.25 -r1.26 *** docfixer.py 2000/05/24 14:33:26 1.25 --- docfixer.py 2001/03/23 17:01:47 1.26 *************** *** 12,21 **** import string import sys ! import xml.dom.core ! from xml.dom.core import \ ! ELEMENT, \ ! ENTITY_REFERENCE, \ ! TEXT --- 12,21 ---- import string import sys ! import xml.dom ! import xml.dom.minidom ! ELEMENT = xml.dom.Node.ELEMENT_NODE ! ENTITY_REFERENCE = xml.dom.Node.ENTITY_REFERENCE_NODE ! TEXT = xml.dom.Node.TEXT_NODE *************** *** 50,79 **** - # Workaround to deal with invalid documents (multiple root elements). This - # does not indicate a bug in the DOM implementation. - # - def get_documentElement(doc): - docelem = None - for n in doc.childNodes: - if n.nodeType == ELEMENT: - docelem = n - return docelem - - xml.dom.core.Document.get_documentElement = get_documentElement - - - # Replace get_childNodes for the Document class; without this, children - # accessed from the Document object via .childNodes (no matter how many - # levels of access are used) will be given an ownerDocument of None. - # - def get_childNodes(doc): - return xml.dom.core.NodeList(doc._node.children, doc._node) - - xml.dom.core.Document.get_childNodes = get_childNodes - - def get_first_element(doc, gi): for n in doc.childNodes: ! if n.get_nodeName() == gi: return n --- 50,56 ---- def get_first_element(doc, gi): for n in doc.childNodes: ! if n.nodeName == gi: return n *************** *** 85,95 **** def find_all_elements(doc, gi): nodes = [] ! if doc.get_nodeName() == gi: nodes.append(doc) for child in doc.childNodes: if child.nodeType == ELEMENT: ! if child.get_tagName() == gi: nodes.append(child) for node in child.getElementsByTagName(gi): --- 62,84 ---- + def get_documentElement(node): + result = None + for child in node.childNodes: + if child.nodeType == ELEMENT: + result = child + return result + + + def set_tagName(elem, gi): + elem.nodeName = elem.tagName = gi + + def find_all_elements(doc, gi): nodes = [] ! if doc.nodeName == gi: nodes.append(doc) for child in doc.childNodes: if child.nodeType == ELEMENT: ! if child.tagName == gi: nodes.append(child) for node in child.getElementsByTagName(gi): *************** *** 100,115 **** nodes = [] for child in doc.childNodes: ! if child.get_nodeName() == gi: nodes.append(child) return nodes def find_all_elements_from_set(doc, gi_set): return __find_all_elements_from_set(doc, gi_set, []) def __find_all_elements_from_set(doc, gi_set, nodes): ! if doc.get_nodeName() in gi_set: nodes.append(doc) for child in doc.childNodes: ! if child.get_nodeType() == ELEMENT: __find_all_elements_from_set(child, gi_set, nodes) return nodes --- 89,105 ---- nodes = [] for child in doc.childNodes: ! if child.nodeName == gi: nodes.append(child) return nodes + def find_all_elements_from_set(doc, gi_set): return __find_all_elements_from_set(doc, gi_set, []) def __find_all_elements_from_set(doc, gi_set, nodes): ! if doc.nodeName in gi_set: nodes.append(doc) for child in doc.childNodes: ! if child.nodeType == ELEMENT: __find_all_elements_from_set(child, gi_set, nodes) return nodes *************** *** 130,134 **** node = get_first_element(fragment, "document") if node is not None: ! node._node.name = documentclass while 1: node = extract_first_element(fragment, "input") --- 120,124 ---- node = get_first_element(fragment, "document") if node is not None: ! set_tagName(node, documentclass) while 1: node = extract_first_element(fragment, "input") *************** *** 144,148 **** docelem.insertBefore(node, text) docelem.insertBefore(doc.createTextNode("\n"), docelem.firstChild) ! while fragment.firstChild and fragment.firstChild.get_nodeType() == TEXT: fragment.removeChild(fragment.firstChild) --- 134,138 ---- docelem.insertBefore(node, text) docelem.insertBefore(doc.createTextNode("\n"), docelem.firstChild) ! while fragment.firstChild and fragment.firstChild.nodeType == TEXT: fragment.removeChild(fragment.firstChild) *************** *** 154,160 **** prevskip = skip skip = 0 ! if n.get_nodeType() == TEXT and not prevskip: discards.append(n) ! elif n.get_nodeName() == "COMMENT": skip = 1 for node in discards: --- 144,150 ---- prevskip = skip skip = 0 ! if n.nodeType == TEXT and not prevskip: discards.append(n) ! elif n.nodeName == "COMMENT": skip = 1 for node in discards: *************** *** 178,183 **** children = container.childNodes for child in children: ! if child.get_nodeType() == ELEMENT: ! tagName = child.get_tagName() if tagName in DESCRIPTOR_ELEMENTS: rewrite_descriptor(doc, child) --- 168,173 ---- children = container.childNodes for child in children: ! if child.nodeType == ELEMENT: ! tagName = child.tagName if tagName in DESCRIPTOR_ELEMENTS: rewrite_descriptor(doc, child) *************** *** 201,210 **** # # 1. ! descname = descriptor.get_tagName() index = 1 if descname[-2:] == "ni": descname = descname[:-2] descriptor.setAttribute("index", "no") ! descriptor._node.name = descname index = 0 desctype = descname[:-4] # remove 'desc' --- 191,200 ---- # # 1. ! descname = descriptor.tagName index = 1 if descname[-2:] == "ni": descname = descname[:-2] descriptor.setAttribute("index", "no") ! set_tagName(descriptor, descname) index = 0 desctype = descname[:-4] # remove 'desc' *************** *** 220,224 **** descriptor.removeAttribute("name") # 2a. ! if descriptor.attributes.has_key("var"): if descname != "opcodedesc": raise RuntimeError, \ --- 210,214 ---- descriptor.removeAttribute("name") # 2a. ! if descriptor.hasAttribute("var"): if descname != "opcodedesc": raise RuntimeError, \ *************** *** 246,253 **** pos = skip_leading_nodes(children, pos) while pos < len(children) \ ! and children[pos].get_nodeName() in (linename, "versionadded"): ! if children[pos].get_tagName() == linename: # this is really a supplemental signature, create ! sig = methodline_to_signature(doc, children[pos]) newchildren.append(sig) else: --- 236,248 ---- pos = skip_leading_nodes(children, pos) while pos < len(children) \ ! and children[pos].nodeName in (linename, "versionadded"): ! if children[pos].tagName == linename: # this is really a supplemental signature, create ! oldchild = children[pos].cloneNode(1) ! try: ! sig = methodline_to_signature(doc, children[pos]) ! except KeyError: ! print oldchild.toxml() ! raise newchildren.append(sig) else: *************** *** 302,306 **** # must be called after simplfy() if document is multi-rooted to begin with docelem = get_documentElement(fragment) ! toplevel = docelem.get_tagName() == "manual" and "chapter" or "section" appendices = 0 nodes = [] --- 297,301 ---- # must be called after simplfy() if document is multi-rooted to begin with docelem = get_documentElement(fragment) ! toplevel = docelem.tagName == "manual" and "chapter" or "section" appendices = 0 nodes = [] *************** *** 334,338 **** continue parent = label.parentNode ! parentTagName = parent.get_tagName() if parentTagName == "title": parent.parentNode.setAttribute("id", id) --- 329,333 ---- continue parent = label.parentNode ! parentTagName = parent.tagName if parentTagName == "title": parent.parentNode.setAttribute("id", id) *************** *** 353,358 **** node = queue[0] del queue[0] ! if wsmap.has_key(node.get_nodeName()): ! ws = wsmap[node.get_tagName()] children = node.childNodes children.reverse() --- 348,353 ---- node = queue[0] del queue[0] ! if wsmap.has_key(node.nodeName): ! ws = wsmap[node.tagName] children = node.childNodes children.reverse() *************** *** 362,367 **** children.reverse() # hack to get the title in place: ! if node.get_tagName() == "title" \ ! and node.parentNode.firstChild.get_nodeType() == ELEMENT: node.parentNode.insertBefore(doc.createText("\n "), node.parentNode.firstChild) --- 357,362 ---- children.reverse() # hack to get the title in place: ! if node.tagName == "title" \ ! and node.parentNode.firstChild.nodeType == ELEMENT: node.parentNode.insertBefore(doc.createText("\n "), node.parentNode.firstChild) *************** *** 389,393 **** node = queue[0] del queue[0] ! if rewrite_element(node.get_tagName()): children = node.childNodes if len(children) == 1 \ --- 384,388 ---- node = queue[0] del queue[0] ! if rewrite_element(node.tagName): children = node.childNodes if len(children) == 1 \ *************** *** 412,416 **** return 0 if nodeType == ELEMENT: ! if l.get_tagName() != r.get_tagName(): return 0 # should check attributes, but that's not a problem here --- 407,411 ---- return 0 if nodeType == ELEMENT: ! if l.tagName != r.tagName: return 0 # should check attributes, but that's not a problem here *************** *** 431,435 **** if node is None: return ! node._node.name = "synopsis" lastchild = node.childNodes[-1] if lastchild.nodeType == TEXT \ --- 426,430 ---- if node is None: return ! set_tagName(node, "synopsis") lastchild = node.childNodes[-1] if lastchild.nodeType == TEXT \ *************** *** 438,447 **** modauthor = extract_first_element(section, "moduleauthor") if modauthor: ! modauthor._node.name = "author" modauthor.appendChild(doc.createTextNode( modauthor.getAttribute("name"))) modauthor.removeAttribute("name") platform = extract_first_element(section, "platform") ! if section.get_tagName() == "section": modinfo_pos = 2 modinfo = doc.createElement("moduleinfo") --- 433,442 ---- modauthor = extract_first_element(section, "moduleauthor") if modauthor: ! set_tagName(modauthor, "author") modauthor.appendChild(doc.createTextNode( modauthor.getAttribute("name"))) modauthor.removeAttribute("name") platform = extract_first_element(section, "platform") ! if section.tagName == "section": modinfo_pos = 2 modinfo = doc.createElement("moduleinfo") *************** *** 468,472 **** children = title.childNodes if len(children) >= 2 \ ! and children[0].get_nodeName() == "module" \ and children[0].childNodes[0].data == name: # this is it; morph the into <short-synopsis> --- 463,467 ---- children = title.childNodes if len(children) >= 2 \ ! and children[0].nodeName == "module" \ and children[0].childNodes[0].data == name: # this is it; morph the <title> into <short-synopsis> *************** *** 474,478 **** if first_data.data[:4] == " ---": first_data.data = string.lstrip(first_data.data[4:]) ! title._node.name = "short-synopsis" if children[-1].nodeType == TEXT \ and children[-1].data[-1:] == ".": --- 469,473 ---- if first_data.data[:4] == " ---": first_data.data = string.lstrip(first_data.data[4:]) ! set_tagName(title, "short-synopsis") if children[-1].nodeType == TEXT \ and children[-1].data[-1:] == ".": *************** *** 512,516 **** for i in range(len(children)): node = children[i] ! if node.get_nodeName() == "moduleinfo": nextnode = children[i+1] if nextnode.nodeType == TEXT: --- 507,511 ---- for i in range(len(children)): node = children[i] ! if node.nodeName == "moduleinfo": nextnode = children[i+1] if nextnode.nodeType == TEXT: *************** *** 545,549 **** for child in children: if child.nodeType == ELEMENT: ! tagName = child.get_tagName() if tagName == "hline" and prev_row is not None: prev_row.setAttribute("rowsep", "1") --- 540,544 ---- for child in children: if child.nodeType == ELEMENT: ! tagName = child.tagName if tagName == "hline" and prev_row is not None: prev_row.setAttribute("rowsep", "1") *************** *** 559,569 **** if nodeType == TEXT: if string.strip(child.data): ! raise ConversionError("unexpected free data in table") table.removeChild(child) continue if nodeType == ELEMENT: ! if child.get_tagName() != "hline": raise ConversionError( ! "unexpected <%s> in table" % child.get_tagName()) table.removeChild(child) continue --- 554,565 ---- if nodeType == TEXT: if string.strip(child.data): ! raise ConversionError("unexpected free data in <%s>: %r" ! % (table.tagName, child.data)) table.removeChild(child) continue if nodeType == ELEMENT: ! if child.tagName != "hline": raise ConversionError( ! "unexpected <%s> in table" % child.tagName) table.removeChild(child) continue *************** *** 594,598 **** nodes = [] for child in source.childNodes: ! if child.get_nodeName() == name: nodes.append(child) for node in nodes: --- 590,594 ---- nodes = [] for child in source.childNodes: ! if child.nodeName == name: nodes.append(child) for node in nodes: *************** *** 634,638 **** def fixup_paras(doc, fragment): for child in fragment.childNodes: ! if child.get_nodeName() in RECURSE_INTO_PARA_CONTAINERS: fixup_paras_helper(doc, child) descriptions = find_all_elements(fragment, "description") --- 630,634 ---- def fixup_paras(doc, fragment): for child in fragment.childNodes: ! if child.nodeName in RECURSE_INTO_PARA_CONTAINERS: fixup_paras_helper(doc, child) descriptions = find_all_elements(fragment, "description") *************** *** 646,650 **** start = skip_leading_nodes(children) while len(children) > start: ! if children[start].get_nodeName() in RECURSE_INTO_PARA_CONTAINERS: # Something to recurse into: fixup_paras_helper(doc, children[start]) --- 642,646 ---- start = skip_leading_nodes(children) while len(children) > start: ! if children[start].nodeName in RECURSE_INTO_PARA_CONTAINERS: # Something to recurse into: fixup_paras_helper(doc, children[start]) *************** *** 669,673 **** nodeType = child.nodeType if nodeType == ELEMENT: ! if child.get_tagName() in BREAK_ELEMENTS: after = j break --- 665,669 ---- nodeType = child.nodeType if nodeType == ELEMENT: ! if child.tagName in BREAK_ELEMENTS: after = j break *************** *** 743,747 **** # all whitespace, just skip elif nodeType == ELEMENT: ! tagName = child.get_tagName() if tagName in RECURSE_INTO_PARA_CONTAINERS: return start --- 739,743 ---- # all whitespace, just skip elif nodeType == ELEMENT: ! tagName = child.tagName if tagName in RECURSE_INTO_PARA_CONTAINERS: return start *************** *** 773,777 **** def fixup_args(doc, arglist): for child in arglist.childNodes: ! if child.get_nodeName() == "optional": # found it; fix and return arglist.insertBefore(doc.createTextNode("["), child) --- 769,773 ---- def fixup_args(doc, arglist): for child in arglist.childNodes: ! if child.nodeName == "optional": # found it; fix and return arglist.insertBefore(doc.createTextNode("["), child) *************** *** 790,794 **** section = sectauth.parentNode section.removeChild(sectauth) ! sectauth._node.name = "author" sectauth.appendChild(doc.createTextNode( sectauth.getAttribute("name"))) --- 786,790 ---- section = sectauth.parentNode section.removeChild(sectauth) ! set_tagName(sectauth, "author") sectauth.appendChild(doc.createTextNode( sectauth.getAttribute("name"))) *************** *** 796,800 **** after = section.childNodes[2] title = section.childNodes[1] ! if title.get_nodeName() != "title": after = section.childNodes[0] section.insertBefore(doc.createTextNode("\n "), after) --- 792,796 ---- after = section.childNodes[2] title = section.childNodes[1] ! if title.nodeName != "title": after = section.childNodes[0] section.insertBefore(doc.createTextNode("\n "), after) *************** *** 807,815 **** if child.nodeType == TEXT \ and string.lstrip(child.data)[:3] == ">>>": ! verbatim._node.name = "interactive-session" def add_node_ids(fragment, counter=0): ! fragment._node.node_id = counter for node in fragment.childNodes: counter = counter + 1 --- 803,811 ---- if child.nodeType == TEXT \ and string.lstrip(child.data)[:3] == ">>>": ! set_tagName(verbatim, "interactive-session") def add_node_ids(fragment, counter=0): ! fragment.node_id = counter for node in fragment.childNodes: counter = counter + 1 *************** *** 817,821 **** counter = add_node_ids(node, counter) else: ! node._node.node_id = counter return counter + 1 --- 813,817 ---- counter = add_node_ids(node, counter) else: ! node.node_id = counter return counter + 1 *************** *** 832,836 **** for node in nodes: parent = node.parentNode ! d[parent._node.node_id] = parent del nodes map(fixup_refmodindexes_chunk, d.values()) --- 828,832 ---- for node in nodes: parent = node.parentNode ! d[parent.node_id] = parent del nodes map(fixup_refmodindexes_chunk, d.values()) *************** *** 839,843 **** def fixup_refmodindexes_chunk(container): # node is probably a <para>; let's see how often it isn't: ! if container.get_tagName() != PARA_ELEMENT: bwrite("--- fixup_refmodindexes_chunk(%s)\n" % container) module_entries = find_all_elements(container, "module") --- 835,839 ---- def fixup_refmodindexes_chunk(container): # node is probably a <para>; let's see how often it isn't: ! if container.tagName != PARA_ELEMENT: bwrite("--- fixup_refmodindexes_chunk(%s)\n" % container) module_entries = find_all_elements(container, "module") *************** *** 850,854 **** if len(children) != 0: bwrite("--- unexpected number of children for %s node:\n" ! % entry.get_tagName()) ewrite(entry.toxml() + "\n") continue --- 846,850 ---- if len(children) != 0: bwrite("--- unexpected number of children for %s node:\n" ! % entry.tagName) ewrite(entry.toxml() + "\n") continue *************** *** 874,878 **** for node in nodes: parent = node.parentNode ! d[parent._node.node_id] = parent del nodes map(fixup_bifuncindexes_chunk, d.values()) --- 870,874 ---- for node in nodes: parent = node.parentNode ! d[parent.node_id] = parent del nodes map(fixup_bifuncindexes_chunk, d.values()) *************** *** 906,910 **** parent = queue.pop() i = 0 ! children = parent.get_childNodes() nchildren = len(children) while i < (nchildren - 1): --- 902,906 ---- parent = queue.pop() i = 0 ! children = parent.childNodes nchildren = len(children) while i < (nchildren - 1): *************** *** 915,919 **** child = children[i] nextchild = children[i+1] ! nextchildren = nextchild.get_childNodes() while len(nextchildren): node = nextchildren[0] --- 911,915 ---- child = children[i] nextchild = children[i+1] ! nextchildren = nextchild.childNodes while len(nextchildren): node = nextchildren[0] *************** *** 933,937 **** nodeType = node.nodeType if nodeType == ELEMENT: ! gi = node.get_tagName() if knownempty(gi): if node.hasChildNodes(): --- 929,933 ---- nodeType = node.nodeType if nodeType == ELEMENT: ! gi = node.tagName if knownempty(gi): if node.hasChildNodes(): *************** *** 939,944 **** "declared-empty node <%s> has children" % gi ofp.write("e\n") ! for k, v in node.attributes.items(): ! value = v.value if _token_rx.match(value): dtype = "TOKEN" --- 935,939 ---- "declared-empty node <%s> has children" % gi ofp.write("e\n") ! for k, value in node.attributes.items(): if _token_rx.match(value): dtype = "TOKEN" *************** *** 952,956 **** ofp.write("-%s\n" % esistools.encode(node.data)) elif nodeType == ENTITY_REFERENCE: ! ofp.write("&%s\n" % node.get_nodeName()) else: raise RuntimeError, "unsupported node type: %s" % nodeType --- 947,951 ---- ofp.write("-%s\n" % esistools.encode(node.data)) elif nodeType == ENTITY_REFERENCE: ! ofp.write("&%s\n" % node.nodeName) else: raise RuntimeError, "unsupported node type: %s" % nodeType *************** *** 958,965 **** def convert(ifp, ofp): ! p = esistools.ExtendedEsisBuilder() ! p.feed(ifp.read()) ! doc = p.document ! fragment = p.fragment normalize(fragment) simplify(doc, fragment) --- 953,961 ---- def convert(ifp, ofp): ! events = esistools.parse(ifp) ! toktype, doc = events.getEvent() ! fragment = doc.createDocumentFragment() ! events.expandNode(fragment) ! normalize(fragment) simplify(doc, fragment) *************** *** 995,1000 **** # d = {} ! for gi in p.get_empties(): d[gi] = gi if d.has_key("rfc"): del d["rfc"] --- 991,998 ---- # d = {} ! for gi in events.parser.get_empties(): d[gi] = gi + if d.has_key("author"): + del d["author"] if d.has_key("rfc"): del d["rfc"] *************** *** 1020,1028 **** elif len(sys.argv) == 3: ifp = open(sys.argv[1]) ! ofp = open(sys.argv[2], "w") else: usage() sys.exit(2) convert(ifp, ofp) --- 1018,1032 ---- elif len(sys.argv) == 3: ifp = open(sys.argv[1]) ! import StringIO ! ofp = StringIO.StringIO() else: usage() sys.exit(2) convert(ifp, ofp) + if len(sys.argv) == 3: + fp = open(sys.argv[2], "w") + fp.write(ofp.getvalue()) + fp.close() + ofp.close() From fdrake@users.sourceforge.net Fri Mar 23 17:09:04 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 23 Mar 2001 09:09:04 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/tools/sgmlconv docfixer.py,1.26,1.27 esis2sgml.py,1.14,1.15 esistools.py,1.5,1.6 Message-ID: <E14gV3g-00089g-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/tools/sgmlconv In directory usw-pr-cvs1:/tmp/cvs-serv31338 Modified Files: docfixer.py esis2sgml.py esistools.py Log Message: Remove the annoying __version__ definitions. Index: docfixer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/sgmlconv/docfixer.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -r1.26 -r1.27 *** docfixer.py 2001/03/23 17:01:47 1.26 --- docfixer.py 2001/03/23 17:09:02 1.27 *************** *** 4,8 **** of the Python documentation, and dump the ESIS data for the transformed tree. """ - __version__ = '$Revision$' --- 4,7 ---- Index: esis2sgml.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/sgmlconv/esis2sgml.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** esis2sgml.py 2001/03/23 16:38:12 1.14 --- esis2sgml.py 2001/03/23 17:09:02 1.15 *************** *** 10,15 **** # generated from an SGML or an XML application. - __version__ = '$Revision$' - import errno import esistools --- 10,13 ---- Index: esistools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/sgmlconv/esistools.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** esistools.py 2001/03/23 16:42:08 1.5 --- esistools.py 2001/03/23 17:09:02 1.6 *************** *** 1,4 **** """Miscellaneous utility functions useful for dealing with ESIS streams.""" - __version__ = '$Revision$' import re --- 1,3 ---- From jhylton@users.sourceforge.net Fri Mar 23 17:23:52 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Fri, 23 Mar 2001 09:23:52 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libdis.tex,1.30,1.31 Message-ID: <E14gVI0-0000Ui-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv1640/lib Modified Files: libdis.tex Log Message: Add nested scopes spec to appendix. Add new opcodes LOAD_CLOSURE, LOAD_DEREF, STORE_DEREF, MAKE_CLOSURE to docs for dis module. Add docs for new function and code members in Sec. 3 of ref manual. They're present regardless of whether nested scopes are used. Remove description of default argument hack from Sec. 7 of the ref manual and refer the reader to the appendix. Index: libdis.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdis.tex,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -r1.30 -r1.31 *** libdis.tex 2000/10/10 22:00:03 1.30 --- libdis.tex 2001/03/23 17:23:49 1.31 *************** *** 557,560 **** --- 557,579 ---- \end{opcodedesc} + \begin{opcodedesc}{LOAD_CLOSURE}{i} + Pushes a reference to the cell contained in slot \var{i} of the + cell and free variable storage. The name of the variable is + \code{co_cellvars[\var{i}]} if \var{i} is less than the length of + \var{co_cellvars}. Otherwise it is + \code{co_freevars[\var{i} - len(co_cellvars)]}. + \end{opcodedesc} + + \begin{opcodedesc}{LOAD_DEREF}{i} + Loads the cell contained in slot \var{i} of the cell and free variable + storage. Pushes a reference to the object the cell contains on the + stack. + \end{opcodedesc} + + \begin{opcodedesc}{STORE_DEREF}{i} + Stores TOS into the cell contained in slot \var{i} of the cell and + free variable storage. + \end{opcodedesc} + \begin{opcodedesc}{SET_LINENO}{lineno} Sets the current line number to \var{lineno}. *************** *** 582,585 **** --- 601,612 ---- with the function. The function object is defined to have \var{argc} default parameters, which are found below TOS. + \end{opcodedesc} + + \begin{opcodedesc}{MAKE_CLOSURE}{argc} + Creates a new function object, sets its \var{func_closure} slot, and + pushes it on the stack. TOS is the code associated with the function. + If the code object has N free variables, the next N items on the stack + are the cells for these variables. The function also has \var{argc} + default parameters, where are found before the cells. \end{opcodedesc} From jhylton@users.sourceforge.net Fri Mar 23 17:23:52 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Fri, 23 Mar 2001 09:23:52 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/ref ref3.tex,1.62,1.63 ref7.tex,1.23,1.24 refa1.tex,1.3,1.4 Message-ID: <E14gVI0-0000Us-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv1640/ref Modified Files: ref3.tex ref7.tex refa1.tex Log Message: Add nested scopes spec to appendix. Add new opcodes LOAD_CLOSURE, LOAD_DEREF, STORE_DEREF, MAKE_CLOSURE to docs for dis module. Add docs for new function and code members in Sec. 3 of ref manual. They're present regardless of whether nested scopes are used. Remove description of default argument hack from Sec. 7 of the ref manual and refer the reader to the appendix. Index: ref3.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -r1.62 -r1.63 *** ref3.tex 2001/02/27 03:36:30 1.62 --- ref3.tex 2001/03/23 17:23:50 1.63 *************** *** 417,429 **** defines the global namespace of the module in which the function was defined; \member{func_dict} or \member{__dict__} contains the ! namespace supporting arbitrary function attributes. ! Of these, \member{func_code}, \member{func_defaults}, \member{func_doc}/\member{__doc__}, and \member{func_dict}/\member{__dict__} may be writable; the ! others can never be changed. ! Additional information about a function's definition can be ! retrieved from its code object; see the description of internal types ! below. \withsubitem{(function attribute)}{ \ttindex{func_doc} --- 417,434 ---- defines the global namespace of the module in which the function was defined; \member{func_dict} or \member{__dict__} contains the ! namespace supporting arbitrary function attributes; ! \member{func_closure} is \code{None} or a tuple of cells that contain ! binding for the function's free variables. ! Of these, \member{func_code}, \member{func_defaults}, \member{func_closure}, \member{func_doc}/\member{__doc__}, and \member{func_dict}/\member{__dict__} may be writable; the ! others can never be changed. Additional information about a ! function's definition can be retrieved from its code object; see the ! description of internal types below. ! ! In Python 2.1, the \member{func_closure} slot is always \code{None} ! unless nested scopes are enabled. (See the appendix.) ! \withsubitem{(function attribute)}{ \ttindex{func_doc} *************** *** 715,720 **** number of local variables used by the function (including arguments); \member{co_varnames} is a tuple containing the names of the local ! variables (starting with the argument names); \member{co_code} is a ! string representing the sequence of bytecode instructions; \member{co_consts} is a tuple containing the literals used by the bytecode; \member{co_names} is a tuple containing the names used by --- 720,728 ---- number of local variables used by the function (including arguments); \member{co_varnames} is a tuple containing the names of the local ! variables (starting with the argument names); \member{co_cellvars} is ! a tuple containing the names of local variables that are referenced by ! nested functions; \member{co_freevars} is a tuple containing the names ! of local variables that are neither local nor global; \member{co_code} ! is a string representing the sequence of bytecode instructions; \member{co_consts} is a tuple containing the literals used by the bytecode; \member{co_names} is a tuple containing the names used by *************** *** 726,729 **** --- 734,742 ---- (including local variables); \member{co_flags} is an integer encoding a number of flags for the interpreter. + + The \member{co_cellvars} and \member{co_freevars} are present in + Python 2.1 when nested scopes are not enabled, but the code itself + does not use or create cells. + \withsubitem{(code object attribute)}{ \ttindex{co_argcount} *************** *** 738,742 **** \ttindex{co_nlocals} \ttindex{co_stacksize} ! \ttindex{co_varnames}} The following flag bits are defined for \member{co_flags}: bit --- 751,757 ---- \ttindex{co_nlocals} \ttindex{co_stacksize} ! \ttindex{co_varnames} ! \ttindex{co_cellvars} ! \ttindex{co_freevars}} The following flag bits are defined for \member{co_flags}: bit *************** *** 745,751 **** \code{0x08} is set if the function uses the \samp{**keywords} syntax to accept arbitrary keyword arguments; other bits are used internally ! or reserved for future use. If\index{documentation string} a code ! object represents a function, the first item in \member{co_consts} is ! the documentation string of the function, or \code{None} if undefined. \item[Frame objects] --- 760,768 ---- \code{0x08} is set if the function uses the \samp{**keywords} syntax to accept arbitrary keyword arguments; other bits are used internally ! or reserved for future use; bit \code{0x10} is set if the function was ! compiled with nested scopes enabled. If\index{documentation string} a ! code object represents a function, the first item in ! \member{co_consts} is the documentation string of the function, or ! \code{None} if undefined. \item[Frame objects] Index: ref7.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref7.tex,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -r1.23 -r1.24 *** ref7.tex 2001/02/01 22:48:12 1.23 --- ref7.tex 2001/03/23 17:23:50 1.24 *************** *** 365,385 **** \strong{Programmer's note:} a ``\code{def}'' form executed inside a function definition defines a local function that can be returned or ! passed around. Because of Python's two-scope philosophy, a local ! function defined in this way does not have access to the local ! variables of the function that contains its definition; the same rule ! applies to functions defined by a lambda form. A standard trick to ! pass selected local variables into a locally defined function is to ! use default argument values, like this: ! ! \begin{verbatim} ! # Return a function that returns its argument incremented by 'n' ! def make_incrementer(n): ! def increment(x, n=n): ! return x+n ! return increment ! ! add1 = make_incrementer(1) ! print add1(3) # This prints '4' ! \end{verbatim} \section{Class definitions\label{class}} --- 365,371 ---- \strong{Programmer's note:} a ``\code{def}'' form executed inside a function definition defines a local function that can be returned or ! passed around. The semantics of name resolution in the nested ! function will change in Python 2.2. See the appendix for a ! description of the new semantics. \section{Class definitions\label{class}} Index: refa1.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/refa1.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** refa1.tex 2001/03/23 16:47:11 1.3 --- refa1.tex 2001/03/23 17:23:50 1.4 *************** *** 146,153 **** No feature description will ever be deleted from \module{__future__}. - \section{Nested scopes \label{nested-scopes}} - \indexii{nested}{scopes} ! Nested scopes are left as an exercise for the reader. --- 146,252 ---- No feature description will ever be deleted from \module{__future__}. \section{Nested scopes \label{nested-scopes}} \indexii{nested}{scopes} + + This section defines the new scoping semantics that will be introduced + in Python 2.2. They are available in Python 2.1 by using the future + statement \samp{nested_scopes}. This section begins with a bit of + terminology. + + \subsection{Definitions and rules \label{defintions}} + + \dfn{Names} refer to objects. Names are introduced by name binding + operations. Each occurrence of a name in the program text refers to + the binding of that name established in the innermost function block + containing the use. + + A \dfn{block} is a pice of Python program text that can is executed as + a unit. The following are blocks: a module, a function body, and a + class defintion. + + A \dfn{scope} defines the visibility of a name within a block. If a + local variable is defined in a block, it's scope includes that block. + If the definition occurs in a function block, the scope extends to any + blocks contained within the defining one, unless a contained block + introduces a different binding for the name. The scope of names + defined in a class block is limited to the class block; it does not + extend to the code blocks of methods. + + When a name is used in a code block, it is resolved using the nearest + enclosing scope. The set of all such scopes visible to a code block + is called the block's \dfn{environment}. + + If a name is bound in a block, it is a local variable of that block. + If a name is bound at the module level, it is a global variable. (The + ariables of the module code block are local and global.) If a + variable is used in a code block but not defined there, it is a + \dfn{free variable}. + + The name binding operations are assignment, class and function + definition, import statements, for statements, and except statements. + Each assignment or import statement occurs within a block defined by a + class or function definition or at the module level (the top-level + code block). + + If a name binding operation occurs anywhere within a code block, all + uses of the name within the block are treated as references to the + current block. This can lead to errors when a name is used within a + block before it is bound. + + The previous rule is a subtle. Python lacks declarations and allows + name binding operations to occur anywhere within a code block. The + local variables of a code block can be determined by scanning the + entire text of the block for name binding operations. + + If the global statement occurs within a block, all uses of the name + specified in the statement refer to the binding of that name in the + top-level namespace. Names are resolved in the top-level namespace by + searching the global namespace, i.e. the namespace of the module + containing the code block, and the builtin namespace, the namespace of + the module \module{__builtin__}. The global namespace is searched + first. If the name is not found there, the builtin namespace is + searched. The global statement must precede all uses of the name. + + The global statement has the same scope as a name binding operation + in the same block. If the nearest enclosing scope for a free variable + contains a global statement, the free variable is treated as a global. + + A class definition is an executable statement that may use and define + names. These references follow the normal rules for name resolution. + The namespace of the class definition becomes the attribute dictionary + of the class. Names defined at the class scope are not visible in + methods. + + \subsection{Interaction with dynamic features \label{dynamic-features}} + + There are several cases where Python statements are illegal when + used in conjunction with nested scopes that contain free + variables. + + If a variable is referenced in an enclosing scope, it is illegal + to delete the name. An error will be reported at compile time. + + If the wild card form of import --- \samp{import *} --- is used in a + function and the function contains or is a nested block with free + variables, the compiler will raise a SyntaxError. + + If exec is used in a function and the function contains or is a nested + block with free variables, the compiler will raise a SyntaxError + unless the exec explicitly specifies the local namespace for the exec. + (In other words, "exec obj" would be illegal, but "exec obj in ns" + would be legal.) + + The builtin functions \function{eval()} and \function{input()} can not + access free variables unless the variables are also referenced by the + program text of the block that contains the call to \function{eval()} + or \function{input()}. ! \emph{Compatibility note}: The compiler for Python 2.1 will issue ! warnings for uses of nested functions that will behave differently ! with nested scopes. The warnings will not be issued if nested scopes ! are enabled via a future statement. If a name bound in a function ! scope and the function contains a nested function scope that uses the ! name, the compiler will issue a warning. The name resolution rules ! will result in different bindings under Python 2.1 than under Python ! 2.2. The warning indicates that the program may not run correctly ! with all versions of Python. From akuchling@users.sourceforge.net Fri Mar 23 17:30:28 2001 From: akuchling@users.sourceforge.net (A.M. Kuchling) Date: Fri, 23 Mar 2001 09:30:28 -0800 Subject: [Python-checkins] CVS: distutils/distutils util.py,1.62,1.63 Message-ID: <E14gVOO-0000oq-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/distutils/distutils In directory usw-pr-cvs1:/tmp/cvs-serv2735 Modified Files: util.py Log Message: Change rfc822_escape() to ensure there's a consistent amount of whitespace after each newline, instead of just blindly inserting a space at the start of each line. (Improvement suggested by Thomas Wouters) Index: util.py =================================================================== RCS file: /cvsroot/python/distutils/distutils/util.py,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -r1.62 -r1.63 *** util.py 2001/03/22 03:03:41 1.62 --- util.py 2001/03/23 17:30:26 1.63 *************** *** 447,454 **** def rfc822_escape (header): """Return a version of the string escaped for inclusion in an ! RFC-822 header, by adding a space after each newline. """ ! header = string.rstrip(header) ! header = string.replace(header, '\n', '\n ') return header --- 447,455 ---- def rfc822_escape (header): """Return a version of the string escaped for inclusion in an ! RFC-822 header, by ensuring there are 8 spaces space after each newline. """ ! lines = string.split(header, '\n') ! lines = map(string.strip, lines) ! header = string.join(lines, '\n' + 8*' ') return header From akuchling@users.sourceforge.net Fri Mar 23 17:30:58 2001 From: akuchling@users.sourceforge.net (A.M. Kuchling) Date: Fri, 23 Mar 2001 09:30:58 -0800 Subject: [Python-checkins] CVS: distutils setup.py,1.28,1.29 Message-ID: <E14gVOs-0000q2-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/distutils In directory usw-pr-cvs1:/tmp/cvs-serv3211 Modified Files: setup.py Log Message: Bow to the inevitable and add my name as maintainer Index: setup.py =================================================================== RCS file: /cvsroot/python/distutils/setup.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -r1.28 -r1.29 *** setup.py 2001/03/16 21:00:18 1.28 --- setup.py 2001/03/23 17:30:56 1.29 *************** *** 16,19 **** --- 16,21 ---- author = "Greg Ward", author_email = "gward@python.net", + maintainer = "A.M. Kuchling", + maintainer_email = 'amk1@bigfoot.com', url = "http://www.python.org/sigs/distutils-sig/", licence = "Python", From fdrake@users.sourceforge.net Fri Mar 23 17:34:05 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 23 Mar 2001 09:34:05 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python pythonrun.c,2.130,2.131 Message-ID: <E14gVRt-00012j-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv3995/Python Modified Files: pythonrun.c Log Message: call_sys_exitfunc(): Remove unused variable f. Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.130 retrieving revision 2.131 diff -C2 -r2.130 -r2.131 *** pythonrun.c 2001/03/23 15:36:41 2.130 --- pythonrun.c 2001/03/23 17:34:02 2.131 *************** *** 1257,1261 **** if (exitfunc) { ! PyObject *res, *f; Py_INCREF(exitfunc); PySys_SetObject("exitfunc", (PyObject *)NULL); --- 1257,1261 ---- if (exitfunc) { ! PyObject *res; Py_INCREF(exitfunc); PySys_SetObject("exitfunc", (PyObject *)NULL); From bwarsaw@users.sourceforge.net Fri Mar 23 17:40:18 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Fri, 23 Mar 2001 09:40:18 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_socket.py,1.18,1.19 Message-ID: <E14gVXu-0001WH-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv5833 Modified Files: test_socket.py Log Message: Make socket.getservbyname test optional on socket module having that attribute. Jython does not have this function. Closes SF patch #403667. Index: test_socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -r1.18 -r1.19 *** test_socket.py 2001/02/09 11:57:20 1.18 --- test_socket.py 2001/03/23 17:40:16 1.19 *************** *** 84,92 **** print 'FQDN not found' ! print socket.getservbyname('telnet', 'tcp') ! try: ! socket.getservbyname('telnet', 'udp') ! except socket.error: ! pass --- 84,93 ---- print 'FQDN not found' ! if hasattr(socket, 'getservbyname'): ! print socket.getservbyname('telnet', 'tcp') ! try: ! socket.getservbyname('telnet', 'udp') ! except socket.error: ! pass From fdrake@users.sourceforge.net Fri Mar 23 17:42:12 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 23 Mar 2001 09:42:12 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/api api.tex,1.111,1.112 Message-ID: <E14gVZk-0001ce-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv6173/api Modified Files: api.tex Log Message: Strengthen the constraints on calling PyObject_GC_Fini(). Index: api.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/api.tex,v retrieving revision 1.111 retrieving revision 1.112 diff -C2 -r1.111 -r1.112 *** api.tex 2001/03/22 16:30:17 1.111 --- api.tex 2001/03/23 17:42:09 1.112 *************** *** 5030,5033 **** --- 5030,5038 ---- this for the object before any of the fields used by the \member{tp_traverse} handler become invalid. + + \strong{Note:} Any container which may be referenced from another + object reachable by the collector must itself be tracked by the + collector, so it is generally not safe to call this function + anywhere but in the object's deallocator. \end{cfuncdesc} From fdrake@users.sourceforge.net Fri Mar 23 17:51:40 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 23 Mar 2001 09:51:40 -0800 Subject: [Python-checkins] CVS: python/dist/src README,1.117,1.118 Message-ID: <E14gViu-00029H-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv8211 Modified Files: README Log Message: Update Mac OS X platform notes. This closes SF bug #406191. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.117 retrieving revision 1.118 diff -C2 -r1.117 -r1.118 *** README 2001/03/22 15:29:37 1.117 --- README 2001/03/23 17:51:37 1.118 *************** *** 389,398 **** future release. ! MacOS X: You need to add the "-traditional-cpp" option to the ! compiler command line for the MacOS X Public Beta. This is appearantly a bug in the default pre-processor, and is expected not to be a problem with future versions. Run ! configure with "OPT=-traditional-cpp ./configure" to add this ! option. --- 389,402 ---- future release. ! Mac OS X: You need to add the "-traditional-cpp" option to the ! compiler command line for the Mac OS X Public Beta. This is appearantly a bug in the default pre-processor, and is expected not to be a problem with future versions. Run ! configure with "OPT='-g -traditional-cpp' ./configure ! --with-suffix=.exe --with-dyld" to add this ! option. One of the regular expression tests fails due to the ! small stack size used by default (how to change this?), and ! the test_largefile test is only expected to work on a Unix UFS ! filesystem (how to check for this on Mac OS X?). From bwarsaw@users.sourceforge.net Fri Mar 23 17:53:51 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Fri, 23 Mar 2001 09:53:51 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib site.py,1.25,1.26 Message-ID: <E14gVl1-0002IE-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv8800 Modified Files: site.py Log Message: Two minor changes for better Jython compatibility. Finn Bock says: Change 1: Not all 'modules' in sys.modules have a sensible __file__ attribute. Some of our java package can have the __file__ attribute set to None. Change 2: In jython we have the jython license file in <root> and the CPython license file in <root>/Lib. By reversing the search sequence jython will find and show the jython license file before the CPython file. Closes SF patch #405853. Index: site.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/site.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -r1.25 -r1.26 *** site.py 2001/03/02 06:43:49 1.25 --- site.py 2001/03/23 17:53:49 1.26 *************** *** 15,19 **** appends lib/python<version>/site-packages as well as lib/site-python. On other platforms (mainly Mac and Windows), it uses just sys.prefix ! (and sys.exec_prefix, if different, but this is unlikely). The resulting directories, if they exist, are appended to sys.path, and also inspected for path configuration files. --- 15,19 ---- appends lib/python<version>/site-packages as well as lib/site-python. On other platforms (mainly Mac and Windows), it uses just sys.prefix ! \(and sys.exec_prefix, if different, but this is unlikely). The resulting directories, if they exist, are appended to sys.path, and also inspected for path configuration files. *************** *** 72,76 **** L = sys.modules.values() for m in L: ! if hasattr(m, "__file__"): m.__file__ = makepath(m.__file__) del m, L --- 72,76 ---- L = sys.modules.values() for m in L: ! if hasattr(m, "__file__") and m.__file__: m.__file__ = makepath(m.__file__) del m, L *************** *** 234,238 **** "license", "See http://www.pythonlabs.com/products/python2.0/license.html", ["LICENSE.txt", "LICENSE"], ! [here, os.path.join(here, os.pardir), os.curdir]) --- 234,238 ---- "license", "See http://www.pythonlabs.com/products/python2.0/license.html", ["LICENSE.txt", "LICENSE"], ! [os.path.join(here, os.pardir), here, os.curdir]) From gvanrossum@users.sourceforge.net Fri Mar 23 17:54:45 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 23 Mar 2001 09:54:45 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python pythonrun.c,2.131,2.132 Message-ID: <E14gVlt-0002NW-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv9126 Modified Files: pythonrun.c Log Message: Finishing touch to Ping's changes. This is a patch that Ping sent me but apparently he had to go to school, so I am checking it in for him. This makes PyRun_HandleSystemExit() a static instead, called handle_system_exit(), and let it use the current exception rather than passing in an exception. This slightly simplifies the code. Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.131 retrieving revision 2.132 diff -C2 -r2.131 -r2.132 *** pythonrun.c 2001/03/23 17:34:02 2.131 --- pythonrun.c 2001/03/23 17:54:43 2.132 *************** *** 799,805 **** } ! void ! PyRun_HandleSystemExit(PyObject* value) { if (Py_FlushLine()) PyErr_Clear(); --- 799,807 ---- } ! static void ! handle_system_exit(void) { + PyObject *exception, *value, *tb; + PyErr_Fetch(&exception, &value, &tb); if (Py_FlushLine()) PyErr_Clear(); *************** *** 832,844 **** { PyObject *exception, *v, *tb, *hook; PyErr_Fetch(&exception, &v, &tb); PyErr_NormalizeException(&exception, &v, &tb); - if (exception == NULL) return; - - if (PyErr_GivenExceptionMatches(exception, PyExc_SystemExit)) { - PyRun_HandleSystemExit(v); - } if (set_sys_last_vars) { PySys_SetObject("last_type", exception); --- 834,845 ---- { PyObject *exception, *v, *tb, *hook; + + if (PyErr_ExceptionMatches(PyExc_SystemExit)) { + handle_system_exit(); + } PyErr_Fetch(&exception, &v, &tb); PyErr_NormalizeException(&exception, &v, &tb); if (exception == NULL) return; if (set_sys_last_vars) { PySys_SetObject("last_type", exception); *************** *** 853,862 **** if (result == NULL) { PyObject *exception2, *v2, *tb2; PyErr_Fetch(&exception2, &v2, &tb2); PyErr_NormalizeException(&exception2, &v2, &tb2); - if (PyErr_GivenExceptionMatches( - exception2, PyExc_SystemExit)) { - PyRun_HandleSystemExit(v2); - } if (Py_FlushLine()) PyErr_Clear(); --- 854,862 ---- if (result == NULL) { PyObject *exception2, *v2, *tb2; + if (PyErr_ExceptionMatches(PyExc_SystemExit)) { + handle_system_exit(); + } PyErr_Fetch(&exception2, &v2, &tb2); PyErr_NormalizeException(&exception2, &v2, &tb2); if (Py_FlushLine()) PyErr_Clear(); From bwarsaw@users.sourceforge.net Fri Mar 23 18:04:05 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Fri, 23 Mar 2001 10:04:05 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_support.py,1.20,1.21 Message-ID: <E14gVuv-0002y6-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv11387 Modified Files: test_support.py Log Message: In Jython, `@' is not allowed in module names. Extend the TESTFN test to use "$test" when in Jython. Closes SF patch #403668. Index: test_support.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_support.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -r1.20 -r1.21 *** test_support.py 2001/03/23 04:21:17 1.20 --- test_support.py 2001/03/23 18:04:02 1.21 *************** *** 58,65 **** import os ! if os.name !='riscos': ! TESTFN = '@test' # Filename used for testing else: ! TESTFN = 'test' # Filename used for testing del os --- 58,69 ---- import os ! # Filename used for testing ! if os.name == 'java': ! # Jython disallows @ in module names ! TESTFN = '$test' ! elif os.name != 'riscos': ! TESTFN = '@test' else: ! TESTFN = 'test' del os From gvanrossum@users.sourceforge.net Fri Mar 23 18:30:21 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 23 Mar 2001 10:30:21 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules xreadlinesmodule.c,1.4,1.5 Message-ID: <E14gWKL-0004I5-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv16486 Modified Files: xreadlinesmodule.c Log Message: Fix a memory leak -- there's no need to INCREF() the result of newreadlinesobject() in xreadlines(). Index: xreadlinesmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/xreadlinesmodule.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** xreadlinesmodule.c 2001/01/19 00:29:06 1.4 --- xreadlinesmodule.c 2001/03/23 18:30:19 1.5 *************** *** 51,55 **** return NULL; ret = newreadlinesobject(file); - Py_XINCREF(ret); return (PyObject*)ret; } --- 51,54 ---- From tim_one@users.sourceforge.net Fri Mar 23 20:21:31 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Fri, 23 Mar 2001 12:21:31 -0800 Subject: [Python-checkins] CVS: python/dist/src/PCbuild python20.wse,1.35,1.36 Message-ID: <E14gY3v-00018G-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/PCbuild In directory usw-pr-cvs1:/tmp/cvs-serv4178/python/dist/src/PCbuild Modified Files: python20.wse Log Message: pydoc changed overnight in such a way that it no longer worked from the Windows start-menu item. This recovers from that. Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -r1.35 -r1.36 *** python20.wse 2001/03/23 03:43:35 1.35 --- python20.wse 2001/03/23 20:21:29 1.36 *************** *** 958,963 **** end item: Install File ! Source=%_SRC_%\Tools\scripts\pydoc ! Destination=%MAINDIR%\pydoc.pyw Description=Utility Scripts Flags=0000000000000010 --- 958,963 ---- end item: Install File ! Source=%_SRC_%\Tools\scripts\*.pyw ! Destination=%MAINDIR%\Tools\Scripts Description=Utility Scripts Flags=0000000000000010 *************** *** 1367,1371 **** Source=%MAINDIR%\pythonw.exe Destination=%GROUP%\Module Docs.lnk ! Command Options=%MAINDIR%\pydoc.pyw Working Directory=%MAINDIR% Key Type=1536 --- 1367,1371 ---- Source=%MAINDIR%\pythonw.exe Destination=%GROUP%\Module Docs.lnk ! Command Options=%MAINDIR%\Tools\Scripts\pydoc.pyw Working Directory=%MAINDIR% Key Type=1536 From bwarsaw@users.sourceforge.net Fri Mar 23 20:24:09 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Fri, 23 Mar 2001 12:24:09 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_strftime.py,1.24,1.25 Message-ID: <E14gY6T-0001Hw-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv4941 Modified Files: test_strftime.py Log Message: main(): Application of SF patch #405851, which allows this test to be used by Jython. The tests in this module expect C locale, so be explicit about setting that (for CPython). However, in Jython, there is no C locale, so instead be explicit about setting the US locale. Closes the patch. Index: test_strftime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strftime.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -r1.24 -r1.25 *** test_strftime.py 2001/02/09 11:59:37 1.24 --- test_strftime.py 2001/03/23 20:24:07 1.25 *************** *** 8,11 **** --- 8,23 ---- def main(): global verbose + # For C Python, these tests expect C locale, so we try to set that + # explicitly. For Jython, Finn says we need to be in the US locale; my + # understanding is that this is the closest Java gets to C's "C" locale. + # Jython ought to supply an _locale module which Does The Right Thing, but + # this is the best we can do given today's state of affairs. + try: + import java + java.util.Locale.setDefault(java.util.Locale.US) + except ImportError: + # Can't do this first because it will succeed, even in Jython + import locale + locale.setlocale(locale.LC_TIME, 'C') now = time.time() strftest(now) From gvanrossum@users.sourceforge.net Sat Mar 24 19:17:38 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sat, 24 Mar 2001 11:17:38 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libcmd.tex,1.6,1.7 Message-ID: <E14gtXe-0001bh-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv6166 Modified Files: libcmd.tex Log Message: Document use_rawinput. (Although now that I think more about it, a better solution would have been to factor out the raw_input() call and make it into an overridable method. Oh well, maybe later...) Index: libcmd.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcmd.tex,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** libcmd.tex 2000/10/10 17:03:45 1.6 --- libcmd.tex 2001/03/24 19:17:35 1.7 *************** *** 139,141 **** \end{memberdesc} ! --- 139,146 ---- \end{memberdesc} ! \begin{memberdesc}{use_rawinput} ! A flag, defaulting to true. If true, \method{cmdloop()} uses ! \function{raw_input()} to display a prompt and read the next command; ! if false, \function{sys.stdout.write()} and ! \function{sys.stdin.readline()} are used. ! \end{memberdesc} From fdrake@users.sourceforge.net Sat Mar 24 19:58:28 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Sat, 24 Mar 2001 11:58:28 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules pyexpat.c,2.44,2.45 Message-ID: <E14guBA-00032w-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv11703 Modified Files: pyexpat.c Log Message: get_version_string(): New function -- returns a Python string object that gives the CVS revision of this file even if it does not include the extra RCS "$Revision: " cruft. initpyexpat(): Use get_version_string() instead of hard-coding magic indexes into the RCS string (which may be affected by export options). Index: pyexpat.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/pyexpat.c,v retrieving revision 2.44 retrieving revision 2.45 diff -C2 -r2.44 -r2.45 *** pyexpat.c 2001/03/13 01:58:22 2.44 --- pyexpat.c 2001/03/24 19:58:26 2.45 *************** *** 1,2 **** --- 1,4 ---- + #include <ctype.h> + #include "Python.h" #include "compile.h" *************** *** 1464,1472 **** #endif DL_EXPORT(void) initpyexpat(void) { PyObject *m, *d; - char *rev = "$Revision$"; PyObject *errmod_name = PyString_FromString("pyexpat.errors"); PyObject *errors_module; --- 1466,1494 ---- #endif + + /* Return a Python string that represents the version number without the + * extra cruft added by revision control, even if the right options were + * given to the "cvs export" command to make it not include the extra + * cruft. + */ + static PyObject * + get_version_string(void) + { + static char *rcsid = "$Revision$"; + char *rev = rcsid; + int i = 0; + + while (!isdigit(*rev)) + ++rev; + while (rev[i] != ' ' && rev[i] != '\0') + ++i; + + return PyString_FromStringAndSize(rev, i); + } + DL_EXPORT(void) initpyexpat(void) { PyObject *m, *d; PyObject *errmod_name = PyString_FromString("pyexpat.errors"); PyObject *errors_module; *************** *** 1501,1506 **** PyModule_AddObject(m, "XMLParserType", (PyObject *) &Xmlparsetype); ! PyModule_AddObject(m, "__version__", ! PyString_FromStringAndSize(rev+11, strlen(rev+11)-2)); #if EXPAT_VERSION >= 0x015f02 PyModule_AddStringConstant(m, "EXPAT_VERSION", --- 1523,1527 ---- PyModule_AddObject(m, "XMLParserType", (PyObject *) &Xmlparsetype); ! PyModule_AddObject(m, "__version__", get_version_string()); #if EXPAT_VERSION >= 0x015f02 PyModule_AddStringConstant(m, "EXPAT_VERSION", From tim_one@users.sourceforge.net Sun Mar 25 05:54:10 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sat, 24 Mar 2001 21:54:10 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0236.txt,1.5,1.6 Message-ID: <E14h3Te-0007if-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv29640 Modified Files: pep-0236.txt Log Message: Update resolved, unresolved and partially resolved issues to reflect Jeremy's 2.1b2 work. Index: pep-0236.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0236.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** pep-0236.txt 2001/03/02 03:11:53 1.5 --- pep-0236.txt 2001/03/25 05:54:08 1.6 *************** *** 215,219 **** ! Unresolved Problems: Runtime Compilation Several Python features can compile code during a module's runtime: --- 215,219 ---- ! Paritally Resolved Problem: Runtime Compilation Several Python features can compile code during a module's runtime: *************** *** 229,243 **** with respect to F, any code compiled dynamically from text passed to one of these from within M should probably also use the new syntax or ! semantics associated with F. This isn't always desired, though. For example, doctest.testmod(M) compiles examples taken from strings in M, and those examples should ! use M's choices, not necessarily doctest module's choices. - It's unclear what to do about this. The initial release (2.1b1) is - likely to ignore these issues, saying that each dynamic compilation - starts over from scratch (i.e., as if no future_statements had been - specified). - In any case, a future_statement appearing "near the top" (see Syntax above) of text compiled dynamically by an exec, execfile() or compile() --- 229,240 ---- with respect to F, any code compiled dynamically from text passed to one of these from within M should probably also use the new syntax or ! semantics associated with F. The 2.1 release does behave this way. This isn't always desired, though. For example, doctest.testmod(M) compiles examples taken from strings in M, and those examples should ! use M's choices, not necessarily the doctest module's choices. In the ! 2.1 release, this isn't possible, and no scheme has yet been suggested ! for working around this. In any case, a future_statement appearing "near the top" (see Syntax above) of text compiled dynamically by an exec, execfile() or compile() *************** *** 247,264 **** allow expression input, and a future_statement is not an expression. ! Unresolved Problems: Interactive Shells An interactive shell can be seen as an extreme case of runtime compilation (see above): in effect, each statement typed at an interactive shell prompt runs a new instance of exec, compile() or ! execfile(). The initial release (2.1b1) is likely to be such that ! future_statements typed at an interactive shell have no effect beyond ! their runtime meaning as ordinary import statements. ! ! It would make more sense if a future_statement typed at an interactive ! shell applied to the rest of the shell session's life, as if the ! future_statement had appeared at the top of a module. Again, it's ! unclear what to do about this. --- 244,272 ---- allow expression input, and a future_statement is not an expression. + + Resolved Problem: Native Interactive Shells + + There are two ways to get an interactive shell: ! 1. By invoking Python from a command line without a script argument. + 2. By invoking Python from a command line with the -i switch and with a + script argument. + An interactive shell can be seen as an extreme case of runtime compilation (see above): in effect, each statement typed at an interactive shell prompt runs a new instance of exec, compile() or ! execfile(). A future_statement typed at an interactive shell applies to ! the rest of the shell session's life, as if the future_statement had ! appeared at the top of a module. ! ! ! Unresolved Problem: Simulated Interactive Shells ! ! Interactive shells "built by hand" (by tools such as IDLE and the Emacs ! Python-mode) should behave like native interactive shells (see above). ! However, the machinery used internally by native interactive shells has ! not been exposed, and there isn't a clear way for tools building their ! own interactive shells to achieve the desired behavior. From lemburg@users.sourceforge.net Sun Mar 25 19:16:16 2001 From: lemburg@users.sourceforge.net (M.-A. Lemburg) Date: Sun, 25 Mar 2001 11:16:16 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects object.c,2.123,2.124 Message-ID: <E14hFzs-0002qM-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv10721 Modified Files: object.c Log Message: Fixed ref count bug. Patch #411191. Found by Walter Dörwald. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.123 retrieving revision 2.124 diff -C2 -r2.123 -r2.124 *** object.c 2001/02/27 04:45:05 2.123 --- object.c 2001/03/25 19:16:13 2.124 *************** *** 347,352 **** return v; } ! else if (PyString_Check(v)) res = v; else if (v->ob_type->tp_str != NULL) res = (*v->ob_type->tp_str)(v); --- 347,354 ---- return v; } ! else if (PyString_Check(v)) { ! Py_INCREF(v); res = v; + } else if (v->ob_type->tp_str != NULL) res = (*v->ob_type->tp_str)(v); From fdrake@users.sourceforge.net Mon Mar 26 15:06:17 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 26 Mar 2001 07:06:17 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib webbrowser.py,1.15,1.16 Message-ID: <E14hYZV-0000mh-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv3001 Modified Files: webbrowser.py Log Message: Update auto-detection for Konqueror to include KDE 2 -- the kfm command is gone; "konqueror" is the new name, and the command-line args are different. kfmclient has not changed, though. Index: webbrowser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/webbrowser.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -r1.15 -r1.16 *** webbrowser.py 2001/03/02 02:01:40 1.15 --- webbrowser.py 2001/03/26 15:06:15 1.16 *************** *** 137,141 **** # Konqueror/kfm, the KDE browser. ! if _iscommand("kfm"): class Konqueror: """Controller for the KDE File Manager (kfm, or Konqueror). --- 137,141 ---- # Konqueror/kfm, the KDE browser. ! if _iscommand("kfm") or _iscommand("konqueror"): class Konqueror: """Controller for the KDE File Manager (kfm, or Konqueror). *************** *** 150,154 **** if rc: import time ! os.system("kfm -d &") time.sleep(PROCESS_CREATION_DELAY) rc = os.system(cmd) --- 150,157 ---- if rc: import time ! if _iscommand("konqueror"): ! os.system("konqueror --silent &") ! else: ! os.system("kfm -d &") time.sleep(PROCESS_CREATION_DELAY) rc = os.system(cmd) From fdrake@users.sourceforge.net Mon Mar 26 15:49:26 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 26 Mar 2001 07:49:26 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib zipfile.py,1.8,1.9 Message-ID: <E14hZFG-0002gm-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv10309 Modified Files: zipfile.py Log Message: Itamar Shtull-Trauring <itamar@maxnm.com>: Add support to zipfile to support opening an archive represented by an open file rather than a file name. Index: zipfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/zipfile.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** zipfile.py 2001/03/01 04:27:19 1.8 --- zipfile.py 2001/03/26 15:49:24 1.9 *************** *** 66,70 **** --- 66,73 ---- _FH_EXTRA_FIELD_LENGTH = 11 + # Used to compare file passed to ZipFile + _STRING_TYPES = (type('s'), type(u's')) + def is_zipfile(filename): """Quickly see if file is a ZIP file by checking the magic number. *************** *** 129,137 **** class ZipFile: ! """Class with methods to open, read, write, close, list zip files.""" fp = None # Set here since __del__ checks it ! def __init__(self, filename, mode="r", compression=ZIP_STORED): """Open the ZIP file with mode read "r", write "w" or append "a".""" if compression == ZIP_STORED: --- 132,148 ---- class ZipFile: ! """ Class with methods to open, read, write, close, list zip files. ! ! z = ZipFile(file, mode="r", compression=ZIP_STORED) ! ! file: Either the path to the file, or a file-like object. ! If it is a path, the file will be opened and closed by ZipFile. ! mode: The mode can be either read "r", write "w" or append "a". ! compression: ZIP_STORED (no compression) or ZIP_DEFLATED (requires zlib). ! """ fp = None # Set here since __del__ checks it ! def __init__(self, file, mode="r", compression=ZIP_STORED): """Open the ZIP file with mode read "r", write "w" or append "a".""" if compression == ZIP_STORED: *************** *** 147,159 **** self.filelist = [] # List of ZipInfo instances for archive self.compression = compression # Method of compression - self.filename = filename self.mode = key = mode[0] if key == 'r': - self.fp = open(filename, "rb") self._GetContents() elif key == 'w': ! self.fp = open(filename, "wb") elif key == 'a': ! fp = self.fp = open(filename, "r+b") fp.seek(-22, 2) # Seek to end-of-file record endrec = fp.read() --- 158,180 ---- self.filelist = [] # List of ZipInfo instances for archive self.compression = compression # Method of compression self.mode = key = mode[0] + + # Check if we were passed a file-like object + if type(file) in _STRING_TYPES: + self._filePassed = 0 + self.filename = file + modeDict = {'r' : 'rb', 'w': 'wb', 'a' : 'r+b'} + self.fp = open(file, modeDict[mode]) + else: + self._filePassed = 1 + self.fp = file + self.filename = getattr(file, 'name', None) + if key == 'r': self._GetContents() elif key == 'w': ! pass elif key == 'a': ! fp = self.fp fp.seek(-22, 2) # Seek to end-of-file record endrec = fp.read() *************** *** 402,406 **** def __del__(self): """Call the "close()" method in case the user forgot.""" ! if self.fp: self.fp.close() self.fp = None --- 423,427 ---- def __del__(self): """Call the "close()" method in case the user forgot.""" ! if self.fp and not self._filePassed: self.fp.close() self.fp = None *************** *** 434,438 **** 0, 0, count, count, pos2 - pos1, pos1, 0) self.fp.write(endrec) ! self.fp.close() self.fp = None --- 455,461 ---- 0, 0, count, count, pos2 - pos1, pos1, 0) self.fp.write(endrec) ! self.fp.flush() ! if not self._filePassed: ! self.fp.close() self.fp = None From fdrake@users.sourceforge.net Mon Mar 26 15:49:26 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 26 Mar 2001 07:49:26 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_zipfile.py,1.3,1.4 Message-ID: <E14hZFG-0002gs-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv10309/test Modified Files: test_zipfile.py Log Message: Itamar Shtull-Trauring <itamar@maxnm.com>: Add support to zipfile to support opening an archive represented by an open file rather than a file name. Index: test_zipfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_zipfile.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** test_zipfile.py 2001/02/28 05:34:16 1.3 --- test_zipfile.py 2001/03/26 15:49:24 1.4 *************** *** 1,3 **** ! import zipfile, os from test_support import TestFailed --- 1,3 ---- ! import zipfile, os, StringIO, tempfile from test_support import TestFailed *************** *** 5,23 **** zipname = "junk9708.tmp" try: ! fp = open(srcname, "w") # Make a source file with some lines for i in range(0, 1000): fp.write("Test of zipfile line %d.\n" % i) fp.close() ! zip = zipfile.ZipFile(zipname, "w") # Create the ZIP archive ! zip.write(srcname, srcname) ! zip.write(srcname, "another.name") ! zip.close() - zip = zipfile.ZipFile(zipname, "r") # Read the ZIP archive - zip.read("another.name") - zip.read(srcname) - zip.close() finally: if os.path.isfile(srcname): # Remove temporary files --- 5,40 ---- zipname = "junk9708.tmp" + + def zipTest(f, compression, srccontents): + zip = zipfile.ZipFile(f, "w", compression) # Create the ZIP archive + zip.write(srcname, "another.name") + zip.write(srcname, srcname) + zip.close() + + zip = zipfile.ZipFile(f, "r", compression) # Read the ZIP archive + readData2 = zip.read(srcname) + readData1 = zip.read("another.name") + zip.close() + + if readData1 != srccontents or readData2 != srccontents: + raise TestFailed, "Written data doesn't equal read data." + + try: ! fp = open(srcname, "wb") # Make a source file with some lines for i in range(0, 1000): fp.write("Test of zipfile line %d.\n" % i) fp.close() + + fp = open(srcname, "rb") + writtenData = fp.read() + fp.close() + + for file in (zipname, tempfile.TemporaryFile(), StringIO.StringIO()): + zipTest(file, zipfile.ZIP_STORED, writtenData) ! for file in (zipname, tempfile.TemporaryFile(), StringIO.StringIO()): ! zipTest(file, zipfile.ZIP_DEFLATED, writtenData) finally: if os.path.isfile(srcname): # Remove temporary files From fdrake@users.sourceforge.net Mon Mar 26 16:17:23 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 26 Mar 2001 08:17:23 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libwebbrowser.tex,1.8,1.9 Message-ID: <E14hZgJ-00046q-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv15787/lib Modified Files: libwebbrowser.tex Log Message: Add a note that the "kfm" controller supports "konqueror" as well as the old KDE 1 "kfm" command. Index: libwebbrowser.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libwebbrowser.tex,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** libwebbrowser.tex 2001/01/25 00:38:15 1.8 --- libwebbrowser.tex 2001/03/26 16:17:21 1.9 *************** *** 98,102 **** UNIX, and only makes sense to use if KDE is running. Some way of reliably detecting KDE would be nice; the \envvar{KDEDIR} variable is ! not sufficient. \item[(2)] --- 98,104 ---- UNIX, and only makes sense to use if KDE is running. Some way of reliably detecting KDE would be nice; the \envvar{KDEDIR} variable is ! not sufficient. Note also that the name ``kfm'' is used even when ! using the \program{konqueror} command with KDE 2 --- the ! implementation selects the best strategy for running Konqueror. \item[(2)] From fdrake@users.sourceforge.net Mon Mar 26 17:14:04 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 26 Mar 2001 09:14:04 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules termios.c,2.19,2.20 Message-ID: <E14haZA-0006Tt-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv24903 Modified Files: termios.c Log Message: Michael Hudson <mwh21@cam.ac.uk>: Add many more constants for some systems. This closes SF patch #410267. Index: termios.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/termios.c,v retrieving revision 2.19 retrieving revision 2.20 diff -C2 -r2.19 -r2.20 *** termios.c 2001/03/03 18:08:52 2.19 --- termios.c 2001/03/26 17:14:02 2.20 *************** *** 528,531 **** --- 528,860 ---- {"VEOL2", VEOL2}, + + #ifdef B460800 + {"B460800", B460800}, + #endif + #ifdef CBAUD + {"CBAUD", CBAUD}, + #endif + #ifdef CDEL + {"CDEL", CDEL}, + #endif + #ifdef CDSUSP + {"CDSUSP", CDSUSP}, + #endif + #ifdef CEOF + {"CEOF", CEOF}, + #endif + #ifdef CEOL + {"CEOL", CEOL}, + #endif + #ifdef CEOL2 + {"CEOL2", CEOL2}, + #endif + #ifdef CEOT + {"CEOT", CEOT}, + #endif + #ifdef CERASE + {"CERASE", CERASE}, + #endif + #ifdef CESC + {"CESC", CESC}, + #endif + #ifdef CFLUSH + {"CFLUSH", CFLUSH}, + #endif + #ifdef CINTR + {"CINTR", CINTR}, + #endif + #ifdef CKILL + {"CKILL", CKILL}, + #endif + #ifdef CLNEXT + {"CLNEXT", CLNEXT}, + #endif + #ifdef CNUL + {"CNUL", CNUL}, + #endif + #ifdef COMMON + {"COMMON", COMMON}, + #endif + #ifdef CQUIT + {"CQUIT", CQUIT}, + #endif + #ifdef CRPRNT + {"CRPRNT", CRPRNT}, + #endif + #ifdef CSTART + {"CSTART", CSTART}, + #endif + #ifdef CSTOP + {"CSTOP", CSTOP}, + #endif + #ifdef CSUSP + {"CSUSP", CSUSP}, + #endif + #ifdef CSWTCH + {"CSWTCH", CSWTCH}, + #endif + #ifdef CWERASE + {"CWERASE", CWERASE}, + #endif + #ifdef EXTA + {"EXTA", EXTA}, + #endif + #ifdef EXTB + {"EXTB", EXTB}, + #endif + #ifdef FIOASYNC + {"FIOASYNC", FIOASYNC}, + #endif + #ifdef FIOCLEX + {"FIOCLEX", FIOCLEX}, + #endif + #ifdef FIONBIO + {"FIONBIO", FIONBIO}, + #endif + #ifdef FIONCLEX + {"FIONCLEX", FIONCLEX}, + #endif + #ifdef FIONREAD + {"FIONREAD", FIONREAD}, + #endif + #ifdef IBSHIFT + {"IBSHIFT", IBSHIFT}, + #endif + #ifdef INIT_C_CC + {"INIT_C_CC", INIT_C_CC}, + #endif + #ifdef IOCSIZE_MASK + {"IOCSIZE_MASK", IOCSIZE_MASK}, + #endif + #ifdef IOCSIZE_SHIFT + {"IOCSIZE_SHIFT", IOCSIZE_SHIFT}, + #endif + #ifdef NCC + {"NCC", NCC}, + #endif + #ifdef NCCS + {"NCCS", NCCS}, + #endif + #ifdef NSWTCH + {"NSWTCH", NSWTCH}, + #endif + #ifdef N_MOUSE + {"N_MOUSE", N_MOUSE}, + #endif + #ifdef N_PPP + {"N_PPP", N_PPP}, + #endif + #ifdef N_SLIP + {"N_SLIP", N_SLIP}, + #endif + #ifdef N_STRIP + {"N_STRIP", N_STRIP}, + #endif + #ifdef N_TTY + {"N_TTY", N_TTY}, + #endif + #ifdef TCFLSH + {"TCFLSH", TCFLSH}, + #endif + #ifdef TCGETA + {"TCGETA", TCGETA}, + #endif + #ifdef TCGETS + {"TCGETS", TCGETS}, + #endif + #ifdef TCSBRK + {"TCSBRK", TCSBRK}, + #endif + #ifdef TCSBRKP + {"TCSBRKP", TCSBRKP}, + #endif + #ifdef TCSETA + {"TCSETA", TCSETA}, + #endif + #ifdef TCSETAF + {"TCSETAF", TCSETAF}, + #endif + #ifdef TCSETAW + {"TCSETAW", TCSETAW}, + #endif + #ifdef TCSETS + {"TCSETS", TCSETS}, + #endif + #ifdef TCSETSF + {"TCSETSF", TCSETSF}, + #endif + #ifdef TCSETSW + {"TCSETSW", TCSETSW}, + #endif + #ifdef TCXONC + {"TCXONC", TCXONC}, + #endif + #ifdef TIOCCONS + {"TIOCCONS", TIOCCONS}, + #endif + #ifdef TIOCEXCL + {"TIOCEXCL", TIOCEXCL}, + #endif + #ifdef TIOCGETD + {"TIOCGETD", TIOCGETD}, + #endif + #ifdef TIOCGICOUNT + {"TIOCGICOUNT", TIOCGICOUNT}, + #endif + #ifdef TIOCGLCKTRMIOS + {"TIOCGLCKTRMIOS", TIOCGLCKTRMIOS}, + #endif + #ifdef TIOCGPGRP + {"TIOCGPGRP", TIOCGPGRP}, + #endif + #ifdef TIOCGSERIAL + {"TIOCGSERIAL", TIOCGSERIAL}, + #endif + #ifdef TIOCGSOFTCAR + {"TIOCGSOFTCAR", TIOCGSOFTCAR}, + #endif + #ifdef TIOCGWINSZ + {"TIOCGWINSZ", TIOCGWINSZ}, + #endif + #ifdef TIOCINQ + {"TIOCINQ", TIOCINQ}, + #endif + #ifdef TIOCLINUX + {"TIOCLINUX", TIOCLINUX}, + #endif + #ifdef TIOCMBIC + {"TIOCMBIC", TIOCMBIC}, + #endif + #ifdef TIOCMBIS + {"TIOCMBIS", TIOCMBIS}, + #endif + #ifdef TIOCMGET + {"TIOCMGET", TIOCMGET}, + #endif + #ifdef TIOCMIWAIT + {"TIOCMIWAIT", TIOCMIWAIT}, + #endif + #ifdef TIOCMSET + {"TIOCMSET", TIOCMSET}, + #endif + #ifdef TIOCM_CAR + {"TIOCM_CAR", TIOCM_CAR}, + #endif + #ifdef TIOCM_CD + {"TIOCM_CD", TIOCM_CD}, + #endif + #ifdef TIOCM_CTS + {"TIOCM_CTS", TIOCM_CTS}, + #endif + #ifdef TIOCM_DSR + {"TIOCM_DSR", TIOCM_DSR}, + #endif + #ifdef TIOCM_DTR + {"TIOCM_DTR", TIOCM_DTR}, + #endif + #ifdef TIOCM_LE + {"TIOCM_LE", TIOCM_LE}, + #endif + #ifdef TIOCM_RI + {"TIOCM_RI", TIOCM_RI}, + #endif + #ifdef TIOCM_RNG + {"TIOCM_RNG", TIOCM_RNG}, + #endif + #ifdef TIOCM_RTS + {"TIOCM_RTS", TIOCM_RTS}, + #endif + #ifdef TIOCM_SR + {"TIOCM_SR", TIOCM_SR}, + #endif + #ifdef TIOCM_ST + {"TIOCM_ST", TIOCM_ST}, + #endif + #ifdef TIOCNOTTY + {"TIOCNOTTY", TIOCNOTTY}, + #endif + #ifdef TIOCNXCL + {"TIOCNXCL", TIOCNXCL}, + #endif + #ifdef TIOCOUTQ + {"TIOCOUTQ", TIOCOUTQ}, + #endif + #ifdef TIOCPKT + {"TIOCPKT", TIOCPKT}, + #endif + #ifdef TIOCPKT_DATA + {"TIOCPKT_DATA", TIOCPKT_DATA}, + #endif + #ifdef TIOCPKT_DOSTOP + {"TIOCPKT_DOSTOP", TIOCPKT_DOSTOP}, + #endif + #ifdef TIOCPKT_FLUSHREAD + {"TIOCPKT_FLUSHREAD", TIOCPKT_FLUSHREAD}, + #endif + #ifdef TIOCPKT_FLUSHWRITE + {"TIOCPKT_FLUSHWRITE", TIOCPKT_FLUSHWRITE}, + #endif + #ifdef TIOCPKT_NOSTOP + {"TIOCPKT_NOSTOP", TIOCPKT_NOSTOP}, + #endif + #ifdef TIOCPKT_START + {"TIOCPKT_START", TIOCPKT_START}, + #endif + #ifdef TIOCPKT_STOP + {"TIOCPKT_STOP", TIOCPKT_STOP}, + #endif + #ifdef TIOCSCTTY + {"TIOCSCTTY", TIOCSCTTY}, + #endif + #ifdef TIOCSERCONFIG + {"TIOCSERCONFIG", TIOCSERCONFIG}, + #endif + #ifdef TIOCSERGETLSR + {"TIOCSERGETLSR", TIOCSERGETLSR}, + #endif + #ifdef TIOCSERGETMULTI + {"TIOCSERGETMULTI", TIOCSERGETMULTI}, + #endif + #ifdef TIOCSERGSTRUCT + {"TIOCSERGSTRUCT", TIOCSERGSTRUCT}, + #endif + #ifdef TIOCSERGWILD + {"TIOCSERGWILD", TIOCSERGWILD}, + #endif + #ifdef TIOCSERSETMULTI + {"TIOCSERSETMULTI", TIOCSERSETMULTI}, + #endif + #ifdef TIOCSERSWILD + {"TIOCSERSWILD", TIOCSERSWILD}, + #endif + #ifdef TIOCSER_TEMT + {"TIOCSER_TEMT", TIOCSER_TEMT}, + #endif + #ifdef TIOCSETD + {"TIOCSETD", TIOCSETD}, + #endif + #ifdef TIOCSLCKTRMIOS + {"TIOCSLCKTRMIOS", TIOCSLCKTRMIOS}, + #endif + #ifdef TIOCSPGRP + {"TIOCSPGRP", TIOCSPGRP}, + #endif + #ifdef TIOCSSERIAL + {"TIOCSSERIAL", TIOCSSERIAL}, + #endif + #ifdef TIOCSSOFTCAR + {"TIOCSSOFTCAR", TIOCSSOFTCAR}, + #endif + #ifdef TIOCSTI + {"TIOCSTI", TIOCSTI}, + #endif + #ifdef TIOCSWINSZ + {"TIOCSWINSZ", TIOCSWINSZ}, + #endif + #ifdef TIOCTTYGSTRUCT + {"TIOCTTYGSTRUCT", TIOCTTYGSTRUCT}, + #endif + /* sentinel */ {NULL, 0} From gvanrossum@users.sourceforge.net Mon Mar 26 17:41:38 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 26 Mar 2001 09:41:38 -0800 Subject: [Python-checkins] CVS: python/dist/src/Tools/idle PyShell.py,1.31,1.32 Message-ID: <E14hazq-0007zu-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv30691 Modified Files: PyShell.py Log Message: Turn SyntasWarning into SyntaxError for all code entered interactively. Index: PyShell.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/PyShell.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -r1.31 -r1.32 *** PyShell.py 2001/01/17 08:48:39 1.31 --- PyShell.py 2001/03/26 17:41:35 1.32 *************** *** 6,9 **** --- 6,10 ---- import getopt import re + import warnings import linecache *************** *** 181,185 **** filename = self.stuffsource(source) self.more = 0 ! return InteractiveInterpreter.runsource(self, source, filename) def stuffsource(self, source): --- 182,193 ---- filename = self.stuffsource(source) self.more = 0 ! self.save_warnings_filters = warnings.filters[:] ! warnings.filterwarnings(action="error", category=SyntaxWarning) ! try: ! return InteractiveInterpreter.runsource(self, source, filename) ! finally: ! if self.save_warnings_filters is not None: ! warnings.filters[:] = self.save_warnings_filters ! self.save_warnings_filters = None def stuffsource(self, source): *************** *** 250,253 **** --- 258,264 ---- def runcode(self, code): # Override base class method + if self.save_warnings_filters is not None: + warnings.filters[:] = self.save_warnings_filters + self.save_warnings_filters = None debugger = self.debugger try: From jhylton@users.sourceforge.net Mon Mar 26 19:53:40 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Mon, 26 Mar 2001 11:53:40 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python pythonrun.c,2.132,2.133 Message-ID: <E14hd3c-0006jG-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv25664 Modified Files: pythonrun.c Log Message: Bug fix: compile() called from a nested-scopes-enable Python was not using nested scopes to compile its argument. Pass compiler flags through to underlying compile call. Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.132 retrieving revision 2.133 diff -C2 -r2.132 -r2.133 *** pythonrun.c 2001/03/23 17:54:43 2.132 --- pythonrun.c 2001/03/26 19:53:38 2.133 *************** *** 1099,1103 **** if (n == NULL) return NULL; ! co = PyNode_Compile(n, filename); PyNode_Free(n); return (PyObject *)co; --- 1099,1103 ---- if (n == NULL) return NULL; ! co = PyNode_CompileFlags(n, filename, flags); PyNode_Free(n); return (PyObject *)co; From bwarsaw@users.sourceforge.net Tue Mar 27 07:51:35 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Mon, 26 Mar 2001 23:51:35 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0243.txt,1.2,1.3 Message-ID: <E14hoGN-0004yB-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv19096 Modified Files: pep-0243.txt Log Message: Sean's revision of 24-Mar-2001 (with minor editing by Barry). Index: pep-0243.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0243.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** pep-0243.txt 2001/03/21 17:36:34 1.2 --- pep-0243.txt 2001/03/27 07:51:33 1.3 *************** *** 8,12 **** Created: 18-Mar-2001 Python-Version: 2.1 ! Post-History: 20-Mar-2001 --- 8,12 ---- Created: 18-Mar-2001 Python-Version: 2.1 ! Post-History: 20-Mar-2001, 24-Mar-2001 *************** *** 35,42 **** will be uploaded as a multi-part form encoded the same as a regular HTML file upload request. This form is posted using ! ENCTYPE="multipart/form-data" encoding. The upload will be made to the host "modules.python.org" on port ! 80/tcp. The form will consist of the following fields: distribution -- The file containing the module software (for --- 35,43 ---- will be uploaded as a multi-part form encoded the same as a regular HTML file upload request. This form is posted using ! ENCTYPE="multipart/form-data" encoding [2]. The upload will be made to the host "modules.python.org" on port ! 80/tcp (POST http://modules.python.org:80/swalowpost.cgi). The form ! will consist of the following fields: distribution -- The file containing the module software (for *************** *** 48,72 **** ord(byte))"). ! pkginfo -- The file containing the distribution meta-data (as ! specified in PEP-241 [1]). - infomd5sum -- The MD5 hash of the uploaded meta-data, encoded - in ASCII representing the hexadecimal representation of the - digest ("for byte in digest: s = s + ('%02x' % ord(byte))"). - platform (optional) -- A string representing the target platform for this distribution. This is only for binary distributions. It is encoded as ! "<os_name>-<os_version>-<platform architecture>". ! signature (optional) -- A GPG signature of the uploaded ! distribution as signed by the author. This may be used by the ! cataloging system to automate acceptance of uploads. Return Data ! The upload will report the status of the upload by sending the ! string "Upload status:" followed by one of the following: SUCCESS -- Indicates that the upload has succeeded. --- 49,84 ---- ord(byte))"). ! pkginfo (optional) -- The file containing the distribution ! meta-data (as specified in PEP-241 [1]). Note that if this is ! not included, the distribution file is expected to be in .tar ! format (gzipped and bzipped compreesed are allowed) or .zip ! format, with a "PKG-INFO" file in the top-level directory it ! extracts ("package-1.00/PKG-INFO"). ! ! infomd5sum (required if pkginfo field is present) -- The MD5 hash ! of the uploaded meta-data, encoded in ASCII representing the ! hexadecimal representation of the digest ("for byte in digest: ! s = s + ('%02x' % ord(byte))"). platform (optional) -- A string representing the target platform for this distribution. This is only for binary distributions. It is encoded as ! "<os_name>-<os_version>-<platform architecture>-<python ! version>". ! ! signature (optional) -- A OpenPGP-compatible signature [3] of ! the uploaded distribution as signed by the author. This may ! be used by the cataloging system to automate acceptance of ! uploads. ! protocol_version -- A string indicating the protocol version that ! the client supports. This document describes protocol version "1". Return Data ! The status of the upload will be reported using HTTP non-standard ! ("X-*)" headers. The "X-Swalow-Status" header may have the following ! values: SUCCESS -- Indicates that the upload has succeeded. *************** *** 79,89 **** Potential causes of this are resource shortages on the server, administrative down-time, etc... - - Following the above string may be a human-readable string - providing further information. This message continues to the end - of the returned data-stream. ! Returned data which does not fit the above format should be ! treated as a temporary failure. --- 91,109 ---- Potential causes of this are resource shortages on the server, administrative down-time, etc... ! Optionally, there may be a "X-Swalow-Reason" header which includes a ! human-readable string which provides more detailed information about ! the "X-Swalow-Status". ! ! If there is no "X-Swalow-Status" header, or it does not contain one of ! the three strings above, it should be treated as a temporary failure. ! ! Example: ! ! >>> f = urllib.urlopen('http://modules.python.org:80/swalowpost.cgi') ! >>> s = f.headers['x-swalow-status'] ! >>> s = s + ': ' + f.headers.get('x-swalow-reason', '<None>') ! >>> print s ! FAILURE: Required field "distribution" missing. *************** *** 103,106 **** --- 123,127 ---- <INPUT TYPE="text" NAME="platform"><BR> <INPUT TYPE="text" NAME="signature"><BR> + <INPUT TYPE="hidden" NAME="protocol_version" VALUE="1"><BR> <INPUT TYPE="SUBMIT" VALUE="Upload"> </FORM> *************** *** 111,122 **** The following are valid os names: ! debian ! hpux ! mandrake ! redhat ! solaris ! suse ! windows ! yellowdog The above include a number of different types of distributions of --- 132,137 ---- The following are valid os names: ! aix beos debian dos freebsd hpux mac macos mandrake netbsd ! openbsd qnx redhat solaris suse windows yellowdog The above include a number of different types of distributions of *************** *** 127,141 **** Version is the official version string specified by the vendor for ! the particular release. For example, "nt" (Windows), "9.04" ! (HP-UX), "7.0" (RedHat, Mandrake). The following are valid architectures: ! alpha ! hppa ! ix86 ! powerpc ! sparc ! ultrasparc --- 142,151 ---- Version is the official version string specified by the vendor for ! the particular release. For example, "2000" and "nt" (Windows), ! "9.04" (HP-UX), "7.0" (RedHat, Mandrake). The following are valid architectures: ! alpha hppa ix86 powerpc sparc ultrasparc *************** *** 154,157 **** --- 164,173 ---- [1] Metadata for Python Software Package, Kuchling, http://python.sourceforge.net/peps/pep-0241.html + + [2] RFC 1867, Form-based File Upload in HTML + http://www.faqs.org/rfcs/rfc1867.html + + [3] RFC 2440, OpenPGP Message Format + http://www.faqs.org/rfcs/rfc2440.html From ping@users.sourceforge.net Tue Mar 27 08:13:45 2001 From: ping@users.sourceforge.net (Ka-Ping Yee) Date: Tue, 27 Mar 2001 00:13:45 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.20,1.21 Message-ID: <E14hobp-0005ca-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv20585/Lib Modified Files: pydoc.py Log Message: Fix some reloading problems (still more work needed). Add hyperlinks to PEPs at http://www.python.org/peps/pep-%04d.html Remove script directory (dirname of sys.argv[0]) from sys.path. Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -r1.20 -r1.21 *** pydoc.py 2001/03/23 14:05:53 1.20 --- pydoc.py 2001/03/27 08:13:42 1.21 *************** *** 367,370 **** --- 367,371 ---- pattern = re.compile(r'\b((http|ftp)://\S+[\w/]|' r'RFC[- ]?(\d+)|' + r'PEP[- ]?(\d+)|' r'(self\.)?(\w+))\b') while 1: *************** *** 374,383 **** results.append(escape(text[here:start])) ! all, scheme, rfc, selfdot, name = match.groups() if scheme: results.append('<a href="%s">%s</a>' % (all, escape(all))) elif rfc: ! url = 'http://www.rfc-editor.org/rfc/rfc%s.txt' % rfc results.append('<a href="%s">%s</a>' % (url, escape(all))) elif text[end:end+1] == '(': results.append(self.namelink(name, methods, funcs, classes)) --- 375,387 ---- results.append(escape(text[here:start])) ! all, scheme, rfc, pep, selfdot, name = match.groups() if scheme: results.append('<a href="%s">%s</a>' % (all, escape(all))) elif rfc: ! url = 'http://www.rfc-editor.org/rfc/rfc%d.txt' % int(rfc) results.append('<a href="%s">%s</a>' % (url, escape(all))) + elif pep: + url = 'http://www.python.org/peps/pep-%04d.html' % int(pep) + results.append('<a href="%s">%s</a>' % (url, escape(all))) elif text[end:end+1] == '(': results.append(self.namelink(name, methods, funcs, classes)) *************** *** 1032,1037 **** if os.path.exists(file): info = (file, os.path.getmtime(file), os.path.getsize(file)) ! if cache.has_key(path) and cache[path] != info: ! module = reload(module) file = module.__file__ if os.path.exists(file): --- 1036,1042 ---- if os.path.exists(file): info = (file, os.path.getmtime(file), os.path.getsize(file)) ! if cache.get(path) == info: ! continue ! module = reload(module) file = module.__file__ if os.path.exists(file): *************** *** 1139,1145 **** class Helper: def __repr__(self): ! return '''To get help on a Python object, call help(object). To get help on a module or package, either import it before calling ! help(module) or call help('modulename').''' def __call__(self, *args): --- 1144,1152 ---- class Helper: def __repr__(self): ! return '''Welcome to Python %s! ! ! To get help on a Python object, call help(object). To get help on a module or package, either import it before calling ! help(module) or call help('modulename').''' % sys.version[:3] def __call__(self, *args): *************** *** 1517,1520 **** --- 1524,1530 ---- # Scripts don't get the current directory in their path by default. + scriptdir = os.path.dirname(sys.argv[0]) + if scriptdir in sys.path: + sys.path.remove(scriptdir) sys.path.insert(0, '.') From loewis@users.sourceforge.net Tue Mar 27 08:42:14 2001 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Tue, 27 Mar 2001 00:42:14 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/xml __init__.py,1.9,1.10 Message-ID: <E14hp3O-0006cz-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib/xml In directory usw-pr-cvs1:/tmp/cvs-serv25373 Modified Files: __init__.py Log Message: Use Guido's trick for always extracting the version number from a CVS Revision string correctly, even under -kv. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xml/__init__.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** __init__.py 2001/02/09 12:03:45 1.9 --- __init__.py 2001/03/27 08:42:12 1.10 *************** *** 16,20 **** __all__ = ["dom", "parsers", "sax"] ! __version__ = "$Revision$".split()[1] --- 16,23 ---- __all__ = ["dom", "parsers", "sax"] ! # When being checked-out without options, this has the form ! # "<dollar>Revision: x.y </dollar>" ! # When exported using -kv, it is "x.y". ! __version__ = "$Revision$".split()[-2][0] From moshez@users.sourceforge.net Tue Mar 27 16:47:30 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Tue, 27 Mar 2001 08:47:30 -0800 Subject: [Python-checkins] CVS: python/nondist/sandbox/rational - New directory Message-ID: <E14hwd0-0000gT-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/sandbox/rational In directory usw-pr-cvs1:/tmp/cvs-serv2622/rational Log Message: Directory /cvsroot/python/python/nondist/sandbox/rational added to the repository From moshez@users.sourceforge.net Tue Mar 27 16:50:12 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Tue, 27 Mar 2001 08:50:12 -0800 Subject: [Python-checkins] CVS: python/nondist/sandbox/rational Rational.py,NONE,1.1 Message-ID: <E14hwfc-0000pH-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/sandbox/rational In directory usw-pr-cvs1:/tmp/cvs-serv2713 Added Files: Rational.py Log Message: First CVS'ed version of Rational.py, prototype for PEP-0239. --- NEW FILE: Rational.py --- ''' Rational numbers are a representation of the mathematical field of rational numbers. They have unlimited precision, but many algorithms with rationals use unbounded space and large amounts of time -- so be careful. Rationals can be created easily: >>> a=rational(1) >>> a rational(1L) And are printed in friendly (though misleading ways) >>> print a 1 >>> a/2 rational(1L, 2L) >>> print a/2 1/2 There are many ways to build rationals: >From integers: >>> print rational(1) 1 >From nominators and denuminators: >>> print rational(1,2) 1/2 >From floats: >>> print rational(1.3) 5854679515581645/4503599627370496 >>> print float(rational(1.3)) 1.3 Not from complex numbers, even if they have 0 imaginary part: >>> rational(1j) Traceback (most recent call last): File "<stdin>", line 1, in ? File "Rational.py", line 418, in rational raise TypeError('cannot convert arguments') TypeError: cannot convert arguments But there is no problem with using floating point literals -- just protect them by quotes. >>> print rational("1.3") 13/10 >>> print rational("1.2e-3") 3/2500 >From ``rational'' literals >>> print rational("1/2") 1/2 Or even mix the two >>> print rational("1.5/2.3") 15/23 Or give them as seperate arguments: >>> print rational("1.5", "2.3") 15/23 *Note*: The following calculation takes some time >>> p=0 >>> for i in range(1,1000): ... p += rational(1)/i ... And p is *very* large. Rationals explode quickly in term of space and (as you have noticed if you tried the above calculation) time. >>> p rational(53355784417020119952537879239887266136731803921522374204060897246465114565409520646006621457833121819822177013733448523121929191853817388455050878455561717371027592157489651884795570078464505321798967754860322188969172665004633935471096455470633645094270513262722579396248817332458071400971347691033193734596623333937737766140820373673275246317859525956885804716570122271771159715339438239613795876131660183846149167740477557199918997L, 7128865274665093053166384155714272920668358861885893040452001991154324087581111499476444151913871586911717817019575256512980264067621009251465871004305131072686268143200196609974862745937188343705015434452523739745298963145674982128236956232823794011068809262317708861979540791247754558049326475737829923352751796735248042463638051137034331214781746850878453485678021888075373249921995672056932029099390891687487672697950931603520000L) printing p is not that user friendly, either. >>> print p 53355784417020119952537879239887266136731803921522374204060897246465114565409520646006621457833121819822177013733448523121929191853817388455050878455561717371027592157489651884795570078464505321798967754860322188969172665004633935471096455470633645094270513262722579396248817332458071400971347691033193734596623333937737766140820373673275246317859525956885804716570122271771159715339438239613795876131660183846149167740477557199918997/7128865274665093053166384155714272920668358861885893040452001991154324087581111499476444151913871586911717817019575256512980264067621009251465871004305131072686268143200196609974862745937188343705015434452523739745298963145674982128236956232823794011068809262317708861979540791247754558049326475737829923352751796735248042463638051137034331214781746850878453485678021888075373249921995672056932029099390891687487672697950931603520000 We can convert p to float. Float conversion always works: >>> float(p) 7.4844708605503447 even though naive conversion wouldn't: >>> float(p.n)/float(p.d) nan To conserve time, we can trim p: find the closest rational with a bounded denominator >>> p.trim(1L<<32) rational(12377570989L, 1653767009L) Subtracting them gives unhelpful results :( >>> p.trim(1L<<32)-p rational(-872119393953314540036963267350639988172842400460951889331776938576194338908055712270088035774611947221522363468929809379656051539773356282463641470813867367248573361743120219423901587966011300322682776045585594990374963929108968282002031347349387213913263250396231429588965548616844893074283339877989693620079553025660145795725133735701645191166053131402530951317054053830892681481265653921747553420724047240884052429689973L, 11789482202846854415241649104540583386623406115959677432802223340973331003735668809384664111066145039897075121304472266413879140983139770215358042356369522737429331262552172835890068328534070869038707353333385737580077488092224146480342885552420913445717377586934653792408698993535292433431351520245462060493779590806227120058195691087482315063384946077372429043555366594878942786082108265888537359480000638667859451202061272586716844271680000L) But we can measure the error as a floating point number to get a rough estimate: >>> float(p.trim(1L<<32)-p) -7.3974359428840768e-20 We can also approximate p: find the closest rational which is closer then the bound (shifting rationals is the same as multiplying by 2 to the correct power. Right shifting means negative powers, of course...) >>> p.approximate(rational(1L)>>32) rational(860063L, 114913L) >>> float(p.approximate(rational(1L)>>32)) 7.4844708605640786 >>> float(p.approximate(rational(1L)>>32))-p 1.3733902903823036e-11 How many bits is that? >>> import math >>> math.log(float(p.approximate(rational(1L)>>32))-p)/math.log(2) -36.083467374587123 Less then -32, or in other words, the rational number we found is about 2.0**-36 further apart, closer then the bound (2.0**-32). ''' def _gcd(a, b): if a>b: b, a = a, b if a == 0: return b while 1: c = b % a if c == 0: return a b = a a = c def _trim(n, d, max_d): if max_d == 1: return n/d, 1 last_n, last_d = 0, 1 current_n, current_d = 1, 0 while 1: div, mod = divmod(n, d) n, d = d, mod before_last_n, before_last_d = last_n, last_d next_n = last_n + current_n*div next_d = last_d + current_d*div last_n, last_d = current_n, current_d current_n, current_d = next_n, next_d if mod == 0 or current_d>=max_d: break if current_d == max_d: return current_n, current_d i = (max_d-before_last_d)/last_d alternative_n = before_last_n + i*last_n alternative_d = before_last_d + i*last_d alternative = _Rational(alternative_n, alternative_d) last = _Rational(last_n, last_d) num = _Rational(n, d) if abs(alternative-num)<abs(last-num): return alternative_n, alternative_d else: return last_n, last_d def _approximate(n, d, err): r = _Rational(n, d) last_n, last_d = 0, 1 current_n, current_d = 1, 0 while 1: div, mod = divmod(n, d) n, d = d, mod next_n = last_n + current_n*div next_d = last_d + current_d*div last_n, last_d = current_n, current_d current_n, current_d = next_n, next_d app = _Rational(current_n, current_d) if mod == 0 or abs(app-r)<err: break return app import math as _math def _float_to_ratio(x): """\ x -> (top, bot), a pair of co-prime longs s.t. x = top/bot. The conversion is done exactly, without rounding. bot > 0 guaranteed. Some form of binary fp is assumed. Pass NaNs or infinities at your own risk. >>> rational(10.0) rational(10L, 1L) >>> rational(0.0) rational(0L) >>> rational(-.25) rational(-1L, 4L) """ if x == 0: return 0L, 1L signbit = 0 if x < 0: x = -x signbit = 1 f, e = _math.frexp(x) assert 0.5 <= f < 1.0 # x = f * 2**e exactly # Suck up CHUNK bits at a time; 28 is enough so that we suck # up all bits in 2 iterations for all known binary double- # precision formats, and small enough to fit in an int. CHUNK = 28 top = 0L # invariant: x = (top + f) * 2**e exactly while f: f = _math.ldexp(f, CHUNK) digit = int(f) assert digit >> CHUNK == 0 top = (top << CHUNK) | digit f = f - digit assert 0.0 <= f < 1.0 e = e - CHUNK assert top # now x = top * 2**e exactly; fold in 2**e r = _Rational(top, 1) if e>0: r = r << e else: r = r >> -e if signbit: return -r else: return r class _Rational: def __init__(self, n, d): if d == 0: return n/d n, d = map(long, (n, d)) if d < 0: n *= -1 d *= -1 f = _gcd(abs(n), d) self.n = n/f self.d = d/f def __repr__(self): if self.d == 1: return 'rational(%r)' % self.n return 'rational(%(n)r, %(d)r)' % self.__dict__ def __str__(self): if self.d == 1: return str(self.n) return '%(n)s/%(d)s' % self.__dict__ def __coerce__(self, other): for int in (type(1), type(1L)): if isinstance(other, int): return self, rational(other) if type(other) == type(1.0): return float(self), other return NotImplemented def __rcoerce__(self, other): return coerce(self, other) def __add__(self, other): return _Rational(self.n*other.d + other.n*self.d, self.d*other.d) def __radd__(self, other): return self+other def __mul__(self, other): return _Rational(self.n*other.n, self.d*other.d) def __rmul__(self, other): return self*other def inv(self): return _Rational(self.d, self.n) def __div__(self, other): return self*other.inv() def __rdiv__(self, other): return self.inv()*other def __neg__(self): return _Rational(-self.n, self.d) def __sub__(self, other): return self+(-other) def __rsub__(self, other): return (-self)+other def __long__(self): if self.d != 1: raise ValueError('cannot convert non-integer') return self.n def __int__(self): return int(long(self)) def __float__(self): # Avoid NaNs like the plague if self.d > 1L<<1023: self = self.trim(1L<<1023) return float(self.n)/float(self.d) def __pow__(self, exp, z=None): if z is not None: raise TypeError('pow with 3 args unsupported') if isinstance(exp, _Rational): if exp.d == 1: exp = exp.n if isinstance(exp, type(1)) or isinstance(exp, type(1L)): if exp < 0: return _Rational(self.d**-exp, self.n**-exp) return _Rational(self.n**exp, self.d**exp) return float(self)**exp def __cmp__(self, other): return cmp(self.n*other.d, self.d*other.n) def __hash__(self): return hash(self.n)^hash(self.d) def __abs__(self): return _Rational(abs(self.n), self.d) def __complex__(self): return complex(float(self)) def __nonzero__(self): return self.n != 0 def __pos__(self): return self def __oct__(self): return '%s/%s' % (oct(self.n), oct(self.d)) def __hex__(self): return '%s/%s' % (hex(self.n), hex(self.d)) def __lshift__(self, other): if other.d != 1: raise TypeError('cannot shift by non-integer') return _Rational(self.n<<other.n, self.d) def __rshift__(self, other): if other.d != 1: raise TypeError('cannot shift by non-integer') return _Rational(self.n, self.d<<other.n) def trim(self, max_d): n, d = self.n, self.d if n < 0: n *= -1 n, d = _trim(n, d, max_d) if self.n < 0: n *= -1 r = _Rational(n, d) upwards = self < r if upwards: alternate_n = n-1 else: alternate_n = n+1 if self == _Rational(alternate_n+n, d*2): new_n = min(alternate_n, n) return _Rational(new_n, d) return r def approximate(self, err): n, d = self.n, self.d if n < 0: n *= -1 app = _approximate(n, d, err) if self.n < 0: app *= -1 return app def _parse_number(num): if '/' in num: n, d = num.split('/', 1) return _parse_number(n)/_parse_number(d) if 'e' in num: mant, exp = num.split('e', 1) mant = _parse_number(mant) exp = long(exp) return mant*(rational(10)**rational(exp)) if '.' in num: i, f = num.split('.', 1) i = long(i) f = rational(long(f), 10L**len(f)) return i+f return rational(long(num)) def rational(n, d=1L): if type(n) in (type(''), type(u'')) : n = _parse_number(n) if type(d) in (type(''), type(u'')) : d = _parse_number(d) if isinstance(n, type(1.0)): n = _float_to_ratio(n) if isinstance(n, type(1.0)): d = _float_to_ratio(d) for arg in (n, d): if isinstance(arg, type(1j)): raise TypeError('cannot convert arguments') if isinstance(n, _Rational): return rational(n.n, n.d*d) if isinstance(d, _Rational): return rational(n*d.d, d.n) return _Rational(n, d) import __builtin__ __builtin__.rational = rational def _test(): import doctest, Rational doctest.testmod(Rational) if __name__ == '__main__': _test() From gvanrossum@users.sourceforge.net Tue Mar 27 17:04:39 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 27 Mar 2001 09:04:39 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc ACKS,1.87,1.88 Message-ID: <E14hwtb-0001aU-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv6094 Modified Files: ACKS Log Message: Add Robin Thomas (author of the slice() comparability hack). Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -r1.87 -r1.88 *** ACKS 2001/03/22 13:43:25 1.87 --- ACKS 2001/03/27 17:04:37 1.88 *************** *** 376,379 **** --- 376,380 ---- Amy Taylor Tobias Thelen + Robin Thomas Eric Tiedemann Tracy Tims From akuchling@users.sourceforge.net Tue Mar 27 17:43:02 2001 From: akuchling@users.sourceforge.net (A.M. Kuchling) Date: Tue, 27 Mar 2001 09:43:02 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0247.txt,NONE,1.1 Message-ID: <E14hxUk-0003tN-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv14907 Added Files: pep-0247.txt Log Message: Initial checkin of hashing API draft --- NEW FILE: pep-0247.txt --- PEP: 247 Title: API for Cryptographic Hash Functions Status: Draft Version: $Revision: 1.1 $ Author: A.M. Kuchling <amk1@bigfoot.com> Type: Informational Created: 23-Mar-2001 Post-History: Abstract There are several different modules available that implement cryptographic hashing algorithms such as MD5 or SHA. This document specifies a standard API for such algorithms, to make it easier to switch between different implementations. Specification All hashing modules should present the same interface. Additional methods or variables can be added, but those described in this document should always be present. Hash function modules define one function: new([string], [key]) Create a new hashing object and return it. You can now feed arbitrary strings into the object using its update() method, and can ask for the hash value at any time by calling its digest() method. The 'string' parameter, if supplied, will be immediately hashed into the object's starting state. For keyed hashes such as HMAC, 'key' is a string containing the starting key. Hash function modules define one variable: digest_size An integer value; the size of the digest produced by the hashing objects, measured in bytes. You could also obtain this value by creating a sample object, and taking the length of the digest string it returns, but using digest_size is faster. The methods for hashing objects are always the following: clear() Reset this hashing object to its initial state, as if the object was created from new(key=<initially specified key>) (XXX what should this do for a keyed hash? A proposed semantic follows:) There is no way to supply a starting string as there is for the new() function, and there's no way to change the key specified for a keyed hash. copy() Return a separate copy of this hashing object. An update to this copy won't affect the original object. digest() Return the hash value of this hashing object, as a string containing 8-bit data. The object is not altered in any way by this function; you can continue updating the object after calling this function. update(arg) Update this hashing object with the string arg. For convenience, hashing objects also have a digest_size attribute, measuring the size of the resulting digest in bytes. This is identical to the module-level digest_size variable. Here's an example, using a module named 'MD5': >>> from Crypto.Hash import MD5 >>> m = MD5.new() >>> m.update('abc') >>> m.digest() '\220\001P\230<\322O\260\326\226?@}(\341\177r' Or, more compactly: >>> MD5.new('abc').digest() '\220\001P\230<\322O\260\326\226?@}(\341\177r' Copyright This document has been placed in the public domain. Local Variables: mode: indented-text indent-tabs-mode: nil End: From moshez@zadka.site.co.il Tue Mar 27 19:50:08 2001 From: moshez@zadka.site.co.il (Moshe Zadka) Date: Tue, 27 Mar 2001 21:50:08 +0200 Subject: [Python-checkins] CVS: python/nondist/peps pep-0247.txt,NONE,1.1 In-Reply-To: <E14hxUk-0003tN-00@usw-pr-cvs1.sourceforge.net> References: <E14hxUk-0003tN-00@usw-pr-cvs1.sourceforge.net> Message-ID: <E14hzTk-00076h-00@darjeeling> Cool! On Tue, 27 Mar 2001, "A.M. Kuchling" <akuchling@users.sourceforge.net> wrote: > new([string], [key]) What happens if I supply a key to an unkeyed hash? Is it silently ignored? > clear() > > (XXX what should this do for a keyed hash? Your solution seems fine. > digest() > > Return the hash value of this hashing object, as a string > containing 8-bit data. The object is not altered in any way by > this function; Why this constrain? I can imagine algorithms for which this will create an artificial inefficiency. It's not such a common need, and if someone really needs it, she can just take hash.copy().digest() Also, the PEP needs to spell out the existence of a Crypto.Hash package more clearly, and I think even an API for a factory function would be very useful. >>> import Crypto.Hash >>> md5 = Crypto.Hash.factory('md5') >>> md5.update("dddd") >>> print >>open("file", 'w'), binascii.hexlify(md5.digest()) Oh, and I think that Mixed Case Is Evil(tm), and that crypto.hash would be just fine. But I don't care really. -- "I'll be ex-DPL soon anyway so I'm |LUKE: Is Perl better than Python? looking for someplace else to grab power."|YODA: No...no... no. Quicker, -- Wichert Akkerman (on debian-private)| easier, more seductive. For public key, finger moshez@debian.org |http://www.{python,debian,gnu}.org From loewis@users.sourceforge.net Tue Mar 27 21:38:17 2001 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Tue, 27 Mar 2001 13:38:17 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/xml __init__.py,1.10,1.11 Message-ID: <E14i1AP-00016D-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib/xml In directory usw-pr-cvs1:/tmp/cvs-serv4186 Modified Files: __init__.py Log Message: Arghh. Fix typo. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xml/__init__.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** __init__.py 2001/03/27 08:42:12 1.10 --- __init__.py 2001/03/27 21:38:15 1.11 *************** *** 19,23 **** # "<dollar>Revision: x.y </dollar>" # When exported using -kv, it is "x.y". ! __version__ = "$Revision$".split()[-2][0] --- 19,23 ---- # "<dollar>Revision: x.y </dollar>" # When exported using -kv, it is "x.y". ! __version__ = "$Revision$".split()[-2:][0] From gvanrossum@users.sourceforge.net Wed Mar 28 01:14:58 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 27 Mar 2001 17:14:58 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_fcntl.py,1.15,1.16 Message-ID: <E14i4Y6-0007fl-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv29483 Modified Files: test_fcntl.py Log Message: Based on info from Jens@digicool.com, add 'darwin1' to the list of BSD-style OS'es. Makes sense, really. Index: test_fcntl.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_fcntl.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -r1.15 -r1.16 *** test_fcntl.py 2001/01/17 21:51:35 1.15 --- test_fcntl.py 2001/03/28 01:14:56 1.16 *************** *** 17,21 **** print 'Status from fnctl with O_NONBLOCK: ', rv ! if sys.platform in ('netbsd1', 'Darwin1.2', 'freebsd2', 'freebsd3', 'freebsd4', 'freebsd5', 'bsdos2', 'bsdos3', 'bsdos4', --- 17,21 ---- print 'Status from fnctl with O_NONBLOCK: ', rv ! if sys.platform in ('netbsd1', 'Darwin1.2', 'darwin1', 'freebsd2', 'freebsd3', 'freebsd4', 'freebsd5', 'bsdos2', 'bsdos3', 'bsdos4', From fdrake@users.sourceforge.net Wed Mar 28 16:51:25 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 28 Mar 2001 08:51:25 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/doc doc.tex,1.37,1.38 Message-ID: <E14iJAL-0007CE-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/doc In directory usw-pr-cvs1:/tmp/cvs-serv27633/doc Modified Files: doc.tex Log Message: Fix a number of small issues; this closes SF bug #411063. Index: doc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/doc/doc.tex,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -r1.37 -r1.38 *** doc.tex 2000/11/27 20:10:18 1.37 --- doc.tex 2001/03/28 16:51:20 1.38 *************** *** 197,202 **** \subsection{Syntax} ! There are only a things that an author of Python documentation ! needs to know about \LaTeX{} syntax. A \dfn{comment} is started by the ``percent'' character --- 197,202 ---- \subsection{Syntax} ! There are a things that an author of Python documentation needs to ! know about \LaTeX{} syntax. A \dfn{comment} is started by the ``percent'' character *************** *** 236,240 **** \end{verbatim} ! An alternate syntax for a group using brackets (\code{\{...\}}) is used by macros and environment constructors which take optional parameters; brackets do not normally hold syntactic significance. --- 236,240 ---- \end{verbatim} ! An alternate syntax for a group using brackets (\code{[...]}) is used by macros and environment constructors which take optional parameters; brackets do not normally hold syntactic significance. *************** *** 327,331 **** \begin{verbatim} ! \begin{datadesc}{datadesc}{controlnames} A 33-element string array that contains the \ASCII{} mnemonics for the thirty-two \ASCII{} control characters from 0 (NUL) to 0x1f --- 327,331 ---- \begin{verbatim} ! \begin{datadesc}{controlnames} A 33-element string array that contains the \ASCII{} mnemonics for the thirty-two \ASCII{} control characters from 0 (NUL) to 0x1f From fdrake@users.sourceforge.net Wed Mar 28 16:55:55 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 28 Mar 2001 08:55:55 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/ref refa1.tex,1.4,1.5 Message-ID: <E14iJEh-0007Zc-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv29094/ref Modified Files: refa1.tex Log Message: Typo: "ariables" --> "variables" This fixes SF bug #411118. Index: refa1.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/refa1.tex,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** refa1.tex 2001/03/23 17:23:50 1.4 --- refa1.tex 2001/03/28 16:55:53 1.5 *************** *** 179,183 **** If a name is bound in a block, it is a local variable of that block. If a name is bound at the module level, it is a global variable. (The ! ariables of the module code block are local and global.) If a variable is used in a code block but not defined there, it is a \dfn{free variable}. --- 179,183 ---- If a name is bound in a block, it is a local variable of that block. If a name is bound at the module level, it is a global variable. (The ! variables of the module code block are local and global.) If a variable is used in a code block but not defined there, it is a \dfn{free variable}. From bwarsaw@users.sourceforge.net Wed Mar 28 19:52:15 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 28 Mar 2001 11:52:15 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0001.txt,1.17,1.18 Message-ID: <E14iLzL-0000Ii-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv1144 Modified Files: pep-0001.txt Log Message: Add a note that titles should be limited to 38 characters. Index: pep-0001.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0001.txt,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** pep-0001.txt 2001/03/21 21:52:08 1.17 --- pep-0001.txt 2001/03/28 19:52:13 1.18 *************** *** 129,134 **** 1. Preamble -- RFC822 style headers containing meta-data about the ! PEP, including the PEP number, a short descriptive title, the ! names contact info for each author, etc. 2. Abstract -- a short (~200 word) description of the technical --- 129,135 ---- 1. Preamble -- RFC822 style headers containing meta-data about the ! PEP, including the PEP number, a short descriptive title ! (limited to a maximum of 38 characters), the names contact info ! for each author, etc. 2. Abstract -- a short (~200 word) description of the technical From bwarsaw@users.sourceforge.net Wed Mar 28 19:55:48 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 28 Mar 2001 11:55:48 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0000.txt,1.80,1.81 Message-ID: <E14iM2m-0000Y4-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv2093 Modified Files: pep-0000.txt Log Message: PEP 247, API for Cryptographic Hash Algorithms, Andrew Kuchling (note: 246 is reserved) Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.80 retrieving revision 1.81 diff -C2 -r1.80 -r1.81 *** pep-0000.txt 2001/03/21 18:59:54 1.80 --- pep-0000.txt 2001/03/28 19:55:46 1.81 *************** *** 30,33 **** --- 30,37 ---- I 6 pep-0006.txt Patch and Bug Fix Releases Aahz + Other Informational PEPs + + I 247 pep-0247.txt API for Cryptographic Hash Algorithms Kuchling + Active PEPs (under serious consideration for Python 2.1 - even if empty) *************** *** 159,162 **** --- 163,167 ---- S 244 pep-0244.txt The `directive' Statement von Loewis S 245 pep-0245.txt Python Interfaces Pelletier + I 247 pep-0247.txt API for Cryptographic Hash Algorithms Kuchling From bwarsaw@users.sourceforge.net Wed Mar 28 19:57:11 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 28 Mar 2001 11:57:11 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0000.txt,1.81,1.82 Message-ID: <E14iM47-0000dh-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv2443 Modified Files: pep-0000.txt Log Message: Oops, it should be "Functions" not "Algorithms" Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.81 retrieving revision 1.82 diff -C2 -r1.81 -r1.82 *** pep-0000.txt 2001/03/28 19:55:46 1.81 --- pep-0000.txt 2001/03/28 19:57:09 1.82 *************** *** 32,36 **** Other Informational PEPs ! I 247 pep-0247.txt API for Cryptographic Hash Algorithms Kuchling Active PEPs (under serious consideration for Python 2.1 - even if empty) --- 32,36 ---- Other Informational PEPs ! I 247 pep-0247.txt API for Cryptographic Hash Functions Kuchling Active PEPs (under serious consideration for Python 2.1 - even if empty) *************** *** 163,167 **** S 244 pep-0244.txt The `directive' Statement von Loewis S 245 pep-0245.txt Python Interfaces Pelletier ! I 247 pep-0247.txt API for Cryptographic Hash Algorithms Kuchling --- 163,167 ---- S 244 pep-0244.txt The `directive' Statement von Loewis S 245 pep-0245.txt Python Interfaces Pelletier ! I 247 pep-0247.txt API for Cryptographic Hash Functions Kuchling From bwarsaw@users.sourceforge.net Wed Mar 28 20:06:13 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 28 Mar 2001 12:06:13 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0001.txt,1.18,1.19 Message-ID: <E14iMCr-0001Eu-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv4743 Modified Files: pep-0001.txt Log Message: Added Requires: header. Index: pep-0001.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0001.txt,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -r1.18 -r1.19 *** pep-0001.txt 2001/03/28 19:52:13 1.18 --- pep-0001.txt 2001/03/28 20:06:10 1.19 *************** *** 185,188 **** --- 185,189 ---- Status: <Draft | Active | Accepted | Deferred | Final | Replaced> Type: <Informational | Standards Track> + * Requires: <pep numbers> Created: <date created on, in dd-mmm-yyyy format> * Python-Version: <version number> *************** *** 201,204 **** --- 202,208 ---- the author, or on the python-list or python-dev email mailing lists. + + PEPs may have a Requires: header, indicating the PEP numbers that + this PEP depends on. PEPs may also have a Replaced-By: header indicating that a PEP has From bwarsaw@users.sourceforge.net Wed Mar 28 20:18:06 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 28 Mar 2001 12:18:06 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0247.txt,1.1,1.2 Message-ID: <E14iMOM-0001hg-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv6541 Modified Files: pep-0247.txt Log Message: Minor style updates. Index: pep-0247.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0247.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** pep-0247.txt 2001/03/27 17:42:59 1.1 --- pep-0247.txt 2001/03/28 20:18:03 1.2 *************** *** 1,7 **** PEP: 247 Title: API for Cryptographic Hash Functions - Status: Draft Version: $Revision$ ! Author: A.M. Kuchling <amk1@bigfoot.com> Type: Informational Created: 23-Mar-2001 --- 1,7 ---- PEP: 247 Title: API for Cryptographic Hash Functions Version: $Revision$ ! Author: amk1@bigfoot.com (A.M. Kuchling) ! Status: Draft Type: Informational Created: 23-Mar-2001 *************** *** 10,96 **** Abstract ! There are several different modules available that implement ! cryptographic hashing algorithms such as MD5 or SHA. This document ! specifies a standard API for such algorithms, to make it easier to ! switch between different implementations. Specification ! All hashing modules should present the same interface. Additional ! methods or variables can be added, but those described in this ! document should always be present. ! Hash function modules define one function: ! new([string], [key]) ! ! Create a new hashing object and return it. You can now feed ! arbitrary strings into the object using its update() method, and ! can ask for the hash value at any time by calling its digest() ! method. ! The 'string' parameter, if supplied, will be immediately hashed ! into the object's starting state. For keyed hashes such as ! HMAC, 'key' is a string containing the starting key. ! Hash function modules define one variable: ! digest_size ! An integer value; the size of the digest produced by the hashing ! objects, measured in bytes. You could also obtain this value by ! creating a sample object, and taking the length of the digest ! string it returns, but using digest_size is faster. ! The methods for hashing objects are always the following: ! clear() ! Reset this hashing object to its initial state, as if the object ! was created from new(key=<initially specified key>) ! (XXX what should this do for a keyed hash? A proposed semantic follows:) ! There is no way to supply a starting string as there is for the ! new() function, and there's no way to change the key specified ! for a keyed hash. ! copy() ! Return a separate copy of this hashing object. An update to this ! copy won't affect the original object. ! digest() ! Return the hash value of this hashing object, as a string ! containing 8-bit data. The object is not altered in any way by ! this function; you can continue updating the object after ! calling this function. ! update(arg) ! Update this hashing object with the string arg. ! For convenience, hashing objects also have a digest_size attribute, ! measuring the size of the resulting digest in bytes. This is ! identical to the module-level digest_size variable. ! Here's an example, using a module named 'MD5': ! >>> from Crypto.Hash import MD5 ! >>> m = MD5.new() ! >>> m.update('abc') ! >>> m.digest() ! '\220\001P\230<\322O\260\326\226?@}(\341\177r' ! Or, more compactly: ! >>> MD5.new('abc').digest() ! '\220\001P\230<\322O\260\326\226?@}(\341\177r' Copyright This document has been placed in the public domain. - --- 10,96 ---- Abstract ! There are several different modules available that implement ! cryptographic hashing algorithms such as MD5 or SHA. This ! document specifies a standard API for such algorithms, to make it ! easier to switch between different implementations. Specification ! All hashing modules should present the same interface. Additional ! methods or variables can be added, but those described in this ! document should always be present. ! Hash function modules define one function: ! new([string], [key]) ! Create a new hashing object and return it. You can now feed ! arbitrary strings into the object using its update() method, ! and can ask for the hash value at any time by calling its ! digest() method. ! The 'string' parameter, if supplied, will be immediately hashed ! into the object's starting state. For keyed hashes such as ! HMAC, 'key' is a string containing the starting key. ! Hash function modules define one variable: ! digest_size ! An integer value; the size of the digest produced by the ! hashing objects, measured in bytes. You could also obtain ! this value by creating a sample object, and taking the length ! of the digest string it returns, but using digest_size is ! faster. ! The methods for hashing objects are always the following: ! clear() ! Reset this hashing object to its initial state, as if the ! object was created from new(key=<initially specified key>) ! (XXX what should this do for a keyed hash? A proposed ! semantic follows:). There is no way to supply a starting ! string as there is for the new() function, and there's no way ! to change the key specified for a keyed hash. ! copy() ! Return a separate copy of this hashing object. An update to ! this copy won't affect the original object. ! digest() ! Return the hash value of this hashing object, as a string ! containing 8-bit data. The object is not altered in any way ! by this function; you can continue updating the object after ! calling this function. ! update(arg) ! Update this hashing object with the string arg. ! For convenience, hashing objects also have a digest_size ! attribute, measuring the size of the resulting digest in bytes. ! This is identical to the module-level digest_size variable. ! Here's an example, using a module named 'MD5': ! >>> from Crypto.Hash import MD5 ! >>> m = MD5.new() ! >>> m.update('abc') ! >>> m.digest() ! '\220\001P\230<\322O\260\326\226?@}(\341\177r' ! Or, more compactly: + >>> MD5.new('abc').digest() + '\220\001P\230<\322O\260\326\226?@}(\341\177r' + Copyright This document has been placed in the public domain. From bwarsaw@users.sourceforge.net Wed Mar 28 20:24:36 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 28 Mar 2001 12:24:36 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0232.txt,1.9,1.10 Message-ID: <E14iMUe-0001yU-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv7576 Modified Files: pep-0232.txt Log Message: Mark this PEP as Final, as it is now in Python 2.1. Any future elaborations (e.g. as described in the retained "Future Directions" section), must be proposed in a new PEP. Index: pep-0232.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0232.txt,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** pep-0232.txt 2001/02/26 18:13:05 1.9 --- pep-0232.txt 2001/03/28 20:24:34 1.10 *************** *** 3,10 **** Version: $Revision$ Author: barry@digicool.com (Barry A. Warsaw) ! Status: Draft Type: Standards Track Created: 02-Dec-2000 ! Python-Version: 2.1 / 2.2 Post-History: 20-Feb-2001 --- 3,10 ---- Version: $Revision$ Author: barry@digicool.com (Barry A. Warsaw) ! Status: Final Type: Standards Track Created: 02-Dec-2000 ! Python-Version: 2.1 Post-History: 20-Feb-2001 *************** *** 97,104 **** Future Directions ! - A previous version of this PEP (and the accompanying ! implementation) allowed for both setter and getter of attributes ! on unbound methods, and only getter on bound methods. A number ! of problems were discovered with this policy. Because method attributes were stored in the underlying --- 97,109 ---- Future Directions ! Here are a number of future directions to consider. Any adoption ! of these ideas would require a new PEP, which referenced this one, ! and would have to be targeted at a Python version subsequent to ! the 2.1 release. ! ! - A previous version of this PEP allowed for both setter and ! getter of attributes on unbound methods, and only getter on ! bound methods. A number of problems were discovered with this ! policy. Because method attributes were stored in the underlying *************** *** 129,133 **** underlying function object. ! The proposal for Python 2.2 is to implement setting (bound or unbound) method attributes by setting attributes on the instance or class, using special naming conventions. I.e. --- 134,138 ---- underlying function object. ! A future PEP might propose to implement setting (bound or unbound) method attributes by setting attributes on the instance or class, using special naming conventions. I.e. *************** *** 181,185 **** The BDFL is currently against any such special syntactic support ! for setting arbitrary function attributes. --- 186,191 ---- The BDFL is currently against any such special syntactic support ! for setting arbitrary function attributes. Any syntax proposals ! would have to be outlined in new PEPs. *************** *** 218,229 **** Reference Implementation ! The reference implementation is available on SourceForge as a ! patch against the Python CVS tree (patch #103123). This patch ! doesn't include the regrtest module and output file. Those are ! available upon request. ! ! http://sourceforge.net/patch/?func=detailpatch&patch_id=103123&group_id=5470 ! ! This patch has been applied and will become part of Python 2.1. --- 224,229 ---- Reference Implementation ! This PEP has been accepted and the implementation has been ! integrated into Python 2.1. From bwarsaw@users.sourceforge.net Wed Mar 28 20:25:42 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 28 Mar 2001 12:25:42 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0000.txt,1.82,1.83 Message-ID: <E14iMVi-00021u-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv7790 Modified Files: pep-0000.txt Log Message: PEP 232 is Final. Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -r1.82 -r1.83 *** pep-0000.txt 2001/03/28 19:57:09 1.82 --- pep-0000.txt 2001/03/28 20:25:39 1.83 *************** *** 49,53 **** S 234 pep-0234.txt Iterators Yee - S 232 pep-0232.txt Function Attributes Warsaw S 237 pep-0237.txt Unifying Long Integers and Integers Zadka S 238 pep-0238.txt Non-integer Division Zadka --- 49,52 ---- *************** *** 88,91 **** --- 87,91 ---- SF 223 pep-0223.txt Change the Meaning of \x Escapes Peters SF 230 pep-0230.txt Warning Framework van Rossum + SF 232 pep-0232.txt Function Attributes Warsaw Empty PEPs (or containing only an abstract) From bwarsaw@users.sourceforge.net Wed Mar 28 20:27:04 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 28 Mar 2001 12:27:04 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0000.txt,1.83,1.84 Message-ID: <E14iMX2-00025i-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv8027 Modified Files: pep-0000.txt Log Message: Oops, forgot to mark the other instance of 232 as final. Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.83 retrieving revision 1.84 diff -C2 -r1.83 -r1.84 *** pep-0000.txt 2001/03/28 20:25:39 1.83 --- pep-0000.txt 2001/03/28 20:27:02 1.84 *************** *** 149,153 **** S 230 pep-0230.txt Warning Framework van Rossum SR 231 pep-0231.txt __findattr__() Warsaw ! S 232 pep-0232.txt Function Attributes Warsaw S 233 pep-0233.txt Python Online Help Prescod S 234 pep-0234.txt Iterators Yee --- 149,153 ---- S 230 pep-0230.txt Warning Framework van Rossum SR 231 pep-0231.txt __findattr__() Warsaw ! SF 232 pep-0232.txt Function Attributes Warsaw S 233 pep-0233.txt Python Online Help Prescod S 234 pep-0234.txt Iterators Yee From bwarsaw@users.sourceforge.net Wed Mar 28 20:45:37 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 28 Mar 2001 12:45:37 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0245.txt,1.3,1.4 Message-ID: <E14iMoz-0002zm-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv11506 Modified Files: pep-0245.txt Log Message: Michel's latest draft. The original PEP is being split into at least two separate PEPs. This one describes only the syntax proposal. Index: pep-0245.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0245.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** pep-0245.txt 2001/03/21 23:21:49 1.3 --- pep-0245.txt 2001/03/28 20:45:35 1.4 *************** *** 1,4 **** PEP: 245 ! Title: Python Interfaces Version: $Revision$ Author: michel@digicool.com (Michel Pelletier) --- 1,4 ---- PEP: 245 ! Title: Python Interface Syntax Version: $Revision$ Author: michel@digicool.com (Michel Pelletier) *************** [...1089 lines suppressed...] Risks *************** *** 1044,1052 **** http://python.sourceforge.net/peps/pep-0236.html - [8] http://www.zope.org/Wikis/Interfaces - [9] http://www.zope.org/Wikis/Interfaces/InterfacesUseCases - - Copyright --- 482,486 ---- *************** *** 1059,1060 **** --- 493,495 ---- indent-tabs-mode: nil End: + From fdrake@users.sourceforge.net Wed Mar 28 21:14:35 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 28 Mar 2001 13:14:35 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/api api.tex,1.112,1.113 Message-ID: <E14iNH1-0004EU-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv16227/api Modified Files: api.tex Log Message: Added documentation for PyObject_IsInstance() and PyObject_IsSubclass(). Index: api.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/api.tex,v retrieving revision 1.112 retrieving revision 1.113 diff -C2 -r1.112 -r1.113 *** api.tex 2001/03/23 17:42:09 1.112 --- api.tex 2001/03/28 21:14:32 1.113 *************** *** 1494,1497 **** --- 1494,1533 ---- \end{cfuncdesc} + \begin{cfuncdesc}{int}{PyObject_IsInstance}{PyObject *inst, PyObject *cls} + Return \code{1} if \var{inst} is an instance of the class \var{cls} or + a subclass of \var{cls}. If \var{cls} is a type object rather than a + class object, \cfunction{PyObject_IsInstance()} returns \code{1} if + \var{inst} is of type \var{cls}. If \var{inst} is not a class + instance and \var{cls} is neither a type object or class object, + \var{inst} must have a \member{__class__} attribute --- the class + relationship of the value of that attribute with \var{cls} will be + used to determine the result of this function. + \versionadded{2.1} + \end{cfuncdesc} + + Subclass determination is done in a fairly straightforward way, but + includes a wrinkle that implementors of extensions to the class system + may want to be aware of. If \class{A} and \class{B} are class + objects, \class{B} is a subclass of \class{A} if it inherits from + \class{A} either directly or indirectly. If either is not a class + object, a more general mechanism is used to determine the class + relationship of the two objects. When testing if \var{B} is a + subclass of \var{A}, if \var{A} is \var{B}, + \cfunction{PyObject_IsSubclass()} returns true. If \var{A} and + \var{B} are different objects, \var{B}'s \member{__bases__} attribute + is searched in a depth-first fashion for \var{A} --- the presence of + the \member{__bases__} attribute is considered sufficient for this + determination. + + \begin{cfuncdesc}{int}{PyObject_IsSubclass}{PyObject *derived, + PyObject *cls} + Returns \code{1} if the class \var{derived} is identical to or derived + from the class \var{cls}, otherwise returns \code{0}. In case of an + error, returns \code{-1}. If either \var{derived} or \var{cls} is not + an actual class object, this function uses the generic algorithm + described above. + \versionadded{2.1} + \end{cfuncdesc} + \begin{cfuncdesc}{int}{PyCallable_Check}{PyObject *o} From fdrake@users.sourceforge.net Wed Mar 28 21:15:44 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 28 Mar 2001 13:15:44 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libweakref.tex,1.4,1.5 Message-ID: <E14iNI8-0004I5-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv16482/lib Modified Files: libweakref.tex Log Message: Added example use of weak references, contributed by Tim Peters. Index: libweakref.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libweakref.tex,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** libweakref.tex 2001/03/23 04:36:02 1.4 --- libweakref.tex 2001/03/28 21:15:41 1.5 *************** *** 182,185 **** --- 182,207 ---- + \subsection{Example \label{weakref-example}} + + This simple example shows how an application can use objects IDs to + retrieve objects that it has seen before. The IDs of the objects can + then be used in other data structures without forcing the objects to + remain alive, but the objects can still be retrieved by ID if they + do. + + % Example contributed by Tim Peters <tim_one@msn.com>. + \begin{verbatim} + import weakref + + _id2obj_dict = weakref.mapping() + + def remember(obj): + _id2obj_dict[id(obj)] = obj + + def id2obj(id): + return _id2obj_dict.get(id) + \end{verbatim} + + \subsection{Weak References in Extension Types \label{weakref-extension}} From bwarsaw@users.sourceforge.net Thu Mar 29 03:12:50 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 28 Mar 2001 19:12:50 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0246.txt,NONE,1.1 Message-ID: <E14iSri-0003mg-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv14537 Added Files: pep-0246.txt Log Message: PEP 246, Object Adaptation, Clark C. Evans (with editing for style, spell-checking, etc. by Barry) --- NEW FILE: pep-0246.txt --- PEP: 246 Title: Object Adaptation Version: $Revision: 1.1 $ Author: cce@clarkevans.com (Clark C. Evans) Status: Draft Type: Standards Track Created: 21-Mar-2001 Python-Version: 2.2 Abstract This proposal puts forth an extensible mechanism for the adaptation of an object to a context where a specific type, class, interface, or other protocol is expected. This proposal provides a built-in "adapt" function that, for any object X and protocol Y, can be used to ask the Python environment for a version of X complaint with Y. Behind the scenes, the mechanism asks the object X: "Are you now, or do you know how to wrap yourself to provide, a supporter of protocol Y?". And, if this request fails, the function then asks the protocol Y: "Does object X support you, or do you know how to wrap it to obtain such a supporter?" This duality is important, because protocols can be developed after objects are, or vice-versa, and this PEP lets either case be supported non-invasively with regard to the pre-existing component[s]. This proposal does not limit what a protocol is, what compliance to the protocol means, nor what a wrapper constitutes. This mechanism leverages existing protocol categories such as the type system and class hierarchy and can be expanded to support future protocol categories such as the pending interface proposal [1] and signature based type-checking system [2]. Motivation Currently there is no standardized mechanism in Python for asking if an object supports a particular protocol. Typically, existence of particular methods, particularly those that are built-in such as __getitem__, is used as an indicator of support for a particular protocol. This technique works for protocols blessed by the BDFL (Benevolent Dictator for Life), such as the new enumerator proposal identified by a new built-in __iter__[9]. However, this technique does not admit an infallible way to identify interfaces lacking a unique, built-in signature method. More so, there is no standardized way to obtain an adapter for an object. Typically, with objects passed to a context expecting a particular protocol, either the object knows about the context and provides its own wrapper or the context knows about the object and wraps it appropriately. The difficulty with these approaches is that such adaptations are one-offs, are not centralized in a single place of the users code, and are not executed with a common technique, etc. This lack of standardization increases code duplication with the same adapter occurring in more than one place or it encourages classes to be re-written instead of adapted. In either case, maintainability suffers. It would be very nice to have a standard function that can be called upon to verify an object's compliance with a particular protocol and provide for a wrapper if one is readily available -- all without having to hunt through a library's documentation for the appropriate incantation. Requirements When considering an objects compliance with a protocol, there are several cases to be examined: a) When the protocol is a type or class, and the object has exactly that type or is a member of the class. In this case compliance is automatic. b) When the object knows about the protocol and either considers itself compliant or knows how to wrap itself appropriately. c) When the protocol knows about the object and either the object already complies or can be wrapped accordingly. d) When the protocol is a class, and the object is a member of a subclass. This is distinct from the first case (a) above, since inheritance does not necessarily imply substitutability and must be handled carefully. e) When the context knows about the object and the protocol and knows how to adapt the object so that the required protocol is satisfied. This could use an adapter registry or similar method. For this proposal's requirements, the first case should be come for free and the next three cases should be relatively relatively easy to accomplish. This proposal does not address the last case, however it provides a base mechanism upon which such an approach could be developed. Further, with only minor implementation changes, this proposal should be able to incorporate a new interface type or type checking system. The fourth case above is subtle. A lack of substitutability can occur when a method restricts an argument's domain or raises an exception which a base class does not or extends the co-domain to include return values which the base class may never produce. While compliance based on class inheritance should be automatic, this proposal should allow an object to signal that it is not compliant with a base class protocol. Specification This proposal introduces a new built-in function, adapt(), which is the basis for supporting these requirements. The adapt() function has three parameters: - `obj', the object to be adapted - `protocol', the protocol requested of the object - `alternate', an optional object to return if the object could not be adapted A successful result of the adapt() function returns either the object passed `obj' if the object is already compliant with the protocol, or a secondary object `wrapper', which provides a view of the object compliant with the protocol. The definition of wrapper is explicitly vague and a wrapper is allowed to be a full object with its own state if necessary. A failure to adapt the object to the protocol will raise a TypeError unless the alternate parameter is used, in this case the alternate argument is returned. To enable the first case listed in the requirements, the adapt() function first checks to see if the object's type or the object's class are identical to the protocol. If so, then the adapt() function returns the object directly without further ado. To enable the second case, when the object knows about the protocol, the object must have a __conform__() method. This optional method takes two arguments: - `self', the object being conformed - `protocol, the protocol requested The object may return itself through this method to indicate compliance. Alternatively, the object also has the option of returning a wrapper object compliant with the protocol. Finally, if the object cannot determine its compliance, it should either return None or raise a TypeError to enable the remaining mechanisms. To enable the third case, when the protocol knows about the object, the protocol must have an __adapt__() method. This optional method takes two arguments: - `self', the protocol requested - `obj', the object being adapted If the protocol finds the object to be compliant, it can return obj directly. Alternatively, the method may return a wrapper compliant with the protocol. Finally, compliance cannot be determined, this method should either return None or raise a TypeError so other mechanisms can be tried. The fourth case, when the object's class is a sub-class of the protocol, is handled by the built-in adapt() function. Under normal circumstances, if "isinstance(object, protocol)" then adapt() returns the object directly. However, if the object is not substitutable, either the __conform__() or __adapt__() methods above may raise an adaptForceFailException to prevent this default behavior. Please note two important things. First, this proposal does not preclude the addition of other protocols. Second, this proposal does not preclude other possible cases where adapter pattern may hold, such as the context knowing the object and the protocol (the last case in the requirements). In fact, this proposal opens the gate for these other mechanisms to be added. Reference Implementation and Test Cases ----------------------------------------------------------------- adapt.py ----------------------------------------------------------------- import types adaptRaiseTypeException = "(raise a type exception on failure)" adaptForceFailException = "(forced failure of adapt)" # look to see if the object passes other protocols def _check(obj,protocol,default): return default def adapt(obj, protocol, alternate = adaptRaiseTypeException): # first check to see if object has the exact protocol if type(obj) is types.InstanceType and \ obj.__class__ is protocol: return obj if type(obj) is protocol: return obj # next check other protocols for exact conformance # before calling __conform__ or __adapt__ if _check(obj,protocol,0): return obj # procedure to execute on success def succeed(obj,retval,protocol,alternate): if _check(retval,protocol,1): return retval else: return fail(obj,alternate) # procedure to execute on failure def fail(obj,protocol,alternate): if alternate is adaptRaiseTypeException: raise TypeError("%s cannot be adapted to %s" \ % (obj,protocol)) return alternate # try to use the object's adapting mechanism conform = getattr(obj, '__conform__',None) if conform: try: retval = conform(protocol) if retval: return succeed(obj,retval,protocol,alternate) except adaptForceFailException: return fail(obj,protocol,alternate) except TypeError: pass # try to use the protocol's adapting mechanism adapt = getattr(protocol, '__adapt__',None) if adapt: try: retval = adapt(obj) if retval: return succeed(obj,retval,protocol,alternate) except adaptForceFailException: return fail(obj,protocol,alternate) except TypeError: pass # check to see if the object is an instance try: if isinstance(obj,protocol): return obj except TypeError: pass # no-adaptation-possible case return fail(obj,protocol,alternate) ----------------------------------------------------------------- test.py ----------------------------------------------------------------- import types from adapt import adaptForceFailException from adapt import adapt class KnightsWhoSayNi: pass class Eggs: # an unrelated class/interface def eggs(self): print "eggs!" word = "Nee-womm" class Ham: # used as an interface, no inhertance def ham(self): pass word = "Ping" class Spam: # a base class, inheritance used def spam(self): print "spam!" class EggsSpamAndHam (Spam,KnightsWhoSayNi): def ham(self): print "ham!" def __conform__(self,protocol): if protocol is Ham: # implements Ham's ham, but does not have a word return self if protocol is KnightsWhoSayNi: # we are no longer the Knights who say Ni! raise adaptForceFailException if protocol is Eggs: # Knows how to create the eggs! return Eggs() class SacredWord: class HasSecredWord: def __call__(self, obj): if getattr(obj,'word',None): return obj __adapt__= HasSecredWord() class Bing (Ham): def __conform__(self,protocol): raise adaptForceFailException def test(): x = EggsSpamAndHam() adapt(x,Spam).spam() adapt(x,Eggs).eggs() adapt(x,Ham).ham() adapt(x,EggsSpamAndHam).ham() print adapt(Eggs(),SacredWord).word print adapt(Ham(),SacredWord).word pass if adapt(x,KnightsWhoSayNi,None): raise "IckyIcky" if not adapt(x,Spam,None): raise "Spam" if not adapt(x,Eggs,None): raise "Eggs" if not adapt(x,Ham,None): raise "Ham" if not adapt(x,EggsSpamAndHam,None): raise "EggsAndSpam" if adapt(x,KnightsWhoSayNi,None): raise "NightsWhoSayNi" if adapt(x,SacredWord,None): raise "SacredWord" try: adapt(x,SacredWord) except TypeError: pass else: raise "SacredWord" try: adapt(x,KnightsWhoSayNi) except TypeError: print "Ekky-ekky-ekky-ekky-z'Bang, " \ + "zoom-Boing, z'nourrrwringmm" else: raise "NightsWhoSayNi" pass b = Bing() if not adapt(b,Bing,None): raise "Not a Bing" if adapt(b,Ham,None): raise "Not a Ham!" if adapt(1,types.FloatType,None): raise "Not a float!" if adapt(b,types.FloatType,None): raise "Not a float!" if adapt(1,Ham,None): raise "Not a Ham!" if not adapt(1,types.IntType,None): raise "Is an Int!" ----------------------------------------------------------------- Expected Output ----------------------------------------------------------------- >>> import test >>> test.test() spam! eggs! ham! ham! Nee-womm Ping Ekky-ekky-ekky-ekky-z'Bang, zoom-Boing, z'nourrrwringmm >>> Relationship To Paul Prescod and Tim Hochberg's Type Assertion method Paul and Tim had proposed a type checking mechanism, where the Interface is passed an object to verify. The example syntax Paul put forth recently [2] was: interface Interface def __check__(self,obj) For discussion purposes, here would be a protocol with __check__: class Interface: class Checker: def __call__(self, obj): pass #check the object __check__= Checker() The built-in adapt() function could be augmented to use this checking mechanism updating the _check method as follows: # look to see if the object passes other protocols def _check(obj,protocol,default): check = getattr(protocol, '__check__',None) if check: try: if check(obj): return 1 except TypeError: pass return 0 else: return default In short, the work put forth by Paul and company is great, and there should be no problem preventing these two proposals from working together in harmony, if not be completely complementary. Relationship to Python Interfaces [1] by Michel Pelletier The relationship to this proposal to Michel's proposal could also be complementary. Following is how the _check method would be updated for this mechanism: # look to see if the object passes other protocols def _check(obj,protocol,default): if type(protocol) is types.InterfaceType: return implements(obj,protocol) return default Relationship to Carlos Ribeiro's proxy technique [7] and [8] Carlos presented a technique where this method could return a proxy instead of self or a wrapper. The advantage of this approach is that the internal details of the object are protected. This is very neat. No changes are necessary to this proposal to support this usage as a standardized mechanism to obtain named proxies. Relationship To Microsoft's Query Interface Although this proposal may sounds similar to Microsoft's QueryInterface, it differs by a number of aspects. First, it is bi-directional allowing the interface to be queried as well giving more dynamic abilities (more Pythonic). Second, there is not a special "IUnknown" interface which can be used for object identity, although this could be proposed as one of those "special" blessed interface protocol identifiers. Third, with QueryInterface, once an object supports a particular interface it must always there after support this interface; this proposal makes no such guarantee, although this may be added at a later time. Fourth, implementations of Microsoft's QueryInterface must support a kind of equivalence relation. By reflexive they mean the querying an interface for itself must always succeed. By symmetrical they mean that if one can successfully query an interface IA for a second interface IB, then one must also be able to successfully query the interface IB for IA. And finally, by transitive they mean if one can successfully query IA for IB and one can successfully query IB for IC, then one must be able to successfully query IA for IC. Ability to support this type of equivalence relation should be encouraged, but may not be possible. Further research on this topic (by someone familiar with Microsoft COM) would be helpful in further determining how compatible this proposal is. Question and Answer Q: What benefit does this provide? The typical Python programmer is an integrator, someone who is connecting components from various vendors. Often times the interfaces between these components require an intermediate adapter. Usually the burden falls upon the programmer to study the interface exposed by one component and required by another, determine if they are directly compatible, or develop an adapter. Sometimes a vendor may even include the appropriate adapter, but then searching for the adapter and figuring out how to deploy the adapter takes time. This technique enables vendors to work with each other directly by implementing __conform__ or __adapt__ as necessary. This frees the integrator from making their own adapters. In essence, this allows the components to have a simple dialogue among themselves. The integrator simply connects one component to another, and if the types don't automatically match an adapting mechanism is built-in. For example, consider SAX1 and SAX2 interfaces, there is an adapter required to switch between them. Normally the programmer must be aware of this; however, with this adaptation framework this is no longer the case. Q: Why does this have to be built-in, can't it be standalone? Yes, it does work standalone. However, if it is built-in, it has a greater chance of usage. The value of this proposal is primarily in standardization. Furthermore: 0. The mechanism is by its very nature a singleton. 1. If used frequently, it will be much faster as a built-in 2. It is extensible and unassuming. 3. A whole-program optimizing compiler could optimize it out in particular cases (ok, this one is far fetched) Q: Why the verbs __conform__ and __adapt__? conform, verb intransitive 1. To correspond in form or character; be similar. 2. To act or be in accord or agreement; comply. 3. To act in accordance with current customs or modes. adapt, verb transitive 1. To make suitable to or fit for a specific use or situation. Source: The American Heritage Dictionary of the English Language, Third Edition Backwards Compatibility There should be no problem with backwards compatibility unless someone had used __conform__ or __adapt__, but this seems unlikely. Indeed this proposal, save an built-in adapt() function, could be tested without changes to the interpreter. Credits This proposal was created in large part by the feedback of the talented individuals on both the main mailing list and also the type-sig list. Specific contributors include (sorry if I missed someone). This proposal is based largely off the suggestions from Alex Martelli and Paul Prescod with significant feedback from Robin Thomas and borrowing ideas from Marcin 'Qrczak' Kowalczyk and Carlos Ribeiro. Other contributors (via comments) include Michel Pelletier, Jeremy Hylton, Aahz Maruch, Fredrik Lundh, Rainer Deyke, Timothy Delaney, and Huaiyu Zhu References and Footnotes [1] PEP 245, Python Interface Syntax, Pelletier http://www.python.org/peps/pep-0245.html [2] http://mail.python.org/pipermail/types-sig/2001-March/001223.html [3] http://www.zope.org/Members/michel/types-sig/TreasureTrove [4] http://mail.python.org/pipermail/types-sig/2001-March/001105.html [5] http://mail.python.org/pipermail/types-sig/2001-March/001206.html [6] http://mail.python.org/pipermail/types-sig/2001-March/001223.html [7] http://mail.python.org/pipermail/python-list/2001-March/035136.html [8] http://mail.python.org/pipermail/python-list/2001-March/035197.html [9] PEP 234, Iterators, Yee http://www.python.org/peps/pep-0234.txt Copyright This document has been placed in the public domain. Local Variables: mode: indented-text indent-tabs-mode: nil End: From bwarsaw@users.sourceforge.net Thu Mar 29 03:13:51 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 28 Mar 2001 19:13:51 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0000.txt,1.84,1.85 Message-ID: <E14iSsh-0003oe-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv14663 Modified Files: pep-0000.txt Log Message: PEP 246, Object Adaptation, Clark C. Evans Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -r1.84 -r1.85 *** pep-0000.txt 2001/03/28 20:27:02 1.84 --- pep-0000.txt 2001/03/29 03:13:49 1.85 *************** *** 56,60 **** S 242 pep-0242.txt Numeric Kinds Dubois S 244 pep-0244.txt The `directive' Statement von Loewis ! S 245 pep-0245.txt Python Interfaces Pelletier Py-in-the-sky PEPs (not ready; may become active yet) --- 56,61 ---- S 242 pep-0242.txt Numeric Kinds Dubois S 244 pep-0244.txt The `directive' Statement von Loewis ! S 245 pep-0245.txt Python Interface Syntax Pelletier ! S 246 pep-0246.txt Object Adaptation Evans Py-in-the-sky PEPs (not ready; may become active yet) *************** *** 162,166 **** S 243 pep-0243.txt Module Repository Upload Mechanism Reifschneider S 244 pep-0244.txt The `directive' Statement von Loewis ! S 245 pep-0245.txt Python Interfaces Pelletier I 247 pep-0247.txt API for Cryptographic Hash Functions Kuchling --- 163,168 ---- S 243 pep-0243.txt Module Repository Upload Mechanism Reifschneider S 244 pep-0244.txt The `directive' Statement von Loewis ! S 245 pep-0245.txt Python Interface Syntax Pelletier ! S 246 pep-0246.txt Object Adaptation Evans I 247 pep-0247.txt API for Cryptographic Hash Functions Kuchling *************** *** 185,188 **** --- 187,191 ---- Drake, Fred fdrake@acm.org Dubois, Paul F. paul@pfdubois.com + Evans, Clark C. cce@clarkevans.com Hylton, Jeremy jeremy@digicool.com Kuchling, Andrew akuchlin@mems-exchange.org From tim_one@users.sourceforge.net Thu Mar 29 03:34:45 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 28 Mar 2001 19:34:45 -0800 Subject: [Python-checkins] CVS: python/dist/src/Tools/idle PyShell.py,1.32,1.33 Message-ID: <E14iTCv-0004Ku-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv16407/python/dist/src/tools/idle Modified Files: PyShell.py Log Message: Initialize new save_warnings_filters data member in ModifiedInterpreter.__init__. Was getting mystery ModifiedInterpreter instance has no attribute 'save_warnings_filters' errors at odd times (for sure in a fresh IDLE, fresh file, then Run Script). Index: PyShell.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/PyShell.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -r1.32 -r1.33 *** PyShell.py 2001/03/26 17:41:35 1.32 --- PyShell.py 2001/03/29 03:34:43 1.33 *************** *** 158,161 **** --- 158,162 ---- locals = sys.modules['__main__'].__dict__ InteractiveInterpreter.__init__(self, locals=locals) + self.save_warnings_filters = None gid = 0 From tim_one@users.sourceforge.net Thu Mar 29 04:36:11 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 28 Mar 2001 20:36:11 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_pty.py,1.11,1.12 test_zipfile.py,1.4,1.5 Message-ID: <E14iUAN-00060S-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv23058/python/dist/src/Lib/test Modified Files: test_pty.py test_zipfile.py Log Message: Whitespace normalization. Index: test_pty.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pty.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** test_pty.py 2001/03/22 14:50:24 1.11 --- test_pty.py 2001/03/29 04:36:09 1.12 *************** *** 61,65 **** # After pty.fork(), the child should already be a session leader. ! # (on those systems that have that concept.) debug("In child, calling os.setsid()") try: --- 61,65 ---- # After pty.fork(), the child should already be a session leader. ! # (on those systems that have that concept.) debug("In child, calling os.setsid()") try: Index: test_zipfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_zipfile.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** test_zipfile.py 2001/03/26 15:49:24 1.4 --- test_zipfile.py 2001/03/29 04:36:09 1.5 *************** *** 11,20 **** zip.write(srcname, srcname) zip.close() ! zip = zipfile.ZipFile(f, "r", compression) # Read the ZIP archive readData2 = zip.read(srcname) readData1 = zip.read("another.name") zip.close() ! if readData1 != srccontents or readData2 != srccontents: raise TestFailed, "Written data doesn't equal read data." --- 11,20 ---- zip.write(srcname, srcname) zip.close() ! zip = zipfile.ZipFile(f, "r", compression) # Read the ZIP archive readData2 = zip.read(srcname) readData1 = zip.read("another.name") zip.close() ! if readData1 != srccontents or readData2 != srccontents: raise TestFailed, "Written data doesn't equal read data." *************** *** 26,34 **** fp.write("Test of zipfile line %d.\n" % i) fp.close() ! fp = open(srcname, "rb") writtenData = fp.read() fp.close() ! for file in (zipname, tempfile.TemporaryFile(), StringIO.StringIO()): zipTest(file, zipfile.ZIP_STORED, writtenData) --- 26,34 ---- fp.write("Test of zipfile line %d.\n" % i) fp.close() ! fp = open(srcname, "rb") writtenData = fp.read() fp.close() ! for file in (zipname, tempfile.TemporaryFile(), StringIO.StringIO()): zipTest(file, zipfile.ZIP_STORED, writtenData) From tim_one@users.sourceforge.net Thu Mar 29 04:36:11 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 28 Mar 2001 20:36:11 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib socket.py,1.10,1.11 symtable.py,1.2,1.3 traceback.py,1.24,1.25 unittest.py,1.2,1.3 zipfile.py,1.9,1.10 Message-ID: <E14iUAN-00060O-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv23058/python/dist/src/Lib Modified Files: socket.py symtable.py traceback.py unittest.py zipfile.py Log Message: Whitespace normalization. Index: socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/socket.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** socket.py 2001/03/22 22:12:17 1.10 --- socket.py 2001/03/29 04:36:08 1.11 *************** *** 64,68 **** if hasattr(sock, "_sock"): sock = sock._sock ! return _realsslcall(sock, keyfile, certfile) --- 64,68 ---- if hasattr(sock, "_sock"): sock = sock._sock ! return _realsslcall(sock, keyfile, certfile) Index: symtable.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/symtable.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** symtable.py 2001/03/23 15:41:14 1.2 --- symtable.py 2001/03/29 04:36:08 1.3 *************** *** 35,39 **** newSymbolTable = SymbolTableFactory() ! def bool(x): """Helper to force boolean result to 1 or 0""" --- 35,39 ---- newSymbolTable = SymbolTableFactory() ! def bool(x): """Helper to force boolean result to 1 or 0""" *************** *** 61,65 **** else: kind = "%s " % self.__class__.__name__ ! if self._table.name == "global": return "<%sSymbolTable for module %s>" % (kind, self._filename) --- 61,65 ---- else: kind = "%s " % self.__class__.__name__ ! if self._table.name == "global": return "<%sSymbolTable for module %s>" % (kind, self._filename) *************** *** 144,148 **** self.__locals = self.__idents_matching(lambda x:x & DEF_BOUND) return self.__locals ! def get_globals(self): if self.__globals is None: --- 144,148 ---- self.__locals = self.__idents_matching(lambda x:x & DEF_BOUND) return self.__locals ! def get_globals(self): if self.__globals is None: *************** *** 187,191 **** def is_global(self): ! return bool((self.__flags & DEF_GLOBAL) or (self.__flags & DEF_FREE_GLOBAL)) --- 187,191 ---- def is_global(self): ! return bool((self.__flags & DEF_GLOBAL) or (self.__flags & DEF_FREE_GLOBAL)) Index: traceback.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/traceback.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -r1.24 -r1.25 *** traceback.py 2001/03/21 20:29:18 1.24 --- traceback.py 2001/03/29 04:36:08 1.25 *************** *** 222,226 **** def print_stack(f=None, limit=None, file=None): """Print a stack trace from its invocation point. ! The optional 'f' argument can be used to specify an alternate stack frame at which to start. The optional 'limit' and 'file' --- 222,226 ---- def print_stack(f=None, limit=None, file=None): """Print a stack trace from its invocation point. ! The optional 'f' argument can be used to specify an alternate stack frame at which to start. The optional 'limit' and 'file' Index: unittest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/unittest.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** unittest.py 2001/03/22 08:45:36 1.2 --- unittest.py 2001/03/29 04:36:08 1.3 *************** *** 104,108 **** "Indicates that the tests should be aborted" self.shouldStop = 1 ! def __repr__(self): return "<%s run=%i errors=%i failures=%i>" % \ --- 104,108 ---- "Indicates that the tests should be aborted" self.shouldStop = 1 ! def __repr__(self): return "<%s run=%i errors=%i failures=%i>" % \ *************** *** 117,126 **** 'runTest'. ! If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute. ! Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test's environment ('fixture') can be implemented by overriding the 'setUp' and 'tearDown' methods respectively. --- 117,126 ---- 'runTest'. ! If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute. ! Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test's environment ('fixture') can be implemented by overriding the 'setUp' and 'tearDown' methods respectively. *************** *** 481,485 **** if args: apply(self.write, args) self.write('\n') # text-mode streams translate to \r\n if needed ! class _TextTestResult(TestResult): --- 481,485 ---- if args: apply(self.write, args) self.write('\n') # text-mode streams translate to \r\n if needed ! class _TextTestResult(TestResult): *************** *** 551,555 **** class TextTestRunner: """A test runner class that displays results in textual form. ! It prints out the names of tests as they are run, errors as they occur, and a summary of the results at the end of the test run. --- 551,555 ---- class TextTestRunner: """A test runner class that displays results in textual form. ! It prints out the names of tests as they are run, errors as they occur, and a summary of the results at the end of the test run. *************** *** 588,592 **** self.stream.writeln("OK") return result ! --- 588,592 ---- self.stream.writeln("OK") return result ! *************** *** 669,673 **** self.testRunner = TextTestRunner(verbosity=self.verbosity) result = self.testRunner.run(self.test) ! sys.exit(not result.wasSuccessful()) main = TestProgram --- 669,673 ---- self.testRunner = TextTestRunner(verbosity=self.verbosity) result = self.testRunner.run(self.test) ! sys.exit(not result.wasSuccessful()) main = TestProgram Index: zipfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/zipfile.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** zipfile.py 2001/03/26 15:49:24 1.9 --- zipfile.py 2001/03/29 04:36:08 1.10 *************** *** 132,139 **** class ZipFile: ! """ Class with methods to open, read, write, close, list zip files. ! z = ZipFile(file, mode="r", compression=ZIP_STORED) ! file: Either the path to the file, or a file-like object. If it is a path, the file will be opened and closed by ZipFile. --- 132,139 ---- class ZipFile: ! """ Class with methods to open, read, write, close, list zip files. ! z = ZipFile(file, mode="r", compression=ZIP_STORED) ! file: Either the path to the file, or a file-like object. If it is a path, the file will be opened and closed by ZipFile. *************** *** 159,163 **** self.compression = compression # Method of compression self.mode = key = mode[0] ! # Check if we were passed a file-like object if type(file) in _STRING_TYPES: --- 159,163 ---- self.compression = compression # Method of compression self.mode = key = mode[0] ! # Check if we were passed a file-like object if type(file) in _STRING_TYPES: *************** *** 170,174 **** self.fp = file self.filename = getattr(file, 'name', None) ! if key == 'r': self._GetContents() --- 170,174 ---- self.fp = file self.filename = getattr(file, 'name', None) ! if key == 'r': self._GetContents() From bwarsaw@users.sourceforge.net Thu Mar 29 14:43:13 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Thu, 29 Mar 2001 06:43:13 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0246.txt,1.1,1.2 Message-ID: <E14iddp-0003FA-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv12458 Modified Files: pep-0246.txt Log Message: Updated Post-History: Index: pep-0246.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0246.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** pep-0246.txt 2001/03/29 03:12:47 1.1 --- pep-0246.txt 2001/03/29 14:43:11 1.2 *************** *** 7,10 **** --- 7,11 ---- Created: 21-Mar-2001 Python-Version: 2.2 + Post-History: 29-Mar-2001 From lemburg@users.sourceforge.net Thu Mar 29 17:00:17 2001 From: lemburg@users.sourceforge.net (M.-A. Lemburg) Date: Thu, 29 Mar 2001 09:00:17 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0248.txt,NONE,1.1 pep-0249.txt,NONE,1.1 Message-ID: <E14ifmT-0001BV-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv4288 Added Files: pep-0248.txt pep-0249.txt Log Message: Added PEP 248 and 249 which define the Python Database API Specifications version 1.0 and 2.0 resp. --- NEW FILE: pep-0248.txt --- PEP: 248 Title: Python Database API Specification v1.0 Version: $Revision: 1.1 $ Author: db-sig@python.org (Python Database SIG) Editor: mal@lemburg.com (Marc-Andre Lemburg) Status: Draft Type: Informational Introduction This API has been defined to encourage similarity between the Python modules that are used to access databases. By doing this, we hope to achieve a consistency leading to more easily understood modules, code that is generally more portable across databases, and a broader reach of database connectivity from Python. This interface specification consists of several items: * Module Interface * Connection Objects * Cursor Objects * DBI Helper Objects Comments and questions about this specification may be directed to the SIG on Tabular Databases in Python (http://www.python.org/sigs/db-sig). This specification document was last updated on: April 9, 1996. It will be known as Version 1.0 of this specification. Module Interface The database interface modules should typically be named with something terminated by 'db'. Existing examples are: 'oracledb', 'informixdb', and 'pg95db'. These modules should export several names: modulename(connection_string) Constructor for creating a connection to the database. Returns a Connection Object. error Exception raise for errors from the database module. Connection Objects Connection Objects should respond to the following methods: close() Close the connection now (rather than whenever __del__ is called). The connection will be unusable from this point forward; an exception will be raised if any operation is attempted with the connection. commit() Commit any pending transaction to the database. rollback() Roll the database back to the start of any pending transaction. cursor() Return a new Cursor Object. An exception may be thrown if the database does not support a cursor concept. callproc([params]) (Note: this method is not well-defined yet.) Call a stored database procedure with the given (optional) parameters. Returns the result of the stored procedure. (all Cursor Object attributes and methods) For databases that do not have cursors and for simple applications that do not require the complexity of a cursor, a Connection Object should respond to each of the attributes and methods of the Cursor Object. Databases that have cursor can implement this by using an implicit, internal cursor. Cursor Objects These objects represent a database cursor, which is used to manage the context of a fetch operation. Cursor Objects should respond to the following methods and attributes: arraysize This read/write attribute specifies the number of rows to fetch at a time with fetchmany(). This value is also used when inserting multiple rows at a time (passing a tuple/list of tuples/lists as the params value to execute()). This attribute will default to a single row. Note that the arraysize is optional and is merely provided for higher performance database interactions. Implementations should observe it with respect to the fetchmany() method, but are free to interact with the database a single row at a time. description This read-only attribute is a tuple of 7-tuples. Each 7-tuple contains information describing each result column: (name, type_code, display_size, internal_size, precision, scale, null_ok). This attribute will be None for operations that do not return rows or if the cursor has not had an operation invoked via the execute() method yet. The 'type_code' is one of the 'dbi' values specified in the section below. Note: this is a bit in flux. Generally, the first two items of the 7-tuple will always be present; the others may be database specific. close() Close the cursor now (rather than whenever __del__ is called). The cursor will be unusable from this point forward; an exception will be raised if any operation is attempted with the cursor. execute(operation [,params]) Execute (prepare) a database operation (query or command). Parameters may be provided (as a sequence (e.g. tuple/list)) and will be bound to variables in the operation. Variables are specified in a database-specific notation that is based on the index in the parameter tuple (position-based rather than name-based). The parameters may also be specified as a sequence of sequences (e.g. a list of tuples) to insert multiple rows in a single operation. A reference to the operation will be retained by the cursor. If the same operation object is passed in again, then the cursor can optimize its behavior. This is most effective for algorithms where the same operation is used, but different parameters are bound to it (many times). For maximum efficiency when reusing an operation, it is best to use the setinputsizes() method to specify the parameter types and sizes ahead of time. It is legal for a parameter to not match the predefined information; the implementation should compensate, possibly with a loss of efficiency. Using SQL terminology, these are the possible result values from the execute() method: If the statement is DDL (e.g. CREATE TABLE), then 1 is returned. If the statement is DML (e.g. UPDATE or INSERT), then the number of rows affected is returned (0 or a positive integer). If the statement is DQL (e.g. SELECT), None is returned, indicating that the statement is not really complete until you use one of the 'fetch' methods. fetchone() Fetch the next row of a query result, returning a single tuple. fetchmany([size]) Fetch the next set of rows of a query result, returning as a list of tuples. An empty list is returned when no more rows are available. The number of rows to fetch is specified by the parameter. If it is None, then the cursor's arraysize determines the number of rows to be fetched. Note there are performance considerations involved with the size parameter. For optimal performance, it is usually best to use the arraysize attribute. If the size parameter is used, then it is best for it to retain the same value from one fetchmany() call to the next. fetchall() Fetch all rows of a query result, returning as a list of tuples. Note that the cursor's arraysize attribute can affect the performance of this operation. setinputsizes(sizes) (Note: this method is not well-defined yet.) This can be used before a call to 'execute()' to predefine memory areas for the operation's parameters. sizes is specified as a tuple -- one item for each input parameter. The item should be a Type object that corresponds to the input that will be used, or it should be an integer specifying the maximum length of a string parameter. If the item is 'None', then no predefined memory area will be reserved for that column (this is useful to avoid predefined areas for large inputs). This method would be used before the execute() method is invoked. Note that this method is optional and is merely provided for higher performance database interaction. Implementations are free to do nothing and users are free to not use it. setoutputsize(size [,col]) (Note: this method is not well-defined yet.) Set a column buffer size for fetches of large columns (e.g. LONG). The column is specified as an index into the result tuple. Using a column of None will set the default size for all large columns in the cursor. This method would be used before the 'execute()' method is invoked. Note that this method is optional and is merely provided for higher performance database interaction. Implementations are free to do nothing and users are free to not use it. DBI Helper Objects Many databases need to have the input in a particular format for binding to an operation's input parameters. For example, if an input is destined for a DATE column, then it must be bound to the database in a particular string format. Similar problems exist for "Row ID" columns or large binary items (e.g. blobs or RAW columns). This presents problems for Python since the parameters to the 'execute()' method are untyped. When the database module sees a Python string object, it doesn't know if it should be bound as a simple CHAR column, as a raw binary item, or as a DATE. To overcome this problem, the 'dbi' module was created. This module specifies some basic database interface types for working with databases. There are two classes: 'dbiDate' and 'dbiRaw'. These are simple container classes that wrap up a value. When passed to the database modules, the module can then detect that the input parameter is intended as a DATE or a RAW. For symmetry, the database modules will return DATE and RAW columns as instances of these classes. A Cursor Object's 'description' attribute returns information about each of the result columns of a query. The 'type_code is defined to be one of five types exported by this module: 'STRING', 'RAW', 'NUMBER', 'DATE', or 'ROWID'. The module exports the following names: dbiDate(value) This function constructs a 'dbiDate' instance that holds a date value. The value should be specified as an integer number of seconds since the "epoch" (e.g. time.time()). dbiRaw(value) This function constructs a 'dbiRaw' instance that holds a raw (binary) value. The value should be specified as a Python string. STRING This object is used to describe columns in a database that are string-based (e.g. CHAR). RAW This object is used to describe (large) binary columns in a database (e.g. LONG RAW, blobs). NUMBER This object is used to describe numeric columns in a database. DATE This object is used to describe date columns in a database. ROWID This object is used to describe the "Row ID" column in a database. Acknowledgements Many thanks go to Andrew Kuchling who converted the Python Database API Specification 1.0 from the original HTML format into the PEP format. Copyright This document has been placed in the Public Domain. Local Variables: mode: indented-text indent-tabs-mode: nil End: --- NEW FILE: pep-0249.txt --- PEP: 249 Title: Python Database API Specification v2.0 Version: $Revision: 1.1 $ Author: db-sig@python.org (Python Database SIG) Editor: mal@lemburg.com (Marc-Andre Lemburg) Status: Draft Type: Informational Introduction This API has been defined to encourage similarity between the Python modules that are used to access databases. By doing this, we hope to achieve a consistency leading to more easily understood modules, code that is generally more portable across databases, and a broader reach of database connectivity from Python. The interface specification consists of several sections: * Module Interface * Connection Objects * Cursor Objects * DBI Helper Objects * Type Objects and Constructors * Implementation Hints * Major Changes from 1.0 to 2.0 Comments and questions about this specification may be directed to the SIG for Database Interfacing with Python (db-sig@python.org). For more information on database interfacing with Python and available packages see the Database Topic Guide at http://www.python.org/topics/database/. This document describes the Python Database API Specification 2.0. The previous version 1.0 version is still available as reference, in PEP XXX. Package writers are encouraged to use this version of the specification as basis for new interfaces. Module Interface Access to the database is made available through connection objects. The module must provide the following constructor for these: connect(parameters...) Constructor for creating a connection to the database. Returns a Connection Object. It takes a number of parameters which are database dependent. [1] These module globals must be defined: apilevel String constant stating the supported DB API level. Currently only the strings '1.0' and '2.0' are allowed. If not given, a DB-API 1.0 level interface should be assumed. threadsafety Integer constant stating the level of thread safety the interface supports. Possible values are: 0 Threads may not share the module. 1 Threads may share the module, but not connections. 2 Threads may share the module and connections. 3 Threads may share the module, connections and cursors. Sharing in the above context means that two threads may use a resource without wrapping it using a mutex semaphore to implement resource locking. Note that you cannot always make external resources thread safe by managing access using a mutex: the resource may rely on global variables or other external sources that are beyond your control. paramstyle String constant stating the type of parameter marker formatting expected by the interface. Possible values are [2]: 'qmark' Question mark style, e.g. '...WHERE name=?' 'numeric' Numeric, positional style, e.g. '...WHERE name=:1' 'named' Named style, e.g. '...WHERE name=:name' 'format' ANSI C printf format codes, e.g. '...WHERE name=%s' 'pyformat' Python extended format codes, e.g. '...WHERE name=%(name)s' The module should make all error information available through these exceptions or subclasses thereof: Warning Exception raised for important warnings like data truncations while inserting, etc. It must be a subclass of the Python StandardError (defined in the module exceptions). Error Exception that is the base class of all other error exceptions. You can use this to catch all errors with one single 'except' statement. Warnings are not considered errors and thus should not use this class as base. It must be a subclass of the Python StandardError (defined in the module exceptions). InterfaceError Exception raised for errors that are related to the database interface rather than the database itself. It must be a subclass of Error. DatabaseError Exception raised for errors that are related to the database. It must be a subclass of Error. DataError Exception raised for errors that are due to problems with the processed data like division by zero, numeric value out of range, etc. It must be a subclass of DatabaseError. OperationalError Exception raised for errors that are related to the database's operation and not necessarily under the control of the programmer, e.g. an unexpected disconnect occurs, the data source name is not found, a transaction could not be processed, a memory allocation error occurred during processing, etc. It must be a subclass of DatabaseError. IntegrityError Exception raised when the relational integrity of the database is affected, e.g. a foreign key check fails. It must be a subclass of DatabaseError. InternalError Exception raised when the database encounters an internal error, e.g. the cursor is not valid anymore, the transaction is out of sync, etc. It must be a subclass of DatabaseError. ProgrammingError Exception raised for programming errors, e.g. table not found or already exists, syntax error in the SQL statement, wrong number of parameters specified, etc. It must be a subclass of DatabaseError. NotSupportedError Exception raised in case a method or database API was used which is not supported by the database, e.g. requesting a .rollback() on a connection that does not support transaction or has transactions turned off. It must be a subclass of DatabaseError. This is the exception inheritance layout: StandardError |__Warning |__Error |__InterfaceError |__DatabaseError |__DataError |__OperationalError |__IntegrityError |__InternalError |__ProgrammingError |__NotSupportedError Note: The values of these exceptions are not defined. They should give the user a fairly good idea of what went wrong, though. Connection Objects Connection Objects should respond to the following methods: close() Close the connection now (rather than whenever __del__ is called). The connection will be unusable from this point forward; an Error (or subclass) exception will be raised if any operation is attempted with the connection. The same applies to all cursor objects trying to use the connection. commit() Commit any pending transaction to the database. Note that if the database supports an auto-commit feature, this must be initially off. An interface method may be provided to turn it back on. Database modules that do not support transactions should implement this method with void functionality. rollback() This method is optional since not all databases provide transaction support. [3] In case a database does provide transactions this method causes the the database to roll back to the start of any pending transaction. Closing a connection without committing the changes first will cause an implicit rollback to be performed. cursor() Return a new Cursor Object using the connection. If the database does not provide a direct cursor concept, the module will have to emulate cursors using other means to the extent needed by this specification. [4] Cursor Objects These objects represent a database cursor, which is used to manage the context of a fetch operation. Cursor Objects should respond to the following methods and attributes: description This read-only attribute is a sequence of 7-item sequences. Each of these sequences contains information describing one result column: (name, type_code, display_size, internal_size, precision, scale, null_ok). This attribute will be None for operations that do not return rows or if the cursor has not had an operation invoked via the executeXXX() method yet. The type_code can be interpreted by comparing it to the Type Objects specified in the section below. rowcount This read-only attribute specifies the number of rows that the last executeXXX() produced (for DQL statements like 'select') or affected (for DML statements like 'update' or 'insert'). The attribute is -1 in case no executeXXX() has been performed on the cursor or the rowcount of the last operation is not determinable by the interface. [7] callproc(procname[,parameters]) (This method is optional since not all databases provide stored procedures. [3]) Call a stored database procedure with the given name. The sequence of parameters must contain one entry for each argument that the procedure expects. The result of the call is returned as modified copy of the input sequence. Input parameters are left untouched, output and input/output parameters replaced with possibly new values. The procedure may also provide a result set as output. This must then be made available through the standard fetchXXX() methods. close() Close the cursor now (rather than whenever __del__ is called). The cursor will be unusable from this point forward; an Error (or subclass) exception will be raised if any operation is attempted with the cursor. execute(operation[,parameters]) Prepare and execute a database operation (query or command). Parameters may be provided as sequence or mapping and will be bound to variables in the operation. Variables are specified in a database-specific notation (see the module's paramstyle attribute for details). [5] A reference to the operation will be retained by the cursor. If the same operation object is passed in again, then the cursor can optimize its behavior. This is most effective for algorithms where the same operation is used, but different parameters are bound to it (many times). For maximum efficiency when reusing an operation, it is best to use the setinputsizes() method to specify the parameter types and sizes ahead of time. It is legal for a parameter to not match the predefined information; the implementation should compensate, possibly with a loss of efficiency. The parameters may also be specified as list of tuples to e.g. insert multiple rows in a single operation, but this kind of usage is depreciated: executemany() should be used instead. Return values are not defined. executemany(operation,seq_of_parameters) Prepare a database operation (query or command) and then execute it against all parameter sequences or mappings found in the sequence seq_of_parameters. Modules are free to implement this method using multiple calls to the execute() method or by using array operations to have the database process the sequence as a whole in one call. The same comments as for execute() also apply accordingly to this method. Return values are not defined. fetchone() Fetch the next row of a query result set, returning a single sequence, or None when no more data is available. [6] An Error (or subclass) exception is raised if the previous call to executeXXX() did not produce any result set or no call was issued yet. fetchmany([size=cursor.arraysize]) Fetch the next set of rows of a query result, returning a sequence of sequences (e.g. a list of tuples). An empty sequence is returned when no more rows are available. The number of rows to fetch per call is specified by the parameter. If it is not given, the cursor's arraysize determines the number of rows to be fetched. The method should try to fetch as many rows as indicated by the size parameter. If this is not possible due to the specified number of rows not being available, fewer rows may be returned. An Error (or subclass) exception is raised if the previous call to executeXXX() did not produce any result set or no call was issued yet. Note there are performance considerations involved with the size parameter. For optimal performance, it is usually best to use the arraysize attribute. If the size parameter is used, then it is best for it to retain the same value from one fetchmany() call to the next. fetchall() Fetch all (remaining) rows of a query result, returning them as a sequence of sequences (e.g. a list of tuples). Note that the cursor's arraysize attribute can affect the performance of this operation. An Error (or subclass) exception is raised if the previous call to executeXXX() did not produce any result set or no call was issued yet. nextset() (This method is optional since not all databases support multiple result sets. [3]) This method will make the cursor skip to the next available set, discarding any remaining rows from the current set. If there are no more sets, the method returns None. Otherwise, it returns a true value and subsequent calls to the fetch methods will return rows from the next result set. An Error (or subclass) exception is raised if the previous call to executeXXX() did not produce any result set or no call was issued yet. arraysize This read/write attribute specifies the number of rows to fetch at a time with fetchmany(). It defaults to 1 meaning to fetch a single row at a time. Implementations must observe this value with respect to the fetchmany() method, but are free to interact with the database a single row at a time. It may also be used in the implementation of executemany(). setinputsizes(sizes) This can be used before a call to executeXXX() to predefine memory areas for the operation's parameters. sizes is specified as a sequence -- one item for each input parameter. The item should be a Type Object that corresponds to the input that will be used, or it should be an integer specifying the maximum length of a string parameter. If the item is None, then no predefined memory area will be reserved for that column (this is useful to avoid predefined areas for large inputs). This method would be used before the executeXXX() method is invoked. Implementations are free to have this method do nothing and users are free to not use it. setoutputsize(size[,column]) Set a column buffer size for fetches of large columns (e.g. LONGs, BLOBs, etc.). The column is specified as an index into the result sequence. Not specifying the column will set the default size for all large columns in the cursor. This method would be used before the executeXXX() method is invoked. Implementations are free to have this method do nothing and users are free to not use it. Type Objects and Constructors Many databases need to have the input in a particular format for binding to an operation's input parameters. For example, if an input is destined for a DATE column, then it must be bound to the database in a particular string format. Similar problems exist for "Row ID" columns or large binary items (e.g. blobs or RAW columns). This presents problems for Python since the parameters to the executeXXX() method are untyped. When the database module sees a Python string object, it doesn't know if it should be bound as a simple CHAR column, as a raw BINARY item, or as a DATE. To overcome this problem, a module must provide the constructors defined below to create objects that can hold special values. When passed to the cursor methods, the module can then detect the proper type of the input parameter and bind it accordingly. A Cursor Object's description attribute returns information about each of the result columns of a query. The type_code must compare equal to one of Type Objects defined below. Type Objects may be equal to more than one type code (e.g. DATETIME could be equal to the type codes for date, time and timestamp columns; see the Implementation Hints below for details). The module exports the following constructors and singletons: Date(year,month,day) This function constructs an object holding a date value. Time(hour,minute,second) This function constructs an object holding a time value. Timestamp(year,month,day,hour,minute,second) This function constructs an object holding a time stamp value. DateFromTicks(ticks) This function constructs an object holding a date value from the given ticks value (number of seconds since the epoch; see the documentation of the standard Python time module for details). TimeFromTicks(ticks) This function constructs an object holding a time value from the given ticks value (number of seconds since the epoch; see the documentation of the standard Python time module for details). TimestampFromTicks(ticks) This function constructs an object holding a time stamp value from the given ticks value (number of seconds since the epoch; see the documentation of the standard Python time module for details). Binary(string) This function constructs an object capable of holding a binary (long) string value. STRING This type object is used to describe columns in a database that are string-based (e.g. CHAR). BINARY This type object is used to describe (long) binary columns in a database (e.g. LONG, RAW, BLOBs). NUMBER This type object is used to describe numeric columns in a database. DATETIME This type object is used to describe date/time columns in a database. ROWID This type object is used to describe the "Row ID" column in a database. SQL NULL values are represented by the Python None singleton on input and output. Note: Usage of Unix ticks for database interfacing can cause troubles because of the limited date range they cover. Implementation Hints * The preferred object types for the date/time objects are those defined in the mxDateTime package. It provides all necessary constructors and methods both at Python and C level. * The preferred object type for Binary objects are the buffer types available in standard Python starting with version 1.5.2. Please see the Python documentation for details. For information about the the C interface have a look at Include/bufferobject.h and Objects/bufferobject.c in the Python source distribution. * Here is a sample implementation of the Unix ticks based constructors for date/time delegating work to the generic constructors: import time def DateFromTicks(ticks): return apply(Date,time.localtime(ticks)[:3]) def TimeFromTicks(ticks): return apply(Time,time.localtime(ticks)[3:6]) def TimestampFromTicks(ticks): return apply(Timestamp,time.localtime(ticks)[:6]) * This Python class allows implementing the above type objects even though the description type code field yields multiple values for on type object: class DBAPITypeObject: def __init__(self,*values): self.values = values def __cmp__(self,other): if other in self.values: return 0 if other < self.values: return 1 else: return -1 The resulting type object compares equal to all values passed to the constructor. * Here is a snippet of Python code that implements the exception hierarchy defined above: import exceptions class Error(exceptions.StandardError): pass class Warning(exceptions.StandardError): pass class InterfaceError(Error): pass class DatabaseError(Error): pass class InternalError(DatabaseError): pass class OperationalError(DatabaseError): pass class ProgrammingError(DatabaseError): pass class IntegrityError(DatabaseError): pass class DataError(DatabaseError): pass class NotSupportedError(DatabaseError): pass In C you can use the PyErr_NewException(fullname, base, NULL) API to create the exception objects. Major Changes from Version 1.0 to Version 2.0 The Python Database API 2.0 introduces a few major changes compared to the 1.0 version. Because some of these changes will cause existing DB API 1.0 based scripts to break, the major version number was adjusted to reflect this change. These are the most important changes from 1.0 to 2.0: * The need for a separate dbi module was dropped and the functionality merged into the module interface itself. * New constructors and Type Objects were added for date/time values, the RAW Type Object was renamed to BINARY. The resulting set should cover all basic data types commonly found in modern SQL databases. * New constants (apilevel, threadlevel, paramstyle) and methods (executemany, nextset) were added to provide better database bindings. * The semantics of .callproc() needed to call stored procedures are now clearly defined. * The definition of the .execute() return value changed. Previously, the return value was based on the SQL statement type (which was hard to implement right) -- it is undefined now; use the more flexible .rowcount attribute instead. Modules are free to return the old style return values, but these are no longer mandated by the specification and should be considered database interface dependent. * Class based exceptions were incorporated into the specification. Module implementors are free to extend the exception layout defined in this specification by subclassing the defined exception classes. Open Issues Although the version 2.0 specification clarifies a lot of questions that were left open in the 1.0 version, there are still some remaining issues: * Define a useful return value for .nextset() for the case where a new result set is available. * Create a fixed point numeric type for use as loss-less monetary and decimal interchange format. Footnotes [1] As a guideline the connection constructor parameters should be implemented as keyword parameters for more intuitive use and follow this order of parameters: dsn Data source name as string user User name as string (optional) password Password as string (optional) host Hostname (optional) database Database name (optional) E.g. a connect could look like this: connect(dsn='myhost:MYDB',user='guido',password='234$') [2] Module implementors should prefer 'numeric', 'named' or 'pyformat' over the other formats because these offer more clarity and flexibility. [3] If the database does not support the functionality required by the method, the interface should throw an exception in case the method is used. The preferred approach is to not implement the method and thus have Python generate an AttributeError in case the method is requested. This allows the programmer to check for database capabilities using the standard hasattr() function. For some dynamically configured interfaces it may not be appropriate to require dynamically making the method available. These interfaces should then raise a NotSupportedError to indicate the non-ability to perform the roll back when the method is invoked. [4] a database interface may choose to support named cursors by allowing a string argument to the method. This feature is not part of the specification, since it complicates semantics of the .fetchXXX() methods. [5] The module will use the __getitem__ method of the parameters object to map either positions (integers) or names (strings) to parameter values. This allows for both sequences and mappings to be used as input. The term "bound" refers to the process of binding an input value to a database execution buffer. In practical terms, this means that the input value is directly used as a value in the operation. The client should not be required to "escape" the value so that it can be used -- the value should be equal to the actual database value. [6] Note that the interface may implement row fetching using arrays and other optimizations. It is not guaranteed that a call to this method will only move the associated cursor forward by one row. [7] The rowcount attribute may be coded in a way that updates its value dynamically. This can be useful for databases that return usable rowcount values only after the first call to a .fetchXXX() method. Acknowledgements Many thanks go to Andrew Kuchling who converted the Python Database API Specification 2.0 from the original HTML format into the PEP format. Copyright This document has been placed in the Public Domain. Local Variables: mode: indented-text indent-tabs-mode: nil End: From fdrake@users.sourceforge.net Thu Mar 29 18:24:10 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 29 Mar 2001 10:24:10 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/perl python.perl,1.95,1.96 Message-ID: <E14ih5e-0005Q3-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/perl In directory usw-pr-cvs1:/tmp/cvs-serv20821/perl Modified Files: python.perl Log Message: Remove the spurious space of uncertain origin from the output for function, method and constructor signatures. Suggested by Peter Funk on the Doc-SIG mailing list. Index: python.perl =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/perl/python.perl,v retrieving revision 1.95 retrieving revision 1.96 diff -C2 -r1.95 -r1.96 *** python.perl 2001/03/02 18:57:05 1.95 --- python.perl 2001/03/29 18:24:08 1.96 *************** *** 731,735 **** . "\n</div>"); } ! return "<dl><dt>$return_type <b>$idx</b> (<var>$arg_list</var>)\n<dd>" . $rcinfo . $_ --- 731,735 ---- . "\n</div>"); } ! return "<dl><dt>$return_type <b>$idx</b>(<var>$arg_list</var>)\n<dd>" . $rcinfo . $_ *************** *** 786,790 **** $idx =~ s/ \(.*\)//; $idx =~ s/\(\)<\/tt>/<\/tt>/; ! return "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>" . $_ . '</dl>'; } --- 786,790 ---- $idx =~ s/ \(.*\)//; $idx =~ s/\(\)<\/tt>/<\/tt>/; ! return "<dl><dt><b>$idx</b>(<var>$arg_list</var>)\n<dd>" . $_ . '</dl>'; } *************** *** 794,798 **** my $arg_list = convert_args(next_argument()); return "<dl><dt><b><tt class='function'>$function_name</tt></b>" ! . " (<var>$arg_list</var>)\n" . '<dd>' . $_ --- 794,798 ---- my $arg_list = convert_args(next_argument()); return "<dl><dt><b><tt class='function'>$function_name</tt></b>" ! . "(<var>$arg_list</var>)\n" . '<dd>' . $_ *************** *** 808,812 **** $prefix =~ s/\(\)//; ! return "<dt><b>$prefix</b> (<var>$arg_list</var>)\n<dd>" . $_; } --- 808,812 ---- $prefix =~ s/\(\)//; ! return "<dt><b>$prefix</b>(<var>$arg_list</var>)\n<dd>" . $_; } *************** *** 817,821 **** my $prefix = "<tt class='function'>$function_name</tt>"; ! return "<dt><b>$prefix</b> (<var>$arg_list</var>)\n<dd>" . $_; } --- 817,821 ---- my $prefix = "<tt class='function'>$function_name</tt>"; ! return "<dt><b>$prefix</b>(<var>$arg_list</var>)\n<dd>" . $_; } *************** *** 896,900 **** "<tt class='$what'>$THIS_CLASS</tt> ($what in $THIS_MODULE)" ); $idx =~ s/ \(.*\)//; ! return ("<dl><dt><b>$what $idx</b> (<var>$arg_list</var>)\n<dd>" . $_ . '</dl>'); --- 896,900 ---- "<tt class='$what'>$THIS_CLASS</tt> ($what in $THIS_MODULE)" ); $idx =~ s/ \(.*\)//; ! return ("<dl><dt><b>$what $idx</b>(<var>$arg_list</var>)\n<dd>" . $_ . '</dl>'); *************** *** 924,928 **** $idx =~ s/ \(.*\)//; $idx =~ s/\(\)//; ! return "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>" . $_ . '</dl>'; } --- 924,928 ---- $idx =~ s/ \(.*\)//; $idx =~ s/\(\)//; ! return "<dl><dt><b>$idx</b>(<var>$arg_list</var>)\n<dd>" . $_ . '</dl>'; } *************** *** 942,946 **** $idx =~ s/ \(.*\)//; $idx =~ s/\(\)//; ! return "<dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>" . $_; } --- 942,946 ---- $idx =~ s/ \(.*\)//; $idx =~ s/\(\)//; ! return "<dt><b>$idx</b>(<var>$arg_list</var>)\n<dd>" . $_; } *************** *** 952,956 **** my $method = next_argument(); my $arg_list = convert_args(next_argument()); ! return "<dt><b>$method</b> (<var>$arg_list</var>)\n<dd>" . $_; } --- 952,956 ---- my $method = next_argument(); my $arg_list = convert_args(next_argument()); ! return "<dt><b>$method</b>(<var>$arg_list</var>)\n<dd>" . $_; } *************** *** 961,965 **** my $method = next_argument(); my $arg_list = convert_args(next_argument()); ! return "<dl><dt><b>$method</b> (<var>$arg_list</var>)\n<dd>" . $_ . '</dl>'; --- 961,965 ---- my $method = next_argument(); my $arg_list = convert_args(next_argument()); ! return "<dl><dt><b>$method</b>(<var>$arg_list</var>)\n<dd>" . $_ . '</dl>'; From moshez@users.sourceforge.net Thu Mar 29 19:27:31 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Thu, 29 Mar 2001 11:27:31 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules _cursesmodule.c,2.39,2.39.2.1 Message-ID: <E14ii4x-0000T0-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv29130 Modified Files: Tag: release20-maint _cursesmodule.c Log Message: Yay! First fix I'm commiting on the way to 2.0.1 This is supposed to fix compilation problems of the curses module on SGI, and is based on the patch from 2.39 to 2.40 This should fix bug #116172 >From the 2.39->2.40 log: * Check for 'sgi' preprocessor symbol, not '__sgi__' * Surround individual character macros with #ifdef's, instead of making them all rely on STRICT_SYSV_CURSES Metacomment: this is as much to test procedures as it is to actually fix the bug. If you're a CVS wizard please look at the checkin message to see I'm commiting correctly, and e-mail me if not, and I'll do my best to back it out and reread the docos. Good luck to me. Index: _cursesmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_cursesmodule.c,v retrieving revision 2.39 retrieving revision 2.39.2.1 diff -C2 -r2.39 -r2.39.2.1 *** _cursesmodule.c 2000/09/01 03:46:16 2.39 --- _cursesmodule.c 2001/03/29 19:27:29 2.39.2.1 *************** *** 79,83 **** #endif ! #if defined(__sgi__) || defined(__sun__) #define STRICT_SYSV_CURSES /* Don't use ncurses extensions */ typedef chtype attr_t; /* No attr_t type is available */ --- 79,91 ---- #endif ! #ifdef sgi ! /* This prototype is in <term.h>, but including this header #defines ! many common symbols (such as "lines") which breaks the curses ! module in other ways. So the code will just specify an explicit ! prototype here. */ ! extern char *tigetstr(char *); ! #endif ! ! #if defined(sgi) || defined(__sun__) #define STRICT_SYSV_CURSES /* Don't use ncurses extensions */ typedef chtype attr_t; /* No attr_t type is available */ *************** *** 1740,1750 **** SetDictInt("ACS_SBSB", (ACS_VLINE)); SetDictInt("ACS_SSSS", (ACS_PLUS)); ! #ifndef STRICT_SYSV_CURSES ! /* The following are never available with strict SYSV curses */ SetDictInt("ACS_S3", (ACS_S3)); SetDictInt("ACS_LEQUAL", (ACS_LEQUAL)); SetDictInt("ACS_GEQUAL", (ACS_GEQUAL)); SetDictInt("ACS_PI", (ACS_PI)); SetDictInt("ACS_NEQUAL", (ACS_NEQUAL)); SetDictInt("ACS_STERLING", (ACS_STERLING)); #endif --- 1748,1772 ---- SetDictInt("ACS_SBSB", (ACS_VLINE)); SetDictInt("ACS_SSSS", (ACS_PLUS)); ! ! /* The following are never available with strict SYSV curses */ ! #ifdef ACS_S3 SetDictInt("ACS_S3", (ACS_S3)); + #endif + #ifdef ACS_S7 + SetDictInt("ACS_S7", (ACS_S7)); + #endif + #ifdef ACS_LEQUAL SetDictInt("ACS_LEQUAL", (ACS_LEQUAL)); + #endif + #ifdef ACS_GEQUAL SetDictInt("ACS_GEQUAL", (ACS_GEQUAL)); + #endif + #ifdef ACS_PI SetDictInt("ACS_PI", (ACS_PI)); + #endif + #ifdef ACS_NEQUAL SetDictInt("ACS_NEQUAL", (ACS_NEQUAL)); + #endif + #ifdef ACS_STERLING SetDictInt("ACS_STERLING", (ACS_STERLING)); #endif *************** *** 2271,2280 **** SetDictInt("A_CHARTEXT", A_CHARTEXT); SetDictInt("A_COLOR", A_COLOR); ! #ifndef STRICT_SYSV_CURSES SetDictInt("A_HORIZONTAL", A_HORIZONTAL); SetDictInt("A_LEFT", A_LEFT); SetDictInt("A_LOW", A_LOW); SetDictInt("A_RIGHT", A_RIGHT); SetDictInt("A_TOP", A_TOP); SetDictInt("A_VERTICAL", A_VERTICAL); #endif --- 2293,2314 ---- SetDictInt("A_CHARTEXT", A_CHARTEXT); SetDictInt("A_COLOR", A_COLOR); ! ! /* The following are never available with strict SYSV curses */ ! #ifdef A_HORIZONTAL SetDictInt("A_HORIZONTAL", A_HORIZONTAL); + #endif + #ifdef A_LEFT SetDictInt("A_LEFT", A_LEFT); + #endif + #ifdef A_LOW SetDictInt("A_LOW", A_LOW); + #endif + #ifdef A_RIGHT SetDictInt("A_RIGHT", A_RIGHT); + #endif + #ifdef A_TOP SetDictInt("A_TOP", A_TOP); + #endif + #ifdef A_VERTICAL SetDictInt("A_VERTICAL", A_VERTICAL); #endif From larsga@users.sourceforge.net Thu Mar 29 22:02:46 2001 From: larsga@users.sourceforge.net (Lars Marius Garshol) Date: Thu, 29 Mar 2001 14:02:46 -0800 Subject: [Python-checkins] CVS: test - Imported sources Message-ID: <E14ikVC-0000jB-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/test In directory usw-pr-cvs1:/tmp/cvs-serv993 Log Message: Importing xmlproc test suite. Status: Vendor Tag: LMG Release Tags: initial N test/api/run-test.py N test/api/unittest.py N test/api/xptest.py N test/api/base/nvp-extdtd.txt N test/api/base/nvp-no-extdtd.txt N test/api/base/validating.txt N test/api/docs/ext-pe.dtd N test/api/docs/doc.dtd N test/api/docs/doc.xml N test/api/docs/ext-pe2.dtd N test/cmd-line/run-test.py N test/cmd-line/baseline/test1.txt N test/cmd-line/baseline/test10.txt N test/cmd-line/baseline/test11.txt N test/cmd-line/baseline/test12.txt N test/cmd-line/baseline/test13.txt N test/cmd-line/baseline/test14.txt N test/cmd-line/baseline/test15.txt N test/cmd-line/baseline/test16.txt N test/cmd-line/baseline/test17.txt N test/cmd-line/baseline/test18.txt N test/cmd-line/baseline/test19.txt N test/cmd-line/baseline/test2.txt N test/cmd-line/baseline/test20.txt N test/cmd-line/baseline/test21.txt N test/cmd-line/baseline/test22.txt N test/cmd-line/baseline/test23.txt N test/cmd-line/baseline/test24.txt N test/cmd-line/baseline/test25.txt N test/cmd-line/baseline/test26.txt N test/cmd-line/baseline/test27.txt N test/cmd-line/baseline/test28.txt N test/cmd-line/baseline/test29.txt N test/cmd-line/baseline/test3.txt N test/cmd-line/baseline/test30.txt N test/cmd-line/baseline/test31.txt N test/cmd-line/baseline/test32.txt N test/cmd-line/baseline/test33.txt N test/cmd-line/baseline/test34.txt N test/cmd-line/baseline/test35.txt N test/cmd-line/baseline/test36.txt N test/cmd-line/baseline/test37.txt N test/cmd-line/baseline/test38.txt N test/cmd-line/baseline/test39.txt N test/cmd-line/baseline/test4.txt N test/cmd-line/baseline/test40.txt N test/cmd-line/baseline/test41.txt N test/cmd-line/baseline/test42.txt N test/cmd-line/baseline/test43.txt N test/cmd-line/baseline/test44.txt N test/cmd-line/baseline/test45.txt N test/cmd-line/baseline/test46.txt N test/cmd-line/baseline/test47.txt N test/cmd-line/baseline/test48.txt N test/cmd-line/baseline/test49.txt N test/cmd-line/baseline/test5.txt N test/cmd-line/baseline/test50.txt N test/cmd-line/baseline/test6.txt N test/cmd-line/baseline/test7.txt N test/cmd-line/baseline/test8.txt N test/cmd-line/baseline/test9.txt N test/cmd-line/in/catalog.soc N test/cmd-line/in/catalog.xml N test/cmd-line/in/catalog2.soc N test/cmd-line/in/catalog2.xml N test/cmd-line/in/catalog3.soc N test/cmd-line/in/catalog4.soc N test/cmd-line/in/doc.xml N test/cmd-line/in/doc2.xml N test/cmd-line/in/doc3.xml N test/cmd-line/in/doc4.xml N test/cmd-line/in/doc5.xml N test/cmd-line/in/doc6.xml N test/cmd-line/in/doc7.dtd N test/cmd-line/in/doc7.xml N test/cmd-line/in/nstest2.xml N test/cmd-line/in/nstest4.xml N test/oasis/xmlconf.xml N test/oasis/testcases.dtd N test/oasis/xmlconformance.xsl N test/oasis/xmlconf.htm N test/oasis/xmlconformance.msxsl N test/oasis/xmlconf-19990712.xml N test/oasis/xmlconf-19990712.htm N test/oasis/runtests.py N test/oasis/sun/cxml.html N test/oasis/sun/not-wf/attlist01.xml N test/oasis/sun/not-wf/attlist02.xml N test/oasis/sun/not-wf/attlist03.xml N test/oasis/sun/not-wf/attlist04.xml N test/oasis/sun/not-wf/attlist05.xml N test/oasis/sun/not-wf/attlist06.xml N test/oasis/sun/not-wf/attlist07.xml N test/oasis/sun/not-wf/attlist08.xml N test/oasis/sun/not-wf/attlist09.xml N test/oasis/sun/not-wf/attlist10.xml N test/oasis/sun/not-wf/attlist11.xml N test/oasis/sun/not-wf/cond.dtd N test/oasis/sun/not-wf/cond01.xml N test/oasis/sun/not-wf/cond02.xml N test/oasis/sun/not-wf/content01.xml N test/oasis/sun/not-wf/content02.xml N test/oasis/sun/not-wf/content03.xml N test/oasis/sun/not-wf/decl01.ent N test/oasis/sun/not-wf/decl01.xml N test/oasis/sun/not-wf/dtd00.xml N test/oasis/sun/not-wf/dtd01.xml N test/oasis/sun/not-wf/dtd02.xml N test/oasis/sun/not-wf/dtd03.xml N test/oasis/sun/not-wf/dtd04.xml N test/oasis/sun/not-wf/dtd05.xml N test/oasis/sun/not-wf/dtd07.dtd N test/oasis/sun/not-wf/dtd07.xml N test/oasis/sun/not-wf/element00.xml N test/oasis/sun/not-wf/element01.xml N test/oasis/sun/not-wf/element02.xml N test/oasis/sun/not-wf/element03.xml N test/oasis/sun/not-wf/element04.xml N test/oasis/sun/not-wf/encoding01.xml N test/oasis/sun/not-wf/encoding02.xml N test/oasis/sun/not-wf/encoding03.xml N test/oasis/sun/not-wf/encoding04.xml N test/oasis/sun/not-wf/encoding05.xml N test/oasis/sun/not-wf/encoding06.xml N test/oasis/sun/not-wf/encoding07.xml N test/oasis/sun/not-wf/lang01.xml N test/oasis/sun/not-wf/lang02.xml N test/oasis/sun/not-wf/lang03.xml N test/oasis/sun/not-wf/lang04.xml N test/oasis/sun/not-wf/lang05.xml N test/oasis/sun/not-wf/lang06.xml N test/oasis/sun/not-wf/pi.xml N test/oasis/sun/not-wf/pubid01.xml N test/oasis/sun/not-wf/pubid02.xml N test/oasis/sun/not-wf/pubid03.xml N test/oasis/sun/not-wf/pubid04.xml N test/oasis/sun/not-wf/pubid05.xml N test/oasis/sun/not-wf/sgml01.xml N test/oasis/sun/not-wf/sgml02.xml N test/oasis/sun/not-wf/sgml03.xml N test/oasis/sun/not-wf/sgml04.xml N test/oasis/sun/not-wf/sgml05.xml N test/oasis/sun/not-wf/sgml06.xml N test/oasis/sun/not-wf/sgml07.xml N test/oasis/sun/not-wf/sgml08.xml N test/oasis/sun/not-wf/sgml09.xml N test/oasis/sun/not-wf/sgml10.xml N test/oasis/sun/not-wf/sgml11.xml N test/oasis/sun/not-wf/sgml12.xml N test/oasis/sun/not-wf/sgml13.xml N test/oasis/sun/not-wf/uri01.xml N test/oasis/sun/not-wf/sun-not-wf.xml N test/oasis/sun/valid/dtd00.xml N test/oasis/sun/valid/dtd01.xml N test/oasis/sun/valid/dtdtest.dtd N test/oasis/sun/valid/element.xml N test/oasis/sun/valid/empty.xml N test/oasis/sun/valid/ext01.ent N test/oasis/sun/valid/ext01.xml N test/oasis/sun/valid/ext02.xml N test/oasis/sun/valid/not-sa01.xml N test/oasis/sun/valid/not-sa02.xml N test/oasis/sun/valid/not-sa03.xml N test/oasis/sun/valid/not-sa04.xml N test/oasis/sun/valid/notation01.dtd N test/oasis/sun/valid/notation01.xml N test/oasis/sun/valid/null.ent N test/oasis/sun/valid/optional.xml N test/oasis/sun/valid/pe00.dtd N test/oasis/sun/valid/pe00.xml N test/oasis/sun/valid/pe01.xml N test/oasis/sun/valid/pe02.xml N test/oasis/sun/valid/required00.xml N test/oasis/sun/valid/sa.dtd N test/oasis/sun/valid/sa01.xml N test/oasis/sun/valid/sa02.xml N test/oasis/sun/valid/sa03.xml N test/oasis/sun/valid/sa04.xml N test/oasis/sun/valid/sa05.xml N test/oasis/sun/valid/sgml01.xml N test/oasis/sun/valid/v-lang01.xml N test/oasis/sun/valid/v-lang02.xml N test/oasis/sun/valid/v-lang03.xml N test/oasis/sun/valid/v-lang04.xml N test/oasis/sun/valid/v-lang05.xml N test/oasis/sun/valid/v-lang06.xml N test/oasis/sun/valid/sun-valid.xml N test/oasis/sun/valid/out/dtd00.xml N test/oasis/sun/valid/out/dtd01.xml N test/oasis/sun/valid/out/element.xml N test/oasis/sun/valid/out/empty.xml N test/oasis/sun/valid/out/ext01.xml N test/oasis/sun/valid/out/ext02.xml N test/oasis/sun/valid/out/not-sa01.xml N test/oasis/sun/valid/out/not-sa02.xml N test/oasis/sun/valid/out/not-sa03.xml N test/oasis/sun/valid/out/not-sa04.xml N test/oasis/sun/valid/out/notation01.xml N test/oasis/sun/valid/out/optional.xml N test/oasis/sun/valid/out/pe00.xml N test/oasis/sun/valid/out/pe01.xml N test/oasis/sun/valid/out/pe02.xml N test/oasis/sun/valid/out/required00.xml N test/oasis/sun/valid/out/sa01.xml N test/oasis/sun/valid/out/sa02.xml N test/oasis/sun/valid/out/sa03.xml N test/oasis/sun/valid/out/sa04.xml N test/oasis/sun/valid/out/sa05.xml N test/oasis/sun/valid/out/sgml01.xml N test/oasis/sun/valid/out/v-lang01.xml N test/oasis/sun/valid/out/v-lang02.xml N test/oasis/sun/valid/out/v-lang03.xml N test/oasis/sun/valid/out/v-lang04.xml N test/oasis/sun/valid/out/v-lang05.xml N test/oasis/sun/valid/out/v-lang06.xml N test/oasis/sun/invalid/attr01.xml N test/oasis/sun/invalid/attr02.xml N test/oasis/sun/invalid/attr03.xml N test/oasis/sun/invalid/attr04.xml N test/oasis/sun/invalid/attr05.xml N test/oasis/sun/invalid/attr06.xml N test/oasis/sun/invalid/attr07.xml N test/oasis/sun/invalid/attr08.xml N test/oasis/sun/invalid/attr09.xml N test/oasis/sun/invalid/attr10.xml N test/oasis/sun/invalid/attr11.xml N test/oasis/sun/invalid/attr12.xml N test/oasis/sun/invalid/attr13.xml N test/oasis/sun/invalid/attr14.xml N test/oasis/sun/invalid/attr15.xml N test/oasis/sun/invalid/attr16.xml N test/oasis/sun/invalid/dtd01.xml N test/oasis/sun/invalid/dtd02.xml N test/oasis/sun/invalid/dtd03.xml N test/oasis/sun/invalid/dtd06.xml N test/oasis/sun/invalid/el01.xml N test/oasis/sun/invalid/el02.xml N test/oasis/sun/invalid/el03.xml N test/oasis/sun/invalid/el04.xml N test/oasis/sun/invalid/el05.xml N test/oasis/sun/invalid/el06.xml N test/oasis/sun/invalid/id01.xml N test/oasis/sun/invalid/id02.xml N test/oasis/sun/invalid/id03.xml N test/oasis/sun/invalid/id04.xml N test/oasis/sun/invalid/id05.xml N test/oasis/sun/invalid/id06.xml N test/oasis/sun/invalid/id07.xml N test/oasis/sun/invalid/id08.xml N test/oasis/sun/invalid/id09.xml N test/oasis/sun/invalid/not-sa01.xml N test/oasis/sun/invalid/not-sa02.xml N test/oasis/sun/invalid/not-sa03.xml N test/oasis/sun/invalid/not-sa04.xml N test/oasis/sun/invalid/not-sa05.xml N test/oasis/sun/invalid/not-sa06.xml N test/oasis/sun/invalid/not-sa07.xml N test/oasis/sun/invalid/not-sa08.xml N test/oasis/sun/invalid/not-sa09.xml N test/oasis/sun/invalid/not-sa10.xml N test/oasis/sun/invalid/not-sa11.xml N test/oasis/sun/invalid/not-sa12.xml N test/oasis/sun/invalid/not-sa13.xml N test/oasis/sun/invalid/not-sa14.xml N test/oasis/sun/invalid/optional01.xml N test/oasis/sun/invalid/optional02.xml N test/oasis/sun/invalid/optional03.xml N test/oasis/sun/invalid/optional04.xml N test/oasis/sun/invalid/optional05.xml N test/oasis/sun/invalid/optional06.xml N test/oasis/sun/invalid/optional07.xml N test/oasis/sun/invalid/optional08.xml N test/oasis/sun/invalid/optional09.xml N test/oasis/sun/invalid/optional10.xml N test/oasis/sun/invalid/optional11.xml N test/oasis/sun/invalid/optional12.xml N test/oasis/sun/invalid/optional13.xml N test/oasis/sun/invalid/optional14.xml N test/oasis/sun/invalid/optional15.xml N test/oasis/sun/invalid/optional16.xml N test/oasis/sun/invalid/optional17.xml N test/oasis/sun/invalid/optional18.xml N test/oasis/sun/invalid/optional19.xml N test/oasis/sun/invalid/optional20.xml N test/oasis/sun/invalid/optional21.xml N test/oasis/sun/invalid/optional22.xml N test/oasis/sun/invalid/optional23.xml N test/oasis/sun/invalid/optional24.xml N test/oasis/sun/invalid/optional25.xml N test/oasis/sun/invalid/pe01.dtd N test/oasis/sun/invalid/pe01.ent N test/oasis/sun/invalid/pe01.xml N test/oasis/sun/invalid/required00.xml N test/oasis/sun/invalid/required01.xml N test/oasis/sun/invalid/required02.xml N test/oasis/sun/invalid/root.xml N test/oasis/sun/invalid/utf16b.xml N test/oasis/sun/invalid/utf16l.xml N test/oasis/sun/invalid/sun-invalid.xml N test/oasis/sun/error/sun-error.xml N test/oasis/oasis/p01fail1.xml N test/oasis/oasis/p01fail2.xml N test/oasis/oasis/p01fail3.xml N test/oasis/oasis/p01fail4.xml N test/oasis/oasis/p01pass1.xml N test/oasis/oasis/p01pass2.xml N test/oasis/oasis/p01pass3.xml N test/oasis/oasis/p02fail1.xml N test/oasis/oasis/p02fail10.xml N test/oasis/oasis/p02fail11.xml N test/oasis/oasis/p02fail12.xml N test/oasis/oasis/p02fail13.xml N test/oasis/oasis/p02fail14.xml N test/oasis/oasis/p02fail15.xml N test/oasis/oasis/p02fail16.xml N test/oasis/oasis/p02fail17.xml N test/oasis/oasis/p02fail18.xml N test/oasis/oasis/p02fail19.xml N test/oasis/oasis/p02fail2.xml N test/oasis/oasis/p02fail20.xml N test/oasis/oasis/p02fail21.xml N test/oasis/oasis/p02fail22.xml N test/oasis/oasis/p02fail23.xml N test/oasis/oasis/p02fail24.xml N test/oasis/oasis/p02fail25.xml N test/oasis/oasis/p02fail26.xml N test/oasis/oasis/p02fail27.xml N test/oasis/oasis/p02fail28.xml N test/oasis/oasis/p02fail29.xml N test/oasis/oasis/p02fail3.xml N test/oasis/oasis/p02fail30.xml N test/oasis/oasis/p02fail31.xml N test/oasis/oasis/p02fail4.xml N test/oasis/oasis/p02fail5.xml N test/oasis/oasis/p02fail6.xml N test/oasis/oasis/p02fail7.xml N test/oasis/oasis/p02fail8.xml N test/oasis/oasis/p02fail9.xml N test/oasis/oasis/p02pass1.xml N test/oasis/oasis/p03fail1.xml N test/oasis/oasis/p03fail10.xml N test/oasis/oasis/p03fail11.xml N test/oasis/oasis/p03fail12.xml N test/oasis/oasis/p03fail13.xml N test/oasis/oasis/p03fail14.xml N test/oasis/oasis/p03fail15.xml N test/oasis/oasis/p03fail16.xml N test/oasis/oasis/p03fail17.xml N test/oasis/oasis/p03fail18.xml N test/oasis/oasis/p03fail19.xml N test/oasis/oasis/p03fail2.xml N test/oasis/oasis/p03fail20.xml N test/oasis/oasis/p03fail21.xml N test/oasis/oasis/p03fail22.xml N test/oasis/oasis/p03fail23.xml N test/oasis/oasis/p03fail24.xml N test/oasis/oasis/p03fail25.xml N test/oasis/oasis/p03fail26.xml N test/oasis/oasis/p03fail27.xml N test/oasis/oasis/p03fail28.xml N test/oasis/oasis/p03fail29.xml N test/oasis/oasis/p03fail3.xml N test/oasis/oasis/p03fail4.xml N test/oasis/oasis/p03fail5.xml N test/oasis/oasis/p03fail7.xml N test/oasis/oasis/p03fail8.xml N test/oasis/oasis/p03fail9.xml N test/oasis/oasis/p03pass1.xml N test/oasis/oasis/p04fail1.xml N test/oasis/oasis/p04fail2.xml N test/oasis/oasis/p04fail3.xml N test/oasis/oasis/p04pass1.xml N test/oasis/oasis/p05fail1.xml N test/oasis/oasis/p05fail2.xml N test/oasis/oasis/p05fail3.xml N test/oasis/oasis/p05fail4.xml N test/oasis/oasis/p05fail5.xml N test/oasis/oasis/p05pass1.xml N test/oasis/oasis/p06fail1.xml N test/oasis/oasis/p06pass1.xml N test/oasis/oasis/p07pass1.xml N test/oasis/oasis/p08fail1.xml N test/oasis/oasis/p08fail2.xml N test/oasis/oasis/p08pass1.xml N test/oasis/oasis/p09fail1.dtd N test/oasis/oasis/p09fail1.xml N test/oasis/oasis/p09fail2.dtd N test/oasis/oasis/p09fail2.xml N test/oasis/oasis/p09fail3.xml N test/oasis/oasis/p09fail4.xml N test/oasis/oasis/p09fail5.xml N test/oasis/oasis/p09pass1.dtd N test/oasis/oasis/p09pass1.xml N test/oasis/oasis/p10fail1.xml N test/oasis/oasis/p10fail2.xml N test/oasis/oasis/p10fail3.xml N test/oasis/oasis/p10pass1.xml N test/oasis/oasis/p11fail1.xml N test/oasis/oasis/p11fail2.xml N test/oasis/oasis/p11pass1.xml N test/oasis/oasis/p12fail1.xml N test/oasis/oasis/p12fail2.xml N test/oasis/oasis/p12fail3.xml N test/oasis/oasis/p12fail4.xml N test/oasis/oasis/p12fail5.xml N test/oasis/oasis/p12fail6.xml N test/oasis/oasis/p12fail7.xml N test/oasis/oasis/p12pass1.xml N test/oasis/oasis/p14fail1.xml N test/oasis/oasis/p14fail2.xml N test/oasis/oasis/p14fail3.xml N test/oasis/oasis/p14pass1.xml N test/oasis/oasis/p15fail1.xml N test/oasis/oasis/p15fail2.xml N test/oasis/oasis/p15fail3.xml N test/oasis/oasis/p15pass1.xml N test/oasis/oasis/p16fail1.xml N test/oasis/oasis/p16fail2.xml N test/oasis/oasis/p16fail3.xml N test/oasis/oasis/p16pass1.xml N test/oasis/oasis/p16pass2.xml N test/oasis/oasis/p16pass3.xml N test/oasis/oasis/p18fail1.xml N test/oasis/oasis/p18fail2.xml N test/oasis/oasis/p18fail3.xml N test/oasis/oasis/p18pass1.xml N test/oasis/oasis/p22fail1.xml N test/oasis/oasis/p22fail2.xml N test/oasis/oasis/p22pass1.xml N test/oasis/oasis/p22pass2.xml N test/oasis/oasis/p22pass3.xml N test/oasis/oasis/p22pass4.xml N test/oasis/oasis/p22pass5.xml N test/oasis/oasis/p22pass6.xml N test/oasis/oasis/p23fail1.xml N test/oasis/oasis/p23fail2.xml N test/oasis/oasis/p23fail3.xml N test/oasis/oasis/p23fail4.xml N test/oasis/oasis/p23fail5.xml N test/oasis/oasis/p23pass1.xml N test/oasis/oasis/p23pass2.xml N test/oasis/oasis/p23pass3.xml N test/oasis/oasis/p23pass4.xml N test/oasis/oasis/p24fail1.xml N test/oasis/oasis/p24fail2.xml N test/oasis/oasis/p24pass1.xml N test/oasis/oasis/p24pass2.xml N test/oasis/oasis/p24pass3.xml N test/oasis/oasis/p24pass4.xml N test/oasis/oasis/p25fail1.xml N test/oasis/oasis/p25pass1.xml N test/oasis/oasis/p25pass2.xml N test/oasis/oasis/p26fail1.xml N test/oasis/oasis/p26fail2.xml N test/oasis/oasis/p26pass1.xml N test/oasis/oasis/p27fail1.xml N test/oasis/oasis/p27pass1.xml N test/oasis/oasis/p27pass2.xml N test/oasis/oasis/p27pass3.xml N test/oasis/oasis/p27pass4.xml N test/oasis/oasis/p28fail1.xml N test/oasis/oasis/p28pass1.xml N test/oasis/oasis/p28pass2.xml N test/oasis/oasis/p28pass3.xml N test/oasis/oasis/p28pass4.dtd N test/oasis/oasis/p28pass4.xml N test/oasis/oasis/p28pass5.dtd N test/oasis/oasis/p28pass5.xml N test/oasis/oasis/p29fail1.xml N test/oasis/oasis/p29pass1.xml N test/oasis/oasis/p30fail1.dtd N test/oasis/oasis/p30fail1.xml N test/oasis/oasis/p30pass1.dtd N test/oasis/oasis/p30pass1.xml N test/oasis/oasis/p30pass2.dtd N test/oasis/oasis/p30pass2.xml N test/oasis/oasis/p31fail1.dtd N test/oasis/oasis/p31fail1.xml N test/oasis/oasis/p31pass1.dtd N test/oasis/oasis/p31pass1.xml N test/oasis/oasis/p31pass2.dtd N test/oasis/oasis/p31pass2.xml N test/oasis/oasis/p32fail1.xml N test/oasis/oasis/p32fail2.xml N test/oasis/oasis/p32fail3.xml N test/oasis/oasis/p32fail4.xml N test/oasis/oasis/p32fail5.xml N test/oasis/oasis/p32pass1.xml N test/oasis/oasis/p32pass2.xml N test/oasis/oasis/p39fail1.xml N test/oasis/oasis/p39fail2.xml N test/oasis/oasis/p39fail3.xml N test/oasis/oasis/p39fail4.xml N test/oasis/oasis/p39fail5.xml N test/oasis/oasis/p39pass1.xml N test/oasis/oasis/p39pass2.xml N test/oasis/oasis/p40fail1.xml N test/oasis/oasis/p40fail2.xml N test/oasis/oasis/p40fail3.xml N test/oasis/oasis/p40fail4.xml N test/oasis/oasis/p40pass1.xml N test/oasis/oasis/p40pass2.xml N test/oasis/oasis/p40pass3.xml N test/oasis/oasis/p40pass4.xml N test/oasis/oasis/p41fail1.xml N test/oasis/oasis/p41fail2.xml N test/oasis/oasis/p41fail3.xml N test/oasis/oasis/p41pass1.xml N test/oasis/oasis/p41pass2.xml N test/oasis/oasis/p42fail1.xml N test/oasis/oasis/p42fail2.xml N test/oasis/oasis/p42fail3.xml N test/oasis/oasis/p42pass1.xml N test/oasis/oasis/p42pass2.xml N test/oasis/oasis/p43fail1.xml N test/oasis/oasis/p43fail2.xml N test/oasis/oasis/p43fail3.xml N test/oasis/oasis/p43pass1.xml N test/oasis/oasis/p44fail1.xml N test/oasis/oasis/p44fail2.xml N test/oasis/oasis/p44fail3.xml N test/oasis/oasis/p44fail4.xml N test/oasis/oasis/p44fail5.xml N test/oasis/oasis/p44pass1.xml N test/oasis/oasis/p44pass2.xml N test/oasis/oasis/p44pass3.xml N test/oasis/oasis/p44pass4.xml N test/oasis/oasis/p44pass5.xml N test/oasis/oasis/p45fail1.xml N test/oasis/oasis/p45fail2.xml N test/oasis/oasis/p45fail3.xml N test/oasis/oasis/p45fail4.xml N test/oasis/oasis/p45pass1.xml N test/oasis/oasis/p46fail1.xml N test/oasis/oasis/p46fail2.xml N test/oasis/oasis/p46fail3.xml N test/oasis/oasis/p46fail4.xml N test/oasis/oasis/p46fail5.xml N test/oasis/oasis/p46fail6.xml N test/oasis/oasis/p46pass1.xml N test/oasis/oasis/p47fail1.xml N test/oasis/oasis/p47fail2.xml N test/oasis/oasis/p47fail3.xml N test/oasis/oasis/p47fail4.xml N test/oasis/oasis/p47pass1.xml N test/oasis/oasis/p48fail1.xml N test/oasis/oasis/p48fail2.xml N test/oasis/oasis/p48pass1.xml N test/oasis/oasis/p49fail1.xml N test/oasis/oasis/p49pass1.xml N test/oasis/oasis/p50fail1.xml N test/oasis/oasis/p50pass1.xml N test/oasis/oasis/p51fail1.xml N test/oasis/oasis/p51fail2.xml N test/oasis/oasis/p51fail3.xml N test/oasis/oasis/p51fail4.xml N test/oasis/oasis/p51fail5.xml N test/oasis/oasis/p51fail6.xml N test/oasis/oasis/p51fail7.xml N test/oasis/oasis/p51pass1.xml N test/oasis/oasis/p52fail1.xml N test/oasis/oasis/p52fail2.xml N test/oasis/oasis/p52pass1.xml N test/oasis/oasis/p53fail1.xml N test/oasis/oasis/p53fail2.xml N test/oasis/oasis/p53fail3.xml N test/oasis/oasis/p53fail4.xml N test/oasis/oasis/p53fail5.xml N test/oasis/oasis/p53pass1.xml N test/oasis/oasis/p54fail1.xml N test/oasis/oasis/p54pass1.xml N test/oasis/oasis/p55fail1.xml N test/oasis/oasis/p55pass1.xml N test/oasis/oasis/p56fail1.xml N test/oasis/oasis/p56fail2.xml N test/oasis/oasis/p56fail3.xml N test/oasis/oasis/p56fail4.xml N test/oasis/oasis/p56fail5.xml N test/oasis/oasis/p56pass1.xml N test/oasis/oasis/p57fail1.xml N test/oasis/oasis/p57pass1.xml N test/oasis/oasis/p58fail1.xml N test/oasis/oasis/p58fail2.xml N test/oasis/oasis/p58fail3.xml N test/oasis/oasis/p58fail4.xml N test/oasis/oasis/p58fail5.xml N test/oasis/oasis/p58fail6.xml N test/oasis/oasis/p58fail7.xml N test/oasis/oasis/p58fail8.xml N test/oasis/oasis/p58pass1.xml N test/oasis/oasis/p59fail1.xml N test/oasis/oasis/p59fail2.xml N test/oasis/oasis/p59fail3.xml N test/oasis/oasis/p59pass1.xml N test/oasis/oasis/p60fail1.xml N test/oasis/oasis/p60fail2.xml N test/oasis/oasis/p60fail3.xml N test/oasis/oasis/p60fail4.xml N test/oasis/oasis/p60fail5.xml N test/oasis/oasis/p60pass1.xml N test/oasis/oasis/p61fail1.dtd N test/oasis/oasis/p61fail1.xml N test/oasis/oasis/p61pass1.dtd N test/oasis/oasis/p61pass1.xml N test/oasis/oasis/p62fail1.dtd N test/oasis/oasis/p62fail1.xml N test/oasis/oasis/p62fail2.dtd N test/oasis/oasis/p62fail2.xml N test/oasis/oasis/p62pass1.dtd N test/oasis/oasis/p62pass1.xml N test/oasis/oasis/p63fail1.dtd N test/oasis/oasis/p63fail1.xml N test/oasis/oasis/p63fail2.dtd N test/oasis/oasis/p63fail2.xml N test/oasis/oasis/p63pass1.dtd N test/oasis/oasis/p63pass1.xml N test/oasis/oasis/p64fail1.dtd N test/oasis/oasis/p64fail1.xml N test/oasis/oasis/p64fail2.dtd N test/oasis/oasis/p64fail2.xml N test/oasis/oasis/p64pass1.dtd N test/oasis/oasis/p64pass1.xml N test/oasis/oasis/p66fail1.xml N test/oasis/oasis/p66fail2.xml N test/oasis/oasis/p66fail3.xml N test/oasis/oasis/p66fail4.xml N test/oasis/oasis/p66fail5.xml N test/oasis/oasis/p66fail6.xml N test/oasis/oasis/p66pass1.xml N test/oasis/oasis/p68fail1.xml N test/oasis/oasis/p68fail2.xml N test/oasis/oasis/p68fail3.xml N test/oasis/oasis/p68pass1.xml N test/oasis/oasis/p69fail1.xml N test/oasis/oasis/p69fail2.xml N test/oasis/oasis/p69fail3.xml N test/oasis/oasis/p69pass1.xml N test/oasis/oasis/p70fail1.xml N test/oasis/oasis/p70pass1.xml N test/oasis/oasis/p71fail1.xml N test/oasis/oasis/p71fail2.xml N test/oasis/oasis/p71fail3.xml N test/oasis/oasis/p71fail4.xml N test/oasis/oasis/p71pass1.xml N test/oasis/oasis/p72fail1.xml N test/oasis/oasis/p72fail2.xml N test/oasis/oasis/p72fail3.xml N test/oasis/oasis/p72fail4.xml N test/oasis/oasis/p72pass1.xml N test/oasis/oasis/p73fail1.xml N test/oasis/oasis/p73fail2.xml N test/oasis/oasis/p73fail3.xml N test/oasis/oasis/p73fail4.xml N test/oasis/oasis/p73fail5.xml N test/oasis/oasis/p73pass1.xml N test/oasis/oasis/p74fail1.xml N test/oasis/oasis/p74fail2.xml N test/oasis/oasis/p74fail3.xml N test/oasis/oasis/p74pass1.xml N test/oasis/oasis/p75fail1.xml N test/oasis/oasis/p75fail2.xml N test/oasis/oasis/p75fail3.xml N test/oasis/oasis/p75fail4.xml N test/oasis/oasis/p75fail5.xml N test/oasis/oasis/p75fail6.xml N test/oasis/oasis/p75pass1.xml N test/oasis/oasis/p76fail1.xml N test/oasis/oasis/p76fail2.xml N test/oasis/oasis/p76fail3.xml N test/oasis/oasis/p76fail4.xml N test/oasis/oasis/p76pass1.xml N test/oasis/oasis/oasis.xml N test/oasis/japanese/pr-xml-euc-jp.xml N test/oasis/japanese/pr-xml-iso-2022-jp.xml N test/oasis/japanese/pr-xml-little-endian.xml N test/oasis/japanese/pr-xml-shift_jis.xml N test/oasis/japanese/pr-xml-utf-16.xml N test/oasis/japanese/pr-xml-utf-8.xml N test/oasis/japanese/weekly-euc-jp.dtd N test/oasis/japanese/weekly-euc-jp.xml N test/oasis/japanese/weekly-iso-2022-jp.dtd N test/oasis/japanese/weekly-iso-2022-jp.xml N test/oasis/japanese/weekly-little-endian.xml N test/oasis/japanese/weekly-shift_jis.dtd N test/oasis/japanese/weekly-shift_jis.xml N test/oasis/japanese/weekly-utf-16.dtd N test/oasis/japanese/weekly-utf-16.xml N test/oasis/japanese/weekly-utf-8.dtd N test/oasis/japanese/weekly-utf-8.xml N test/oasis/japanese/japanese.xml N test/oasis/xmltest/readme.html N test/oasis/xmltest/canonxml.html N test/oasis/xmltest/xmltest.xml N test/oasis/xmltest/invalid/001.xml N test/oasis/xmltest/invalid/002.xml N test/oasis/xmltest/invalid/003.xml N test/oasis/xmltest/invalid/004.xml N test/oasis/xmltest/invalid/005.xml N test/oasis/xmltest/invalid/006.xml N test/oasis/xmltest/invalid/001.ent N test/oasis/xmltest/invalid/002.ent N test/oasis/xmltest/invalid/003.ent N test/oasis/xmltest/invalid/004.ent N test/oasis/xmltest/invalid/005.ent N test/oasis/xmltest/invalid/006.ent N test/oasis/xmltest/valid/not-sa/001.xml N test/oasis/xmltest/valid/not-sa/002.xml N test/oasis/xmltest/valid/not-sa/003.xml N test/oasis/xmltest/valid/not-sa/004.xml N test/oasis/xmltest/valid/not-sa/005.xml N test/oasis/xmltest/valid/not-sa/006.xml N test/oasis/xmltest/valid/not-sa/007.xml N test/oasis/xmltest/valid/not-sa/008.xml N test/oasis/xmltest/valid/not-sa/009.xml N test/oasis/xmltest/valid/not-sa/010.xml N test/oasis/xmltest/valid/not-sa/011.xml N test/oasis/xmltest/valid/not-sa/012.xml N test/oasis/xmltest/valid/not-sa/013.xml N test/oasis/xmltest/valid/not-sa/014.xml N test/oasis/xmltest/valid/not-sa/015.xml N test/oasis/xmltest/valid/not-sa/016.xml N test/oasis/xmltest/valid/not-sa/017.xml N test/oasis/xmltest/valid/not-sa/018.xml N test/oasis/xmltest/valid/not-sa/019.xml N test/oasis/xmltest/valid/not-sa/020.xml N test/oasis/xmltest/valid/not-sa/021.xml N test/oasis/xmltest/valid/not-sa/022.xml N test/oasis/xmltest/valid/not-sa/023.xml N test/oasis/xmltest/valid/not-sa/024.xml N test/oasis/xmltest/valid/not-sa/025.xml N test/oasis/xmltest/valid/not-sa/026.xml N test/oasis/xmltest/valid/not-sa/027.xml N test/oasis/xmltest/valid/not-sa/028.xml N test/oasis/xmltest/valid/not-sa/029.xml N test/oasis/xmltest/valid/not-sa/030.xml N test/oasis/xmltest/valid/not-sa/031.xml N test/oasis/xmltest/valid/not-sa/001.ent N test/oasis/xmltest/valid/not-sa/002.ent N test/oasis/xmltest/valid/not-sa/003-1.ent N test/oasis/xmltest/valid/not-sa/003-2.ent N test/oasis/xmltest/valid/not-sa/004-1.ent N test/oasis/xmltest/valid/not-sa/004-2.ent N test/oasis/xmltest/valid/not-sa/005-1.ent N test/oasis/xmltest/valid/not-sa/005-2.ent N test/oasis/xmltest/valid/not-sa/006.ent N test/oasis/xmltest/valid/not-sa/007.ent N test/oasis/xmltest/valid/not-sa/008.ent N test/oasis/xmltest/valid/not-sa/009.ent N test/oasis/xmltest/valid/not-sa/010.ent N test/oasis/xmltest/valid/not-sa/011.ent N test/oasis/xmltest/valid/not-sa/012.ent N test/oasis/xmltest/valid/not-sa/013.ent N test/oasis/xmltest/valid/not-sa/014.ent N test/oasis/xmltest/valid/not-sa/015.ent N test/oasis/xmltest/valid/not-sa/016.ent N test/oasis/xmltest/valid/not-sa/017.ent N test/oasis/xmltest/valid/not-sa/018.ent N test/oasis/xmltest/valid/not-sa/019.ent N test/oasis/xmltest/valid/not-sa/020.ent N test/oasis/xmltest/valid/not-sa/021.ent N test/oasis/xmltest/valid/not-sa/022.ent N test/oasis/xmltest/valid/not-sa/023.ent N test/oasis/xmltest/valid/not-sa/024.ent N test/oasis/xmltest/valid/not-sa/025.ent N test/oasis/xmltest/valid/not-sa/026.ent N test/oasis/xmltest/valid/not-sa/027.ent N test/oasis/xmltest/valid/not-sa/028.ent N test/oasis/xmltest/valid/not-sa/029.ent N test/oasis/xmltest/valid/not-sa/030.ent N test/oasis/xmltest/valid/not-sa/031-1.ent N test/oasis/xmltest/valid/not-sa/031-2.ent N test/oasis/xmltest/valid/not-sa/out/001.xml N test/oasis/xmltest/valid/not-sa/out/002.xml N test/oasis/xmltest/valid/not-sa/out/003.xml N test/oasis/xmltest/valid/not-sa/out/004.xml N test/oasis/xmltest/valid/not-sa/out/005.xml N test/oasis/xmltest/valid/not-sa/out/006.xml N test/oasis/xmltest/valid/not-sa/out/007.xml N test/oasis/xmltest/valid/not-sa/out/008.xml N test/oasis/xmltest/valid/not-sa/out/009.xml N test/oasis/xmltest/valid/not-sa/out/010.xml N test/oasis/xmltest/valid/not-sa/out/011.xml N test/oasis/xmltest/valid/not-sa/out/012.xml N test/oasis/xmltest/valid/not-sa/out/013.xml N test/oasis/xmltest/valid/not-sa/out/014.xml N test/oasis/xmltest/valid/not-sa/out/015.xml N test/oasis/xmltest/valid/not-sa/out/016.xml N test/oasis/xmltest/valid/not-sa/out/017.xml N test/oasis/xmltest/valid/not-sa/out/018.xml N test/oasis/xmltest/valid/not-sa/out/019.xml N test/oasis/xmltest/valid/not-sa/out/020.xml N test/oasis/xmltest/valid/not-sa/out/021.xml N test/oasis/xmltest/valid/not-sa/out/022.xml N test/oasis/xmltest/valid/not-sa/out/023.xml N test/oasis/xmltest/valid/not-sa/out/024.xml N test/oasis/xmltest/valid/not-sa/out/025.xml N test/oasis/xmltest/valid/not-sa/out/026.xml N test/oasis/xmltest/valid/not-sa/out/027.xml N test/oasis/xmltest/valid/not-sa/out/028.xml N test/oasis/xmltest/valid/not-sa/out/029.xml N test/oasis/xmltest/valid/not-sa/out/030.xml N test/oasis/xmltest/valid/not-sa/out/031.xml N test/oasis/xmltest/valid/ext-sa/001.xml N test/oasis/xmltest/valid/ext-sa/002.xml N test/oasis/xmltest/valid/ext-sa/003.xml N test/oasis/xmltest/valid/ext-sa/004.xml N test/oasis/xmltest/valid/ext-sa/005.xml N test/oasis/xmltest/valid/ext-sa/006.xml N test/oasis/xmltest/valid/ext-sa/007.xml N test/oasis/xmltest/valid/ext-sa/008.xml N test/oasis/xmltest/valid/ext-sa/009.xml N test/oasis/xmltest/valid/ext-sa/010.xml N test/oasis/xmltest/valid/ext-sa/011.xml N test/oasis/xmltest/valid/ext-sa/012.xml N test/oasis/xmltest/valid/ext-sa/013.xml N test/oasis/xmltest/valid/ext-sa/014.xml N test/oasis/xmltest/valid/ext-sa/001.ent N test/oasis/xmltest/valid/ext-sa/002.ent N test/oasis/xmltest/valid/ext-sa/003.ent N test/oasis/xmltest/valid/ext-sa/004.ent N test/oasis/xmltest/valid/ext-sa/005.ent N test/oasis/xmltest/valid/ext-sa/006.ent N test/oasis/xmltest/valid/ext-sa/007.ent N test/oasis/xmltest/valid/ext-sa/008.ent N test/oasis/xmltest/valid/ext-sa/009.ent N test/oasis/xmltest/valid/ext-sa/010.ent N test/oasis/xmltest/valid/ext-sa/011.ent N test/oasis/xmltest/valid/ext-sa/012.ent N test/oasis/xmltest/valid/ext-sa/013.ent N test/oasis/xmltest/valid/ext-sa/014.ent N test/oasis/xmltest/valid/ext-sa/out/001.xml N test/oasis/xmltest/valid/ext-sa/out/002.xml N test/oasis/xmltest/valid/ext-sa/out/003.xml N test/oasis/xmltest/valid/ext-sa/out/004.xml N test/oasis/xmltest/valid/ext-sa/out/005.xml N test/oasis/xmltest/valid/ext-sa/out/006.xml N test/oasis/xmltest/valid/ext-sa/out/007.xml N test/oasis/xmltest/valid/ext-sa/out/008.xml N test/oasis/xmltest/valid/ext-sa/out/009.xml N test/oasis/xmltest/valid/ext-sa/out/010.xml N test/oasis/xmltest/valid/ext-sa/out/011.xml N test/oasis/xmltest/valid/ext-sa/out/012.xml N test/oasis/xmltest/valid/ext-sa/out/013.xml N test/oasis/xmltest/valid/ext-sa/out/014.xml N test/oasis/xmltest/valid/sa/001.xml N test/oasis/xmltest/valid/sa/002.xml N test/oasis/xmltest/valid/sa/003.xml N test/oasis/xmltest/valid/sa/004.xml N test/oasis/xmltest/valid/sa/005.xml N test/oasis/xmltest/valid/sa/006.xml N test/oasis/xmltest/valid/sa/007.xml N test/oasis/xmltest/valid/sa/008.xml N test/oasis/xmltest/valid/sa/009.xml N test/oasis/xmltest/valid/sa/010.xml N test/oasis/xmltest/valid/sa/011.xml N test/oasis/xmltest/valid/sa/012.xml N test/oasis/xmltest/valid/sa/013.xml N test/oasis/xmltest/valid/sa/014.xml N test/oasis/xmltest/valid/sa/015.xml N test/oasis/xmltest/valid/sa/016.xml N test/oasis/xmltest/valid/sa/017.xml N test/oasis/xmltest/valid/sa/018.xml N test/oasis/xmltest/valid/sa/019.xml N test/oasis/xmltest/valid/sa/020.xml N test/oasis/xmltest/valid/sa/021.xml N test/oasis/xmltest/valid/sa/022.xml N test/oasis/xmltest/valid/sa/023.xml N test/oasis/xmltest/valid/sa/024.xml N test/oasis/xmltest/valid/sa/025.xml N test/oasis/xmltest/valid/sa/026.xml N test/oasis/xmltest/valid/sa/027.xml N test/oasis/xmltest/valid/sa/028.xml N test/oasis/xmltest/valid/sa/029.xml N test/oasis/xmltest/valid/sa/030.xml N test/oasis/xmltest/valid/sa/031.xml N test/oasis/xmltest/valid/sa/032.xml N test/oasis/xmltest/valid/sa/033.xml N test/oasis/xmltest/valid/sa/034.xml N test/oasis/xmltest/valid/sa/035.xml N test/oasis/xmltest/valid/sa/036.xml N test/oasis/xmltest/valid/sa/037.xml N test/oasis/xmltest/valid/sa/038.xml N test/oasis/xmltest/valid/sa/039.xml N test/oasis/xmltest/valid/sa/040.xml N test/oasis/xmltest/valid/sa/041.xml N test/oasis/xmltest/valid/sa/042.xml N test/oasis/xmltest/valid/sa/043.xml N test/oasis/xmltest/valid/sa/044.xml N test/oasis/xmltest/valid/sa/045.xml N test/oasis/xmltest/valid/sa/046.xml N test/oasis/xmltest/valid/sa/047.xml N test/oasis/xmltest/valid/sa/048.xml N test/oasis/xmltest/valid/sa/049.xml N test/oasis/xmltest/valid/sa/050.xml N test/oasis/xmltest/valid/sa/051.xml N test/oasis/xmltest/valid/sa/052.xml N test/oasis/xmltest/valid/sa/053.xml N test/oasis/xmltest/valid/sa/054.xml N test/oasis/xmltest/valid/sa/055.xml N test/oasis/xmltest/valid/sa/056.xml N test/oasis/xmltest/valid/sa/057.xml N test/oasis/xmltest/valid/sa/058.xml N test/oasis/xmltest/valid/sa/059.xml N test/oasis/xmltest/valid/sa/060.xml N test/oasis/xmltest/valid/sa/061.xml N test/oasis/xmltest/valid/sa/062.xml N test/oasis/xmltest/valid/sa/063.xml N test/oasis/xmltest/valid/sa/064.xml N test/oasis/xmltest/valid/sa/065.xml N test/oasis/xmltest/valid/sa/066.xml N test/oasis/xmltest/valid/sa/067.xml N test/oasis/xmltest/valid/sa/068.xml N test/oasis/xmltest/valid/sa/069.xml N test/oasis/xmltest/valid/sa/070.xml N test/oasis/xmltest/valid/sa/071.xml N test/oasis/xmltest/valid/sa/072.xml N test/oasis/xmltest/valid/sa/073.xml N test/oasis/xmltest/valid/sa/074.xml N test/oasis/xmltest/valid/sa/075.xml N test/oasis/xmltest/valid/sa/076.xml N test/oasis/xmltest/valid/sa/077.xml N test/oasis/xmltest/valid/sa/078.xml N test/oasis/xmltest/valid/sa/079.xml N test/oasis/xmltest/valid/sa/080.xml N test/oasis/xmltest/valid/sa/081.xml N test/oasis/xmltest/valid/sa/082.xml N test/oasis/xmltest/valid/sa/083.xml N test/oasis/xmltest/valid/sa/084.xml N test/oasis/xmltest/valid/sa/085.xml N test/oasis/xmltest/valid/sa/086.xml N test/oasis/xmltest/valid/sa/087.xml N test/oasis/xmltest/valid/sa/088.xml N test/oasis/xmltest/valid/sa/089.xml N test/oasis/xmltest/valid/sa/090.xml N test/oasis/xmltest/valid/sa/091.xml N test/oasis/xmltest/valid/sa/092.xml N test/oasis/xmltest/valid/sa/093.xml N test/oasis/xmltest/valid/sa/094.xml N test/oasis/xmltest/valid/sa/095.xml N test/oasis/xmltest/valid/sa/096.xml N test/oasis/xmltest/valid/sa/097.xml N test/oasis/xmltest/valid/sa/098.xml N test/oasis/xmltest/valid/sa/099.xml N test/oasis/xmltest/valid/sa/100.xml N test/oasis/xmltest/valid/sa/101.xml N test/oasis/xmltest/valid/sa/102.xml N test/oasis/xmltest/valid/sa/103.xml N test/oasis/xmltest/valid/sa/104.xml N test/oasis/xmltest/valid/sa/105.xml N test/oasis/xmltest/valid/sa/106.xml N test/oasis/xmltest/valid/sa/107.xml N test/oasis/xmltest/valid/sa/108.xml N test/oasis/xmltest/valid/sa/109.xml N test/oasis/xmltest/valid/sa/110.xml N test/oasis/xmltest/valid/sa/111.xml N test/oasis/xmltest/valid/sa/112.xml N test/oasis/xmltest/valid/sa/113.xml N test/oasis/xmltest/valid/sa/114.xml N test/oasis/xmltest/valid/sa/115.xml N test/oasis/xmltest/valid/sa/116.xml N test/oasis/xmltest/valid/sa/117.xml N test/oasis/xmltest/valid/sa/118.xml N test/oasis/xmltest/valid/sa/119.xml N test/oasis/xmltest/valid/sa/097.ent N test/oasis/xmltest/valid/sa/out/001.xml N test/oasis/xmltest/valid/sa/out/002.xml N test/oasis/xmltest/valid/sa/out/003.xml N test/oasis/xmltest/valid/sa/out/004.xml N test/oasis/xmltest/valid/sa/out/005.xml N test/oasis/xmltest/valid/sa/out/006.xml N test/oasis/xmltest/valid/sa/out/007.xml N test/oasis/xmltest/valid/sa/out/008.xml N test/oasis/xmltest/valid/sa/out/009.xml N test/oasis/xmltest/valid/sa/out/010.xml N test/oasis/xmltest/valid/sa/out/011.xml N test/oasis/xmltest/valid/sa/out/012.xml N test/oasis/xmltest/valid/sa/out/013.xml N test/oasis/xmltest/valid/sa/out/014.xml N test/oasis/xmltest/valid/sa/out/015.xml N test/oasis/xmltest/valid/sa/out/016.xml N test/oasis/xmltest/valid/sa/out/017.xml N test/oasis/xmltest/valid/sa/out/018.xml N test/oasis/xmltest/valid/sa/out/019.xml N test/oasis/xmltest/valid/sa/out/020.xml N test/oasis/xmltest/valid/sa/out/021.xml N test/oasis/xmltest/valid/sa/out/022.xml N test/oasis/xmltest/valid/sa/out/023.xml N test/oasis/xmltest/valid/sa/out/024.xml N test/oasis/xmltest/valid/sa/out/025.xml N test/oasis/xmltest/valid/sa/out/026.xml N test/oasis/xmltest/valid/sa/out/027.xml N test/oasis/xmltest/valid/sa/out/028.xml N test/oasis/xmltest/valid/sa/out/029.xml N test/oasis/xmltest/valid/sa/out/030.xml N test/oasis/xmltest/valid/sa/out/031.xml N test/oasis/xmltest/valid/sa/out/032.xml N test/oasis/xmltest/valid/sa/out/033.xml N test/oasis/xmltest/valid/sa/out/034.xml N test/oasis/xmltest/valid/sa/out/035.xml N test/oasis/xmltest/valid/sa/out/036.xml N test/oasis/xmltest/valid/sa/out/037.xml N test/oasis/xmltest/valid/sa/out/038.xml N test/oasis/xmltest/valid/sa/out/039.xml N test/oasis/xmltest/valid/sa/out/040.xml N test/oasis/xmltest/valid/sa/out/041.xml N test/oasis/xmltest/valid/sa/out/042.xml N test/oasis/xmltest/valid/sa/out/043.xml N test/oasis/xmltest/valid/sa/out/044.xml N test/oasis/xmltest/valid/sa/out/045.xml N test/oasis/xmltest/valid/sa/out/046.xml N test/oasis/xmltest/valid/sa/out/047.xml N test/oasis/xmltest/valid/sa/out/048.xml N test/oasis/xmltest/valid/sa/out/049.xml N test/oasis/xmltest/valid/sa/out/050.xml N test/oasis/xmltest/valid/sa/out/051.xml N test/oasis/xmltest/valid/sa/out/052.xml N test/oasis/xmltest/valid/sa/out/053.xml N test/oasis/xmltest/valid/sa/out/054.xml N test/oasis/xmltest/valid/sa/out/055.xml N test/oasis/xmltest/valid/sa/out/056.xml N test/oasis/xmltest/valid/sa/out/057.xml N test/oasis/xmltest/valid/sa/out/058.xml N test/oasis/xmltest/valid/sa/out/059.xml N test/oasis/xmltest/valid/sa/out/060.xml N test/oasis/xmltest/valid/sa/out/061.xml N test/oasis/xmltest/valid/sa/out/062.xml N test/oasis/xmltest/valid/sa/out/063.xml N test/oasis/xmltest/valid/sa/out/064.xml N test/oasis/xmltest/valid/sa/out/065.xml N test/oasis/xmltest/valid/sa/out/066.xml N test/oasis/xmltest/valid/sa/out/067.xml N test/oasis/xmltest/valid/sa/out/068.xml N test/oasis/xmltest/valid/sa/out/069.xml N test/oasis/xmltest/valid/sa/out/070.xml N test/oasis/xmltest/valid/sa/out/071.xml N test/oasis/xmltest/valid/sa/out/072.xml N test/oasis/xmltest/valid/sa/out/073.xml N test/oasis/xmltest/valid/sa/out/074.xml N test/oasis/xmltest/valid/sa/out/075.xml N test/oasis/xmltest/valid/sa/out/076.xml N test/oasis/xmltest/valid/sa/out/077.xml N test/oasis/xmltest/valid/sa/out/078.xml N test/oasis/xmltest/valid/sa/out/079.xml N test/oasis/xmltest/valid/sa/out/080.xml N test/oasis/xmltest/valid/sa/out/081.xml N test/oasis/xmltest/valid/sa/out/082.xml N test/oasis/xmltest/valid/sa/out/083.xml N test/oasis/xmltest/valid/sa/out/084.xml N test/oasis/xmltest/valid/sa/out/085.xml N test/oasis/xmltest/valid/sa/out/086.xml N test/oasis/xmltest/valid/sa/out/087.xml N test/oasis/xmltest/valid/sa/out/088.xml N test/oasis/xmltest/valid/sa/out/089.xml N test/oasis/xmltest/valid/sa/out/090.xml N test/oasis/xmltest/valid/sa/out/091.xml N test/oasis/xmltest/valid/sa/out/092.xml N test/oasis/xmltest/valid/sa/out/093.xml N test/oasis/xmltest/valid/sa/out/094.xml N test/oasis/xmltest/valid/sa/out/095.xml N test/oasis/xmltest/valid/sa/out/096.xml N test/oasis/xmltest/valid/sa/out/097.xml N test/oasis/xmltest/valid/sa/out/098.xml N test/oasis/xmltest/valid/sa/out/099.xml N test/oasis/xmltest/valid/sa/out/100.xml N test/oasis/xmltest/valid/sa/out/101.xml N test/oasis/xmltest/valid/sa/out/102.xml N test/oasis/xmltest/valid/sa/out/103.xml N test/oasis/xmltest/valid/sa/out/104.xml N test/oasis/xmltest/valid/sa/out/105.xml N test/oasis/xmltest/valid/sa/out/106.xml N test/oasis/xmltest/valid/sa/out/107.xml N test/oasis/xmltest/valid/sa/out/108.xml N test/oasis/xmltest/valid/sa/out/109.xml N test/oasis/xmltest/valid/sa/out/110.xml N test/oasis/xmltest/valid/sa/out/111.xml N test/oasis/xmltest/valid/sa/out/112.xml N test/oasis/xmltest/valid/sa/out/113.xml N test/oasis/xmltest/valid/sa/out/114.xml N test/oasis/xmltest/valid/sa/out/115.xml N test/oasis/xmltest/valid/sa/out/116.xml N test/oasis/xmltest/valid/sa/out/117.xml N test/oasis/xmltest/valid/sa/out/118.xml N test/oasis/xmltest/valid/sa/out/119.xml N test/oasis/xmltest/not-wf/not-sa/001.xml N test/oasis/xmltest/not-wf/not-sa/002.xml N test/oasis/xmltest/not-wf/not-sa/003.xml N test/oasis/xmltest/not-wf/not-sa/004.xml N test/oasis/xmltest/not-wf/not-sa/005.xml N test/oasis/xmltest/not-wf/not-sa/006.xml N test/oasis/xmltest/not-wf/not-sa/007.xml N test/oasis/xmltest/not-wf/not-sa/008.xml N test/oasis/xmltest/not-wf/not-sa/001.ent N test/oasis/xmltest/not-wf/not-sa/003.ent N test/oasis/xmltest/not-wf/not-sa/004.ent N test/oasis/xmltest/not-wf/not-sa/005.ent N test/oasis/xmltest/not-wf/not-sa/006.ent N test/oasis/xmltest/not-wf/not-sa/007.ent N test/oasis/xmltest/not-wf/not-sa/008.ent N test/oasis/xmltest/not-wf/ext-sa/001.xml N test/oasis/xmltest/not-wf/ext-sa/002.xml N test/oasis/xmltest/not-wf/ext-sa/003.xml N test/oasis/xmltest/not-wf/ext-sa/001.ent N test/oasis/xmltest/not-wf/ext-sa/002.ent N test/oasis/xmltest/not-wf/ext-sa/003.ent N test/oasis/xmltest/not-wf/sa/001.xml N test/oasis/xmltest/not-wf/sa/002.xml N test/oasis/xmltest/not-wf/sa/003.xml N test/oasis/xmltest/not-wf/sa/004.xml N test/oasis/xmltest/not-wf/sa/005.xml N test/oasis/xmltest/not-wf/sa/006.xml N test/oasis/xmltest/not-wf/sa/007.xml N test/oasis/xmltest/not-wf/sa/008.xml N test/oasis/xmltest/not-wf/sa/009.xml N test/oasis/xmltest/not-wf/sa/010.xml N test/oasis/xmltest/not-wf/sa/011.xml N test/oasis/xmltest/not-wf/sa/012.xml N test/oasis/xmltest/not-wf/sa/013.xml N test/oasis/xmltest/not-wf/sa/014.xml N test/oasis/xmltest/not-wf/sa/015.xml N test/oasis/xmltest/not-wf/sa/016.xml N test/oasis/xmltest/not-wf/sa/017.xml N test/oasis/xmltest/not-wf/sa/018.xml N test/oasis/xmltest/not-wf/sa/019.xml N test/oasis/xmltest/not-wf/sa/020.xml N test/oasis/xmltest/not-wf/sa/021.xml N test/oasis/xmltest/not-wf/sa/022.xml N test/oasis/xmltest/not-wf/sa/023.xml N test/oasis/xmltest/not-wf/sa/024.xml N test/oasis/xmltest/not-wf/sa/025.xml N test/oasis/xmltest/not-wf/sa/026.xml N test/oasis/xmltest/not-wf/sa/027.xml N test/oasis/xmltest/not-wf/sa/028.xml N test/oasis/xmltest/not-wf/sa/029.xml N test/oasis/xmltest/not-wf/sa/030.xml N test/oasis/xmltest/not-wf/sa/031.xml N test/oasis/xmltest/not-wf/sa/032.xml N test/oasis/xmltest/not-wf/sa/033.xml N test/oasis/xmltest/not-wf/sa/034.xml N test/oasis/xmltest/not-wf/sa/035.xml N test/oasis/xmltest/not-wf/sa/036.xml N test/oasis/xmltest/not-wf/sa/037.xml N test/oasis/xmltest/not-wf/sa/038.xml N test/oasis/xmltest/not-wf/sa/039.xml N test/oasis/xmltest/not-wf/sa/040.xml N test/oasis/xmltest/not-wf/sa/041.xml N test/oasis/xmltest/not-wf/sa/042.xml N test/oasis/xmltest/not-wf/sa/043.xml N test/oasis/xmltest/not-wf/sa/044.xml N test/oasis/xmltest/not-wf/sa/045.xml N test/oasis/xmltest/not-wf/sa/046.xml N test/oasis/xmltest/not-wf/sa/047.xml N test/oasis/xmltest/not-wf/sa/048.xml N test/oasis/xmltest/not-wf/sa/049.xml N test/oasis/xmltest/not-wf/sa/050.xml N test/oasis/xmltest/not-wf/sa/051.xml N test/oasis/xmltest/not-wf/sa/052.xml N test/oasis/xmltest/not-wf/sa/053.xml N test/oasis/xmltest/not-wf/sa/054.xml N test/oasis/xmltest/not-wf/sa/055.xml N test/oasis/xmltest/not-wf/sa/056.xml N test/oasis/xmltest/not-wf/sa/057.xml N test/oasis/xmltest/not-wf/sa/058.xml N test/oasis/xmltest/not-wf/sa/059.xml N test/oasis/xmltest/not-wf/sa/060.xml N test/oasis/xmltest/not-wf/sa/061.xml N test/oasis/xmltest/not-wf/sa/062.xml N test/oasis/xmltest/not-wf/sa/063.xml N test/oasis/xmltest/not-wf/sa/064.xml N test/oasis/xmltest/not-wf/sa/065.xml N test/oasis/xmltest/not-wf/sa/066.xml N test/oasis/xmltest/not-wf/sa/067.xml N test/oasis/xmltest/not-wf/sa/068.xml N test/oasis/xmltest/not-wf/sa/069.xml N test/oasis/xmltest/not-wf/sa/070.xml N test/oasis/xmltest/not-wf/sa/071.xml N test/oasis/xmltest/not-wf/sa/072.xml N test/oasis/xmltest/not-wf/sa/073.xml N test/oasis/xmltest/not-wf/sa/074.xml N test/oasis/xmltest/not-wf/sa/075.xml N test/oasis/xmltest/not-wf/sa/076.xml N test/oasis/xmltest/not-wf/sa/077.xml N test/oasis/xmltest/not-wf/sa/078.xml N test/oasis/xmltest/not-wf/sa/079.xml N test/oasis/xmltest/not-wf/sa/080.xml N test/oasis/xmltest/not-wf/sa/081.xml N test/oasis/xmltest/not-wf/sa/082.xml N test/oasis/xmltest/not-wf/sa/083.xml N test/oasis/xmltest/not-wf/sa/084.xml N test/oasis/xmltest/not-wf/sa/085.xml N test/oasis/xmltest/not-wf/sa/086.xml N test/oasis/xmltest/not-wf/sa/087.xml N test/oasis/xmltest/not-wf/sa/088.xml N test/oasis/xmltest/not-wf/sa/089.xml N test/oasis/xmltest/not-wf/sa/090.xml N test/oasis/xmltest/not-wf/sa/091.xml N test/oasis/xmltest/not-wf/sa/092.xml N test/oasis/xmltest/not-wf/sa/093.xml N test/oasis/xmltest/not-wf/sa/094.xml N test/oasis/xmltest/not-wf/sa/095.xml N test/oasis/xmltest/not-wf/sa/096.xml N test/oasis/xmltest/not-wf/sa/097.xml N test/oasis/xmltest/not-wf/sa/098.xml N test/oasis/xmltest/not-wf/sa/099.xml N test/oasis/xmltest/not-wf/sa/100.xml N test/oasis/xmltest/not-wf/sa/101.xml N test/oasis/xmltest/not-wf/sa/102.xml N test/oasis/xmltest/not-wf/sa/103.xml N test/oasis/xmltest/not-wf/sa/104.xml N test/oasis/xmltest/not-wf/sa/105.xml N test/oasis/xmltest/not-wf/sa/106.xml N test/oasis/xmltest/not-wf/sa/107.xml N test/oasis/xmltest/not-wf/sa/108.xml N test/oasis/xmltest/not-wf/sa/109.xml N test/oasis/xmltest/not-wf/sa/110.xml N test/oasis/xmltest/not-wf/sa/111.xml N test/oasis/xmltest/not-wf/sa/112.xml N test/oasis/xmltest/not-wf/sa/113.xml N test/oasis/xmltest/not-wf/sa/114.xml N test/oasis/xmltest/not-wf/sa/115.xml N test/oasis/xmltest/not-wf/sa/116.xml N test/oasis/xmltest/not-wf/sa/117.xml N test/oasis/xmltest/not-wf/sa/118.xml N test/oasis/xmltest/not-wf/sa/119.xml N test/oasis/xmltest/not-wf/sa/120.xml N test/oasis/xmltest/not-wf/sa/121.xml N test/oasis/xmltest/not-wf/sa/122.xml N test/oasis/xmltest/not-wf/sa/123.xml N test/oasis/xmltest/not-wf/sa/124.xml N test/oasis/xmltest/not-wf/sa/125.xml N test/oasis/xmltest/not-wf/sa/126.xml N test/oasis/xmltest/not-wf/sa/127.xml N test/oasis/xmltest/not-wf/sa/128.xml N test/oasis/xmltest/not-wf/sa/129.xml N test/oasis/xmltest/not-wf/sa/130.xml N test/oasis/xmltest/not-wf/sa/131.xml N test/oasis/xmltest/not-wf/sa/132.xml N test/oasis/xmltest/not-wf/sa/133.xml N test/oasis/xmltest/not-wf/sa/134.xml N test/oasis/xmltest/not-wf/sa/135.xml N test/oasis/xmltest/not-wf/sa/136.xml N test/oasis/xmltest/not-wf/sa/137.xml N test/oasis/xmltest/not-wf/sa/138.xml N test/oasis/xmltest/not-wf/sa/139.xml N test/oasis/xmltest/not-wf/sa/140.xml N test/oasis/xmltest/not-wf/sa/141.xml N test/oasis/xmltest/not-wf/sa/142.xml N test/oasis/xmltest/not-wf/sa/143.xml N test/oasis/xmltest/not-wf/sa/144.xml N test/oasis/xmltest/not-wf/sa/145.xml N test/oasis/xmltest/not-wf/sa/146.xml N test/oasis/xmltest/not-wf/sa/147.xml N test/oasis/xmltest/not-wf/sa/148.xml N test/oasis/xmltest/not-wf/sa/149.xml N test/oasis/xmltest/not-wf/sa/150.xml N test/oasis/xmltest/not-wf/sa/151.xml N test/oasis/xmltest/not-wf/sa/152.xml N test/oasis/xmltest/not-wf/sa/153.xml N test/oasis/xmltest/not-wf/sa/154.xml N test/oasis/xmltest/not-wf/sa/155.xml N test/oasis/xmltest/not-wf/sa/156.xml N test/oasis/xmltest/not-wf/sa/157.xml N test/oasis/xmltest/not-wf/sa/158.xml N test/oasis/xmltest/not-wf/sa/159.xml N test/oasis/xmltest/not-wf/sa/160.xml N test/oasis/xmltest/not-wf/sa/161.xml N test/oasis/xmltest/not-wf/sa/162.xml N test/oasis/xmltest/not-wf/sa/163.xml N test/oasis/xmltest/not-wf/sa/164.xml N test/oasis/xmltest/not-wf/sa/165.xml N test/oasis/xmltest/not-wf/sa/166.xml N test/oasis/xmltest/not-wf/sa/167.xml N test/oasis/xmltest/not-wf/sa/168.xml N test/oasis/xmltest/not-wf/sa/169.xml N test/oasis/xmltest/not-wf/sa/170.xml N test/oasis/xmltest/not-wf/sa/171.xml N test/oasis/xmltest/not-wf/sa/172.xml N test/oasis/xmltest/not-wf/sa/173.xml N test/oasis/xmltest/not-wf/sa/174.xml N test/oasis/xmltest/not-wf/sa/175.xml N test/oasis/xmltest/not-wf/sa/176.xml N test/oasis/xmltest/not-wf/sa/177.xml N test/oasis/xmltest/not-wf/sa/178.xml N test/oasis/xmltest/not-wf/sa/179.xml N test/oasis/xmltest/not-wf/sa/180.xml N test/oasis/xmltest/not-wf/sa/181.xml N test/oasis/xmltest/not-wf/sa/182.xml N test/oasis/xmltest/not-wf/sa/183.xml N test/oasis/xmltest/not-wf/sa/184.xml N test/oasis/xmltest/not-wf/sa/185.xml N test/oasis/xmltest/not-wf/sa/186.xml N test/oasis/xmltest/not-wf/sa/185.ent N test/oasis/xmltest/not-wf/sa/null.ent N test/oasis/files/committee.css N test/oasis/files/a_oasis-logo.gif N test/oasis/myown/long-comment.xml N test/oasis/baseline/invalid/dtd01.xml N test/oasis/baseline/invalid/dtd02.xml N test/oasis/baseline/invalid/dtd03.xml N test/oasis/baseline/invalid/dtd06.xml N test/oasis/baseline/invalid/el01.xml N test/oasis/baseline/invalid/el02.xml N test/oasis/baseline/invalid/el03.xml N test/oasis/baseline/invalid/el04.xml N test/oasis/baseline/invalid/el05.xml N test/oasis/baseline/invalid/el06.xml N test/oasis/baseline/invalid/id01.xml N test/oasis/baseline/invalid/id02.xml N test/oasis/baseline/invalid/id03.xml N test/oasis/baseline/invalid/id04.xml N test/oasis/baseline/invalid/id05.xml N test/oasis/baseline/invalid/id06.xml N test/oasis/baseline/invalid/id07.xml N test/oasis/baseline/invalid/id08.xml N test/oasis/baseline/invalid/id09.xml N test/oasis/baseline/invalid/not-sa01.xml N test/oasis/baseline/invalid/not-sa02.xml N test/oasis/baseline/invalid/not-sa03.xml N test/oasis/baseline/invalid/not-sa04.xml N test/oasis/baseline/invalid/not-sa05.xml N test/oasis/baseline/invalid/not-sa06.xml N test/oasis/baseline/invalid/not-sa07.xml N test/oasis/baseline/invalid/not-sa08.xml N test/oasis/baseline/invalid/not-sa09.xml N test/oasis/baseline/invalid/not-sa10.xml N test/oasis/baseline/invalid/not-sa11.xml N test/oasis/baseline/invalid/not-sa12.xml N test/oasis/baseline/invalid/not-sa13.xml N test/oasis/baseline/invalid/not-sa14.xml N test/oasis/baseline/invalid/optional01.xml N test/oasis/baseline/invalid/optional02.xml N test/oasis/baseline/invalid/optional03.xml N test/oasis/baseline/invalid/optional04.xml N test/oasis/baseline/invalid/optional05.xml N test/oasis/baseline/invalid/optional06.xml N test/oasis/baseline/invalid/optional07.xml N test/oasis/baseline/invalid/optional08.xml N test/oasis/baseline/invalid/optional09.xml N test/oasis/baseline/invalid/optional10.xml N test/oasis/baseline/invalid/optional11.xml N test/oasis/baseline/invalid/optional12.xml N test/oasis/baseline/invalid/optional13.xml N test/oasis/baseline/invalid/optional14.xml N test/oasis/baseline/invalid/optional15.xml N test/oasis/baseline/invalid/optional16.xml N test/oasis/baseline/invalid/optional17.xml N test/oasis/baseline/invalid/optional18.xml N test/oasis/baseline/invalid/optional19.xml N test/oasis/baseline/invalid/optional20.xml N test/oasis/baseline/invalid/optional21.xml N test/oasis/baseline/invalid/optional22.xml N test/oasis/baseline/invalid/optional23.xml N test/oasis/baseline/invalid/optional24.xml N test/oasis/baseline/invalid/optional25.xml N test/oasis/baseline/invalid/required00.xml N test/oasis/baseline/invalid/required01.xml N test/oasis/baseline/invalid/required02.xml N test/oasis/baseline/invalid/root.xml N test/oasis/baseline/invalid/attr01.xml N test/oasis/baseline/invalid/attr02.xml N test/oasis/baseline/invalid/attr03.xml N test/oasis/baseline/invalid/attr04.xml N test/oasis/baseline/invalid/attr05.xml N test/oasis/baseline/invalid/attr06.xml N test/oasis/baseline/invalid/attr07.xml N test/oasis/baseline/invalid/attr08.xml N test/oasis/baseline/invalid/attr09.xml N test/oasis/baseline/invalid/attr10.xml N test/oasis/baseline/invalid/attr11.xml N test/oasis/baseline/invalid/attr12.xml N test/oasis/baseline/invalid/attr13.xml N test/oasis/baseline/invalid/attr14.xml N test/oasis/baseline/invalid/attr15.xml N test/oasis/baseline/invalid/attr16.xml N test/oasis/baseline/invalid/utf16b.xml N test/oasis/baseline/invalid/utf16l.xml N test/oasis/baseline/invalid/pe01.xml N test/oasis/baseline/japanese/pr-xml-euc-jp.xml N test/oasis/baseline/japanese/pr-xml-iso-2022-jp.xml N test/oasis/baseline/japanese/pr-xml-little-endian.xml N test/oasis/baseline/japanese/pr-xml-shift_jis.xml N test/oasis/baseline/japanese/pr-xml-utf-16.xml N test/oasis/baseline/japanese/pr-xml-utf-8.xml N test/oasis/baseline/japanese/weekly-euc-jp.xml N test/oasis/baseline/japanese/weekly-iso-2022-jp.xml N test/oasis/baseline/japanese/weekly-little-endian.xml N test/oasis/baseline/japanese/weekly-shift_jis.xml N test/oasis/baseline/japanese/weekly-utf-16.xml N test/oasis/baseline/japanese/weekly-utf-8.xml N test/oasis/baseline/not-wf/attlist01.xml N test/oasis/baseline/not-wf/attlist02.xml N test/oasis/baseline/not-wf/attlist03.xml N test/oasis/baseline/not-wf/attlist04.xml N test/oasis/baseline/not-wf/attlist05.xml N test/oasis/baseline/not-wf/attlist06.xml N test/oasis/baseline/not-wf/attlist07.xml N test/oasis/baseline/not-wf/attlist08.xml N test/oasis/baseline/not-wf/attlist09.xml N test/oasis/baseline/not-wf/attlist10.xml N test/oasis/baseline/not-wf/attlist11.xml N test/oasis/baseline/not-wf/cond01.xml N test/oasis/baseline/not-wf/cond02.xml N test/oasis/baseline/not-wf/content01.xml N test/oasis/baseline/not-wf/content02.xml N test/oasis/baseline/not-wf/content03.xml N test/oasis/baseline/not-wf/decl01.xml N test/oasis/baseline/not-wf/dtd00.xml N test/oasis/baseline/not-wf/dtd01.xml N test/oasis/baseline/not-wf/dtd02.xml N test/oasis/baseline/not-wf/dtd03.xml N test/oasis/baseline/not-wf/dtd04.xml N test/oasis/baseline/not-wf/dtd05.xml N test/oasis/baseline/not-wf/dtd07.xml N test/oasis/baseline/not-wf/element00.xml N test/oasis/baseline/not-wf/element01.xml N test/oasis/baseline/not-wf/element02.xml N test/oasis/baseline/not-wf/element03.xml N test/oasis/baseline/not-wf/element04.xml N test/oasis/baseline/not-wf/encoding01.xml N test/oasis/baseline/not-wf/encoding02.xml N test/oasis/baseline/not-wf/encoding03.xml N test/oasis/baseline/not-wf/encoding04.xml N test/oasis/baseline/not-wf/encoding05.xml N test/oasis/baseline/not-wf/encoding06.xml N test/oasis/baseline/not-wf/encoding07.xml N test/oasis/baseline/not-wf/pi.xml N test/oasis/baseline/not-wf/pubid01.xml N test/oasis/baseline/not-wf/pubid02.xml N test/oasis/baseline/not-wf/pubid03.xml N test/oasis/baseline/not-wf/pubid04.xml N test/oasis/baseline/not-wf/pubid05.xml N test/oasis/baseline/not-wf/sgml01.xml N test/oasis/baseline/not-wf/sgml02.xml N test/oasis/baseline/not-wf/sgml03.xml N test/oasis/baseline/not-wf/sgml04.xml N test/oasis/baseline/not-wf/sgml05.xml N test/oasis/baseline/not-wf/sgml06.xml N test/oasis/baseline/not-wf/sgml07.xml N test/oasis/baseline/not-wf/sgml08.xml N test/oasis/baseline/not-wf/sgml09.xml N test/oasis/baseline/not-wf/sgml10.xml N test/oasis/baseline/not-wf/sgml11.xml N test/oasis/baseline/not-wf/sgml12.xml N test/oasis/baseline/not-wf/sgml13.xml N test/oasis/baseline/not-wf/uri01.xml N test/oasis/baseline/not-wf/lang01.xml N test/oasis/baseline/not-wf/lang02.xml N test/oasis/baseline/not-wf/lang03.xml N test/oasis/baseline/not-wf/lang04.xml N test/oasis/baseline/not-wf/lang05.xml N test/oasis/baseline/not-wf/lang06.xml N test/oasis/baseline/oasis/p01pass2.xml N test/oasis/baseline/oasis/p06pass1.xml N test/oasis/baseline/oasis/p07pass1.xml N test/oasis/baseline/oasis/p08pass1.xml N test/oasis/baseline/oasis/p09pass1.xml N test/oasis/baseline/oasis/p12pass1.xml N test/oasis/baseline/oasis/p22pass4.xml N test/oasis/baseline/oasis/p22pass5.xml N test/oasis/baseline/oasis/p22pass6.xml N test/oasis/baseline/oasis/p28pass1.xml N test/oasis/baseline/oasis/p28pass3.xml N test/oasis/baseline/oasis/p28pass4.xml N test/oasis/baseline/oasis/p28pass5.xml N test/oasis/baseline/oasis/p29pass1.xml N test/oasis/baseline/oasis/p30pass1.xml N test/oasis/baseline/oasis/p30pass2.xml N test/oasis/baseline/oasis/p31pass1.xml N test/oasis/baseline/oasis/p31pass2.xml N test/oasis/baseline/oasis/p43pass1.xml N test/oasis/baseline/oasis/p45pass1.xml N test/oasis/baseline/oasis/p46pass1.xml N test/oasis/baseline/oasis/p47pass1.xml N test/oasis/baseline/oasis/p48pass1.xml N test/oasis/baseline/oasis/p49pass1.xml N test/oasis/baseline/oasis/p50pass1.xml N test/oasis/baseline/oasis/p51pass1.xml N test/oasis/baseline/oasis/p52pass1.xml N test/oasis/baseline/oasis/p53pass1.xml N test/oasis/baseline/oasis/p54pass1.xml N test/oasis/baseline/oasis/p55pass1.xml N test/oasis/baseline/oasis/p56pass1.xml N test/oasis/baseline/oasis/p57pass1.xml N test/oasis/baseline/oasis/p58pass1.xml N test/oasis/baseline/oasis/p59pass1.xml N test/oasis/baseline/oasis/p60pass1.xml N test/oasis/baseline/oasis/p61pass1.xml N test/oasis/baseline/oasis/p62pass1.xml N test/oasis/baseline/oasis/p63pass1.xml N test/oasis/baseline/oasis/p64pass1.xml N test/oasis/baseline/oasis/p68pass1.xml N test/oasis/baseline/oasis/p69pass1.xml N test/oasis/baseline/oasis/p70pass1.xml N test/oasis/baseline/oasis/p71pass1.xml N test/oasis/baseline/oasis/p72pass1.xml N test/oasis/baseline/oasis/p73pass1.xml N test/oasis/baseline/oasis/p76pass1.xml N test/oasis/baseline/oasis/p01pass1.xml N test/oasis/baseline/oasis/p01pass3.xml N test/oasis/baseline/oasis/p03pass1.xml N test/oasis/baseline/oasis/p04pass1.xml N test/oasis/baseline/oasis/p05pass1.xml N test/oasis/baseline/oasis/p06fail1.xml N test/oasis/baseline/oasis/p08fail1.xml N test/oasis/baseline/oasis/p08fail2.xml N test/oasis/baseline/oasis/p10pass1.xml N test/oasis/baseline/oasis/p14pass1.xml N test/oasis/baseline/oasis/p15pass1.xml N test/oasis/baseline/oasis/p16fail3.xml N test/oasis/baseline/oasis/p16pass1.xml N test/oasis/baseline/oasis/p16pass2.xml N test/oasis/baseline/oasis/p16pass3.xml N test/oasis/baseline/oasis/p18pass1.xml N test/oasis/baseline/oasis/p22pass1.xml N test/oasis/baseline/oasis/p22pass2.xml N test/oasis/baseline/oasis/p22pass3.xml N test/oasis/baseline/oasis/p23pass1.xml N test/oasis/baseline/oasis/p23pass2.xml N test/oasis/baseline/oasis/p23pass3.xml N test/oasis/baseline/oasis/p23pass4.xml N test/oasis/baseline/oasis/p24pass1.xml N test/oasis/baseline/oasis/p24pass2.xml N test/oasis/baseline/oasis/p24pass3.xml N test/oasis/baseline/oasis/p24pass4.xml N test/oasis/baseline/oasis/p25pass1.xml N test/oasis/baseline/oasis/p25pass2.xml N test/oasis/baseline/oasis/p26pass1.xml N test/oasis/baseline/oasis/p27pass1.xml N test/oasis/baseline/oasis/p27pass2.xml N test/oasis/baseline/oasis/p27pass3.xml N test/oasis/baseline/oasis/p27pass4.xml N test/oasis/baseline/oasis/p32pass1.xml N test/oasis/baseline/oasis/p32pass2.xml N test/oasis/baseline/oasis/p39pass1.xml N test/oasis/baseline/oasis/p39pass2.xml N test/oasis/baseline/oasis/p40pass1.xml N test/oasis/baseline/oasis/p40pass2.xml N test/oasis/baseline/oasis/p40pass3.xml N test/oasis/baseline/oasis/p40pass4.xml N test/oasis/baseline/oasis/p41pass1.xml N test/oasis/baseline/oasis/p41pass2.xml N test/oasis/baseline/oasis/p42pass1.xml N test/oasis/baseline/oasis/p42pass2.xml N test/oasis/baseline/oasis/p44pass1.xml N test/oasis/baseline/oasis/p44pass2.xml N test/oasis/baseline/oasis/p44pass3.xml N test/oasis/baseline/oasis/p44pass4.xml N test/oasis/baseline/oasis/p44pass5.xml N test/oasis/baseline/oasis/p66pass1.xml N test/oasis/baseline/oasis/p74pass1.xml N test/oasis/baseline/oasis/p75pass1.xml N test/oasis/baseline/oasis/p01fail1.xml N test/oasis/baseline/oasis/p01fail2.xml N test/oasis/baseline/oasis/p01fail3.xml N test/oasis/baseline/oasis/p01fail4.xml N test/oasis/baseline/oasis/p02fail1.xml N test/oasis/baseline/oasis/p02fail10.xml N test/oasis/baseline/oasis/p02fail11.xml N test/oasis/baseline/oasis/p02fail12.xml N test/oasis/baseline/oasis/p02fail13.xml N test/oasis/baseline/oasis/p02fail14.xml N test/oasis/baseline/oasis/p02fail15.xml N test/oasis/baseline/oasis/p02fail16.xml N test/oasis/baseline/oasis/p02fail17.xml N test/oasis/baseline/oasis/p02fail18.xml N test/oasis/baseline/oasis/p02fail19.xml N test/oasis/baseline/oasis/p02fail2.xml N test/oasis/baseline/oasis/p02fail20.xml N test/oasis/baseline/oasis/p02fail21.xml N test/oasis/baseline/oasis/p02fail22.xml N test/oasis/baseline/oasis/p02fail23.xml N test/oasis/baseline/oasis/p02fail24.xml N test/oasis/baseline/oasis/p02fail25.xml N test/oasis/baseline/oasis/p02fail26.xml N test/oasis/baseline/oasis/p02fail27.xml N test/oasis/baseline/oasis/p02fail28.xml N test/oasis/baseline/oasis/p02fail29.xml N test/oasis/baseline/oasis/p02fail3.xml N test/oasis/baseline/oasis/p02fail30.xml N test/oasis/baseline/oasis/p02fail31.xml N test/oasis/baseline/oasis/p02fail4.xml N test/oasis/baseline/oasis/p02fail5.xml N test/oasis/baseline/oasis/p02fail6.xml N test/oasis/baseline/oasis/p02fail7.xml N test/oasis/baseline/oasis/p02fail8.xml N test/oasis/baseline/oasis/p02fail9.xml N test/oasis/baseline/oasis/p03fail1.xml N test/oasis/baseline/oasis/p03fail10.xml N test/oasis/baseline/oasis/p03fail11.xml N test/oasis/baseline/oasis/p03fail12.xml N test/oasis/baseline/oasis/p03fail13.xml N test/oasis/baseline/oasis/p03fail14.xml N test/oasis/baseline/oasis/p03fail15.xml N test/oasis/baseline/oasis/p03fail16.xml N test/oasis/baseline/oasis/p03fail17.xml N test/oasis/baseline/oasis/p03fail18.xml N test/oasis/baseline/oasis/p03fail19.xml N test/oasis/baseline/oasis/p03fail2.xml N test/oasis/baseline/oasis/p03fail20.xml N test/oasis/baseline/oasis/p03fail21.xml N test/oasis/baseline/oasis/p03fail22.xml N test/oasis/baseline/oasis/p03fail23.xml N test/oasis/baseline/oasis/p03fail24.xml N test/oasis/baseline/oasis/p03fail25.xml N test/oasis/baseline/oasis/p03fail26.xml N test/oasis/baseline/oasis/p03fail27.xml N test/oasis/baseline/oasis/p03fail28.xml N test/oasis/baseline/oasis/p03fail29.xml N test/oasis/baseline/oasis/p03fail3.xml N test/oasis/baseline/oasis/p03fail4.xml N test/oasis/baseline/oasis/p03fail5.xml N test/oasis/baseline/oasis/p03fail7.xml N test/oasis/baseline/oasis/p03fail8.xml N test/oasis/baseline/oasis/p03fail9.xml N test/oasis/baseline/oasis/p04fail1.xml N test/oasis/baseline/oasis/p04fail2.xml N test/oasis/baseline/oasis/p04fail3.xml N test/oasis/baseline/oasis/p05fail1.xml N test/oasis/baseline/oasis/p05fail2.xml N test/oasis/baseline/oasis/p05fail3.xml N test/oasis/baseline/oasis/p05fail4.xml N test/oasis/baseline/oasis/p05fail5.xml N test/oasis/baseline/oasis/p09fail1.xml N test/oasis/baseline/oasis/p09fail2.xml N test/oasis/baseline/oasis/p09fail3.xml N test/oasis/baseline/oasis/p09fail4.xml N test/oasis/baseline/oasis/p09fail5.xml N test/oasis/baseline/oasis/p10fail1.xml N test/oasis/baseline/oasis/p10fail2.xml N test/oasis/baseline/oasis/p10fail3.xml N test/oasis/baseline/oasis/p11fail1.xml N test/oasis/baseline/oasis/p11fail2.xml N test/oasis/baseline/oasis/p12fail1.xml N test/oasis/baseline/oasis/p12fail2.xml N test/oasis/baseline/oasis/p12fail3.xml N test/oasis/baseline/oasis/p12fail4.xml N test/oasis/baseline/oasis/p12fail5.xml N test/oasis/baseline/oasis/p12fail6.xml N test/oasis/baseline/oasis/p12fail7.xml N test/oasis/baseline/oasis/p14fail1.xml N test/oasis/baseline/oasis/p14fail2.xml N test/oasis/baseline/oasis/p14fail3.xml N test/oasis/baseline/oasis/p15fail1.xml N test/oasis/baseline/oasis/p15fail2.xml N test/oasis/baseline/oasis/p15fail3.xml N test/oasis/baseline/oasis/p16fail1.xml N test/oasis/baseline/oasis/p16fail2.xml N test/oasis/baseline/oasis/p18fail1.xml N test/oasis/baseline/oasis/p18fail2.xml N test/oasis/baseline/oasis/p18fail3.xml N test/oasis/baseline/oasis/p22fail1.xml N test/oasis/baseline/oasis/p22fail2.xml N test/oasis/baseline/oasis/p23fail1.xml N test/oasis/baseline/oasis/p23fail2.xml N test/oasis/baseline/oasis/p23fail3.xml N test/oasis/baseline/oasis/p23fail4.xml N test/oasis/baseline/oasis/p23fail5.xml N test/oasis/baseline/oasis/p24fail1.xml N test/oasis/baseline/oasis/p24fail2.xml N test/oasis/baseline/oasis/p25fail1.xml N test/oasis/baseline/oasis/p26fail1.xml N test/oasis/baseline/oasis/p26fail2.xml N test/oasis/baseline/oasis/p27fail1.xml N test/oasis/baseline/oasis/p28fail1.xml N test/oasis/baseline/oasis/p29fail1.xml N test/oasis/baseline/oasis/p30fail1.xml N test/oasis/baseline/oasis/p31fail1.xml N test/oasis/baseline/oasis/p32fail1.xml N test/oasis/baseline/oasis/p32fail2.xml N test/oasis/baseline/oasis/p32fail3.xml N test/oasis/baseline/oasis/p32fail4.xml N test/oasis/baseline/oasis/p32fail5.xml N test/oasis/baseline/oasis/p39fail1.xml N test/oasis/baseline/oasis/p39fail2.xml N test/oasis/baseline/oasis/p39fail3.xml N test/oasis/baseline/oasis/p39fail4.xml N test/oasis/baseline/oasis/p39fail5.xml N test/oasis/baseline/oasis/p40fail1.xml N test/oasis/baseline/oasis/p40fail2.xml N test/oasis/baseline/oasis/p40fail3.xml N test/oasis/baseline/oasis/p40fail4.xml N test/oasis/baseline/oasis/p41fail1.xml N test/oasis/baseline/oasis/p41fail2.xml N test/oasis/baseline/oasis/p41fail3.xml N test/oasis/baseline/oasis/p42fail1.xml N test/oasis/baseline/oasis/p42fail2.xml N test/oasis/baseline/oasis/p42fail3.xml N test/oasis/baseline/oasis/p43fail1.xml N test/oasis/baseline/oasis/p43fail2.xml N test/oasis/baseline/oasis/p43fail3.xml N test/oasis/baseline/oasis/p44fail1.xml N test/oasis/baseline/oasis/p44fail2.xml N test/oasis/baseline/oasis/p44fail3.xml N test/oasis/baseline/oasis/p44fail4.xml N test/oasis/baseline/oasis/p44fail5.xml N test/oasis/baseline/oasis/p45fail1.xml N test/oasis/baseline/oasis/p45fail2.xml N test/oasis/baseline/oasis/p45fail3.xml N test/oasis/baseline/oasis/p45fail4.xml N test/oasis/baseline/oasis/p46fail1.xml N test/oasis/baseline/oasis/p46fail2.xml N test/oasis/baseline/oasis/p46fail3.xml N test/oasis/baseline/oasis/p46fail4.xml N test/oasis/baseline/oasis/p46fail5.xml N test/oasis/baseline/oasis/p46fail6.xml N test/oasis/baseline/oasis/p47fail1.xml N test/oasis/baseline/oasis/p47fail2.xml N test/oasis/baseline/oasis/p47fail3.xml N test/oasis/baseline/oasis/p47fail4.xml N test/oasis/baseline/oasis/p48fail1.xml N test/oasis/baseline/oasis/p48fail2.xml N test/oasis/baseline/oasis/p49fail1.xml N test/oasis/baseline/oasis/p50fail1.xml N test/oasis/baseline/oasis/p51fail1.xml N test/oasis/baseline/oasis/p51fail2.xml N test/oasis/baseline/oasis/p51fail3.xml N test/oasis/baseline/oasis/p51fail4.xml N test/oasis/baseline/oasis/p51fail5.xml N test/oasis/baseline/oasis/p51fail6.xml N test/oasis/baseline/oasis/p51fail7.xml N test/oasis/baseline/oasis/p52fail1.xml N test/oasis/baseline/oasis/p52fail2.xml N test/oasis/baseline/oasis/p53fail1.xml N test/oasis/baseline/oasis/p53fail2.xml N test/oasis/baseline/oasis/p53fail3.xml N test/oasis/baseline/oasis/p53fail4.xml N test/oasis/baseline/oasis/p53fail5.xml N test/oasis/baseline/oasis/p54fail1.xml N test/oasis/baseline/oasis/p55fail1.xml N test/oasis/baseline/oasis/p56fail1.xml N test/oasis/baseline/oasis/p56fail2.xml N test/oasis/baseline/oasis/p56fail3.xml N test/oasis/baseline/oasis/p56fail4.xml N test/oasis/baseline/oasis/p56fail5.xml N test/oasis/baseline/oasis/p57fail1.xml N test/oasis/baseline/oasis/p58fail1.xml N test/oasis/baseline/oasis/p58fail2.xml N test/oasis/baseline/oasis/p58fail3.xml N test/oasis/baseline/oasis/p58fail4.xml N test/oasis/baseline/oasis/p58fail5.xml N test/oasis/baseline/oasis/p58fail6.xml N test/oasis/baseline/oasis/p58fail7.xml N test/oasis/baseline/oasis/p58fail8.xml N test/oasis/baseline/oasis/p59fail1.xml N test/oasis/baseline/oasis/p59fail2.xml N test/oasis/baseline/oasis/p59fail3.xml N test/oasis/baseline/oasis/p60fail1.xml N test/oasis/baseline/oasis/p60fail2.xml N test/oasis/baseline/oasis/p60fail3.xml N test/oasis/baseline/oasis/p60fail4.xml N test/oasis/baseline/oasis/p60fail5.xml N test/oasis/baseline/oasis/p61fail1.xml N test/oasis/baseline/oasis/p62fail1.xml N test/oasis/baseline/oasis/p62fail2.xml N test/oasis/baseline/oasis/p63fail1.xml N test/oasis/baseline/oasis/p63fail2.xml N test/oasis/baseline/oasis/p64fail1.xml N test/oasis/baseline/oasis/p64fail2.xml N test/oasis/baseline/oasis/p66fail1.xml N test/oasis/baseline/oasis/p66fail2.xml N test/oasis/baseline/oasis/p66fail3.xml N test/oasis/baseline/oasis/p66fail4.xml N test/oasis/baseline/oasis/p66fail5.xml N test/oasis/baseline/oasis/p66fail6.xml N test/oasis/baseline/oasis/p68fail1.xml N test/oasis/baseline/oasis/p68fail2.xml N test/oasis/baseline/oasis/p68fail3.xml N test/oasis/baseline/oasis/p69fail1.xml N test/oasis/baseline/oasis/p69fail2.xml N test/oasis/baseline/oasis/p69fail3.xml N test/oasis/baseline/oasis/p70fail1.xml N test/oasis/baseline/oasis/p71fail1.xml N test/oasis/baseline/oasis/p71fail2.xml N test/oasis/baseline/oasis/p71fail3.xml N test/oasis/baseline/oasis/p71fail4.xml N test/oasis/baseline/oasis/p72fail1.xml N test/oasis/baseline/oasis/p72fail2.xml N test/oasis/baseline/oasis/p72fail3.xml N test/oasis/baseline/oasis/p72fail4.xml N test/oasis/baseline/oasis/p73fail1.xml N test/oasis/baseline/oasis/p73fail2.xml N test/oasis/baseline/oasis/p73fail3.xml N test/oasis/baseline/oasis/p73fail4.xml N test/oasis/baseline/oasis/p73fail5.xml N test/oasis/baseline/oasis/p74fail1.xml N test/oasis/baseline/oasis/p74fail2.xml N test/oasis/baseline/oasis/p74fail3.xml N test/oasis/baseline/oasis/p75fail1.xml N test/oasis/baseline/oasis/p75fail2.xml N test/oasis/baseline/oasis/p75fail3.xml N test/oasis/baseline/oasis/p75fail4.xml N test/oasis/baseline/oasis/p75fail5.xml N test/oasis/baseline/oasis/p75fail6.xml N test/oasis/baseline/oasis/p76fail1.xml N test/oasis/baseline/oasis/p76fail2.xml N test/oasis/baseline/oasis/p76fail3.xml N test/oasis/baseline/oasis/p76fail4.xml N test/oasis/baseline/oasis/p11pass1.xml N test/oasis/baseline/valid/dtd00.xml N test/oasis/baseline/valid/dtd01.xml N test/oasis/baseline/valid/element.xml N test/oasis/baseline/valid/empty.xml N test/oasis/baseline/valid/ext01.xml N test/oasis/baseline/valid/ext02.xml N test/oasis/baseline/valid/not-sa01.xml N test/oasis/baseline/valid/not-sa02.xml N test/oasis/baseline/valid/not-sa03.xml N test/oasis/baseline/valid/not-sa04.xml N test/oasis/baseline/valid/notation01.xml N test/oasis/baseline/valid/optional.xml N test/oasis/baseline/valid/required00.xml N test/oasis/baseline/valid/sa01.xml N test/oasis/baseline/valid/sa02.xml N test/oasis/baseline/valid/sa03.xml N test/oasis/baseline/valid/sa04.xml N test/oasis/baseline/valid/sa05.xml N test/oasis/baseline/valid/sgml01.xml N test/oasis/baseline/valid/v-lang01.xml N test/oasis/baseline/valid/v-lang02.xml N test/oasis/baseline/valid/v-lang03.xml N test/oasis/baseline/valid/v-lang04.xml N test/oasis/baseline/valid/v-lang05.xml N test/oasis/baseline/valid/v-lang06.xml N test/oasis/baseline/valid/pe00.xml N test/oasis/baseline/valid/pe01.xml N test/oasis/baseline/valid/pe02.xml N test/oasis/baseline/xmltest/not-wf/sa/001.xml N test/oasis/baseline/xmltest/not-wf/sa/002.xml N test/oasis/baseline/xmltest/not-wf/sa/003.xml N test/oasis/baseline/xmltest/not-wf/sa/004.xml N test/oasis/baseline/xmltest/not-wf/sa/005.xml N test/oasis/baseline/xmltest/not-wf/sa/006.xml N test/oasis/baseline/xmltest/not-wf/sa/007.xml N test/oasis/baseline/xmltest/not-wf/sa/008.xml N test/oasis/baseline/xmltest/not-wf/sa/009.xml N test/oasis/baseline/xmltest/not-wf/sa/010.xml N test/oasis/baseline/xmltest/not-wf/sa/011.xml N test/oasis/baseline/xmltest/not-wf/sa/012.xml N test/oasis/baseline/xmltest/not-wf/sa/013.xml N test/oasis/baseline/xmltest/not-wf/sa/014.xml N test/oasis/baseline/xmltest/not-wf/sa/015.xml N test/oasis/baseline/xmltest/not-wf/sa/016.xml N test/oasis/baseline/xmltest/not-wf/sa/017.xml N test/oasis/baseline/xmltest/not-wf/sa/018.xml N test/oasis/baseline/xmltest/not-wf/sa/019.xml N test/oasis/baseline/xmltest/not-wf/sa/020.xml N test/oasis/baseline/xmltest/not-wf/sa/021.xml N test/oasis/baseline/xmltest/not-wf/sa/022.xml N test/oasis/baseline/xmltest/not-wf/sa/023.xml N test/oasis/baseline/xmltest/not-wf/sa/024.xml N test/oasis/baseline/xmltest/not-wf/sa/025.xml N test/oasis/baseline/xmltest/not-wf/sa/026.xml N test/oasis/baseline/xmltest/not-wf/sa/027.xml N test/oasis/baseline/xmltest/not-wf/sa/028.xml N test/oasis/baseline/xmltest/not-wf/sa/029.xml N test/oasis/baseline/xmltest/not-wf/sa/030.xml N test/oasis/baseline/xmltest/not-wf/sa/031.xml N test/oasis/baseline/xmltest/not-wf/sa/032.xml N test/oasis/baseline/xmltest/not-wf/sa/033.xml N test/oasis/baseline/xmltest/not-wf/sa/034.xml N test/oasis/baseline/xmltest/not-wf/sa/035.xml N test/oasis/baseline/xmltest/not-wf/sa/036.xml N test/oasis/baseline/xmltest/not-wf/sa/037.xml N test/oasis/baseline/xmltest/not-wf/sa/038.xml N test/oasis/baseline/xmltest/not-wf/sa/039.xml N test/oasis/baseline/xmltest/not-wf/sa/040.xml N test/oasis/baseline/xmltest/not-wf/sa/041.xml N test/oasis/baseline/xmltest/not-wf/sa/042.xml N test/oasis/baseline/xmltest/not-wf/sa/043.xml N test/oasis/baseline/xmltest/not-wf/sa/044.xml N test/oasis/baseline/xmltest/not-wf/sa/045.xml N test/oasis/baseline/xmltest/not-wf/sa/046.xml N test/oasis/baseline/xmltest/not-wf/sa/047.xml N test/oasis/baseline/xmltest/not-wf/sa/048.xml N test/oasis/baseline/xmltest/not-wf/sa/049.xml N test/oasis/baseline/xmltest/not-wf/sa/050.xml N test/oasis/baseline/xmltest/not-wf/sa/051.xml N test/oasis/baseline/xmltest/not-wf/sa/052.xml N test/oasis/baseline/xmltest/not-wf/sa/053.xml N test/oasis/baseline/xmltest/not-wf/sa/054.xml N test/oasis/baseline/xmltest/not-wf/sa/055.xml N test/oasis/baseline/xmltest/not-wf/sa/056.xml N test/oasis/baseline/xmltest/not-wf/sa/057.xml N test/oasis/baseline/xmltest/not-wf/sa/058.xml N test/oasis/baseline/xmltest/not-wf/sa/059.xml N test/oasis/baseline/xmltest/not-wf/sa/060.xml N test/oasis/baseline/xmltest/not-wf/sa/061.xml N test/oasis/baseline/xmltest/not-wf/sa/062.xml N test/oasis/baseline/xmltest/not-wf/sa/063.xml N test/oasis/baseline/xmltest/not-wf/sa/064.xml N test/oasis/baseline/xmltest/not-wf/sa/065.xml N test/oasis/baseline/xmltest/not-wf/sa/066.xml N test/oasis/baseline/xmltest/not-wf/sa/067.xml N test/oasis/baseline/xmltest/not-wf/sa/068.xml N test/oasis/baseline/xmltest/not-wf/sa/069.xml N test/oasis/baseline/xmltest/not-wf/sa/070.xml N test/oasis/baseline/xmltest/not-wf/sa/071.xml N test/oasis/baseline/xmltest/not-wf/sa/072.xml N test/oasis/baseline/xmltest/not-wf/sa/073.xml N test/oasis/baseline/xmltest/not-wf/sa/074.xml N test/oasis/baseline/xmltest/not-wf/sa/075.xml N test/oasis/baseline/xmltest/not-wf/sa/076.xml N test/oasis/baseline/xmltest/not-wf/sa/077.xml N test/oasis/baseline/xmltest/not-wf/sa/078.xml N test/oasis/baseline/xmltest/not-wf/sa/079.xml N test/oasis/baseline/xmltest/not-wf/sa/080.xml N test/oasis/baseline/xmltest/not-wf/sa/081.xml N test/oasis/baseline/xmltest/not-wf/sa/082.xml N test/oasis/baseline/xmltest/not-wf/sa/083.xml N test/oasis/baseline/xmltest/not-wf/sa/084.xml N test/oasis/baseline/xmltest/not-wf/sa/085.xml N test/oasis/baseline/xmltest/not-wf/sa/086.xml N test/oasis/baseline/xmltest/not-wf/sa/087.xml N test/oasis/baseline/xmltest/not-wf/sa/088.xml N test/oasis/baseline/xmltest/not-wf/sa/089.xml N test/oasis/baseline/xmltest/not-wf/sa/090.xml N test/oasis/baseline/xmltest/not-wf/sa/091.xml N test/oasis/baseline/xmltest/not-wf/sa/092.xml N test/oasis/baseline/xmltest/not-wf/sa/093.xml N test/oasis/baseline/xmltest/not-wf/sa/094.xml N test/oasis/baseline/xmltest/not-wf/sa/095.xml N test/oasis/baseline/xmltest/not-wf/sa/096.xml N test/oasis/baseline/xmltest/not-wf/sa/097.xml N test/oasis/baseline/xmltest/not-wf/sa/098.xml N test/oasis/baseline/xmltest/not-wf/sa/099.xml N test/oasis/baseline/xmltest/not-wf/sa/100.xml N test/oasis/baseline/xmltest/not-wf/sa/101.xml N test/oasis/baseline/xmltest/not-wf/sa/102.xml N test/oasis/baseline/xmltest/not-wf/sa/103.xml N test/oasis/baseline/xmltest/not-wf/sa/104.xml N test/oasis/baseline/xmltest/not-wf/sa/105.xml N test/oasis/baseline/xmltest/not-wf/sa/106.xml N test/oasis/baseline/xmltest/not-wf/sa/107.xml N test/oasis/baseline/xmltest/not-wf/sa/108.xml N test/oasis/baseline/xmltest/not-wf/sa/109.xml N test/oasis/baseline/xmltest/not-wf/sa/110.xml N test/oasis/baseline/xmltest/not-wf/sa/111.xml N test/oasis/baseline/xmltest/not-wf/sa/112.xml N test/oasis/baseline/xmltest/not-wf/sa/113.xml N test/oasis/baseline/xmltest/not-wf/sa/114.xml N test/oasis/baseline/xmltest/not-wf/sa/115.xml N test/oasis/baseline/xmltest/not-wf/sa/116.xml N test/oasis/baseline/xmltest/not-wf/sa/117.xml N test/oasis/baseline/xmltest/not-wf/sa/118.xml N test/oasis/baseline/xmltest/not-wf/sa/119.xml N test/oasis/baseline/xmltest/not-wf/sa/120.xml N test/oasis/baseline/xmltest/not-wf/sa/121.xml N test/oasis/baseline/xmltest/not-wf/sa/122.xml N test/oasis/baseline/xmltest/not-wf/sa/123.xml N test/oasis/baseline/xmltest/not-wf/sa/124.xml N test/oasis/baseline/xmltest/not-wf/sa/125.xml N test/oasis/baseline/xmltest/not-wf/sa/126.xml N test/oasis/baseline/xmltest/not-wf/sa/127.xml N test/oasis/baseline/xmltest/not-wf/sa/128.xml N test/oasis/baseline/xmltest/not-wf/sa/129.xml N test/oasis/baseline/xmltest/not-wf/sa/130.xml N test/oasis/baseline/xmltest/not-wf/sa/131.xml N test/oasis/baseline/xmltest/not-wf/sa/132.xml N test/oasis/baseline/xmltest/not-wf/sa/133.xml N test/oasis/baseline/xmltest/not-wf/sa/134.xml N test/oasis/baseline/xmltest/not-wf/sa/135.xml N test/oasis/baseline/xmltest/not-wf/sa/136.xml N test/oasis/baseline/xmltest/not-wf/sa/137.xml N test/oasis/baseline/xmltest/not-wf/sa/138.xml N test/oasis/baseline/xmltest/not-wf/sa/139.xml N test/oasis/baseline/xmltest/not-wf/sa/140.xml N test/oasis/baseline/xmltest/not-wf/sa/141.xml N test/oasis/baseline/xmltest/not-wf/sa/142.xml N test/oasis/baseline/xmltest/not-wf/sa/143.xml N test/oasis/baseline/xmltest/not-wf/sa/144.xml N test/oasis/baseline/xmltest/not-wf/sa/145.xml N test/oasis/baseline/xmltest/not-wf/sa/146.xml N test/oasis/baseline/xmltest/not-wf/sa/147.xml N test/oasis/baseline/xmltest/not-wf/sa/148.xml N test/oasis/baseline/xmltest/not-wf/sa/149.xml N test/oasis/baseline/xmltest/not-wf/sa/150.xml N test/oasis/baseline/xmltest/not-wf/sa/151.xml N test/oasis/baseline/xmltest/not-wf/sa/152.xml N test/oasis/baseline/xmltest/not-wf/sa/153.xml N test/oasis/baseline/xmltest/not-wf/sa/154.xml N test/oasis/baseline/xmltest/not-wf/sa/155.xml N test/oasis/baseline/xmltest/not-wf/sa/156.xml N test/oasis/baseline/xmltest/not-wf/sa/157.xml N test/oasis/baseline/xmltest/not-wf/sa/158.xml N test/oasis/baseline/xmltest/not-wf/sa/159.xml N test/oasis/baseline/xmltest/not-wf/sa/160.xml N test/oasis/baseline/xmltest/not-wf/sa/161.xml N test/oasis/baseline/xmltest/not-wf/sa/162.xml N test/oasis/baseline/xmltest/not-wf/sa/163.xml N test/oasis/baseline/xmltest/not-wf/sa/164.xml N test/oasis/baseline/xmltest/not-wf/sa/165.xml N test/oasis/baseline/xmltest/not-wf/sa/166.xml N test/oasis/baseline/xmltest/not-wf/sa/167.xml N test/oasis/baseline/xmltest/not-wf/sa/168.xml N test/oasis/baseline/xmltest/not-wf/sa/169.xml N test/oasis/baseline/xmltest/not-wf/sa/170.xml N test/oasis/baseline/xmltest/not-wf/sa/171.xml N test/oasis/baseline/xmltest/not-wf/sa/172.xml N test/oasis/baseline/xmltest/not-wf/sa/173.xml N test/oasis/baseline/xmltest/not-wf/sa/174.xml N test/oasis/baseline/xmltest/not-wf/sa/175.xml N test/oasis/baseline/xmltest/not-wf/sa/176.xml N test/oasis/baseline/xmltest/not-wf/sa/177.xml N test/oasis/baseline/xmltest/not-wf/sa/178.xml N test/oasis/baseline/xmltest/not-wf/sa/179.xml N test/oasis/baseline/xmltest/not-wf/sa/180.xml N test/oasis/baseline/xmltest/not-wf/sa/181.xml N test/oasis/baseline/xmltest/not-wf/sa/182.xml N test/oasis/baseline/xmltest/not-wf/sa/183.xml N test/oasis/baseline/xmltest/not-wf/sa/184.xml N test/oasis/baseline/xmltest/not-wf/sa/185.xml N test/oasis/baseline/xmltest/not-wf/sa/186.xml N test/oasis/baseline/xmltest/not-wf/not-sa/001.xml N test/oasis/baseline/xmltest/not-wf/not-sa/002.xml N test/oasis/baseline/xmltest/not-wf/not-sa/003.xml N test/oasis/baseline/xmltest/not-wf/not-sa/004.xml N test/oasis/baseline/xmltest/not-wf/not-sa/005.xml N test/oasis/baseline/xmltest/not-wf/not-sa/006.xml N test/oasis/baseline/xmltest/not-wf/not-sa/007.xml N test/oasis/baseline/xmltest/not-wf/not-sa/008.xml N test/oasis/baseline/xmltest/not-wf/ext-sa/001.xml N test/oasis/baseline/xmltest/not-wf/ext-sa/002.xml N test/oasis/baseline/xmltest/not-wf/ext-sa/003.xml N test/oasis/baseline/xmltest/invalid/001.xml N test/oasis/baseline/xmltest/invalid/002.xml N test/oasis/baseline/xmltest/invalid/003.xml N test/oasis/baseline/xmltest/invalid/004.xml N test/oasis/baseline/xmltest/invalid/005.xml N test/oasis/baseline/xmltest/invalid/006.xml N test/oasis/baseline/xmltest/valid/sa/001.xml N test/oasis/baseline/xmltest/valid/sa/002.xml N test/oasis/baseline/xmltest/valid/sa/003.xml N test/oasis/baseline/xmltest/valid/sa/004.xml N test/oasis/baseline/xmltest/valid/sa/005.xml N test/oasis/baseline/xmltest/valid/sa/006.xml N test/oasis/baseline/xmltest/valid/sa/007.xml N test/oasis/baseline/xmltest/valid/sa/008.xml N test/oasis/baseline/xmltest/valid/sa/009.xml N test/oasis/baseline/xmltest/valid/sa/010.xml N test/oasis/baseline/xmltest/valid/sa/011.xml N test/oasis/baseline/xmltest/valid/sa/012.xml N test/oasis/baseline/xmltest/valid/sa/013.xml N test/oasis/baseline/xmltest/valid/sa/014.xml N test/oasis/baseline/xmltest/valid/sa/015.xml N test/oasis/baseline/xmltest/valid/sa/016.xml N test/oasis/baseline/xmltest/valid/sa/017.xml N test/oasis/baseline/xmltest/valid/sa/018.xml N test/oasis/baseline/xmltest/valid/sa/019.xml N test/oasis/baseline/xmltest/valid/sa/020.xml N test/oasis/baseline/xmltest/valid/sa/021.xml N test/oasis/baseline/xmltest/valid/sa/022.xml N test/oasis/baseline/xmltest/valid/sa/023.xml N test/oasis/baseline/xmltest/valid/sa/024.xml N test/oasis/baseline/xmltest/valid/sa/025.xml N test/oasis/baseline/xmltest/valid/sa/026.xml N test/oasis/baseline/xmltest/valid/sa/027.xml N test/oasis/baseline/xmltest/valid/sa/028.xml N test/oasis/baseline/xmltest/valid/sa/029.xml N test/oasis/baseline/xmltest/valid/sa/030.xml N test/oasis/baseline/xmltest/valid/sa/031.xml N test/oasis/baseline/xmltest/valid/sa/032.xml N test/oasis/baseline/xmltest/valid/sa/033.xml N test/oasis/baseline/xmltest/valid/sa/034.xml N test/oasis/baseline/xmltest/valid/sa/035.xml N test/oasis/baseline/xmltest/valid/sa/036.xml N test/oasis/baseline/xmltest/valid/sa/037.xml N test/oasis/baseline/xmltest/valid/sa/038.xml N test/oasis/baseline/xmltest/valid/sa/039.xml N test/oasis/baseline/xmltest/valid/sa/040.xml N test/oasis/baseline/xmltest/valid/sa/041.xml N test/oasis/baseline/xmltest/valid/sa/042.xml N test/oasis/baseline/xmltest/valid/sa/043.xml N test/oasis/baseline/xmltest/valid/sa/044.xml N test/oasis/baseline/xmltest/valid/sa/045.xml N test/oasis/baseline/xmltest/valid/sa/046.xml N test/oasis/baseline/xmltest/valid/sa/047.xml N test/oasis/baseline/xmltest/valid/sa/048.xml N test/oasis/baseline/xmltest/valid/sa/049.xml N test/oasis/baseline/xmltest/valid/sa/050.xml N test/oasis/baseline/xmltest/valid/sa/051.xml N test/oasis/baseline/xmltest/valid/sa/052.xml N test/oasis/baseline/xmltest/valid/sa/053.xml N test/oasis/baseline/xmltest/valid/sa/054.xml N test/oasis/baseline/xmltest/valid/sa/055.xml N test/oasis/baseline/xmltest/valid/sa/056.xml N test/oasis/baseline/xmltest/valid/sa/057.xml N test/oasis/baseline/xmltest/valid/sa/058.xml N test/oasis/baseline/xmltest/valid/sa/059.xml N test/oasis/baseline/xmltest/valid/sa/060.xml N test/oasis/baseline/xmltest/valid/sa/061.xml N test/oasis/baseline/xmltest/valid/sa/062.xml N test/oasis/baseline/xmltest/valid/sa/063.xml N test/oasis/baseline/xmltest/valid/sa/064.xml N test/oasis/baseline/xmltest/valid/sa/065.xml N test/oasis/baseline/xmltest/valid/sa/066.xml N test/oasis/baseline/xmltest/valid/sa/067.xml N test/oasis/baseline/xmltest/valid/sa/068.xml N test/oasis/baseline/xmltest/valid/sa/069.xml N test/oasis/baseline/xmltest/valid/sa/070.xml N test/oasis/baseline/xmltest/valid/sa/071.xml N test/oasis/baseline/xmltest/valid/sa/072.xml N test/oasis/baseline/xmltest/valid/sa/073.xml N test/oasis/baseline/xmltest/valid/sa/074.xml N test/oasis/baseline/xmltest/valid/sa/075.xml N test/oasis/baseline/xmltest/valid/sa/076.xml N test/oasis/baseline/xmltest/valid/sa/077.xml N test/oasis/baseline/xmltest/valid/sa/078.xml N test/oasis/baseline/xmltest/valid/sa/079.xml N test/oasis/baseline/xmltest/valid/sa/080.xml N test/oasis/baseline/xmltest/valid/sa/081.xml N test/oasis/baseline/xmltest/valid/sa/082.xml N test/oasis/baseline/xmltest/valid/sa/083.xml N test/oasis/baseline/xmltest/valid/sa/084.xml N test/oasis/baseline/xmltest/valid/sa/085.xml N test/oasis/baseline/xmltest/valid/sa/086.xml N test/oasis/baseline/xmltest/valid/sa/087.xml N test/oasis/baseline/xmltest/valid/sa/088.xml N test/oasis/baseline/xmltest/valid/sa/089.xml N test/oasis/baseline/xmltest/valid/sa/090.xml N test/oasis/baseline/xmltest/valid/sa/091.xml N test/oasis/baseline/xmltest/valid/sa/092.xml N test/oasis/baseline/xmltest/valid/sa/093.xml N test/oasis/baseline/xmltest/valid/sa/094.xml N test/oasis/baseline/xmltest/valid/sa/095.xml N test/oasis/baseline/xmltest/valid/sa/096.xml N test/oasis/baseline/xmltest/valid/sa/097.xml N test/oasis/baseline/xmltest/valid/sa/098.xml N test/oasis/baseline/xmltest/valid/sa/099.xml N test/oasis/baseline/xmltest/valid/sa/100.xml N test/oasis/baseline/xmltest/valid/sa/101.xml N test/oasis/baseline/xmltest/valid/sa/102.xml N test/oasis/baseline/xmltest/valid/sa/103.xml N test/oasis/baseline/xmltest/valid/sa/104.xml N test/oasis/baseline/xmltest/valid/sa/105.xml N test/oasis/baseline/xmltest/valid/sa/106.xml N test/oasis/baseline/xmltest/valid/sa/107.xml N test/oasis/baseline/xmltest/valid/sa/108.xml N test/oasis/baseline/xmltest/valid/sa/109.xml N test/oasis/baseline/xmltest/valid/sa/110.xml N test/oasis/baseline/xmltest/valid/sa/111.xml N test/oasis/baseline/xmltest/valid/sa/112.xml N test/oasis/baseline/xmltest/valid/sa/113.xml N test/oasis/baseline/xmltest/valid/sa/114.xml N test/oasis/baseline/xmltest/valid/sa/115.xml N test/oasis/baseline/xmltest/valid/sa/116.xml N test/oasis/baseline/xmltest/valid/sa/117.xml N test/oasis/baseline/xmltest/valid/sa/118.xml N test/oasis/baseline/xmltest/valid/sa/119.xml N test/oasis/baseline/xmltest/valid/not-sa/001.xml N test/oasis/baseline/xmltest/valid/not-sa/002.xml N test/oasis/baseline/xmltest/valid/not-sa/003.xml N test/oasis/baseline/xmltest/valid/not-sa/004.xml N test/oasis/baseline/xmltest/valid/not-sa/005.xml N test/oasis/baseline/xmltest/valid/not-sa/006.xml N test/oasis/baseline/xmltest/valid/not-sa/007.xml N test/oasis/baseline/xmltest/valid/not-sa/008.xml N test/oasis/baseline/xmltest/valid/not-sa/009.xml N test/oasis/baseline/xmltest/valid/not-sa/010.xml N test/oasis/baseline/xmltest/valid/not-sa/011.xml N test/oasis/baseline/xmltest/valid/not-sa/012.xml N test/oasis/baseline/xmltest/valid/not-sa/013.xml N test/oasis/baseline/xmltest/valid/not-sa/014.xml N test/oasis/baseline/xmltest/valid/not-sa/015.xml N test/oasis/baseline/xmltest/valid/not-sa/016.xml N test/oasis/baseline/xmltest/valid/not-sa/017.xml N test/oasis/baseline/xmltest/valid/not-sa/018.xml N test/oasis/baseline/xmltest/valid/not-sa/019.xml N test/oasis/baseline/xmltest/valid/not-sa/020.xml N test/oasis/baseline/xmltest/valid/not-sa/021.xml N test/oasis/baseline/xmltest/valid/not-sa/022.xml N test/oasis/baseline/xmltest/valid/not-sa/023.xml N test/oasis/baseline/xmltest/valid/not-sa/024.xml N test/oasis/baseline/xmltest/valid/not-sa/025.xml N test/oasis/baseline/xmltest/valid/not-sa/026.xml N test/oasis/baseline/xmltest/valid/not-sa/027.xml N test/oasis/baseline/xmltest/valid/not-sa/028.xml N test/oasis/baseline/xmltest/valid/not-sa/029.xml N test/oasis/baseline/xmltest/valid/not-sa/030.xml N test/oasis/baseline/xmltest/valid/not-sa/031.xml N test/oasis/baseline/xmltest/valid/ext-sa/001.xml N test/oasis/baseline/xmltest/valid/ext-sa/002.xml N test/oasis/baseline/xmltest/valid/ext-sa/003.xml N test/oasis/baseline/xmltest/valid/ext-sa/004.xml N test/oasis/baseline/xmltest/valid/ext-sa/005.xml N test/oasis/baseline/xmltest/valid/ext-sa/006.xml N test/oasis/baseline/xmltest/valid/ext-sa/007.xml N test/oasis/baseline/xmltest/valid/ext-sa/008.xml N test/oasis/baseline/xmltest/valid/ext-sa/009.xml N test/oasis/baseline/xmltest/valid/ext-sa/011.xml N test/oasis/baseline/xmltest/valid/ext-sa/012.xml N test/oasis/baseline/xmltest/valid/ext-sa/013.xml N test/oasis/baseline/xmltest/valid/ext-sa/014.xml N test/oasis/baseline/myown/long-comment.xml No conflicts created by this import ***** Bogus filespec: - ***** Bogus filespec: Imported ***** Bogus filespec: sources From fdrake@users.sourceforge.net Thu Mar 29 22:22:25 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 29 Mar 2001 14:22:25 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libcursespanel.tex,1.1,1.2 Message-ID: <E14ikoD-0001Vs-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv5800/lib Modified Files: libcursespanel.tex Log Message: Fix serious markup errors. Index: libcursespanel.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcursespanel.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** libcursespanel.tex 2000/12/22 21:57:42 1.1 --- libcursespanel.tex 2001/03/29 22:22:23 1.2 *************** *** 21,27 **** \end{funcdesc} ! \begin{methoddesc}{new_panel}{win} Returns a panel object, associating it with the given window \var{win}. ! \end{methoddesc} \begin{funcdesc}{top_panel}{} --- 21,27 ---- \end{funcdesc} ! \begin{funcdesc}{new_panel}{win} Returns a panel object, associating it with the given window \var{win}. ! \end{funcdesc} \begin{funcdesc}{top_panel}{} *************** *** 43,63 **** Panel objects have the following methods: ! \begin{methoddesc}{above} Returns the panel above the current panel. \end{methoddesc} ! \begin{methoddesc}{below} Returns the panel below the current panel. \end{methoddesc} ! \begin{methoddesc}{bottom} Push the panel to the bottom of the stack. \end{methoddesc} ! \begin{methoddesc}{hidden} Returns true if the panel is hidden (not visible), false otherwise. \end{methoddesc} ! \begin{methoddesc}{hide} Hide the panel. This does not delete the object, it just makes the window on screen invisible. --- 43,63 ---- Panel objects have the following methods: ! \begin{methoddesc}{above}{} Returns the panel above the current panel. \end{methoddesc} ! \begin{methoddesc}{below}{} Returns the panel below the current panel. \end{methoddesc} ! \begin{methoddesc}{bottom}{} Push the panel to the bottom of the stack. \end{methoddesc} ! \begin{methoddesc}{hidden}{} Returns true if the panel is hidden (not visible), false otherwise. \end{methoddesc} ! \begin{methoddesc}{hide}{} Hide the panel. This does not delete the object, it just makes the window on screen invisible. *************** *** 77,93 **** \end{methoddesc} ! \begin{methoddesc}{show} Display the panel (which might have been hidden). \end{methoddesc} ! \begin{methoddesc}{top} Push panel to the top of the stack. \end{methoddesc} ! \begin{methoddesc}{userptr} Returns the user pointer for the panel. This might be any Python object. \end{methoddesc} ! \begin{methoddesc}{window} Returns the window object associated with the panel. \end{methoddesc} --- 77,93 ---- \end{methoddesc} ! \begin{methoddesc}{show}{} Display the panel (which might have been hidden). \end{methoddesc} ! \begin{methoddesc}{top}{} Push panel to the top of the stack. \end{methoddesc} ! \begin{methoddesc}{userptr}{} Returns the user pointer for the panel. This might be any Python object. \end{methoddesc} ! \begin{methoddesc}{window}{} Returns the window object associated with the panel. \end{methoddesc} From fdrake@users.sourceforge.net Thu Mar 29 22:23:21 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 29 Mar 2001 14:23:21 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc Makefile.deps,1.62,1.63 Message-ID: <E14ikp7-0001Yj-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc In directory usw-pr-cvs1:/tmp/cvs-serv5984 Modified Files: Makefile.deps Log Message: Add entry for curses.panel documentation. Index: Makefile.deps =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile.deps,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -r1.62 -r1.63 *** Makefile.deps 2001/03/23 16:23:21 1.62 --- Makefile.deps 2001/03/29 22:23:18 1.63 *************** *** 242,245 **** --- 242,246 ---- lib/libcodeop.tex \ lib/libcurses.tex \ + lib/libcursespanel.tex \ lib/libascii.tex \ lib/libdl.tex \ From fdrake@users.sourceforge.net Thu Mar 29 22:23:21 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 29 Mar 2001 14:23:21 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib lib.tex,1.183,1.184 Message-ID: <E14ikp7-0001Yo-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv5984/lib Modified Files: lib.tex Log Message: Add entry for curses.panel documentation. Index: lib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/lib.tex,v retrieving revision 1.183 retrieving revision 1.184 diff -C2 -r1.183 -r1.184 *** lib.tex 2001/03/01 19:54:29 1.183 --- lib.tex 2001/03/29 22:23:19 1.184 *************** *** 141,144 **** --- 141,145 ---- \input{libcurses} \input{libascii} % curses.ascii + \input{libcursespanel} \input{libgetopt} \input{libtempfile} From fdrake@users.sourceforge.net Thu Mar 29 23:31:24 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 29 Mar 2001 15:31:24 -0800 Subject: [Python-checkins] CVS: python/dist/src/Doc/tools/sgmlconv docfixer.py,1.27,1.28 Message-ID: <E14ilsy-0003po-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/tools/sgmlconv In directory usw-pr-cvs1:/tmp/cvs-serv14725 Modified Files: docfixer.py Log Message: Allow the <author/> element to appear before a paragraph without being made a part of the paragraph. Index: docfixer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/sgmlconv/docfixer.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -r1.27 -r1.28 *** docfixer.py 2001/03/23 17:09:02 1.27 --- docfixer.py 2001/03/29 23:31:22 1.28 *************** *** 620,624 **** PARA_LEVEL_PRECEEDERS = ( ! "setindexsubitem", "stindex", "obindex", "COMMENT", "label", "input", "title", "versionadded", "versionchanged", "declaremodule", "modulesynopsis", --- 620,624 ---- PARA_LEVEL_PRECEEDERS = ( ! "setindexsubitem", "author", "stindex", "obindex", "COMMENT", "label", "input", "title", "versionadded", "versionchanged", "declaremodule", "modulesynopsis", From moshez@users.sourceforge.net Fri Mar 30 13:55:54 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 30 Mar 2001 05:55:54 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.2,1.81.2.3 Message-ID: <E14izNa-0007GC-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv24110/Misc Modified Files: Tag: release20-maint NEWS Log Message: Documenting the _curses bug fix. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.2 retrieving revision 1.81.2.3 diff -C2 -r1.81.2.2 -r1.81.2.3 *** NEWS 2001/03/15 17:12:36 1.81.2.2 --- NEWS 2001/03/30 13:55:52 1.81.2.3 *************** *** 16,19 **** --- 16,21 ---- - #117278, #117167: _tkinter + - #116172, curses module fails to build on SGI, _curses + What's New in Python 2.0? ========================= From moshez@users.sourceforge.net Fri Mar 30 14:23:08 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 30 Mar 2001 06:23:08 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules _cursesmodule.c,2.39.2.1,2.39.2.2 Message-ID: <E14iznw-0008W3-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv29389/Modules Modified Files: Tag: release20-maint _cursesmodule.c Log Message: More _curses compilation-problem fixes. NetBSD, IRIX and platforms with term.h that makes "lines" a macro Index: _cursesmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_cursesmodule.c,v retrieving revision 2.39.2.1 retrieving revision 2.39.2.2 diff -C2 -r2.39.2.1 -r2.39.2.2 *** _cursesmodule.c 2001/03/29 19:27:29 2.39.2.1 --- _cursesmodule.c 2001/03/30 14:23:06 2.39.2.2 *************** *** 85,88 **** --- 85,89 ---- prototype here. */ extern char *tigetstr(char *); + extern char *tparm(char *instring, ...); #endif *************** *** 92,95 **** --- 93,100 ---- #endif + #if defined(_AIX) + #define STRICT_SYSV_CURSES + #endif + /* Definition of exception curses.error */ *************** *** 262,268 **** --- 267,281 ---- Window_OneArgNoReturnFunction(clearok, int, "i;True(1) or False(0)") Window_OneArgNoReturnFunction(idlok, int, "i;True(1) or False(0)") + #if defined(__NetBSD__) + Window_OneArgNoReturnVoidFunction(keypad, int, "i;True(1) or False(0)") + #else Window_OneArgNoReturnFunction(keypad, int, "i;True(1) or False(0)") + #endif Window_OneArgNoReturnFunction(leaveok, int, "i;True(1) or False(0)") + #if defined(__NetBSD__) + Window_OneArgNoReturnVoidFunction(nodelay, int, "i;True(1) or False(0)") + #else Window_OneArgNoReturnFunction(nodelay, int, "i;True(1) or False(0)") + #endif Window_OneArgNoReturnFunction(notimeout, int, "i;True(1) or False(0)") Window_OneArgNoReturnFunction(scrollok, int, "i;True(1) or False(0)") *************** *** 607,614 **** --- 620,629 ---- } + #if !defined(__NetBSD__) if (self->win->_flags & _ISPAD) return PyCursesCheckERR(pechochar(self->win, ch | attr), "echochar"); else + #endif return PyCursesCheckERR(wechochar(self->win, ch | attr), "echochar"); *************** *** 687,691 **** --- 702,710 ---- return Py_BuildValue("c", rtn); else + #if defined(__NetBSD__) + return PyString_FromString(unctrl(rtn)); + #else return PyString_FromString((char *)keyname(rtn)); + #endif } *************** *** 1006,1010 **** --- 1025,1033 ---- int rtn; + #if defined(__NetBSD__) + if (0) { + #else if (self->win->_flags & _ISPAD) { + #endif switch(ARG_COUNT(args)) { case 6: *************** *** 1068,1072 **** --- 1091,1099 ---- int rtn; + #if defined(__NetBSD__) + if (0) { + #else if (self->win->_flags & _ISPAD) { + #endif switch(ARG_COUNT(args)) { case 6: *************** *** 1132,1138 **** --- 1159,1167 ---- /* printf("Subwin: %i %i %i %i \n", nlines, ncols, begin_y, begin_x); */ + #if !defined(__NetBSD__) if (self->win->_flags & _ISPAD) win = subpad(self->win, nlines, ncols, begin_y, begin_x); else + #endif win = subwin(self->win, nlines, ncols, begin_y, begin_x); *************** *** 1148,1152 **** PyCursesWindow_Scroll(PyCursesWindowObject *self, PyObject *args) { ! int lines; switch(ARG_COUNT(args)) { case 0: --- 1177,1181 ---- PyCursesWindow_Scroll(PyCursesWindowObject *self, PyObject *args) { ! int nlines; switch(ARG_COUNT(args)) { case 0: *************** *** 1154,1160 **** break; case 1: ! if (!PyArg_Parse(args, "i;lines", &lines)) return NULL; ! return PyCursesCheckERR(wscrl(self->win, lines), "scroll"); default: PyErr_SetString(PyExc_TypeError, "scroll requires 0 or 1 arguments"); --- 1183,1189 ---- break; case 1: ! if (!PyArg_Parse(args, "i;nlines", &nlines)) return NULL; ! return PyCursesCheckERR(wscrl(self->win, nlines), "scroll"); default: PyErr_SetString(PyExc_TypeError, "scroll requires 0 or 1 arguments"); *************** *** 1688,1692 **** { WINDOW *win; ! PyObject *lines, *cols; if (!PyArg_NoArgs(args)) return NULL; --- 1717,1721 ---- { WINDOW *win; ! PyObject *nlines, *cols; if (!PyArg_NoArgs(args)) return NULL; *************** *** 1772,1778 **** #endif ! lines = PyInt_FromLong((long) LINES); ! PyDict_SetItemString(ModDict, "LINES", lines); ! Py_DECREF(lines); cols = PyInt_FromLong((long) COLS); PyDict_SetItemString(ModDict, "COLS", cols); --- 1801,1807 ---- #endif ! nlines = PyInt_FromLong((long) LINES); ! PyDict_SetItemString(ModDict, "LINES", nlines); ! Py_DECREF(nlines); cols = PyInt_FromLong((long) COLS); PyDict_SetItemString(ModDict, "COLS", cols); *************** *** 1802,1805 **** --- 1831,1835 ---- } + #if !defined(__NetBSD__) static PyObject * PyCurses_KeyName(PyObject *self, PyObject *args) *************** *** 1816,1819 **** --- 1846,1850 ---- return PyString_FromString((knp == NULL) ? "" : (char *)knp); } + #endif static PyObject * *************** *** 2215,2219 **** --- 2246,2252 ---- {"intrflush", (PyCFunction)PyCurses_IntrFlush}, {"isendwin", (PyCFunction)PyCurses_isendwin}, + #if !defined(__NetBSD__) {"keyname", (PyCFunction)PyCurses_KeyName}, + #endif {"killchar", (PyCFunction)PyCurses_KillChar}, {"longname", (PyCFunction)PyCurses_longname}, *************** *** 2289,2293 **** --- 2322,2328 ---- SetDictInt("A_BOLD", A_BOLD); SetDictInt("A_ALTCHARSET", A_ALTCHARSET); + #if !defined(__NetBSD__) SetDictInt("A_INVIS", A_INVIS); + #endif SetDictInt("A_PROTECT", A_PROTECT); SetDictInt("A_CHARTEXT", A_CHARTEXT); *************** *** 2361,2364 **** --- 2396,2400 ---- char *key_n; char *key_n2; + #if !defined(__NetBSD__) for (key=KEY_MIN;key < KEY_MAX; key++) { key_n = (char *)keyname(key); *************** *** 2384,2387 **** --- 2420,2424 ---- free(key_n2); } + #endif SetDictInt("KEY_MIN", KEY_MIN); SetDictInt("KEY_MAX", KEY_MAX); From moshez@users.sourceforge.net Fri Mar 30 14:23:08 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 30 Mar 2001 06:23:08 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.3,1.81.2.4 Message-ID: <E14iznw-0008WA-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv29389/Misc Modified Files: Tag: release20-maint NEWS Log Message: More _curses compilation-problem fixes. NetBSD, IRIX and platforms with term.h that makes "lines" a macro Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.3 retrieving revision 1.81.2.4 diff -C2 -r1.81.2.3 -r1.81.2.4 *** NEWS 2001/03/30 13:55:52 1.81.2.3 --- NEWS 2001/03/30 14:23:06 1.81.2.4 *************** *** 18,21 **** --- 18,27 ---- - #116172, curses module fails to build on SGI, _curses + - Patch #103485, compile on NetBSD + + - Rename lines to nlines, macro sometimes defined in term.h + + - Patch #130117: add a prototype required to compile cleanly on IRIX + What's New in Python 2.0? ========================= From moshez@users.sourceforge.net Fri Mar 30 14:48:16 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 30 Mar 2001 06:48:16 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib locale.py,1.11,1.11.2.1 Message-ID: <E14j0CG-0001JZ-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv2100/Lib Modified Files: Tag: release20-maint locale.py Log Message: In Lib/locale.py, setlocale emulation, use != and not is not to compare strings Index: locale.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/locale.py,v retrieving revision 1.11 retrieving revision 1.11.2.1 diff -C2 -r1.11 -r1.11.2.1 *** locale.py 2000/07/16 12:04:30 1.11 --- locale.py 2001/03/30 14:48:14 1.11.2.1 *************** *** 66,70 **** """ if value is not None and \ ! value is not 'C': raise Error, '_locale emulation only supports "C" locale' return 'C' --- 66,70 ---- """ if value is not None and \ ! value != 'C': raise Error, '_locale emulation only supports "C" locale' return 'C' From moshez@users.sourceforge.net Fri Mar 30 14:48:16 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 30 Mar 2001 06:48:16 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.4,1.81.2.5 Message-ID: <E14j0CG-0001Je-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv2100/Misc Modified Files: Tag: release20-maint NEWS Log Message: In Lib/locale.py, setlocale emulation, use != and not is not to compare strings Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.4 retrieving revision 1.81.2.5 diff -C2 -r1.81.2.4 -r1.81.2.5 *** NEWS 2001/03/30 14:23:06 1.81.2.4 --- NEWS 2001/03/30 14:48:14 1.81.2.5 *************** *** 24,27 **** --- 24,31 ---- - Patch #130117: add a prototype required to compile cleanly on IRIX + - In Lib/locale.py, setlocale emulation, use != and not is not to compare + strings + + What's New in Python 2.0? ========================= From moshez@users.sourceforge.net Fri Mar 30 15:37:34 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 30 Mar 2001 07:37:34 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.5,1.81.2.6 Message-ID: <E14j0xy-0003xs-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv9037/Misc Modified Files: Tag: release20-maint NEWS Log Message: Fixing #409651 -- \ in a character group Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.5 retrieving revision 1.81.2.6 diff -C2 -r1.81.2.5 -r1.81.2.6 *** NEWS 2001/03/30 14:48:14 1.81.2.5 --- NEWS 2001/03/30 15:37:31 1.81.2.6 *************** *** 27,30 **** --- 27,32 ---- strings + - #409651 - in Lib/fnmatch.py, make \ in a character group work + What's New in Python 2.0? From moshez@users.sourceforge.net Fri Mar 30 15:37:34 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 30 Mar 2001 07:37:34 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib fnmatch.py,1.8,1.8.2.1 Message-ID: <E14j0xy-0003xr-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv9037/Lib Modified Files: Tag: release20-maint fnmatch.py Log Message: Fixing #409651 -- \ in a character group Index: fnmatch.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/fnmatch.py,v retrieving revision 1.8 retrieving revision 1.8.2.1 diff -C2 -r1.8 -r1.8.2.1 *** fnmatch.py 2000/06/28 14:48:01 1.8 --- fnmatch.py 2001/03/30 15:37:31 1.8.2.1 *************** *** 74,78 **** res = res + '\\[' else: ! stuff = pat[i:j] i = j+1 if stuff[0] == '!': --- 74,78 ---- res = res + '\\[' else: ! stuff = pat[i:j].replace('\\','\\\\') i = j+1 if stuff[0] == '!': From bwarsaw@users.sourceforge.net Fri Mar 30 16:29:46 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Fri, 30 Mar 2001 08:29:46 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0000.txt,1.85,1.86 Message-ID: <E14j1mU-0006V6-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv24980 Modified Files: pep-0000.txt Log Message: Added PEPs 248 & 249, Python Database API Specification (v1.0 and v2.0) Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.85 retrieving revision 1.86 diff -C2 -r1.85 -r1.86 *** pep-0000.txt 2001/03/29 03:13:49 1.85 --- pep-0000.txt 2001/03/30 16:29:44 1.86 *************** *** 33,36 **** --- 33,38 ---- I 247 pep-0247.txt API for Cryptographic Hash Functions Kuchling + I 248 pep-0248.txt Python Database API Specification v1.0 Lemburg + I 249 pep-0249.txt Python Database API Specification v2.0 Lemburg Active PEPs (under serious consideration for Python 2.1 - even if empty) *************** *** 166,169 **** --- 168,173 ---- S 246 pep-0246.txt Object Adaptation Evans I 247 pep-0247.txt API for Cryptographic Hash Functions Kuchling + I 248 pep-0248.txt Python Database API Specification v1.0 Lemburg + I 249 pep-0249.txt Python Database API Specification v2.0 Lemburg From moshez@users.sourceforge.net Fri Mar 30 16:31:52 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 30 Mar 2001 08:31:52 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python compile.c,2.142,2.142.2.1 marshal.c,1.57,1.57.2.1 Message-ID: <E14j1oW-0006be-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv21285/Python Modified Files: Tag: release20-maint compile.c marshal.c Log Message: SF bug 119622: compile errors due to redundant atof decls. Fixed in compile.c and marshal.c Quote tim: "Python shouldn't be in the business of defining atof" Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.142 retrieving revision 2.142.2.1 diff -C2 -r2.142 -r2.142.2.1 *** compile.c 2000/09/26 05:46:01 2.142 --- compile.c 2001/03/30 16:31:49 2.142.2.1 *************** *** 768,772 **** parsenumber(struct compiling *co, char *s) { - extern double atof(const char *); char *end; long x; --- 768,771 ---- Index: marshal.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/marshal.c,v retrieving revision 1.57 retrieving revision 1.57.2.1 diff -C2 -r1.57 -r1.57.2.1 *** marshal.c 2000/09/19 08:54:13 1.57 --- marshal.c 2001/03/30 16:31:49 1.57.2.1 *************** *** 404,408 **** case TYPE_FLOAT: { - extern double atof(const char *); char buf[256]; double dx; --- 404,407 ---- *************** *** 423,427 **** case TYPE_COMPLEX: { - extern double atof(const char *); char buf[256]; Py_complex c; --- 422,425 ---- From moshez@users.sourceforge.net Fri Mar 30 16:31:52 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 30 Mar 2001 08:31:52 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.6,1.81.2.7 Message-ID: <E14j1oW-0006bl-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv21285/Misc Modified Files: Tag: release20-maint NEWS Log Message: SF bug 119622: compile errors due to redundant atof decls. Fixed in compile.c and marshal.c Quote tim: "Python shouldn't be in the business of defining atof" Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.6 retrieving revision 1.81.2.7 diff -C2 -r1.81.2.6 -r1.81.2.7 *** NEWS 2001/03/30 15:37:31 1.81.2.6 --- NEWS 2001/03/30 16:31:50 1.81.2.7 *************** *** 29,32 **** --- 29,35 ---- - #409651 - in Lib/fnmatch.py, make \ in a character group work + - #119622: compile errors due to redundant atof decls. Removed from + Python/compile.c and Python/marshal.c + What's New in Python 2.0? From moshez@users.sourceforge.net Fri Mar 30 16:49:09 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 30 Mar 2001 08:49:09 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects rangeobject.c,2.20,2.20.2.1 Message-ID: <E14j25F-0007V8-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv25889/Objects Modified Files: Tag: release20-maint rangeobject.c Log Message: Fixing #121965 -- containment in xrange objects. Index: rangeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/rangeobject.c,v retrieving revision 2.20 retrieving revision 2.20.2.1 diff -C2 -r2.20 -r2.20.2.1 *** rangeobject.c 2000/09/01 23:29:27 2.20 --- rangeobject.c 2001/03/30 16:49:06 2.20.2.1 *************** *** 3,6 **** --- 3,8 ---- #include "Python.h" + #include "structmember.h" + #include <string.h> typedef struct { *************** *** 194,212 **** return -1; ! if (num < r->start || (num - r->start) % r->step) ! return 0; ! if (num > (r->start + (r->len * r->step))) ! return 0; return 1; } static PySequenceMethods range_as_sequence = { ! (inquiry)range_length, /*sq_length*/ (binaryfunc)range_concat, /*sq_concat*/ (intargfunc)range_repeat, /*sq_repeat*/ (intargfunc)range_item, /*sq_item*/ (intintargfunc)range_slice, /*sq_slice*/ ! 0, /*sq_ass_item*/ ! 0, /*sq_ass_slice*/ (objobjproc)range_contains, /*sq_contains*/ }; --- 196,222 ---- return -1; ! if (r->step > 0) { ! if ((num < r->start) || ((num - r->start) % r->step)) ! return 0; ! if (num >= (r->start + (r->len * r->step))) ! return 0; ! } ! else { ! if ((num > r->start) || ((num - r->start) % r->step)) ! return 0; ! if (num <= (r->start + (r->len * r->step))) ! return 0; ! } return 1; } static PySequenceMethods range_as_sequence = { ! (inquiry)range_length, /*sq_length*/ (binaryfunc)range_concat, /*sq_concat*/ (intargfunc)range_repeat, /*sq_repeat*/ (intargfunc)range_item, /*sq_item*/ (intintargfunc)range_slice, /*sq_slice*/ ! 0, /*sq_ass_item*/ ! 0, /*sq_ass_slice*/ (objobjproc)range_contains, /*sq_contains*/ }; From moshez@users.sourceforge.net Fri Mar 30 16:49:09 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 30 Mar 2001 08:49:09 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.7,1.81.2.8 Message-ID: <E14j25F-0007VD-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv25889/Misc Modified Files: Tag: release20-maint NEWS Log Message: Fixing #121965 -- containment in xrange objects. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.7 retrieving revision 1.81.2.8 diff -C2 -r1.81.2.7 -r1.81.2.8 *** NEWS 2001/03/30 16:31:50 1.81.2.7 --- NEWS 2001/03/30 16:49:07 1.81.2.8 *************** *** 32,35 **** --- 32,37 ---- Python/compile.c and Python/marshal.c + - #121965 -- fixing containment in xrange() objects + What's New in Python 2.0? From akuchling@users.sourceforge.net Fri Mar 30 16:56:17 2001 From: akuchling@users.sourceforge.net (A.M. Kuchling) Date: Fri, 30 Mar 2001 08:56:17 -0800 Subject: [Python-checkins] CVS: python/nondist/peps pep-0248.txt,1.1,1.2 pep-0249.txt,1.1,1.2 Message-ID: <E14j2C9-0007pa-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv30019 Modified Files: pep-0248.txt pep-0249.txt Log Message: Add Replaces and Replaced-By header. Use PEP number for DB-API 1.0. Index: pep-0248.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0248.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** pep-0248.txt 2001/03/29 17:00:15 1.1 --- pep-0248.txt 2001/03/30 16:56:15 1.2 *************** *** 5,8 **** --- 5,9 ---- Editor: mal@lemburg.com (Marc-Andre Lemburg) Status: Draft + Replaced-By: 249 Type: Informational Index: pep-0249.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0249.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** pep-0249.txt 2001/03/29 17:00:15 1.1 --- pep-0249.txt 2001/03/30 16:56:15 1.2 *************** *** 6,9 **** --- 6,10 ---- Status: Draft Type: Informational + Replaces: 248 Introduction *************** *** 35,39 **** This document describes the Python Database API Specification 2.0. The previous version 1.0 version is still available as ! reference, in PEP XXX. Package writers are encouraged to use this version of the specification as basis for new interfaces. --- 36,40 ---- This document describes the Python Database API Specification 2.0. The previous version 1.0 version is still available as ! reference, in PEP 248. Package writers are encouraged to use this version of the specification as basis for new interfaces. From moshez@users.sourceforge.net Fri Mar 30 17:21:00 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 30 Mar 2001 09:21:00 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib pickle.py,1.39,1.39.2.1 Message-ID: <E14j2a4-0000ad-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv30389/Lib Modified Files: Tag: release20-maint pickle.py Log Message: #126161 and 123634 -- Unicode strings could not be pickled correctly. This is *backwards incompatible* with the previous pickling scheme, which wasnot reversible Index: pickle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pickle.py,v retrieving revision 1.39 retrieving revision 1.39.2.1 diff -C2 -r1.39 -r1.39.2.1 *** pickle.py 2000/09/15 15:14:51 1.39 --- pickle.py 2001/03/30 17:20:58 1.39.2.1 *************** *** 289,292 **** --- 289,294 ---- self.write(BINUNICODE + s + encoding) else: + object = object.replace(u"\\", u"\\u005c") + object = object.replace(u"\n", u"\\u000a") self.write(UNICODE + object.encode('raw-unicode-escape') + '\n') From moshez@users.sourceforge.net Fri Mar 30 17:21:00 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 30 Mar 2001 09:21:00 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.8,1.81.2.9 Message-ID: <E14j2a4-0000aY-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv30389/Misc Modified Files: Tag: release20-maint NEWS Log Message: #126161 and 123634 -- Unicode strings could not be pickled correctly. This is *backwards incompatible* with the previous pickling scheme, which wasnot reversible Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.8 retrieving revision 1.81.2.9 diff -C2 -r1.81.2.8 -r1.81.2.9 *** NEWS 2001/03/30 16:49:07 1.81.2.8 --- NEWS 2001/03/30 17:20:58 1.81.2.9 *************** *** 34,37 **** --- 34,42 ---- - #121965 -- fixing containment in xrange() objects + - #126161 #123634 -- pickle.py, cPickle.c -- fix pickling unicode strings + this is *backwards incompatible* with older pickles containing unicode + strings -- but this has to be done, the previous pickling scheme broke + anyway. + What's New in Python 2.0? From moshez@users.sourceforge.net Fri Mar 30 17:21:01 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 30 Mar 2001 09:21:01 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules cPickle.c,2.53,2.53.2.1 Message-ID: <E14j2a5-0000ap-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv30389/Modules Modified Files: Tag: release20-maint cPickle.c Log Message: #126161 and 123634 -- Unicode strings could not be pickled correctly. This is *backwards incompatible* with the previous pickling scheme, which wasnot reversible Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.53 retrieving revision 2.53.2.1 diff -C2 -r2.53 -r2.53.2.1 *** cPickle.c 2000/10/04 16:22:26 2.53 --- cPickle.c 2001/03/30 17:20:58 2.53.2.1 *************** *** 1150,1153 **** --- 1150,1198 ---- + /* A copy of PyUnicode_EncodeRawUnicodeEscape() that also translates + backslash and newline characters to \uXXXX escapes. */ + static PyObject * + modified_EncodeRawUnicodeEscape(const Py_UNICODE *s, int size) + { + PyObject *repr; + char *p; + char *q; + + static const char *hexdigit = "0123456789ABCDEF"; + + repr = PyString_FromStringAndSize(NULL, 6 * size); + if (repr == NULL) + return NULL; + if (size == 0) + return repr; + + p = q = PyString_AS_STRING(repr); + while (size-- > 0) { + Py_UNICODE ch = *s++; + /* Map 16-bit characters to '\uxxxx' */ + if (ch >= 256 || ch == '\\' || ch == '\n') { + *p++ = '\\'; + *p++ = 'u'; + *p++ = hexdigit[(ch >> 12) & 0xf]; + *p++ = hexdigit[(ch >> 8) & 0xf]; + *p++ = hexdigit[(ch >> 4) & 0xf]; + *p++ = hexdigit[ch & 15]; + } + /* Copy everything else as-is */ + else + *p++ = (char) ch; + } + *p = '\0'; + if (_PyString_Resize(&repr, p - q)) + goto onError; + + return repr; + + onError: + Py_DECREF(repr); + return NULL; + } + + static int save_unicode(Picklerobject *self, PyObject *args, int doput) { *************** *** 1162,1166 **** static char string = UNICODE; ! UNLESS (repr = PyUnicode_AsRawUnicodeEscapeString(args)) return -1; --- 1207,1212 ---- static char string = UNICODE; ! UNLESS(repr = modified_EncodeRawUnicodeEscape( ! PyUnicode_AS_UNICODE(args), PyUnicode_GET_SIZE(args))) return -1; *************** *** 2746,2750 **** if ((len = (*self->readline_func)(self, &s)) < 0) return -1; ! if (len < 2) return bad_readline(); UNLESS (str = PyUnicode_DecodeRawUnicodeEscape(s, len - 1, NULL)) --- 2792,2796 ---- if ((len = (*self->readline_func)(self, &s)) < 0) return -1; ! if (len < 1) return bad_readline(); UNLESS (str = PyUnicode_DecodeRawUnicodeEscape(s, len - 1, NULL)) From moshez@users.sourceforge.net Fri Mar 30 18:27:13 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 30 Mar 2001 10:27:13 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.9,1.81.2.10 Message-ID: <E14j3c9-0004AU-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv12593/Misc Modified Files: Tag: release20-maint NEWS Log Message: Fixed bug in complex(). No SF id Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.9 retrieving revision 1.81.2.10 diff -C2 -r1.81.2.9 -r1.81.2.10 *** NEWS 2001/03/30 17:20:58 1.81.2.9 --- NEWS 2001/03/30 18:27:11 1.81.2.10 *************** *** 39,42 **** --- 39,45 ---- anyway. + - complex() could segfault on numeric types with NULL for float conversion. + Fixed. + What's New in Python 2.0? From moshez@users.sourceforge.net Fri Mar 30 18:27:13 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 30 Mar 2001 10:27:13 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.181,2.181.2.1 Message-ID: <E14j3c9-0004AP-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv12593/Python Modified Files: Tag: release20-maint bltinmodule.c Log Message: Fixed bug in complex(). No SF id Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.181 retrieving revision 2.181.2.1 diff -C2 -r2.181 -r2.181.2.1 *** bltinmodule.c 2000/09/26 05:46:01 2.181 --- bltinmodule.c 2001/03/30 18:27:10 2.181.2.1 *************** *** 592,596 **** } else { ! tmp = (*nbr->nb_float)(r); if (own_r) { Py_DECREF(r); --- 592,596 ---- } else { ! tmp = PyNumber_Float(r); if (own_r) { Py_DECREF(r); *************** *** 598,601 **** --- 598,607 ---- if (tmp == NULL) return NULL; + if (!PyFloat_Check(tmp)) { + PyErr_SetString(PyExc_TypeError, + "float(r) didn't return a float"); + Py_DECREF(tmp); + return NULL; + } cr.real = PyFloat_AsDouble(tmp); Py_DECREF(tmp); From moshez@users.sourceforge.net Fri Mar 30 18:50:25 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 30 Mar 2001 10:50:25 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python compile.c,2.142.2.1,2.142.2.2 Message-ID: <E14j3yb-0005Rd-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv17116/Python Modified Files: Tag: release20-maint compile.c Log Message: Fix memory leak with from import ... Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.142.2.1 retrieving revision 2.142.2.2 diff -C2 -r2.142.2.1 -r2.142.2.2 *** compile.c 2001/03/30 16:31:49 2.142.2.1 --- compile.c 2001/03/30 18:50:23 2.142.2.2 *************** *** 2326,2334 **** { int i; - PyObject *tup; REQ(n, import_stmt); /* 'import' dotted_name (',' dotted_name)* | 'from' dotted_name 'import' ('*' | NAME (',' NAME)*) */ if (STR(CHILD(n, 0))[0] == 'f') { /* 'from' dotted_name 'import' ... */ REQ(CHILD(n, 1), dotted_name); --- 2326,2334 ---- { int i; REQ(n, import_stmt); /* 'import' dotted_name (',' dotted_name)* | 'from' dotted_name 'import' ('*' | NAME (',' NAME)*) */ if (STR(CHILD(n, 0))[0] == 'f') { + PyObject *tup; /* 'from' dotted_name 'import' ... */ REQ(CHILD(n, 1), dotted_name); *************** *** 2345,2348 **** --- 2345,2349 ---- } com_addoparg(c, LOAD_CONST, com_addconst(c, tup)); + Py_DECREF(tup); com_push(c, 1); com_addopname(c, IMPORT_NAME, CHILD(n, 1)); From moshez@users.sourceforge.net Fri Mar 30 19:18:25 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 30 Mar 2001 11:18:25 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules pwdmodule.c,1.24,1.24.2.1 grpmodule.c,2.14,2.14.2.1 Message-ID: <E14j4Ph-0006oc-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv23805/Modules Modified Files: Tag: release20-maint pwdmodule.c grpmodule.c Log Message: Fixing bug #407504. -- did not close pwd/grp databases. Index: pwdmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/pwdmodule.c,v retrieving revision 1.24 retrieving revision 1.24.2.1 diff -C2 -r1.24 -r1.24.2.1 *** pwdmodule.c 2000/09/01 23:29:27 1.24 --- pwdmodule.c 2001/03/30 19:18:22 1.24.2.1 *************** *** 103,106 **** --- 103,107 ---- Py_DECREF(v); } + endpwent(); return d; } Index: grpmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/grpmodule.c,v retrieving revision 2.14 retrieving revision 2.14.2.1 diff -C2 -r2.14 -r2.14.2.1 *** grpmodule.c 2000/09/01 23:29:26 2.14 --- grpmodule.c 2001/03/30 19:18:22 2.14.2.1 *************** *** 88,91 **** --- 88,92 ---- Py_DECREF(v); } + endgrent(); return d; } From moshez@users.sourceforge.net Fri Mar 30 19:18:26 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 30 Mar 2001 11:18:26 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.10,1.81.2.11 Message-ID: <E14j4Pi-0006ok-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv23805/Misc Modified Files: Tag: release20-maint NEWS Log Message: Fixing bug #407504. -- did not close pwd/grp databases. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.10 retrieving revision 1.81.2.11 diff -C2 -r1.81.2.10 -r1.81.2.11 *** NEWS 2001/03/30 18:27:11 1.81.2.10 --- NEWS 2001/03/30 19:18:23 1.81.2.11 *************** *** 42,45 **** --- 42,49 ---- Fixed. + - Fixed #407504 -- closing pwd and grp database when finished. + + - Fixed memory leak in from import ... + What's New in Python 2.0? From moshez@users.sourceforge.net Fri Mar 30 19:45:15 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 30 Mar 2001 11:45:15 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python import.c,2.153,2.153.2.1 Message-ID: <E14j4pf-0007xV-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv27821/Python Modified Files: Tag: release20-maint import.c Log Message: - Importing should now be safe with multiple Py_Initialize/Py_Finalize sequences. Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.153 retrieving revision 2.153.2.1 diff -C2 -r2.153 -r2.153.2.1 *** import.c 2000/10/03 16:02:05 2.153 --- import.c 2001/03/30 19:45:12 2.153.2.1 *************** *** 1843,1847 **** static PyObject *builtins_str = NULL; static PyObject *import_str = NULL; - static PyObject *standard_builtins = NULL; PyObject *globals = NULL; PyObject *import = NULL; --- 1843,1846 ---- *************** *** 1874,1886 **** PyErr_Clear(); ! if (standard_builtins == NULL) { ! standard_builtins = ! PyImport_ImportModule("__builtin__"); ! if (standard_builtins == NULL) ! return NULL; ! } ! ! builtins = standard_builtins; ! Py_INCREF(builtins); globals = Py_BuildValue("{OO}", builtins_str, builtins); if (globals == NULL) --- 1873,1880 ---- PyErr_Clear(); ! builtins = PyImport_ImportModuleEx("__builtin__", ! NULL, NULL, NULL); ! if (builtins == NULL) ! return NULL; globals = Py_BuildValue("{OO}", builtins_str, builtins); if (globals == NULL) From moshez@users.sourceforge.net Fri Mar 30 19:45:15 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 30 Mar 2001 11:45:15 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.11,1.81.2.12 Message-ID: <E14j4pf-0007xd-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv27821/Misc Modified Files: Tag: release20-maint NEWS Log Message: - Importing should now be safe with multiple Py_Initialize/Py_Finalize sequences. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.11 retrieving revision 1.81.2.12 diff -C2 -r1.81.2.11 -r1.81.2.12 *** NEWS 2001/03/30 19:18:23 1.81.2.11 --- NEWS 2001/03/30 19:45:13 1.81.2.12 *************** *** 46,49 **** --- 46,52 ---- - Fixed memory leak in from import ... + - Importing should now be safe with multiple Py_Initialize/Py_Finalize + sequences. + What's New in Python 2.0? From moshez@users.sourceforge.net Fri Mar 30 20:06:57 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 30 Mar 2001 12:06:57 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.12,1.81.2.13 Message-ID: <E14j5Af-0000bM-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv31915/Misc Modified Files: Tag: release20-maint NEWS Log Message: - Add TELL64() hack #ifdef to FreeBSD, Apple and BSDI Someone with BSDs, please test this! Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.12 retrieving revision 1.81.2.13 diff -C2 -r1.81.2.12 -r1.81.2.13 *** NEWS 2001/03/30 19:45:13 1.81.2.12 --- NEWS 2001/03/30 20:06:55 1.81.2.13 *************** *** 49,52 **** --- 49,53 ---- sequences. + - Add TELL64() hack #ifdef to FreeBSD, Apple and BSDI What's New in Python 2.0? From moshez@users.sourceforge.net Fri Mar 30 20:06:58 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 30 Mar 2001 12:06:58 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects fileobject.c,2.90,2.90.2.1 Message-ID: <E14j5Ag-0000bR-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv31915/Objects Modified Files: Tag: release20-maint fileobject.c Log Message: - Add TELL64() hack #ifdef to FreeBSD, Apple and BSDI Someone with BSDs, please test this! Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.90 retrieving revision 2.90.2.1 diff -C2 -r2.90 -r2.90.2.1 *** fileobject.c 2000/10/06 20:42:33 2.90 --- fileobject.c 2001/03/30 20:06:55 2.90.2.1 *************** *** 59,63 **** #if defined(MS_WIN64) #define TELL64 _telli64 ! #elif defined(__NetBSD__) || defined(__OpenBSD__) /* NOTE: this is only used on older NetBSD prior to f*o() funcions */ --- 59,63 ---- #if defined(MS_WIN64) #define TELL64 _telli64 ! #elif defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(_HAVE_BSDI) || defined(__APPLE__) /* NOTE: this is only used on older NetBSD prior to f*o() funcions */ From moshez@users.sourceforge.net Fri Mar 30 20:26:34 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 30 Mar 2001 12:26:34 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects funcobject.c,2.30,2.30.2.1 Message-ID: <E14j5Te-0001RT-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv2982/Objects Modified Files: Tag: release20-maint funcobject.c Log Message: Fixed deleting func_defaults causes segmentation fault bug Index: funcobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/funcobject.c,v retrieving revision 2.30 retrieving revision 2.30.2.1 diff -C2 -r2.30 -r2.30.2.1 *** funcobject.c 2000/09/01 23:29:27 2.30 --- funcobject.c 2001/03/30 20:26:31 2.30.2.1 *************** *** 130,134 **** } else if (strcmp(name, "func_defaults") == 0) { ! if (value != Py_None && !PyTuple_Check(value)) { PyErr_SetString( PyExc_TypeError, --- 130,135 ---- } else if (strcmp(name, "func_defaults") == 0) { ! if (value != Py_None && ! (value == NULL || !PyTuple_Check(value))) { PyErr_SetString( PyExc_TypeError, From moshez@users.sourceforge.net Fri Mar 30 20:26:34 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 30 Mar 2001 12:26:34 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.13,1.81.2.14 Message-ID: <E14j5Te-0001Rb-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv2982/Misc Modified Files: Tag: release20-maint NEWS Log Message: Fixed deleting func_defaults causes segmentation fault bug Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.13 retrieving revision 1.81.2.14 diff -C2 -r1.81.2.13 -r1.81.2.14 *** NEWS 2001/03/30 20:06:55 1.81.2.13 --- NEWS 2001/03/30 20:26:32 1.81.2.14 *************** *** 51,54 **** --- 51,56 ---- - Add TELL64() hack #ifdef to FreeBSD, Apple and BSDI + - del func.func_defaults raises a TypeError instead of dumping core + What's New in Python 2.0? ========================= From moshez@users.sourceforge.net Fri Mar 30 20:44:53 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 30 Mar 2001 12:44:53 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects stringobject.c,2.91,2.91.2.1 Message-ID: <E14j5lN-0002Gt-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv5843/Objects Modified Files: Tag: release20-maint stringobject.c Log Message: - #121013 - stringobject.c -- "".join(u"this is a test") dumped core Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.91 retrieving revision 2.91.2.1 diff -C2 -r2.91 -r2.91.2.1 *** stringobject.c 2000/10/07 08:54:09 2.91 --- stringobject.c 2001/03/30 20:44:51 2.91.2.1 *************** *** 836,840 **** Py_DECREF(res); Py_DECREF(seq); ! return PyUnicode_Join((PyObject *)self, seq); } PyErr_Format(PyExc_TypeError, --- 836,840 ---- Py_DECREF(res); Py_DECREF(seq); ! return PyUnicode_Join((PyObject *)self, orig); } PyErr_Format(PyExc_TypeError, From moshez@users.sourceforge.net Fri Mar 30 21:01:11 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 30 Mar 2001 13:01:11 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python exceptions.c,1.17,1.17.2.1 Message-ID: <E14j619-00035C-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv8873/Python Modified Files: Tag: release20-maint exceptions.c Log Message: - exceptions.c - make_class() Added a "goto finally" so that if populate_methods() fails, the return status will be -1 (failure) instead of 0 (success). fini_exceptions(): When decref'ing the static pointers to the exception classes, clear out their dictionaries too. This breaks a cycle from class->dict->method->class and allows the classes with unbound methods to be reclaimed. This plugs a large memory leak in a common Py_Initialize()/dosomething/Py_Finalize() loop. Index: exceptions.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/exceptions.c,v retrieving revision 1.17 retrieving revision 1.17.2.1 diff -C2 -r1.17 -r1.17.2.1 *** exceptions.c 2000/08/18 19:53:25 1.17 --- exceptions.c 2001/03/30 21:01:09 1.17.2.1 *************** *** 169,172 **** --- 169,173 ---- Py_DECREF(*klass); *klass = NULL; + goto finally; } *************** *** 1097,1100 **** --- 1098,1109 ---- for (i=0; exctable[i].name; i++) { + /* clear the class's dictionary, freeing up circular references + * between the class and its methods. + */ + PyObject* cdict = PyObject_GetAttrString(*exctable[i].exc, "__dict__"); + PyDict_Clear(cdict); + Py_DECREF(cdict); + + /* Now decref the exception class */ Py_XDECREF(*exctable[i].exc); *exctable[i].exc = NULL; From moshez@users.sourceforge.net Fri Mar 30 21:01:11 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 30 Mar 2001 13:01:11 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.14,1.81.2.15 Message-ID: <E14j619-00035I-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv8873/Misc Modified Files: Tag: release20-maint NEWS Log Message: - exceptions.c - make_class() Added a "goto finally" so that if populate_methods() fails, the return status will be -1 (failure) instead of 0 (success). fini_exceptions(): When decref'ing the static pointers to the exception classes, clear out their dictionaries too. This breaks a cycle from class->dict->method->class and allows the classes with unbound methods to be reclaimed. This plugs a large memory leak in a common Py_Initialize()/dosomething/Py_Finalize() loop. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.14 retrieving revision 1.81.2.15 diff -C2 -r1.81.2.14 -r1.81.2.15 *** NEWS 2001/03/30 20:26:32 1.81.2.14 --- NEWS 2001/03/30 21:01:09 1.81.2.15 *************** *** 53,56 **** --- 53,68 ---- - del func.func_defaults raises a TypeError instead of dumping core + - #121013 - stringobject.c -- "".join(u"this is a test") dumped core + + - exceptions.c - make_class() Added a "goto finally" so that if + populate_methods() fails, the return status will be -1 (failure) + instead of 0 (success). + + fini_exceptions(): When decref'ing the static pointers to the + exception classes, clear out their dictionaries too. This breaks a + cycle from class->dict->method->class and allows the classes with + unbound methods to be reclaimed. This plugs a large memory leak in a + common Py_Initialize()/dosomething/Py_Finalize() loop. + What's New in Python 2.0? ========================= From nascheme@users.sourceforge.net Sat Mar 31 00:01:58 2001 From: nascheme@users.sourceforge.net (Neil Schemenauer) Date: Fri, 30 Mar 2001 16:01:58 -0800 Subject: [Python-checkins] CVS: python/dist/src configure.in,1.213,1.214 configure,1.205,1.206 Message-ID: <E14j8q6-0000mr-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv2805 Modified Files: configure.in configure Log Message: "install -d" does not work on BSDI systems even though autoconf thinks install works on that system. Use "install-sh" on BSDI. Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.213 retrieving revision 1.214 diff -C2 -r1.213 -r1.214 *** configure.in 2001/03/22 00:29:55 1.213 --- configure.in 2001/03/31 00:01:55 1.214 *************** *** 271,274 **** --- 271,283 ---- AC_SUBST(AR) AC_CHECK_PROGS(AR, ar aal, ar) + + case $MACHDEP in + bsdos*) + # install -d does not work on BSDI + if test -z "$INSTALL" + then + INSTALL="${srcdir}/install-sh -c" + fi + esac AC_PROG_INSTALL Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.205 retrieving revision 1.206 diff -C2 -r1.205 -r1.206 *** configure 2001/03/22 00:34:03 1.205 --- configure 2001/03/31 00:01:55 1.206 *************** *** 1332,1335 **** --- 1332,1344 ---- test -n "$AR" || AR="ar" + + case $MACHDEP in + bsdos*) + # install -d does not work on BSDI + if test -z "$INSTALL" + then + INSTALL="${srcdir}/install-sh -c" [...3729 lines suppressed...] if eval "test \"`echo '$''{'ac_cv_type_socklen_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF ! #line 6142 "configure" #include "confdefs.h" #include <sys/types.h> *************** *** 6179,6183 **** SRCDIRS="Parser Grammar Objects Python Modules" echo $ac_n "checking for build directories""... $ac_c" 1>&6 ! echo "configure:6182: checking for build directories" >&5 for dir in $SRCDIRS; do if test ! -d $dir; then --- 6188,6192 ---- SRCDIRS="Parser Grammar Objects Python Modules" echo $ac_n "checking for build directories""... $ac_c" 1>&6 ! echo "configure:6191: checking for build directories" >&5 for dir in $SRCDIRS; do if test ! -d $dir; then From esr@users.sourceforge.net Sat Mar 31 01:50:55 2001 From: esr@users.sourceforge.net (Eric S. Raymond) Date: Fri, 30 Mar 2001 17:50:55 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib webbrowser.py,1.16,1.17 Message-ID: <E14jAXX-0003Mp-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv12885 Modified Files: webbrowser.py Log Message: Fixes a fatal bug when the module has computed alternatives containing %s. Index: webbrowser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/webbrowser.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** webbrowser.py 2001/03/26 15:06:15 1.16 --- webbrowser.py 2001/03/31 01:50:52 1.17 *************** *** 25,29 **** if browser.find('%s') > -1: # User gave us a command line, don't mess with it. ! return browser else: # User gave us a browser name. --- 25,29 ---- if browser.find('%s') > -1: # User gave us a command line, don't mess with it. ! return GenericBrowser(browser) else: # User gave us a browser name. From akuchling@users.sourceforge.net Sat Mar 31 02:41:03 2001 From: akuchling@users.sourceforge.net (A.M. Kuchling) Date: Fri, 30 Mar 2001 18:41:03 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/distutils dist.py,1.46,1.47 Message-ID: <E14jBK3-0004F4-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib/distutils In directory usw-pr-cvs1:/tmp/cvs-serv16286 Modified Files: dist.py Log Message: Back out the requirement to supply a version number Index: dist.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/dist.py,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -r1.46 -r1.47 *** dist.py 2001/03/22 15:32:23 1.46 --- dist.py 2001/03/31 02:41:01 1.47 *************** *** 535,542 **** """ - if self.metadata.version is None: - raise DistutilsSetupError, \ - "No version number specified for distribution" - keywords = self.metadata.keywords if keywords is not None: --- 535,538 ---- From akuchling@users.sourceforge.net Sat Mar 31 02:42:44 2001 From: akuchling@users.sourceforge.net (A.M. Kuchling) Date: Fri, 30 Mar 2001 18:42:44 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.139,1.140 Message-ID: <E14jBLg-0004Gg-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv16326 Modified Files: NEWS Log Message: Remove the backed-out version requirement Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.139 retrieving revision 1.140 diff -C2 -r1.139 -r1.140 *** NEWS 2001/03/23 14:18:27 1.139 --- NEWS 2001/03/31 02:42:42 1.140 *************** *** 98,103 **** - added 'platforms' and 'keywords' to the set of metadata that can be ! specified for a distribution. Supplying a version number has been made ! compulsory. - applied patches from Jason Tishler to make the compiler class work with --- 98,102 ---- - added 'platforms' and 'keywords' to the set of metadata that can be ! specified for a distribution. - applied patches from Jason Tishler to make the compiler class work with From moshez@users.sourceforge.net Sat Mar 31 06:48:54 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 30 Mar 2001 22:48:54 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects stringobject.c,2.91.2.1,2.91.2.2 unicodeobject.c,2.66,2.66.2.1 Message-ID: <E14jFBu-0008Ff-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv30534/Objects Modified Files: Tag: release20-maint stringobject.c unicodeobject.c Log Message: - #122162 -- unicodeobject.c --- Fix unicode .split() off-by-one - Loosely based on patch #103249 -- Fix core dumps in PyUnicode_Count Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.91.2.1 retrieving revision 2.91.2.2 diff -C2 -r2.91.2.1 -r2.91.2.2 *** stringobject.c 2001/03/30 20:44:51 2.91.2.1 --- stringobject.c 2001/03/31 06:48:51 2.91.2.2 *************** *** 1237,1243 **** n = PyString_GET_SIZE(subobj); } ! else if (PyUnicode_Check(subobj)) ! return PyInt_FromLong( ! PyUnicode_Count((PyObject *)self, subobj, i, last)); else if (PyObject_AsCharBuffer(subobj, &sub, &n)) return NULL; --- 1237,1248 ---- n = PyString_GET_SIZE(subobj); } ! else if (PyUnicode_Check(subobj)) { ! int count; ! count = PyUnicode_Count((PyObject *)self, subobj, i, last); ! if (count == -1) ! return NULL; ! else ! return PyInt_FromLong((long) count); ! } else if (PyObject_AsCharBuffer(subobj, &sub, &n)) return NULL; *************** *** 1638,1645 **** plen = PyString_GET_SIZE(subobj); } ! else if (PyUnicode_Check(subobj)) ! return PyInt_FromLong( ! PyUnicode_Tailmatch((PyObject *)self, ! subobj, start, end, -1)); else if (PyObject_AsCharBuffer(subobj, &prefix, &plen)) return NULL; --- 1643,1655 ---- plen = PyString_GET_SIZE(subobj); } ! else if (PyUnicode_Check(subobj)) { ! int rc; ! rc = PyUnicode_Tailmatch((PyObject *)self, ! subobj, start, end, -1); ! if (rc == -1) ! return NULL; ! else ! return PyInt_FromLong((long) rc); ! } else if (PyObject_AsCharBuffer(subobj, &prefix, &plen)) return NULL; *************** *** 1691,1698 **** slen = PyString_GET_SIZE(subobj); } ! else if (PyUnicode_Check(subobj)) ! return PyInt_FromLong( ! PyUnicode_Tailmatch((PyObject *)self, ! subobj, start, end, +1)); else if (PyObject_AsCharBuffer(subobj, &suffix, &slen)) return NULL; --- 1701,1713 ---- slen = PyString_GET_SIZE(subobj); } ! else if (PyUnicode_Check(subobj)) { ! int rc; ! rc = PyUnicode_Tailmatch((PyObject *)self, ! subobj, start, end, +1); ! if (rc == -1) ! return NULL; ! else ! return PyInt_FromLong((long) rc); ! } else if (PyObject_AsCharBuffer(subobj, &suffix, &slen)) return NULL; Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.66 retrieving revision 2.66.2.1 diff -C2 -r2.66 -r2.66.2.1 *** unicodeobject.c 2000/10/03 20:45:26 2.66 --- unicodeobject.c 2001/03/31 06:48:51 2.66.2.1 *************** *** 2358,2361 **** --- 2358,2372 ---- int count = 0; + if (start < 0) + start += self->length; + if (start < 0) + start = 0; + if (end > self->length) + end = self->length; + if (end < 0) + end += self->length; + if (end < 0) + end = 0; + if (substring->length == 0) return (end - start + 1); *************** *** 2926,2930 **** PyObject *str; ! for (i = j = 0; i < len - sublen; ) { if (Py_UNICODE_MATCH(self, i, substring)) { if (maxcount-- <= 0) --- 2937,2941 ---- PyObject *str; ! for (i = j = 0; i <= len - sublen; ) { if (Py_UNICODE_MATCH(self, i, substring)) { if (maxcount-- <= 0) From moshez@users.sourceforge.net Sat Mar 31 06:48:54 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 30 Mar 2001 22:48:54 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.15,1.81.2.16 Message-ID: <E14jFBu-0008Fe-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv30534/Misc Modified Files: Tag: release20-maint NEWS Log Message: - #122162 -- unicodeobject.c --- Fix unicode .split() off-by-one - Loosely based on patch #103249 -- Fix core dumps in PyUnicode_Count Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.15 retrieving revision 1.81.2.16 diff -C2 -r1.81.2.15 -r1.81.2.16 *** NEWS 2001/03/30 21:01:09 1.81.2.15 --- NEWS 2001/03/31 06:48:52 1.81.2.16 *************** *** 65,68 **** --- 65,72 ---- common Py_Initialize()/dosomething/Py_Finalize() loop. + - #122162 -- unicodeobject.c --- Fix unicode .split() off-by-one + + - Loosely based on patch #103249 -- Fix core dumps in PyUnicode_Count + What's New in Python 2.0? ========================= From moshez@users.sourceforge.net Sat Mar 31 07:13:32 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 30 Mar 2001 23:13:32 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules socketmodule.c,1.128,1.128.2.1 Message-ID: <E14jFZk-0000BM-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv32117/Modules Modified Files: Tag: release20-maint socketmodule.c Log Message: - #125981 -- socketmodule.c -- closing sockets was not thread-safe. - Use openssl/*.h to include the OpenSSL header files - Patch #103636: Allow writing strings containing null bytes to an SSL socket Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.128 retrieving revision 1.128.2.1 diff -C2 -r1.128 -r1.128.2.1 *** socketmodule.c 2000/10/06 15:37:06 1.128 --- socketmodule.c 2001/03/31 07:13:29 1.128.2.1 *************** *** 157,166 **** #ifdef USE_SSL ! #include "rsa.h" ! #include "crypto.h" ! #include "x509.h" ! #include "pem.h" ! #include "ssl.h" ! #include "err.h" #endif /* USE_SSL */ --- 157,166 ---- #ifdef USE_SSL ! #include "openssl/rsa.h" ! #include "openssl/crypto.h" ! #include "openssl/x509.h" ! #include "openssl/pem.h" ! #include "openssl/ssl.h" ! #include "openssl/err.h" #endif /* USE_SSL */ *************** *** 899,910 **** PySocketSock_close(PySocketSockObject *s, PyObject *args) { if (!PyArg_ParseTuple(args, ":close")) return NULL; ! if (s->sock_fd != -1) { Py_BEGIN_ALLOW_THREADS ! (void) SOCKETCLOSE(s->sock_fd); Py_END_ALLOW_THREADS } - s->sock_fd = -1; Py_INCREF(Py_None); return Py_None; --- 899,911 ---- PySocketSock_close(PySocketSockObject *s, PyObject *args) { + SOCKET_T fd; if (!PyArg_ParseTuple(args, ":close")) return NULL; ! if ((fd = s->sock_fd) != -1) { ! s->sock_fd = -1; Py_BEGIN_ALLOW_THREADS ! (void) SOCKETCLOSE(fd); Py_END_ALLOW_THREADS } Py_INCREF(Py_None); return Py_None; *************** *** 2133,2137 **** size_t len = 0; ! if (!PyArg_ParseTuple(args, "s|i:write", &data, &len)) return NULL; --- 2134,2138 ---- size_t len = 0; ! if (!PyArg_ParseTuple(args, "s#|i:write", &data, &len)) return NULL; From moshez@users.sourceforge.net Sat Mar 31 07:13:32 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 30 Mar 2001 23:13:32 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.16,1.81.2.17 Message-ID: <E14jFZk-0000BE-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv32117/Misc Modified Files: Tag: release20-maint NEWS Log Message: - #125981 -- socketmodule.c -- closing sockets was not thread-safe. - Use openssl/*.h to include the OpenSSL header files - Patch #103636: Allow writing strings containing null bytes to an SSL socket Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.16 retrieving revision 1.81.2.17 diff -C2 -r1.81.2.16 -r1.81.2.17 *** NEWS 2001/03/31 06:48:52 1.81.2.16 --- NEWS 2001/03/31 07:13:29 1.81.2.17 *************** *** 69,72 **** --- 69,78 ---- - Loosely based on patch #103249 -- Fix core dumps in PyUnicode_Count + - #125981 -- socketmodule.c -- closing sockets was not thread-safe. + + - Use openssl/*.h to include the OpenSSL header files + + - Patch #103636: Allow writing strings containing null bytes to an SSL socket + What's New in Python 2.0? ========================= From moshez@users.sourceforge.net Sat Mar 31 07:33:58 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 30 Mar 2001 23:33:58 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python errors.c,2.57,2.57.2.1 Message-ID: <E14jFtW-0000VF-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv860/Python Modified Files: Tag: release20-maint errors.c Log Message: Use Py_CHARMASK for ctype macros. Fixes bug #232787. Index: errors.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/errors.c,v retrieving revision 2.57 retrieving revision 2.57.2.1 diff -C2 -r2.57 -r2.57.2.1 *** errors.c 2000/10/10 21:10:35 2.57 --- errors.c 2001/03/31 07:33:56 2.57.2.1 *************** *** 403,407 **** if (*f == '%') { const char* p = f; ! while (*++f && *f != '%' && !isalpha(*f)) ; switch (*f) { --- 403,407 ---- if (*f == '%') { const char* p = f; ! while (*++f && *f != '%' && !isalpha(Py_CHARMASK(*f))) ; switch (*f) { *************** *** 458,470 **** interested in the precision value, if any) */ n = 0; ! while (isdigit(*f)) n = (n*10) + *f++ - '0'; if (*f == '.') { f++; n = 0; ! while (isdigit(*f)) n = (n*10) + *f++ - '0'; } ! while (*f && *f != '%' && !isalpha(*f)) f++; switch (*f) { --- 458,470 ---- interested in the precision value, if any) */ n = 0; ! while (isdigit(Py_CHARMASK(*f))) n = (n*10) + *f++ - '0'; if (*f == '.') { f++; n = 0; ! while (isdigit(Py_CHARMASK(*f))) n = (n*10) + *f++ - '0'; } ! while (*f && *f != '%' && !isalpha(Py_CHARMASK(*f))) f++; switch (*f) { From moshez@users.sourceforge.net Sat Mar 31 07:33:58 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 30 Mar 2001 23:33:58 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.17,1.81.2.18 Message-ID: <E14jFtW-0000V7-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv860/Misc Modified Files: Tag: release20-maint NEWS Log Message: Use Py_CHARMASK for ctype macros. Fixes bug #232787. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.17 retrieving revision 1.81.2.18 diff -C2 -r1.81.2.17 -r1.81.2.18 *** NEWS 2001/03/31 07:13:29 1.81.2.17 --- NEWS 2001/03/31 07:33:56 1.81.2.18 *************** *** 75,78 **** --- 75,80 ---- - Patch #103636: Allow writing strings containing null bytes to an SSL socket + - #232787 -- Modules/timemodule.c, Python/errors.c, Objects/intobject.c + What's New in Python 2.0? ========================= From moshez@users.sourceforge.net Sat Mar 31 07:33:58 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 30 Mar 2001 23:33:58 -0800 Subject: [Python-checkins] CVS: python/dist/src/Objects intobject.c,2.52,2.52.2.1 Message-ID: <E14jFtW-0000V9-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv860/Objects Modified Files: Tag: release20-maint intobject.c Log Message: Use Py_CHARMASK for ctype macros. Fixes bug #232787. Index: intobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/intobject.c,v retrieving revision 2.52 retrieving revision 2.52.2.1 diff -C2 -r2.52 -r2.52.2.1 *** intobject.c 2000/10/06 00:36:09 2.52 --- intobject.c 2001/03/31 07:33:56 2.52.2.1 *************** *** 183,187 **** else x = PyOS_strtol(s, &end, base); ! if (end == s || !isalnum(end[-1])) goto bad; while (*end && isspace(Py_CHARMASK(*end))) --- 183,187 ---- else x = PyOS_strtol(s, &end, base); ! if (end == s || !isalnum(Py_CHARMASK(end[-1]))) goto bad; while (*end && isspace(Py_CHARMASK(*end))) From moshez@users.sourceforge.net Sat Mar 31 07:33:58 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Fri, 30 Mar 2001 23:33:58 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules timemodule.c,2.103,2.103.2.1 Message-ID: <E14jFtW-0000VK-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv860/Modules Modified Files: Tag: release20-maint timemodule.c Log Message: Use Py_CHARMASK for ctype macros. Fixes bug #232787. Index: timemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/timemodule.c,v retrieving revision 2.103 retrieving revision 2.103.2.1 diff -C2 -r2.103 -r2.103.2.1 *** timemodule.c 2000/09/01 23:29:27 2.103 --- timemodule.c 2001/03/31 07:33:56 2.103.2.1 *************** *** 383,387 **** return NULL; } ! while (*s && isspace(*s)) s++; if (*s) { --- 383,387 ---- return NULL; } ! while (*s && isspace(Py_CHARMASK(*s))) s++; if (*s) { From moshez@users.sourceforge.net Sat Mar 31 08:10:05 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 00:10:05 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.175,2.175.2.1 Message-ID: <E14jGST-0001AE-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv2690/Modules Modified Files: Tag: release20-maint posixmodule.c Log Message: - posixmodule.c - Add missing prototypes in for SunOS 4.1.4, plug memory leak - #125891 - posixmodule.c - os.popen2,3 and 4 leaked file objects on Windows. - #128053 - posixmodule.c - #ifdef for including "tmpfile" in the posix_methods[] array was wrong -- should be HAVE_TMPFILE Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.175 retrieving revision 2.175.2.1 diff -C2 -r2.175 -r2.175.2.1 *** posixmodule.c 2000/10/03 16:54:24 2.175 --- posixmodule.c 2001/03/31 08:10:03 2.175.2.1 *************** *** 114,117 **** --- 114,120 ---- extern int pclose(FILE *); extern int fclose(FILE *); + extern int fsync(int); + extern int lstat(const char *, struct stat *); + extern int symlink(const char *, const char *); #endif *************** *** 2510,2513 **** --- 2513,2518 ---- f = Py_BuildValue("OO",p1,p2); + Py_XDECREF(p1); + Py_XDECREF(p2); file_count = 2; break; *************** *** 2540,2543 **** --- 2545,2551 ---- PyFile_SetBufSize(p3, 0); f = Py_BuildValue("OOO",p1,p2,p3); + Py_XDECREF(p1); + Py_XDECREF(p2); + Py_XDECREF(p3); file_count = 3; break; *************** *** 5349,5353 **** {"statvfs", posix_statvfs, METH_VARARGS, posix_statvfs__doc__}, #endif ! #ifdef HAVE_TMPNAM {"tmpfile", posix_tmpfile, METH_VARARGS, posix_tmpfile__doc__}, #endif --- 5357,5361 ---- {"statvfs", posix_statvfs, METH_VARARGS, posix_statvfs__doc__}, #endif ! #ifdef HAVE_TMPFILE {"tmpfile", posix_tmpfile, METH_VARARGS, posix_tmpfile__doc__}, #endif *************** *** 5570,5574 **** #ifdef HAVE_PUTENV ! posix_putenv_garbage = PyDict_New(); #endif } --- 5578,5583 ---- #ifdef HAVE_PUTENV ! if (posix_putenv_garbage == NULL) ! posix_putenv_garbage = PyDict_New(); #endif } From moshez@users.sourceforge.net Sat Mar 31 08:10:05 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 00:10:05 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.18,1.81.2.19 Message-ID: <E14jGST-0001AD-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv2690/Misc Modified Files: Tag: release20-maint NEWS Log Message: - posixmodule.c - Add missing prototypes in for SunOS 4.1.4, plug memory leak - #125891 - posixmodule.c - os.popen2,3 and 4 leaked file objects on Windows. - #128053 - posixmodule.c - #ifdef for including "tmpfile" in the posix_methods[] array was wrong -- should be HAVE_TMPFILE Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.18 retrieving revision 1.81.2.19 diff -C2 -r1.81.2.18 -r1.81.2.19 *** NEWS 2001/03/31 07:33:56 1.81.2.18 --- NEWS 2001/03/31 08:10:03 1.81.2.19 *************** *** 77,80 **** --- 77,87 ---- - #232787 -- Modules/timemodule.c, Python/errors.c, Objects/intobject.c + - posixmodule.c - Add missing prototypes in for SunOS 4.1.4, plug memory leak + + - #125891 - posixmodule.c - os.popen2,3 and 4 leaked file objects on Windows. + + - #128053 - posixmodule.c - #ifdef for including "tmpfile" in the + posix_methods[] array was wrong -- should be HAVE_TMPFILE + What's New in Python 2.0? ========================= From moshez@users.sourceforge.net Sat Mar 31 08:31:15 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 00:31:15 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules cPickle.c,2.53.2.1,2.53.2.2 Message-ID: <E14jGmx-0001bB-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv4531/Modules Modified Files: Tag: release20-maint cPickle.c Log Message: Fixing #233200 - cPickle did not use Py_BEGIN_ALLOW_THREADS. Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.53.2.1 retrieving revision 2.53.2.2 diff -C2 -r2.53.2.1 -r2.53.2.2 *** cPickle.c 2001/03/30 17:20:58 2.53.2.1 --- cPickle.c 2001/03/31 08:31:13 2.53.2.2 *************** *** 402,412 **** } ! static int write_file(Picklerobject *self, char *s, int n) { if (s == NULL) { return 0; } ! if (fwrite(s, sizeof(char), n, self->fp) != (size_t)n) { PyErr_SetFromErrno(PyExc_IOError); return -1; --- 402,417 ---- } ! static int write_file(Picklerobject *self, char *s, int n) { + size_t nbyteswritten; + if (s == NULL) { return 0; } ! Py_BEGIN_ALLOW_THREADS ! nbyteswritten = fwrite(s, sizeof(char), n, self->fp); ! Py_END_ALLOW_THREADS ! if (nbyteswritten != (size_t)n) { PyErr_SetFromErrno(PyExc_IOError); return -1; *************** *** 473,491 **** else return -1; } ! else PDATA_PUSH(self->file, py_str, -1); ! ! self->buf_size = 0; return n; } ! static int read_file(Unpicklerobject *self, char **s, int n) { if (self->buf_size == 0) { int size; ! size = ((n < 32) ? 32 : n); UNLESS (self->buf = (char *)malloc(size * sizeof(char))) { PyErr_NoMemory(); --- 478,497 ---- else return -1; } ! else PDATA_PUSH(self->file, py_str, -1); ! ! self->buf_size = 0; return n; } ! static int read_file(Unpicklerobject *self, char **s, int n) { + size_t nbytesread; if (self->buf_size == 0) { int size; ! size = ((n < 32) ? 32 : n); UNLESS (self->buf = (char *)malloc(size * sizeof(char))) { PyErr_NoMemory(); *************** *** 500,508 **** return -1; } ! self->buf_size = n; } ! ! if (fread(self->buf, sizeof(char), n, self->fp) != (size_t)n) { if (feof(self->fp)) { PyErr_SetNone(PyExc_EOFError); --- 506,517 ---- return -1; } ! self->buf_size = n; } ! ! Py_BEGIN_ALLOW_THREADS ! nbytesread = fread(self->buf, sizeof(char), n, self->fp); ! Py_END_ALLOW_THREADS ! if (nbytesread != (size_t)n) { if (feof(self->fp)) { PyErr_SetNone(PyExc_EOFError); From moshez@users.sourceforge.net Sat Mar 31 08:31:15 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 00:31:15 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.19,1.81.2.20 Message-ID: <E14jGmx-0001b9-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv4531/Misc Modified Files: Tag: release20-maint NEWS Log Message: Fixing #233200 - cPickle did not use Py_BEGIN_ALLOW_THREADS. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.19 retrieving revision 1.81.2.20 diff -C2 -r1.81.2.19 -r1.81.2.20 *** NEWS 2001/03/31 08:10:03 1.81.2.19 --- NEWS 2001/03/31 08:31:12 1.81.2.20 *************** *** 84,87 **** --- 84,89 ---- posix_methods[] array was wrong -- should be HAVE_TMPFILE + - #233200 - cPickle did not use Py_BEGIN_ALLOW_THREADS. + What's New in Python 2.0? ========================= From moshez@users.sourceforge.net Sat Mar 31 08:42:39 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 00:42:39 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib shlex.py,1.9,1.9.2.1 Message-ID: <E14jGxz-0001p4-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv6919/Lib Modified Files: Tag: release20-maint shlex.py Log Message: Fixing #125452 - shlex.shlex hangs when it encounters a string with an unmatched quote Index: shlex.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/shlex.py,v retrieving revision 1.9 retrieving revision 1.9.2.1 diff -C2 -r1.9 -r1.9.2.1 *** shlex.py 2000/07/09 16:44:26 1.9 --- shlex.py 2001/03/31 08:42:37 1.9.2.1 *************** *** 124,127 **** --- 124,132 ---- self.state = ' ' break + elif not nextchar: # end of file + if self.debug >= 2: + print "shlex: I see EOF in quotes state" + # XXX what error should be raised here? + raise ValueError, "No closing quotation" elif self.state == 'a': if not nextchar: From moshez@users.sourceforge.net Sat Mar 31 09:12:53 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 01:12:53 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib getopt.py,1.11,1.11.4.1 smtplib.py,1.29,1.29.2.1 Message-ID: <E14jHRF-00034Y-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv8231/Lib Modified Files: Tag: release20-maint getopt.py smtplib.py Log Message: - #119833 - close socket in smtplib if there was an error connecting - #126863 - getopt long option handling fixed Index: getopt.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/getopt.py,v retrieving revision 1.11 retrieving revision 1.11.4.1 diff -C2 -r1.11 -r1.11.4.1 *** getopt.py 2000/02/25 16:34:11 1.11 --- getopt.py 2001/03/31 09:12:51 1.11.4.1 *************** *** 66,71 **** else: longopts = list(longopts) ! longopts.sort() ! while args and args[0][:1] == '-' and args[0] != '-': if args[0] == '--': args = args[1:] --- 66,70 ---- else: longopts = list(longopts) ! while args and args[0].startswith('-') and args[0] != '-': if args[0] == '--': args = args[1:] *************** *** 81,87 **** try: i = opt.index('=') - opt, optarg = opt[:i], opt[i+1:] except ValueError: optarg = None has_arg, opt = long_has_args(opt, longopts) --- 80,87 ---- try: i = opt.index('=') except ValueError: optarg = None + else: + opt, optarg = opt[:i], opt[i+1:] has_arg, opt = long_has_args(opt, longopts) *************** *** 100,115 **** # full option name def long_has_args(opt, longopts): ! optlen = len(opt) ! for i in range(len(longopts)): ! x, y = longopts[i][:optlen], longopts[i][optlen:] ! if opt != x: ! continue ! if y != '' and y != '=' and i+1 < len(longopts): ! if opt == longopts[i+1][:optlen]: ! raise GetoptError('option --%s not a unique prefix' % opt, opt) ! if longopts[i][-1:] in ('=', ): ! return 1, longopts[i][:-1] ! return 0, longopts[i] ! raise GetoptError('option --%s not recognized' % opt, opt) def do_shorts(opts, optstring, shortopts, args): --- 100,122 ---- # full option name def long_has_args(opt, longopts): ! possibilities = [o for o in longopts if o.startswith(opt)] ! if not possibilities: ! raise GetoptError('option --%s not recognized' % opt, opt) ! # Is there an exact match? ! if opt in possibilities: ! return 0, opt ! elif opt + '=' in possibilities: ! return 1, opt ! # No exact match, so better be unique. ! if len(possibilities) > 1: ! # XXX since possibilities contains all valid continuations, might be ! # nice to work them into the error msg ! raise GetoptError('option --%s not a unique prefix' % opt, opt) ! assert len(possibilities) == 1 ! unique_match = possibilities[0] ! has_arg = unique_match.endswith('=') ! if has_arg: ! unique_match = unique_match[:-1] ! return has_arg, unique_match def do_shorts(opts, optstring, shortopts, args): Index: smtplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/smtplib.py,v retrieving revision 1.29 retrieving revision 1.29.2.1 diff -C2 -r1.29 -r1.29.2.1 *** smtplib.py 2000/09/01 06:40:07 1.29 --- smtplib.py 2001/03/31 09:12:51 1.29.2.1 *************** *** 215,219 **** self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) if self.debuglevel > 0: print 'connect:', (host, port) ! self.sock.connect((host, port)) (code,msg)=self.getreply() if self.debuglevel >0 : print "connect:", msg --- 215,223 ---- self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) if self.debuglevel > 0: print 'connect:', (host, port) ! try: ! self.sock.connect((host, port)) ! except socket.error: ! self.close() ! raise (code,msg)=self.getreply() if self.debuglevel >0 : print "connect:", msg From moshez@users.sourceforge.net Sat Mar 31 09:12:53 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 01:12:53 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.20,1.81.2.21 Message-ID: <E14jHRF-00034e-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv8231/Misc Modified Files: Tag: release20-maint NEWS Log Message: - #119833 - close socket in smtplib if there was an error connecting - #126863 - getopt long option handling fixed Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.20 retrieving revision 1.81.2.21 diff -C2 -r1.81.2.20 -r1.81.2.21 *** NEWS 2001/03/31 08:31:12 1.81.2.20 --- NEWS 2001/03/31 09:12:51 1.81.2.21 *************** *** 86,89 **** --- 86,96 ---- - #233200 - cPickle did not use Py_BEGIN_ALLOW_THREADS. + - #125452 - shlex.shlex hungs when it encounters a string with an unmatched + quote + + - #119833 - close socket in smtplib if there was an error connecting + + - #126863 - getopt long option handling fixed + What's New in Python 2.0? ========================= From moshez@users.sourceforge.net Sat Mar 31 09:32:03 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 01:32:03 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib httplib.py,1.24,1.24.2.1 Message-ID: <E14jHjn-0003n6-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv12410/Lib Modified Files: Tag: release20-maint httplib.py Log Message: #123924: Windows - using OpenSSL, problem with socket in httplib.py. Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.24 retrieving revision 1.24.2.1 diff -C2 -r1.24 -r1.24.2.1 *** httplib.py 2000/10/12 19:58:36 1.24 --- httplib.py 2001/03/31 09:32:00 1.24.2.1 *************** *** 614,618 **** sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((self.host, self.port)) ! ssl = socket.ssl(sock, self.key_file, self.cert_file) self.sock = FakeSocket(sock, ssl) --- 614,621 ---- sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((self.host, self.port)) ! realsock = sock ! if hasattr(sock, "_sock"): ! realsock = sock._sock ! ssl = socket.ssl(realsock, self.key_file, self.cert_file) self.sock = FakeSocket(sock, ssl) From moshez@users.sourceforge.net Sat Mar 31 09:32:03 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 01:32:03 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.21,1.81.2.22 Message-ID: <E14jHjn-0003nB-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv12410/Misc Modified Files: Tag: release20-maint NEWS Log Message: #123924: Windows - using OpenSSL, problem with socket in httplib.py. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.21 retrieving revision 1.81.2.22 diff -C2 -r1.81.2.21 -r1.81.2.22 *** NEWS 2001/03/31 09:12:51 1.81.2.21 --- NEWS 2001/03/31 09:32:01 1.81.2.22 *************** *** 93,96 **** --- 93,98 ---- - #126863 - getopt long option handling fixed + - #123924 - httplib.py - Windows - using OpenSSL, problem with socket + What's New in Python 2.0? ========================= From moshez@users.sourceforge.net Sat Mar 31 09:45:06 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 01:45:06 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.22,1.81.2.23 Message-ID: <E14jHwQ-0004FJ-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv14664/Misc Modified Files: Tag: release20-maint NEWS Log Message: atexit.py - mutate list of functions in thread-safe way Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.22 retrieving revision 1.81.2.23 diff -C2 -r1.81.2.22 -r1.81.2.23 *** NEWS 2001/03/31 09:32:01 1.81.2.22 --- NEWS 2001/03/31 09:45:04 1.81.2.23 *************** *** 95,98 **** --- 95,100 ---- - #123924 - httplib.py - Windows - using OpenSSL, problem with socket + - atexit.py - mutate list of functions in thread-safe way + What's New in Python 2.0? ========================= From moshez@users.sourceforge.net Sat Mar 31 09:45:06 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 01:45:06 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib atexit.py,1.1,1.1.2.1 Message-ID: <E14jHwQ-0004FO-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv14664/Lib Modified Files: Tag: release20-maint atexit.py Log Message: atexit.py - mutate list of functions in thread-safe way Index: atexit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/atexit.py,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -r1.1 -r1.1.2.1 *** atexit.py 2000/06/28 15:07:31 1.1 --- atexit.py 2001/03/31 09:45:04 1.1.2.1 *************** *** 15,21 **** while _exithandlers: ! func, targs, kargs = _exithandlers[-1] apply(func, targs, kargs) - _exithandlers.remove(_exithandlers[-1]) def register(func, *targs, **kargs): --- 15,20 ---- while _exithandlers: ! func, targs, kargs = _exithandlers.pop() apply(func, targs, kargs) def register(func, *targs, **kargs): From moshez@users.sourceforge.net Sat Mar 31 10:06:20 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 02:06:20 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.23,1.81.2.24 Message-ID: <E14jIGy-00053m-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv17319/Misc Modified Files: Tag: release20-maint NEWS Log Message: curses.ascii - space (ASCII 32) is now considered whitespace Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.23 retrieving revision 1.81.2.24 diff -C2 -r1.81.2.23 -r1.81.2.24 *** NEWS 2001/03/31 09:45:04 1.81.2.23 --- NEWS 2001/03/31 10:06:17 1.81.2.24 *************** *** 97,100 **** --- 97,102 ---- - atexit.py - mutate list of functions in thread-safe way + - curses.ascii - space (ASCII 32) is now considered whitespace + What's New in Python 2.0? ========================= From moshez@users.sourceforge.net Sat Mar 31 10:06:20 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 02:06:20 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/curses ascii.py,1.3,1.3.4.1 Message-ID: <E14jIGy-00053n-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib/curses In directory usw-pr-cvs1:/tmp/cvs-serv17319/Lib/curses Modified Files: Tag: release20-maint ascii.py Log Message: curses.ascii - space (ASCII 32) is now considered whitespace Index: ascii.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/curses/ascii.py,v retrieving revision 1.3 retrieving revision 1.3.4.1 diff -C2 -r1.3 -r1.3.4.1 *** ascii.py 2000/07/11 10:38:24 1.3 --- ascii.py 2001/03/31 10:06:18 1.3.4.1 *************** *** 62,66 **** def isprint(c): return _ctoi(c) >= 32 and _ctoi(c) <= 126 def ispunct(c): return _ctoi(c) != 32 and not isalnum(c) ! def isspace(c): return _ctoi(c) in (12, 10, 13, 9, 11) def isupper(c): return _ctoi(c) >= 65 and _ctoi(c) <= 90 def isxdigit(c): return isdigit(c) or \ --- 62,66 ---- def isprint(c): return _ctoi(c) >= 32 and _ctoi(c) <= 126 def ispunct(c): return _ctoi(c) != 32 and not isalnum(c) ! def isspace(c): return _ctoi(c) in (9, 10, 11, 12, 13, 32) def isupper(c): return _ctoi(c) >= 65 and _ctoi(c) <= 90 def isxdigit(c): return isdigit(c) or \ From moshez@users.sourceforge.net Sat Mar 31 10:29:05 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 02:29:05 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.24,1.81.2.25 Message-ID: <E14jIcz-0005mG-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv19544/Misc Modified Files: Tag: release20-maint NEWS Log Message: #125375 - parsermodule.c - fix parser.tuple2ast() failure on valid parse tree Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.24 retrieving revision 1.81.2.25 diff -C2 -r1.81.2.24 -r1.81.2.25 *** NEWS 2001/03/31 10:06:17 1.81.2.24 --- NEWS 2001/03/31 10:29:03 1.81.2.25 *************** *** 99,102 **** --- 99,104 ---- - curses.ascii - space (ASCII 32) is now considered whitespace + - #125375 - parsermodule.c - fix parser.tuple2ast() failure on valid parse tree + What's New in Python 2.0? ========================= From moshez@users.sourceforge.net Sat Mar 31 10:29:05 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 02:29:05 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules parsermodule.c,2.57,2.57.2.1 Message-ID: <E14jIcz-0005mL-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv19544/Modules Modified Files: Tag: release20-maint parsermodule.c Log Message: #125375 - parsermodule.c - fix parser.tuple2ast() failure on valid parse tree Index: parsermodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/parsermodule.c,v retrieving revision 2.57 retrieving revision 2.57.2.1 diff -C2 -r2.57 -r2.57.2.1 *** parsermodule.c 2000/09/12 21:58:06 2.57 --- parsermodule.c 2001/03/31 10:29:03 2.57.2.1 *************** *** 1099,1102 **** --- 1099,1104 ---- int sym; + if (!res) + return 0; if (nch < 1) { err_string("varargslist missing child nodes"); *************** *** 1105,1108 **** --- 1107,1113 ---- sym = TYPE(CHILD(tree, 0)); if (sym == STAR || sym == DOUBLESTAR) + /* whole thing matches: + * '*' NAME [',' '**' NAME] | '**' NAME + */ res = validate_varargslist_trailer(tree, 0); else if (sym == fpdef) { *************** *** 1128,1136 **** if (res && i < nch) { res = validate_comma(CHILD(tree, i)); ! if (res) ! ++i; } } ! /* handle '*' NAME [',' '**' NAME] | '**' NAME */ if (res) res = validate_varargslist_trailer(tree, i); --- 1133,1146 ---- if (res && i < nch) { res = validate_comma(CHILD(tree, i)); ! ++i; ! if (res && i < nch ! && (TYPE(CHILD(tree, i)) == DOUBLESTAR ! || TYPE(CHILD(tree, i)) == STAR)) ! break; } } ! /* ... '*' NAME [',' '**' NAME] | '**' NAME ! * i --^^^ ! */ if (res) res = validate_varargslist_trailer(tree, i); *************** *** 1140,1143 **** --- 1150,1154 ---- * fpdef ['=' test] (',' fpdef ['=' test])* [','] */ + /* strip trailing comma node */ if (sym == COMMA) { res = validate_comma(CHILD(tree, nch-1)); *************** *** 1151,1157 **** res = validate_fpdef(CHILD(tree, 0)); ++i; ! if (res && (i+2 < nch) && TYPE(CHILD(tree, 1)) == EQUAL) { ! res = (validate_equal(CHILD(tree, 1)) ! && validate_test(CHILD(tree, 2))); i += 2; } --- 1162,1168 ---- res = validate_fpdef(CHILD(tree, 0)); ++i; ! if (res && (i+2 <= nch) && TYPE(CHILD(tree, i)) == EQUAL) { ! res = (validate_equal(CHILD(tree, i)) ! && validate_test(CHILD(tree, i+1))); i += 2; } *************** *** 1164,1173 **** && validate_fpdef(CHILD(tree, i+1))); i += 2; ! if (res && (nch - i) >= 2 ! && TYPE(CHILD(tree, i)) == COMMA) { ! res = (validate_comma(CHILD(tree, i)) && validate_test(CHILD(tree, i+1))); ! if (res) ! i += 2; } } --- 1175,1182 ---- && validate_fpdef(CHILD(tree, i+1))); i += 2; ! if (res && (nch - i) >= 2 && TYPE(CHILD(tree, i)) == EQUAL) { ! res = (validate_equal(CHILD(tree, i)) && validate_test(CHILD(tree, i+1))); ! i += 2; } } From moshez@users.sourceforge.net Sat Mar 31 10:55:49 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 02:55:49 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules mpzmodule.c,2.34,2.34.2.1 Message-ID: <E14jJ2r-0007K6-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv23401/Modules Modified Files: Tag: release20-maint mpzmodule.c Log Message: Make mpz's .binary() work on 64 bit platforms Make mpzmodule compile with cygwin Index: mpzmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/mpzmodule.c,v retrieving revision 2.34 retrieving revision 2.34.2.1 diff -C2 -r2.34 -r2.34.2.1 *** mpzmodule.c 2000/10/11 21:53:34 2.34 --- mpzmodule.c 2001/03/31 10:55:47 2.34.2.1 *************** *** 1478,1481 **** --- 1478,1487 ---- *cp++ = (unsigned char)((ldigit >>= 8) & 0xFF); *cp++ = (unsigned char)((ldigit >>= 8) & 0xFF); + if (sizeof(ldigit) == 8 && BITS_PER_MP_LIMB == 64) { + *cp++ = (unsigned char)((ldigit >>= 8) & 0xFF); + *cp++ = (unsigned char)((ldigit >>= 8) & 0xFF); + *cp++ = (unsigned char)((ldigit >>= 8) & 0xFF); + *cp++ = (unsigned char)((ldigit >>= 8) & 0xFF); + } } *************** *** 1585,1589 **** static PyTypeObject MPZtype = { ! PyObject_HEAD_INIT(&PyType_Type) 0, /*ob_size*/ "mpz", /*tp_name*/ --- 1591,1595 ---- static PyTypeObject MPZtype = { ! PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ "mpz", /*tp_name*/ *************** *** 1717,1720 **** --- 1723,1727 ---- mp_set_memory_functions( mp_allocate, mp_reallocate, mp_free ); + MPZtype.ob_type = &PyType_Type; module = Py_InitModule("mpz", mpz_functions); From moshez@users.sourceforge.net Sat Mar 31 10:55:49 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 02:55:49 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.25,1.81.2.26 Message-ID: <E14jJ2r-0007K5-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv23401/Misc Modified Files: Tag: release20-maint NEWS Log Message: Make mpz's .binary() work on 64 bit platforms Make mpzmodule compile with cygwin Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.25 retrieving revision 1.81.2.26 diff -C2 -r1.81.2.25 -r1.81.2.26 *** NEWS 2001/03/31 10:29:03 1.81.2.25 --- NEWS 2001/03/31 10:55:47 1.81.2.26 *************** *** 101,104 **** --- 101,107 ---- - #125375 - parsermodule.c - fix parser.tuple2ast() failure on valid parse tree + - mpzmodule.c - make .binary() work on 64-bit system, make it compile with + Cygwin + What's New in Python 2.0? ========================= From moshez@users.sourceforge.net Sat Mar 31 11:14:45 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 03:14:45 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules binascii.c,2.27,2.27.2.1 Message-ID: <E14jJLB-00081Q-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv28421/Modules Modified Files: Tag: release20-maint binascii.c Log Message: Address a bug in the uuencode decoder, reported bu "donut" in SF bug #127718: '@' and '`' seem to be confused. Index: binascii.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/binascii.c,v retrieving revision 2.27 retrieving revision 2.27.2.1 diff -C2 -r2.27 -r2.27.2.1 *** binascii.c 2000/09/01 23:29:26 2.27 --- binascii.c 2001/03/31 11:14:43 2.27.2.1 *************** *** 205,209 **** ** The 64 in stead of the expected 63 is because ** there are a few uuencodes out there that use ! ** '@' as zero instead of space. */ if ( this_ch < ' ' || this_ch > (' ' + 64)) { --- 205,209 ---- ** The 64 in stead of the expected 63 is because ** there are a few uuencodes out there that use ! ** '`' as zero instead of space. */ if ( this_ch < ' ' || this_ch > (' ' + 64)) { *************** *** 233,238 **** while( ascii_len-- > 0 ) { this_ch = *ascii_data++; ! /* Extra '@' may be written as padding in some cases */ ! if ( this_ch != ' ' && this_ch != '@' && this_ch != '\n' && this_ch != '\r' ) { PyErr_SetString(Error, "Trailing garbage"); --- 233,238 ---- while( ascii_len-- > 0 ) { this_ch = *ascii_data++; ! /* Extra '`' may be written as padding in some cases */ ! if ( this_ch != ' ' && this_ch != ' '+64 && this_ch != '\n' && this_ch != '\r' ) { PyErr_SetString(Error, "Trailing garbage"); From moshez@users.sourceforge.net Sat Mar 31 11:14:45 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 03:14:45 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.26,1.81.2.27 Message-ID: <E14jJLB-00081N-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv28421/Misc Modified Files: Tag: release20-maint NEWS Log Message: Address a bug in the uuencode decoder, reported bu "donut" in SF bug #127718: '@' and '`' seem to be confused. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.26 retrieving revision 1.81.2.27 diff -C2 -r1.81.2.26 -r1.81.2.27 *** NEWS 2001/03/31 10:55:47 1.81.2.26 --- NEWS 2001/03/31 11:14:42 1.81.2.27 *************** *** 104,107 **** --- 104,109 ---- Cygwin + - #127718 - '@' were '`' seem to be confused. + What's New in Python 2.0? ========================= From moshez@users.sourceforge.net Sat Mar 31 13:18:38 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 05:18:38 -0800 Subject: [Python-checkins] CVS: python/dist/src/Python pythonrun.c,2.115,2.115.2.1 getargs.c,2.49,2.49.2.1 Message-ID: <E14jLH4-0003xR-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv14060/Python Modified Files: Tag: release20-maint pythonrun.c getargs.c Log Message: - #119862 - getargs.c - patched memory leak - #128475 - pythonrun.c - In Py_Finalize, don't reset initialized flag until after the exit funcs have run Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.115 retrieving revision 2.115.2.1 diff -C2 -r2.115 -r2.115.2.1 *** pythonrun.c 2000/09/16 16:32:19 2.115 --- pythonrun.c 2001/03/31 13:18:35 2.115.2.1 *************** *** 184,190 **** if (!initialized) return; - initialized = 0; call_sys_exitfunc(); /* Get current thread state and interpreter pointer */ --- 184,199 ---- if (!initialized) return; + /* The interpreter is still entirely intact at this point, and the + * exit funcs may be relying on that. In particular, if some thread + * or exit func is still waiting to do an import, the import machinery + * expects Py_IsInitialized() to return true. So don't say the + * interpreter is uninitialized until after the exit funcs have run. + * Note that Threading.py uses an exit func to do a join on all the + * threads created thru it, so this also protects pending imports in + * the threads created via Threading. + */ call_sys_exitfunc(); + initialized = 0; /* Get current thread state and interpreter pointer */ Index: getargs.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/getargs.c,v retrieving revision 2.49 retrieving revision 2.49.2.1 diff -C2 -r2.49 -r2.49.2.1 *** getargs.c 2000/09/26 05:46:01 2.49 --- getargs.c 2001/03/31 13:18:35 2.49.2.1 *************** *** 1125,1128 **** --- 1125,1129 ---- } converted++; + Py_DECREF(item); } else { From moshez@users.sourceforge.net Sat Mar 31 13:18:37 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 05:18:37 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.27,1.81.2.28 Message-ID: <E14jLH3-0003xL-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv14060/Misc Modified Files: Tag: release20-maint NEWS Log Message: - #119862 - getargs.c - patched memory leak - #128475 - pythonrun.c - In Py_Finalize, don't reset initialized flag until after the exit funcs have run Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.27 retrieving revision 1.81.2.28 diff -C2 -r1.81.2.27 -r1.81.2.28 *** NEWS 2001/03/31 11:14:42 1.81.2.27 --- NEWS 2001/03/31 13:18:35 1.81.2.28 *************** *** 106,109 **** --- 106,114 ---- - #127718 - '@' were '`' seem to be confused. + - #119862 - getargs.c - patched memory leak + + - #128475 - pythonrun.c - In Py_Finalize, don't reset initialized flag + until after the exit funcs have run + What's New in Python 2.0? ========================= From moshez@users.sourceforge.net Sat Mar 31 13:23:22 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 05:23:22 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules mmapmodule.c,2.24,2.24.2.1 Message-ID: <E14jLLe-0004B7-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv15193/Modules Modified Files: Tag: release20-maint mmapmodule.c Log Message: - #128713 - mmapmodule.c - type(mmap_object) blew up on Linux. - mmap on windows creates a mapping without a name when tagname isn't specified Index: mmapmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/mmapmodule.c,v retrieving revision 2.24 retrieving revision 2.24.2.1 diff -C2 -r2.24 -r2.24.2.1 *** mmapmodule.c 2000/10/01 17:50:46 2.24 --- mmapmodule.c 2001/03/31 13:23:19 2.24.2.1 *************** *** 842,848 **** HANDLE fh = 0; - /* Patch the object type */ - mmap_object_type.ob_type = &PyType_Type; - if (!PyArg_ParseTuple(args, "iO|z", --- 842,845 ---- *************** *** 908,912 **** /* set the tag name */ ! if (tagname != NULL) { m_obj->tagname = PyMem_Malloc(strlen(tagname)+1); if (m_obj->tagname == NULL) { --- 905,909 ---- /* set the tag name */ ! if (tagname != NULL && *tagname != '\0') { m_obj->tagname = PyMem_Malloc(strlen(tagname)+1); if (m_obj->tagname == NULL) { *************** *** 925,929 **** 0, m_obj->size, ! tagname); if (m_obj->map_handle != NULL) { m_obj->data = (char *) MapViewOfFile (m_obj->map_handle, --- 922,926 ---- 0, m_obj->size, ! m_obj->tagname); if (m_obj->map_handle != NULL) { m_obj->data = (char *) MapViewOfFile (m_obj->map_handle, *************** *** 963,966 **** --- 960,967 ---- { PyObject *dict, *module; + + /* Patch the object type */ + mmap_object_type.ob_type = &PyType_Type; + module = Py_InitModule ("mmap", mmap_functions); dict = PyModule_GetDict (module); From moshez@users.sourceforge.net Sat Mar 31 13:32:41 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 05:32:41 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.28,1.81.2.29 Message-ID: <E14jLUf-0004WQ-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv16574/Misc Modified Files: Tag: release20-maint NEWS Log Message: Fix two typos in __imul__. Closes Bug #117745. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.28 retrieving revision 1.81.2.29 diff -C2 -r1.81.2.28 -r1.81.2.29 *** NEWS 2001/03/31 13:18:35 1.81.2.28 --- NEWS 2001/03/31 13:32:38 1.81.2.29 *************** *** 111,114 **** --- 111,121 ---- until after the exit funcs have run + - #128713 - mmapmodule.c - type(mmap_object) blew up on Linux. + + - mmap on windows creates a mapping without a name when tagname isn't + specified + + - #117745 - UserString.py - Fix two typos in __imul__. + What's New in Python 2.0? ========================= From moshez@users.sourceforge.net Sat Mar 31 13:32:41 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 05:32:41 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib UserString.py,1.6,1.6.2.1 Message-ID: <E14jLUf-0004WP-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv16574/Lib Modified Files: Tag: release20-maint UserString.py Log Message: Fix two typos in __imul__. Closes Bug #117745. Index: UserString.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/UserString.py,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -C2 -r1.6 -r1.6.2.1 *** UserString.py 2000/08/24 21:47:34 1.6 --- UserString.py 2001/03/31 13:32:38 1.6.2.1 *************** *** 62,67 **** return self.__class__(self.data*n) __rmul__ = __mul__ ! def __imull__(self, n): ! self.data += n return self --- 62,67 ---- return self.__class__(self.data*n) __rmul__ = __mul__ ! def __imul__(self, n): ! self.data *= n return self From moshez@users.sourceforge.net Sat Mar 31 13:46:36 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 05:46:36 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib statcache.py,1.7,1.7.4.1 Message-ID: <E14jLi8-0004v7-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv18533/Lib Modified Files: Tag: release20-maint statcache.py Log Message: - #130306 - statcache.py - full of thread problems. - Made statcache.forget_dir more portable Index: statcache.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/statcache.py,v retrieving revision 1.7 retrieving revision 1.7.4.1 diff -C2 -r1.7 -r1.7.4.1 *** statcache.py 2000/02/04 15:39:30 1.7 --- statcache.py 2001/03/31 13:46:33 1.7.4.1 *************** *** 15,20 **** def stat(path): """Stat a file, possibly out of the cache.""" ! if cache.has_key(path): ! return cache[path] cache[path] = ret = os.stat(path) return ret --- 15,21 ---- def stat(path): """Stat a file, possibly out of the cache.""" ! ret = cache.get(path, None) ! if ret is not None: ! return ret cache[path] = ret = os.stat(path) return ret *************** *** 23,34 **** def reset(): """Reset the cache completely.""" ! global cache ! cache = {} def forget(path): """Remove a given item from the cache, if it exists.""" ! if cache.has_key(path): del cache[path] --- 24,36 ---- def reset(): """Reset the cache completely.""" ! cache.clear() def forget(path): """Remove a given item from the cache, if it exists.""" ! try: del cache[path] + except KeyError: + pass *************** *** 38,42 **** for path in cache.keys(): if path[:n] == prefix: ! del cache[path] --- 40,44 ---- for path in cache.keys(): if path[:n] == prefix: ! forget(path) *************** *** 44,60 **** """Forget about a directory and all entries in it, but not about entries in subdirectories.""" ! if prefix[-1:] == '/' and prefix <> '/': ! prefix = prefix[:-1] forget(prefix) - if prefix[-1:] <> '/': - prefix = prefix + '/' - n = len(prefix) for path in cache.keys(): ! if path[:n] == prefix: ! rest = path[n:] ! if rest[-1:] == '/': rest = rest[:-1] ! if '/' not in rest: ! del cache[path] ! def forget_except_prefix(prefix): --- 46,55 ---- """Forget about a directory and all entries in it, but not about entries in subdirectories.""" ! import os.path ! prefix = os.path.dirname(os.path.join(prefix, "xxx")) forget(prefix) for path in cache.keys(): ! if path.startswith(prefix) and os.path.dirname(path) == prefix: ! forget(path) def forget_except_prefix(prefix): *************** *** 64,68 **** for path in cache.keys(): if path[:n] <> prefix: ! del cache[path] --- 59,63 ---- for path in cache.keys(): if path[:n] <> prefix: ! forget(path) From moshez@users.sourceforge.net Sat Mar 31 13:46:36 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 05:46:36 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.29,1.81.2.30 Message-ID: <E14jLi8-0004vC-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv18533/Misc Modified Files: Tag: release20-maint NEWS Log Message: - #130306 - statcache.py - full of thread problems. - Made statcache.forget_dir more portable Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.29 retrieving revision 1.81.2.30 diff -C2 -r1.81.2.29 -r1.81.2.30 *** NEWS 2001/03/31 13:32:38 1.81.2.29 --- NEWS 2001/03/31 13:46:34 1.81.2.30 *************** *** 118,121 **** --- 118,125 ---- - #117745 - UserString.py - Fix two typos in __imul__. + - #130306 - statcache.py - full of thread problems. + + - Made statcache.forget_dir more portable + What's New in Python 2.0? ========================= From moshez@users.sourceforge.net Sat Mar 31 13:52:04 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 05:52:04 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib site.py,1.20,1.20.2.1 Message-ID: <E14jLnQ-000597-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv19002/Lib Modified Files: Tag: release20-maint site.py Log Message: The ".pth" code knew about the layout of Python trees on unix and windows, but not on the mac. Fixed. Index: site.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/site.py,v retrieving revision 1.20 retrieving revision 1.20.2.1 diff -C2 -r1.20 -r1.20.2.1 *** site.py 2000/10/03 17:11:37 1.20 --- site.py 2001/03/31 13:52:02 1.20.2.1 *************** *** 123,126 **** --- 123,128 ---- "site-packages"), makepath(prefix, "lib", "site-python")] + elif os.sep == ':': + sitedirs = [makepath(prefix, "lib", "site-packages")] else: sitedirs = [prefix] From moshez@users.sourceforge.net Sat Mar 31 13:52:04 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 05:52:04 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.30,1.81.2.31 Message-ID: <E14jLnQ-00059C-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv19002/Misc Modified Files: Tag: release20-maint NEWS Log Message: The ".pth" code knew about the layout of Python trees on unix and windows, but not on the mac. Fixed. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.30 retrieving revision 1.81.2.31 diff -C2 -r1.81.2.30 -r1.81.2.31 *** NEWS 2001/03/31 13:46:34 1.81.2.30 --- NEWS 2001/03/31 13:52:02 1.81.2.31 *************** *** 122,125 **** --- 122,128 ---- - Made statcache.forget_dir more portable + - In site.py, the ".pth" code knew about the layout of Python trees on + unix and windows, but not on the mac. Fixed. + What's New in Python 2.0? ========================= From moshez@users.sourceforge.net Sat Mar 31 14:01:16 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 06:01:16 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules config.c.in,1.71,1.71.2.1 Message-ID: <E14jLwK-0005Xe-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv20456/Modules Modified Files: Tag: release20-maint config.c.in Log Message: - #121706 - config.c - _PyImport_Inittab: define the exceptions module's init function. Index: config.c.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/config.c.in,v retrieving revision 1.71 retrieving revision 1.71.2.1 diff -C2 -r1.71 -r1.71.2.1 *** config.c.in 2000/07/23 00:02:15 1.71 --- config.c.in 2001/03/31 14:01:13 1.71.2.1 *************** *** 38,42 **** {"__builtin__", NULL}, {"sys", NULL}, ! {"exceptions", NULL}, /* Sentinel */ --- 38,42 ---- {"__builtin__", NULL}, {"sys", NULL}, ! {"exceptions", init_exceptions}, /* Sentinel */ From moshez@users.sourceforge.net Sat Mar 31 14:01:16 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 06:01:16 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.31,1.81.2.32 Message-ID: <E14jLwK-0005XZ-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv20456/Misc Modified Files: Tag: release20-maint NEWS Log Message: - #121706 - config.c - _PyImport_Inittab: define the exceptions module's init function. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.31 retrieving revision 1.81.2.32 diff -C2 -r1.81.2.31 -r1.81.2.32 *** NEWS 2001/03/31 13:52:02 1.81.2.31 --- NEWS 2001/03/31 14:01:13 1.81.2.32 *************** *** 125,128 **** --- 125,131 ---- unix and windows, but not on the mac. Fixed. + - #121706 - config.c - _PyImport_Inittab: define the exceptions module's init + function. + What's New in Python 2.0? ========================= From moshez@users.sourceforge.net Sat Mar 31 14:06:34 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 06:06:34 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.32,1.81.2.33 Message-ID: <E14jM1S-0005kQ-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv21496/Misc Modified Files: Tag: release20-maint NEWS Log Message: - Update install-sh using version from automake 1.4. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.32 retrieving revision 1.81.2.33 diff -C2 -r1.81.2.32 -r1.81.2.33 *** NEWS 2001/03/31 14:01:13 1.81.2.32 --- NEWS 2001/03/31 14:06:31 1.81.2.33 *************** *** 128,131 **** --- 128,133 ---- function. + - Update install-sh using version from automake 1.4. + What's New in Python 2.0? ========================= From moshez@users.sourceforge.net Sat Mar 31 14:06:34 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 06:06:34 -0800 Subject: [Python-checkins] CVS: python/dist/src install-sh,2.3,2.3.4.1 Message-ID: <E14jM1S-0005kV-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv21496 Modified Files: Tag: release20-maint install-sh Log Message: - Update install-sh using version from automake 1.4. Index: install-sh =================================================================== RCS file: /cvsroot/python/python/dist/src/install-sh,v retrieving revision 2.3 retrieving revision 2.3.4.1 diff -C2 -r2.3 -r2.3.4.1 *** install-sh 1998/08/13 16:08:45 2.3 --- install-sh 2001/03/31 14:06:32 2.3.4.1 *************** *** 1,13 **** #!/bin/sh - # # install - install a program, script, or datafile ! # This comes from X11R5; it is not part of GNU. # ! # $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $ # ! # This script is compatible with the BSD install script, but was written ! # from scratch. # --- 1,26 ---- #!/bin/sh # # install - install a program, script, or datafile ! # This comes from X11R5 (mit/util/scripts/install.sh). # ! # Copyright 1991 by the Massachusetts Institute of Technology # ! # Permission to use, copy, modify, distribute, and sell this software and its ! # documentation for any purpose is hereby granted without fee, provided that ! # the above copyright notice appear in all copies and that both that ! # copyright notice and this permission notice appear in supporting ! # documentation, and that the name of M.I.T. not be used in advertising or ! # publicity pertaining to distribution of the software without specific, ! # written prior permission. M.I.T. makes no representations about the ! # suitability of this software for any purpose. It is provided "as is" ! # without express or implied warranty. # + # Calling this script install-sh is preferred over install.sh, to prevent + # `make' implicit rules from creating a file called install from it + # when there is no Makefile. + # + # This script is compatible with the BSD install script, but was written + # from scratch. It can only install one file at a time, a restriction + # shared with many OS's install programs. *************** *** 27,33 **** stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" instcmd="$mvprog" ! chmodcmd="" chowncmd="" chgrpcmd="" --- 40,49 ---- stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" + mkdirprog="${MKDIRPROG-mkdir}" + transformbasename="" + transform_arg="" instcmd="$mvprog" ! chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" *************** *** 37,40 **** --- 53,57 ---- src="" dst="" + dir_arg="" while [ x"$1" != x ]; do *************** *** 44,47 **** --- 61,68 ---- continue;; + -d) dir_arg=true + shift + continue;; + -m) chmodcmd="$chmodprog $2" shift *************** *** 63,70 **** --- 84,101 ---- continue;; + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + *) if [ x"$src" = x ] then src=$1 else + # this colon is to work around a 386BSD /bin/sh bug + : dst=$1 fi *************** *** 76,119 **** if [ x"$src" = x ] then ! echo "install: no input file specified" exit 1 fi ! if [ x"$dst" = x ] ! then ! echo "install: no destination specified" ! exit 1 ! fi ! # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic ! if [ -d $dst ] ! then ! dst="$dst"/`basename $src` fi # Make a temp file name in the proper directory. ! # Avoid dirname, which doesn't exist everywhere... ! dstdir=`echo $dst | sed 's,/[^/]*$,,'` ! dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name ! $doit $instcmd $src $dsttmp || exit $? # and set any options; do chmod last to preserve setuid bits ! if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; fi ! if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; fi ! if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; fi ! if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; fi # Now rename the file to the real destination. ! $doit $rmcmd $dst ! $doit $mvcmd $dsttmp $dst || exit $? --- 107,250 ---- if [ x"$src" = x ] then ! echo "install: no input file specified" exit 1 + else + true fi ! if [ x"$dir_arg" != x ]; then ! dst=$src ! src="" ! ! if [ -d $dst ]; then ! instcmd=: ! chmodcmd="" ! else ! instcmd=mkdir ! fi ! else ! ! # Waiting for this to be detected by the "$instcmd $src $dsttmp" command ! # might cause directories to be created, which would be especially bad ! # if $src (and thus $dsttmp) contains '*'. ! ! if [ -f $src -o -d $src ] ! then ! true ! else ! echo "install: $src does not exist" ! exit 1 ! fi ! ! if [ x"$dst" = x ] ! then ! echo "install: no destination specified" ! exit 1 ! else ! true ! fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic ! if [ -d $dst ] ! then ! dst="$dst"/`basename $src` ! else ! true ! fi ! fi ! ! ## this sed command emulates the dirname command ! dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` ! ! # Make sure that the destination directory exists. ! # this part is taken from Noah Friedman's mkinstalldirs script ! ! # Skip lots of stat calls in the usual case. ! if [ ! -d "$dstdir" ]; then ! defaultIFS=' ! ' ! IFS="${IFS-${defaultIFS}}" ! ! oIFS="${IFS}" ! # Some sh's can't handle IFS=/ for some reason. ! IFS='%' ! set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` ! IFS="${oIFS}" ! ! pathcomp='' ! ! while [ $# -ne 0 ] ; do ! pathcomp="${pathcomp}${1}" ! shift ! ! if [ ! -d "${pathcomp}" ] ; ! then ! $mkdirprog "${pathcomp}" ! else ! true ! fi ! ! pathcomp="${pathcomp}/" ! done fi + if [ x"$dir_arg" != x ] + then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi + else + + # If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + + # don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + # Make a temp file name in the proper directory. ! dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && ! trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits ! # If any of these fail, we abort the whole thing. If we want to ! # ignore errors from any of these, just make sure not to ignore ! # errors from the above "$doit $instcmd $src $dsttmp" command. ! ! if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && ! if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && ! if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && ! if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile ! fi && From moshez@users.sourceforge.net Sat Mar 31 14:13:28 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 06:13:28 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.33,1.81.2.34 Message-ID: <E14jM88-0005yI-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv22532/Misc Modified Files: Tag: release20-maint NEWS Log Message: - #12195 - webbrowser.py - there was typo in Mac code Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.33 retrieving revision 1.81.2.34 diff -C2 -r1.81.2.33 -r1.81.2.34 *** NEWS 2001/03/31 14:06:31 1.81.2.33 --- NEWS 2001/03/31 14:13:25 1.81.2.34 *************** *** 130,133 **** --- 130,135 ---- - Update install-sh using version from automake 1.4. + - #12195 - webbrowser.py - there was typo in Mac code + What's New in Python 2.0? ========================= From moshez@users.sourceforge.net Sat Mar 31 14:13:28 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 06:13:28 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib webbrowser.py,1.4,1.4.2.1 Message-ID: <E14jM88-0005yH-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv22532/Lib Modified Files: Tag: release20-maint webbrowser.py Log Message: - #12195 - webbrowser.py - there was typo in Mac code Index: webbrowser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/webbrowser.py,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -C2 -r1.4 -r1.4.2.1 *** webbrowser.py 2000/10/02 03:40:51 1.4 --- webbrowser.py 2001/03/31 14:13:26 1.4.2.1 *************** *** 216,220 **** class InternetConfig: def open(self, url, new=0): ! ic.launcurl(url) def open_new(self, url): --- 216,220 ---- class InternetConfig: def open(self, url, new=0): ! ic.launchurl(url) def open_new(self, url): From moshez@users.sourceforge.net Sat Mar 31 14:14:45 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 06:14:45 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib quopri.py,1.7,1.7.2.1 Message-ID: <E14jM9N-0005zr-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv22973/Lib Modified Files: Tag: release20-maint quopri.py Log Message: Treat \r as whitespace too, when removing trailing whitespace Index: quopri.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/quopri.py,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -C2 -r1.7 -r1.7.2.1 *** quopri.py 2000/10/05 17:24:33 1.7 --- quopri.py 2001/03/31 14:14:43 1.7.2.1 *************** *** 64,68 **** partial = 0; n = n-1 # Strip trailing whitespace ! while n > 0 and line[n-1] in (' ', '\t'): n = n-1 else: --- 64,68 ---- partial = 0; n = n-1 # Strip trailing whitespace ! while n > 0 and line[n-1] in " \t\r": n = n-1 else: From moshez@users.sourceforge.net Sat Mar 31 14:26:56 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 06:26:56 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.34,1.81.2.35 Message-ID: <E14jMLA-0006II-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv23452/Misc Modified Files: Tag: release20-maint NEWS Log Message: - xmllib.py - Moved clearing of "literal" flag. The flag is set in setliteral which can be called from a start tag handler. When the corresponding end tag is read the flag is cleared. However, it didn't get cleared when the start tag was for an empty element of the type <tag .../>. This modification fixes the problem. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.34 retrieving revision 1.81.2.35 diff -C2 -r1.81.2.34 -r1.81.2.35 *** NEWS 2001/03/31 14:13:25 1.81.2.34 --- NEWS 2001/03/31 14:26:53 1.81.2.35 *************** *** 132,135 **** --- 132,143 ---- - #12195 - webbrowser.py - there was typo in Mac code + - quopri.py - treat \r as whitespace too + + - xmllib.py - Moved clearing of "literal" flag. The flag is set in setliteral + which can be called from a start tag handler. When the corresponding end + tag is read the flag is cleared. However, it didn't get cleared when + the start tag was for an empty element of the type <tag .../>. This + modification fixes the problem. + What's New in Python 2.0? ========================= From moshez@users.sourceforge.net Sat Mar 31 14:26:56 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 06:26:56 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib xmllib.py,1.23,1.23.2.1 Message-ID: <E14jMLA-0006IM-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv23452/Lib Modified Files: Tag: release20-maint xmllib.py Log Message: - xmllib.py - Moved clearing of "literal" flag. The flag is set in setliteral which can be called from a start tag handler. When the corresponding end tag is read the flag is cleared. However, it didn't get cleared when the start tag was for an empty element of the type <tag .../>. This modification fixes the problem. Index: xmllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xmllib.py,v retrieving revision 1.23 retrieving revision 1.23.2.1 diff -C2 -r1.23 -r1.23.2.1 *** xmllib.py 2000/08/31 10:26:52 1.23 --- xmllib.py 2001/03/31 14:26:54 1.23.2.1 *************** *** 684,688 **** self.handle_data(rawdata[i]) return i+1 - self.literal = 0 k = res.end(0) if endbracket.match(rawdata, k) is None: --- 684,687 ---- *************** *** 700,703 **** --- 699,703 ---- # Internal -- finish processing of end tag def finish_endtag(self, tag): + self.literal = 0 if not tag: self.syntax_error('name-less end tag') From moshez@users.sourceforge.net Sat Mar 31 14:48:37 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 06:48:37 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.35,1.81.2.36 Message-ID: <E14jMg9-0006zZ-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv24736/Misc Modified Files: Tag: release20-maint NEWS Log Message: - #117606 - configure.in, configure - use gcc -shared and gcc -fPIC Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.35 retrieving revision 1.81.2.36 diff -C2 -r1.81.2.35 -r1.81.2.36 *** NEWS 2001/03/31 14:26:53 1.81.2.35 --- NEWS 2001/03/31 14:48:34 1.81.2.36 *************** *** 140,143 **** --- 140,145 ---- modification fixes the problem. + - #117606 - configure.in, configure - use gcc -shared and gcc -fPIC + What's New in Python 2.0? ========================= From moshez@users.sourceforge.net Sat Mar 31 14:48:40 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 06:48:40 -0800 Subject: [Python-checkins] CVS: python/dist/src configure,1.165,1.165.2.1 configure.in,1.173,1.173.2.1 Message-ID: <E14jMgC-0006zi-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv24736 Modified Files: Tag: release20-maint configure configure.in Log Message: - #117606 - configure.in, configure - use gcc -shared and gcc -fPIC Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.165 retrieving revision 1.165.2.1 diff -C2 -r1.165 -r1.165.2.1 *** configure 2000/10/16 16:59:12 1.165 --- configure 2001/03/31 14:48:35 1.165.2.1 *************** *** 1,5 **** #! /bin/sh ! # From configure.in Revision: 1.172 # Guess values for system-dependent variables and create Makefiles. --- 1,5 ---- #! /bin/sh ! # From configure.in Revision: 1.173 [...3153 lines suppressed...] echo $ac_n "checking for socklen_t""... $ac_c" 1>&6 ! echo "configure:5893: checking for socklen_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_socklen_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF ! #line 5898 "configure" #include "confdefs.h" #include <sys/types.h> --- 5900,5909 ---- EOF echo $ac_n "checking for socklen_t""... $ac_c" 1>&6 ! echo "configure:5903: checking for socklen_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_socklen_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF ! #line 5908 "configure" #include "confdefs.h" #include <sys/types.h> Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.173 retrieving revision 1.173.2.1 diff -C2 -r1.173 -r1.173.2.1 *** configure.in 2000/10/16 16:59:12 1.173 --- configure.in 2001/03/31 14:48:37 1.173.2.1 *************** *** 309,314 **** yes) case $ac_cv_prog_cc_g in ! yes) OPT="-g -O2 -Wall -Wstrict-prototypes";; ! *) OPT="-O2 -Wall -Wstrict-prototypes";; esac ;; --- 309,314 ---- yes) case $ac_cv_prog_cc_g in ! yes) OPT="-g -O2 -Wall -Wstrict-prototypes -fPIC";; ! *) OPT="-O2 -Wall -Wstrict-prototypes -fPIC";; esac ;; *************** *** 565,569 **** SunOS/5*) if test "$GCC" = "yes" ! then LDSHARED='$(CC) -G' else LDSHARED="ld -G"; fi ;; --- 565,569 ---- SunOS/5*) if test "$GCC" = "yes" ! then LDSHARED='$(CC) -shared' else LDSHARED="ld -G"; fi ;; From moshez@users.sourceforge.net Sat Mar 31 14:58:23 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 06:58:23 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib urllib.py,1.107,1.107.2.1 Message-ID: <E14jMpb-0007CH-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv26992/Lib Modified Files: Tag: release20-maint urllib.py Log Message: - #227562 - urllib.py - call URLopener.http_error_default when an invalid 401 request is being handled. - urllib.py - provide simple recovery/escape from apparent redirect recursion - #129288 - urllib.py - chanign %02x to %02X in quoting - urllib.py - HTTPS now works with string URLs Index: urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib.py,v retrieving revision 1.107 retrieving revision 1.107.2.1 diff -C2 -r1.107 -r1.107.2.1 *** urllib.py 2000/10/02 23:04:02 1.107 --- urllib.py 2001/03/31 14:58:20 1.107.2.1 *************** *** 513,516 **** --- 513,518 ---- apply(URLopener.__init__, (self,) + args) self.auth_cache = {} + self.tries = 0 + self.maxtries = 10 def http_error_default(self, url, fp, errcode, errmsg, headers): *************** *** 520,524 **** def http_error_302(self, url, fp, errcode, errmsg, headers, data=None): """Error 302 -- relocated (temporarily).""" ! # XXX The server can force infinite recursion here! if headers.has_key('location'): newurl = headers['location'] --- 522,540 ---- def http_error_302(self, url, fp, errcode, errmsg, headers, data=None): """Error 302 -- relocated (temporarily).""" ! self.tries += 1 ! if self.maxtries and self.tries >= self.maxtries: ! if hasattr(self, "http_error_500"): ! meth = self.http_error_500 ! else: ! meth = self.http_error_default ! self.tries = 0 ! return meth(url, fp, 500, ! "Internal Server Error: Redirect Recursion", headers) ! result = self.redirect_internal(url, fp, errcode, errmsg, headers, ! data) ! self.tries = 0 ! return result ! ! def redirect_internal(self, url, fp, errcode, errmsg, headers, data): if headers.has_key('location'): newurl = headers['location'] *************** *** 556,559 **** --- 572,577 ---- else: return getattr(self,name)(url, realm, data) + return URLopener.http_error_default(self, url, fp, + errcode, errmsg, headers) def retry_http_basic_auth(self, url, realm, data=None): *************** *** 690,694 **** conn = self.ftp.ntransfercmd(cmd) except ftplib.error_perm, reason: ! if reason[:3] != '550': raise IOError, ('ftp error', reason), sys.exc_info()[2] if not conn: --- 708,712 ---- conn = self.ftp.ntransfercmd(cmd) except ftplib.error_perm, reason: ! if str(reason)[:3] != '550': raise IOError, ('ftp error', reason), sys.exc_info()[2] if not conn: *************** *** 1037,1041 **** c = res[i] if not _fast_safe.has_key(c): ! res[i] = '%%%02x' % ord(c) return string.join(res, '') --- 1055,1059 ---- c = res[i] if not _fast_safe.has_key(c): ! res[i] = '%%%02X' % ord(c) return string.join(res, '') *************** *** 1068,1072 **** c = res[i] if c not in safe: ! res[i] = '%%%02x' % ord(c) return string.join(res, '') --- 1086,1090 ---- c = res[i] if c not in safe: ! res[i] = '%%%02X' % ord(c) return string.join(res, '') From moshez@users.sourceforge.net Sat Mar 31 14:58:23 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 06:58:23 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.36,1.81.2.37 Message-ID: <E14jMpb-0007CC-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv26992/Misc Modified Files: Tag: release20-maint NEWS Log Message: - #227562 - urllib.py - call URLopener.http_error_default when an invalid 401 request is being handled. - urllib.py - provide simple recovery/escape from apparent redirect recursion - #129288 - urllib.py - chanign %02x to %02X in quoting - urllib.py - HTTPS now works with string URLs Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.36 retrieving revision 1.81.2.37 diff -C2 -r1.81.2.36 -r1.81.2.37 *** NEWS 2001/03/31 14:48:34 1.81.2.36 --- NEWS 2001/03/31 14:58:19 1.81.2.37 *************** *** 142,145 **** --- 142,154 ---- - #117606 - configure.in, configure - use gcc -shared and gcc -fPIC + - #227562 - urllib.py - call URLopener.http_error_default when + an invalid 401 request is being handled. + + - urllib.py - provide simple recovery/escape from apparent redirect recursion + + - #129288 - urllib.py - chanign %02x to %02X in quoting + + - urllib.py - HTTPS now works with string URLs + What's New in Python 2.0? ========================= From moshez@users.sourceforge.net Sat Mar 31 15:03:09 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 07:03:09 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.37,1.81.2.38 Message-ID: <E14jMuD-0007Lw-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv27705/Misc Modified Files: Tag: release20-maint NEWS Log Message: - distutils/command/install.py - make .get_outputs() produce a list of unique filenames Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.37 retrieving revision 1.81.2.38 diff -C2 -r1.81.2.37 -r1.81.2.38 *** NEWS 2001/03/31 14:58:19 1.81.2.37 --- NEWS 2001/03/31 15:03:07 1.81.2.38 *************** *** 147,153 **** - urllib.py - provide simple recovery/escape from apparent redirect recursion ! - #129288 - urllib.py - chanign %02x to %02X in quoting - urllib.py - HTTPS now works with string URLs What's New in Python 2.0? --- 147,156 ---- - urllib.py - provide simple recovery/escape from apparent redirect recursion ! - #129288 - urllib.py - changing %02x to %02X in quoting - urllib.py - HTTPS now works with string URLs + + - distutils/command/install.py - make .get_outputs() produce a list of unique + filenames What's New in Python 2.0? From moshez@users.sourceforge.net Sat Mar 31 15:03:09 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 07:03:09 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/distutils/command install.py,1.54,1.54.2.1 Message-ID: <E14jMuD-0007Ls-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory usw-pr-cvs1:/tmp/cvs-serv27705/Lib/distutils/command Modified Files: Tag: release20-maint install.py Log Message: - distutils/command/install.py - make .get_outputs() produce a list of unique filenames Index: install.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/install.py,v retrieving revision 1.54 retrieving revision 1.54.2.1 diff -C2 -r1.54 -r1.54.2.1 *** install.py 2000/10/14 04:06:40 1.54 --- install.py 2001/03/31 15:03:06 1.54.2.1 *************** *** 530,534 **** for cmd_name in self.get_sub_commands(): cmd = self.get_finalized_command(cmd_name) ! outputs.extend(cmd.get_outputs()) return outputs --- 530,538 ---- for cmd_name in self.get_sub_commands(): cmd = self.get_finalized_command(cmd_name) ! # Add the contents of cmd.get_outputs(), ensuring ! # that outputs doesn't contain duplicate entries ! for filename in cmd.get_outputs(): ! if filename not in outputs: ! outputs.append(filename) return outputs From moshez@users.sourceforge.net Sat Mar 31 15:44:18 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 07:44:18 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.38,1.81.2.39 Message-ID: <E14jNY2-0000Pl-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv321/Misc Modified Files: Tag: release20-maint NEWS Log Message: Backported pyexpat memory-leak plugs backported by Martin van Lowis Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.38 retrieving revision 1.81.2.39 diff -C2 -r1.81.2.38 -r1.81.2.39 *** NEWS 2001/03/31 15:03:07 1.81.2.38 --- NEWS 2001/03/31 15:44:15 1.81.2.39 *************** *** 154,157 **** --- 154,159 ---- filenames + - pyexpat.c - removed memory leaks + What's New in Python 2.0? ========================= From moshez@users.sourceforge.net Sat Mar 31 15:44:18 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 07:44:18 -0800 Subject: [Python-checkins] CVS: python/dist/src/Modules pyexpat.c,2.27,2.27.2.1 Message-ID: <E14jNY2-0000Pq-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv321/Modules Modified Files: Tag: release20-maint pyexpat.c Log Message: Backported pyexpat memory-leak plugs backported by Martin van Lowis Index: pyexpat.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/pyexpat.c,v retrieving revision 2.27 retrieving revision 2.27.2.1 diff -C2 -r2.27 -r2.27.2.1 *** pyexpat.c 2000/09/29 19:23:29 2.27 --- pyexpat.c 2001/03/31 15:44:16 2.27.2.1 *************** *** 6,9 **** --- 6,16 ---- #endif + #ifndef PyGC_HEAD_SIZE + #define PyGC_HEAD_SIZE 0 + #define PyObject_GC_Init(x) + #define PyObject_GC_Fini(m) + #define Py_TPFLAGS_GC 0 + #endif + enum HandlerTypes { StartElement, *************** *** 76,79 **** --- 83,87 ---- if (PyDict_SetItemString(attrs_obj, (char*)*attrs_k, rv) < 0) { + Py_DECREF(rv); Py_DECREF(attrs_obj); attrs_obj = NULL; *************** *** 199,208 **** /* Callback routines */ ! static void clear_handlers(xmlparseobject *self); static void flag_error(xmlparseobject *self) { ! clear_handlers(self); } --- 207,216 ---- /* Callback routines */ ! static void clear_handlers(xmlparseobject *self, int decref); static void flag_error(xmlparseobject *self) { ! clear_handlers(self, 1); } *************** *** 501,504 **** --- 509,519 ---- break; } + if (rv == 0) { + PyErr_Format(ErrorObject, "%.200s: line %i, column %i", + XML_ErrorString(XML_GetErrorCode(self->itself)), + XML_GetErrorLineNumber(self->itself), + XML_GetErrorColumnNumber(self->itself)); + return NULL; + } return Py_BuildValue("i", rv); } *************** *** 569,576 **** new_parser->itself = XML_ExternalEntityParserCreate(self->itself, context, ! encoding); ! if (!new_parser) { ! Py_DECREF(new_parser); ! return PyErr_NoMemory(); } --- 584,594 ---- new_parser->itself = XML_ExternalEntityParserCreate(self->itself, context, ! encoding); ! new_parser->handlers = 0; ! PyObject_GC_Init(new_parser); ! ! if (!new_parser->itself) { ! Py_DECREF(new_parser); ! return PyErr_NoMemory(); } *************** *** 582,586 **** new_parser->handlers = malloc(sizeof(PyObject *)*i); ! clear_handlers(new_parser); /* then copy handlers from self */ --- 600,608 ---- new_parser->handlers = malloc(sizeof(PyObject *)*i); ! if (!new_parser->handlers) { ! Py_DECREF(new_parser); ! return PyErr_NoMemory(); ! } ! clear_handlers(new_parser, 0); /* then copy handlers from self */ *************** *** 616,620 **** ! static xmlparseobject * newxmlparseobject(char *encoding, char *namespace_separator) { --- 638,642 ---- ! static PyObject * newxmlparseobject(char *encoding, char *namespace_separator) { *************** *** 636,639 **** --- 658,662 ---- self->returns_unicode = 1; #endif + self->handlers = NULL; if (namespace_separator) { self->itself = XML_ParserCreateNS(encoding, *namespace_separator); *************** *** 642,645 **** --- 665,669 ---- self->itself = XML_ParserCreate(encoding); } + PyObject_GC_Init(self); if (self->itself == NULL) { PyErr_SetString(PyExc_RuntimeError, *************** *** 654,660 **** self->handlers = malloc(sizeof(PyObject *)*i); ! clear_handlers(self); ! return self; } --- 678,688 ---- self->handlers = malloc(sizeof(PyObject *)*i); ! if (!self->handlers){ ! Py_DECREF(self); ! return PyErr_NoMemory(); ! } ! clear_handlers(self, 0); ! return (PyObject*)self; } *************** *** 664,673 **** { int i; if (self->itself) XML_ParserFree(self->itself); self->itself = NULL; ! for (i=0; handler_info[i].name != NULL; i++) { ! Py_XDECREF(self->handlers[i]); } #if PY_MAJOR_VERSION == 1 && PY_MINOR_VERSION < 6 --- 692,705 ---- { int i; + PyObject_GC_Fini(self); if (self->itself) XML_ParserFree(self->itself); self->itself = NULL; ! if(self->handlers){ ! for (i=0; handler_info[i].name != NULL; i++) { ! Py_XDECREF(self->handlers[i]); ! } ! free (self->handlers); } #if PY_MAJOR_VERSION == 1 && PY_MINOR_VERSION < 6 *************** *** 781,784 **** --- 813,839 ---- } + #ifdef WITH_CYCLE_GC + static int + xmlparse_traverse(xmlparseobject *op, visitproc visit, void *arg) + { + int i, err; + for (i = 0; handler_info[i].name != NULL; i++) { + if (!op->handlers[i]) + continue; + err = visit(op->handlers[i], arg); + if (err) + return err; + } + return 0; + } + + static int + xmlparse_clear(xmlparseobject *op) + { + clear_handlers(op, 1); + return 0; + } + #endif + static char Xmlparsetype__doc__[] = "XML parser"; *************** *** 788,792 **** 0, /*ob_size*/ "xmlparser", /*tp_name*/ ! sizeof(xmlparseobject), /*tp_basicsize*/ 0, /*tp_itemsize*/ /* methods */ --- 843,847 ---- 0, /*ob_size*/ "xmlparser", /*tp_name*/ ! sizeof(xmlparseobject) + PyGC_HEAD_SIZE,/*tp_basicsize*/ 0, /*tp_itemsize*/ /* methods */ *************** *** 803,810 **** (ternaryfunc)0, /*tp_call*/ (reprfunc)0, /*tp_str*/ ! ! /* Space for future expansion */ ! 0L,0L,0L,0L, ! Xmlparsetype__doc__ /* Documentation string */ }; --- 858,872 ---- (ternaryfunc)0, /*tp_call*/ (reprfunc)0, /*tp_str*/ ! 0, /* tp_getattro */ ! 0, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC, /*tp_flags*/ ! Xmlparsetype__doc__, /* Documentation string */ ! #ifdef WITH_CYCLE_GC ! (traverseproc)xmlparse_traverse, /* tp_traverse */ ! (inquiry)xmlparse_clear /* tp_clear */ ! #else ! 0, 0 ! #endif }; *************** *** 969,980 **** static void ! clear_handlers(xmlparseobject *self) { ! int i = 0; ! for (; handler_info[i].name!=NULL; i++) { ! self->handlers[i]=NULL; ! handler_info[i].setter(self->itself, NULL); ! } } --- 1031,1045 ---- static void ! clear_handlers(xmlparseobject *self, int decref) { ! int i = 0; ! for (; handler_info[i].name!=NULL; i++) { ! if (decref){ ! Py_XDECREF(self->handlers[i]); ! } ! self->handlers[i]=NULL; ! handler_info[i].setter(self->itself, NULL); ! } } From moshez@users.sourceforge.net Sat Mar 31 16:09:34 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 08:09:34 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/distutils/command build_ext.py,1.68,1.68.2.1 Message-ID: <E14jNwU-0001Ng-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory usw-pr-cvs1:/tmp/cvs-serv4312/Lib/distutils/command Modified Files: Tag: release20-maint build_ext.py Log Message: - #233253 - distutils/command/build_ext.py - the --define and --undef options didn't work, whether specified on the command-line or in setup.cfg. - distutils/command/build_ext.py - make docstrings raw - #128930 - distutils/command/build_ext.py - split rpath argument Suggested by AMK, but had to be massaged a bit from the cvs diff Index: build_ext.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/build_ext.py,v retrieving revision 1.68 retrieving revision 1.68.2.1 diff -C2 -r1.68 -r1.68.2.1 *** build_ext.py 2000/09/30 18:27:54 1.68 --- build_ext.py 2001/03/31 16:09:32 1.68.2.1 *************** *** 152,155 **** --- 152,157 ---- if self.rpath is None: self.rpath = [] + elif type(self.rpath) is StringType: + self.rpath = string.split(self.rpath, os.pathsep) # for extensions under windows use different directories *************** *** 162,165 **** --- 164,183 ---- else: self.build_temp = os.path.join(self.build_temp, "Release") + + # The argument parsing will result in self.define being a string, but + # it has to be a list of 2-tuples. All the preprocessor symbols + # specified by the 'define' option will be set to '1'. Multiple + # symbols can be separated with commas. + + if self.define: + defines = string.split(self.define, ',') + self.define = map(lambda symbol: (symbol, '1'), defines) + + # The option for macros to undefine is also a string from the + # option parsing, but has to be a list. Multiple symbols can also + # be separated with commas here. + if self.undef: + self.undef = string.split(self.undef, ',') + # finalize_options () *************** *** 529,533 **** def get_ext_filename (self, ext_name): ! """Convert the name of an extension (eg. "foo.bar") into the name of the file from which it will be loaded (eg. "foo/bar.so", or "foo\bar.pyd"). --- 547,551 ---- def get_ext_filename (self, ext_name): ! r"""Convert the name of an extension (eg. "foo.bar") into the name of the file from which it will be loaded (eg. "foo/bar.so", or "foo\bar.pyd"). From moshez@users.sourceforge.net Sat Mar 31 16:09:34 2001 From: moshez@users.sourceforge.net (Moshe Zadka) Date: Sat, 31 Mar 2001 08:09:34 -0800 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.81.2.39,1.81.2.40 Message-ID: <E14jNwU-0001Nb-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv4312/Misc Modified Files: Tag: release20-maint NEWS Log Message: - #233253 - distutils/command/build_ext.py - the --define and --undef options didn't work, whether specified on the command-line or in setup.cfg. - distutils/command/build_ext.py - make docstrings raw - #128930 - distutils/command/build_ext.py - split rpath argument Suggested by AMK, but had to be massaged a bit from the cvs diff Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.81.2.39 retrieving revision 1.81.2.40 diff -C2 -r1.81.2.39 -r1.81.2.40 *** NEWS 2001/03/31 15:44:15 1.81.2.39 --- NEWS 2001/03/31 16:09:32 1.81.2.40 *************** *** 156,159 **** --- 156,166 ---- - pyexpat.c - removed memory leaks + - #233253 - distutils/command/build_ext.py - the --define and --undef options + didn't work, whether specified on the command-line or in setup.cfg. + + - distutils/command/build_ext.py - make docstrings raw + + - #128930 - distutils/command/build_ext.py - split rpath argument + What's New in Python 2.0? ========================= From loewis@users.sourceforge.net Sat Mar 31 16:30:43 2001 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Sat, 31 Mar 2001 08:30:43 -0800 Subject: [Python-checkins] CVS: python/dist/src/Lib/xml/dom minidom.py,1.28,1.29 Message-ID: <E14jOGx-0002CX-00@usw-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib/xml/dom In directory usw-pr-cvs1:/tmp/cvs-serv8346 Modified Files: minidom.py Log Message: Initialize Attr.value with empty string in createAttribute*, as per DOM spec. Closes bug #412036. Also reindent toprettyxml. Index: minidom.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xml/dom/minidom.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -r1.28 -r1.29 *** minidom.py 2001/03/13 10:50:13 1.28 --- minidom.py 2001/03/31 16:30:40 1.29 *************** *** 88,96 **** def toprettyxml(self, indent="\t", newl="\n"): ! # indent = the indentation string to prepend, per level ! # newl = the newline string to append ! writer = _get_StringIO() ! self.writexml(writer, "", indent, newl) ! return writer.getvalue() def hasChildNodes(self): --- 88,96 ---- def toprettyxml(self, indent="\t", newl="\n"): ! # indent = the indentation string to prepend, per level ! # newl = the newline string to append ! writer = _get_StringIO() ! self.writexml(writer, "", indent, newl) ! return writer.getvalue() def hasChildNodes(self): *************** *** 795,798 **** --- 795,799 ---- a = Attr(qName) a.ownerDocument = self + a.value = "" return a *************** *** 807,810 **** --- 808,812 ---- a = Attr(qualifiedName, namespaceURI, localName, prefix) a.ownerDocument = self + a.value = "" return a