--- python2.2-2.2.3dfsg.orig/debian/PVER-elisp.prerm.in
+++ python2.2-2.2.3dfsg/debian/PVER-elisp.prerm.in
@@ -0,0 +1,26 @@
+#! /bin/sh -e
+#
+# prerm script for Debian @PVER@-elisp package.
+# Written 1998 by Gregor Hoffleit <flight@debian.org>.
+#
+
+PACKAGE=`basename $0 .prerm`
+
+case "$1" in
+    remove|upgrade|deconfigure)
+        /usr/lib/emacsen-common/emacs-package-remove $PACKAGE
+    ;;
+    failed-upgrade)
+        :
+    ;;
+    *)
+        echo "prerm called with unknow argument \`$1'" >&2
+	exit 1
+    ;;
+esac
+
+
+#DEBHELPER#
+
+
+exit 0
--- python2.2-2.2.3dfsg.orig/debian/README.Debian
+++ python2.2-2.2.3dfsg/debian/README.Debian
@@ -0,0 +1,8 @@
+The documentation for this package is in /usr/share/doc/python2.2/.
+
+A draft of the "Debian Python Policy" can be found in
+
+        /usr/share/doc/python
+
+Sometime it will be moved to /usr/share/doc/debian-policy in the
+debian-policy package.
--- python2.2-2.2.3dfsg.orig/debian/README.dbm
+++ python2.2-2.2.3dfsg/debian/README.dbm
@@ -0,0 +1,72 @@
+
+ Python and dbm modules on Debian
+ --------------------------------
+
+This file documents the configuration of the dbm modules for Debian. It
+gives hints at the preferred use of the dbm modules.
+
+
+The preferred way to access dbm databases in Python is the anydbm module.
+dbm databases behave like mappings (dictionaries).
+
+Since there exist several dbm database formats, we choose the following
+layout for Python on Debian:
+
+  * creating a new database with anydbm will create a Berkeley DB 2.X Hash
+    database file. This is the standard format used by libdb starting
+    with glibc 2.1.
+
+  * opening an existing database with anydbm will try to guess the format
+    of the file (using whichdb) and then load it using one of the bsddb,
+    bsddb1, gdbm or dbm (only if the python-gdbm package is installed)
+    or dumbdbm modules.
+
+  * The modules use the following database formats:
+
+    - bsddb:   Berkeley DB 2.X Hash (as in libc6 >=2.1 or libdb2)
+    - bsddb1:  Berkeley DB 1.85 Hash (as in libc6 >=2.1 or libdb2)
+    - gdbm:    GNU dbm 1.x or ndbm
+    - dbm:     " (nearly the same as the gdbm module for us)
+    - dumbdbm: a hand-crafted format only used in this module
+
+    That means that all usual formats should be readable with anydbm.
+
+  * If you want to create a database in a format different from DB 2.X,
+    you can still directly use the specified module.
+
+  * I.e. bsddb is the preferred module, and DB 2.X is the preferred format.
+
+  * Note that the db1hash and bsddb1 modules are Debian specific. anydbm
+    and whichdb have been modified to support DB 2.X Hash files (see
+    below for details).
+    
+
+
+For experts only:
+----------------
+
+Although bsddb employs the new DB 2.X format and uses the new Sleepycat
+DB 2 library as included with glibc >= 2.1, it's still using the old
+DB 1.85 API (which is still supported by DB 2).
+
+A more recent version 1.1 of the BSD DB module (available from
+http://starship.skyport.net/robind/python/) directly uses the DB 2.X API.
+It has a richer set of features.
+
+
+On a glibc 2.1 system, bsddb is linked with -ldb, bsddb1 is linked with
+-ldb1 and gdbm as well as dbm are linked with -lgdbm.
+
+On a glibc 2.0 system (e.g. potato for m68k or slink), bsddb will be
+linked with -ldb2 while bsddb1 will be linked with -ldb (therefore
+python-base here depends on libdb2).
+
+
+db1hash and bsddb1 nearly completely identical to dbhash and bsddb. The
+only difference is that bsddb is linked with the real DB 2 library, while
+bsddb1 is linked with an library which provides compatibility with legacy
+DB 1.85 databases.
+
+
+    July 16, 1999
+    Gregor Hoffleit <flight@debian.org>
--- python2.2-2.2.3dfsg.orig/debian/idle-PVER.menu.in
+++ python2.2-2.2.3dfsg/debian/idle-PVER.menu.in
@@ -0,0 +1,6 @@
+?package(idle-@PVER@):needs="X11" section="Apps/Programming"\
+	title="IDLE (Python v@VER@)"\
+	icon="/usr/share/pixmaps/@PVER@-32.xpm"\
+	icon16x16="/usr/share/pixmaps/@PVER@-16.xpm"\
+	icon32x32="/usr/share/pixmaps/@PVER@-32.xpm"\
+	command="/usr/bin/idle-@PVER@" hints="Environments"
--- python2.2-2.2.3dfsg.orig/debian/README.maintainers
+++ python2.2-2.2.3dfsg/debian/README.maintainers
@@ -0,0 +1,74 @@
+
+Hints for maintainers of Debian packages of Python extensions
+-------------------------------------------------------------
+
+Most of the content of this README can be found in the Debian Python policy.
+See /usr/share/doc/python/python-policy.txt.gz.
+
+Makefile.pre.in issues
+----------------------
+
+Python comes with a `universal Unix Makefile for Python extensions' in
+/usr/lib/python2.1/config/Makefile.pre.in (with Debian, this is included
+in the python-dev package), which is used by most Python extensions.
+
+In general, packages using the Makefile.pre.in approach can be packaged
+simply by running dh_make or by using one of debhelper's rules' templates
+(see /usr/doc/debhelper/examples/). Makefile.pre.in works fine with e.g.
+"make prefix=debian/tmp/usr install".
+
+One glitch: You may be running into the problem that Makefile.pre.in
+doesn't try to create all the directories when they don't exist. Therefore,
+you may have to create them manually before "make install". In most cases,
+the following should work:
+
+	...
+	dh_installdirs /usr/lib/python2.1
+	$(MAKE) prefix=debian/tmp/usr install
+	...
+
+
+Byte-compilation
+----------------
+
+For speed reasons, Python internally compiles source files into a byte-code.
+To speed up subsequent imports, it tries to save the byte-code along with
+the source with an extension .pyc (resp. pyo). This will fail if the
+libraries are installed in a non-writable directory, which may be the
+case for /usr/lib/python2.1/.
+
+Not that .pyc and .pyo files should not be relocated, since for debugging
+purposes the path of the source for is hard-coded into them.
+
+To precompile files in batches after installation, Python has a script
+compileall.py, which compiles all files in a given directory tree. The
+Debian version of compileall has been enhanced to support incremental
+compilation and to feature a ddir (destination dir) option. ddir is
+used to compile files in debian/usr/lib/python/ when they will be
+installed into /usr/lib/python/.
+
+
+Currently, there are two ways to use compileall for Debian packages. The
+first has a speed penalty, the second has a space penalty in the package.
+
+1.) Compiling and removing .pyc files in postinst/prerm:
+
+  In /usr/share/doc/python2.1, you'll find sample.postinst and sample.prerm.
+  If you set the directory where the .py files are installed, these
+  scripts will install and remove the .pyc and .pyo files for your
+  package after unpacking resp. before removing the package.
+
+2.) Compiling the .pyc files `out of place' during installation:
+
+  As of 1.5.1, compileall.py allows you to specify a faked installation
+  directory using the "-d destdir" option, so that you can precompile
+  the files in their temporary directory
+  (e.g. debian/tmp/usr/lib/python2.1/site-packages/PACKAGE).
+
+
+
+    11/02/98                             
+    Gregor Hoffleit <flight@debian.org>
+
+
+Last modified: 2001-12-14
--- python2.2-2.2.3dfsg.orig/debian/PVER-tk.postinst.in
+++ python2.2-2.2.3dfsg/debian/PVER-tk.postinst.in
@@ -0,0 +1,28 @@
+#! /bin/sh -e
+#
+# postinst script for the Debian @PVER@-tk package.
+# Written 1998 by Gregor Hoffleit <flight@debian.org>.
+#
+
+PACKAGE=`basename $0 .postinst`
+DIRLIST="/usr/lib/python@VER@/lib-tk"
+
+case "$1" in
+    configure|abort-upgrade|abort-remove|abort-deconfigure)
+        for i in $DIRLIST ; do
+            /usr/bin/python@VER@ -O /usr/lib/python@VER@/compileall.py -q $i
+            /usr/bin/python@VER@ /usr/lib/python@VER@/compileall.py -q $i
+        done
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+
+#DEBHELPER#
+
+
+exit 0
--- python2.2-2.2.3dfsg.orig/debian/PVER.postinst.in
+++ python2.2-2.2.3dfsg/debian/PVER.postinst.in
@@ -0,0 +1,58 @@
+#! /bin/sh -e
+#
+# postinst script for the Debian @PVER@-base package.
+# Written 1998 by Gregor Hoffleit <flight@debian.org>.
+#
+
+PACKAGE=`basename $0 .postinst`
+DIRLIST="/usr/lib/python@VER@"
+
+# remove unconditionally
+update-alternatives --remove python /usr/bin/python@VER@ || true
+
+case "$1" in
+    configure|abort-upgrade|abort-remove|abort-deconfigure)
+
+        for i in $DIRLIST ; do
+	    if [ "$DEBIAN_FRONTEND" != noninteractive ]; then
+		echo "Compiling python modules in $i ..."
+	    fi
+            /usr/bin/python@VER@ /usr/lib/python@VER@/compileall.py -q $i
+	    if [ "$DEBIAN_FRONTEND" != noninteractive ]; then
+		echo "Compiling optimized python modules in $i ..."
+	    fi
+            /usr/bin/python@VER@ -O /usr/lib/python@VER@/compileall.py -q $i
+        done
+
+        # Create empty directories in /usr/local
+        if [ ! -e /usr/local/lib/python@VER@ ]; then
+            mkdir -p /usr/local/lib/python@VER@ 2> /dev/null || true
+            chmod 2775 /usr/local/lib/python@VER@ 2> /dev/null || true
+            chown root:staff /usr/local/lib/python@VER@ 2> /dev/null || true
+        fi
+        if [ ! -e /usr/local/lib/python@VER@/site-packages ]; then
+            mkdir -p /usr/local/lib/python@VER@/site-packages 2> /dev/null || true
+            chmod 2775 /usr/local/lib/python@VER@/site-packages 2> /dev/null || true
+            chown root:staff /usr/local/lib/python@VER@/site-packages 2> /dev/null || true
+        fi
+
+	# Install a symlink for /usr/doc/@PVER@
+        ##if [ -d /usr/doc -a ! -e /usr/doc/@PVER@ -a -d /usr/share/doc/@PVER@ ]; then
+        ##    ln -sf ../share/doc/@PVER@ /usr/doc/@PVER@
+        ##fi
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+if [ "$1" = "configure" ]; then
+	ldconfig
+fi
+
+#DEBHELPER#
+
+
+exit 0
--- python2.2-2.2.3dfsg.orig/debian/control
+++ python2.2-2.2.3dfsg/debian/control
@@ -0,0 +1,99 @@
+Source: python2.2
+Section: python
+Priority: optional
+Maintainer: Matthias Klose <doko@debian.org>
+Uploaders: Gregor Hoffleit <flight@debian.org>
+Build-Depends: debhelper (>= 3), autoconf2.13, libreadline4-dev (>= 2.2-13.3), libncurses5-dev (>= 4.2-3.1), tk8.4-dev, libdb4.2-dev, zlib1g-dev (>= 1:1.1.3), libexpat1-dev, libgmp3-dev, libgdbm-dev, blt-dev (>= 2.4z), tix8.1-dev (>= 8.1.3.93), libssl-dev
+Build-Depends-Indep: libhtml-tree-perl, tetex-bin, tetex-extra, texinfo, emacs21, tar, gzip, bzip2, sharutils
+Build-Conflicts: tcl8.0-dev, tk8.0-dev, tcl8.2-dev, tk8.2-dev, tcl8.3-dev, tk8.3-dev
+Standards-Version: 3.6.1
+
+Package: python2.2
+Architecture: any
+Priority: optional
+Depends: ${shlibs:Depends}
+Recommends: python2.2-iconvcodec | python2.2-cjkcodecs | python2.2-japanese-codecs, python2.2-iconvcodec | python2.2-cjkcodecs | python2.2-korean-codecs
+Conflicts: python2.2-ssl, python2.2-email, python2.2-dev (<< 2.2.3-11)
+Replaces: python2.2-base, python2.2-ssl
+Suggests: python2.2-doc, python2.2-profiler
+Provides: python2.2-email
+Description: An interactive high-level object-oriented language (version 2.2)
+ Version 2.2 of the high-level, interactive object oriented language,
+ includes an extensive class library with lots of goodies for
+ network programming, system administration, sounds and graphics.
+
+Package: python2.2-tk
+Architecture: any
+Depends: python2.2 (= ${Source-Version}), ${shlibs:Depends}
+Suggests: tix8.1
+Description: Tkinter - Writing Tk applications with Python (v2.2)
+ A module for writing portable GUI applications with Python (v2.2) using Tk.
+ Also known as Tkinter.
+
+Package: python2.2-xmlbase
+Architecture: any
+Depends: python2.2 (= ${Source-Version}), ${shlibs:Depends}
+Description: XML support included in Python (v2.2)
+ Base XML support included in Python (v2.2), providing DOM and SAX modules
+ and a parser based on expat.
+
+Package: python2.2-gdbm
+Architecture: any
+Depends: python2.2 (= ${Source-Version}), ${shlibs:Depends}
+Description: GNU dbm database support for Python (v2.2)
+ GNU dbm database module for Python. Install this if you want to
+ create or read GNU dbm database files with Python.
+
+Package: python2.2-mpz
+Architecture: any
+Depends: python2.2 (= ${Source-Version}), ${shlibs:Depends}
+Description: Multiple-precision arithmetic support for Python (v2.2)
+ Arbitrary precision arithmetic for Python (v2.2) using the GNU MP
+ library, i.e. bignum support.
+
+Package: python2.2-examples
+Architecture: all
+Depends: python2.2 (>= ${Source-Version})
+Description: Examples for the Python language (v2.2)
+ Examples, Demos and Tools for Python (v2.2). These are files included in
+ the upstream Python distribution (v2.2).
+
+Package: python2.2-dev
+Architecture: any
+Depends: python2.2 (= ${Source-Version})
+Description: Header files and a static library for Python (v2.2)
+ Header files, a static library and development tools for building
+ Python (v2.2) modules, extending the Python interpreter or embedding
+ Python (v2.2) in applications.
+ .
+ Includes the python distutils, which were in a separate package up to
+ version 1.5.2.
+ .
+ Maintainers of Python packages should read README.maintainers.
+
+Package: idle-python2.2
+Architecture: all
+Depends: python2.2, python2.2-tk (>= ${Source-Version})
+Description: An IDE for Python (v2.2) using Tkinter
+ IDLE is an Integrated Development Environment for Python (v2.2).
+ IDLE is written using Tkinter and therefore quite platform-independent.
+
+Package: python2.2-doc
+Section: doc
+Architecture: all
+Suggests: python2.2
+Description: Documentation for the high-level object-oriented language Python
+ These is the official set of documentation for the interactive high-level
+ object-oriented language Python (v2.2). All documents are provided
+ in HTML format, some in info format. The package consists of ten documents:
+ .
+   * What's New in Python2.2
+   * Tutorial
+   * Python Library Reference
+   * Macintosh Module Reference
+   * Python Language Reference
+   * Extending and Embedding Python
+   * Python/C API Reference
+   * Installing Python Modules
+   * Documenting Python
+   * Distributing Python Modules
--- python2.2-2.2.3dfsg.orig/debian/idle-PVER.prerm.in
+++ python2.2-2.2.3dfsg/debian/idle-PVER.prerm.in
@@ -0,0 +1,14 @@
+#! /bin/sh -e
+#
+# sample prerm script for the Debian idle-@PVER@ package.
+# Written 1998 by Gregor Hoffleit <flight@debian.org>.
+#
+
+PACKAGE=`basename $0 .prerm`
+
+dpkg --listfiles $PACKAGE |
+	awk '$0~/\.py$/ {print $0"c\n" $0"o"}' |
+	xargs rm -f >&2
+
+
+#DEBHELPER#
--- python2.2-2.2.3dfsg.orig/debian/PVER.prerm.in
+++ python2.2-2.2.3dfsg/debian/PVER.prerm.in
@@ -0,0 +1,18 @@
+#! /bin/sh -e
+#
+# prerm script for the Debian @PVER@-base package.
+# Written 1998 by Gregor Hoffleit <flight@debian.org>.
+#
+
+PACKAGE=`basename $0 .prerm`
+
+dpkg --listfiles $PACKAGE |
+        awk '$0~/\.py$/ {print $0"c\n" $0"o"}' |
+        xargs rm -f >&2
+
+rmdir /usr/local/lib/python@VER@/site-packages 2>/dev/null && \
+        rmdir /usr/local/lib/python@VER@ 2>/dev/null || \
+        true
+
+
+#DEBHELPER#
--- python2.2-2.2.3dfsg.orig/debian/idle-PVER.postinst.in
+++ python2.2-2.2.3dfsg/debian/idle-PVER.postinst.in
@@ -0,0 +1,30 @@
+#! /bin/sh -e
+#
+# postinst script for the Debian idle-@PVER@ package.
+# Written 1998 by Gregor Hoffleit <flight@debian.org>.
+#
+
+PACKAGE=`basename $0 .postinst`
+DIRLIST="/usr/lib/idle-python@VER@"
+
+case "$1" in
+    configure|abort-upgrade|abort-remove|abort-deconfigure)
+
+        for i in $DIRLIST ; do
+            /usr/bin/python@VER@ -O /usr/lib/python@VER@/compileall.py -q $i
+            /usr/bin/python@VER@ /usr/lib/python@VER@/compileall.py -q $i
+        done
+
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+
+#DEBHELPER#
+
+
+exit 0
--- python2.2-2.2.3dfsg.orig/debian/PVER-tk.prerm.in
+++ python2.2-2.2.3dfsg/debian/PVER-tk.prerm.in
@@ -0,0 +1,14 @@
+#! /bin/sh -e
+#
+# prerm script for the Debian @PVER@-tk package.
+# Written 1998 by Gregor Hoffleit <flight@debian.org>.
+#
+
+PACKAGE=`basename $0 .prerm`
+
+dpkg --listfiles $PACKAGE |
+	awk '$0~/\.py$/ {print $0"c\n" $0"o"}' |
+	xargs rm -f >&2
+
+
+#DEBHELPER#
--- python2.2-2.2.3dfsg.orig/debian/dh_doclink
+++ python2.2-2.2.3dfsg/debian/dh_doclink
@@ -0,0 +1,28 @@
+#! /bin/sh
+
+pkg=`echo $1 | sed 's/^-p//'`
+target=$2
+
+ln -sf $target debian/$pkg/usr/share/doc/$pkg
+
+f=debian/$pkg.postinst.debhelper
+if [ ! -e $f ] || [ "`grep -c '^# dh_doclink' $f`" -eq 0 ]; then
+cat >> $f <<EOF
+# dh_doclink
+if [ "\$1" = "configure" ]; then
+  if [ -d /usr/doc -a ! -e /usr/doc/$pkg -a -d /usr/share/doc/$pkg ]; then
+    ln -sf ../share/doc/$pkg /usr/doc/$pkg
+  fi
+fi
+EOF
+fi
+
+f=debian/$pkg.prerm.debhelper
+if [ ! -e $f ] || [ "`grep -c '^# dh_doclink' $f`" -eq 0 ]; then
+cat >> $f <<EOF
+# dh_doclink
+if [ \( "\$1" = "upgrade" -o "\$1" = "remove" \) -a -L /usr/doc/$pkg ]; then
+  rm -f /usr/doc/$pkg
+fi
+EOF
+fi
--- python2.2-2.2.3dfsg.orig/debian/shlibs
+++ python2.2-2.2.3dfsg/debian/shlibs
@@ -0,0 +1 @@
+libpython2.2 0.0 python2.2 (>= 2.2.2)
--- python2.2-2.2.3dfsg.orig/debian/old_compileall.py
+++ python2.2-2.2.3dfsg/debian/old_compileall.py
@@ -0,0 +1,120 @@
+# Routines to force "compilation" of all .py files in a directory
+# tree or on sys.path.  By default recursion is pruned at a depth of
+# 10 and the current directory, if it occurs in sys.path, is skipped.
+# When called as a script, compiles argument directories, or sys.path
+# if no arguments.
+# After a similar module by Sjoerd Mullender.
+
+# Addition by Gregor Hoffleit <flight@debian.org>:
+# This version of compileall.py has been modified for Debian GNU/Linux
+# to support quiet operation and removal of compiled .pyc and .pyo
+# files (see the -q and -d options).
+# There's a bug in the modified version that won't compile optimized
+# (.pyo) files if there are .pyc versions. Therefore, if you want
+# .pyo files, you have to run "python -O compileall.py" *before*
+# "python compileall.py".
+
+import os
+import sys
+import py_compile
+
+def compile_dir(dir, maxlevels = 10, quiet = 0, delete = 0, destdir = None):
+	if (not delete):
+		if (not destdir):
+			print 'Byte-compiling files in', dir, '...'
+		else:
+			print 'Byte-compiling files in', dir, ' for installation in', destdir, '...'
+	else:
+		print 'Removing unused byte-compiled files in', dir, '...'
+	try:
+		names = os.listdir(dir)
+	except os.error:
+		print "Can't list", dir
+		names = []
+	names.sort()
+	for name in names:
+		fullname = os.path.join(dir, name)
+		if os.path.isfile(fullname):
+			if (name[-4:] == '.pyc') or (name[-4:] == '.pyo'):
+				head, tail = name[:-4], name[-4:]
+				try:
+					os.stat(os.path.join (dir, head + '.py'))
+				except:
+					if (not quiet): print fullname, 'removed, deleting %s' % tail
+					if (delete):
+						os.unlink (os.path.join (dir, head + tail))
+			if (name[-3:] == '.py'):
+				head, tail = name[:-3], name[-3:]
+				spy = os.stat(os.path.join (dir, head + '.py'))[8]
+				spyc = -1;
+				try:
+					spyc = os.stat(os.path.join (dir, head + '.pyc'))[8]
+				except:
+					pass
+				if (spy < spyc):
+					if (not quiet): print fullname, 'is current'
+				else:
+					if (not quiet): print 'Compiling', fullname, '...'
+					try:
+						if destdir == None:
+							py_compile.compile(fullname)
+						else:
+							py_compile.compile(fullname, dest = os.path.join(destdir, name))
+					except KeyboardInterrupt:
+						del names[:]
+						print '\n[interrupt]'
+						break
+					except:
+						if type(sys.exc_type) == type(''):
+							exc_type_name = sys.exc_type
+						else: exc_type_name = sys.exc_type.__name__
+						print 'Sorry:', exc_type_name + ':',
+						print sys.exc_value
+		elif maxlevels > 0 and \
+			name != os.curdir and name != os.pardir and \
+			os.path.isdir(fullname) and \
+			not os.path.islink(fullname):
+			if destdir == None:
+				compile_dir(fullname, maxlevels - 1, quiet, delete)
+			else:
+				compile_dir(fullname, maxlevels - 1, quiet, delete, destdir = os.path.join(destdir, name))
+
+def compile_path(skip_curdir = 1, quiet = 0, delete = 0):
+	for dir in sys.path:
+		if (not dir or dir == os.curdir) and skip_curdir:
+			print 'Skipping current directory'
+		else:
+			compile_dir(dir, 0, quiet, delete)
+
+def main():
+	import getopt
+	try:
+		opts, args = getopt.getopt(sys.argv[1:], 'lqdi:')
+	except getopt.error, msg:
+		print msg
+		print "usage: compileall [-l] [-q] [-d] [-i destdir] [directory ...]"
+		print "-l: don't recurse down"
+		print "-q: don't list files while compiling"
+		print "-d: delete .pyc and .pyo files with no .py files"
+		print "-i destdir: compile files for later installation in destdir"
+		print "if no arguments, -l sys.path is assumed"
+	maxlevels = 10
+	quiet = 0
+	delete = 0
+	destdir = None
+	for o, a in opts:
+		if o == '-l': maxlevels = 0
+		if o == '-q': quiet = 1
+		if o == '-d': delete = 1
+		if o == '-i': destdir = a
+	if args:
+		for dir in args:
+			if destdir == None:
+				compile_dir(dir, maxlevels, quiet, delete)
+			else:
+				compile_dir(dir, maxlevels, quiet, delete, destdir = destdir)
+	else:
+		compile_path(1, quiet)
+
+if __name__ == '__main__':
+	main()
--- python2.2-2.2.3dfsg.orig/debian/README.PVER-elisp.in
+++ python2.2-2.2.3dfsg/debian/README.PVER-elisp.in
@@ -0,0 +1,12 @@
+
+  The Emacs python-mode for Debian GNU/Linux
+  ------------------------------------------
+
+Barry Warsaw's python-mode for Emacs is included in the upstream Python
+distribution. In Debian, we provide this mode in this separate package,
+python-elisp.
+
+python-elisp automagically installs itself for use with all supported
+flavors of emacs, according to the Debian emacsen policy. The installation
+includes byte-compilation for the installed emacsen flavor and an
+entry for auto-load, as suggested in python-mode.el
--- python2.2-2.2.3dfsg.orig/debian/PVER-elisp.postinst.in
+++ python2.2-2.2.3dfsg/debian/PVER-elisp.postinst.in
@@ -0,0 +1,24 @@
+#! /bin/sh -e
+#
+# postinst script for Debian @PVER@-elisp package.
+# Written 1998 by Gregor Hoffleit <flight@debian.org>.
+#
+
+PACKAGE=`basename $0 .postinst`
+
+case "$1" in
+    configure|abort-upgrade|abort-remove|abort-deconfigure)
+        /usr/lib/emacsen-common/emacs-package-install $PACKAGE
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+
+#DEBHELPER#
+
+
+exit 0
--- python2.2-2.2.3dfsg.orig/debian/PVER-regrtest.postinst.in
+++ python2.2-2.2.3dfsg/debian/PVER-regrtest.postinst.in
@@ -0,0 +1,28 @@
+#! /bin/sh -e
+#
+# postinst script for the Debian @PVER@-regrtest package.
+# Written 1998 by Gregor Hoffleit <flight@debian.org>.
+#
+
+PACKAGE=`basename $0 .postinst`
+DIRLIST="/usr/lib/python@VER@/test"
+
+case "$1" in
+    configure|abort-upgrade|abort-remove|abort-deconfigure)
+        for i in $DIRLIST ; do
+            /usr/bin/python@VER@ -O /usr/lib/python@VER@/compileall.py -q $i
+            /usr/bin/python@VER@ /usr/lib/python@VER@/compileall.py -q $i
+        done
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+
+#DEBHELPER#
+
+
+exit 0
--- python2.2-2.2.3dfsg.orig/debian/PVER-regrtest.prerm.in
+++ python2.2-2.2.3dfsg/debian/PVER-regrtest.prerm.in
@@ -0,0 +1,14 @@
+#! /bin/sh -e
+#
+# prerm script for the Debian @PVER@-regrtest package.
+# Written 1998 by Gregor Hoffleit <flight@debian.org>.
+#
+
+PACKAGE=`basename $0 .prerm`
+
+dpkg --listfiles $PACKAGE |
+	awk '$0~/\.py$/ {print $0"c\n" $0"o"}' |
+	xargs rm -f >&2
+
+
+#DEBHELPER#
--- python2.2-2.2.3dfsg.orig/debian/sample.prerm
+++ python2.2-2.2.3dfsg/debian/sample.prerm
@@ -0,0 +1,13 @@
+#! /bin/sh -e
+#
+# sample prerm script for Debian python packages.
+# Written 1998 by Gregor Hoffleit <flight@debian.org>.
+#
+
+PACKAGE=`basename $0 .prerm`
+
+dpkg --listfiles $PACKAGE |
+	awk '$0~/\.py$/ {print $0"c\n" $0"o"}' |
+	xargs rm -f >&2
+
+#DEBHELPER#
--- python2.2-2.2.3dfsg.orig/debian/python.preinst
+++ python2.2-2.2.3dfsg/debian/python.preinst
@@ -0,0 +1,10 @@
+#! /bin/sh -e
+
+# remove the python alternatives before installing our own python link
+
+update-alternatives --auto /usr/bin/python >/dev/null 2>&1 || true
+update-alternatives --remove python /usr/bin/python1.5 || true
+update-alternatives --remove python /usr/bin/python2.1 || true
+update-alternatives --remove python /usr/bin/python2.2 || true
+
+#DEBHELPER#
--- python2.2-2.2.3dfsg.orig/debian/sample.postinst
+++ python2.2-2.2.3dfsg/debian/sample.postinst
@@ -0,0 +1,31 @@
+#! /bin/sh -e
+#
+# postinst script for Debian python packages.
+# Written 1998 by Gregor Hoffleit <flight@debian.org>.
+# Modified 2001 by Matthias Klose <doko@debian.org>
+
+PACKAGE=`basename $0 .postinst`
+PV=`dpkg --listfiles $PACKAGE | sed -n -e '/^\/usr\/lib\/python.*\//{
+  s,/usr/lib/python\([0-9][0-9.]*\)/.*,\1,p
+  q
+}'`
+PYTHON=python$PV
+DIRLIST="/usr/lib/python$PV/site-packages/extension"
+
+case "$1" in
+    configure|abort-upgrade|abort-remove|abort-deconfigure)
+        for i in $DIRLIST ; do
+            /usr/bin/$PYTHON -O /usr/lib/python$PV/compileall.py -q $i
+            /usr/bin/$PYTHON /usr/lib/python$PV/compileall.py -q $i
+        done
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+#DEBHELPER#
+
+exit 0
--- python2.2-2.2.3dfsg.orig/debian/PVER-elisp.remove.in
+++ python2.2-2.2.3dfsg/debian/PVER-elisp.remove.in
@@ -0,0 +1,42 @@
+#!/bin/sh
+#
+# emacsen-remove for @PVER@-elisp, Gregor Hoffleit <flight@debian.org>
+#
+# parts borrowed from gnus's emacsen-install,
+#  by Manoj Srivastava <srivasta@tiamat.datasync.com>
+#
+# This file is free software under the terms of the GNU
+# Public License, version 2 or higher.
+
+set -e
+
+FLAVOR=$1
+PACKAGE="@PVER@-elisp"
+
+if [ "X$FLAVOR" = "X" ]; then
+    echo need argument to determine FLAVOR of emacs
+    exit 1
+fi
+
+if [ "X$PACKAGE" = "X" ]; then
+    echo internal error: need package name
+    exit 1
+fi
+
+ELDIR=/usr/share/emacs/site-lisp/$PACKAGE
+ELCDIR=/usr/share/$FLAVOR/site-lisp/$PACKAGE
+
+case "$FLAVOR" in
+    emacs20 | emacs21 | xemacs19 | xemacs20 | xemacs21)
+	echo -n "remove/$PACKAGE: removing for $FLAVOR..."
+	if [ -d $ELCDIR ]; then
+	    rm -rf $ELCDIR
+	fi
+	echo "done."
+	;;
+    *)
+	echo "remove/$PACKAGE: ignoring emacsen flavor $FLAVOR."
+	;;
+esac
+
+exit 0
--- python2.2-2.2.3dfsg.orig/debian/50python-mode.el.in
+++ python2.2-2.2.3dfsg/debian/50python-mode.el.in
@@ -0,0 +1,10 @@
+;-*-emacs-lisp-*-
+
+(autoload 'python-mode
+    (concat "/usr/share/" (symbol-name debian-emacs-flavor)
+        "/site-lisp/@PVER@-elisp/python-mode.elc") "Python editing mode." t)
+(setq auto-mode-alist
+    (cons '("\\.py$" . python-mode) auto-mode-alist))
+(setq interpreter-mode-alist
+    (cons '("python" . python-mode) interpreter-mode-alist))
+
--- python2.2-2.2.3dfsg.orig/debian/PVER.menu.in
+++ python2.2-2.2.3dfsg/debian/PVER.menu.in
@@ -0,0 +1,6 @@
+?package(@PVER@):needs="text" section="Apps/Programming"\
+	title="Python (v@VER@)"\
+	icon="/usr/share/pixmaps/@PVER@-32.xpm"\
+	icon16x16="/usr/share/pixmaps/@PVER@-16.xpm"\
+	icon32x32="/usr/share/pixmaps/@PVER@-32.xpm"\
+	command="/usr/bin/python@VER@"
--- python2.2-2.2.3dfsg.orig/debian/PVER.postrm.in
+++ python2.2-2.2.3dfsg/debian/PVER.postrm.in
@@ -0,0 +1,27 @@
+#! /bin/sh -e
+
+
+# Remove the /usr/doc/@PVER@ symlink, but only if /usr/share/doc/@PVER@ is gone!
+if [ \( "$1" = "upgrade" -o "$1" = "remove" \) -a -L /usr/doc/@PVER@ -a ! -e /usr/share/doc/@PVER@ ]; then
+        rm -f /usr/doc/@PVER@
+fi
+
+if [ "$1" = "remove" ]; then
+    ldconfig
+
+    (find /usr/lib/@PVER@ -name '*.py[co]' | xargs rm -f {}) 2>/dev/null || true
+
+    for d in `find /usr/lib/@PVER@ -depth -type d -empty 2> /dev/null`; do \
+        while rmdir $d 2> /dev/null; do d=`dirname $d`; done; \
+    done
+fi
+
+if [ "$1" = "purge" ]; then
+    for d in `find /usr/lib/@PVER@ -depth -type d -empty 2> /dev/null`; do \
+        while rmdir $d 2> /dev/null; do d=`dirname $d`; done; \
+    done
+fi
+
+#DEBHELPER#
+
+exit 0
--- python2.2-2.2.3dfsg.orig/debian/README.PVER.in
+++ python2.2-2.2.3dfsg/debian/README.PVER.in
@@ -0,0 +1,93 @@
+
+  Python @VER@ for Debian
+  ---------------------
+
+This is Python @VER@ packaged for Debian.
+
+This document contains information specific to the Debian packages of
+Python @VER@.
+
+
+
+   [TODO: This document is not yet up-to-date with the packages.]
+
+Currently, it features those two main topics:
+
+  1. Release notes for the Debian packages:
+  2. Notes for developers using the Debian Python packages:
+
+Release notes and documentation from the upstream package are installed
+in /usr/share/doc/@PVER@/.
+
+There's a mailing list for discussion of issues related to Python on Debian
+systems: debian-python@lists.debian.org. The list is not intended for
+general Python problems, but as a forum for maintainers of Python-related
+packages and interested third parties.
+
+
+
+1. Release notes for the Debian packages:
+
+
+Results of the regression test:
+------------------------------
+
+The package does successfully run the regression tests for all included
+modules. Seven packages are skipped since they are platform-dependent and
+can't be used with Linux.
+
+
+2. Notes for developers using the Debian python packages:
+
+See the draft of the Debian Python policy in /usr/share/doc/python.
+
+distutils can be found in the @PVER@-dev package. Development files
+like the python library or Makefiles can be found in the @PVER@-dev
+package in /usr/lib/@PVER@/config.
+
+a) Locally installed Python add-ons
+
+    /usr/local/lib/@PVER@/site-packages/
+    /usr/local/lib/site-python/ (version-independent modules)
+
+b) Python add-ons packaged for Debian
+
+    /usr/lib/@PVER@/site-packages/
+    /usr/lib/site-python/ (version-independent modules)
+
+Note that no package must install files directly into /usr/lib/@PVER@/
+or /usr/local/lib/@PVER@/. Only the site-packages directory is allowed
+for third-party extensions.
+
+Use of the new `package' scheme is strongly encouraged. The `ni' interface
+is obsolete in python 1.5.
+
+Header files for extensions go into /usr/include/@PVER@/.
+
+
+Installing extensions for local use only:
+----------------------------------------
+
+Consider using distutils ...
+
+Most extensions use Python's Makefile.pre.in. Note that Makefile.pre.in
+by default will install files into /usr/lib/, not into /usr/local/lib/,
+which is not allowed for local extensions. You'll have to change the
+Makefile accordingly. Most times, "make prefix=/usr/local install" will
+work.
+
+
+Packaging python extensions for Debian:
+--------------------------------------
+
+Maintainers of Python extension packages should read
+
+	/usr/share/doc/python/python-policy.txt.gz
+
+ 
+
+
+    03/09/98
+    Gregor Hoffleit <flight@debian.org>
+
+Last change: 2001-12-14
--- python2.2-2.2.3dfsg.orig/debian/README.python
+++ python2.2-2.2.3dfsg/debian/README.python
@@ -0,0 +1,153 @@
+
+  Python 2.x for Debian
+  ---------------------
+
+This is Python 2.x packaged for Debian.
+
+This document contains information specific to the Debian packages of
+Python 2.x.
+
+
+
+   [TODO: This document is not yet up-to-date with the packages.]
+
+
+
+
+
+
+Currently, it features those two main topics:
+
+  1. Release notes for the Debian packages:
+  2. Notes for developers using the Debian Python packages:
+
+Release notes and documentation from the upstream package are installed
+in /usr/share/doc/python/.
+
+Up-to-date information regarding Python on Debian systems is also
+available as http://www.debian.org/~flight/python/.
+
+There's a mailing list for discussion of issues related to Python on Debian
+systems: debian-python@lists.debian.org. The list is not intended for
+general Python problems, but as a forum for maintainers of Python-related
+packages and interested third parties.
+
+
+
+1. Release notes for the Debian packages:
+
+
+Results of the regression test:
+------------------------------
+
+The package does successfully run the regression tests for all included
+modules. Seven packages are skipped since they are platform-dependent and
+can't be used with Linux.
+
+
+Noteworthy changes since the 1.4 packages:
+-----------------------------------------
+
+- Threading support enabled.
+- Tkinter for Tcl/Tk 8.x.
+- New package python-zlib.
+- The dbmmodule was dropped. Use bsddb instead. gdbmmodule is provided
+  for compatibility's sake.
+- python-elisp adheres to the new emacs add-on policy; it now depends
+  on emacsen. python-elisp probably won't work correctly with emacs19.
+  Refer to /usr/doc/python-elisp/ for more information.
+- Remember that 1.5 has dropped the `ni' interface in favor of a generic
+  `packages' concept.
+- Python 1.5 regression test as additional package python-regrtest. You
+  don't need to install this package unless you don't trust the
+  maintainer ;-).
+- once again, modified upstream's compileall.py and py_compile.py.
+  Now they support compilation of optimized byte-code (.pyo) for use
+  with "python -O", removal of .pyc and .pyo files where the .py source
+  files are missing (-d) and finally the fake of a installation directory
+  when .py files have to be compiled out of place for later installation
+  in a different directory (-i destdir, used in ./debian/rules).
+- The Debian packages for python 1.4 do call 
+  /usr/lib/python1.4/compileall.py in their postrm script. Therefore
+  I had to provide a link from /usr/lib/python1.5/compileall.py, otherwise
+  the old packages won't be removed completely. THIS IS A SILLY HACK!
+
+
+
+2. Notes for developers using the Debian python packages:
+
+
+Embedding python:
+----------------
+
+The files for embedding python resp. extending the python interpreter
+are included in the python-dev package. With the configuration in the
+Debian GNU/Linux packages of python 1.5, you will want to use something
+like
+
+    -I/usr/include/python1.5                  (e.g. for config.h)
+    -L/usr/lib/python1.5/config -lpython1.5   (... -lpthread)
+                           (also for Makefile.pre.in, Setup etc.)
+
+Makefile.pre.in automatically gets that right.  Note that unlike 1.4,
+python 1.5 has only one library, libpython1.5.a.
+
+Currently, there's no shared version of libpython. Future version of
+the Debian python packages will support this.
+
+
+Python extension packages:
+-------------------------
+
+According to www.python.org/doc/essays/packages.html, extension packages
+should only install into /usr/lib/python1.5/site-packages/ (resp.
+/usr/lib/site-python/ for packages that are definitely version independent).
+No extension package should install files directly into /usr/lib/python1.5/.
+
+But according to the FSSTND, only Debian packages are allowed to use
+/usr/lib/python1.5/. Therefore Debian Python additionally by default
+searches a second hierarchy in /usr/local/lib/. These directories take
+precedence over their equivalents in /usr/lib/.
+
+a) Locally installed Python add-ons
+
+    /usr/local/lib/python1.5/site-packages/
+    /usr/local/lib/site-python/ (version-independent modules)
+
+b) Python add-ons packaged for Debian
+
+    /usr/lib/python1.5/site-packages/
+    /usr/lib/site-python/ (version-independent modules)
+
+Note that no package must install files directly into /usr/lib/python1.5/
+or /usr/local/lib/python1.5/. Only the site-packages directory is allowed
+for third-party extensions.
+
+Use of the new `package' scheme is strongly encouraged. The `ni' interface
+is obsolete in python 1.5.
+
+Header files for extensions go into /usr/include/python1.5/.
+
+
+Installing extensions for local use only:
+----------------------------------------
+
+Most extensions use Python's Makefile.pre.in. Note that Makefile.pre.in
+by default will install files into /usr/lib/, not into /usr/local/lib/,
+which is not allowed for local extensions. You'll have to change the
+Makefile accordingly. Most times, "make prefix=/usr/local install" will
+work.
+
+
+Packaging python extensions for Debian:
+--------------------------------------
+
+Maintainers of Python extension packages should read README.maintainers.
+
+ 
+
+
+    03/09/98
+    Gregor Hoffleit <flight@debian.org>
+
+Last change: 07/16/1999
--- python2.2-2.2.3dfsg.orig/debian/README.idle-PVER.in
+++ python2.2-2.2.3dfsg/debian/README.idle-PVER.in
@@ -0,0 +1,14 @@
+
+  The Python IDLE package for Debian
+  ----------------------------------
+
+This package contains Python @VER@'s Integrated DeveLopment Environment, IDLE.
+
+IDLE is included in the Python @VER@ upstream distribution (Tools/idle) and
+depends on Tkinter (available as @PVER@-tk package).
+
+I have written a simple man page.
+
+
+    06/16/1999
+    Gregor Hoffleit <flight@debian.org>
--- python2.2-2.2.3dfsg.orig/debian/python.xpm
+++ python2.2-2.2.3dfsg/debian/python.xpm
@@ -0,0 +1,215 @@
+/* XPM */
+static char * python_xpm[] = {
+"32 23 189 2",
+"  	c None",
+". 	c #E9EEBC",
+"+ 	c #CCD49C",
+"@ 	c #AEBB7E",
+"# 	c #9CB260",
+"$ 	c #93AD43",
+"% 	c #7E9544",
+"& 	c #84993F",
+"* 	c #899B4E",
+"= 	c #92A452",
+"- 	c #97AD56",
+"; 	c #9FAC72",
+"> 	c #B6C182",
+", 	c #D2DAA4",
+"' 	c #869654",
+") 	c #A2BA61",
+"! 	c #82A332",
+"~ 	c #ADCB55",
+"{ 	c #C6DD72",
+"] 	c #8BB131",
+"^ 	c #AACD3B",
+"/ 	c #D6E692",
+"( 	c #D3E38D",
+"_ 	c #9ABD34",
+": 	c #83A625",
+"< 	c #A1BB5C",
+"[ 	c #B5BF83",
+"} 	c #ACBA77",
+"| 	c #D0DA9C",
+"1 	c #E6F0AF",
+"2 	c #CDD2A2",
+"3 	c #97A568",
+"4 	c #ACC35C",
+"5 	c #9BBC39",
+"6 	c #C1D879",
+"7 	c #A8C64A",
+"8 	c #A3C24C",
+"9 	c #BFD866",
+"0 	c #98BE29",
+"a 	c #A3C43B",
+"b 	c #CBDC8A",
+"c 	c #E1EDA4",
+"d 	c #B0D148",
+"e 	c #D2E584",
+"f 	c #DCE6A5",
+"g 	c #849B49",
+"h 	c #7B8C47",
+"i 	c #CDD898",
+"j 	c #C9CF9F",
+"k 	c #9DBA44",
+"l 	c #A2C733",
+"m 	c #B3D443",
+"n 	c #85AA29",
+"o 	c #83A12C",
+"p 	c #737332",
+"q 	c #7A6B21",
+"r 	c #6A6B23",
+"s 	c #8BA44B",
+"t 	c #759B26",
+"u 	c #C7D391",
+"v 	c #8FA942",
+"w 	c #85905C",
+"x 	c #CDD893",
+"y 	c #D6E39B",
+"z 	c #DFEBA1",
+"A 	c #6C7B3E",
+"B 	c #88AE26",
+"C 	c #ABD032",
+"D 	c #9AB34D",
+"E 	c #ACCA49",
+"F 	c #A1C342",
+"G 	c #97BC30",
+"H 	c #DCEA9C",
+"I 	c #7C943C",
+"J 	c #524A1A",
+"K 	c #83570C",
+"L 	c #967737",
+"M 	c #575420",
+"N 	c #7A9D29",
+"O 	c #BAD853",
+"P 	c #B3C76B",
+"Q 	c #9DB849",
+"R 	c #A8C164",
+"S 	c #AFC272",
+"T 	c #C4D289",
+"U 	c #8D9C5C",
+"V 	c #749525",
+"W 	c #84AA25",
+"X 	c #CADD83",
+"Y 	c #CEE47E",
+"Z 	c #89A53A",
+"` 	c #92B63A",
+" .	c #8DAA3E",
+"..	c #6D9125",
+"+.	c #45350A",
+"@.	c #6E4B10",
+"#.	c #C2AD66",
+"$.	c #BFAC67",
+"%.	c #563C0E",
+"&.	c #B8CD70",
+"*.	c #D9E895",
+"=.	c #B3D152",
+"-.	c #9CB356",
+";.	c #A2B75F",
+">.	c #B5C57A",
+",.	c #BBC190",
+"'.	c #6C8B2A",
+").	c #93B927",
+"!.	c #74932A",
+"~.	c #A0C629",
+"{.	c #B3CB64",
+"].	c #9FC041",
+"^.	c #799B25",
+"/.	c #311F04",
+"(.	c #B7D066",
+"_.	c #BBD36C",
+":.	c #BCD173",
+"<.	c #546121",
+"[.	c #3B461C",
+"}.	c #B9D55B",
+"|.	c #9FB45C",
+"1.	c #77A027",
+"2.	c #8AAD2A",
+"3.	c #91B42A",
+"4.	c #F3F8C5",
+"5.	c #627E24",
+"6.	c #484E0E",
+"7.	c #2E2B09",
+"8.	c #4B5419",
+"9.	c #79962D",
+"0.	c #E7F1B0",
+"a.	c #94B344",
+"b.	c #AECA5B",
+"c.	c #88A735",
+"d.	c #9DC429",
+"e.	c #66812B",
+"f.	c #8BB327",
+"g.	c #AED03E",
+"h.	c #DCE4AB",
+"i.	c #E5EFAD",
+"j.	c #97B452",
+"k.	c #D1DE95",
+"l.	c #9CA674",
+"m.	c #A3CA29",
+"n.	c #7BA326",
+"o.	c #66841D",
+"p.	c #A2CA25",
+"q.	c #E5EDB4",
+"r.	c #C0D968",
+"s.	c #E8F2B1",
+"t.	c #92B632",
+"u.	c #92A74E",
+"v.	c #7A9727",
+"w.	c #94BC28",
+"x.	c #74931E",
+"y.	c #6D8B24",
+"z.	c #C9DD7D",
+"A.	c #7D9734",
+"B.	c #96B24C",
+"C.	c #506518",
+"D.	c #648324",
+"E.	c #A3B364",
+"F.	c #627D2A",
+"G.	c #6A852C",
+"H.	c #5B7624",
+"I.	c #708D2C",
+"J.	c #637833",
+"K.	c #BACA7E",
+"L.	c #AAB47C",
+"M.	c #6A8326",
+"N.	c #8AA242",
+"O.	c #8B9C57",
+"P.	c #8DA254",
+"Q.	c #9CAC68",
+"R.	c #5E7232",
+"S.	c #6C7B42",
+"T.	c #738544",
+"U.	c #81A23B",
+"V.	c #8DB229",
+"W.	c #769929",
+"X.	c #758C3D",
+"Y.	c #BAC48A",
+"Z.	c #6C8534",
+"`.	c #5D7923",
+" +	c #739034",
+".+	c #6F912A",
+"++	c #AABA6F",
+"@+	c #C0D086",
+"#+	c #7D9A31",
+"                . + @ # $ % & * = - ; > ,                       ",
+"              @ ' ) ! ~ { ] ^ / ( _ : < [ } | 1                 ",
+"          2 3 4 5 6 7 8 9 0 a b c d 0 e f g h } i               ",
+"        j h k b l m n o / ( l ! p q r [ s t d u v w x y z       ",
+"      , A B C D E ( F G H y I J K L L M N E O P 5 ! Q # R S T   ",
+"      U V W ^ X ~ Y Z t `  ...+.@.#.$.%.&.H ( ! X *.=.Q -.;.) >.",
+"    ,.'.).!.~.a {.( % ].9 ^ ^.+./.%.@.r (.{ _.) :._.` <.[.$ }.>.",
+"    |.: 1.2.3.2.Y f ^ e 4._.t 5.6.7.8.9.].v E 0.| a.d Q s 8 b.S ",
+"  2 c.d.e.n n ).a s f.~ :.m g.9 5 - {.(.0.h.< X i.{.^ 8 -._.j.k.",
+"  l.9.m.o !.d.m.n.V d.n o.p.O H =.i.q.r.z s.b.t.F 2.9 b ^ k :.  ",
+"  u.v.d.2.'.w.~.e.e.f.x.y.d.m.w.^ z./  .A.B.V C.D.n  .` ] E.    ",
+"j 5 ^.F.G.H.I.d.: '.d.V n.m.D.[.y.J.G.e.H.f.V H.D.F.J.' K.      ",
+"L.M.x.5.w.3.e.n ^.t B '.t B y.D.W V G.V '.N.O.P.) Q.>           ",
+"U n p.M.2.w.n.N '...R.S.A T.U.T.A                               ",
+"g !.!.5.e.!.p.V.W.X.Y.                                          ",
+"Z.W.'.3.p.M.W.`.e.}                                             ",
+"T.).N  +V..+n.B T.                                              ",
+"Z.1.n.!.0 n.N V '                                               ",
+"% t d.B d.n ..'.U                                               ",
+"P.1.n..+t D.1.B '                                               ",
+"++W..+f.n...).1.g                                               ",
+"@+ +1.V.d.1.d.t #+                                              ",
+"> X.W.5.y.t `...D.w                                             "};
--- python2.2-2.2.3dfsg.orig/debian/dh_rmemptydirs
+++ python2.2-2.2.3dfsg/debian/dh_rmemptydirs
@@ -0,0 +1,10 @@
+#! /bin/sh -e
+
+pkg=`echo $1 | sed 's/^-p//'`
+
+: # remove empty directories, when all components are in place
+for d in `find debian/$pkg -depth -type d -empty 2> /dev/null`; do \
+    while rmdir $$d 2> /dev/null; do d=`dirname $$d`; done; \
+done
+
+exit 0
--- python2.2-2.2.3dfsg.orig/debian/PVER-elisp.install.in
+++ python2.2-2.2.3dfsg/debian/PVER-elisp.install.in
@@ -0,0 +1,64 @@
+#!/bin/sh
+#
+# emacsen-install for @PVER@-elisp, Gregor Hoffleit <flight@debian.org>
+#
+# parts borrowed from gnus's emacsen-install,
+#  by Manoj Srivastava <srivasta@tiamat.datasync.com>
+#
+# This file is free software under the terms of the GNU
+# Public License, version 2 or higher.
+
+set -e
+
+FLAVOR=$1
+PACKAGE="@PVER@-elisp"
+
+if [ "X$FLAVOR" = "X" ]; then
+    echo need argument to determine FLAVOR of emacs
+    exit 1
+fi
+
+if [ "X$PACKAGE" = "X" ]; then
+    echo internal error: need package name
+    exit 1
+fi
+
+ELDIR=/usr/share/emacs/site-lisp/$PACKAGE
+ELCDIR=/usr/share/$FLAVOR/site-lisp/$PACKAGE
+STARTFILE=/etc/$FLAVOR/site-start.d/50$PACKAGE.el
+
+BATCHFLAGS="-batch -q -no-site-file"
+COMPILE="-f batch-byte-compile [a-z]*.el"
+
+case "$FLAVOR" in
+    emacs20 | emacs21 | xemacs19 | xemacs20 | xemacs21)
+	echo -n "install/$PACKAGE: byte-compiling for $FLAVOR..."
+	if [ -d $ELCDIR ]; then
+	    rm -f $ELCDIR/*.elc $ELCDIR/install.log
+	    rmdir $ELCDIR
+	fi
+	if [ ! -d $ELCDIR ]; then
+	    install -m 755 -d $ELCDIR
+        fi
+
+	cd $ELDIR
+	LOG=`tempfile`
+	echo "running '$FLAVOR $BATCHFLAGS $PRELOADS $COMPILE' in $ELDIR" >>$LOG
+	$FLAVOR $BATCHFLAGS $PRELOADS $COMPILE >>$LOG 2>&1
+	echo install -m 644 *.elc $ELCDIR >> $LOG
+	install -m 644 *.elc $ELCDIR
+	mv -f $LOG $ELCDIR/install.log
+	rm -f *.elc
+
+	#if [ ! -f $STARTFILE ]; then
+	#    ln -s $ELDIR/_tdtd-init.el $STARTFILE
+	#fi
+
+	echo "done."
+	;;
+    *)
+	echo "install/$PACKAGE: ignoring emacsen flavor $FLAVOR."
+	;;
+esac
+
+exit 0
--- python2.2-2.2.3dfsg.orig/debian/idle-PVER.1.in
+++ python2.2-2.2.3dfsg/debian/idle-PVER.1.in
@@ -0,0 +1,38 @@
+.TH IDLE 1 "16 June 1999"
+.SH NAME
+\fBIDLE\fP \- An Integrated DeveLopment Environment for Python
+.SH SYNTAX
+.B idle
+.RI [ -d ]
+.RI [ filename(s) ]
+.SH DESCRIPTION
+This manual page documents briefly the
+.BR idle
+command.
+This manual page was written for Debian
+because the original program does not have a manual page.
+For more information, refer to IDLE's help menu.
+.PP
+.B IDLE
+is an Integrated DeveLopment Environment for Python. IDLE is based on
+Tkinter, Python's bindings to the Tk widget set. Features are 100% pure
+Python, multi-windows with multiple undo and Python colorizing, a Python
+shell window subclass, a debugger. IDLE is cross-platform, i.e. it works
+on all platforms where Tk is installed.
+.LP
+.SH OPTIONS
+.TP
+.B \-d
+.PD
+Debug mode
+.TP
+.B filename(s)
+.PD
+Specifies the file(s) to open when IDLE starts. IDLE will open up each
+file in a separate window.
+.PP
+In any case, Python will open up a Python shell window where one can
+interactively evaluate Python code.
+
+.SH AUTHORS
+Steffen Kern (sk@pn.org)
--- python2.2-2.2.3dfsg.orig/debian/patches/hurd.dpatch
+++ python2.2-2.2.3dfsg/debian/patches/hurd.dpatch
@@ -0,0 +1,71 @@
+#! /bin/sh -e
+
+# DP: Patch for building on the Hurd
+
+dir=
+if [ $# -eq 3 -a "$2" = '-d' ]; then
+    pdir="-d $3"
+    dir="$3/"
+elif [ $# -ne 1 ]; then
+    echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+    exit 1
+fi
+case "$1" in
+    -patch)
+        patch $pdir -l -f --no-backup-if-mismatch -p0 < $0
+        autoconf
+        ;;
+    -unpatch)
+        patch $pdir -l -f --no-backup-if-mismatch -R -p0 < $0
+        rm configure
+        ;;
+    *)
+	echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+        exit 1
+esac
+exit 0
+
+# append the patch here and adjust the -p? flag in the patch calls.
+--- Python/thread_cthread.old.h	Wed Oct 31 22:50:27 2001
++++ Python/thread_cthread.h	Sat Nov  3 09:23:29 2001
+@@ -1,6 +1,11 @@
+ 
++#ifdef MACH_C_THREADS
+ #include <mach/cthreads.h>
++#endif
+ 
++#ifdef HURD_C_THREADS
++#include <cthreads.h>
++#endif
+ 
+ /*
+  * Initialization.
+@@ -8,7 +13,14 @@
+ static void
+ PyThread__init_thread(void)
+ {
+-	cthread_init();
++#ifndef HURD_C_THREADS
++	/* Roland McGrath said this should not be used since this is
++	done while linking to threads */
++	cthread_init(); 
++#else
++/* do nothing */
++	;
++#endif
+ }
+ 
+ /*
+@@ -127,10 +139,10 @@
+ 
+ 	dprintf(("PyThread_acquire_lock(%p, %d) called\n", lock, waitflag));
+ 	if (waitflag) { 	/* blocking */
+-		mutex_lock(lock);
++		mutex_lock((mutex_t)lock);
+ 		success = TRUE;
+ 	} else {		/* non blocking */
+-		success = mutex_try_lock(lock);
++		success = mutex_try_lock((mutex_t)lock);
+ 	}
+ 	dprintf(("PyThread_acquire_lock(%p, %d) -> %d\n", lock, waitflag, success));
+ 	return success;
--- python2.2-2.2.3dfsg.orig/debian/patches/template.dpatch
+++ python2.2-2.2.3dfsg/debian/patches/template.dpatch
@@ -0,0 +1,32 @@
+#! /bin/sh -e
+
+# All lines beginning with `# DPATCH:' are a description of the patch.
+# DP: <your description>
+
+# remove the next line
+exit 0
+
+dir=
+if [ $# -eq 3 -a "$2" = '-d' ]; then
+    pdir="-d $3"
+    dir="$3/"
+elif [ $# -ne 1 ]; then
+    echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+    exit 1
+fi
+case "$1" in
+    -patch)
+        patch $pdir -f --no-backup-if-mismatch -p0 < $0
+        #cd ${dir}gcc && autoconf
+        ;;
+    -unpatch)
+        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
+        #rm ${dir}gcc/configure
+        ;;
+    *)
+	echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+        exit 1
+esac
+exit 0
+
+# append the patch here and adjust the -p? flag in the patch calls.
--- python2.2-2.2.3dfsg.orig/debian/patches/no-large-file-support.dpatch
+++ python2.2-2.2.3dfsg/debian/patches/no-large-file-support.dpatch
@@ -0,0 +1,41 @@
+#! /bin/sh -e
+
+# DP: disable large file support for GNU/Hurd
+
+dir=.
+if [ $# -eq 3 -a "$2" = '-d' ]; then
+    pdir="-d $3"
+    dir="$3/"
+elif [ $# -ne 1 ]; then
+    echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+    exit 1
+fi
+case "$1" in
+    -patch)
+        patch $pdir -f --no-backup-if-mismatch -p0 < $0
+        autoconf
+        ;;
+    -unpatch)
+        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
+        rm -f configure
+        ;;
+    *)
+	echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+        exit 1
+esac
+exit 0
+
+--- configure.in~	Mon Jan  7 21:15:02 2002
++++ configure.in	Mon Jan  7 21:53:33 2002
+@@ -541,11 +541,6 @@
+ AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long))
+ AC_MSG_RESULT($was_it_defined)
+ 
+-# Two defines needed to enable largefile support on various platforms
+-# These may affect some typedefs
+-AC_DEFINE(_LARGEFILE_SOURCE)
+-AC_DEFINE(_FILE_OFFSET_BITS, 64)
+-
+ # Add some code to confdefs.h so that the test for off_t works on SCO
+ cat >> confdefs.h <<\EOF
+ #if defined(SCO_DS)
--- python2.2-2.2.3dfsg.orig/debian/patches/deb-locations.dpatch
+++ python2.2-2.2.3dfsg/debian/patches/deb-locations.dpatch
@@ -0,0 +1,181 @@
+#! /bin/sh -e
+
+# DP: adjust locations of directories to debian policy
+
+dir=
+if [ $# -eq 3 -a "$2" = '-d' ]; then
+    pdir="-d $3"
+    dir="$3/"
+elif [ $# -ne 1 ]; then
+    echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+    exit 1
+fi
+case "$1" in
+    -patch)
+        patch $pdir -f --no-backup-if-mismatch -p1 < $0
+        #cd ${dir}gcc && autoconf
+        ;;
+    -unpatch)
+        patch $pdir -f --no-backup-if-mismatch -R -p1 < $0
+        #rm ${dir}gcc/configure
+        ;;
+    *)
+	echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+        exit 1
+esac
+exit 0
+
+--- python2.1-2.1.1.orig/Demo/scripts/ftpstats.py
++++ python2.1-2.1.1/Demo/scripts/ftpstats.py
+@@ -6,7 +6,8 @@
+ # ftpstats [-m maxitems] [-s search] [file]
+ # -m maxitems: restrict number of items in "top-N" lists, default 25.
+ # -s string:   restrict statistics to lines containing this string.
+-# Default file is /usr/adm/ftpd;  a "-" means read stdandard input.
++# Default file for Debian GNU/Linux is /var/log/xferlog;
++# a "-" means read stdandard input.
+ 
+ # The script must be run on the host where the ftp daemon runs.
+ # (At CWI this is currently buizerd.)
+@@ -34,7 +35,7 @@
+ 			maxitems = string.atoi(a)
+ 		if o == '-s':
+ 			search = a
+-	file = '/usr/adm/ftpd'
++	file = '/var/log/xferlog'
+ 	if args: file = args[0]
+ 	if file == '-':
+ 		f = sys.stdin
+--- python2.1-2.1.1.orig/Demo/tkinter/guido/ManPage.py
++++ python2.1-2.1.1/Demo/tkinter/guido/ManPage.py
+@@ -189,8 +189,9 @@
+ def test():
+ 	import os
+ 	import sys
+-	# XXX This directory may be different on your system
+-	MANDIR = '/usr/local/man/mann'
++	# XXX This directory may be different on your system,
++	#     it is here set for Debian GNU/Linux.
++	MANDIR = '/usr/share/man'
+ 	DEFAULTPAGE = 'Tcl'
+ 	formatted = 0
+ 	if sys.argv[1:] and sys.argv[1] == '-f':
+--- python2.1-2.1.1.orig/Demo/tkinter/guido/tkman.py
++++ python2.1-2.1.1/Demo/tkinter/guido/tkman.py
+@@ -9,8 +9,8 @@
+ from Tkinter import *
+ from ManPage import ManPage
+ 
+-MANNDIRLIST = ['/depot/sundry/man/mann','/usr/local/man/mann']
+-MAN3DIRLIST = ['/depot/sundry/man/man3','/usr/local/man/man3']
++MANNDIRLIST = ['/depot/sundry/man/mann','/usr/man/mann']
++MAN3DIRLIST = ['/depot/sundry/man/man3','/usr/man/man3']
+ 
+ foundmanndir = 0
+ for dir in MANNDIRLIST:
+--- python2.1-2.1.1.orig/Lib/mailbox.py
++++ python2.1-2.1.1/Lib/mailbox.py
+@@ -267,7 +267,7 @@
+     if mbox[:1] == '+':
+         mbox = os.environ['HOME'] + '/Mail/' + mbox[1:]
+     elif not '/' in mbox:
+-        mbox = '/usr/mail/' + mbox
++        mbox = '/var/mail/' + mbox
+     if os.path.isdir(mbox):
+         if os.path.isdir(os.path.join(mbox, 'cur')):
+             mb = Maildir(mbox)
+--- python2.1-2.1.1.orig/Lib/site.py
++++ python2.1-2.1.1/Lib/site.py
+@@ -18,6 +18,11 @@
+ resulting directories, if they exist, are appended to sys.path, and
+ also inspected for path configuration files.
+ 
++FOR DEBIAN, this sys.path is augmented with directories in /usr/local.
++Local addons go into /usr/local/lib/python<version>/site-packages
++(resp. /usr/local/lib/site-python), Debian addons install into
++/usr/lib/python<version>/site-packages.
++
+ A path configuration file is a file whose name has the form
+ <package>.pth; its contents are additional directories (one per line)
+ to be added to sys.path.  Non-existing directories (or
+@@ -130,9 +135,9 @@
+             sys.path.append(dir)
+             dirs_in_sys_path[dircase] = 1
+ 
+-prefixes = [sys.prefix]
++prefixes = [os.path.join(sys.prefix, "local"), sys.prefix]
+ if sys.exec_prefix != sys.prefix:
+-    prefixes.append(sys.exec_prefix)
++    prefixes.append(os.path.join(sys.exec_prefix, "local"))
+ for prefix in prefixes:
+     if prefix:
+         if os.sep == '/':
+--- python2.1-2.1.1.orig/Tools/faqwiz/faqconf.py
++++ python2.1-2.1.1/Tools/faqwiz/faqconf.py
+@@ -21,7 +21,7 @@
+ OWNEREMAIL = "nobody@anywhere.org"	# Email for feedback
+ HOMEURL = "http://www.python.org"	# Related home page
+ HOMENAME = "Python home"		# Name of related home page
+-RCSBINDIR = "/usr/local/bin/"		# Directory containing RCS commands
++RCSBINDIR = "/usr/bin/"			# Directory containing RCS commands
+ 					# (must end in a slash)
+ 
+ # Parameters you can normally leave alone
+--- python2.1-2.1.1.orig/Tools/webchecker/webchecker.py
++++ python2.1-2.1.1/Tools/webchecker/webchecker.py
+@@ -19,7 +19,8 @@
+ a directory listing is returned.  Now, you can point webchecker to the
+ document tree in the local file system of your HTTP daemon, and have
+ most of it checked.  In fact the default works this way if your local
+-web tree is located at /usr/local/etc/httpd/htdpcs (the default for
++web tree is located at /var/www, which is the default for Debian
++GNU/Linux. Other systems use /usr/local/etc/httpd/htdocs (the default for
+ the NCSA HTTP daemon and probably others).
+ 
+ Report printed:
+8rameters
+-DEFROOT = "file:/usr/local/etc/httpd/htdocs/"   # Default root URL
++DEFROOT = "file:/var/www/"   # Default root URL
+ CHECKEXT = 1                            # Check external references (1 deep)
+ VERBOSE = 1                             # Verbosity level (0-3)
+ MAXPAGE = 150000                        # Ignore files bigger than this
+--- python2.1-2.1.1.orig/Tools/idle/idle.py~	Mon Apr 10 18:27:47 2000
++++ python2.1-2.1.1/Tools/idle/idle.py	Sat Dec 29 19:54:41 2001
+@@ -1,4 +1,6 @@
+ #! /usr/bin/env python
+ 
++import sys
++sys.path[:0] = ['/usr/lib/idle-python2.2']
+ import PyShell
+ PyShell.main()
+ 
+--- python2.1-2.1.1.orig/Lib/pydoc.py.orig	2002-03-25 14:11:47.000000000 +0100
++++ python2.1-2.1.1/Lib/pydoc.py	2002-07-24 07:51:57.000000000 +0200
+@@ -1492,6 +1492,7 @@
+         for dir in [os.environ.get('PYTHONDOCS'),
+                     homedir and os.path.join(homedir, 'doc'),
+                     os.path.join(execdir, 'doc'),
++                    '/usr/share/doc/python' + sys.version[:3] + '-doc/html',
+                     '/usr/doc/python-docs-' + split(sys.version)[0],
+                     '/usr/doc/python-' + split(sys.version)[0],
+                     '/usr/doc/python-docs-' + sys.version[:3],
+@@ -1597,6 +1598,9 @@
+ Sorry, topic and keyword documentation is not available because the Python
+ HTML documentation files could not be found.  If you have installed them,
+ please set the environment variable PYTHONDOCS to indicate their location.
++
++On Debian GNU/{Linux,Hurd} systems you have to install the corresponding
++pythonX.Y-doc package, i.e. python2.2-doc.
+ ''')
+             return
+         target = self.topics.get(topic, self.keywords.get(topic))
+--- ./Lib/mimetypes.py~	2001-12-05 16:58:29.000000000 +0100
++++ ./Lib/mimetypes.py	2003-01-21 20:38:01.000000000 +0100
+@@ -29,6 +29,7 @@
+ __all__ = ["guess_type","guess_extension","read_mime_types","init"]
+ 
+ knownfiles = [
++    "/etc/mime.types",
+     "/usr/local/etc/httpd/conf/mime.types",
+     "/usr/local/lib/netscape/mime.types",
+     "/usr/local/etc/httpd/conf/mime.types",     # Apache 1.2
--- python2.2-2.2.3dfsg.orig/debian/patches/deb-build.dpatch
+++ python2.2-2.2.3dfsg/debian/patches/deb-build.dpatch
@@ -0,0 +1,323 @@
+#! /bin/sh -e
+
+# DP: Debian's changes to the build procedure (Makefiles and configure.in)
+
+dir=.
+if [ $# -eq 3 -a "$2" = '-d' ]; then
+    pdir="-d $3"
+    dir="$3/"
+elif [ $# -ne 1 ]; then
+    echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+    exit 1
+fi
+case "$1" in
+    -patch)
+        patch $pdir -f --no-backup-if-mismatch -p1 < $0
+        autoconf
+        ;;
+    -unpatch)
+        patch $pdir -f --no-backup-if-mismatch -R -p1 < $0
+        rm -f configure
+        ;;
+    *)
+	echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+        exit 1
+esac
+exit 0
+
+--- python2.2-2.2.91.orig/Makefile.pre.in	2002-08-23 18:05:49.000000000 +0200
++++ python2.2-2.2.91/Makefile.pre.in	2002-10-10 20:44:27.000000000 +0200
+@@ -25,6 +25,7 @@
+ 
+ # === Variables set by configure
+ VERSION=	@VERSION@
++SOVERSION=	@SOVERSION@
+ srcdir=		@srcdir@
+ VPATH=		@srcdir@
+ 
+@@ -65,7 +66,7 @@
+ # Extra C flags added for building the interpreter object files.
+ CFLAGSFORSHARED=@CFLAGSFORSHARED@
+ # C flags used for building the interpreter object files
+-PY_CFLAGS=	$(CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED)
++PY_CFLAGS=	$(CFLAGS) $(CPPFLAGS)
+ 
+ 
+ # Machine-dependent subdirectories
+@@ -97,6 +98,7 @@
+ LDSHARED=	@LDSHARED@
+ BLDSHARED=	@BLDSHARED@
+ DESTSHARED=	$(BINLIBDEST)/lib-dynload
++RUNSHARED=	LD_PRELOAD=./$(LDLIBRARY)
+ 
+ # Executable suffix (.exe on Windows and Mac OS X)
+ EXE=		@EXEEXT@
+@@ -288,23 +290,30 @@
+ # Rules
+ 
+ # Default target
+-all:		$(BUILDPYTHON) oldsharedmods sharedmods
++all:		$(BUILDPYTHON) $(LIBRARY) oldsharedmods sharedmods
+ 
+ # Build the interpreter
++ifeq ($(STATIC_PYTHON),yes)
++$(BUILDPYTHON):	Modules/$(MAINOBJ) $(LDLIBRARY) $(LIBRARY)
++		$(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
++			Modules/$(MAINOBJ) \
++			$(LIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
++else
+ $(BUILDPYTHON):	Modules/$(MAINOBJ) $(LDLIBRARY)
+ 		$(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
+ 			Modules/$(MAINOBJ) \
+ 			$(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
++endif
+ 
+ platform: $(BUILDPYTHON)
+-	./$(BUILDPYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
++	$(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
+ 
+ 
+ # Build the shared modules
+ sharedmods: $(BUILDPYTHON)
+ 	case $$MAKEFLAGS in \
+-	*-s*) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
+-	*) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
++	*-s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
++	*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
+ 	esac
+ 
+ # buildno should really depend on something like LIBRARY_SRC
+@@ -332,6 +341,26 @@
+ 	$(AR) cr $@ $(MODOBJS)
+ 	$(RANLIB) $@
+ 
++# Build static library with pic objects
++$(PICLIBRARY): $(LIBRARY_OBJS:%.o=%.pic_o)
++	-rm -f $@
++	$(AR) cr $@ $(LIBRARY_OBJS:%.o=%.pic_o)
++	$(RANLIB) $@
++
++# WARNING: The following is only tested for Debian GNU/Linux.
++# This rule is silly and needs to be cleaned up ASAP!
++#      Gregor Hoffleit <flight@debian.org>
++#
++# This rule is here for Linux shared libs
++# The PIC code will be built additionally to the static lib!
++libpython$(VERSION).so.$(SOVERSION): $(LIBRARY_OBJS:%.o=%.pic_o)
++	case `uname -s | tr -d '/ ' | tr '[A-Z]' '[a-z]'` in \
++	*linux*|*gnu*) \
++	    $(CC) -shared -Wl,-soname,$@ -o $@ $(LIBRARY_OBJS:%.o=%.pic_o) \
++		$(LIBS) $(LIBM) \
++	    ;; \
++	esac
++
+ # This rule is only here for DG/UX and BeOS!!!
+ libpython$(VERSION).so:	$(LIBRARY)
+ 	case `uname -s | tr -d '/ ' | tr '[A-Z]' '[a-z]'` in \
+@@ -391,6 +420,9 @@
+ Modules/getbuildinfo.o: $(srcdir)/Modules/getbuildinfo.c buildno
+ 	$(CC) -c $(PY_CFLAGS) -DBUILD=`cat buildno` -o $@ $(srcdir)/Modules/getbuildinfo.c
+ 
++Modules/getbuildinfo.pic_o: $(srcdir)/Modules/getbuildinfo.c buildno
++	$(CC) -c $(PY_CFLAGS) $(CCSHARED) -DBUILD=`cat buildno` -o $@ $(srcdir)/Modules/getbuildinfo.c
++
+ Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
+ 	$(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
+ 		-DPREFIX='"$(prefix)"' \
+@@ -399,9 +431,20 @@
+ 		-DVPATH='"$(VPATH)"' \
+ 		-o $@ $(srcdir)/Modules/getpath.c
+ 
++Modules/getpath.pic_o: $(srcdir)/Modules/getpath.c Makefile
++	$(CC) -c $(PY_CFLAGS) $(CCSHARED) -DPYTHONPATH='"$(PYTHONPATH)"' \
++		-DPREFIX='"$(prefix)"' \
++		-DEXEC_PREFIX='"$(exec_prefix)"' \
++		-DVERSION='"$(VERSION)"' \
++		-DVPATH='"$(VPATH)"' \
++		-o $@ $(srcdir)/Modules/getpath.c
++
+ Modules/ccpython.o: $(srcdir)/Modules/ccpython.cc
+ 	$(CXX) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/ccpython.cc
+ 
++Modules/ccpython.pic_o: $(srcdir)/Modules/ccpython.cc
++	$(CXX) -c $(PY_CFLAGS) $(CCSHARED) -o $@ $(srcdir)/Modules/ccpython.cc
++
+ 
+ $(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
+ 		-$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
+@@ -420,9 +463,15 @@
+ Python/getplatform.o: $(srcdir)/Python/getplatform.c
+ 		$(CC) -c $(CFLAGS) $(CPPFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
+ 
++Python/getplatform.pic_o: $(srcdir)/Python/getplatform.c
++		$(CC) -c $(CFLAGS) $(CPPFLAGS) $(CCSHARED) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
++
+ Python/importdl.o: $(srcdir)/Python/importdl.c
+ 		$(CC) -c $(CFLAGS) $(CPPFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
+ 
++Python/importdl.pic_o: $(srcdir)/Python/importdl.c
++		$(CC) -c $(CFLAGS) $(CPPFLAGS) $(CCSHARED) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
++
+ Objects/object.o: $(srcdir)/Objects/object.c $(srcdir)/Objects/obmalloc.c
+ 
+ Objects/unicodectype.o:	$(srcdir)/Objects/unicodectype.c \
+@@ -486,7 +535,7 @@
+ # Test the interpreter (twice, once without .pyc files, once with)
+ TESTOPTS=	-l
+ TESTPROG=	$(srcdir)/Lib/test/regrtest.py
+-TESTPYTHON=	./$(BUILDPYTHON) -E -tt
++TESTPYTHON=	$(RUNSHARED) ./$(BUILDPYTHON) -E -tt
+ test:		all platform
+ 		-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
+ 		-$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
+@@ -556,6 +605,12 @@
+ 		fi; \
+ 	done
+ 	$(INSTALL_PROGRAM) $(BUILDPYTHON) $(BINDIR)/python$(VERSION)$(EXE)
++	if test -f libpython$(VERSION).so.$(SOVERSION); then \
++		mkdir $(LIBDIR); \
++		$(INSTALL_DATA) libpython$(VERSION).so.$(SOVERSION) $(LIBDIR); \
++		(cd $(LIBDIR) && $(LN) -sf libpython$(VERSION).so.$(SOVERSION) libpython$(VERSION).so); \
++	else	true; \
++	fi
+ 	if test -f libpython$(VERSION).so; then \
+ 		$(INSTALL_DATA) libpython$(VERSION).so $(LIBDIR); \
+ 	else	true; \
+@@ -640,11 +695,11 @@
+ 		done; \
+ 	done
+ 	$(INSTALL_DATA) $(srcdir)/LICENSE $(LIBDEST)/LICENSE.txt
+-	PYTHONPATH=$(LIBDEST) \
+-		./$(BUILDPYTHON) -tt $(LIBDEST)/compileall.py -x badsyntax \
+-	        $(LIBDEST)
+-	PYTHONPATH=$(LIBDEST) \
+-		./$(BUILDPYTHON) -O $(LIBDEST)/compileall.py -x badsyntax $(LIBDEST)
++##	PYTHONPATH=$(LIBDEST) \
++##		./$(BUILDPYTHON) -tt $(LIBDEST)/compileall.py -x badsyntax \
++##	        $(LIBDEST)
++##	PYTHONPATH=$(LIBDEST) \
++##		./$(BUILDPYTHON) -O $(LIBDEST)/compileall.py -x badsyntax $(LIBDEST)
+ 
+ # Create the PLATDIR source directory, if one wasn't distributed..
+ $(srcdir)/Lib/$(PLATDIR):
+@@ -686,12 +741,12 @@
+ 		else	true; \
+ 		fi; \
+ 	done
+-	@if test -d $(LDLIBRARY); then :; else \
++	@if test -d $(LIBRARY); then :; else \
+ 		if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
+-			$(INSTALL_DATA) $(LDLIBRARY) $(LIBPL)/$(LDLIBRARY) ; \
+-			$(RANLIB) $(LIBPL)/$(LDLIBRARY) ; \
++			$(INSTALL_DATA) $(LIBRARY) $(LIBPL)/$(LIBRARY) ; \
++			$(RANLIB) $(LIBPL)/$(LIBRARY) ; \
+ 		else \
+-			echo Skip install of $(LDLIBRARY) - use make frameworkinstall; \
++			echo Skip install of $(LIBRARY) - use make frameworkinstall; \
+ 		fi; \
+ 	fi
+ 	$(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c
+@@ -733,7 +788,8 @@
+ # Install the dynamically loadable modules
+ # This goes into $(exec_prefix)
+ sharedinstall:
+-	./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
++	$(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
++		--prefix=$(prefix) \
+ 		--install-scripts=$(BINDIR) \
+ 		--install-platlib=$(DESTSHARED)
+ 
+@@ -810,6 +866,11 @@
+ .c.o:
+ 	$(CC) -c $(PY_CFLAGS) -o $@ $<
+ 
++.SUFFIXES: .pic_o
++
++.c.pic_o:
++	$(CC) -c $(PY_CFLAGS) $(CCSHARED) -o $@ $<
++
+ # Rerun configure with the same options as it was run last time,
+ # provided the config.status script exists
+ recheck:
+--- python2.2-2.2.91.orig/configure.in	2002-10-07 13:57:04.000000000 +0200
++++ python2.2-2.2.91/configure.in	2002-10-10 20:40:20.000000000 +0200
+@@ -8,6 +8,10 @@
+ AC_SUBST(VERSION)
+ VERSION=2.2
+ 
++# Set SOVERSION
++AC_SUBST(SOVERSION)
++SOVERSION=0.0
++
+ # Arguments passed to configure.
+ AC_SUBST(CONFIG_ARGS)
+ CONFIG_ARGS="$ac_configure_args"
+@@ -273,6 +277,7 @@
+ # python might then depend on the C++ runtime
+ # This is altered for AIX in order to build the export list before 
+ # linking.
++# For Linux, we now build a shared library, too.
+ AC_SUBST(LINKCC)
+ AC_MSG_CHECKING(LINKCC)
+ if test -z "$LINKCC"
+@@ -298,6 +303,9 @@
+ 	   LINKCC="LD_RUN_PATH=$libdir $(LINKCC)";;
+ 	Monterey64*)
+ 	   LINKCC="$(LINKCC) -L/usr/lib/ia64l64";;
++	Linux*|GNU*)
++	   LDLIBRARY='libpython$(VERSION).so.$(SOVERSION)'
++	   if test -z "$CXX"; then LINKCC="\$(CC)"; else LINKCC="\$(CXX)"; fi;;
+ 	esac
+ fi
+ AC_MSG_RESULT($LINKCC)
+@@ -824,7 +832,7 @@
+ 			BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
+ 			LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/$(PYTHON)'
+ 		fi ;;
+-	Linux*) LDSHARED='$(CC) -shared';;
++	Linux*|GNU*) LDSHARED='$(CC) -shared';;
+ 	dgux*) LDSHARED="ld -G";;
+ 	BSD/OS*/4*) LDSHARED="gcc -shared";;
+ 	OpenBSD*|FreeBSD*)
+@@ -861,7 +869,7 @@
+ 		 then CCSHARED="-fPIC";
+ 		 else CCSHARED="+z";
+ 		 fi;;
+-	Linux*) CCSHARED="-fPIC";;
++	Linux*|GNU*) CCSHARED="-fPIC";;
+ 	BSD/OS*/4*) CCSHARED="-fpic";;
+ 	FreeBSD*|NetBSD*|OpenBSD*) CCSHARED="-fPIC";;
+ 	OpenUNIX*|UnixWare*)
+@@ -893,7 +901,7 @@
+ 	hp*|HP*)
+ 	    LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
+ 	BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
+-	Linux*) LINKFORSHARED="-Xlinker -export-dynamic";;
++	Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
+ 	# -u libsys_s pulls in all symbols in libsys
+ 	Darwin/*) 
+ 		# -u __dummy makes the linker aware of the objc runtime
+@@ -1066,8 +1074,14 @@
+     AC_MSG_RESULT($unistd_defines_pthreads)
+ 
+     AC_DEFINE(_REENTRANT)
++    AC_CHECK_HEADER(cthreads.h, [AC_DEFINE(WITH_THREAD)
++    AC_DEFINE(C_THREADS)
++    AC_DEFINE(HURD_C_THREADS)
++    LIBS="$LIBS -lthreads"
++    LIBOBJS="$LIBOBJS thread.o"],[
+     AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
+     AC_DEFINE(C_THREADS)
++    AC_DEFINE(MACH_C_THREADS)
+     LIBOBJS="$LIBOBJS thread.o"],[
+     AC_MSG_CHECKING(for --with-pth)
+     AC_ARG_WITH(pth,
+@@ -1121,7 +1135,7 @@
+     LIBS="$LIBS -lcma"
+     LIBOBJS="$LIBOBJS thread.o"],[
+     USE_THREAD_MODULE="#"])
+-    ])])])])])])])])])
++    ])])])])])])])])])])
+ 
+     if test "$posix_threads" = "yes"; then
+       if test "$unistd_defines_pthreads" = "no"; then
--- python2.2-2.2.3dfsg.orig/debian/patches/compile.dpatch
+++ python2.2-2.2.3dfsg/debian/patches/compile.dpatch
@@ -0,0 +1,146 @@
+#! /bin/sh -e
+
+# DP: compile.py: add an -q option for more quiet operation
+
+dir=
+if [ $# -eq 3 -a "$2" = '-d' ]; then
+    pdir="-d $3"
+    dir="$3/"
+elif [ $# -ne 1 ]; then
+    echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+    exit 1
+fi
+case "$1" in
+    -patch)
+        patch $pdir -f --no-backup-if-mismatch -p1 < $0
+        #cd ${dir}gcc && autoconf
+        ;;
+    -unpatch)
+        patch $pdir -f --no-backup-if-mismatch -R -p1 < $0
+        #rm ${dir}gcc/configure
+        ;;
+    *)
+	echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+        exit 1
+esac
+exit 0
+
+--- python2.2-2.2.orig/Lib/compileall.py	Wed Apr 18 03:20:21 2001
++++ python2.2-2.2/Lib/compileall.py	Sun Sep 30 22:30:32 2001
+@@ -4,6 +4,8 @@
+ given as arguments recursively; the -l option prevents it from
+ recursing into directories.
+ 
++DEBIAN adds an -q option for more quiet operation.
++
+ Without arguments, if compiles all modules on sys.path, without
+ recursing into subdirectories.  (Even though it should do so for
+ packages -- for now, you'll have to deal with packages separately.)
+@@ -19,7 +21,7 @@
+ 
+ __all__ = ["compile_dir","compile_path"]
+ 
+-def compile_dir(dir, maxlevels=10, ddir=None, force=0, rx=None):
++def compile_dir(dir, maxlevels=10, ddir=None, force=0, rx=None, quiet=0):
+     """Byte-compile all modules in the given directory tree.
+ 
+     Arguments (only dir is required):
+@@ -29,9 +31,10 @@
+     ddir:      if given, purported directory name (this is the
+                directory name that will show up in error messages)
+     force:     if 1, force compilation, even if timestamps are up-to-date
++    quiet:     if 1, be quiet during compilation
+ 
+     """
+-    print 'Listing', dir, '...'
++    if not quiet: print 'Listing', dir, '...'
+     try:
+         names = os.listdir(dir)
+     except os.error:
+@@ -57,7 +60,7 @@
+                 try: ctime = os.stat(cfile)[stat.ST_MTIME]
+                 except os.error: ctime = 0
+                 if (ctime > ftime) and not force: continue
+-                print 'Compiling', fullname, '...'
++                if not quiet: print 'Compiling', fullname, '...'
+                 try:
+                     ok = py_compile.compile(fullname, None, dfile)
+                 except KeyboardInterrupt:
+@@ -67,6 +70,7 @@
+                     if type(sys.exc_type) == type(''):
+                         exc_type_name = sys.exc_type
+                     else: exc_type_name = sys.exc_type.__name__
++                    if quiet: print 'Compiling', fullname, '...'
+                     print 'Sorry:', exc_type_name + ':',
+                     print sys.exc_value
+                     success = 0
+@@ -77,11 +81,11 @@
+              name != os.curdir and name != os.pardir and \
+              os.path.isdir(fullname) and \
+              not os.path.islink(fullname):
+-            if not compile_dir(fullname, maxlevels - 1, dfile, force, rx):
++            if not compile_dir(fullname, maxlevels - 1, dfile, force, rx, quiet):
+                 success = 0
+     return success
+ 
+-def compile_path(skip_curdir=1, maxlevels=0, force=0):
++def compile_path(skip_curdir=1, maxlevels=0, force=0, quiet=0):
+     """Byte-compile all module on sys.path.
+ 
+     Arguments (all optional):
+@@ -89,6 +93,7 @@
+     skip_curdir: if true, skip current directory (default true)
+     maxlevels:   max recursion level (default 0)
+     force: as for compile_dir() (default 0)
++    quiet: as for compile_dir() (default 0)
+ 
+     """
+     success = 1
+@@ -96,20 +101,21 @@
+         if (not dir or dir == os.curdir) and skip_curdir:
+             print 'Skipping current directory'
+         else:
+-            success = success and compile_dir(dir, maxlevels, None, force)
++            success = success and compile_dir(dir, maxlevels, None, force, quiet)
+     return success
+ 
+ def main():
+     """Script main program."""
+     import getopt
+     try:
+-        opts, args = getopt.getopt(sys.argv[1:], 'lfd:x:')
++        opts, args = getopt.getopt(sys.argv[1:], 'lfqd:x:')
+     except getopt.error, msg:
+         print msg
+-        print "usage: python compileall.py [-l] [-f] [-d destdir] " \
++        print "usage: python compileall.py [-l] [-f] [-q] [-d destdir] " \
+               "[-s regexp] [directory ...]"
+         print "-l: don't recurse down"
+         print "-f: force rebuild even if timestamps are up-to-date"
++        print "-q: quiet operation"
+         print "-d destdir: purported directory name for error messages"
+         print "   if no directory arguments, -l sys.path is assumed"
+         print "-x regexp: skip files matching the regular expression regexp"
+@@ -118,11 +124,13 @@
+     maxlevels = 10
+     ddir = None
+     force = 0
++    quiet = 0
+     rx = None
+     for o, a in opts:
+         if o == '-l': maxlevels = 0
+         if o == '-d': ddir = a
+         if o == '-f': force = 1
++        if o == '-q': quiet = 1
+         if o == '-x':
+             import re
+             rx = re.compile(a)
+@@ -134,7 +142,7 @@
+     try:
+         if args:
+             for dir in args:
+-                if not compile_dir(dir, maxlevels, ddir, force, rx):
++                if not compile_dir(dir, maxlevels, ddir, force, rx, quiet):
+                     success = 0
+         else:
+             success = compile_path()
--- python2.2-2.2.3dfsg.orig/debian/patches/cvs-updates.dpatch
+++ python2.2-2.2.3dfsg/debian/patches/cvs-updates.dpatch
@@ -0,0 +1,3076 @@
+#! /bin/sh -e
+
+# DP: CVS updates of the release22-maint branch (until 2005-02-04).
+
+dir=
+if [ $# -eq 3 -a "$2" = '-d' ]; then
+    pdir="-d $3"
+    dir="$3/"
+elif [ $# -ne 1 ]; then
+    echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+    exit 1
+fi
+case "$1" in
+    -patch)
+        patch $pdir -f --no-backup-if-mismatch -p0 < $0
+        autoconf
+        ;;
+    -unpatch)
+        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
+        rm -f configure
+        ;;
+    *)
+	echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+        exit 1
+esac
+exit 0
+
+# cvs -z9 -q diff -uN -r r223 -r release22-maint
+
+Index: configure.in
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/configure.in,v
+retrieving revision 1.288.6.19
+retrieving revision 1.288.6.21
+diff -u -r1.288.6.19 -r1.288.6.21
+--- configure.in	29 Mar 2003 22:25:17 -0000	1.288.6.19
++++ configure.in	13 Jul 2003 09:48:31 -0000	1.288.6.21
+@@ -1,5 +1,5 @@
+ dnl Process this file with autoconf 2.0 or later to make a configure script.
+-AC_REVISION($Revision: 1.288.6.19 $)
++AC_REVISION($Revision: 1.288.6.21 $)
+ AC_PREREQ(2.0)
+ AC_INIT(Include/object.h)
+ AC_CONFIG_HEADER(pyconfig.h)
+@@ -70,6 +70,7 @@
+ 	case $MACHDEP in
+ 	cygwin*) MACHDEP="cygwin";;
+ 	darwin*) MACHDEP="darwin";;
++        irix646) MACHDEP="irix6";;
+ 	'')	MACHDEP="unknown";;
+ 	esac
+ fi
+@@ -370,6 +371,21 @@
+ fi],
+ [AC_MSG_RESULT(no)])
+ 
++AC_MSG_CHECKING(whether gcc needs -fno-strict-aliasing)
++AC_TRY_CPP([
++#ifdef __GNUC__
++# if defined(__GNUC_MINOR__) && __GNUC__ >= 3 && (__GNUC_MINOR__ >= 3)
++#   error -fno-strict-aliasing needed
++# endif
++#endif
++],[
++  GCC_EXTRA_OPT=
++  AC_MSG_RESULT(no)
++],[
++  GCC_EXTRA_OPT=-fno-strict-aliasing
++  AC_MSG_RESULT(yes)
++])
++
+ # Optimizer/debugger flags
+ AC_SUBST(OPT)
+ if test -z "$OPT"
+@@ -383,10 +399,10 @@
+ 		# debug builds.
+ 		OPT="-g -Wall -Wstrict-prototypes"
+ 	    else
+-		OPT="-g -O3 -Wall -Wstrict-prototypes"
++		OPT="-g -O3 $GCC_EXTRA_OPT -Wall -Wstrict-prototypes"
+ 	    fi;;
+ 	*)
+-	    OPT="-O3 -Wall -Wstrict-prototypes";;
++	    OPT="-O3 $GCC_EXTRA_OPT -Wall -Wstrict-prototypes";;
+ 	esac
+ 	case $ac_sys_system in
+ 	    SCO_SV*) OPT="$OPT -m486 -DSCO5";;
+Index: install-sh
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/install-sh,v
+retrieving revision 2.4
+retrieving revision 2.4.24.1
+diff -u -r2.4 -r2.4.24.1
+--- install-sh	10 Feb 2001 20:04:53 -0000	2.4
++++ install-sh	14 Jun 2003 06:59:02 -0000	2.4.24.1
+@@ -1,19 +1,37 @@
+ #!/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
++# This originates from X11R5 (mit/util/scripts/install.sh), which was
++# later released in X11R6 (xc/config/util/install.sh) with the
++# following copyright and license.
+ #
+-# 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.
++# Copyright (C) 1994 X Consortium
++#
++# Permission is hereby granted, free of charge, to any person obtaining a copy
++# of this software and associated documentation files (the "Software"), to
++# deal in the Software without restriction, including without limitation the
++# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
++# sell copies of the Software, and to permit persons to whom the Software is
++# furnished to do so, subject to the following conditions:
++#
++# The above copyright notice and this permission notice shall be included in
++# all copies or substantial portions of the Software.
++#
++# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
++# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
++# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
++# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
++# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
++# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
++#
++# Except as contained in this notice, the name of the X Consortium shall not
++# be used in advertising or otherwise to promote the sale, use or other deal-
++# ings in this Software without prior written authorization from the X Consor-
++# tium.
++#
++#
++# FSF changes to this file are in the public domain.
+ #
+ # Calling this script install-sh is preferred over install.sh, to prevent
+ # `make' implicit rules from creating a file called install from it
+@@ -56,7 +74,7 @@
+ 
+ while [ x"$1" != x ]; do
+     case $1 in
+-	-c) instcmd="$cpprog"
++	-c) instcmd=$cpprog
+ 	    shift
+ 	    continue;;
+ 
+@@ -79,7 +97,7 @@
+ 	    shift
+ 	    continue;;
+ 
+-	-s) stripcmd="$stripprog"
++	-s) stripcmd=$stripprog
+ 	    shift
+ 	    continue;;
+ 
+@@ -106,128 +124,132 @@
+ 
+ if [ x"$src" = x ]
+ then
+-	echo "install:	no input file specified"
++	echo "$0: no input file specified" >&2
+ 	exit 1
+ else
+-	true
++	:
+ fi
+ 
+ if [ x"$dir_arg" != x ]; then
+ 	dst=$src
+ 	src=""
+-	
+-	if [ -d $dst ]; then
++
++	if [ -d "$dst" ]; then
+ 		instcmd=:
+ 		chmodcmd=""
+ 	else
+-		instcmd=mkdir
++		instcmd=$mkdirprog
+ 	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 
++# might cause directories to be created, which would be especially bad
+ # if $src (and thus $dsttmp) contains '*'.
+ 
+-	if [ -f $src -o -d $src ]
++	if [ -f "$src" ] || [ -d "$src" ]
+ 	then
+-		true
++		:
+ 	else
+-		echo "install:  $src does not exist"
++		echo "$0: $src does not exist" >&2
+ 		exit 1
+ 	fi
+-	
++
+ 	if [ x"$dst" = x ]
+ 	then
+-		echo "install:	no destination specified"
++		echo "$0: no destination specified" >&2
+ 		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 ]
++	if [ -d "$dst" ]
+ 	then
+-		dst="$dst"/`basename $src`
++		dst=$dst/`basename "$src"`
+ 	else
+-		true
++		:
+ 	fi
+ fi
+ 
+ ## this sed command emulates the dirname command
+-dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
++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}}"
++defaultIFS='
++	'
++IFS="${IFS-$defaultIFS}"
+ 
+-oIFS="${IFS}"
++oIFS=$IFS
+ # Some sh's can't handle IFS=/ for some reason.
+ IFS='%'
+-set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+-IFS="${oIFS}"
++set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
++IFS=$oIFS
+ 
+ pathcomp=''
+ 
+ while [ $# -ne 0 ] ; do
+-	pathcomp="${pathcomp}${1}"
++	pathcomp=$pathcomp$1
+ 	shift
+ 
+-	if [ ! -d "${pathcomp}" ] ;
++	if [ ! -d "$pathcomp" ] ;
+         then
+-		$mkdirprog "${pathcomp}"
++		$mkdirprog "$pathcomp"
+ 	else
+-		true
++		:
+ 	fi
+ 
+-	pathcomp="${pathcomp}/"
++	pathcomp=$pathcomp/
+ done
+ fi
+ 
+ if [ x"$dir_arg" != x ]
+ then
+-	$doit $instcmd $dst &&
++	$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
++	if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi &&
++	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&
++	if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&
++	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi
+ else
+ 
+ # If we're going to rename the final executable, determine the name now.
+ 
+-	if [ x"$transformarg" = x ] 
++	if [ x"$transformarg" = x ]
+ 	then
+-		dstfile=`basename $dst`
++		dstfile=`basename "$dst"`
+ 	else
+-		dstfile=`basename $dst $transformbasename | 
++		dstfile=`basename "$dst" $transformbasename |
+ 			sed $transformarg`$transformbasename
+ 	fi
+ 
+ # don't allow the sed command to completely eliminate the filename
+ 
+-	if [ x"$dstfile" = x ] 
++	if [ x"$dstfile" = x ]
+ 	then
+-		dstfile=`basename $dst`
++		dstfile=`basename "$dst"`
+ 	else
+-		true
++		:
+ 	fi
+ 
+-# Make a temp file name in the proper directory.
++# Make a couple of temp file names in the proper directory.
+ 
+ 	dsttmp=$dstdir/#inst.$$#
++	rmtmp=$dstdir/#rm.$$#
+ 
+-# Move or copy the file name to the temp name
++# Trap to clean up temp files at exit.
+ 
+-	$doit $instcmd $src $dsttmp &&
++	trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
++	trap '(exit $?); exit' 1 2 13 15
++
++# Move or copy the file name to the temp name
+ 
+-	trap "rm -f ${dsttmp}" 0 &&
++	$doit $instcmd "$src" "$dsttmp" &&
+ 
+ # and set any options; do chmod last to preserve setuid bits
+ 
+@@ -235,17 +257,38 @@
+ # 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 &&
++	if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi &&
++	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi &&
++	if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi &&
++	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi &&
++
++# Now remove or move aside any old file at destination location.  We try this
++# two ways since rm can't unlink itself on some systems and the destination
++# file might be busy for other reasons.  In this case, the final cleanup
++# might fail but the new file should still install successfully.
++
++{
++	if [ -f "$dstdir/$dstfile" ]
++	then
++		$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null ||
++		$doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null ||
++		{
++		  echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
++		  (exit 1); exit
++		}
++	else
++		:
++	fi
++} &&
+ 
+ # Now rename the file to the real destination.
+ 
+-	$doit $rmcmd -f $dstdir/$dstfile &&
+-	$doit $mvcmd $dsttmp $dstdir/$dstfile 
++	$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+ 
+ fi &&
+ 
++# The final little trick to "correctly" pass the exit status to the exit trap.
+ 
+-exit 0
++{
++	(exit 0); exit
++}
+Index: Doc/ACKS
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Doc/ACKS,v
+retrieving revision 1.33.6.2
+retrieving revision 1.33.6.3
+diff -u -r1.33.6.2 -r1.33.6.3
+--- Doc/ACKS	3 Dec 2002 18:50:41 -0000	1.33.6.2
++++ Doc/ACKS	29 Jul 2003 17:44:23 -0000	1.33.6.3
+@@ -4,7 +4,7 @@
+ This file lists people who have contributed in some way to the Python
+ documentation.  It is probably not complete -- if you feel that you or
+ anyone else should be on this list, please let us know (send email to
+-python-docs@python.org), and we'll be glad to correct the problem.
++docs@python.org), and we'll be glad to correct the problem.
+ 
+ It is only with the input and contributions of the Python community
+ that Python has such wonderful documentation -- Thank You!
+Index: Doc/Makefile
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Doc/Makefile,v
+retrieving revision 1.235.2.1.2.20
+retrieving revision 1.235.2.1.2.22
+diff -u -r1.235.2.1.2.20 -r1.235.2.1.2.22
+--- Doc/Makefile	29 May 2003 18:49:32 -0000	1.235.2.1.2.20
++++ Doc/Makefile	29 Jul 2003 17:44:23 -0000	1.235.2.1.2.22
+@@ -49,7 +49,7 @@
+ # The formatted output is located in subdirectories.  For PDF and
+ # PostScript, look in the paper-$(PAPER)/ directory.  For HTML, look in
+ # the html/ directory.  If you want to fix the GNU info process, look
+-# in the info/ directory; please send patches to python-docs@python.org.
++# in the info/ directory; please send patches to docs@python.org.
+ 
+ # This Makefile only includes information on how to perform builds; for
+ # dependency information, see Makefile.deps.
+@@ -66,7 +66,7 @@
+ 
+ # This is the *documentation* release, and is used to construct the file
+ # names of the downloadable tarballs.
+-RELEASE=2.2.3
++RELEASE=2.2.3+
+ 
+ PYTHON=	   python
+ DVIPS=	   dvips -N0 -t $(PAPER)
+@@ -650,5 +650,6 @@
+ 	rm -rf isilo/ref/ isilo/tut/ isilo/inst/ isilo/dist/
+ 	rm -rf isilo/whatsnew/
+ 	rm -f isilo/python-*-$(RELEASE).pdb isilo-$(RELEASE).zip
++	rm -f pkglist.html paper-$(PAPER)/README
+ 
+ realclean distclean:  clobber
+Index: Doc/README
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Doc/README,v
+retrieving revision 1.45.16.1
+retrieving revision 1.45.16.2
+diff -u -r1.45.16.1 -r1.45.16.2
+--- Doc/README	27 Feb 2002 13:32:25 -0000	1.45.16.1
++++ Doc/README	29 Jul 2003 17:42:54 -0000	1.45.16.2
+@@ -66,20 +66,11 @@
+ Other suggestions or questions should be sent to the Python
+ Documentation Team:
+ 
+-	python-docs@python.org
++	docs@python.org
+ 
+ Thanks!
+ 
+ 
+-What happened to the Macintosh chapter of the Python Library Reference?
+------------------------------------------------------------------------
+-
+-The directory mac/ contains the LaTeX sources for the "Macintosh
+-Library Modules" manual; this is built using the standard build
+-targets, so check the proper output directory for your chosen format
+-and paper size.
+-
+-
+ What tools do I need?
+ ---------------------
+ 
+Index: Doc/api/concrete.tex
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Doc/api/concrete.tex,v
+retrieving revision 1.6.6.6
+retrieving revision 1.6.6.7
+diff -u -r1.6.6.6 -r1.6.6.7
+--- Doc/api/concrete.tex	22 Oct 2002 20:21:06 -0000	1.6.6.6
++++ Doc/api/concrete.tex	26 Dec 2003 00:00:29 -0000	1.6.6.7
+@@ -1602,7 +1602,15 @@
+ \end{cvardesc}
+ 
+ \begin{cfuncdesc}{int}{PyList_Check}{PyObject *p}
+-  Returns true if its argument is a \ctype{PyListObject}.
++  Returns true if \var{p} is a list object or an instance of a
++  subtype of the list type.
++  \versionchanged[Allowed subtypes to be accepted]{2.2}
++\end{cfuncdesc}
++
++\begin{cfuncdesc}{int}{PyList_CheckExact}{PyObject *p}
++  Return true if \var{p} is a list object, but not an instance of a
++  subtype of the list type.
++  \versionadded{2.2}
+ \end{cfuncdesc}
+ 
+ \begin{cfuncdesc}{PyObject*}{PyList_New}{int len}
+@@ -1720,7 +1728,9 @@
+ \end{cvardesc}
+ 
+ \begin{cfuncdesc}{int}{PyDict_Check}{PyObject *p}
+-  Returns true if its argument is a \ctype{PyDictObject}.
++  Returns true if \var{p} is a dict object or an instance of a
++  subtype of the dict type.
++  \versionchanged[Allowed subtypes to be accepted]{2.2}
+ \end{cfuncdesc}
+ 
+ \begin{cfuncdesc}{PyObject*}{PyDict_New}{}
+Index: Doc/dist/dist.tex
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Doc/dist/dist.tex,v
+retrieving revision 1.36.16.3
+retrieving revision 1.36.16.4
+diff -u -r1.36.16.3 -r1.36.16.4
+--- Doc/dist/dist.tex	31 Mar 2003 16:45:22 -0000	1.36.16.3
++++ Doc/dist/dist.tex	1 Jul 2003 21:37:38 -0000	1.36.16.4
+@@ -1,7 +1,7 @@
+ \documentclass{howto}
+ \usepackage{distutils}
+ 
+-% $Id: dist.tex,v 1.36.16.3 2003/03/31 16:45:22 fdrake Exp $
++% $Id: dist.tex,v 1.36.16.4 2003/07/01 21:37:38 nnorwitz Exp $
+ 
+ \title{Distributing Python Modules}
+ 
+@@ -663,6 +663,27 @@
+ string should be given as the directory.
+ 
+ 
++\subsection{Debugging the setup script}
++\label{meta-data}
++
++Sometimes things go wrong, and the setup script doesn't do what the
++developer wants.
++
++Distutils catches any exceptions when running the setup script, and
++print a simple error message before the script is terminated.  The
++motivation for this behaviour is to not confuse administrators who
++don't know much about Python and are trying to install a package.  If
++they get a big long traceback from deep inside the guts of Distutils,
++they may think the package or the Python installation is broken
++because they don't read all the way down to the bottom and see that
++it's a permission problem.
++
++On the other hand, this doesn't help the developer to find the cause
++of the failure. For this purpose, the DISTUTILS_DEBUG environment
++variable can be set to anything except an empty string, and distutils
++will now print detailed information what it is doing, and prints the
++full traceback in case an exception occurrs.
++
+ \section{Writing the Setup Configuration File}
+ \label{setup-config}
+ 
+Index: Doc/doc/doc.tex
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Doc/doc/doc.tex,v
+retrieving revision 1.58
+retrieving revision 1.58.4.1
+diff -u -r1.58 -r1.58.4.1
+--- Doc/doc/doc.tex	14 Dec 2001 22:50:05 -0000	1.58
++++ Doc/doc/doc.tex	29 Jul 2003 17:44:23 -0000	1.58.4.1
+@@ -1805,7 +1805,7 @@
+     interested parties.
+ 
+     Comments and bug reports on the standard documents should be sent
+-    to \email{python-docs@python.org}.  This may include comments
++    to \email{docs@python.org}.  This may include comments
+     about formatting, content, grammatical and spelling errors, or
+     this document.  You can also send comments on this document
+     directly to the author at \email{fdrake@acm.org}.
+Index: Doc/ext/extending.tex
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Doc/ext/extending.tex,v
+retrieving revision 1.11.6.2
+retrieving revision 1.11.6.3
+diff -u -r1.11.6.2 -r1.11.6.3
+--- Doc/ext/extending.tex	16 May 2002 13:47:00 -0000	1.11.6.2
++++ Doc/ext/extending.tex	7 Nov 2003 12:25:53 -0000	1.11.6.3
+@@ -1174,14 +1174,12 @@
+ \section{Reference Counts
+          \label{refcounts}}
+ 
+-In languages like C or \Cpp, the programmer is responsible for
+-dynamic allocation and deallocation of memory on the heap.  In C,
+-this is done using the functions \cfunction{malloc()} and
+-\cfunction{free()}.  In \Cpp, the operators \keyword{new} and
+-\keyword{delete} are used with essentially the same meaning; they are
+-actually implemented using \cfunction{malloc()} and
+-\cfunction{free()}, so we'll restrict the following discussion to the
+-latter.
++In languages like C or \Cpp, the programmer is responsible for dynamic
++allocation and deallocation of memory on the heap.  In C, this is done
++using the functions \cfunction{malloc()} and \cfunction{free()}.  In
++\Cpp, the operators \keyword{new} and \keyword{delete} are used with
++essentially the same meaning so we'll restrict the following
++discussion to the C case.
+ 
+ Every block of memory allocated with \cfunction{malloc()} should
+ eventually be returned to the pool of available memory by exactly one
+Index: Doc/html/about.html
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Doc/html/about.html,v
+retrieving revision 1.3.24.1
+retrieving revision 1.3.24.2
+diff -u -r1.3.24.1 -r1.3.24.2
+--- Doc/html/about.html	17 Apr 2002 01:42:58 -0000	1.3.24.1
++++ Doc/html/about.html	29 Jul 2003 17:44:23 -0000	1.3.24.2
+@@ -50,8 +50,8 @@
+     <h2>Comments and Questions</h2>
+ 
+     <p> General comments and questions regarding this document should
+-      be sent by email to <a href="mailto:python-docs@python.org"
+-        >python-docs@python.org</a>.  If you find specific errors in
++      be sent by email to <a href="mailto:docs@python.org"
++        >docs@python.org</a>.  If you find specific errors in
+       this document, please report the bug at the <a
+         href="http://sourceforge.net/bugs/?group_id=5470">Python Bug
+         Tracker</a> at <a href="http://sourceforge.net/">SourceForge</a>.
+Index: Doc/html/stdabout.dat
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Doc/html/stdabout.dat,v
+retrieving revision 1.5.24.1
+retrieving revision 1.5.24.2
+diff -u -r1.5.24.1 -r1.5.24.2
+--- Doc/html/stdabout.dat	22 May 2003 15:09:55 -0000	1.5.24.1
++++ Doc/html/stdabout.dat	29 Jul 2003 17:44:23 -0000	1.5.24.2
+@@ -28,8 +28,8 @@
+ <h2>Comments and Questions</h2>
+ 
+ <p> General comments and questions regarding this document should
+-  be sent by email to <a href="mailto:python-docs@python.org"
+-    >python-docs@python.org</a>.  If you find specific errors in
++  be sent by email to <a href="mailto:docs@python.org"
++    >docs@python.org</a>.  If you find specific errors in
+   this document, either in the content or the presentation, please
+   report the bug at the <a
+     href="http://sourceforge.net/bugs/?group_id=5470">Python Bug
+Index: Doc/info/README
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Doc/info/README,v
+retrieving revision 1.3.28.1
+retrieving revision 1.3.28.2
+diff -u -r1.3.28.1 -r1.3.28.2
+--- Doc/info/README	17 Jan 2002 21:06:19 -0000	1.3.28.1
++++ Doc/info/README	29 Jul 2003 17:44:23 -0000	1.3.28.2
+@@ -18,4 +18,4 @@
+ conversion to the info format.
+ 
+ Questions and comments on these documents should be directed to
+-python-docs@python.org.
++docs@python.org.
+Index: Doc/lib/emailmessage.tex
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Doc/lib/emailmessage.tex,v
+retrieving revision 1.4.8.3
+retrieving revision 1.4.8.4
+diff -u -r1.4.8.3 -r1.4.8.4
+--- Doc/lib/emailmessage.tex	21 Mar 2003 21:24:27 -0000	1.4.8.3
++++ Doc/lib/emailmessage.tex	19 Aug 2003 04:56:46 -0000	1.4.8.4
+@@ -340,15 +340,18 @@
+ Parameter keys are always compared case insensitively.  The return
+ value can either be a string, or a 3-tuple if the parameter was
+ \rfc{2231} encoded.  When it's a 3-tuple, the elements of the value are of
+-the form \code{(CHARSET, LANGUAGE, VALUE)}, where \code{LANGUAGE} may
+-be the empty string.  Your application should be prepared to deal with
+-3-tuple return values, which it can convert to a Unicode string like
+-so:
++the form \code{(CHARSET, LANGUAGE, VALUE)}.  Note that both \code{CHARSET} and
++\code{LANGUAGE} can be \code{None}, in which case you should consider
++\code{VALUE} to be encoded in the \code{us-ascii} charset.  You can
++usually ignore \code{LANGUAGE}.
++
++Your application should be prepared to deal with 3-tuple return
++values, and can convert the parameter to a Unicode string like so:
+ 
+ \begin{verbatim}
+ param = msg.get_param('foo')
+ if isinstance(param, tuple):
+-    param = unicode(param[2], param[0])
++    param = unicode(param[2], param[0] or 'us-ascii')
+ \end{verbatim}
+ 
+ In any case, the parameter value (either the returned string, or the
+Index: Doc/lib/lib.tex
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Doc/lib/lib.tex,v
+retrieving revision 1.200
+retrieving revision 1.200.4.1
+diff -u -r1.200 -r1.200.4.1
+--- Doc/lib/lib.tex	18 Dec 2001 16:32:30 -0000	1.200
++++ Doc/lib/lib.tex	25 Sep 2003 18:25:51 -0000	1.200.4.1
+@@ -216,6 +216,7 @@
+ \input{libxmlrpclib}
+ \input{libsimplexmlrpc}
+ \input{libasyncore}
++\input{libasynchat}
+ 
+ \input{netdata}                 % Internet Data Handling
+ \input{libformatter}
+Index: Doc/lib/libasynchat.tex
+===================================================================
+RCS file: Doc/lib/libasynchat.tex
+diff -N Doc/lib/libasynchat.tex
+--- /dev/null	1 Jan 1970 00:00:00 -0000
++++ Doc/lib/libasynchat.tex	25 Sep 2003 18:26:06 -0000	1.3.18.1
+@@ -0,0 +1,254 @@
++\section{\module{asynchat} ---
++         Asynchronous socket command/response handler}
++
++\declaremodule{standard}{asynchat}
++\modulesynopsis{Support for asynchronous command/response protocols.}
++\moduleauthor{Sam Rushing}{rushing@nightmare.com}
++\sectionauthor{Steve Holden}{sholden@holdenweb.com}
++
++This module builds on the \refmodule{asyncore} infrastructure,
++simplifying asynchronous clients and servers and making it easier to
++handle protocols whose elements are terminated by arbitrary strings, or
++are of variable length. \refmodule{asynchat} defines the abstract class
++\class{async_chat} that you subclass, providing implementations of the
++\method{collect_incoming_data()} and \method{found_terminator()}
++methods. It uses the same asynchronous loop as \refmodule{asyncore}, and
++the two types of channel, \class{asyncore.dispatcher} and
++\class{asynchat.async_chat}, can freely be mixed in the channel map.
++Typically an \class{asyncore.dispatcher} server channel generates new
++\class{asynchat.async_chat} channel objects as it receives incoming
++connection requests. 
++
++\begin{classdesc}{async_chat}{}
++  This class is an abstract subclass of \class{asyncore.dispatcher}. To make
++  practical use of the code you must subclass \class{async_chat}, providing
++  meaningful \method{collect_incoming_data()} and \method{found_terminator()}
++  methods. The \class{asyncore.dispatcher} methods can be
++  used, although not all make sense in a message/response context.  
++
++  Like \class{asyncore.dispatcher}, \class{async_chat} defines a set of events
++  that are generated by an analysis of socket conditions after a
++  \cfunction{select()} call. Once the polling loop has been started the
++  \class{async_chat} object's methods are called by the event-processing
++  framework with no action on the part of the programmer.
++
++  Unlike \class{asyncore.dispatcher}, \class{async_chat} allows you to define
++  a first-in-first-out queue (fifo) of \emph{producers}. A producer need have
++  only one method, \method{more()}, which should return data to be transmitted
++  on the channel. The producer indicates exhaustion (\emph{i.e.} that it contains
++  no more data) by having its \method{more()} method return the empty string. At
++  this point the \class{async_chat} object removes the producer from the fifo
++  and starts using the next producer, if any. When the producer fifo is empty
++  the \method{handle_write()} method does nothing. You use the channel object's
++  \method{set_terminator()} method to describe how to recognize the end
++  of, or an important breakpoint in, an incoming transmission from the
++  remote endpoint.
++
++  To build a functioning \class{async_chat} subclass your 
++  input methods \method{collect_incoming_data()} and
++  \method{found_terminator()} must handle the data that the channel receives
++  asynchronously. The methods are described below.
++\end{classdesc}
++
++\begin{methoddesc}{close_when_done}{}
++  Pushes a \code{None} on to the producer fifo. When this producer is
++  popped off the fifo it causes the channel to be closed.
++\end{methoddesc}
++
++\begin{methoddesc}{collect_incoming_data}{data}
++  Called with \var{data} holding an arbitrary amount of received data.
++  The default method, which must be overridden, raises a \exception{NotImplementedError} exception.
++\end{methoddesc}
++
++\begin{methoddesc}{discard_buffers}{}
++  In emergencies this method will discard any data held in the input and/or
++  output buffers and the producer fifo.
++\end{methoddesc}
++
++\begin{methoddesc}{found_terminator}{}
++  Called when the incoming data stream  matches the termination condition
++  set by \method{set_terminator}. The default method, which must be overridden,
++  raises a \exception{NotImplementedError} exception. The buffered input data should
++  be available via an instance attribute.
++\end{methoddesc}
++
++\begin{methoddesc}{get_terminator}{}
++  Returns the current terminator for the channel.
++\end{methoddesc}
++
++\begin{methoddesc}{handle_close}{}
++  Called when the channel is closed. The default method silently closes
++  the channel's socket.
++\end{methoddesc}
++
++\begin{methoddesc}{handle_read}{}
++  Called when a read event fires on the channel's socket in the
++  asynchronous loop. The default method checks for the termination
++  condition established by \method{set_terminator()}, which can be either
++  the appearance of a particular string in the input stream or the receipt
++  of a particular number of characters. When the terminator is found,
++  \method{handle_read} calls the \method{found_terminator()} method after
++  calling \method{collect_incoming_data()} with any data preceding the
++  terminating condition.
++\end{methoddesc}
++
++\begin{methoddesc}{handle_write}{}
++  Called when the application may write data to the channel.  
++  The default method calls the \method{initiate_send()} method, which in turn
++  will call \method{refill_buffer()} to collect data from the producer
++  fifo associated with the channel.
++\end{methoddesc}
++
++\begin{methoddesc}{push}{data}
++  Creates a \class{simple_producer} object (\emph{see below}) containing the data and
++  pushes it on to the channel's \code{producer_fifo} to ensure its
++  transmission. This is all you need to do to have the channel write
++  the data out to the network, although it is possible to use your
++  own producers in more complex schemes to implement encryption and
++  chunking, for example.
++\end{methoddesc}
++
++\begin{methoddesc}{push_with_producer}{producer}
++  Takes a producer object and adds it to the producer fifo associated with
++  the channel. When all currently-pushed producers have been exhausted
++  the channel will consume this producer's data by calling its
++  \method{more()} method and send the data to the remote endpoint. 
++\end{methoddesc}
++
++\begin{methoddesc}{readable}{}
++  Should return \code{True} for the channel to be included in the set of
++  channels tested by the \cfunction{select()} loop for readability.
++\end{methoddesc}
++
++\begin{methoddesc}{refill_buffer}{}
++  Refills the output buffer by calling the \method{more()} method of the
++  producer at the head of the fifo. If it is exhausted then the
++  producer is popped off the fifo and the next producer is activated.
++  If the current producer is, or becomes, \code{None} then the channel
++  is closed.
++\end{methoddesc}
++
++\begin{methoddesc}{set_terminator}{term}
++  Sets the terminating condition to be recognised on the channel. \code{term}
++  may be any of three types of value, corresponding to three different ways
++  to handle incoming protocol data.
++
++  \begin{tableii}{l|l}{}{term}{Description}
++    \lineii{\emph{string}}{Will call \method{found_terminator()} when the
++                string is found in the input stream}
++    \lineii{\emph{integer}}{Will call \method{found_terminator()} when the
++                indicated number of characters have been received}
++    \lineii{\code{None}}{The channel continues to collect data forever}
++  \end{tableii}
++
++  Note that any data following the terminator will be available for reading by
++  the channel after \method{found_terminator()} is called.
++\end{methoddesc}
++
++\begin{methoddesc}{writable}{}
++  Should return \code{True} as long as items remain on the producer fifo,
++  or the channel is connected and the channel's output buffer is non-empty.
++\end{methoddesc}
++
++\subsection{asynchat - Auxiliary Classes and Functions}
++
++\begin{classdesc}{simple_producer}{data\optional{, buffer_size=512}}
++  A \class{simple_producer} takes a chunk of data and an optional buffer size.
++  Repeated calls to its \method{more()} method yield successive chunks of the
++  data no larger than \var{buffer_size}.
++\end{classdesc}
++
++\begin{methoddesc}{more}{}
++  Produces the next chunk of information from the producer, or returns the empty string.
++\end{methoddesc}
++
++\begin{classdesc}{fifo}{\optional{list=None}}
++  Each channel maintains a \class{fifo} holding data which has been pushed by the
++  application but not yet popped for writing to the channel.
++  A \class{fifo} is a list used to hold data and/or producers until they are required.
++  If the \var{list} argument is provided then it should contain producers or
++  data items to be written to the channel.
++\end{classdesc}
++
++\begin{methoddesc}{is_empty}{}
++  Returns \code{True} iff the fifo is empty.
++\end{methoddesc}
++
++\begin{methoddesc}{first}{}
++  Returns the least-recently \method{push()}ed item from the fifo.
++\end{methoddesc}
++
++\begin{methoddesc}{push}{data}
++  Adds the given data (which may be a string or a producer object) to the
++  producer fifo.
++\end{methoddesc}
++
++\begin{methoddesc}{pop}{}
++  If the fifo is not empty, returns \code{True, first()}, deleting the popped
++  item. Returns \code{False, None} for an empty fifo.
++\end{methoddesc}
++
++The \module{asynchat} module also defines one utility function, which may be
++of use in network and textual analysis operations.
++
++\begin{funcdesc}{find_prefix_at_end}{haystack, needle}
++  Returns \code{True} if string \var{haystack} ends with any non-empty
++  prefix of string \var{needle}.
++\end{funcdesc}
++
++\subsection{asynchat Example \label{asynchat-example}}
++
++The following partial example shows how HTTP requests can be read with
++\class{async_chat}. A web server might create an \class{http_request_handler} object for
++each incoming client connection. Notice that initially the
++channel terminator is set to match the blank line at the end of the HTTP
++headers, and a flag indicates that the headers are being read.
++
++Once the headers have been read, if the request is of type POST
++(indicating that further data are present in the input stream) then the
++\code{Content-Length:} header is used to set a numeric terminator to
++read the right amount of data from the channel.
++
++The \method{handle_request()} method is called once all relevant input
++has been marshalled, after setting the channel terminator to \code{None}
++to ensure that any extraneous data sent by the web client are ignored.
++
++\begin{verbatim}
++class http_request_handler(asynchat.async_chat):
++
++    def __init__(self, conn, addr, sessions, log):
++        asynchat.async_chat.__init__(self, conn=conn)
++        self.addr = addr
++        self.sessions = sessions
++        self.ibuffer = []
++        self.obuffer = ""
++        self.set_terminator("\r\n\r\n")
++        self.reading_headers = True
++        self.handling = False
++        self.cgi_data = None
++        self.log = log
++
++    def collect_incoming_data(self, data):
++        """Buffer the data"""
++        self.ibuffer.append(data)
++
++    def found_terminator(self):
++        if self.reading_headers:
++            self.reading_headers = False
++            self.parse_headers("".join(self.ibuffer))
++            self.ibuffer = []
++            if self.op.upper() == "POST":
++                clen = self.headers.getheader("content-length")
++                self.set_terminator(int(clen))
++            else:
++                self.handling = True
++                self.set_terminator(None)
++                self.handle_request()
++        elif not self.handling:
++            self.set_terminator(None) # browsers sometimes over-send
++            self.cgi_data = parse(self.headers, "".join(self.ibuffer))
++            self.handling = True
++            self.ibuffer = []
++            self.handle_request()
++\end{verbatim}
++
+Index: Doc/lib/libfuncs.tex
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v
+retrieving revision 1.100.4.16
+retrieving revision 1.100.4.17
+diff -u -r1.100.4.16 -r1.100.4.17
+--- Doc/lib/libfuncs.tex	16 May 2003 03:08:34 -0000	1.100.4.16
++++ Doc/lib/libfuncs.tex	5 Jul 2003 17:38:25 -0000	1.100.4.17
+@@ -684,7 +684,7 @@
+     def getx(self): return self.__x
+     def setx(self, value): self.__x = value
+     def delx(self): del self.__x
+-        x = property(getx, setx, delx, "I'm the 'x' property.")
++    x = property(getx, setx, delx, "I'm the 'x' property.")
+ \end{verbatim}
+ 
+   \versionadded{2.2}
+Index: Doc/lib/libinspect.tex
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Doc/lib/libinspect.tex,v
+retrieving revision 1.10.6.1
+retrieving revision 1.10.6.2
+diff -u -r1.10.6.1 -r1.10.6.2
+--- Doc/lib/libinspect.tex	23 Apr 2002 21:20:44 -0000	1.10.6.1
++++ Doc/lib/libinspect.tex	31 Oct 2003 15:27:55 -0000	1.10.6.2
+@@ -25,7 +25,7 @@
+ 
+ The \function{getmembers()} function retrieves the members
+ of an object such as a class or module.
+-The nine functions whose names begin with ``is'' are mainly
++The ten functions whose names begin with ``is'' are mainly
+ provided as convenient choices for the second argument to
+ \function{getmembers()}.  They also help you determine when
+ you can expect to find the following special attributes:
+Index: Doc/lib/librobotparser.tex
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Doc/lib/librobotparser.tex,v
+retrieving revision 1.4
+retrieving revision 1.4.8.1
+diff -u -r1.4 -r1.4.8.1
+--- Doc/lib/librobotparser.tex	6 Nov 2001 22:14:35 -0000	1.4
++++ Doc/lib/librobotparser.tex	14 Jul 2003 17:05:19 -0000	1.4.8.1
+@@ -15,7 +15,7 @@
+ questions about whether or not a particular user agent can fetch a URL on
+ the Web site that published the \file{robots.txt} file.  For more details on 
+ the structure of \file{robots.txt} files, see
+-\url{http://info.webcrawler.com/mak/projects/robots/norobots.html}. 
++\url{http://www.robotstxt.org/wc/norobots.html}. 
+ 
+ \begin{classdesc}{RobotFileParser}{}
+ 
+Index: Doc/lib/libstat.tex
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstat.tex,v
+retrieving revision 1.22
+retrieving revision 1.22.6.1
+diff -u -r1.22 -r1.22.6.1
+--- Doc/lib/libstat.tex	28 Nov 2001 07:26:15 -0000	1.22
++++ Doc/lib/libstat.tex	19 Jun 2003 18:14:02 -0000	1.22.6.1
+@@ -129,12 +129,12 @@
+ import os, sys
+ from stat import *
+ 
+-def walktree(dir, callback):
+-    '''recursively descend the directory rooted at dir,
++def walktree(top, callback):
++    '''recursively descend the directory tree rooted at top,
+        calling the callback function for each regular file'''
+ 
+-    for f in os.listdir(dir):
+-        pathname = '%s/%s' % (dir, f)
++    for f in os.listdir(top):
++        pathname = os.path.join(top, f)
+         mode = os.stat(pathname)[ST_MODE]
+         if S_ISDIR(mode):
+             # It's a directory, recurse into it
+Index: Doc/lib/libundoc.tex
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Doc/lib/libundoc.tex,v
+retrieving revision 1.81
+retrieving revision 1.81.6.1
+diff -u -r1.81 -r1.81.6.1
+--- Doc/lib/libundoc.tex	26 Nov 2001 21:38:50 -0000	1.81
++++ Doc/lib/libundoc.tex	29 Jul 2003 17:44:24 -0000	1.81.6.1
+@@ -2,7 +2,8 @@
+ 
+ Here's a quick listing of modules that are currently undocumented, but
+ that should be documented.  Feel free to contribute documentation for
+-them!  (Send via email to \email{python-docs@python.org}.)
++them!  (Send via email to
++\ulink{\email{docs@python.org}}{mailto:docs@python.org}.)
+ 
+ The idea and original contents for this chapter were taken
+ from a posting by Fredrik Lundh; the specific contents of this chapter
+Index: Doc/lib/liburllib.tex
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Doc/lib/liburllib.tex,v
+retrieving revision 1.40.8.4
+retrieving revision 1.40.8.6
+diff -u -r1.40.8.4 -r1.40.8.6
+--- Doc/lib/liburllib.tex	25 Apr 2003 05:31:43 -0000	1.40.8.4
++++ Doc/lib/liburllib.tex	27 Aug 2003 15:10:20 -0000	1.40.8.6
+@@ -118,7 +118,7 @@
+ \class{FancyURLopener} class and use it to perform their requested
+ actions.  To override this functionality, programmers can create a
+ subclass of \class{URLopener} or \class{FancyURLopener}, then assign
+-that an instance of that class to the
++an instance of that class to the
+ \code{urllib._urlopener} variable before calling the desired function.
+ For example, applications may want to specify a different
+ \mailheader{User-Agent} header than \class{URLopener} defines.  This
+@@ -223,12 +223,12 @@
+ 
+ \begin{classdesc}{FancyURLopener}{...}
+ \class{FancyURLopener} subclasses \class{URLopener} providing default
+-handling for the following HTTP response codes: 301, 302, 303 and 401.
+-For 301, 302 and 303 response codes, the \mailheader{Location} header
+-is used to fetch the actual URL.  For 401 response codes
+-(authentication required), basic HTTP authentication is performed.
+-For 301, 302 and 303 response codes, recursion is bounded by the value
+-of the \var{maxtries} attribute, which defaults 10.
++handling for the following HTTP response codes: 301, 302, 303, 307 and
++401.  For the 30x response codes listed above, the
++\mailheader{Location} header is used to fetch the actual URL.  For 401
++response codes (authentication required), basic HTTP authentication is
++performed.  For the 30x response codes, recursion is bounded by the
++value of the \var{maxtries} attribute, which defaults to 10.
+ 
+ \note{According to the letter of \rfc{2616}, 301 and 302 responses to
+   POST requests must not be automatically redirected without
+Index: Doc/lib/liburllib2.tex
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Doc/lib/liburllib2.tex,v
+retrieving revision 1.6.8.3
+retrieving revision 1.6.8.5
+diff -u -r1.6.8.3 -r1.6.8.5
+--- Doc/lib/liburllib2.tex	16 May 2003 03:08:36 -0000	1.6.8.3
++++ Doc/lib/liburllib2.tex	24 Jul 2003 01:45:16 -0000	1.6.8.5
+@@ -419,12 +419,13 @@
+ if you can't but another \class{Handler} might.
+ 
+ \note{The default implementation of this method does not strictly
+- follow \rfc{2616}: it allows automatic 302 redirection of POST
+- requests, because essentially all HTTP clients do this.}
+-
++ follow \rfc{2616}, which says that 301 and 302 responses to POST
++ requests must not be automatically redirected without confirmation by
++ the user.  In reality, browsers do allow automatic redirection of
++ these responses, changing the POST to a GET, and the default
++ implementation reproduces this behavior.}
+ \end{methoddesc}
+ 
+-
+ \begin{methoddesc}[HTTPRedirectHandler]{http_error_301}{req,
+                                                   fp, code, msg, hdrs}
+ Redirect to the \code{Location:} URL.  This method is called by
+@@ -441,9 +442,16 @@
+ \begin{methoddesc}[HTTPRedirectHandler]{http_error_303}{req,
+                                                   fp, code, msg, hdrs}
+ The same as \method{http_error_301()}, but called for the
+-`see other' redirect response.
++`see other' response.
+ \end{methoddesc}
+ 
++\begin{methoddesc}[HTTPRedirectHandler]{http_error_307}{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{methoddescni}[ProxyHandler]{\var{protocol}_open}{request}
+Index: Doc/lib/libwarnings.tex
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Doc/lib/libwarnings.tex,v
+retrieving revision 1.6.16.1
+retrieving revision 1.6.16.2
+diff -u -r1.6.16.1 -r1.6.16.2
+--- Doc/lib/libwarnings.tex	12 Mar 2002 19:51:16 -0000	1.6.16.1
++++ Doc/lib/libwarnings.tex	1 Jul 2003 21:48:57 -0000	1.6.16.2
+@@ -174,7 +174,7 @@
+ \begin{funcdesc}{showwarning}{message, category, filename,
+ 			     lineno\optional{, file}}
+ Write a warning to a file.  The default implementation calls
+-\code{showwarning(\var{message}, \var{category}, \var{filename},
++\code{formatwarning(\var{message}, \var{category}, \var{filename},
+ \var{lineno})} and writes the resulting string to \var{file}, which
+ defaults to \code{sys.stderr}.  You may replace this function with an
+ alternative implementation by assigning to
+Index: Doc/lib/tkinter.tex
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Doc/lib/tkinter.tex,v
+retrieving revision 1.10.6.7
+retrieving revision 1.10.6.9
+diff -u -r1.10.6.7 -r1.10.6.9
+--- Doc/lib/tkinter.tex	20 May 2003 15:20:33 -0000	1.10.6.7
++++ Doc/lib/tkinter.tex	28 Jul 2003 14:39:37 -0000	1.10.6.9
+@@ -1763,13 +1763,15 @@
+ widgets that \code{[incr Widgets]} does, and is almost as complete as
+ Tix, lacking however Tix's fast \class{HList} widget for drawing trees.
+ }
+-\seetitle[http://tkinter.effbot.org]{Tkinter3000}{
+-is a Widget Construction Kit that allows you to write new Tkinter
+-widgets in Python using Mixins. It is built on top of Tkinter,
+-and does not offer the extended range of widgets that \refmodule{Tix} does,
+-but does allow a form of  building mega-widgets. The project is
+-still in the early stages.
+-}
++
++\seetitle[http://tkinter.effbot.org/]{Tkinter3000 Widget Construction
++          Kit (WCK)}{%
++is a library that allows you to write new Tkinter widgets in pure
++Python.  The WCK framework gives you full control over widget
++creation, configuration, screen appearance, and event handling.  WCK
++widgets can be very fast and light-weight, since they can operate
++directly on Python data structures, without having to transfer data
++through the Tk/Tcl layer.}
+ \end{seealso*}
+ 
+ 
+@@ -1818,7 +1820,7 @@
+ and GUI elements, simply by taking existing controls, and creating a
+ derived class which simply adds or redefines the desired behavior.
+ }
+-\seetitle[http://www.daa.com.au/\textasciitilde james/pygtk/]{PyGTK}{
++\seetitle[http://www.daa.com.au/\textasciitilde james/software/pygtk/]{PyGTK}{
+ is a set of bindings for the \ulink{GTK}{http://www.gtk.org/} widget set.
+ It provides an object oriented interface that is slightly higher
+ level than the C one. It automatically does all the type casting and
+Index: Doc/mac/toolbox.tex
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Doc/mac/toolbox.tex,v
+retrieving revision 1.4
+retrieving revision 1.4.12.1
+diff -u -r1.4 -r1.4.12.1
+--- Doc/mac/toolbox.tex	11 Sep 2001 21:25:10 -0000	1.4
++++ Doc/mac/toolbox.tex	29 Jul 2003 17:44:24 -0000	1.4.12.1
+@@ -23,7 +23,7 @@
+ 
+ \strong{Warning!}  These modules are not yet documented.  If you
+ wish to contribute documentation of any of these modules, please get
+-in touch with \email{python-docs@python.org}.
++in touch with \email{docs@python.org}.
+ 
+ \localmoduletable
+ 
+Index: Doc/mac/undoc.tex
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Doc/mac/undoc.tex,v
+retrieving revision 1.7
+retrieving revision 1.7.10.1
+diff -u -r1.7 -r1.7.10.1
+--- Doc/mac/undoc.tex	1 Oct 2001 17:04:10 -0000	1.7
++++ Doc/mac/undoc.tex	29 Jul 2003 17:44:24 -0000	1.7.10.1
+@@ -4,7 +4,7 @@
+ The modules in this chapter are poorly documented (if at all).  If you
+ wish to contribute documentation of any of these modules, please get in
+ touch with
+-\ulink{\email{python-docs@python.org}}{mailto:python-docs@python.org}.
++\ulink{\email{docs@python.org}}{mailto:docs@python.org}.
+ 
+ \localmoduletable
+ 
+Index: Doc/perl/l2hinit.perl
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Doc/perl/l2hinit.perl,v
+retrieving revision 1.58.6.1
+retrieving revision 1.58.6.2
+diff -u -r1.58.6.1 -r1.58.6.2
+--- Doc/perl/l2hinit.perl	22 Mar 2002 17:23:03 -0000	1.58.6.1
++++ Doc/perl/l2hinit.perl	27 Jun 2003 18:27:21 -0000	1.58.6.2
+@@ -385,12 +385,14 @@
+ 
+ # In addition to the standard stuff, add label to allow named node files and
+ # support suppression of the page complete (for HTML Help use).
++$MY_CONTENTS_PAGE = '';
+ sub do_cmd_tableofcontents {
+     local($_) = @_;
+     $TITLE = $toc_title;
+     $tocfile = $CURRENT_FILE;
+     my($closures,$reopens) = preserve_open_tags();
+     anchor_label('contents', $CURRENT_FILE, $_);	# this is added
++    $MY_CONTENTS_PAGE = "$CURRENT_FILE";
+     join('', "<BR>\n\\tableofchildlinks[off]", $closures
+ 	 , make_section_heading($toc_title, 'H2'), $toc_mark
+ 	 , $reopens, $_);
+@@ -619,8 +621,8 @@
+             "<link rel=\"STYLESHEET\" href=\"$STYLESHEET\">\n",
+             "<link rel=\"first\" href=\"$FILE.html\">\n",
+             ($HAVE_TABLE_OF_CONTENTS
+-             ? ('<link rel="contents" href="contents.html" title="Contents">'
+-                . "\n")
++             ? ("<link rel='contents' href='$MY_CONTENTS_PAGE'"
++                . " title='Contents'>\n")
+              : ''),
+             ($HAVE_GENERAL_INDEX
+              ? '<link rel="index" href="genindex.html" title="Index">'
+Index: Doc/ref/ref2.tex
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref2.tex,v
+retrieving revision 1.34.6.7
+retrieving revision 1.34.6.8
+diff -u -r1.34.6.7 -r1.34.6.8
+--- Doc/ref/ref2.tex	19 Jan 2003 14:54:08 -0000	1.34.6.7
++++ Doc/ref/ref2.tex	6 Sep 2003 03:48:52 -0000	1.34.6.8
+@@ -284,25 +284,39 @@
+ \subsection{Reserved classes of identifiers\label{id-classes}}
+ 
+ Certain classes of identifiers (besides keywords) have special
+-meanings.  These are:
++meanings.  These classes are identified by the patterns of leading and
++trailing underscore characters:
+ 
+-\begin{tableiii}{l|l|l}{code}{Form}{Meaning}{Notes}
+-\lineiii{_*}{Not imported by \samp{from \var{module} import *}}{(1)}
+-\lineiii{__*__}{System-defined name}{}
+-\lineiii{__*}{Class-private name mangling}{}
+-\end{tableiii}
+-
+-See sections: \ref{import}, ``The \keyword{import} statement'';
+-\ref{specialnames}, ``Special method names'';
+-\ref{atom-identifiers}, ``Identifiers (Names)''.
++\begin{description}
+ 
+-Note:
++\item[\code{_*}]
++  Not imported by \samp{from \var{module} import *}.  The special
++  identifier \samp{_} is used in the interactive interpreter to store
++  the result of the last evaluation; it is stored in the
++  \module{__builtin__} module.  When not in interactive mode, \samp{_}
++  has no special meaning and is not defined.
++  See section~\ref{import}, ``The \keyword{import} statement.''
++
++  \note{The name \samp{_} is often used in conjunction with
++  internationalization; refer to the documentation for the
++  \ulink{\module{gettext} module}{../lib/module-gettext.html} for more
++  information on this convention.}
++
++\item[\code{__*__}]
++  System-defined names.  These names are defined by the interpreter
++  and it's implementation (including the standard library);
++  applications should not expect to define additional names using this
++  convention.  The set of names of this class defined by Python may be
++  extended in future versions.
++  See section~\ref{specialnames}, ``Special method names.''
++
++\item[\code{__*}]
++  Class-private names.  Names in this category, when used within the
++  context of a class definition, are re-written to use a mangled for
++  to help avoid name clashes between ``private'' attributes of base
++  and derived classes.
++  See section~\ref{atom-identifiers}, ``Identifiers (Names).''
+ 
+-\begin{description}
+-\item[(1)] The special identifier \samp{_} is used in the interactive
+-interpreter to store the result of the last evaluation; it is stored
+-in the \module{__builtin__} module.  When not in interactive mode,
+-\samp{_} has no special meaning and is not defined.
+ \end{description}
+ 
+ 
+Index: Doc/ref/ref3.tex
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v
+retrieving revision 1.82.4.9
+retrieving revision 1.82.4.10
+diff -u -r1.82.4.9 -r1.82.4.10
+--- Doc/ref/ref3.tex	12 May 2003 13:50:41 -0000	1.82.4.9
++++ Doc/ref/ref3.tex	24 Jul 2003 01:46:39 -0000	1.82.4.10
+@@ -1486,7 +1486,7 @@
+ These methods are called to implement the augmented arithmetic
+ operations (\code{+=}, \code{-=}, \code{*=}, \code{/=}, \code{\%=},
+ \code{**=}, \code{<}\code{<=}, \code{>}\code{>=}, \code{\&=},
+-\code{\^=}, \code{|=}).  These methods should attempt to do the
++\code{\textasciicircum=}, \code{|=}).  These methods should attempt to do the
+ operation in-place (modifying \var{self}) and return the result (which
+ could be, but does not have to be, \var{self}).  If a specific method
+ is not defined, the augmented operation falls back to the normal
+Index: Doc/ref/ref5.tex
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref5.tex,v
+retrieving revision 1.53.4.11
+retrieving revision 1.53.4.12
+diff -u -r1.53.4.11 -r1.53.4.12
+--- Doc/ref/ref5.tex	16 Dec 2002 23:19:19 -0000	1.53.4.11
++++ Doc/ref/ref5.tex	27 Jun 2003 17:13:17 -0000	1.53.4.12
+@@ -169,6 +169,11 @@
+ square brackets:
+ 
+ \begin{productionlist}
++  \production{test}
++             {\token{and_test} ( "or" \token{and_test} )*
++              | \token{lambda_form}}
++  \production{testlist}
++             {\token{test} ( "," \token{test} )* [ "," ]}
+   \production{list_display}
+              {"[" [\token{listmaker}] "]"}
+   \production{listmaker}
+Index: Doc/texinputs/boilerplate.tex
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/Attic/boilerplate.tex,v
+retrieving revision 1.70.2.1.2.11
+retrieving revision 1.70.2.1.2.13
+diff -u -r1.70.2.1.2.11 -r1.70.2.1.2.13
+--- Doc/texinputs/boilerplate.tex	29 May 2003 18:49:32 -0000	1.70.2.1.2.11
++++ Doc/texinputs/boilerplate.tex	29 Jul 2003 17:44:24 -0000	1.70.2.1.2.13
+@@ -2,10 +2,10 @@
+ 	Fred L. Drake, Jr., editor}
+ \authoraddress{
+ 	\strong{PythonLabs}\\
+-	Email: \email{python-docs@python.org}
++	Email: \email{docs@python.org}
+ }
+ 
+-\date{30 May 2003}		% XXX update before final release!
+-\release{2.2.3}			% software release, not documentation
++\date{\today}			% XXX update before final release!
++\release{2.2.3+}		% software release, not documentation
+ \setreleaseinfo{}		% empty for final release
+ \setshortversion{2.2}		% major.minor only for software
+Index: Doc/tools/getpagecounts
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Doc/tools/getpagecounts,v
+retrieving revision 1.7.26.1
+retrieving revision 1.7.26.3
+diff -u -r1.7.26.1 -r1.7.26.3
+--- Doc/tools/getpagecounts	17 Apr 2002 03:29:26 -0000	1.7.26.1
++++ Doc/tools/getpagecounts	29 Jul 2003 17:44:24 -0000	1.7.26.3
+@@ -2,7 +2,7 @@
+ 
+ """Generate a page count report of the PostScript version of the manuals."""
+ 
+-__version__ = '$Revision: 1.7.26.1 $'
++__version__ = '$Revision: 1.7.26.3 $'
+ 
+ import getopt
+ import sys
+@@ -65,7 +65,7 @@
+ of it!  To locate published copies of the larger manuals, or other
+ Python reference material, consult the Python Bookstore at:
+ 
+-             http://www.amk.ca/bookstore/
++    http://www.python.org/cgi-bin/moinmoin/PythonBooks
+ 
+ The following manuals are included in this package:
+ """
+@@ -73,7 +73,7 @@
+ 
+ 
+ If you have any questions, comments, or suggestions regarding these
+-documents, please send them via email to python-docs@python.org.
++documents, please send them via email to docs@python.org.
+ """
+ 
+ def count_pages(filename):
+Index: Doc/tools/html2texi.pl
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Doc/tools/html2texi.pl,v
+retrieving revision 1.3
+retrieving revision 1.3.30.1
+diff -u -r1.3 -r1.3.30.1
+--- Doc/tools/html2texi.pl	14 Jan 1999 18:17:07 -0000	1.3
++++ Doc/tools/html2texi.pl	29 Jul 2003 17:44:24 -0000	1.3.30.1
+@@ -137,7 +137,7 @@
+ # Index:
+ #   Perhaps double-check that every tag mentioned in the index is found
+ #     in the text.
+-# Python:  email to python-docs@python.org, to get their feedback.
++# Python:  email to docs@python.org, to get their feedback.
+ #   Compare to existing lib/ Info manual
+ #   Write the hooks into info-look; replace pyliblookup1-1.tar.gz.
+ #   Postpass to remove extra quotation marks around typography already in
+Index: Doc/tools/mkackshtml
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Doc/tools/mkackshtml,v
+retrieving revision 1.2
+retrieving revision 1.2.22.1
+diff -u -r1.2 -r1.2.22.1
+--- Doc/tools/mkackshtml	12 Feb 2001 19:12:55 -0000	1.2
++++ Doc/tools/mkackshtml	29 Jul 2003 17:44:24 -0000	1.2.22.1
+@@ -52,7 +52,7 @@
+ documentation.  This list is probably not complete -- if you feel that
+ you or anyone else should be on this list, please let us know (send
+ email to <a
+-href="mailto:python-docs@python.org">python-docs@python.org</a>), and
++href="mailto:docs@python.org">docs@python.org</a>), and
+ we will be glad to correct the problem.</p>
+ 
+ <p>It is only with the input and contributions of the Python community
+Index: Doc/tools/mkhowto
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Doc/tools/mkhowto,v
+retrieving revision 1.31
+retrieving revision 1.31.6.1
+diff -u -r1.31 -r1.31.6.1
+--- Doc/tools/mkhowto	4 Dec 2001 16:32:04 -0000	1.31
++++ Doc/tools/mkhowto	24 Jul 2003 02:00:18 -0000	1.31.6.1
+@@ -640,11 +640,9 @@
+ 
+ def new_index(filename, label="genindex"):
+     fp = open(filename, "w")
+-    fp.write(r"""\
+-\begin{theindex}
+-\label{%s}
+-\end{theindex}
+-""" % label)
++    fp.write("\\begin{theindex}\n"
++             "\\label{%s}\n"
++             "\\end{theindex}\n" % label)
+     fp.close()
+ 
+ 
+Index: Doc/tools/sgmlconv/README
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Doc/tools/sgmlconv/README,v
+retrieving revision 1.6
+retrieving revision 1.6.22.1
+diff -u -r1.6 -r1.6.22.1
+--- Doc/tools/sgmlconv/README	22 Nov 2000 16:58:25 -0000	1.6
++++ Doc/tools/sgmlconv/README	29 Jul 2003 17:44:24 -0000	1.6.22.1
+@@ -13,7 +13,7 @@
+ 	cd Doc/<document-dir>
+ 	make -f ../tools/sgmlconv/make.rules TOOLSDIR=../tools
+ 
+-Please send comments and bug reports to python-docs@python.org.
++Please send comments and bug reports to docs@python.org.
+ 
+ 
+ What do the tools do?
+Index: Doc/tut/tut.tex
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v
+retrieving revision 1.156.4.1.2.17
+retrieving revision 1.156.4.1.2.20
+diff -u -r1.156.4.1.2.17 -r1.156.4.1.2.20
+--- Doc/tut/tut.tex	7 May 2003 16:02:06 -0000	1.156.4.1.2.17
++++ Doc/tut/tut.tex	7 Jul 2003 21:01:09 -0000	1.156.4.1.2.20
+@@ -141,7 +141,7 @@
+ references to Monty Python skits in documentation is not only allowed,
+ it is encouraged!
+ 
+-\section{Where From Here \label{where}}
++%\section{Where From Here \label{where}}
+ 
+ Now that you are all excited about Python, you'll want to examine it
+ in some more detail.  Since the best way to learn a language is
+@@ -299,10 +299,21 @@
+ 
+ (assuming that the interpreter is on the user's \envvar{PATH}) at the
+ beginning of the script and giving the file an executable mode.  The
+-\samp{\#!} must be the first two characters of the file.  Note that
++\samp{\#!} must be the first two characters of the file.  On some
++platforms, this first line must end with a \UNIX-style line ending
++(\character{\e n}), not a Mac OS (\character{\e r}) or Windows
++(\character{\e r\e n}) line ending.  Note that
+ the hash, or pound, character, \character{\#}, is used to start a
+ comment in Python.
+ 
++The script can be given a executable mode, or permission, using the
++\program{chmod} command:
++
++\begin{verbatim}
++% chmod +x myscript.py
++\end{verbatim}
++
++
+ \subsection{The Interactive Startup File \label{startup}}
+ 
+ % XXX This should probably be dumped in an appendix, since most people
+@@ -1388,8 +1399,9 @@
+ 
+ \strong{Important warning:}  The default value is evaluated only once.
+ This makes a difference when the default is a mutable object such as a
+-list or dictionary.  For example, the following function accumulates
+-the arguments passed to it on subsequent calls:
++list, dictionary, or instances of most classes.  For example, the
++following function accumulates the arguments passed to it on
++subsequent calls:
+ 
+ \begin{verbatim}
+ def f(a, L=[]):
+Index: Doc/whatsnew/whatsnew22.tex
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew22.tex,v
+retrieving revision 1.54.2.4
+retrieving revision 1.54.2.5
+diff -u -r1.54.2.4 -r1.54.2.5
+--- Doc/whatsnew/whatsnew22.tex	20 May 2003 18:13:14 -0000	1.54.2.4
++++ Doc/whatsnew/whatsnew22.tex	10 Sep 2004 19:51:20 -0000	1.54.2.5
+@@ -1,6 +1,6 @@
+ \documentclass{howto}
+ 
+-% $Id: whatsnew22.tex,v 1.54.2.4 2003/05/20 18:13:14 akuchling Exp $
++% $Id: whatsnew22.tex,v 1.54.2.5 2004/09/10 19:51:20 akuchling Exp $
+ 
+ \title{What's New in Python 2.2}
+ \release{1.02}
+@@ -344,7 +344,7 @@
+ example, \class{D}'s \method{save()} method would look like this:
+ 
+ \begin{verbatim}
+-class D:
++class D (B,C):
+     def save (self):
+ 	# Call superclass .save()
+         super(D, self).save()
+Index: Include/patchlevel.h
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Include/patchlevel.h,v
+retrieving revision 2.60.2.1.2.12
+retrieving revision 2.60.2.1.2.13
+diff -u -r2.60.2.1.2.12 -r2.60.2.1.2.13
+--- Include/patchlevel.h	30 May 2003 13:41:07 -0000	2.60.2.1.2.12
++++ Include/patchlevel.h	31 May 2003 03:19:28 -0000	2.60.2.1.2.13
+@@ -26,7 +26,7 @@
+ #define PY_RELEASE_SERIAL	0
+ 
+ /* Version as a string */
+-#define PY_VERSION		"2.2.3"
++#define PY_VERSION		"2.2.3+"
+ 
+ /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2.
+    Use this for numeric comparisons, e.g. #if PY_VERSION_HEX >= ... */
+Index: Lib/SimpleXMLRPCServer.py
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Lib/SimpleXMLRPCServer.py,v
+retrieving revision 1.2
+retrieving revision 1.2.10.1
+diff -u -r1.2 -r1.2.10.1
+--- Lib/SimpleXMLRPCServer.py	29 Sep 2001 04:54:33 -0000	1.2
++++ Lib/SimpleXMLRPCServer.py	3 Feb 2005 14:58:26 -0000	1.2.10.1
+@@ -161,7 +161,8 @@
+                     try:
+                         func = _resolve_dotted_attribute(
+                             self.server.instance,
+-                            method
++                            method,
++                            self.server.allow_dotted_names
+                             )
+                     except AttributeError:
+                         pass
+@@ -178,11 +179,20 @@
+             BaseHTTPServer.BaseHTTPRequestHandler.log_request(self, code, size)
+ 
+ 
+-def _resolve_dotted_attribute(obj, attr):
++def _resolve_dotted_attribute(obj, attr, allow_dotted_names=True):
+     """Resolves a dotted attribute name to an object.  Raises
+     an AttributeError if any attribute in the chain starts with a '_'.
++
++    If the optional allow_dotted_names argument is false, dots are not
++    supported and this function operates similar to getattr(obj, attr).
+     """
+-    for i in attr.split('.'):
++
++    if allow_dotted_names:
++        attrs = attr.split('.')
++    else:
++        attrs = [attr]
++
++    for i in attrs:
+         if i.startswith('_'):
+             raise AttributeError(
+                 'attempt to access private attribute "%s"' % i
+@@ -206,7 +216,7 @@
+         self.instance = None
+         SocketServer.TCPServer.__init__(self, addr, requestHandler)
+ 
+-    def register_instance(self, instance):
++    def register_instance(self, instance, allow_dotted_names=False):
+         """Registers an instance to respond to XML-RPC requests.
+ 
+         Only one instance can be installed at a time.
+@@ -225,9 +235,23 @@
+ 
+         If a registered function matches a XML-RPC request, then it
+         will be called instead of the registered instance.
++
++        If the optional allow_dotted_names argument is true and the
++        instance does not have a _dispatch method, method names
++        containing dots are supported and resolved, as long as none of
++        the name segments start with an '_'.
++
++            *** SECURITY WARNING: ***
++
++            Enabling the allow_dotted_names options allows intruders
++            to access your module's global variables and may allow
++            intruders to execute arbitrary code on your machine.  Only
++            use this option on a secure, closed network.
++
+         """
+ 
+         self.instance = instance
++        self.allow_dotted_names = allow_dotted_names
+ 
+     def register_function(self, function, name = None):
+         """Registers a function to respond to XML-RPC requests.
+Index: Lib/copy.py
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Lib/copy.py,v
+retrieving revision 1.22.10.5
+retrieving revision 1.22.10.6
+diff -u -r1.22.10.5 -r1.22.10.6
+--- Lib/copy.py	12 Aug 2002 20:21:43 -0000	1.22.10.5
++++ Lib/copy.py	14 Jun 2003 07:20:04 -0000	1.22.10.6
+@@ -112,6 +112,7 @@
+ d[types.TypeType] = _copy_atomic
+ d[types.XRangeType] = _copy_atomic
+ d[types.ClassType] = _copy_atomic
++d[types.BuiltinFunctionType] = _copy_atomic
+ 
+ def _copy_list(x):
+     return x[:]
+@@ -211,6 +212,8 @@
+     pass
+ d[types.TypeType] = _deepcopy_atomic
+ d[types.XRangeType] = _deepcopy_atomic
++d[types.ClassType] = _deepcopy_atomic
++d[types.BuiltinFunctionType] = _deepcopy_atomic
+ 
+ def _deepcopy_list(x, memo):
+     y = []
+Index: Lib/copy_reg.py
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Lib/copy_reg.py,v
+retrieving revision 1.9.6.1
+retrieving revision 1.9.6.2
+diff -u -r1.9.6.1 -r1.9.6.2
+--- Lib/copy_reg.py	28 Dec 2001 15:48:09 -0000	1.9.6.1
++++ Lib/copy_reg.py	7 Jun 2003 20:09:43 -0000	1.9.6.2
+@@ -29,10 +29,16 @@
+ 
+ # Example: provide pickling support for complex numbers.
+ 
+-def pickle_complex(c):
+-    return complex, (c.real, c.imag)
++try:
++    complex
++except NameError:
++    pass
++else:
+ 
+-pickle(type(1j), pickle_complex, complex)
++    def pickle_complex(c):
++        return complex, (c.real, c.imag)
++
++    pickle(complex, pickle_complex, complex)
+ 
+ # Support for picking new-style objects
+ 
+Index: Lib/difflib.py
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Lib/difflib.py,v
+retrieving revision 1.6.10.1
+retrieving revision 1.6.10.2
+diff -u -r1.6.10.1 -r1.6.10.2
+--- Lib/difflib.py	30 Oct 2002 06:33:33 -0000	1.6.10.1
++++ Lib/difflib.py	1 Jul 2003 15:12:33 -0000	1.6.10.2
+@@ -24,6 +24,11 @@
+ __all__ = ['get_close_matches', 'ndiff', 'restore', 'SequenceMatcher',
+            'Differ', 'IS_CHARACTER_JUNK', 'IS_LINE_JUNK']
+ 
++def _calculate_ratio(matches, length):
++    if length:
++        return 2.0 * matches / length
++    return 1.0
++
+ class SequenceMatcher:
+ 
+     """
+@@ -525,7 +530,7 @@
+ 
+         matches = reduce(lambda sum, triple: sum + triple[-1],
+                          self.get_matching_blocks(), 0)
+-        return 2.0 * matches / (len(self.a) + len(self.b))
++        return _calculate_ratio(matches, len(self.a) + len(self.b))
+ 
+     def quick_ratio(self):
+         """Return an upper bound on ratio() relatively quickly.
+@@ -554,7 +559,7 @@
+             avail[elt] = numb - 1
+             if numb > 0:
+                 matches = matches + 1
+-        return 2.0 * matches / (len(self.a) + len(self.b))
++        return _calculate_ratio(matches, len(self.a) + len(self.b))
+ 
+     def real_quick_ratio(self):
+         """Return an upper bound on ratio() very quickly.
+@@ -566,7 +571,7 @@
+         la, lb = len(self.a), len(self.b)
+         # can't have more matches than the number of elements in the
+         # shorter sequence
+-        return 2.0 * min(la, lb) / (la + lb)
++        return _calculate_ratio(min(la, lb), la + lb)
+ 
+ def get_close_matches(word, possibilities, n=3, cutoff=0.6):
+     """Use SequenceMatcher to return list of the best "good enough" matches.
+Index: Lib/httplib.py
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v
+retrieving revision 1.42.10.10
+retrieving revision 1.42.10.11
+diff -u -r1.42.10.10 -r1.42.10.11
+--- Lib/httplib.py	31 Jan 2003 14:07:31 -0000	1.42.10.10
++++ Lib/httplib.py	30 Jun 2003 15:01:26 -0000	1.42.10.11
+@@ -231,6 +231,10 @@
+         line = self.fp.readline()
+         if self.debuglevel > 0:
+             print "reply:", repr(line)
++        if not line:
++            # Presumably, the server closed the connection before
++            # sending a valid response.
++            raise BadStatusLine(line)
+         try:
+             [version, status, reason] = line.split(None, 2)
+         except ValueError:
+Index: Lib/inspect.py
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v
+retrieving revision 1.26.10.3
+retrieving revision 1.26.10.4
+diff -u -r1.26.10.3 -r1.26.10.4
+--- Lib/inspect.py	19 Jan 2003 14:16:19 -0000	1.26.10.3
++++ Lib/inspect.py	27 Jun 2003 18:16:21 -0000	1.26.10.4
+@@ -619,6 +619,8 @@
+     'args' is a list of the argument names (it may contain nested lists).
+     'varargs' and 'varkw' are the names of the * and ** arguments or None.
+     'defaults' is an n-tuple of the default values of the last n arguments."""
++    if ismethod(func):
++        func = func.im_func
+     if not isfunction(func): raise TypeError, 'arg is not a Python function'
+     args, varargs, varkw = getargs(func.func_code)
+     return args, varargs, varkw, func.func_defaults
+Index: Lib/mimetypes.py
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Lib/mimetypes.py,v
+retrieving revision 1.21
+retrieving revision 1.21.6.1
+diff -u -r1.21 -r1.21.6.1
+--- Lib/mimetypes.py	5 Dec 2001 15:58:29 -0000	1.21
++++ Lib/mimetypes.py	30 Oct 2003 15:13:41 -0000	1.21.6.1
+@@ -35,7 +35,7 @@
+     "/usr/local/etc/mime.types",                # Apache 1.3
+     ]
+ 
+-inited = 0
++inited = False
+ 
+ 
+ class MimeTypes:
+@@ -208,7 +208,7 @@
+     global guess_extension, guess_type
+     global suffix_map, types_map, encodings_map, common_types
+     global inited
+-    inited = 1
++    inited = True
+     db = MimeTypes()
+     if files is None:
+         files = knownfiles
+Index: Lib/os.py
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Lib/os.py,v
+retrieving revision 1.50.8.7
+retrieving revision 1.50.8.8
+diff -u -r1.50.8.7 -r1.50.8.8
+--- Lib/os.py	28 Mar 2003 22:31:41 -0000	1.50.8.7
++++ Lib/os.py	2 Jul 2003 02:51:15 -0000	1.50.8.8
+@@ -537,7 +537,7 @@
+     # At the moment, Windows doesn't implement spawnvp[e],
+     # so it won't have spawnlp[e] either.
+     def spawnlp(mode, file, *args):
+-        """spawnlp(mode, file, *args, env) -> integer
++        """spawnlp(mode, file, *args) -> integer
+ 
+ Execute file (which is looked for along $PATH) with arguments from
+ args in a subprocess with the supplied environment.
+Index: Lib/urllib2.py
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v
+retrieving revision 1.24.8.7
+retrieving revision 1.24.8.9
+diff -u -r1.24.8.7 -r1.24.8.9
+--- Lib/urllib2.py	22 May 2003 17:30:48 -0000	1.24.8.7
++++ Lib/urllib2.py	12 Jul 2003 07:35:35 -0000	1.24.8.9
+@@ -418,15 +418,15 @@
+         """
+         m = req.get_method()
+         if (code in (301, 302, 303, 307) and m in ("GET", "HEAD")
+-            or code in (302, 303) and m == "POST"):
+-            # Strictly (according to RFC 2616), 302 in response to a
+-            # POST MUST NOT cause a redirection without confirmation
++            or code in (301, 302, 303) and m == "POST"):
++            # Strictly (according to RFC 2616), 301 or 302 in response
++            # to a POST MUST NOT cause a redirection without confirmation
+             # from the user (of urllib2, in this case).  In practice,
+             # essentially all clients do redirect in this case, so we
+             # do the same.
+             return Request(newurl, headers=req.headers)
+         else:
+-            raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
++            raise HTTPError(req.get_full_url(), code, msg, headers, fp)
+ 
+     # Implementation note: To avoid the server sending us into an
+     # infinite loop, the request object needs to track what URLs we
+@@ -467,9 +467,9 @@
+ 
+     http_error_301 = http_error_303 = http_error_307 = http_error_302
+ 
+-    inf_msg = "The HTTP server returned a redirect error that would" \
++    inf_msg = "The HTTP server returned a redirect error that would " \
+               "lead to an infinite loop.\n" \
+-              "The last 302 error message was:\n"
++              "The last 30x error message was:\n"
+ 
+ class ProxyHandler(BaseHandler):
+     def __init__(self, proxies=None):
+Index: Lib/whichdb.py
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Lib/whichdb.py,v
+retrieving revision 1.12
+retrieving revision 1.12.8.1
+diff -u -r1.12 -r1.12.8.1
+--- Lib/whichdb.py	24 Oct 2001 20:33:34 -0000	1.12
++++ Lib/whichdb.py	14 Jun 2003 08:17:28 -0000	1.12.8.1
+@@ -29,15 +29,19 @@
+ 
+     # Check for dumbdbm next -- this has a .dir and and a .dat file
+     try:
+-        f = open(filename + os.extsep + "dat", "rb")
+-        f.close()
++        # First check for presence of files
++        sizes = os.stat(filename + os.extsep + "dat").st_size, \
++                os.stat(filename + os.extsep + "dir").st_size
++        # dumbdbm files with no keys are empty
++        if sizes == (0, 0):
++            return "dumbdbm"
+         f = open(filename + os.extsep + "dir", "rb")
+         try:
+             if f.read(1) in ["'", '"']:
+                 return "dumbdbm"
+         finally:
+             f.close()
+-    except IOError:
++    except (OSError, IOError):
+         pass
+ 
+     # See if the file exists, return None if not
+Index: Lib/xmlrpclib.py
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Lib/xmlrpclib.py,v
+retrieving revision 1.15
+retrieving revision 1.15.4.1
+diff -u -r1.15 -r1.15.4.1
+--- Lib/xmlrpclib.py	19 Dec 2001 21:40:04 -0000	1.15
++++ Lib/xmlrpclib.py	12 Jul 2003 07:53:52 -0000	1.15.4.1
+@@ -1,6 +1,6 @@
+ #
+ # XML-RPC CLIENT LIBRARY
+-# $Id: xmlrpclib.py,v 1.15 2001/12/19 21:40:04 effbot Exp $
++# $Id: xmlrpclib.py,v 1.15.4.1 2003/07/12 07:53:52 loewis Exp $
+ #
+ # an XML-RPC client interface for Python.
+ #
+@@ -439,7 +439,10 @@
+         if isinstance(values, Fault):
+             # fault instance
+             write("<fault>\n")
+-            self.__dump(vars(values))
++            self.__dump({
++                'faultCode': values.faultCode, 
++                'faultString': values.faultString,
++            })
+             write("</fault>\n")
+         else:
+             # parameter block
+Index: Lib/zipfile.py
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Lib/zipfile.py,v
+retrieving revision 1.20
+retrieving revision 1.20.6.1
+diff -u -r1.20 -r1.20.6.1
+--- Lib/zipfile.py	6 Dec 2001 06:23:25 -0000	1.20
++++ Lib/zipfile.py	18 Jun 2003 01:05:34 -0000	1.20.6.1
+@@ -1,6 +1,4 @@
+ "Read and write ZIP files."
+-# Written by James C. Ahlstrom jim@interet.com
+-# All rights transferred to CNRI pursuant to the Python contribution agreement
+ 
+ import struct, os, time
+ import binascii
+@@ -92,7 +90,18 @@
+     """Class with attributes describing each file in the ZIP archive."""
+ 
+     def __init__(self, filename="NoName", date_time=(1980,1,1,0,0,0)):
+-        self.filename = _normpath(filename) # Name of the file in the archive
++        self.orig_filename = filename   # Original file name in archive
++# Terminate the file name at the first null byte.  Null bytes in file
++# names are used as tricks by viruses in archives.
++        null_byte = filename.find(chr(0))
++        if null_byte >= 0:
++            filename = filename[0:null_byte]
++# This is used to ensure paths in generated ZIP files always use
++# forward slashes as the directory separator, as required by the
++# ZIP format specification.
++        if os.sep != "/":
++            filename = filename.replace(os.sep, "/")
++        self.filename = filename        # Normalized file name
+         self.date_time = date_time      # year, month, day, hour, min, sec
+         # Standard values:
+         self.compress_type = ZIP_STORED # Type of compression for the file
+@@ -133,17 +142,6 @@
+         return header + self.filename + self.extra
+ 
+ 
+-# This is used to ensure paths in generated ZIP files always use
+-# forward slashes as the directory separator, as required by the
+-# ZIP format specification.
+-if os.sep != "/":
+-    def _normpath(path):
+-        return path.replace(os.sep, "/")
+-else:
+-    def _normpath(path):
+-        return path
+-
+-
+ class ZipFile:
+     """ Class with methods to open, read, write, close, list zip files.
+ 
+@@ -281,10 +279,10 @@
+                                 + fheader[_FH_FILENAME_LENGTH]
+                                 + fheader[_FH_EXTRA_FIELD_LENGTH])
+             fname = fp.read(fheader[_FH_FILENAME_LENGTH])
+-            if fname != data.filename:
++            if fname != data.orig_filename:
+                 raise RuntimeError, \
+                       'File name in directory "%s" and header "%s" differ.' % (
+-                          data.filename, fname)
++                          data.orig_filename, fname)
+ 
+     def namelist(self):
+         """Return a list of file names in the archive."""
+Index: Lib/distutils/command/bdist_wininst.py
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/bdist_wininst.py,v
+retrieving revision 1.27.4.3
+retrieving revision 1.27.4.4
+diff -u -r1.27.4.3 -r1.27.4.4
+--- Lib/distutils/command/bdist_wininst.py	18 Apr 2002 02:30:39 -0000	1.27.4.3
++++ Lib/distutils/command/bdist_wininst.py	12 Jun 2003 17:29:57 -0000	1.27.4.4
+@@ -5,7 +5,7 @@
+ 
+ # created 2000/06/02, Thomas Heller
+ 
+-__revision__ = "$Id: bdist_wininst.py,v 1.27.4.3 2002/04/18 02:30:39 anthonybaxter Exp $"
++__revision__ = "$Id: bdist_wininst.py,v 1.27.4.4 2003/06/12 17:29:57 theller Exp $"
+ 
+ import sys, os, string
+ from distutils.core import Command
+@@ -82,7 +82,7 @@
+ 
+         self.run_command('build')
+ 
+-        install = self.reinitialize_command('install')
++        install = self.reinitialize_command('install', reinit_subcommands=1)
+         install.root = self.bdist_dir
+         install.warn_dir = 0
+ 
+Index: Lib/distutils/command/install_scripts.py
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/install_scripts.py,v
+retrieving revision 1.10.26.1
+retrieving revision 1.10.26.2
+diff -u -r1.10.26.1 -r1.10.26.2
+--- Lib/distutils/command/install_scripts.py	22 Feb 2002 13:19:54 -0000	1.10.26.1
++++ Lib/distutils/command/install_scripts.py	27 Jun 2003 19:37:16 -0000	1.10.26.2
+@@ -5,7 +5,7 @@
+ 
+ # contributed by Bastian Kleineidam
+ 
+-__revision__ = "$Id: install_scripts.py,v 1.10.26.1 2002/02/22 13:19:54 mwh Exp $"
++__revision__ = "$Id: install_scripts.py,v 1.10.26.2 2003/06/27 19:37:16 montanaro Exp $"
+ 
+ import os
+ from distutils.core import Command
+@@ -50,7 +50,7 @@
+                 if self.dry_run:
+                     self.announce("changing mode of %s" % file)
+                 else:
+-                    mode = ((os.stat(file)[ST_MODE]) | 0111) & 07777
++                    mode = ((os.stat(file)[ST_MODE]) | 0555) & 07777
+                     self.announce("changing mode of %s to %o" % (file, mode))
+                     os.chmod(file, mode)
+ 
+Index: Lib/email/Message.py
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Lib/email/Message.py,v
+retrieving revision 1.9.6.4
+retrieving revision 1.9.6.6
+diff -u -r1.9.6.4 -r1.9.6.6
+--- Lib/email/Message.py	8 May 2003 04:00:04 -0000	1.9.6.4
++++ Lib/email/Message.py	3 Sep 2003 04:14:01 -0000	1.9.6.6
+@@ -58,6 +58,23 @@
+     else:
+         return param
+ 
++def _parseparam(s):
++    plist = []
++    while s[:1] == ';':
++        s = s[1:]
++        end = s.find(';')
++        while end > 0 and s.count('"', 0, end) % 2:
++            end = s.find(';', end + 1)
++        if end < 0:
++            end = len(s)
++        f = s[:end]
++        if '=' in f:
++            i = f.index('=')
++            f = f[:i].strip().lower() + '=' + f[i+1:].strip()
++        plist.append(f.strip())
++        s = s[end:]
++    return plist
++
+ 
+ def _unquotevalue(value):
+     if isinstance(value, TupleType):
+@@ -525,7 +542,7 @@
+         if value is missing:
+             return failobj
+         params = []
+-        for p in paramre.split(value):
++        for p in _parseparam(';' + value):
+             try:
+                 name, val = p.split('=', 1)
+                 name = name.strip()
+@@ -571,13 +588,16 @@
+         Parameter keys are always compared case insensitively.  The return
+         value can either be a string, or a 3-tuple if the parameter was RFC
+         2231 encoded.  When it's a 3-tuple, the elements of the value are of
+-        the form (CHARSET, LANGUAGE, VALUE), where LANGUAGE may be the empty
+-        string.  Your application should be prepared to deal with these, and
+-        can convert the parameter to a Unicode string like so:
++        the form (CHARSET, LANGUAGE, VALUE).  Note that both CHARSET and
++        LANGUAGE can be None, in which case you should consider VALUE to be
++        encoded in the us-ascii charset.  You can usually ignore LANGUAGE.
++
++        Your application should be prepared to deal with 3-tuple return
++        values, and can convert the parameter to a Unicode string like so:
+ 
+             param = msg.get_param('foo')
+             if isinstance(param, tuple):
+-                param = unicode(param[2], param[0])
++                param = unicode(param[2], param[0] or 'us-ascii')
+ 
+         In any case, the parameter value (either the returned string, or the
+         VALUE item in the 3-tuple) is always unquoted, unless unquote is set
+@@ -708,7 +728,7 @@
+         if isinstance(filename, TupleType):
+             # It's an RFC 2231 encoded parameter
+             newvalue = _unquotevalue(filename)
+-            return unicode(newvalue[2], newvalue[0])
++            return unicode(newvalue[2], newvalue[0] or 'us-ascii')
+         else:
+             newvalue = _unquotevalue(filename.strip())
+             return newvalue
+@@ -725,7 +745,8 @@
+             return failobj
+         if isinstance(boundary, TupleType):
+             # RFC 2231 encoded, so decode.  It better end up as ascii
+-            return unicode(boundary[2], boundary[0]).encode('us-ascii')
++            charset = boundary[0] or 'us-ascii'
++            return unicode(boundary[2], charset).encode('us-ascii')
+         return _unquotevalue(boundary.strip())
+ 
+     def set_boundary(self, boundary):
+@@ -792,7 +813,8 @@
+             return failobj
+         if isinstance(charset, TupleType):
+             # RFC 2231 encoded, so decode it, and it better end up as ascii.
+-            charset = unicode(charset[2], charset[0]).encode('us-ascii')
++            pcharset = charset[0] or 'us-ascii'
++            charset = unicode(charset[2], pcharset).encode('us-ascii')
+         # RFC 2046, $4.1.2 says charsets are not case sensitive
+         return charset.lower()
+ 
+Index: Lib/email/Utils.py
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Lib/email/Utils.py,v
+retrieving revision 1.9.6.2
+retrieving revision 1.9.6.3
+diff -u -r1.9.6.2 -r1.9.6.3
+--- Lib/email/Utils.py	21 Mar 2003 21:09:31 -0000	1.9.6.2
++++ Lib/email/Utils.py	19 Aug 2003 04:56:47 -0000	1.9.6.3
+@@ -280,7 +280,7 @@
+     import urllib
+     parts = s.split("'", 2)
+     if len(parts) == 1:
+-        return None, None, s
++        return None, None, urllib.unquote(s)
+     charset, language, s = parts
+     return charset, language, urllib.unquote(s)
+ 
+Index: Lib/email/__init__.py
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Lib/email/__init__.py,v
+retrieving revision 1.4.10.8
+retrieving revision 1.4.10.9
+diff -u -r1.4.10.8 -r1.4.10.9
+--- Lib/email/__init__.py	29 May 2003 20:09:31 -0000	1.4.10.8
++++ Lib/email/__init__.py	19 Aug 2003 04:56:47 -0000	1.4.10.9
+@@ -4,7 +4,7 @@
+ """A package for parsing, handling, and generating email messages.
+ """
+ 
+-__version__ = '2.5.3'
++__version__ = '2.5.4'
+ 
+ __all__ = [
+     'base64MIME',
+Index: Lib/email/test/test_email.py
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v
+retrieving revision 1.17.2.7
+retrieving revision 1.17.2.9
+diff -u -r1.17.2.7 -r1.17.2.9
+--- Lib/email/test/test_email.py	8 May 2003 04:00:05 -0000	1.17.2.7
++++ Lib/email/test/test_email.py	3 Sep 2003 04:14:29 -0000	1.17.2.9
+@@ -313,6 +313,13 @@
+         msg = self._msgobj('msg_22.txt')
+         self.assertEqual(msg.get_payload(1).get_param('name'), 'wibble.JPG')
+ 
++    def test_get_param_with_semis_in_quotes(self):
++        msg = email.message_from_string(
++            'Content-Type: image/pjpeg; name="Jim&amp;&amp;Jill"\n')
++        self.assertEqual(msg.get_param('name'), 'Jim&amp;&amp;Jill')
++        self.assertEqual(msg.get_param('name', unquote=False),
++                         '"Jim&amp;&amp;Jill"')
++
+     def test_has_key(self):
+         msg = email.message_from_string('Header: exists')
+         self.failUnless(msg.has_key('header'))
+@@ -2650,6 +2657,43 @@
+         self.assertEqual(msg.get_param('NAME'),
+                          (None, None, 'file____C__DOCUMENTS_20AND_20SETTINGS_FABIEN_LOCAL_20SETTINGS_TEMP_nsmail.htm'))
+ 
++    def test_rfc2231_no_language_or_charset_in_filename(self):
++        m = '''\
++Content-Disposition: inline;
++\tfilename*0="This%20is%20even%20more%20";
++\tfilename*1="%2A%2A%2Afun%2A%2A%2A%20";
++\tfilename*2="is it not.pdf"
++
++'''
++        msg = email.message_from_string(m)
++        self.assertEqual(msg.get_filename(),
++                         'This is even more ***fun*** is it not.pdf')
++
++    def test_rfc2231_no_language_or_charset_in_boundary(self):
++        m = '''\
++Content-Type: multipart/alternative;
++\tboundary*0="This%20is%20even%20more%20";
++\tboundary*1="%2A%2A%2Afun%2A%2A%2A%20";
++\tboundary*2="is it not.pdf"
++
++'''
++        msg = email.message_from_string(m)
++        self.assertEqual(msg.get_boundary(),
++                         'This is even more ***fun*** is it not.pdf')
++
++    def test_rfc2231_no_language_or_charset_in_charset(self):
++        # This is a nonsensical charset value, but tests the code anyway
++        m = '''\
++Content-Type: text/plain;
++\tcharset*0="This%20is%20even%20more%20";
++\tcharset*1="%2A%2A%2Afun%2A%2A%2A%20";
++\tcharset*2="is it not.pdf"
++
++'''
++        msg = email.message_from_string(m)
++        self.assertEqual(msg.get_content_charset(),
++                         'this is even more ***fun*** is it not.pdf')
++
+ 
+ 
+ def _testclasses():
+Index: Lib/encodings/rot_13.py
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Lib/encodings/rot_13.py,v
+retrieving revision 1.2
+retrieving revision 1.2.20.1
+diff -u -r1.2 -r1.2.20.1
+--- Lib/encodings/rot_13.py	16 May 2001 09:41:45 -0000	1.2
++++ Lib/encodings/rot_13.py	18 Jul 2003 02:45:27 -0000	1.2.20.1
+@@ -1,4 +1,4 @@
+-#!/usr/local/bin/python2.1
++#!/usr/bin/env python
+ """ Python Character Mapping Codec for ROT13.
+ 
+     See http://ucsub.colorado.edu/~kominek/rot13/ for details.
+Index: Lib/lib-tk/Tkinter.py
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/Tkinter.py,v
+retrieving revision 1.160.10.3
+retrieving revision 1.160.10.4
+diff -u -r1.160.10.3 -r1.160.10.4
+--- Lib/lib-tk/Tkinter.py	29 Mar 2003 09:48:12 -0000	1.160.10.3
++++ Lib/lib-tk/Tkinter.py	7 Jun 2003 19:53:55 -0000	1.160.10.4
+@@ -27,7 +27,7 @@
+ tk.mainloop()
+ """
+ 
+-__version__ = "$Revision: 1.160.10.3 $"
++__version__ = "$Revision: 1.160.10.4 $"
+ 
+ import sys
+ if sys.platform == "win32":
+@@ -454,6 +454,12 @@
+ 
+         Identifier returned by after or after_idle must be
+         given as first parameter."""
++        try:
++            (script, type) = self.tk.splitlist(
++                self.tk.call('after', 'info', id))
++            self.deletecommand(script)
++        except TclError:
++            pass
+         self.tk.call('after', 'cancel', id)
+     def bell(self, displayof=0):
+         """Ring a display's bell."""
+Index: Lib/test/regrtest.py
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v
+retrieving revision 1.70.4.4
+retrieving revision 1.70.4.6
+diff -u -r1.70.4.4 -r1.70.4.6
+--- Lib/test/regrtest.py	31 Mar 2003 22:11:45 -0000	1.70.4.4
++++ Lib/test/regrtest.py	21 Jun 2003 16:13:49 -0000	1.70.4.6
+@@ -24,27 +24,34 @@
+ 
+ -v is incompatible with -g and does not compare test output files.
+ 
+--s means to run only a single test and exit.  This is useful when doing memory
+-analysis on the Python interpreter (which tend to consume to many resources to
+-run the full regression test non-stop).  The file /tmp/pynexttest is read to
+-find the next test to run.  If this file is missing, the first test_*.py file
+-in testdir or on the command line is used.  (actually tempfile.gettempdir() is
+-used instead of /tmp).
+-
+--u is used to specify which special resource intensive tests to run, such as
+-those requiring large file support or network connectivity.  The argument is a
+-comma-separated list of words indicating the resources to test.  Currently
+-only the following are defined:
++-s means to run only a single test and exit.  This is useful when
++doing memory analysis on the Python interpreter (which tend to consume
++too many resources to run the full regression test non-stop).  The
++file /tmp/pynexttest is read to find the next test to run.  If this
++file is missing, the first test_*.py file in testdir or on the command
++line is used.  (actually tempfile.gettempdir() is used instead of
++/tmp).
++
++-u is used to specify which special resource intensive tests to run,
++such as those requiring large file support or network connectivity.
++The argument is a comma-separated list of words indicating the
++resources to test.  Currently only the following are defined:
++
++    all -       Enable all special resources.
+ 
+     curses -    Tests that use curses and will modify the terminal's
+                 state and output modes.
+ 
+-    largefile - It is okay to run some test that may create huge files.  These
+-                tests can take a long time and may consume >2GB of disk space
+-                temporarily.
+-
+-    network -   It is okay to run tests that use external network resource,
+-                e.g. testing SSL support for sockets.
++    largefile - It is okay to run some test that may create huge
++                files.  These tests can take a long time and may
++                consume >2GB of disk space temporarily.
++
++    network -   It is okay to run tests that use external network
++                resource, e.g. testing SSL support for sockets.
++
++To enable all resources except one, use '-uall,-<resource>'.  For
++example, to run all the tests except for the network tests, give the
++option '-uall,-network'.
+ """
+ 
+ import sys
+@@ -56,6 +63,9 @@
+ 
+ import test_support
+ 
++RESOURCE_NAMES = ['curses', 'largefile', 'network']
++
++
+ def usage(code, msg=''):
+     print __doc__
+     if msg: print msg
+@@ -81,10 +91,10 @@
+     command-line will be used.  If that's empty, too, then all *.py
+     files beginning with test_ will be used.
+ 
+-    The other default arguments (verbose, quiet, generate, exclude, single,
+-    randomize, findleaks, and use_resources) allow programmers calling main()
+-    directly to set the values that would normally be set by flags on the
+-    command line.
++    The other default arguments (verbose, quiet, generate, exclude,
++    single, randomize, findleaks, and use_resources) allow programmers
++    calling main() directly to set the values that would normally be
++    set by flags on the command line.
+ 
+     """
+ 
+@@ -121,9 +131,20 @@
+         elif o in ('-u', '--use'):
+             u = [x.lower() for x in a.split(',')]
+             for r in u:
+-                if r not in ('curses', 'largefile', 'network'):
+-                    usage(1, 'Invalid -u/--use option: %s' % a)
+-            use_resources.extend(u)
++                if r == 'all':
++                    use_resources[:] = RESOURCE_NAMES
++                    continue
++                remove = False
++                if r[0] == '-':
++                    remove = True
++                    r = r[1:]
++                if r not in RESOURCE_NAMES:
++                    usage(1, 'Invalid -u/--use option: ' + a)
++                if remove:
++                    if r in use_resources:
++                        use_resources.remove(r)
++                elif r not in use_resources:
++                    use_resources.append(r)
+     if generate and verbose:
+         usage(2, "-g and -v don't go together!")
+ 
+@@ -315,7 +336,7 @@
+             sys.stdout = save_stdout
+     except (ImportError, test_support.TestSkipped), msg:
+         if not quiet:
+-            print "test", test, "skipped --", msg
++            print test, "skipped --", msg
+             sys.stdout.flush()
+         return -1
+     except KeyboardInterrupt:
+@@ -525,7 +546,7 @@
+         test_winreg
+         test_winsound
+         """,
+-   'mac':
++    'mac':
+         """
+         test_al
+         test_bsddb
+@@ -715,6 +736,75 @@
+         test_winreg
+         test_winsound
+         """,
++    'sunos5':
++        """
++        test_al
++        test_bsddb
++        test_cd
++        test_cl
++        test_curses
++        test_dbm
++        test_email_codecs
++        test_gdbm
++        test_gl
++        test_gzip
++        test_imgfile
++        test_linuxaudiodev
++        test_mpz
++        test_openpty
++        test_socketserver
++        test_zipfile
++        test_zlib
++        """,
++    'hp-ux11':
++        """
++        test_al
++        test_bsddb
++        test_cd
++        test_cl
++        test_curses
++        test_dl
++        test_gdbm
++        test_gl
++        test_gzip
++        test_imgfile
++        test_largefile
++        test_linuxaudiodev
++        test_locale
++        test_minidom
++        test_nis
++        test_ntpath
++        test_openpty
++        test_pyexpat
++        test_sax
++        test_socketserver
++        test_sunaudiodev
++        test_zipfile
++        test_zlib
++        """,
++    'freebsd4':
++        """
++	test_al
++	test_cd
++	test_cl
++	test_curses
++	test_email_codecs
++	test_gdbm
++	test_gl
++	test_imgfile
++	test_linuxaudiodev
++	test_locale
++	test_minidom
++	test_nis
++	test_pyexpat
++	test_sax
++	test_socket_ssl
++	test_socketserver
++	test_sunaudiodev
++	test_unicode_file
++	test_winreg
++	test_winsound
++	""",
+ }
+ 
+ class _ExpectedSkips:
+Index: Lib/test/test_descr.py
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v
+retrieving revision 1.113.4.33
+retrieving revision 1.113.4.35
+diff -u -r1.113.4.33 -r1.113.4.35
+--- Lib/test/test_descr.py	29 May 2003 15:14:52 -0000	1.113.4.33
++++ Lib/test/test_descr.py	13 Jul 2003 13:54:34 -0000	1.113.4.35
+@@ -1116,6 +1116,22 @@
+         g==g
+     new_objects = len(gc.get_objects())
+     vereq(orig_objects, new_objects)
++    class H(object):
++        __slots__ = ['a', 'b']
++        def __init__(self):
++            self.a = 1
++            self.b = 2
++        def __del__(self):
++            assert self.a == 1
++            assert self.b == 2
++
++    save_stderr = sys.stderr
++    sys.stderr = sys.stdout
++    h = H()
++    try:
++        del h
++    finally:
++        sys.stderr = save_stderr
+ 
+ def dynamics():
+     if verbose: print "Testing class attribute propagation..."
+@@ -1271,6 +1287,14 @@
+     vereq(super(D,D).goo(), (D,))
+     vereq(super(D,d).goo(), (D,))
+ 
++    # Verify that argument is checked for callability (SF bug 753451)
++    try:
++        classmethod(1).__get__(1)
++    except TypeError:
++        pass
++    else:
++        raise TestFailed, "classmethod should check for callability"
++
+ def staticmethods():
+     if verbose: print "Testing static methods..."
+     class C(object):
+Index: Lib/test/test_extcall.py
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Lib/test/test_extcall.py,v
+retrieving revision 1.17
+retrieving revision 1.17.14.1
+diff -u -r1.17 -r1.17.14.1
+--- Lib/test/test_extcall.py	24 Aug 2001 19:11:57 -0000	1.17
++++ Lib/test/test_extcall.py	21 Feb 2004 20:58:03 -0000	1.17.14.1
+@@ -75,6 +75,31 @@
+             raise IndexError, i
+ g(*Nothing())
+ 
++class Nothing:
++    def __init__(self):
++        self.c = 0
++    def __iter__(self):
++        return self
++try:
++    g(*Nothing())
++except TypeError, attr:
++    pass
++else:
++    print "should raise TypeError"
++
++class Nothing:
++    def __init__(self):
++        self.c = 0
++    def __iter__(self):
++        return self
++    def next(self):
++        if self.c == 4:
++            raise StopIteration
++        c = self.c
++        self.c += 1
++        return c
++g(*Nothing())
++
+ # make sure the function call doesn't stomp on the dictionary?
+ d = {'a': 1, 'b': 2, 'c': 3}
+ d2 = d.copy()
+Index: Lib/test/test_socket.py
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket.py,v
+retrieving revision 1.23
+retrieving revision 1.23.6.1
+diff -u -r1.23 -r1.23.6.1
+--- Lib/test/test_socket.py	9 Dec 2001 08:57:46 -0000	1.23
++++ Lib/test/test_socket.py	21 Jun 2003 15:59:01 -0000	1.23.6.1
+@@ -84,11 +84,20 @@
+     print 'FQDN not found'
+ 
+ if hasattr(socket, 'getservbyname'):
+-    print socket.getservbyname('telnet', 'tcp')
++    # try a few protocols - not everyone has telnet enabled
++    class Found(Exception): pass
+     try:
+-        socket.getservbyname('telnet', 'udp')
+-    except socket.error:
++        for proto in ("telnet", "ssh", "www", "ftp"):
++            for how in ("tcp", "udp"):
++                try:
++                    socket.getservbyname(proto, how)
++                    raise Found
++                except socket.error:
++                    pass
++    except Found:
+         pass
++    else:
++        print "socket.error", "socket.getservbyname failed"
+ 
+ import sys
+ if not sys.platform.startswith('java'):
+Index: Lib/test/output/test_extcall
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_extcall,v
+retrieving revision 1.12
+retrieving revision 1.12.14.1
+diff -u -r1.12 -r1.12.14.1
+--- Lib/test/output/test_extcall	24 Aug 2001 19:46:21 -0000	1.12
++++ Lib/test/output/test_extcall	21 Feb 2004 20:58:04 -0000	1.12.14.1
+@@ -17,6 +17,7 @@
+ 1 (2, 3) {}
+ 1 (2, 3, 4, 5) {}
+ 0 (1, 2) {}
++0 (1, 2, 3) {}
+ 1 () {'a': 1, 'b': 2, 'c': 3, 'd': 4}
+ {'a': 1, 'b': 2, 'c': 3}
+ {'a': 1, 'b': 2, 'c': 3}
+Index: Lib/test/output/test_socket
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Lib/test/output/Attic/test_socket,v
+retrieving revision 1.2
+retrieving revision 1.2.30.1
+diff -u -r1.2 -r1.2.30.1
+--- Lib/test/output/test_socket	9 May 1997 01:54:45 -0000	1.2
++++ Lib/test/output/test_socket	21 Jun 2003 15:59:13 -0000	1.2.30.1
+@@ -1,3 +1,2 @@
+ test_socket
+ socket.error
+-23
+Index: Misc/NEWS
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v
+retrieving revision 1.337.2.4.2.87
+retrieving revision 1.337.2.4.2.95
+diff -u -r1.337.2.4.2.87 -r1.337.2.4.2.95
+--- Misc/NEWS	30 May 2003 20:57:36 -0000	1.337.2.4.2.87
++++ Misc/NEWS	3 Feb 2005 14:58:41 -0000	1.337.2.4.2.95
+@@ -1,3 +1,30 @@
++What's New in Python 2.2.4?
++Release date: XX-XXX-XXXX
++===========================
++
++- Applied a security fix to SimpleXMLRPCserver (PSF-2005-001).  This
++  disables recursive traversal through instance attributes, which can
++  be exploited in various ways.
++
++- Fixed a bug in the cache of length-one Unicode strings that could
++  lead to a seg fault.  The specific problem occurred when an earlier,
++  non-fatal error left an uninitialized Unicode object in the
++  freelist.
++
++- The email package handles some RFC 2231 parameters with missing
++  CHARSET fields better.  It also includes a patch to parameter
++  parsing when semicolons appear inside quotes.
++
++- SF #746304: Builtin functions are now copy.[deep]copyable.
++  Classes are now also deepcopyable.
++
++- SF #753592: webchecker/wsgui now handles user supplied directories.
++
++- SF bug 763023: fix uncaught ZeroDivisionError in difflib ratio methods
++  when there are no lines.
++
++- SF bug 753451: classmethod checks that it's argument is callable.
++
+ What's New in Python 2.2.3 (final) ?
+ Release date: 30-May-2003
+ ====================================
+Index: Misc/RPM/python-2.2.spec
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Misc/RPM/Attic/python-2.2.spec,v
+retrieving revision 1.1.2.4
+retrieving revision 1.1.2.6
+diff -u -r1.1.2.4 -r1.1.2.6
+--- Misc/RPM/python-2.2.spec	27 May 2003 14:36:02 -0000	1.1.2.4
++++ Misc/RPM/python-2.2.spec	5 Aug 2003 06:30:45 -0000	1.1.2.6
+@@ -26,7 +26,7 @@
+ 
+ %define name python
+ %define version 2.2.3
+-%define release 1
++%define release 2
+ %define __prefix /usr
+ %define libvers %(echo "%{version}" | awk -F. '{ printf "%s.%s", $1, $2 }')
+ 
+@@ -121,6 +121,11 @@
+ %endif
+ 
+ %changelog
++* Wed Jul 16 2003 Sean Reifschneider <jafo-rpms@tummy.com>
++[Release 2.2.3-2]
++- Removing .cvsignore files in the build, so that they don't cause problems
++  with the packaged file list.  Reported by David Hutchinson.
++
+ * Sun Oct 06 2002 Sean Reifschneider <jafo-rpms@tummy.com>
+ [Release 2.2.2b1-1]
+ - Updated for the 2.2.2b1 release.
+@@ -201,6 +206,9 @@
+ ./configure %{ipv6} %{pymalloc} --prefix=%{__prefix}
+ make
+ 
++#  remove .cvsignore files
++find . -name .cvsignore | xargs rm -f
++
+ #  fix paths
+ for file in \
+       Tools/scripts/pathfix.py \
+@@ -315,6 +323,8 @@
+ %{__prefix}/lib/python%{libvers}/xml
+ %{__prefix}/lib/python%{libvers}/email
+ %{__prefix}/lib/python%{libvers}/compiler
++%{__prefix}/lib/python%{libvers}/lib-old
++%{__prefix}/lib/python%{libvers}/hotshot
+ 
+ %files devel
+ %defattr(-,root,root)
+Index: Modules/_sre.c
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Modules/_sre.c,v
+retrieving revision 2.77.6.1
+retrieving revision 2.77.6.2
+diff -u -r2.77.6.1 -r2.77.6.2
+--- Modules/_sre.c	31 Jul 2002 11:19:49 -0000	2.77.6.1
++++ Modules/_sre.c	14 Jun 2003 15:03:06 -0000	2.77.6.2
+@@ -88,9 +88,23 @@
+ /* FIXME: maybe the limit should be 40000 / sizeof(void*) ? */
+ #define USE_RECURSION_LIMIT 7500
+ #else
++#if defined(__GNUC__) && defined(WITH_THREAD) && defined(__FreeBSD__)
++/* the pthreads library on FreeBSD has a fixed 1MB stack size for the
++ * initial (or "primary") thread, which is insufficient for the default
++ * recursion limit.  gcc 3.x at the default optimisation
++ * level (-O3) uses stack space more aggressively than gcc 2.95.
++ */
++#if (__GNUC__ > 2)
++#define USE_RECURSION_LIMIT 6500
++#else
++#define USE_RECURSION_LIMIT 7500
++#endif
++
++#else
+ #define USE_RECURSION_LIMIT 10000
+ #endif
+ #endif
++#endif
+ 
+ /* enables fast searching */
+ #define USE_FAST_SEARCH
+Index: Modules/cPickle.c
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v
+retrieving revision 2.73.2.1.2.6
+retrieving revision 2.73.2.1.2.7
+diff -u -r2.73.2.1.2.6 -r2.73.2.1.2.7
+--- Modules/cPickle.c	21 May 2003 20:43:09 -0000	2.73.2.1.2.6
++++ Modules/cPickle.c	11 Jul 2003 20:37:13 -0000	2.73.2.1.2.7
+@@ -4308,6 +4308,7 @@
+     Py_XDECREF(self->pers_func);
+     Py_XDECREF(self->arg);
+     Py_XDECREF(self->last_string);
++    Py_XDECREF(self->find_class);
+     Py_XDECREF(self->safe_constructors);
+ 
+     if (self->marks) {
+@@ -4340,6 +4341,8 @@
+ 	VISIT(self->pers_func);
+ 	VISIT(self->arg);
+ 	VISIT(self->last_string);
++	VISIT(self->find_class);
++	VISIT(self->safe_constructors);
+ #undef VISIT
+ 	return 0;
+ }
+@@ -4356,6 +4359,8 @@
+ 	CLEAR(self->pers_func);
+ 	CLEAR(self->arg);
+ 	CLEAR(self->last_string);
++	CLEAR(self->find_class);
++	CLEAR(self->safe_constructors);
+ #undef CLEAR
+ 	return 0;
+ }
+Index: Modules/mmapmodule.c
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Modules/mmapmodule.c,v
+retrieving revision 2.35.6.5
+retrieving revision 2.35.6.6
+diff -u -r2.35.6.5 -r2.35.6.6
+--- Modules/mmapmodule.c	7 Feb 2003 19:46:44 -0000	2.35.6.5
++++ Modules/mmapmodule.c	15 Jul 2003 13:00:45 -0000	2.35.6.6
+@@ -1,7 +1,7 @@
+ /*
+  /  Author: Sam Rushing <rushing@nightmare.com>
+  /  Hacked for Unix by AMK
+- /  $Id: mmapmodule.c,v 2.35.6.5 2003/02/07 19:46:44 nnorwitz Exp $
++ /  $Id: mmapmodule.c,v 2.35.6.6 2003/07/15 13:00:45 akuchling Exp $
+ 
+  / mmapmodule.cpp -- map a view of a file into memory
+  /
+@@ -897,7 +897,8 @@
+ 	}
+ 
+ #ifdef HAVE_FSTAT
+-	if (fstat(fd, &st) == 0 && (size_t)map_size > st.st_size) {
++	if (fstat(fd, &st) == 0 && S_ISREG(st.st_mode) &&
++	    (size_t)map_size > st.st_size) {
+ 		PyErr_SetString(PyExc_ValueError, 
+ 				"mmap length is greater than file size");
+ 		return NULL;
+Index: Modules/posixmodule.c
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v
+retrieving revision 2.216.4.10
+retrieving revision 2.216.4.11
+diff -u -r2.216.4.10 -r2.216.4.11
+--- Modules/posixmodule.c	23 Apr 2003 20:14:12 -0000	2.216.4.10
++++ Modules/posixmodule.c	11 Jun 2003 00:20:02 -0000	2.216.4.11
+@@ -3416,7 +3416,7 @@
+ #ifdef HAVE_SYMLINK
+ static char posix_symlink__doc__[] =
+ "symlink(src, dst) -> None\n\
+-Create a symbolic link.";
++Create a symbolic link pointing to src named dst.";
+ 
+ static PyObject *
+ posix_symlink(PyObject *self, PyObject *args)
+Index: Objects/funcobject.c
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Objects/funcobject.c,v
+retrieving revision 2.50.4.3
+retrieving revision 2.50.4.4
+diff -u -r2.50.4.3 -r2.50.4.4
+--- Objects/funcobject.c	22 May 2003 18:11:20 -0000	2.50.4.3
++++ Objects/funcobject.c	13 Jul 2003 13:54:34 -0000	2.50.4.4
+@@ -611,6 +611,12 @@
+ 
+ 	if (!PyArg_ParseTuple(args, "O:callable", &callable))
+ 		return -1;
++	if (!PyCallable_Check(callable)) {
++		PyErr_Format(PyExc_TypeError, "'%s' object is not callable",
++		     callable->ob_type->tp_name);
++		return -1;
++	}
++	
+ 	Py_INCREF(callable);
+ 	cm->cm_callable = callable;
+ 	return 0;
+Index: Objects/typeobject.c
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v
+retrieving revision 2.126.4.38
+retrieving revision 2.126.4.39
+diff -u -r2.126.4.38 -r2.126.4.39
+--- Objects/typeobject.c	29 May 2003 15:13:18 -0000	2.126.4.38
++++ Objects/typeobject.c	16 Jun 2003 23:38:00 -0000	2.126.4.39
+@@ -431,24 +431,33 @@
+ 
+ 	/* This function exists so we can DECREF self->ob_type */
+ 
+-	/* Find the nearest base with a different tp_dealloc
+-	   and clear slots while we're at it */
++	/* Find the nearest base with a different tp_dealloc */
+ 	type = self->ob_type;
+ 	base = type;
+ 	while ((basedealloc = base->tp_dealloc) == subtype_dealloc) {
+-		if (base->ob_size)
+-			clear_slots(base, self);
+ 		base = base->tp_base;
+ 		assert(base);
+ 	}
+ 
+-	/* If we added weaklist, we clear it */
++	/* If we added a weaklist, we clear it.  Do this *before* calling
++	   the finalizer (__del__), clearing slots, or clearing the instance
++	   dict. */
++
+ 	if (type->tp_weaklistoffset && !base->tp_weaklistoffset)
+ 		PyObject_ClearWeakRefs(self);
+ 
+ 	if (call_finalizer(self) < 0)
+ 		return;
+ 
++	/*  Clear slots up to the nearest base with a different tp_dealloc */
++	base = type;
++	while ((basedealloc = base->tp_dealloc) == subtype_dealloc) {
++		if (base->ob_size)
++			clear_slots(base, self);
++		base = base->tp_base;
++		assert(base);
++	}
++
+ 	/* If we added a dict, DECREF it */
+ 	if (type->tp_dictoffset && !base->tp_dictoffset) {
+ 		PyObject **dictptr = _PyObject_GetDictPtr(self);
+Index: Objects/unicodeobject.c
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v
+retrieving revision 2.124.6.21
+retrieving revision 2.124.6.22
+diff -u -r2.124.6.21 -r2.124.6.22
+--- Objects/unicodeobject.c	11 Apr 2003 18:21:22 -0000	2.124.6.21
++++ Objects/unicodeobject.c	17 Sep 2003 03:32:41 -0000	2.124.6.22
+@@ -132,7 +132,12 @@
+        instead ! */
+     if (unicode == unicode_empty || 
+ 	(unicode->length == 1 && 
+-	 unicode->str[0] < 256 &&
++         /* MvL said unicode->str[] may be signed.  Python generally assumes
++          * an int contains at least 32 bits, and we don't use more than
++          * 32 bits even in a UCS4 build, so casting to unsigned int should
++          * be correct.
++          */
++	 (unsigned int)unicode->str[0] < 256U &&
+ 	 unicode_latin1[unicode->str[0]] == unicode)) {
+         PyErr_SetString(PyExc_SystemError,
+                         "can't resize shared unicode objects");
+@@ -211,6 +216,14 @@
+ 	PyErr_NoMemory();
+ 	goto onError;
+     }
++    /* Initialize the first element to guard against cases where
++     * the caller fails before initializing str -- unicode_resize()
++     * reads str[0], and the Keep-Alive optimization can keep memory
++     * allocated for str alive across a call to unicode_dealloc(unicode).
++     * We don't want unicode_resize to read uninitialized memory in
++     * that case.
++     */
++    unicode->str[0] = 0;
+     unicode->str[length] = 0;
+     unicode->length = length;
+     unicode->hash = -1;
+Index: Python/ceval.c
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v
+retrieving revision 2.301.4.8
+retrieving revision 2.301.4.9
+diff -u -r2.301.4.8 -r2.301.4.9
+--- Python/ceval.c	7 Oct 2002 09:47:20 -0000	2.301.4.8
++++ Python/ceval.c	29 Jun 2003 14:57:10 -0000	2.301.4.9
+@@ -1365,6 +1365,11 @@
+ 					err = -1;
+ 				}
+ 			}
++			/* PyFile_SoftSpace() can exececute arbitrary code
++			   if sys.stdout is an instance with a __getattr__.
++			   If __getattr__ raises an exception, w will
++			   be freed, so we need to prevent that temporarily. */
++			Py_XINCREF(w);
+ 			if (w != NULL && PyFile_SoftSpace(w, 1))
+ 				err = PyFile_WriteString(" ", w);
+ 			if (err == 0)
+@@ -1390,6 +1395,7 @@
+ 			    }
+ #endif
+ 			}
++			Py_XDECREF(w);
+ 			Py_DECREF(v);
+ 			Py_XDECREF(stream);
+ 			stream = NULL;
+Index: Python/compile.c
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v
+retrieving revision 2.234.4.8
+retrieving revision 2.234.4.9
+diff -u -r2.234.4.8 -r2.234.4.9
+--- Python/compile.c	22 May 2003 16:43:03 -0000	2.234.4.8
++++ Python/compile.c	22 Sep 2003 04:42:17 -0000	2.234.4.9
+@@ -4549,6 +4549,16 @@
+ }
+ 
+ static int
++symtable_error(struct symtable *st, int lineno)
++{
++	if (lineno == 0)
++		lineno = st->st_cur->ste_lineno;
++	PyErr_SyntaxLocation(st->st_filename, lineno);
++	st->st_errors++;
++	return -1;
++}
++
++static int
+ symtable_load_symbols(struct compiling *c)
+ {
+ 	static PyObject *implicit = NULL;
+@@ -4612,9 +4622,7 @@
+ 			if (flags & DEF_PARAM) {
+ 				PyErr_Format(PyExc_SyntaxError, LOCAL_GLOBAL,
+ 					     PyString_AS_STRING(name));
+-				PyErr_SyntaxLocation(st->st_filename, 
+-						   ste->ste_lineno);
+-				st->st_errors++;
++				symtable_error(st, 0);
+ 				goto fail;
+ 			}
+ 			if (PyDict_SetItem(c->c_globals, name, Py_None) < 0)
+@@ -4959,9 +4967,7 @@
+ 	    if ((flag & DEF_PARAM) && (val & DEF_PARAM)) {
+ 		    PyErr_Format(PyExc_SyntaxError, DUPLICATE_ARGUMENT,
+ 				 PyString_AsString(name));
+-		    PyErr_SyntaxLocation(st->st_filename,
+-				       st->st_cur->ste_lineno);
+-		    return -1;
++		    return symtable_error(st, 0);
+ 	    }
+ 	    val |= flag;
+ 	} else
+@@ -5358,9 +5364,7 @@
+ 				PyErr_Format(PyExc_SyntaxError,
+ 				     "name '%.400s' is local and global",
+ 					     name);
+-				PyErr_SyntaxLocation(st->st_filename,
+-						   st->st_cur->ste_lineno);
+-				st->st_errors++;
++				symtable_error(st, 0);
+ 				return;
+ 			}
+ 			else {
+@@ -5420,9 +5424,7 @@
+ 			if (n->n_lineno >= st->st_future->ff_last_lineno) {
+ 				PyErr_SetString(PyExc_SyntaxError,
+ 						LATE_FUTURE);
+- 				PyErr_SyntaxLocation(st->st_filename,
+-						   n->n_lineno);
+-				st->st_errors++;
++				symtable_error(st, n->n_lineno);
+ 				return;
+ 			}
+ 		}
+@@ -5515,9 +5517,8 @@
+ 			if (strcmp(STR(tmp), "__debug__") == 0) {
+ 				PyErr_SetString(PyExc_SyntaxError, 
+ 						ASSIGN_DEBUG);
+-				PyErr_SyntaxLocation(st->st_filename,
+-						     n->n_lineno);
+-				st->st_errors++;
++				symtable_error(st, n->n_lineno);
++				return;
+ 			}
+ 			symtable_add_def(st, STR(tmp), DEF_LOCAL | def_flag);
+ 		}
+Index: Tools/idle/CallTips.py
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Tools/idle/Attic/CallTips.py,v
+retrieving revision 1.9.12.1
+retrieving revision 1.9.12.2
+diff -u -r1.9.12.1 -r1.9.12.2
+--- Tools/idle/CallTips.py	23 Sep 2002 14:23:15 -0000	1.9.12.1
++++ Tools/idle/CallTips.py	23 Jul 2003 16:25:43 -0000	1.9.12.2
+@@ -148,8 +148,7 @@
+         # See if we can use the docstring
+         doc = getattr(ob, "__doc__", "")
+         if doc:
+-            while doc[:1] in " \t\n":
+-                doc = doc[1:]
++            doc = doc.lstrip()
+             pos = doc.find("\n")
+             if pos < 0 or pos > 70:
+                 pos = 70
+Index: Tools/webchecker/wsgui.py
+===================================================================
+RCS file: /cvsroot/python/python/dist/src/Tools/webchecker/wsgui.py,v
+retrieving revision 1.5
+retrieving revision 1.5.18.1
+diff -u -r1.5 -r1.5.18.1
+--- Tools/webchecker/wsgui.py	11 May 2001 19:40:10 -0000	1.5
++++ Tools/webchecker/wsgui.py	1 Jul 2003 04:17:25 -0000	1.5.18.1
+@@ -162,7 +162,7 @@
+         else:
+             self.sucker.savedir = dir
+             self.sucker.rootdir = os.path.dirname(
+-                websucker.Sucker.savefilename(self, url))
++                websucker.Sucker.savefilename(self.sucker, url))
+         self.go_button.configure(state=DISABLED)
+         self.auto_button.configure(state=DISABLED)
+         self.cancel_button.configure(state=NORMAL)
--- python2.2-2.2.3dfsg.orig/debian/patches/blt+tix.dpatch
+++ python2.2-2.2.3dfsg/debian/patches/blt+tix.dpatch
@@ -0,0 +1,47 @@
+#! /bin/sh -e
+
+# DP: configure _tkinter with BLT and Tix support
+
+dir=
+if [ $# -eq 3 -a "$2" = '-d' ]; then
+    pdir="-d $3"
+    dir="$3/"
+elif [ $# -ne 1 ]; then
+    echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+    exit 1
+fi
+case "$1" in
+    -patch)
+        patch $pdir -f --no-backup-if-mismatch -p0 < $0
+        #cd ${dir}gcc && autoconf
+        ;;
+    -unpatch)
+        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
+        #rm ${dir}gcc/configure
+        ;;
+    *)
+	echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+        exit 1
+esac
+exit 0
+
+--- setup.py.old	Fri Mar 15 08:10:18 2002
++++ setup.py	Mon Apr  1 15:58:09 2002
+@@ -737,9 +737,17 @@
+ 
+         # Check for BLT extension
+         if self.compiler.find_library_file(lib_dirs + added_lib_dirs,
++                                           'BLT'):
++            defs.append( ('WITH_BLT', 1) )
++            libs.append('BLT')
++        elif self.compiler.find_library_file(lib_dirs + added_lib_dirs,
+                                            'BLT8.0'):
+             defs.append( ('WITH_BLT', 1) )
+             libs.append('BLT8.0')
++
++        # Add the Tix libraries
++        defs.append( ('WITH_TIX', 1) )
++        libs.append('tix')
+ 
+         # Add the Tcl/Tk libraries
+         libs.append('tk'+version)
--- python2.2-2.2.3dfsg.orig/debian/patches/dlmodule.dpatch
+++ python2.2-2.2.3dfsg/debian/patches/dlmodule.dpatch
@@ -0,0 +1,74 @@
+#! /bin/sh -e
+
+# DP: Always build the dl module. Failure in case of 
+# DP:     sizeof(int)!=sizeof(long)!=sizeof(void*)
+# DP: is delayed until dl.open is called.
+
+dir=
+if [ $# -eq 3 -a "$2" = '-d' ]; then
+    pdir="-d $3"
+    dir="$3/"
+elif [ $# -ne 1 ]; then
+    echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+    exit 1
+fi
+case "$1" in
+    -patch)
+        patch $pdir -f --no-backup-if-mismatch -p0 < $0
+        #cd ${dir}gcc && autoconf
+        ;;
+    -unpatch)
+        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
+        #rm ${dir}gcc/configure
+        ;;
+    *)
+	echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+        exit 1
+esac
+exit 0
+
+--- setup.py~	Mon Apr  1 16:05:12 2002
++++ setup.py	Mon Apr  1 16:27:02 2002
+@@ -223,6 +223,10 @@
+             math_libs = []
+         
+         # XXX Omitted modules: gl, pure, dl, SGI-specific modules
++        try:
++            exts.append( Extension('dl', ['dlmodule.c']) )
++        except SystemError:
++            pass
+ 
+         #
+         # The following modules are all pretty straightforward, and compile
+
+diff -u -r2.18 -r2.19
+--- Modules/dlmodule.c	2001/12/08 18:02:56	2.18
++++ Modules/dlmodule.c	2002/01/01 20:18:30	2.19
+@@ -158,6 +158,13 @@
+ 	char *name;
+ 	int mode;
+ 	PyUnivPtr *handle;
++	if (sizeof(int) != sizeof(long) ||
++	    sizeof(long) != sizeof(char *)) {
++		PyErr_SetString(PyExc_SystemError,
++ "module dl requires sizeof(int) == sizeof(long) == sizeof(char*)");
++		return NULL;
++	}
++
+ 	if (PyArg_Parse(args, "z", &name))
+ 		mode = RTLD_LAZY;
+ 	else {
+@@ -203,13 +210,6 @@
+ initdl(void)
+ {
+ 	PyObject *m, *d, *x;
+-
+-	if (sizeof(int) != sizeof(long) ||
+-	    sizeof(long) != sizeof(char *)) {
+-		PyErr_SetString(PyExc_SystemError,
+- "module dl requires sizeof(int) == sizeof(long) == sizeof(char*)");
+-		return;
+-	}
+ 
+ 	/* Initialize object type */
+ 	Dltype.ob_type = &PyType_Type;
--- python2.2-2.2.3dfsg.orig/debian/patches/py2texi.dpatch
+++ python2.2-2.2.3dfsg/debian/patches/py2texi.dpatch
@@ -0,0 +1,189 @@
+#! /bin/sh -e
+
+# DP: Doc/tools/py2texi.el update
+
+dir=
+if [ $# -eq 3 -a "$2" = '-d' ]; then
+    pdir="-d $3"
+    dir="$3/"
+elif [ $# -ne 1 ]; then
+    echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+    exit 1
+fi
+case "$1" in
+    -patch)
+        patch $pdir -f --no-backup-if-mismatch -p0 < $0
+        #cd ${dir}gcc && autoconf
+        ;;
+    -unpatch)
+        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
+        #rm ${dir}gcc/configure
+        ;;
+    *)
+	echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+        exit 1
+esac
+exit 0
+
+--- Doc/tools/py2texi.el.orig	2002-07-29 22:10:38.000000000 +0200
++++ Doc/tools/py2texi.el	2002-07-29 22:12:53.000000000 +0200
+@@ -56,6 +56,10 @@
+     (match-string 0 py2texi-python-version))
+   "Short version number, usually set by the LaTeX commands.")
+ 
++(defvar py2texi-info-file-name nil
++  "If non-nil, that string is used as the name of the Info file.
++Otherwise a generated Info file name is used.")
++
+ (defvar py2texi-stop-on-problems nil
+   "*If non-nil, stop when you encouter soft problem.")
+ 
+@@ -65,32 +69,32 @@
+     ("cfuncdesc" 3
+      (progn (setq findex t)
+ 	    "\n@table @code\n@item \\1 \\2(\\3)\n@findex \\2\n")
+-     "@end table")
++     "@end table\n")
+     ("classdesc" 2
+      (progn (setq obindex t)
+ 	    "\n@table @code\n@item \\1(\\2)\n@obindex \\1\n")
+-     "@end table")
++     "@end table\n")
+     ("classdesc*" 1
+      (progn (setq obindex t)
+ 	    "\n@table @code\n@item \\1\n@obindex \\1\n")
+-     "@end table")
++     "@end table\n")
+     ("csimplemacrodesc" 1
+      (progn (setq cindex t)
+ 	    "\n@table @code\n@item \\1\n@cindex \\1\n")
+-     "@end table")
++     "@end table\n")     
+     ("ctypedesc" 1
+      (progn (setq cindex t)
+ 	    "\n@table @code\n@item \\1\n@cindex \\1\n")
+-     "@end table")
++     "@end table\n")
+     ("cvardesc" 2
+      (progn (setq findex t)
+ 	    "\n@table @code\n@item \\1 \\2\n@findex \\2\n")
+-     "@end table")
++     "@end table\n")
+     ("datadesc" 1
+      (progn (setq findex t)
+ 	    "\n@table @code\n@item \\1\n@findex \\1\n")
+-     "@end table")
+-    ("datadescni" 1 "\n@table @code\n@item \\1\n" "@end table")
++     "@end table\n")
++    ("datadescni" 1 "\n@table @code\n@item \\1\n" "@end table\n")
+     ("definitions" 0 "@table @dfn" "@end table\n")
+     ("description" 0 "@table @samp" "@end table\n")
+     ("displaymath" 0 "" "")
+@@ -111,20 +115,20 @@
+     ("excdesc" 1
+      (progn (setq obindex t)
+ 	    "\n@table @code\n@item \\1\n@obindex \\1\n")
+-     "@end table")
++     "@end table\n")
+     ("excclassdesc" 2
+      (progn (setq obindex t)
+ 	    "\n@table @code\n@item \\1(\\2)\n@obindex \\1\n")
+-     "@end table")
++     "@end table\n")
+     ("flushleft" 0 "" "")
+-    ("fulllineitems" 0 "\n@table @code\n" "@end table")
++    ("fulllineitems" 0 "\n@table @code\n" "@end table\n")
+     ("funcdesc" 2
+      (progn (setq findex t)
+ 	    "\n@table @code\n@item \\1(\\2)\n@findex \\1\n")
+-     "@end table")
+-    ("funcdescni" 2 "\n@table @code\n@item \\1(\\2)\n" "@end table")
++     "@end table\n")
++    ("funcdescni" 2 "\n@table @code\n@item \\1(\\2)\n" "@end table\n")
+     ("itemize" 0 "@itemize @bullet" "@end itemize\n")
+-    ("list" 2 "\n@table @code\n" "@end table")
++    ("list" 2 "\n@table @code\n" "@end table\n")
+     ("longtableii" 4 (concat "@multitable @columnfractions .5 .5\n"
+ 			     "@item \\3 @tab \\4\n"
+ 			     "@item ------- @tab ------ \n")
+@@ -136,22 +140,22 @@
+     ("memberdesc" 1
+      (progn (setq findex t)
+ 	    "\n@table @code\n@item \\1\n@findex \\1\n")
+-     "@end table")
+-    ("memberdescni" 1 "\n@table @code\n@item \\1\n" "@end table")
++     "@end table\n")
++    ("memberdescni" 1 "\n@table @code\n@item \\1\n" "@end table\n")
+     ("methoddesc" 2
+      (progn (setq findex t)
+ 	    "\n@table @code\n@item \\1(\\2)\n@findex \\1\n")
+-     "@end table")
+-    ("methoddescni" 2 "\n@table @code\n@item \\1(\\2)\n" "@end table")
++     "@end table\n")
++    ("methoddescni" 2 "\n@table @code\n@item \\1(\\2)\n" "@end table\n")
+     ("notice" 0 "@emph{Notice:} " "")
+     ("opcodedesc" 2
+      (progn (setq findex t)
+ 	    "\n@table @code\n@item \\1 \\2\n@findex \\1\n")
+-     "@end table")
+-    ("productionlist" 0 "\n@table @code\n" "@end table")
++     "@end table\n")
++    ("productionlist" 0 "\n@table @code\n" "@end table\n")
+     ("quotation" 0 "@quotation" "@end quotation")
+-    ("seealso" 0 "See also:\n@table @emph\n" "@end table")
+-    ("seealso*" 0 "@table @emph\n" "@end table")
++    ("seealso" 0 "See also:\n@table @emph\n" "@end table\n")
++    ("seealso*" 0 "@table @emph\n" "@end table\n")
+     ("sloppypar" 0 "" "")
+     ("small" 0 "" "")
+     ("tableii" 4 (concat "@multitable @columnfractions .5 .5\n"
+@@ -457,12 +461,13 @@
+   (let* ((filename (concat "./"
+ 			   (file-name-nondirectory file)
+ 			   (if (string-match "\\.tex$" file) "i" ".texi")))
+-	 (infofilename (py2texi-info-file-name filename)))
++	 (infofilename (or py2texi-info-file-name
++			   (py2texi-info-file-name filename))))
+     (goto-char (point-min))
+     (when (looking-at py2texi-magic)
+       (delete-region (point) (progn (beginning-of-line 2) (point)))
+       (insert "\\input texinfo @c -*-texinfo-*-\n")
+-      (insert "@setfilename " (file-name-nondirectory infofilename)))
++      (insert "@setfilename " infofilename))
+     (when (re-search-forward "@chapter" nil t)
+       (texinfo-all-menus-update t))
+     (goto-char (point-min))
+@@ -705,7 +710,8 @@
+ 	id
+ 	counter
+ 	string
+-	label)
++	label
++	index)
+     (py2texi-search "^@node +\\(.*\\)$"
+       (setq string (match-string 1))
+       (if py2texi-xemacs
+@@ -714,6 +720,9 @@
+       (when (string-match "@label{[^}]*}" string)
+ 	(setq label (match-string 0 string))
+ 	(setq string (replace-match "" t nil string)))
++      (when (string-match "@..?index{[^}]*}" string)
++	(setq index (match-string 0 string))
++	(setq string (replace-match "" t nil string)))
+       (while (string-match "@[a-zA-Z]+\\|[{}():]\\|``\\|''" string)
+ 	(setq string (replace-match "" t nil string)))
+       (while (string-match " -- " string)
+@@ -733,9 +742,11 @@
+ 	(setq counter 1))
+       (setf (gethash id nodes) counter)
+       (insert string)
++      (beginning-of-line 3)
+       (when label
+-	(beginning-of-line 3)
+-	(insert label "\n")))))
++	(insert label "\n"))
++      (when index
++	(insert index "\n")))))
+ 
+ 
+ (defun py2texi-fix-references ()
--- python2.2-2.2.3dfsg.orig/debian/patches/dbm.dpatch
+++ python2.2-2.2.3dfsg/debian/patches/dbm.dpatch
@@ -0,0 +1,53 @@
+#! /bin/sh -e
+
+# DP: Use Berkley DB for the dbm module.
+
+dir=
+if [ $# -eq 3 -a "$2" = '-d' ]; then
+    pdir="-d $3"
+    dir="$3/"
+elif [ $# -ne 1 ]; then
+    echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+    exit 1
+fi
+case "$1" in
+    -patch)
+        patch $pdir -f --no-backup-if-mismatch -p0 < $0
+        #cd ${dir}gcc && autoconf
+        ;;
+    -unpatch)
+        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
+        #rm ${dir}gcc/configure
+        ;;
+    *)
+	echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+        exit 1
+esac
+exit 0
+
+--- Modules/dbmmodule.c~	2001-12-08 19:02:56.000000000 +0100
++++ Modules/dbmmodule.c	2002-08-22 09:44:29.000000000 +0200
+@@ -20,6 +20,9 @@
+ #elif defined(HAVE_GDBM_NDBM_H)
+ #include <gdbm/ndbm.h>
+ static char *which_dbm = "GNU gdbm";
++#elif defined(HAVE_BERKDB_H)
++#include <db.h>
++static char *which_dbm = "Berkeley DB";
+ #else
+ #error "No ndbm.h available!"
+ #endif
+--- setup.py.old	2005-05-04 10:19:30.086135000 +0200
++++ setup.py	2005-05-04 10:21:37.246933052 +0200
+@@ -411,6 +411,11 @@
+             elif self.compiler.find_library_file(lib_dirs, 'db1'):
+                 exts.append( Extension('dbm', ['dbmmodule.c'],
+                                        libraries = ['db1'] ) )
++            elif self.compiler.find_library_file(lib_dirs, 'db-4.2'):
++                exts.append( Extension('dbm', ['dbmmodule.c'],
++                                       define_macros=[('HAVE_BERKDB_H',None),
++                                                      ('DB_DBM_HSEARCH',None)],
++                                       libraries=['db']))
+             elif self.compiler.find_library_file(lib_dirs, 'gdbm'):
+                 exts.append( Extension('dbm', ['dbmmodule.c'],
+                                        libraries = ['gdbm'] ) )
--- python2.2-2.2.3dfsg.orig/debian/patches/setup.dpatch
+++ python2.2-2.2.3dfsg/debian/patches/setup.dpatch
@@ -0,0 +1,56 @@
+#! /bin/sh -e
+
+# DP: Don't include /usr/local in search flags
+
+dir=
+if [ $# -eq 3 -a "$2" = '-d' ]; then
+    pdir="-d $3"
+    dir="$3/"
+elif [ $# -ne 1 ]; then
+    echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+    exit 1
+fi
+case "$1" in
+    -patch)
+        patch $pdir -f --no-backup-if-mismatch -p0 < $0
+        #cd ${dir}gcc && autoconf
+        ;;
+    -unpatch)
+        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
+        #rm ${dir}gcc/configure
+        ;;
+    *)
+	echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+        exit 1
+esac
+exit 0
+
+--- setup.py~	2002-08-22 11:41:06.000000000 +0200
++++ setup.py	2002-08-22 11:48:20.000000000 +0200
+@@ -198,10 +198,11 @@
+ 
+     def detect_modules(self):
+         # Ensure that /usr/local is always used
+-        if '/usr/local/lib' not in self.compiler.library_dirs:
+-            self.compiler.library_dirs.insert(0, '/usr/local/lib')
+-        if '/usr/local/include' not in self.compiler.include_dirs:
+-            self.compiler.include_dirs.insert(0, '/usr/local/include' )
++        # commented out on Debian
++        #if '/usr/local/lib' not in self.compiler.library_dirs:
++        #    self.compiler.library_dirs.insert(0, '/usr/local/lib')
++        #if '/usr/local/include' not in self.compiler.include_dirs:
++        #    self.compiler.include_dirs.insert(0, '/usr/local/include' )
+ 
+         try:
+             have_unicode = unicode
+@@ -412,7 +412,9 @@
+         # Berkeley DB 3.x.)
+ 
+         dblib = []
+-        if self.compiler.find_library_file(lib_dirs, 'db-3.2'):
++        if self.compiler.find_library_file(lib_dirs, 'db'):
++            dblib = ['db']
++        elif self.compiler.find_library_file(lib_dirs, 'db-3.2'):
+             dblib = ['db-3.2']
+         elif self.compiler.find_library_file(lib_dirs, 'db-3.1'):
+             dblib = ['db-3.1']
--- python2.2-2.2.3dfsg.orig/debian/patches/tix-update.dpatch
+++ python2.2-2.2.3dfsg/debian/patches/tix-update.dpatch
@@ -0,0 +1,2753 @@
+#! /bin/sh -e
+
+# DP: Tix update from tix-8.1.4 (python2.3a1)
+
+dir=
+if [ $# -eq 3 -a "$2" = '-d' ]; then
+    pdir="-d $3"
+    dir="$3/"
+elif [ $# -ne 1 ]; then
+    echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+    exit 1
+fi
+case "$1" in
+    -patch)
+        patch $pdir -f --no-backup-if-mismatch -p0 < $0
+        #cd ${dir}gcc && autoconf
+        ;;
+    -unpatch)
+        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
+        #rm ${dir}gcc/configure
+        ;;
+    *)
+	echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+        exit 1
+esac
+exit 0
+
+--- Lib/lib-tk/Tix.py	2003-01-03 12:27:12.000000000 +0100
++++ Lib/lib-tk/Tix.py	2002-12-31 10:46:18.000000000 +0100
+@@ -1,10 +1,10 @@
+ # -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
+ #
+-# $Id: Tix.py,v 1.7 2001/12/13 04:53:07 fdrake Exp $
++# $Id: Tix.py,v 1.15 2002/12/30 23:52:00 nnorwitz Exp $
+ #
+ # Tix.py -- Tix widget wrappers.
+ #
+-#	For Tix, see http://tix.sourceforge.net
++#       For Tix, see http://tix.sourceforge.net
+ #
+ #       - Sudhir Shenoy (sshenoy@gol.com), Dec. 1995.
+ #         based on an idea of Jean-Marc Lugrin (lugrin@ms.com)
+@@ -26,7 +26,6 @@
+ # appreciate the advantages.
+ #
+ 
+-import string
+ from Tkinter import *
+ from Tkinter import _flatten, _cnfmerge, _default_root
+ 
+@@ -35,8 +34,6 @@
+     raise ImportError, "This version of Tix.py requires Tk 4.0 or higher"
+ 
+ import _tkinter # If this fails your Python may not be configured for Tk
+-# TixVersion = string.atof(tkinter.TIX_VERSION) # If this fails your Python may not be configured for Tix
+-# WARNING - TixVersion is a limited precision floating point number
+ 
+ # Some more constants (for consistency with Tkinter)
+ WINDOW = 'window'
+@@ -165,7 +162,7 @@
+             active_bg       active_fg      bg
+             bold_font       dark1_bg       dark1_fg
+             dark2_bg        dark2_fg       disabled_fg
+-            fg       	    fixed_font     font
++            fg              fixed_font     font
+             inactive_bg     inactive_fg    input1_bg
+             input2_bg       italic_font    light1_bg
+             light1_fg       light2_bg      light2_fg
+@@ -206,12 +203,16 @@
+             self.tk.eval('global auto_path; lappend auto_path {%s}' % tixlib)
+             self.tk.eval('global tcl_pkgPath; lappend tcl_pkgPath {%s}' % tixlib)
+         # Load Tix - this should work dynamically or statically
+-        # If it's static, lib/tix8.1/pkgIndex.tcl should have
+-        #		'load {} Tix'
+-        # If it's dynamic under Unix, lib/tix8.1/pkgIndex.tcl should have
+-        #		'load libtix8.1.8.3.so Tix'
++        # If it's static, tcl/tix8.1/pkgIndex.tcl should have
++        #               'load {} Tix'
++        # If it's dynamic under Unix, tcl/tix8.1/pkgIndex.tcl should have
++        #               'load libtix8.1.8.3.so Tix'
+         self.tk.eval('package require Tix')
+ 
++    def destroy(self):
++        # For safety, remove an delete_window binding before destroy
++        self.protocol("WM_DELETE_WINDOW", "")
++        Tkinter.Tk.destroy(self)
+ 
+ # The Tix 'tixForm' geometry manager
+ class Form:
+@@ -242,7 +243,7 @@
+             for x in y:
+                 z = z + (self.tk.getint(x),)
+             return z
+-        self.tk.call('tixForm', 'grid', self._w, xsize, ysize)
++        return self.tk.call('tixForm', 'grid', self._w, xsize, ysize)
+ 
+     def info(self, option=None):
+         if not option:
+@@ -258,7 +259,6 @@
+                        'tixForm', 'slaves', self._w)))
+ 
+ 
+-    
+ 
+ Tkinter.Widget.__bases__ = Tkinter.Widget.__bases__ + (Form,)
+ 
+@@ -277,37 +277,43 @@
+     """
+     def __init__ (self, master=None, widgetName=None,
+                 static_options=None, cnf={}, kw={}):
+-       # Merge keywords and dictionary arguments
+-       if kw:
++        # Merge keywords and dictionary arguments
++        if kw:
+             cnf = _cnfmerge((cnf, kw))
+-       else:
+-           cnf = _cnfmerge(cnf)
++        else:
++            cnf = _cnfmerge(cnf)
+ 
+-       # Move static options into extra. static_options must be
+-       # a list of keywords (or None).
+-       extra=()
+-       if static_options:
+-           for k,v in cnf.items()[:]:
+-              if k in static_options:
+-                  extra = extra + ('-' + k, v)
+-                  del cnf[k]
+-
+-       self.widgetName = widgetName
+-       Widget._setup(self, master, cnf)
+-
+-       # If widgetName is None, this is a dummy creation call where the
+-       # corresponding Tk widget has already been created by Tix
+-       if widgetName:
+-           apply(self.tk.call, (widgetName, self._w) + extra)
+-
+-       # Non-static options - to be done via a 'config' command
+-       if cnf:
+-           Widget.config(self, cnf)
+-
+-       # Dictionary to hold subwidget names for easier access. We can't
+-       # use the children list because the public Tix names may not be the
+-       # same as the pathname component
+-       self.subwidget_list = {}
++        # Move static options into extra. static_options must be
++        # a list of keywords (or None).
++        extra=()
++
++        # 'options' is always a static option
++        if static_options:
++            static_options.append('options')
++        else:
++            static_options = ['options']
++            
++        for k,v in cnf.items()[:]:
++            if k in static_options:
++                extra = extra + ('-' + k, v)
++                del cnf[k]
++
++        self.widgetName = widgetName
++        Widget._setup(self, master, cnf)
++
++        # If widgetName is None, this is a dummy creation call where the
++        # corresponding Tk widget has already been created by Tix
++        if widgetName:
++            apply(self.tk.call, (widgetName, self._w) + extra)
++
++        # Non-static options - to be done via a 'config' command
++        if cnf:
++            Widget.config(self, cnf)
++
++        # Dictionary to hold subwidget names for easier access. We can't
++        # use the children list because the public Tix names may not be the
++        # same as the pathname component
++        self.subwidget_list = {}
+ 
+     # We set up an attribute access function so that it is possible to
+     # do w.ok['text'] = 'Hello' rather than w.subwidget('ok')['text'] = 'Hello'
+@@ -315,65 +321,85 @@
+     # We can even do w.ok.invoke() because w.ok is subclassed from the
+     # Button class if you go through the proper constructors
+     def __getattr__(self, name):
+-       if self.subwidget_list.has_key(name):
+-           return self.subwidget_list[name]
+-       raise AttributeError, name
++        if self.subwidget_list.has_key(name):
++            return self.subwidget_list[name]
++        raise AttributeError, name
+ 
+     def set_silent(self, value):
+-       """Set a variable without calling its action routine"""
+-       self.tk.call('tixSetSilent', self._w, value)
++        """Set a variable without calling its action routine"""
++        self.tk.call('tixSetSilent', self._w, value)
+ 
+     def subwidget(self, name):
+-       """Return the named subwidget (which must have been created by
+-       the sub-class)."""
+-       n = self._subwidget_name(name)
+-       if not n:
+-           raise TclError, "Subwidget " + name + " not child of " + self._name
+-       # Remove header of name and leading dot
+-       n = n[len(self._w)+1:]
+-       return self._nametowidget(n)
++        """Return the named subwidget (which must have been created by
++        the sub-class)."""
++        n = self._subwidget_name(name)
++        if not n:
++            raise TclError, "Subwidget " + name + " not child of " + self._name
++        # Remove header of name and leading dot
++        n = n[len(self._w)+1:]
++        return self._nametowidget(n)
+ 
+     def subwidgets_all(self):
+-       """Return all subwidgets."""
+-       names = self._subwidget_names()
+-       if not names:
+-           return []
+-       retlist = []
+-       for name in names:
+-           name = name[len(self._w)+1:]
+-           try:
+-              retlist.append(self._nametowidget(name))
+-           except:
+-              # some of the widgets are unknown e.g. border in LabelFrame
+-              pass
+-       return retlist
++        """Return all subwidgets."""
++        names = self._subwidget_names()
++        if not names:
++            return []
++        retlist = []
++        for name in names:
++            name = name[len(self._w)+1:]
++            try:
++                retlist.append(self._nametowidget(name))
++            except:
++                # some of the widgets are unknown e.g. border in LabelFrame
++                pass
++        return retlist
+ 
+     def _subwidget_name(self,name):
+-       """Get a subwidget name (returns a String, not a Widget !)"""
+-       try:
+-           return self.tk.call(self._w, 'subwidget', name)
+-       except TclError:
+-           return None
++        """Get a subwidget name (returns a String, not a Widget !)"""
++        try:
++            return self.tk.call(self._w, 'subwidget', name)
++        except TclError:
++            return None
+ 
+     def _subwidget_names(self):
+-       """Return the name of all subwidgets."""
+-       try:
+-           x = self.tk.call(self._w, 'subwidgets', '-all')
+-           return self.tk.split(x)
+-       except TclError:
+-           return None
++        """Return the name of all subwidgets."""
++        try:
++            x = self.tk.call(self._w, 'subwidgets', '-all')
++            return self.tk.split(x)
++        except TclError:
++            return None
+ 
+     def config_all(self, option, value):
+-       """Set configuration options for all subwidgets (and self)."""
+-       if option == '':
+-           return
+-       elif not isinstance(option, StringType):
+-           option = `option`
+-       if not isinstance(value, StringType):
+-           value = `value`
+-       names = self._subwidget_names()
+-       for name in names:
+-           self.tk.call(name, 'configure', '-' + option, value)
++        """Set configuration options for all subwidgets (and self)."""
++        if option == '':
++            return
++        elif not isinstance(option, StringType):
++            option = `option`
++        if not isinstance(value, StringType):
++            value = `value`
++        names = self._subwidget_names()
++        for name in names:
++            self.tk.call(name, 'configure', '-' + option, value)
++    # These are missing from Tkinter
++    def image_create(self, imgtype, cnf={}, master=None, **kw):
++        if not master:
++            master = Tkinter._default_root
++            if not master:
++                raise RuntimeError, 'Too early to create image'
++        if kw and cnf: cnf = _cnfmerge((cnf, kw))
++        elif kw: cnf = kw
++        options = ()
++        for k, v in cnf.items():
++            if callable(v):
++                v = self._register(v)
++            options = options + ('-'+k, v)
++        return master.tk.call(('image', 'create', imgtype,) + options)
++    def image_delete(self, imgname):
++        try:
++            self.tk.call('image', 'delete', imgname)
++        except TclError:
++            # May happen if the root was destroyed
++            pass
+ 
+ # Subwidgets are child widgets created automatically by mega-widgets.
+ # In python, we have to create these subwidgets manually to mirror their
+@@ -387,53 +413,53 @@
+ 
+     def __init__(self, master, name,
+                destroy_physically=1, check_intermediate=1):
+-       if check_intermediate:
+-           path = master._subwidget_name(name)
+-           try:
+-              path = path[len(master._w)+1:]
+-              plist = string.splitfields(path, '.')
+-           except:
+-              plist = []
+-
+-       if (not check_intermediate) or len(plist) < 2:
+-           # immediate descendant
+-           TixWidget.__init__(self, master, None, None, {'name' : name})
+-       else:
+-           # Ensure that the intermediate widgets exist
+-           parent = master
+-           for i in range(len(plist) - 1):
+-              n = string.joinfields(plist[:i+1], '.')
+-              try:
+-                  w = master._nametowidget(n)
+-                  parent = w
+-              except KeyError:
+-                  # Create the intermediate widget
+-                  parent = TixSubWidget(parent, plist[i],
+-                                     destroy_physically=0,
+-                                     check_intermediate=0)
+-           TixWidget.__init__(self, parent, None, None, {'name' : name})
+-       self.destroy_physically = destroy_physically
++        if check_intermediate:
++            path = master._subwidget_name(name)
++            try:
++                path = path[len(master._w)+1:]
++                plist = path.split('.')
++            except:
++                plist = []
++
++        if (not check_intermediate) or len(plist) < 2:
++            # immediate descendant
++            TixWidget.__init__(self, master, None, None, {'name' : name})
++        else:
++            # Ensure that the intermediate widgets exist
++            parent = master
++            for i in range(len(plist) - 1):
++                n = '.'.join(plist[:i+1])
++                try:
++                    w = master._nametowidget(n)
++                    parent = w
++                except KeyError:
++                    # Create the intermediate widget
++                    parent = TixSubWidget(parent, plist[i],
++                                          destroy_physically=0,
++                                          check_intermediate=0)
++            TixWidget.__init__(self, parent, None, None, {'name' : name})
++        self.destroy_physically = destroy_physically
+ 
+     def destroy(self):
+-       # For some widgets e.g., a NoteBook, when we call destructors,
+-       # we must be careful not to destroy the frame widget since this
+-       # also destroys the parent NoteBook thus leading to an exception
+-       # in Tkinter when it finally calls Tcl to destroy the NoteBook
+-       for c in self.children.values(): c.destroy()
+-       if self.master.children.has_key(self._name):
+-           del self.master.children[self._name]
+-       if self.master.subwidget_list.has_key(self._name):
+-           del self.master.subwidget_list[self._name]
+-       if self.destroy_physically:
+-           # This is bypassed only for a few widgets
+-           self.tk.call('destroy', self._w)
++        # For some widgets e.g., a NoteBook, when we call destructors,
++        # we must be careful not to destroy the frame widget since this
++        # also destroys the parent NoteBook thus leading to an exception
++        # in Tkinter when it finally calls Tcl to destroy the NoteBook
++        for c in self.children.values(): c.destroy()
++        if self.master.children.has_key(self._name):
++            del self.master.children[self._name]
++        if self.master.subwidget_list.has_key(self._name):
++            del self.master.subwidget_list[self._name]
++        if self.destroy_physically:
++            # This is bypassed only for a few widgets
++            self.tk.call('destroy', self._w)
+ 
+ 
+ # Useful func. to split Tcl lists and return as a dict. From Tkinter.py
+ def _lst2dict(lst):
+     dict = {}
+     for x in lst:
+-       dict[x[0][1:]] = (x[0][1:],) + x[1:]
++        dict[x[0][1:]] = (x[0][1:],) + x[1:]
+     return dict
+ 
+ # Useful class to create a display style - later shared by many items.
+@@ -452,33 +478,32 @@
+                             self._options(cnf,kw) )
+ 
+     def __str__(self):
+-       return self.stylename
+- 
++        return self.stylename
++
+     def _options(self, cnf, kw ):
+-       if kw and cnf:
+-           cnf = _cnfmerge((cnf, kw))
+-       elif kw:
+-           cnf = kw
+-       opts = ()
+-       for k, v in cnf.items():
+-           opts = opts + ('-'+k, v)
+-       return opts
+- 
++        if kw and cnf:
++            cnf = _cnfmerge((cnf, kw))
++        elif kw:
++            cnf = kw
++        opts = ()
++        for k, v in cnf.items():
++            opts = opts + ('-'+k, v)
++        return opts
++
+     def delete(self):
+-       self.tk.call(self.stylename, 'delete')
+-       del(self)
+- 
++        self.tk.call(self.stylename, 'delete')
++
+     def __setitem__(self,key,value):
+-       self.tk.call(self.stylename, 'configure', '-%s'%key, value)
+- 
++        self.tk.call(self.stylename, 'configure', '-%s'%key, value)
++
+     def config(self, cnf={}, **kw):
+-       return _lst2dict(
+-           self.tk.split(
+-              apply(self.tk.call,
+-                    (self.stylename, 'configure') + self._options(cnf,kw))))
+- 
++        return _lst2dict(
++            self.tk.split(
++            apply(self.tk.call,
++                  (self.stylename, 'configure') + self._options(cnf,kw))))
++
+     def __getitem__(self,key):
+-       return self.tk.call(self.stylename, 'cget', '-%s'%key)
++        return self.tk.call(self.stylename, 'cget', '-%s'%key)
+ 
+ 
+ ######################################################
+@@ -493,44 +518,45 @@
+     label           Label
+     message         Message"""
+ 
++    # FIXME: It should inherit -superclass tixShell
+     def __init__(self, master=None, cnf={}, **kw):
+         # static seem to be -installcolormap -initwait -statusbar -cursor
+-       static = ['options', 'installcolormap', 'initwait', 'statusbar',
+-                 'cursor']
+-       TixWidget.__init__(self, master, 'tixBalloon', static, cnf, kw)
+-       self.subwidget_list['label'] = _dummyLabel(self, 'label',
+-                                                  destroy_physically=0)
+-       self.subwidget_list['message'] = _dummyLabel(self, 'message',
+-                                                    destroy_physically=0)
++        static = ['options', 'installcolormap', 'initwait', 'statusbar',
++                  'cursor']
++        TixWidget.__init__(self, master, 'tixBalloon', static, cnf, kw)
++        self.subwidget_list['label'] = _dummyLabel(self, 'label',
++                                                   destroy_physically=0)
++        self.subwidget_list['message'] = _dummyLabel(self, 'message',
++                                                     destroy_physically=0)
+ 
+     def bind_widget(self, widget, cnf={}, **kw):
+-       """Bind balloon widget to another.
+-       One balloon widget may be bound to several widgets at the same time"""
+-       apply(self.tk.call, 
+-             (self._w, 'bind', widget._w) + self._options(cnf, kw))
++        """Bind balloon widget to another.
++        One balloon widget may be bound to several widgets at the same time"""
++        apply(self.tk.call,
++              (self._w, 'bind', widget._w) + self._options(cnf, kw))
+ 
+     def unbind_widget(self, widget):
+-       self.tk.call(self._w, 'unbind', widget._w)
++        self.tk.call(self._w, 'unbind', widget._w)
+ 
+ class ButtonBox(TixWidget):
+     """ButtonBox - A container for pushbuttons.
+     Subwidgets are the buttons added with the add method.
+     """
+     def __init__(self, master=None, cnf={}, **kw):
+-       TixWidget.__init__(self, master, 'tixButtonBox',
+-                          ['orientation', 'options'], cnf, kw)
++        TixWidget.__init__(self, master, 'tixButtonBox',
++                           ['orientation', 'options'], cnf, kw)
+ 
+     def add(self, name, cnf={}, **kw):
+-       """Add a button with given name to box."""
++        """Add a button with given name to box."""
+ 
+-       btn = apply(self.tk.call,
+-                   (self._w, 'add', name) + self._options(cnf, kw))
+-       self.subwidget_list[name] = _dummyButton(self, name)
+-       return btn
++        btn = apply(self.tk.call,
++                    (self._w, 'add', name) + self._options(cnf, kw))
++        self.subwidget_list[name] = _dummyButton(self, name)
++        return btn
+ 
+     def invoke(self, name):
+-       if self.subwidget_list.has_key(name):
+-           self.tk.call(self._w, 'invoke', name)
++        if self.subwidget_list.has_key(name):
++            self.tk.call(self._w, 'invoke', name)
+ 
+ class ComboBox(TixWidget):
+     """ComboBox - an Entry field with a dropdown menu. The user can select a
+@@ -542,36 +568,39 @@
+     entry       Entry
+     arrow       Button
+     slistbox    ScrolledListBox
+-    tick        Button 
++    tick        Button
+     cross       Button : present if created with the fancy option"""
+ 
++    # FIXME: It should inherit -superclass tixLabelWidget
+     def __init__ (self, master=None, cnf={}, **kw):
+-       TixWidget.__init__(self, master, 'tixComboBox', 
+-                          ['editable', 'dropdown', 'fancy', 'options'],
+-                          cnf, kw)
+-       self.subwidget_list['label'] = _dummyLabel(self, 'label')
+-       self.subwidget_list['entry'] = _dummyEntry(self, 'entry')
+-       self.subwidget_list['arrow'] = _dummyButton(self, 'arrow')
+-       self.subwidget_list['slistbox'] = _dummyScrolledListBox(self,
+-                                                               'slistbox')
+-       try:
+-           self.subwidget_list['tick'] = _dummyButton(self, 'tick')
+-           self.subwidget_list['cross'] = _dummyButton(self, 'cross')
+-       except TypeError:
+-           # unavailable when -fancy not specified
+-           pass
++        TixWidget.__init__(self, master, 'tixComboBox',
++                           ['editable', 'dropdown', 'fancy', 'options'],
++                           cnf, kw)
++        self.subwidget_list['label'] = _dummyLabel(self, 'label')
++        self.subwidget_list['entry'] = _dummyEntry(self, 'entry')
++        self.subwidget_list['arrow'] = _dummyButton(self, 'arrow')
++        self.subwidget_list['slistbox'] = _dummyScrolledListBox(self,
++                                                                'slistbox')
++        try:
++            self.subwidget_list['tick'] = _dummyButton(self, 'tick')
++            self.subwidget_list['cross'] = _dummyButton(self, 'cross')
++        except TypeError:
++            # unavailable when -fancy not specified
++            pass
+ 
++    # align
++    
+     def add_history(self, str):
+-       self.tk.call(self._w, 'addhistory', str)
++        self.tk.call(self._w, 'addhistory', str)
+ 
+     def append_history(self, str):
+-       self.tk.call(self._w, 'appendhistory', str)
++        self.tk.call(self._w, 'appendhistory', str)
+ 
+     def insert(self, index, str):
+-       self.tk.call(self._w, 'insert', index, str)
++        self.tk.call(self._w, 'insert', index, str)
+ 
+     def pick(self, index):
+-       self.tk.call(self._w, 'pick', index)
++        self.tk.call(self._w, 'pick', index)
+ 
+ class Control(TixWidget):
+     """Control - An entry field with value change arrows.  The user can
+@@ -586,24 +615,25 @@
+     entry       Entry
+     label       Label"""
+ 
++    # FIXME: It should inherit -superclass tixLabelWidget
+     def __init__ (self, master=None, cnf={}, **kw):
+-       TixWidget.__init__(self, master, 'tixControl', ['options'], cnf, kw)
+-       self.subwidget_list['incr'] = _dummyButton(self, 'incr')
+-       self.subwidget_list['decr'] = _dummyButton(self, 'decr')
+-       self.subwidget_list['label'] = _dummyLabel(self, 'label')
+-       self.subwidget_list['entry'] = _dummyEntry(self, 'entry')
++        TixWidget.__init__(self, master, 'tixControl', ['options'], cnf, kw)
++        self.subwidget_list['incr'] = _dummyButton(self, 'incr')
++        self.subwidget_list['decr'] = _dummyButton(self, 'decr')
++        self.subwidget_list['label'] = _dummyLabel(self, 'label')
++        self.subwidget_list['entry'] = _dummyEntry(self, 'entry')
+ 
+     def decrement(self):
+-       self.tk.call(self._w, 'decr')
++        self.tk.call(self._w, 'decr')
+ 
+     def increment(self):
+-       self.tk.call(self._w, 'incr')
++        self.tk.call(self._w, 'incr')
+ 
+     def invoke(self):
+-       self.tk.call(self._w, 'invoke')
++        self.tk.call(self._w, 'invoke')
+ 
+     def update(self):
+-       self.tk.call(self._w, 'update')
++        self.tk.call(self._w, 'update')
+ 
+ class DirList(TixWidget):
+     """DirList - displays a list view of a directory, its previous
+@@ -616,14 +646,15 @@
+     hsb              Scrollbar
+     vsb              Scrollbar"""
+ 
++    # FIXME: It should inherit -superclass tixScrolledHList
+     def __init__(self, master, cnf={}, **kw):
+-       TixWidget.__init__(self, master, 'tixDirList', ['options'], cnf, kw)
+-       self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
+-       self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
+-       self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
++        TixWidget.__init__(self, master, 'tixDirList', ['options'], cnf, kw)
++        self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
++        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
++        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
+ 
+     def chdir(self, dir):
+-       self.tk.call(self._w, 'chdir', dir)
++        self.tk.call(self._w, 'chdir', dir)
+ 
+ class DirTree(TixWidget):
+     """DirTree - Directory Listing in a hierarchical view.
+@@ -633,18 +664,19 @@
+ 
+     Subwidget       Class
+     ---------       -----
+-    hlist       HList
+-    hsb              Scrollbar
+-    vsb              Scrollbar"""
++    hlist           HList
++    hsb             Scrollbar
++    vsb             Scrollbar"""
+ 
++    # FIXME: It should inherit -superclass tixScrolledHList
+     def __init__(self, master, cnf={}, **kw):
+-       TixWidget.__init__(self, master, 'tixDirTree', ['options'], cnf, kw)
+-       self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
+-       self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
+-       self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
++        TixWidget.__init__(self, master, 'tixDirTree', ['options'], cnf, kw)
++        self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
++        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
++        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
+ 
+     def chdir(self, dir):
+-       self.tk.call(self._w, 'chdir', dir)
++        self.tk.call(self._w, 'chdir', dir)
+ 
+ class DirSelectBox(TixWidget):
+     """DirSelectBox - Motif style file select box.
+@@ -652,18 +684,18 @@
+     the user to choose a file. FileSelectBox stores the files mostly
+     recently selected into a ComboBox widget so that they can be quickly
+     selected again.
+-    
++
+     Subwidget       Class
+     ---------       -----
+     selection       ComboBox
+-    filter       ComboBox
+-    dirlist       ScrolledListBox
+-    filelist       ScrolledListBox"""
++    filter          ComboBox
++    dirlist         ScrolledListBox
++    filelist        ScrolledListBox"""
+ 
+     def __init__(self, master, cnf={}, **kw):
+-       TixWidget.__init__(self, master, 'tixDirSelectBox', ['options'], cnf, kw)
+-       self.subwidget_list['dirlist'] = _dummyDirList(self, 'dirlist')
+-       self.subwidget_list['dircbx'] = _dummyFileComboBox(self, 'dircbx')
++        TixWidget.__init__(self, master, 'tixDirSelectBox', ['options'], cnf, kw)
++        self.subwidget_list['dirlist'] = _dummyDirList(self, 'dirlist')
++        self.subwidget_list['dircbx'] = _dummyFileComboBox(self, 'dircbx')
+ 
+ class ExFileSelectBox(TixWidget):
+     """ExFileSelectBox - MS Windows style file select box.
+@@ -681,21 +713,21 @@
+     filelist       ScrolledListBox"""
+ 
+     def __init__(self, master, cnf={}, **kw):
+-       TixWidget.__init__(self, master, 'tixExFileSelectBox', ['options'], cnf, kw)
+-       self.subwidget_list['cancel'] = _dummyButton(self, 'cancel')
+-       self.subwidget_list['ok'] = _dummyButton(self, 'ok')
+-       self.subwidget_list['hidden'] = _dummyCheckbutton(self, 'hidden')
+-       self.subwidget_list['types'] = _dummyComboBox(self, 'types')
+-       self.subwidget_list['dir'] = _dummyComboBox(self, 'dir')
+-       self.subwidget_list['dirlist'] = _dummyDirList(self, 'dirlist')
+-       self.subwidget_list['file'] = _dummyComboBox(self, 'file')
+-       self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist')
++        TixWidget.__init__(self, master, 'tixExFileSelectBox', ['options'], cnf, kw)
++        self.subwidget_list['cancel'] = _dummyButton(self, 'cancel')
++        self.subwidget_list['ok'] = _dummyButton(self, 'ok')
++        self.subwidget_list['hidden'] = _dummyCheckbutton(self, 'hidden')
++        self.subwidget_list['types'] = _dummyComboBox(self, 'types')
++        self.subwidget_list['dir'] = _dummyComboBox(self, 'dir')
++        self.subwidget_list['dirlist'] = _dummyDirList(self, 'dirlist')
++        self.subwidget_list['file'] = _dummyComboBox(self, 'file')
++        self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist')
+ 
+     def filter(self):
+-       self.tk.call(self._w, 'filter')
++        self.tk.call(self._w, 'filter')
+ 
+     def invoke(self):
+-       self.tk.call(self._w, 'invoke')
++        self.tk.call(self._w, 'invoke')
+ 
+ 
+ # Should inherit from a Dialog class
+@@ -708,17 +740,18 @@
+     ----------       -----
+     dirbox       DirSelectDialog"""
+ 
++    # FIXME: It should inherit -superclass tixDialogShell
+     def __init__(self, master, cnf={}, **kw):
+-       TixWidget.__init__(self, master, 'tixDirSelectDialog',
+-                        ['options'], cnf, kw)
+-       self.subwidget_list['dirbox'] = _dummyDirSelectBox(self, 'dirbox')
+-       # cancel and ok buttons are missing
+-       
++        TixWidget.__init__(self, master, 'tixDirSelectDialog',
++                           ['options'], cnf, kw)
++        self.subwidget_list['dirbox'] = _dummyDirSelectBox(self, 'dirbox')
++        # cancel and ok buttons are missing
++
+     def popup(self):
+-       self.tk.call(self._w, 'popup')
++        self.tk.call(self._w, 'popup')
+ 
+     def popdown(self):
+-       self.tk.call(self._w, 'popdown')
++        self.tk.call(self._w, 'popdown')
+ 
+ 
+ # Should inherit from a Dialog class
+@@ -730,16 +763,17 @@
+     ----------       -----
+     fsbox       ExFileSelectBox"""
+ 
++    # FIXME: It should inherit -superclass tixDialogShell
+     def __init__(self, master, cnf={}, **kw):
+-       TixWidget.__init__(self, master, 'tixExFileSelectDialog',
+-                        ['options'], cnf, kw)
+-       self.subwidget_list['fsbox'] = _dummyExFileSelectBox(self, 'fsbox')
++        TixWidget.__init__(self, master, 'tixExFileSelectDialog',
++                           ['options'], cnf, kw)
++        self.subwidget_list['fsbox'] = _dummyExFileSelectBox(self, 'fsbox')
+ 
+     def popup(self):
+-       self.tk.call(self._w, 'popup')
++        self.tk.call(self._w, 'popup')
+ 
+     def popdown(self):
+-       self.tk.call(self._w, 'popdown')
++        self.tk.call(self._w, 'popdown')
+ 
+ class FileSelectBox(TixWidget):
+     """ExFileSelectBox - Motif style file select box.
+@@ -747,26 +781,26 @@
+     the user to choose a file. FileSelectBox stores the files mostly
+     recently selected into a ComboBox widget so that they can be quickly
+     selected again.
+-    
++
+     Subwidget       Class
+     ---------       -----
+     selection       ComboBox
+-    filter       ComboBox
+-    dirlist       ScrolledListBox
+-    filelist       ScrolledListBox"""
++    filter          ComboBox
++    dirlist         ScrolledListBox
++    filelist        ScrolledListBox"""
+ 
+     def __init__(self, master, cnf={}, **kw):
+-       TixWidget.__init__(self, master, 'tixFileSelectBox', ['options'], cnf, kw)
+-       self.subwidget_list['dirlist'] = _dummyScrolledListBox(self, 'dirlist')
+-       self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist')
+-       self.subwidget_list['filter'] = _dummyComboBox(self, 'filter')
+-       self.subwidget_list['selection'] = _dummyComboBox(self, 'selection')
++        TixWidget.__init__(self, master, 'tixFileSelectBox', ['options'], cnf, kw)
++        self.subwidget_list['dirlist'] = _dummyScrolledListBox(self, 'dirlist')
++        self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist')
++        self.subwidget_list['filter'] = _dummyComboBox(self, 'filter')
++        self.subwidget_list['selection'] = _dummyComboBox(self, 'selection')
+ 
+     def apply_filter(self):              # name of subwidget is same as command
+-       self.tk.call(self._w, 'filter')
++        self.tk.call(self._w, 'filter')
+ 
+     def invoke(self):
+-       self.tk.call(self._w, 'invoke')
++        self.tk.call(self._w, 'invoke')
+ 
+ # Should inherit from a Dialog class
+ class FileSelectDialog(TixWidget):
+@@ -777,17 +811,18 @@
+     btns       StdButtonBox
+     fsbox       FileSelectBox"""
+ 
++    # FIXME: It should inherit -superclass tixStdDialogShell
+     def __init__(self, master, cnf={}, **kw):
+-       TixWidget.__init__(self, master, 'tixFileSelectDialog',
+-                        ['options'], cnf, kw)
+-       self.subwidget_list['btns'] = _dummyStdButtonBox(self, 'btns')
+-       self.subwidget_list['fsbox'] = _dummyFileSelectBox(self, 'fsbox')
++        TixWidget.__init__(self, master, 'tixFileSelectDialog',
++                           ['options'], cnf, kw)
++        self.subwidget_list['btns'] = _dummyStdButtonBox(self, 'btns')
++        self.subwidget_list['fsbox'] = _dummyFileSelectBox(self, 'fsbox')
+ 
+     def popup(self):
+-       self.tk.call(self._w, 'popup')
++        self.tk.call(self._w, 'popup')
+ 
+     def popdown(self):
+-       self.tk.call(self._w, 'popdown')
++        self.tk.call(self._w, 'popdown')
+ 
+ class FileEntry(TixWidget):
+     """FileEntry - Entry field with button that invokes a FileSelectDialog.
+@@ -800,18 +835,19 @@
+     button       Button
+     entry       Entry"""
+ 
++    # FIXME: It should inherit -superclass tixLabelWidget
+     def __init__(self, master, cnf={}, **kw):
+-       TixWidget.__init__(self, master, 'tixFileEntry',
+-                        ['dialogtype', 'options'], cnf, kw)
+-       self.subwidget_list['button'] = _dummyButton(self, 'button')
+-       self.subwidget_list['entry'] = _dummyEntry(self, 'entry')
++        TixWidget.__init__(self, master, 'tixFileEntry',
++                           ['dialogtype', 'options'], cnf, kw)
++        self.subwidget_list['button'] = _dummyButton(self, 'button')
++        self.subwidget_list['entry'] = _dummyEntry(self, 'entry')
+ 
+     def invoke(self):
+-       self.tk.call(self._w, 'invoke')
++        self.tk.call(self._w, 'invoke')
+ 
+     def file_dialog(self):
+-       # XXX return python object
+-       pass
++        # FIXME: return python object
++        pass
+ 
+ class HList(TixWidget):
+     """HList - Hierarchy display  widget can be used to display any data
+@@ -822,189 +858,189 @@
+     Subwidgets - None"""
+ 
+     def __init__ (self,master=None,cnf={}, **kw):
+-       TixWidget.__init__(self, master, 'tixHList',
+-                        ['columns', 'options'], cnf, kw)
++        TixWidget.__init__(self, master, 'tixHList',
++                           ['columns', 'options'], cnf, kw)
+ 
+     def add(self, entry, cnf={}, **kw):
+-       return apply(self.tk.call,
+-                   (self._w, 'add', entry) + self._options(cnf, kw))
++        return apply(self.tk.call,
++                     (self._w, 'add', entry) + self._options(cnf, kw))
+ 
+     def add_child(self, parent=None, cnf={}, **kw):
+-       if not parent:
+-           parent = ''
+-       return apply(self.tk.call,
+-                   (self._w, 'addchild', parent) + self._options(cnf, kw))
++        if not parent:
++            parent = ''
++        return apply(self.tk.call,
++                     (self._w, 'addchild', parent) + self._options(cnf, kw))
+ 
+     def anchor_set(self, entry):
+-       self.tk.call(self._w, 'anchor', 'set', entry)
++        self.tk.call(self._w, 'anchor', 'set', entry)
+ 
+     def anchor_clear(self):
+-       self.tk.call(self._w, 'anchor', 'clear')
++        self.tk.call(self._w, 'anchor', 'clear')
+ 
+     def column_width(self, col=0, width=None, chars=None):
+-       if not chars:
+-           return self.tk.call(self._w, 'column', 'width', col, width)
+-       else:
+-           return self.tk.call(self._w, 'column', 'width', col,
+-                            '-char', chars)
++        if not chars:
++            return self.tk.call(self._w, 'column', 'width', col, width)
++        else:
++            return self.tk.call(self._w, 'column', 'width', col,
++                                '-char', chars)
+ 
+     def delete_all(self):
+-       self.tk.call(self._w, 'delete', 'all')
++        self.tk.call(self._w, 'delete', 'all')
+ 
+     def delete_entry(self, entry):
+-       self.tk.call(self._w, 'delete', 'entry', entry)
++        self.tk.call(self._w, 'delete', 'entry', entry)
+ 
+     def delete_offsprings(self, entry):
+-       self.tk.call(self._w, 'delete', 'offsprings', entry)
++        self.tk.call(self._w, 'delete', 'offsprings', entry)
+ 
+     def delete_siblings(self, entry):
+-       self.tk.call(self._w, 'delete', 'siblings', entry)
++        self.tk.call(self._w, 'delete', 'siblings', entry)
+ 
+     def dragsite_set(self, index):
+-       self.tk.call(self._w, 'dragsite', 'set', index)
++        self.tk.call(self._w, 'dragsite', 'set', index)
+ 
+     def dragsite_clear(self):
+-       self.tk.call(self._w, 'dragsite', 'clear')
++        self.tk.call(self._w, 'dragsite', 'clear')
+ 
+     def dropsite_set(self, index):
+-       self.tk.call(self._w, 'dropsite', 'set', index)
++        self.tk.call(self._w, 'dropsite', 'set', index)
+ 
+     def dropsite_clear(self):
+-       self.tk.call(self._w, 'dropsite', 'clear')
++        self.tk.call(self._w, 'dropsite', 'clear')
+ 
+     def header_create(self, col, cnf={}, **kw):
+         apply(self.tk.call,
+               (self._w, 'header', 'create', col) + self._options(cnf, kw))
+- 
++
+     def header_configure(self, col, cnf={}, **kw):
+-       if cnf is None:
+-           return _lst2dict(
+-              self.tk.split(
+-                  self.tk.call(self._w, 'header', 'configure', col)))
+-       apply(self.tk.call, (self._w, 'header', 'configure', col)
+-             + self._options(cnf, kw))
+- 
++        if cnf is None:
++            return _lst2dict(
++                self.tk.split(
++                self.tk.call(self._w, 'header', 'configure', col)))
++        apply(self.tk.call, (self._w, 'header', 'configure', col)
++              + self._options(cnf, kw))
++
+     def header_cget(self,  col, opt):
+-       return self.tk.call(self._w, 'header', 'cget', col, opt)
+- 
++        return self.tk.call(self._w, 'header', 'cget', col, opt)
++
+     def header_exists(self,  col):
+-       return self.tk.call(self._w, 'header', 'exists', col)
+- 
++        return self.tk.call(self._w, 'header', 'exists', col)
++
+     def header_delete(self, col):
+         self.tk.call(self._w, 'header', 'delete', col)
+- 
++
+     def header_size(self, col):
+         return self.tk.call(self._w, 'header', 'size', col)
+- 
++
+     def hide_entry(self, entry):
+-       self.tk.call(self._w, 'hide', 'entry', entry)
++        self.tk.call(self._w, 'hide', 'entry', entry)
+ 
+     def indicator_create(self, entry, cnf={}, **kw):
+         apply(self.tk.call,
+               (self._w, 'indicator', 'create', entry) + self._options(cnf, kw))
+- 
++
+     def indicator_configure(self, entry, cnf={}, **kw):
+-       if cnf is None:
+-           return _lst2dict(
+-              self.tk.split(
+-                  self.tk.call(self._w, 'indicator', 'configure', entry)))
+-       apply(self.tk.call,
+-             (self._w, 'indicator', 'configure', entry) + self._options(cnf, kw))
+- 
++        if cnf is None:
++            return _lst2dict(
++                self.tk.split(
++                self.tk.call(self._w, 'indicator', 'configure', entry)))
++        apply(self.tk.call,
++              (self._w, 'indicator', 'configure', entry) + self._options(cnf, kw))
++
+     def indicator_cget(self,  entry, opt):
+-       return self.tk.call(self._w, 'indicator', 'cget', entry, opt)
+- 
++        return self.tk.call(self._w, 'indicator', 'cget', entry, opt)
++
+     def indicator_exists(self,  entry):
+-       return self.tk.call (self._w, 'indicator', 'exists', entry)
+- 
++        return self.tk.call (self._w, 'indicator', 'exists', entry)
++
+     def indicator_delete(self, entry):
+         self.tk.call(self._w, 'indicator', 'delete', entry)
+- 
++
+     def indicator_size(self, entry):
+         return self.tk.call(self._w, 'indicator', 'size', entry)
+ 
+     def info_anchor(self):
+-       return self.tk.call(self._w, 'info', 'anchor')
++        return self.tk.call(self._w, 'info', 'anchor')
+ 
+     def info_children(self, entry=None):
+-       c = self.tk.call(self._w, 'info', 'children', entry)
+-       return self.tk.splitlist(c)
++        c = self.tk.call(self._w, 'info', 'children', entry)
++        return self.tk.splitlist(c)
+ 
+     def info_data(self, entry):
+-       return self.tk.call(self._w, 'info', 'data', entry)
++        return self.tk.call(self._w, 'info', 'data', entry)
+ 
+     def info_exists(self, entry):
+-       return self.tk.call(self._w, 'info', 'exists', entry)
++        return self.tk.call(self._w, 'info', 'exists', entry)
+ 
+     def info_hidden(self, entry):
+-       return self.tk.call(self._w, 'info', 'hidden', entry)
++        return self.tk.call(self._w, 'info', 'hidden', entry)
+ 
+     def info_next(self, entry):
+-       return self.tk.call(self._w, 'info', 'next', entry)
++        return self.tk.call(self._w, 'info', 'next', entry)
+ 
+     def info_parent(self, entry):
+-       return self.tk.call(self._w, 'info', 'parent', entry)
++        return self.tk.call(self._w, 'info', 'parent', entry)
+ 
+     def info_prev(self, entry):
+-       return self.tk.call(self._w, 'info', 'prev', entry)
++        return self.tk.call(self._w, 'info', 'prev', entry)
+ 
+     def info_selection(self):
+-       c = self.tk.call(self._w, 'info', 'selection')
+-       return self.tk.splitlist(c)
++        c = self.tk.call(self._w, 'info', 'selection')
++        return self.tk.splitlist(c)
+ 
+     def item_cget(self, entry, col, opt):
+-       return self.tk.call(self._w, 'item', 'cget', entry, col, opt)
+- 
++        return self.tk.call(self._w, 'item', 'cget', entry, col, opt)
++
+     def item_configure(self, entry, col, cnf={}, **kw):
+-       if cnf is None:
+-           return _lst2dict(
+-              self.tk.split(
+-                  self.tk.call(self._w, 'item', 'configure', entry, col)))
+-       apply(self.tk.call, (self._w, 'item', 'configure', entry, col) +
+-             self._options(cnf, kw))
++        if cnf is None:
++            return _lst2dict(
++                self.tk.split(
++                self.tk.call(self._w, 'item', 'configure', entry, col)))
++        apply(self.tk.call, (self._w, 'item', 'configure', entry, col) +
++              self._options(cnf, kw))
+ 
+     def item_create(self, entry, col, cnf={}, **kw):
+-       apply(self.tk.call,
+-             (self._w, 'item', 'create', entry, col) + self._options(cnf, kw))
++        apply(self.tk.call,
++              (self._w, 'item', 'create', entry, col) + self._options(cnf, kw))
+ 
+     def item_exists(self, entry, col):
+-       return self.tk.call(self._w, 'item', 'exists', entry, col)
+- 
++        return self.tk.call(self._w, 'item', 'exists', entry, col)
++
+     def item_delete(self, entry, col):
+-       self.tk.call(self._w, 'item', 'delete', entry, col)
++        self.tk.call(self._w, 'item', 'delete', entry, col)
+ 
+     def nearest(self, y):
+-       return self.tk.call(self._w, 'nearest', y)
++        return self.tk.call(self._w, 'nearest', y)
+ 
+     def see(self, entry):
+-       self.tk.call(self._w, 'see', entry)
++        self.tk.call(self._w, 'see', entry)
+ 
+     def selection_clear(self, cnf={}, **kw):
+-       apply(self.tk.call,
+-             (self._w, 'selection', 'clear') + self._options(cnf, kw))
++        apply(self.tk.call,
++              (self._w, 'selection', 'clear') + self._options(cnf, kw))
+ 
+     def selection_includes(self, entry):
+-       return self.tk.call(self._w, 'selection', 'includes', entry)
++        return self.tk.call(self._w, 'selection', 'includes', entry)
+ 
+     def selection_set(self, first, last=None):
+-       self.tk.call(self._w, 'selection', 'set', first, last)
++        self.tk.call(self._w, 'selection', 'set', first, last)
+ 
+     def show_entry(self, entry):
+-       return self.tk.call(self._w, 'show', 'entry', entry)
++        return self.tk.call(self._w, 'show', 'entry', entry)
+ 
+     def xview(self, *args):
+-       apply(self.tk.call, (self._w, 'xview') + args)
++        apply(self.tk.call, (self._w, 'xview') + args)
+ 
+     def yview(self, *args):
+-       apply(self.tk.call, (self._w, 'yview') + args)
++        apply(self.tk.call, (self._w, 'yview') + args)
+ 
+ class InputOnly(TixWidget):
+-    """InputOnly - Invisible widget.
++    """InputOnly - Invisible widget. Unix only.
+ 
+     Subwidgets - None"""
+ 
+     def __init__ (self,master=None,cnf={}, **kw):
+-       TixWidget.__init__(self, master, 'tixInputOnly', None, cnf, kw)
++        TixWidget.__init__(self, master, 'tixInputOnly', None, cnf, kw)
+ 
+ class LabelEntry(TixWidget):
+     """LabelEntry - Entry field with label. Packages an entry widget
+@@ -1017,10 +1053,10 @@
+     entry       Entry"""
+ 
+     def __init__ (self,master=None,cnf={}, **kw):
+-       TixWidget.__init__(self, master, 'tixLabelEntry',
+-                        ['labelside','options'], cnf, kw)
+-       self.subwidget_list['label'] = _dummyLabel(self, 'label')
+-       self.subwidget_list['entry'] = _dummyEntry(self, 'entry')
++        TixWidget.__init__(self, master, 'tixLabelEntry',
++                           ['labelside','options'], cnf, kw)
++        self.subwidget_list['label'] = _dummyLabel(self, 'label')
++        self.subwidget_list['entry'] = _dummyEntry(self, 'entry')
+ 
+ class LabelFrame(TixWidget):
+     """LabelFrame - Labelled Frame container. Packages a frame widget
+@@ -1034,10 +1070,10 @@
+     frame       Frame"""
+ 
+     def __init__ (self,master=None,cnf={}, **kw):
+-       TixWidget.__init__(self, master, 'tixLabelFrame',
+-                        ['labelside','options'], cnf, kw)
+-       self.subwidget_list['label'] = _dummyLabel(self, 'label')
+-       self.subwidget_list['frame'] = _dummyFrame(self, 'frame')
++        TixWidget.__init__(self, master, 'tixLabelFrame',
++                           ['labelside','options'], cnf, kw)
++        self.subwidget_list['label'] = _dummyLabel(self, 'label')
++        self.subwidget_list['frame'] = _dummyFrame(self, 'frame')
+ 
+ 
+ class ListNoteBook(TixWidget):
+@@ -1049,19 +1085,32 @@
+     choosing the name of the desired page in the hlist subwidget."""
+ 
+     def __init__(self, master, cnf={}, **kw):
+-       TixWidget.__init__(self, master, 'tixDirList', ['options'], cnf, kw)
+-       self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
+-       self.subwidget_list['shlist'] = _dummyScrolledHList(self, 'vsb')
+-
++        TixWidget.__init__(self, master, 'tixListNoteBook', ['options'], cnf, kw)
++        # Is this necessary? It's not an exposed subwidget in Tix.
++        self.subwidget_list['pane'] = _dummyPanedWindow(self, 'pane',
++                                                        destroy_physically=0)
++        self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
++        self.subwidget_list['shlist'] = _dummyScrolledHList(self, 'shlist')
+ 
+     def add(self, name, cnf={}, **kw):
+-       apply(self.tk.call,
+-             (self._w, 'add', name) + self._options(cnf, kw))
+-       self.subwidget_list[name] = TixSubWidget(self, name)
+-       return self.subwidget_list[name]
++        apply(self.tk.call,
++              (self._w, 'add', name) + self._options(cnf, kw))
++        self.subwidget_list[name] = TixSubWidget(self, name)
++        return self.subwidget_list[name]
++
++    def page(self, name):
++       return self.subwidget(name)
++
++    def pages(self):
++       # Can't call subwidgets_all directly because we don't want .nbframe
++       names = self.tk.split(self.tk.call(self._w, 'pages'))
++       ret = []
++       for x in names:
++           ret.append(self.subwidget(x))
++       return ret
+ 
+     def raise_page(self, name):              # raise is a python keyword
+-       self.tk.call(self._w, 'raise', name)
++        self.tk.call(self._w, 'raise', name)
+ 
+ class Meter(TixWidget):
+     """The Meter widget can be used to show the progress of a background
+@@ -1069,8 +1118,8 @@
+     """
+ 
+     def __init__(self, master=None, cnf={}, **kw):
+-       TixWidget.__init__(self, master, 'tixMeter',
+-                        ['options'], cnf, kw)
++        TixWidget.__init__(self, master, 'tixMeter',
++                           ['options'], cnf, kw)
+ 
+ class NoteBook(TixWidget):
+     """NoteBook - Multi-page container widget (tabbed notebook metaphor).
+@@ -1081,38 +1130,40 @@
+     <pages>       page widgets added dynamically with the add method"""
+ 
+     def __init__ (self,master=None,cnf={}, **kw):
+-       TixWidget.__init__(self,master,'tixNoteBook', ['options'], cnf, kw)
+-       self.subwidget_list['nbframe'] = TixSubWidget(self, 'nbframe',
+-                                                destroy_physically=0)
++        TixWidget.__init__(self,master,'tixNoteBook', ['options'], cnf, kw)
++        self.subwidget_list['nbframe'] = TixSubWidget(self, 'nbframe',
++                                                      destroy_physically=0)
+ 
+     def add(self, name, cnf={}, **kw):
+-       apply(self.tk.call,
+-             (self._w, 'add', name) + self._options(cnf, kw))
+-       self.subwidget_list[name] = TixSubWidget(self, name)
+-       return self.subwidget_list[name]
++        apply(self.tk.call,
++              (self._w, 'add', name) + self._options(cnf, kw))
++        self.subwidget_list[name] = TixSubWidget(self, name)
++        return self.subwidget_list[name]
+ 
+     def delete(self, name):
+-       self.tk.call(self._w, 'delete', name)
++        self.tk.call(self._w, 'delete', name)
++        self.subwidget_list[name].destroy()
++        del self.subwidget_list[name]
+ 
+     def page(self, name):
+-       return self.subwidget(name)
++        return self.subwidget(name)
+ 
+     def pages(self):
+-       # Can't call subwidgets_all directly because we don't want .nbframe
+-       names = self.tk.split(self.tk.call(self._w, 'pages'))
+-       ret = []
+-       for x in names:
+-           ret.append(self.subwidget(x))
+-       return ret
++        # Can't call subwidgets_all directly because we don't want .nbframe
++        names = self.tk.split(self.tk.call(self._w, 'pages'))
++        ret = []
++        for x in names:
++            ret.append(self.subwidget(x))
++        return ret
+ 
+     def raise_page(self, name):              # raise is a python keyword
+-       self.tk.call(self._w, 'raise', name)
++        self.tk.call(self._w, 'raise', name)
+ 
+     def raised(self):
+-       return self.tk.call(self._w, 'raised')
++        return self.tk.call(self._w, 'raised')
+ 
+ class NoteBookFrame(TixWidget):
+-    """Will be added when Tix documentation is available !!!"""
++    # FIXME: This is dangerous to expose to be called on its own.
+     pass
+ 
+ class OptionMenu(TixWidget):
+@@ -1120,30 +1171,30 @@
+ 
+     Subwidget       Class
+     ---------       -----
+-    menubutton       Menubutton
+-    menu       Menu"""
++    menubutton      Menubutton
++    menu            Menu"""
+ 
+     def __init__(self, master, cnf={}, **kw):
+-       TixWidget.__init__(self, master, 'tixOptionMenu', ['options'], cnf, kw)
+-       self.subwidget_list['menubutton'] = _dummyMenubutton(self, 'menubutton')
+-       self.subwidget_list['menu'] = _dummyMenu(self, 'menu')
++        TixWidget.__init__(self, master, 'tixOptionMenu', ['options'], cnf, kw)
++        self.subwidget_list['menubutton'] = _dummyMenubutton(self, 'menubutton')
++        self.subwidget_list['menu'] = _dummyMenu(self, 'menu')
+ 
+     def add_command(self, name, cnf={}, **kw):
+-       apply(self.tk.call,
+-             (self._w, 'add', 'command', name) + self._options(cnf, kw))
++        apply(self.tk.call,
++              (self._w, 'add', 'command', name) + self._options(cnf, kw))
+ 
+     def add_separator(self, name, cnf={}, **kw):
+-       apply(self.tk.call,
+-             (self._w, 'add', 'separator', name) + self._options(cnf, kw))
++        apply(self.tk.call,
++              (self._w, 'add', 'separator', name) + self._options(cnf, kw))
+ 
+     def delete(self, name):
+-       self.tk.call(self._w, 'delete', name)
++        self.tk.call(self._w, 'delete', name)
+ 
+     def disable(self, name):
+-       self.tk.call(self._w, 'disable', name)
++        self.tk.call(self._w, 'disable', name)
+ 
+     def enable(self, name):
+-       self.tk.call(self._w, 'enable', name)
++        self.tk.call(self._w, 'enable', name)
+ 
+ class PanedWindow(TixWidget):
+     """PanedWindow - Multi-pane container widget
+@@ -1157,21 +1208,41 @@
+     <panes>       g/p widgets added dynamically with the add method."""
+ 
+     def __init__(self, master, cnf={}, **kw):
+-       TixWidget.__init__(self, master, 'tixPanedWindow', ['orientation', 'options'], cnf, kw)
++        TixWidget.__init__(self, master, 'tixPanedWindow', ['orientation', 'options'], cnf, kw)
+ 
++    # add delete forget panecget paneconfigure panes setsize
+     def add(self, name, cnf={}, **kw):
+-       apply(self.tk.call,
+-             (self._w, 'add', name) + self._options(cnf, kw))
+-       self.subwidget_list[name] = TixSubWidget(self, name,
+-                                           check_intermediate=0)
+-       return self.subwidget_list[name]
++        apply(self.tk.call,
++              (self._w, 'add', name) + self._options(cnf, kw))
++        self.subwidget_list[name] = TixSubWidget(self, name,
++                                                 check_intermediate=0)
++        return self.subwidget_list[name]
++
++    def delete(self, name):
++        self.tk.call(self._w, 'delete', name)
++        self.subwidget_list[name].destroy()
++        del self.subwidget_list[name]
++
++    def forget(self, name):
++        self.tk.call(self._w, 'forget', name)
++
++    def panecget(self,  entry, opt):
++        return self.tk.call(self._w, 'panecget', entry, opt)
++
++    def paneconfigure(self, entry, cnf={}, **kw):
++        if cnf is None:
++            return _lst2dict(
++                self.tk.split(
++                self.tk.call(self._w, 'paneconfigure', entry)))
++        apply(self.tk.call,
++              (self._w, 'paneconfigure', entry) + self._options(cnf, kw))
+ 
+     def panes(self):
+-       names = self.tk.call(self._w, 'panes')
+-       ret = []
+-       for x in names:
+-           ret.append(self.subwidget(x))
+-       return ret
++        names = self.tk.call(self._w, 'panes')
++        ret = []
++        for x in names:
++            ret.append(self.subwidget(x))
++        return ret
+ 
+ class PopupMenu(TixWidget):
+     """PopupMenu widget can be used as a replacement of the tk_popup command.
+@@ -1184,91 +1255,96 @@
+     menubutton       Menubutton
+     menu       Menu"""
+ 
++    # FIXME: It should inherit -superclass tixShell
+     def __init__(self, master, cnf={}, **kw):
+-       TixWidget.__init__(self, master, 'tixPopupMenu', ['options'], cnf, kw)
+-       self.subwidget_list['menubutton'] = _dummyMenubutton(self, 'menubutton')
+-       self.subwidget_list['menu'] = _dummyMenu(self, 'menu')
++        TixWidget.__init__(self, master, 'tixPopupMenu', ['options'], cnf, kw)
++        self.subwidget_list['menubutton'] = _dummyMenubutton(self, 'menubutton')
++        self.subwidget_list['menu'] = _dummyMenu(self, 'menu')
+ 
+     def bind_widget(self, widget):
+-       self.tk.call(self._w, 'bind', widget._w)
++        self.tk.call(self._w, 'bind', widget._w)
+ 
+     def unbind_widget(self, widget):
+-       self.tk.call(self._w, 'unbind', widget._w)
++        self.tk.call(self._w, 'unbind', widget._w)
+ 
+     def post_widget(self, widget, x, y):
+-       self.tk.call(self._w, 'post', widget._w, x, y)
++        self.tk.call(self._w, 'post', widget._w, x, y)
+ 
+ class ResizeHandle(TixWidget):
+     """Internal widget to draw resize handles on Scrolled widgets."""
+-
+     def __init__(self, master, cnf={}, **kw):
+-       # There seems to be a Tix bug rejecting the configure method
+-       # Let's try making the flags -static
+-       flags = ['options', 'command', 'cursorfg', 'cursorbg',
+-                'handlesize', 'hintcolor', 'hintwidth',
+-                'x', 'y']
+-       # In fact, x y height width are configurable
+-       TixWidget.__init__(self, master, 'tixResizeHandle',
++        # There seems to be a Tix bug rejecting the configure method
++        # Let's try making the flags -static
++        flags = ['options', 'command', 'cursorfg', 'cursorbg',
++                 'handlesize', 'hintcolor', 'hintwidth',
++                 'x', 'y']
++        # In fact, x y height width are configurable
++        TixWidget.__init__(self, master, 'tixResizeHandle',
+                            flags, cnf, kw)
+ 
+     def attach_widget(self, widget):
+-       self.tk.call(self._w, 'attachwidget', widget._w)
++        self.tk.call(self._w, 'attachwidget', widget._w)
+ 
+     def detach_widget(self, widget):
+-       self.tk.call(self._w, 'detachwidget', widget._w)
++        self.tk.call(self._w, 'detachwidget', widget._w)
+ 
+     def hide(self, widget):
+-       self.tk.call(self._w, 'hide', widget._w)
++        self.tk.call(self._w, 'hide', widget._w)
+ 
+     def show(self, widget):
+-       self.tk.call(self._w, 'show', widget._w)
++        self.tk.call(self._w, 'show', widget._w)
+ 
+ class ScrolledHList(TixWidget):
+     """ScrolledHList - HList with automatic scrollbars."""
+ 
++    # FIXME: It should inherit -superclass tixScrolledWidget
+     def __init__(self, master, cnf={}, **kw):
+-       TixWidget.__init__(self, master, 'tixScrolledHList', ['options'],
+-                        cnf, kw)
+-       self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
+-       self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
+-       self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
++        TixWidget.__init__(self, master, 'tixScrolledHList', ['options'],
++                           cnf, kw)
++        self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
++        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
++        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
+ 
+ class ScrolledListBox(TixWidget):
+     """ScrolledListBox - Listbox with automatic scrollbars."""
+ 
++    # FIXME: It should inherit -superclass tixScrolledWidget
+     def __init__(self, master, cnf={}, **kw):
+-       TixWidget.__init__(self, master, 'tixScrolledListBox', ['options'], cnf, kw)
+-       self.subwidget_list['listbox'] = _dummyListbox(self, 'listbox')
+-       self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
+-       self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
++        TixWidget.__init__(self, master, 'tixScrolledListBox', ['options'], cnf, kw)
++        self.subwidget_list['listbox'] = _dummyListbox(self, 'listbox')
++        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
++        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
+ 
+ class ScrolledText(TixWidget):
+     """ScrolledText - Text with automatic scrollbars."""
+ 
++    # FIXME: It should inherit -superclass tixScrolledWidget
+     def __init__(self, master, cnf={}, **kw):
+-       TixWidget.__init__(self, master, 'tixScrolledText', ['options'], cnf, kw)
+-       self.subwidget_list['text'] = _dummyText(self, 'text')
+-       self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
+-       self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
++        TixWidget.__init__(self, master, 'tixScrolledText', ['options'], cnf, kw)
++        self.subwidget_list['text'] = _dummyText(self, 'text')
++        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
++        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
+ 
+ class ScrolledTList(TixWidget):
+     """ScrolledTList - TList with automatic scrollbars."""
+ 
++    # FIXME: It should inherit -superclass tixScrolledWidget
+     def __init__(self, master, cnf={}, **kw):
+-       TixWidget.__init__(self, master, 'tixScrolledTList', ['options'],
+-                        cnf, kw)
+-       self.subwidget_list['tlist'] = _dummyTList(self, 'tlist')
+-       self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
+-       self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
++        TixWidget.__init__(self, master, 'tixScrolledTList', ['options'],
++                           cnf, kw)
++        self.subwidget_list['tlist'] = _dummyTList(self, 'tlist')
++        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
++        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
+ 
+ class ScrolledWindow(TixWidget):
+     """ScrolledWindow - Window with automatic scrollbars."""
+ 
++    # FIXME: It should inherit -superclass tixScrolledWidget
+     def __init__(self, master, cnf={}, **kw):
+-       TixWidget.__init__(self, master, 'tixScrolledWindow', ['options'], cnf, kw)
+-       self.subwidget_list['window'] = _dummyFrame(self, 'window')
+-       self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
+-       self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
++        TixWidget.__init__(self, master, 'tixScrolledWindow', ['options'], cnf, kw)
++        self.subwidget_list['window'] = _dummyFrame(self, 'window')
++        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
++        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
+ 
+ class Select(TixWidget):
+     """Select - Container of button subwidgets. It can be used to provide
+@@ -1276,36 +1352,70 @@
+ 
+     Subwidgets are buttons added dynamically using the add method."""
+ 
++    # FIXME: It should inherit -superclass tixLabelWidget
+     def __init__(self, master, cnf={}, **kw):
+-       TixWidget.__init__(self, master, 'tixSelect',
+-                        ['allowzero', 'radio', 'orientation', 'labelside',
+-                         'options'],
+-                        cnf, kw)
+-       self.subwidget_list['label'] = _dummyLabel(self, 'label')
++        TixWidget.__init__(self, master, 'tixSelect',
++                           ['allowzero', 'radio', 'orientation', 'labelside',
++                            'options'],
++                           cnf, kw)
++        self.subwidget_list['label'] = _dummyLabel(self, 'label')
+ 
+     def add(self, name, cnf={}, **kw):
+-       apply(self.tk.call,
+-             (self._w, 'add', name) + self._options(cnf, kw))
+-       self.subwidget_list[name] = _dummyButton(self, name)
+-       return self.subwidget_list[name]
++        apply(self.tk.call,
++              (self._w, 'add', name) + self._options(cnf, kw))
++        self.subwidget_list[name] = _dummyButton(self, name)
++        return self.subwidget_list[name]
+ 
+     def invoke(self, name):
+-       self.tk.call(self._w, 'invoke', name)
++        self.tk.call(self._w, 'invoke', name)
++
++class Shell(TixWidget):
++    """Toplevel window.
++
++    Subwidgets - None"""
++
++    def __init__ (self,master=None,cnf={}, **kw):
++        TixWidget.__init__(self, master, 'tixShell', ['options', 'title'], cnf, kw)
++
++class DialogShell(TixWidget):
++    """Toplevel window, with popup popdown and center methods.
++    It tells the window manager that it is a dialog window and should be
++    treated specially. The exact treatment depends on the treatment of
++    the window manager.
++
++    Subwidgets - None"""
++
++    # FIXME: It should inherit from  Shell
++    def __init__ (self,master=None,cnf={}, **kw):
++        TixWidget.__init__(self, master,
++                           'tixDialogShell',
++                           ['options', 'title', 'mapped',
++                            'minheight', 'minwidth',
++                            'parent', 'transient'], cnf, kw)
++
++    def popdown(self):
++        self.tk.call(self._w, 'popdown')
++
++    def popup(self):
++        self.tk.call(self._w, 'popup')
++
++    def center(self):
++        self.tk.call(self._w, 'center')
+ 
+ class StdButtonBox(TixWidget):
+     """StdButtonBox - Standard Button Box (OK, Apply, Cancel and Help) """
+ 
+     def __init__(self, master=None, cnf={}, **kw):
+-       TixWidget.__init__(self, master, 'tixStdButtonBox',
+-                        ['orientation', 'options'], cnf, kw)
+-       self.subwidget_list['ok'] = _dummyButton(self, 'ok')
+-       self.subwidget_list['apply'] = _dummyButton(self, 'apply')
+-       self.subwidget_list['cancel'] = _dummyButton(self, 'cancel')
+-       self.subwidget_list['help'] = _dummyButton(self, 'help')
++        TixWidget.__init__(self, master, 'tixStdButtonBox',
++                           ['orientation', 'options'], cnf, kw)
++        self.subwidget_list['ok'] = _dummyButton(self, 'ok')
++        self.subwidget_list['apply'] = _dummyButton(self, 'apply')
++        self.subwidget_list['cancel'] = _dummyButton(self, 'cancel')
++        self.subwidget_list['help'] = _dummyButton(self, 'help')
+ 
+     def invoke(self, name):
+-       if self.subwidget_list.has_key(name):
+-           self.tk.call(self._w, 'invoke', name)
++        if self.subwidget_list.has_key(name):
++            self.tk.call(self._w, 'invoke', name)
+ 
+ class TList(TixWidget):
+     """TList - Hierarchy display widget which can be
+@@ -1318,112 +1428,129 @@
+     Subwidgets - None"""
+ 
+     def __init__ (self,master=None,cnf={}, **kw):
+-       TixWidget.__init__(self, master, 'tixTList', ['options'], cnf, kw)
++        TixWidget.__init__(self, master, 'tixTList', ['options'], cnf, kw)
+ 
+     def active_set(self, index):
+-       self.tk.call(self._w, 'active', 'set', index)
++        self.tk.call(self._w, 'active', 'set', index)
+ 
+     def active_clear(self):
+-       self.tk.call(self._w, 'active', 'clear')
++        self.tk.call(self._w, 'active', 'clear')
+ 
+     def anchor_set(self, index):
+-       self.tk.call(self._w, 'anchor', 'set', index)
++        self.tk.call(self._w, 'anchor', 'set', index)
+ 
+     def anchor_clear(self):
+-       self.tk.call(self._w, 'anchor', 'clear')
++        self.tk.call(self._w, 'anchor', 'clear')
+ 
+     def delete(self, from_, to=None):
+-       self.tk.call(self._w, 'delete', from_, to)
++        self.tk.call(self._w, 'delete', from_, to)
+ 
+     def dragsite_set(self, index):
+-       self.tk.call(self._w, 'dragsite', 'set', index)
++        self.tk.call(self._w, 'dragsite', 'set', index)
+ 
+     def dragsite_clear(self):
+-       self.tk.call(self._w, 'dragsite', 'clear')
++        self.tk.call(self._w, 'dragsite', 'clear')
+ 
+     def dropsite_set(self, index):
+-       self.tk.call(self._w, 'dropsite', 'set', index)
++        self.tk.call(self._w, 'dropsite', 'set', index)
+ 
+     def dropsite_clear(self):
+-       self.tk.call(self._w, 'dropsite', 'clear')
++        self.tk.call(self._w, 'dropsite', 'clear')
+ 
+     def insert(self, index, cnf={}, **kw):
+-       apply(self.tk.call,
++        apply(self.tk.call,
+               (self._w, 'insert', index) + self._options(cnf, kw))
+ 
+     def info_active(self):
+-       return self.tk.call(self._w, 'info', 'active')
++        return self.tk.call(self._w, 'info', 'active')
+ 
+     def info_anchor(self):
+-       return self.tk.call(self._w, 'info', 'anchor')
++        return self.tk.call(self._w, 'info', 'anchor')
+ 
+     def info_down(self, index):
+-       return self.tk.call(self._w, 'info', 'down', index)
++        return self.tk.call(self._w, 'info', 'down', index)
+ 
+     def info_left(self, index):
+-       return self.tk.call(self._w, 'info', 'left', index)
++        return self.tk.call(self._w, 'info', 'left', index)
+ 
+     def info_right(self, index):
+-       return self.tk.call(self._w, 'info', 'right', index)
++        return self.tk.call(self._w, 'info', 'right', index)
+ 
+     def info_selection(self):
+-       c = self.tk.call(self._w, 'info', 'selection')
+-       return self.tk.splitlist(c)
++        c = self.tk.call(self._w, 'info', 'selection')
++        return self.tk.splitlist(c)
+ 
+     def info_size(self):
+-       return self.tk.call(self._w, 'info', 'size')
++        return self.tk.call(self._w, 'info', 'size')
+ 
+     def info_up(self, index):
+-       return self.tk.call(self._w, 'info', 'up', index)
++        return self.tk.call(self._w, 'info', 'up', index)
+ 
+     def nearest(self, x, y):
+-       return self.tk.call(self._w, 'nearest', x, y)
++        return self.tk.call(self._w, 'nearest', x, y)
+ 
+     def see(self, index):
+-       self.tk.call(self._w, 'see', index)
++        self.tk.call(self._w, 'see', index)
+ 
+     def selection_clear(self, cnf={}, **kw):
+-       apply(self.tk.call,
+-             (self._w, 'selection', 'clear') + self._options(cnf, kw))
++        apply(self.tk.call,
++              (self._w, 'selection', 'clear') + self._options(cnf, kw))
+ 
+     def selection_includes(self, index):
+-       return self.tk.call(self._w, 'selection', 'includes', index)
++        return self.tk.call(self._w, 'selection', 'includes', index)
+ 
+     def selection_set(self, first, last=None):
+-       self.tk.call(self._w, 'selection', 'set', first, last)
++        self.tk.call(self._w, 'selection', 'set', first, last)
+ 
+     def xview(self, *args):
+-       apply(self.tk.call, (self._w, 'xview') + args)
++        apply(self.tk.call, (self._w, 'xview') + args)
+ 
+     def yview(self, *args):
+-       apply(self.tk.call, (self._w, 'yview') + args)
++        apply(self.tk.call, (self._w, 'yview') + args)
+ 
+ class Tree(TixWidget):
+     """Tree - The tixTree widget can be used to display hierachical
+     data in a tree form. The user can adjust
+     the view of the tree by opening or closing parts of the tree."""
+ 
++    # FIXME: It should inherit -superclass tixScrolledWidget
+     def __init__(self, master=None, cnf={}, **kw):
+-       TixWidget.__init__(self, master, 'tixTree',
+-                        ['options'], cnf, kw)
+-       self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
+-       self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
+-       self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
++        TixWidget.__init__(self, master, 'tixTree',
++                           ['options'], cnf, kw)
++        self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
++        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
++        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
+ 
+     def autosetmode(self):
+-       self.tk.call(self._w, 'autosetmode')
++        '''This command calls the setmode method for all the entries in this
++     Tree widget: if an entry has no child entries, its mode is set to
++     none. Otherwise, if the entry has any hidden child entries, its mode is
++     set to open; otherwise its mode is set to close.'''
++        self.tk.call(self._w, 'autosetmode')
+ 
+     def close(self, entrypath):
+-       self.tk.call(self._w, 'close', entrypath)
++        '''Close the entry given by entryPath if its mode is close.'''
++        self.tk.call(self._w, 'close', entrypath)
+ 
+     def getmode(self, entrypath):
+-       return self.tk.call(self._w, 'getmode', entrypath)
++        '''Returns the current mode of the entry given by entryPath.'''
++        return self.tk.call(self._w, 'getmode', entrypath)
+ 
+     def open(self, entrypath):
+-       self.tk.call(self._w, 'open', entrypath)
++        '''Open the entry given by entryPath if its mode is open.'''
++        self.tk.call(self._w, 'open', entrypath)
+ 
+     def setmode(self, entrypath, mode='none'):
+-       self.tk.call(self._w, 'setmode', entrypath, mode)
++        '''This command is used to indicate whether the entry given by
++     entryPath has children entries and whether the children are visible. mode
++     must be one of open, close or none. If mode is set to open, a (+)
++     indicator is drawn next the the entry. If mode is set to close, a (-)
++     indicator is drawn next the the entry. If mode is set to none, no
++     indicators will be drawn for this entry. The default mode is none. The
++     open mode indicates the entry has hidden children and this entry can be
++     opened by the user. The close mode indicates that all the children of the
++     entry are now visible and the entry can be closed by the user.'''
++        self.tk.call(self._w, 'setmode', entrypath, mode)
+ 
+ 
+ # Could try subclassing Tree for CheckList - would need another arg to init
+@@ -1433,34 +1560,47 @@
+     similarly to the Tk checkbutton or radiobutton widgets, except it is
+     capable of handling many more items than checkbuttons or radiobuttons.
+     """
+-
++    # FIXME: It should inherit -superclass tixTree
+     def __init__(self, master=None, cnf={}, **kw):
+         TixWidget.__init__(self, master, 'tixCheckList',
+                            ['options'], cnf, kw)
+         self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
+         self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
+         self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
+-        
++
+     def autosetmode(self):
++        '''This command calls the setmode method for all the entries in this
++     Tree widget: if an entry has no child entries, its mode is set to
++     none. Otherwise, if the entry has any hidden child entries, its mode is
++     set to open; otherwise its mode is set to close.'''
+         self.tk.call(self._w, 'autosetmode')
+ 
+     def close(self, entrypath):
++        '''Close the entry given by entryPath if its mode is close.'''
+         self.tk.call(self._w, 'close', entrypath)
+ 
+     def getmode(self, entrypath):
++        '''Returns the current mode of the entry given by entryPath.'''
+         return self.tk.call(self._w, 'getmode', entrypath)
+ 
+     def open(self, entrypath):
++        '''Open the entry given by entryPath if its mode is open.'''
+         self.tk.call(self._w, 'open', entrypath)
+ 
+     def getselection(self, mode='on'):
+-        '''Mode can be on, off, default'''
+-        self.tk.call(self._w, 'getselection', mode)
++        '''Returns a list of items whose status matches status. If status is
++     not specified, the list of items in the "on" status will be returned.
++     Mode can be on, off, default'''
++        c = self.tk.split(self.tk.call(self._w, 'getselection', mode))
++        return self.tk.splitlist(c)
+ 
+     def getstatus(self, entrypath):
+-        self.tk.call(self._w, 'getstatus', entrypath)
++        '''Returns the current status of entryPath.'''
++        return self.tk.call(self._w, 'getstatus', entrypath)
+ 
+     def setstatus(self, entrypath, mode='on'):
++        '''Sets the status of entryPath to be status. A bitmap will be
++     displayed next to the entry its status is on, off or default.'''
+         self.tk.call(self._w, 'setstatus', entrypath, mode)
+ 
+ 
+@@ -1471,136 +1611,146 @@
+ 
+ class _dummyButton(Button, TixSubWidget):
+     def __init__(self, master, name, destroy_physically=1):
+-       TixSubWidget.__init__(self, master, name, destroy_physically)
++        TixSubWidget.__init__(self, master, name, destroy_physically)
+ 
+ class _dummyCheckbutton(Checkbutton, TixSubWidget):
+     def __init__(self, master, name, destroy_physically=1):
+-       TixSubWidget.__init__(self, master, name, destroy_physically)
++        TixSubWidget.__init__(self, master, name, destroy_physically)
+ 
+ class _dummyEntry(Entry, TixSubWidget):
+     def __init__(self, master, name, destroy_physically=1):
+-       TixSubWidget.__init__(self, master, name, destroy_physically)
++        TixSubWidget.__init__(self, master, name, destroy_physically)
+ 
+ class _dummyFrame(Frame, TixSubWidget):
+     def __init__(self, master, name, destroy_physically=1):
+-       TixSubWidget.__init__(self, master, name, destroy_physically)
++        TixSubWidget.__init__(self, master, name, destroy_physically)
+ 
+ class _dummyLabel(Label, TixSubWidget):
+     def __init__(self, master, name, destroy_physically=1):
+-       TixSubWidget.__init__(self, master, name, destroy_physically)
++        TixSubWidget.__init__(self, master, name, destroy_physically)
+ 
+ class _dummyListbox(Listbox, TixSubWidget):
+     def __init__(self, master, name, destroy_physically=1):
+-       TixSubWidget.__init__(self, master, name, destroy_physically)
++        TixSubWidget.__init__(self, master, name, destroy_physically)
+ 
+ class _dummyMenu(Menu, TixSubWidget):
+     def __init__(self, master, name, destroy_physically=1):
+-       TixSubWidget.__init__(self, master, name, destroy_physically)
++        TixSubWidget.__init__(self, master, name, destroy_physically)
+ 
+ class _dummyMenubutton(Menubutton, TixSubWidget):
+     def __init__(self, master, name, destroy_physically=1):
+-       TixSubWidget.__init__(self, master, name, destroy_physically)
++        TixSubWidget.__init__(self, master, name, destroy_physically)
+ 
+ class _dummyScrollbar(Scrollbar, TixSubWidget):
+     def __init__(self, master, name, destroy_physically=1):
+-       TixSubWidget.__init__(self, master, name, destroy_physically)
++        TixSubWidget.__init__(self, master, name, destroy_physically)
+ 
+ class _dummyText(Text, TixSubWidget):
+     def __init__(self, master, name, destroy_physically=1):
+-       TixSubWidget.__init__(self, master, name, destroy_physically)
++        TixSubWidget.__init__(self, master, name, destroy_physically)
+ 
+ class _dummyScrolledListBox(ScrolledListBox, TixSubWidget):
+     def __init__(self, master, name, destroy_physically=1):
+-       TixSubWidget.__init__(self, master, name, destroy_physically)
+-       self.subwidget_list['listbox'] = _dummyListbox(self, 'listbox')
+-       self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
+-       self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
++        TixSubWidget.__init__(self, master, name, destroy_physically)
++        self.subwidget_list['listbox'] = _dummyListbox(self, 'listbox')
++        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
++        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
+ 
+ class _dummyHList(HList, TixSubWidget):
+     def __init__(self, master, name, destroy_physically=1):
+-       TixSubWidget.__init__(self, master, name, destroy_physically)
++        TixSubWidget.__init__(self, master, name, destroy_physically)
+ 
+ class _dummyScrolledHList(ScrolledHList, TixSubWidget):
+     def __init__(self, master, name, destroy_physically=1):
+-       TixSubWidget.__init__(self, master, name, destroy_physically)
+-       self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
+-       self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
+-       self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
++        TixSubWidget.__init__(self, master, name, destroy_physically)
++        self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
++        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
++        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
+ 
+ class _dummyTList(TList, TixSubWidget):
+     def __init__(self, master, name, destroy_physically=1):
+-       TixSubWidget.__init__(self, master, name, destroy_physically)
++        TixSubWidget.__init__(self, master, name, destroy_physically)
+ 
+ class _dummyComboBox(ComboBox, TixSubWidget):
+     def __init__(self, master, name, destroy_physically=1):
+-       TixSubWidget.__init__(self, master, name, destroy_physically)
+-       self.subwidget_list['entry'] = _dummyEntry(self, 'entry')
+-       self.subwidget_list['arrow'] = _dummyButton(self, 'arrow')
+-       # I'm not sure about this destroy_physically=0 in all cases;
+-       # it may depend on if -dropdown is true; I've added as a trial
+-       self.subwidget_list['slistbox'] = _dummyScrolledListBox(self,
+-                                                        'slistbox',
+-                                                        destroy_physically=0)
+-       self.subwidget_list['listbox'] = _dummyListbox(self, 'listbox',
+-                                                 destroy_physically=0)
++        TixSubWidget.__init__(self, master, name, ['fancy',destroy_physically])
++        self.subwidget_list['label'] = _dummyLabel(self, 'label')
++        self.subwidget_list['entry'] = _dummyEntry(self, 'entry')
++        self.subwidget_list['arrow'] = _dummyButton(self, 'arrow')
++
++        self.subwidget_list['slistbox'] = _dummyScrolledListBox(self,
++                                                                'slistbox')
++        try:
++            self.subwidget_list['tick'] = _dummyButton(self, 'tick')
++            #cross Button : present if created with the fancy option
++            self.subwidget_list['cross'] = _dummyButton(self, 'cross')
++        except TypeError:
++            # unavailable when -fancy not specified
++            pass
+ 
+ class _dummyDirList(DirList, TixSubWidget):
+     def __init__(self, master, name, destroy_physically=1):
+-       TixSubWidget.__init__(self, master, name, destroy_physically)
+-       self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
+-       self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
+-       self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
++        TixSubWidget.__init__(self, master, name, destroy_physically)
++        self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
++        self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
++        self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
+ 
+ class _dummyDirSelectBox(DirSelectBox, TixSubWidget):
+     def __init__(self, master, name, destroy_physically=1):
+-       TixSubWidget.__init__(self, master, name, destroy_physically)
+-       self.subwidget_list['dirlist'] = _dummyDirList(self, 'dirlist')
+-       self.subwidget_list['dircbx'] = _dummyFileComboBox(self, 'dircbx')
++        TixSubWidget.__init__(self, master, name, destroy_physically)
++        self.subwidget_list['dirlist'] = _dummyDirList(self, 'dirlist')
++        self.subwidget_list['dircbx'] = _dummyFileComboBox(self, 'dircbx')
+ 
+ class _dummyExFileSelectBox(ExFileSelectBox, TixSubWidget):
+     def __init__(self, master, name, destroy_physically=1):
+-       TixSubWidget.__init__(self, master, name, destroy_physically)
+-       self.subwidget_list['cancel'] = _dummyButton(self, 'cancel')
+-       self.subwidget_list['ok'] = _dummyButton(self, 'ok')
+-       self.subwidget_list['hidden'] = _dummyCheckbutton(self, 'hidden')
+-       self.subwidget_list['types'] = _dummyComboBox(self, 'types')
+-       self.subwidget_list['dir'] = _dummyComboBox(self, 'dir')
+-       self.subwidget_list['dirlist'] = _dummyScrolledListBox(self, 'dirlist')
+-       self.subwidget_list['file'] = _dummyComboBox(self, 'file')
+-       self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist')
++        TixSubWidget.__init__(self, master, name, destroy_physically)
++        self.subwidget_list['cancel'] = _dummyButton(self, 'cancel')
++        self.subwidget_list['ok'] = _dummyButton(self, 'ok')
++        self.subwidget_list['hidden'] = _dummyCheckbutton(self, 'hidden')
++        self.subwidget_list['types'] = _dummyComboBox(self, 'types')
++        self.subwidget_list['dir'] = _dummyComboBox(self, 'dir')
++        self.subwidget_list['dirlist'] = _dummyScrolledListBox(self, 'dirlist')
++        self.subwidget_list['file'] = _dummyComboBox(self, 'file')
++        self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist')
+ 
+ class _dummyFileSelectBox(FileSelectBox, TixSubWidget):
+     def __init__(self, master, name, destroy_physically=1):
+-       TixSubWidget.__init__(self, master, name, destroy_physically)
+-       self.subwidget_list['dirlist'] = _dummyScrolledListBox(self, 'dirlist')
+-       self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist')
+-       self.subwidget_list['filter'] = _dummyComboBox(self, 'filter')
+-       self.subwidget_list['selection'] = _dummyComboBox(self, 'selection')
++        TixSubWidget.__init__(self, master, name, destroy_physically)
++        self.subwidget_list['dirlist'] = _dummyScrolledListBox(self, 'dirlist')
++        self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist')
++        self.subwidget_list['filter'] = _dummyComboBox(self, 'filter')
++        self.subwidget_list['selection'] = _dummyComboBox(self, 'selection')
+ 
+ class _dummyFileComboBox(ComboBox, TixSubWidget):
+     def __init__(self, master, name, destroy_physically=1):
+-       TixSubWidget.__init__(self, master, name, destroy_physically)
+-       self.subwidget_list['dircbx'] = _dummyComboBox(self, 'dircbx')
++        TixSubWidget.__init__(self, master, name, destroy_physically)
++        self.subwidget_list['dircbx'] = _dummyComboBox(self, 'dircbx')
+ 
+ class _dummyStdButtonBox(StdButtonBox, TixSubWidget):
+     def __init__(self, master, name, destroy_physically=1):
+-       TixSubWidget.__init__(self, master, name, destroy_physically)
+-       self.subwidget_list['ok'] = _dummyButton(self, 'ok')
+-       self.subwidget_list['apply'] = _dummyButton(self, 'apply')
+-       self.subwidget_list['cancel'] = _dummyButton(self, 'cancel')
+-       self.subwidget_list['help'] = _dummyButton(self, 'help')
++        TixSubWidget.__init__(self, master, name, destroy_physically)
++        self.subwidget_list['ok'] = _dummyButton(self, 'ok')
++        self.subwidget_list['apply'] = _dummyButton(self, 'apply')
++        self.subwidget_list['cancel'] = _dummyButton(self, 'cancel')
++        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)
++
++class _dummyPanedWindow(PanedWindow, TixSubWidget):
++    def __init__(self, master, name, destroy_physically=1):
+        TixSubWidget.__init__(self, master, name, destroy_physically)
+ 
+ ########################
+ ### Utility Routines ###
+ ########################
+ 
+-# Returns the qualified path name for the widget. Normally used to set
+-# default options for subwidgets. See tixwidgets.py
++#mike Should tixDestroy be exposed as a wrapper? - but not for widgets.
++
+ def OptionName(widget):
++    '''Returns the qualified path name for the widget. Normally used to set
++    default options for subwidgets. See tixwidgets.py'''
+     return widget.tk.call('tixOptionName', widget._w)
+ 
+ # Called with a dictionary argument of the form
+@@ -1611,10 +1761,11 @@
+ def FileTypeList(dict):
+     s = ''
+     for type in dict.keys():
+-       s = s + '{{' + type + '} {' + type + ' - ' + dict[type] + '}} '
++        s = s + '{{' + type + '} {' + type + ' - ' + dict[type] + '}} '
+     return s
+ 
+ # Still to be done:
++# tixIconView
+ class CObjView(TixWidget):
+     """This file implements the Canvas Object View widget. This is a base
+     class of IconView. It implements automatic placement/adjustment of the
+@@ -1622,5 +1773,43 @@
+     The scrollbars are adjusted so that the canvas is just large enough
+     to see all the objects.
+     """
++    # FIXME: It should inherit -superclass tixScrolledWidget
++    pass
++
++class Grid(TixWidget):
++    '''The Tix Grid command creates a new window  and makes it into a
++    tixGrid widget. Additional options, may be specified on the command
++    line or in the option database to configure aspects such as its cursor
++    and relief.
++
++    A Grid widget displays its contents in a two dimensional grid of cells.
++    Each cell may contain one Tix display item, which may be in text,
++    graphics or other formats. See the DisplayStyle class for more information
++    about Tix display items. Individual cells, or groups of cells, can be
++    formatted with a wide range of attributes, such as its color, relief and
++    border.
++
++    Subwidgets - None'''
+     pass
+ 
++    # def anchor option ?args ...?
++    # def bdtype
++    # def delete dim from ?to?
++    # def edit apply
++    # def edit set x y
++    # def entrycget x y option
++    # def entryconfigure x y ?option? ?value option value ...?
++    # def format
++    # def index
++    # def move dim from to offset
++    # def set x y ?-itemtype type? ?option value...?
++    # def size dim index ?option value ...?
++    # def unset x y
++    # def xview
++    # def yview
++    
++class ScrolledGrid(TixWidget):
++    '''Scrolled Grid widgets'''
++
++    # FIXME: It should inherit -superclass tixScrolledWidget
++    pass
+--- Demo/tix/tixwidgets.py	2003-01-03 12:27:12.000000000 +0100
++++ Demo/tix/tixwidgets.py	2002-12-31 10:46:16.000000000 +0100
+@@ -1,19 +1,20 @@
+ # -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
+ #
+-# $Id: tixwidgets.py,v 1.4.6.1 2002/03/01 13:10:02 nnorwitz Exp $
++# $Id: tixwidgets.py,v 1.10 2002/12/30 23:52:00 nnorwitz Exp $
+ #
+ # tixwidgets.py --
+ #
+ #	For Tix, see http://tix.sourceforge.net
+ #
+-# 	This is a demo program of all Tix widgets available from Python. If
+-#	you have installed Python & Tix properly, you can execute this as
++# 	This is a demo program of some of the Tix widgets available in Python.
++#	If you have installed Python & Tix properly, you can execute this as
+ #
+ #		% python tixwidgets.py
+ #
+ 
+ import os, os.path, sys, Tix
+ from Tkconstants import *
++import traceback, tkMessageBox
+ 
+ TCL_DONT_WAIT		= 1<<1
+ TCL_WINDOW_EVENTS	= 1<<2
+@@ -65,10 +66,6 @@
+         hm = Tix.Menu(help, tearoff=0)
+         help['menu'] = hm
+ 
+-        if w.tk.eval ('info commands console') == "console":
+-            fm.add_command(label='Console', underline=1,
+-                           command=lambda w=w: w.tk.eval('console show'))
+-
+         fm.add_command(label='Exit', underline=1,
+                      command = lambda self=self: self.quitcmd () )
+         hm.add_checkbutton(label='BalloonHelp', underline=0, command=ToggleHelp,
+@@ -76,14 +73,15 @@
+         # The trace variable option doesn't seem to work, instead I use 'command'
+         #apply(w.tk.call, ('trace', 'variable', self.useBalloons, 'w',
+         #		      ToggleHelp))
++
+         return w
+ 
+     def MkMainNotebook(self):
+         top = self.root
+         w = Tix.NoteBook(top, ipadx=5, ipady=5, options="""
+-        *TixNoteBook*tagPadX 6
+-        *TixNoteBook*tagPadY 4
+-        *TixNoteBook*borderWidth 2
++        tagPadX 6
++        tagPadY 4
++        borderWidth 2
+         """)
+         # This may be required if there is no *Background option
+         top['bg'] = w['bg']
+@@ -115,8 +113,10 @@
+         root = self.root
+         z = root.winfo_toplevel()
+         z.wm_title('Tix Widget Demonstration')
+-        z.geometry('790x590+10+10')
+-
++        if z.winfo_screenwidth() <= 800:
++            z.geometry('790x590+10+10')
++        else:
++            z.geometry('890x640+10+10')
+         demo.balloon = Tix.Balloon(root)
+         frame1 = self.MkMainMenu()
+         frame2 = self.MkMainNotebook()
+@@ -127,38 +127,51 @@
+         demo.balloon['statusbar'] = demo.statusbar
+         z.wm_protocol("WM_DELETE_WINDOW", lambda self=self: self.quitcmd())
+ 
++        # To show Tcl errors - uncomment this to see the listbox bug.
++        # Tkinter defines a Tcl tkerror procedure that in effect
++        # silences all background Tcl error reporting.
++	# root.tk.eval('if {[info commands tkerror] != ""} {rename tkerror pytkerror}')
+     def quitcmd (self):
+         """Quit our mainloop. It is up to you to call root.destroy() after."""
+         self.exit = 0
+ 
+     def loop(self):
+-        import tkMessageBox, traceback
++	"""This is an explict replacement for _tkinter mainloop()
++	It lets you catch keyboard interrupts easier, and avoids
++	the 20 msec. dead sleep() which burns a constant CPU."""
+         while self.exit < 0:
++            # There are 2 whiles here. The outer one lets you continue
++            # after a ^C interrupt.
+             try:
+-                self.root.tk.dooneevent(TCL_ALL_EVENTS)
++                # This is the replacement for _tkinter mainloop()
++                # It blocks waiting for the next Tcl event using select.
++                while self.exit < 0:
++                    self.root.tk.dooneevent(TCL_ALL_EVENTS)
+             except SystemExit:
++                # Tkinter uses SystemExit to exit
+                 #print 'Exit'
+                 self.exit = 1
+-                break
++                return
+             except KeyboardInterrupt:
+                 if tkMessageBox.askquestion ('Interrupt', 'Really Quit?') == 'yes':
+                     # self.tk.eval('exit')
++                    self.exit = 1
+                     return
+-                else:
+-                    pass
+                 continue
+             except:
++                # Otherwise it's some other error - be nice and say why
+                 t, v, tb = sys.exc_info()
+                 text = ""
+                 for line in traceback.format_exception(t,v,tb):
+                     text += line + '\n'
+                 try: tkMessageBox.showerror ('Error', text)
+                 except: pass
+-                tkinspect_quit (1)
++                self.exit = 1
++                raise SystemExit, 1
+ 
+     def destroy (self):
+         self.root.destroy()
+-    
++
+ def RunMain(root):
+     global demo
+ 
+@@ -253,19 +266,16 @@
+ 
+ def MkChoosers(nb, name):
+     w = nb.page(name)
+-    prefix = Tix.OptionName(w)
+-    if not prefix:
+-	prefix = ''
+-    w.option_add('*' + prefix + '*TixLabelFrame*label.padX', 4)
+-
+-    til = Tix.LabelFrame(w, label='Chooser Widgets')
+-    cbx = Tix.LabelFrame(w, label='tixComboBox')
+-    ctl = Tix.LabelFrame(w, label='tixControl')
+-    sel = Tix.LabelFrame(w, label='tixSelect')
+-    opt = Tix.LabelFrame(w, label='tixOptionMenu')
+-    fil = Tix.LabelFrame(w, label='tixFileEntry')
+-    fbx = Tix.LabelFrame(w, label='tixFileSelectBox')
+-    tbr = Tix.LabelFrame(w, label='Tool Bar')
++    options = "label.padX 4"
++
++    til = Tix.LabelFrame(w, label='Chooser Widgets', options=options)
++    cbx = Tix.LabelFrame(w, label='tixComboBox', options=options)
++    ctl = Tix.LabelFrame(w, label='tixControl', options=options)
++    sel = Tix.LabelFrame(w, label='tixSelect', options=options)
++    opt = Tix.LabelFrame(w, label='tixOptionMenu', options=options)
++    fil = Tix.LabelFrame(w, label='tixFileEntry', options=options)
++    fbx = Tix.LabelFrame(w, label='tixFileSelectBox', options=options)
++    tbr = Tix.LabelFrame(w, label='Tool Bar', options=options)
+ 
+     MkTitle(til.frame)
+     MkCombo(cbx.frame)
+@@ -292,16 +302,12 @@
+     fbx.form(right=-1, top=0, left='%66')
+ 
+ def MkCombo(w):
+-    prefix = Tix.OptionName(w)
+-    if not prefix: prefix = ''
+-    w.option_add('*' + prefix + '*TixComboBox*label.width', 10)
+-    w.option_add('*' + prefix + '*TixComboBox*label.anchor', Tix.E)
+-    w.option_add('*' + prefix + '*TixComboBox*entry.width', 14)
++    options="label.width %d label.anchor %s entry.width %d" % (10, Tix.E, 14)
+ 
+-    static = Tix.ComboBox(w, label='Static', editable=0)
+-    editable = Tix.ComboBox(w, label='Editable', editable=1)
++    static = Tix.ComboBox(w, label='Static', editable=0, options=options)
++    editable = Tix.ComboBox(w, label='Editable', editable=1, options=options)
+     history = Tix.ComboBox(w, label='History', editable=1, history=1,
+-			   anchor=Tix.E)
++			   anchor=Tix.E, options=options)
+     static.insert(Tix.END, 'January')
+     static.insert(Tix.END, 'February')
+     static.insert(Tix.END, 'March')
+@@ -354,32 +360,31 @@
+ def MkControl(w):
+     global demo_spintxt
+ 
+-    prefix = Tix.OptionName(w)
+-    if not prefix: prefix = ''
+-    w.option_add('*' + prefix + '*TixControl*label.width', 10)
+-    w.option_add('*' + prefix + '*TixControl*label.anchor', Tix.E)
+-    w.option_add('*' + prefix + '*TixControl*entry.width', 13)
++    options="label.width %d label.anchor %s entry.width %d" % (10, Tix.E, 13)
+ 
+     demo_spintxt = Tix.StringVar()
+     demo_spintxt.set(states[0])
+-    simple = Tix.Control(w, label='Numbers')
+-    spintxt = Tix.Control(w, label='States', variable=demo_spintxt)
++    simple = Tix.Control(w, label='Numbers', options=options)
++    spintxt = Tix.Control(w, label='States', variable=demo_spintxt,
++                          options=options)
+     spintxt['incrcmd'] = lambda w=spintxt: spin_cmd(w, 1)
+     spintxt['decrcmd'] = lambda w=spintxt: spin_cmd(w, -1)
+     spintxt['validatecmd'] = lambda w=spintxt: spin_validate(w)
+ 
+     simple.pack(side=Tix.TOP, padx=5, pady=3)
+     spintxt.pack(side=Tix.TOP, padx=5, pady=3)
+-    
++
+ def MkSelect(w):
+-    prefix = Tix.OptionName(w)
+-    if not prefix: prefix = ''
+-    w.option_add('*' + prefix + '*TixSelect*label.anchor', Tix.CENTER)
+-    w.option_add('*' + prefix + '*TixSelect*orientation', Tix.VERTICAL)
+-    w.option_add('*' + prefix + '*TixSelect*labelSide', Tix.TOP)
++    options = "label.anchor %s" % Tix.CENTER
+ 
+-    sel1 = Tix.Select(w, label='Mere Mortals', allowzero=1, radio=1)
+-    sel2 = Tix.Select(w, label='Geeks', allowzero=1, radio=0)
++    sel1 = Tix.Select(w, label='Mere Mortals', allowzero=1, radio=1,
++                      orientation=Tix.VERTICAL,
++                      labelside=Tix.TOP,
++                      options=options)
++    sel2 = Tix.Select(w, label='Geeks', allowzero=1, radio=0,
++                      orientation=Tix.VERTICAL,
++                      labelside= Tix.TOP,
++                      options=options)
+ 
+     sel1.add('eat', text='Eat')
+     sel1.add('work', text='Work')
+@@ -397,10 +402,9 @@
+     sel2.pack(side=Tix.LEFT, padx=5, pady=3, fill=Tix.X)
+ 
+ def MkOptMenu(w):
+-    prefix = Tix.OptionName(w)
+-    if not prefix: prefix = ''
+-    w.option_add('*' + prefix + '*TixOptionMenu*label.anchor', Tix.E)
+-    m = Tix.OptionMenu(w, label='File Format : ', options='menubutton.width 15')
++    options='menubutton.width 15 label.anchor %s' % Tix.E
++
++    m = Tix.OptionMenu(w, label='File Format : ', options=options)
+     m.add_command('text', label='Plain Text')
+     m.add_command('post', label='PostScript')
+     m.add_command('format', label='Formatted Text')
+@@ -412,7 +416,7 @@
+     m.pack(fill=Tix.X, padx=5, pady=3)
+ 
+ def MkFileEnt(w):
+-    msg = Tix.Message(w, 
++    msg = Tix.Message(w,
+ 		      relief=Tix.FLAT, width=240, anchor=Tix.N,
+ 		      text='Press the "open file" icon button and a TixFileSelectDialog will popup.')
+     ent = Tix.FileEntry(w, label='Select a file : ')
+@@ -420,25 +424,30 @@
+     ent.pack(side=Tix.TOP, fill=Tix.X, padx=3, pady=3)
+ 
+ def MkFileBox(w):
+-    msg = Tix.Message(w, 
++    """The FileSelectBox is a Motif-style box with various enhancements.
++    For example, you can adjust the size of the two listboxes
++    and your past selections are recorded.
++    """
++    msg = Tix.Message(w,
+ 		      relief=Tix.FLAT, width=240, anchor=Tix.N,
+-		      text='The TixFileSelectBox is a Motif-style box with various enhancements. For example, you can adjust the size of the two listboxes and your past selections are recorded.')
++		      text='The Tix FileSelectBox is a Motif-style box with various enhancements. For example, you can adjust the size of the two listboxes and your past selections are recorded.')
+     box = Tix.FileSelectBox(w)
+     msg.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=3, pady=3)
+     box.pack(side=Tix.TOP, fill=Tix.X, padx=3, pady=3)
+ 
+ def MkToolBar(w):
++    """The Select widget is also good for arranging buttons in a tool bar.
++    """
+     global demo
+ 
+-    prefix = Tix.OptionName(w)
+-    if not prefix: prefix = ''
+-    w.option_add('*' + prefix + '*TixSelect*frame.borderWidth', 1)
+-    msg = Tix.Message(w, 
++    options='frame.borderWidth 1'
++
++    msg = Tix.Message(w,
+ 		      relief=Tix.FLAT, width=240, anchor=Tix.N,
+ 		      text='The Select widget is also good for arranging buttons in a tool bar.')
+     bar = Tix.Frame(w, bd=2, relief=Tix.RAISED)
+-    font = Tix.Select(w, allowzero=1, radio=0, label='')
+-    para = Tix.Select(w, allowzero=0, radio=1, label='')
++    font = Tix.Select(w, allowzero=1, radio=0, label='', options=options)
++    para = Tix.Select(w, allowzero=0, radio=1, label='', options=options)
+ 
+     font.add('bold', bitmap='@' + demo.dir + '/bitmaps/bold.xbm')
+     font.add('italic', bitmap='@' + demo.dir + '/bitmaps/italic.xbm')
+@@ -456,24 +465,18 @@
+     para.pack({'in':bar}, side=Tix.LEFT, padx=3, pady=3)
+ 
+ def MkTitle(w):
+-    prefix = Tix.OptionName(w)
+-    if not prefix: prefix = ''
+-    w.option_add('*' + prefix + '*TixSelect*frame.borderWidth', 1)
+-    msg = Tix.Message(w, 
++    msg = Tix.Message(w,
+ 		      relief=Tix.FLAT, width=240, anchor=Tix.N,
+ 		      text='There are many types of "chooser" widgets that allow the user to input different types of information')
+     msg.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=3, pady=3)
+ 
+ def MkScroll(nb, name):
+     w = nb.page(name)
+-    prefix = Tix.OptionName(w)
+-    if not prefix:
+-	prefix = ''
+-    w.option_add('*' + prefix + '*TixLabelFrame*label.padX', 4)
+-
+-    sls = Tix.LabelFrame(w, label='tixScrolledListBox')
+-    swn = Tix.LabelFrame(w, label='tixScrolledWindow')
+-    stx = Tix.LabelFrame(w, label='tixScrolledText')
++    options='label.padX 4'
++
++    sls = Tix.LabelFrame(w, label='Tix.ScrolledListBox', options=options)
++    swn = Tix.LabelFrame(w, label='Tix.ScrolledWindow', options=options)
++    stx = Tix.LabelFrame(w, label='Tix.ScrolledText', options=options)
+ 
+     MkSList(sls.frame)
+     MkSWindow(swn.frame)
+@@ -483,10 +486,14 @@
+     swn.form(top=0, left=sls, right='%66', bottom=-1)
+     stx.form(top=0, left=swn, right=-1, bottom=-1)
+ 
++
+ def MkSList(w):
++    """This TixScrolledListBox is configured so that it uses scrollbars
++    only when it is necessary. Use the handles to resize the listbox and
++    watch the scrollbars automatically appear and disappear.  """
+     top = Tix.Frame(w, width=300, height=330)
+     bot = Tix.Frame(w)
+-    msg = Tix.Message(top, 
++    msg = Tix.Message(top,
+ 		      relief=Tix.FLAT, width=200, anchor=Tix.N,
+ 		      text='This TixScrolledListBox is configured so that it uses scrollbars only when it is necessary. Use the handles to resize the listbox and watch the scrollbars automatically appear and disappear.')
+ 
+@@ -517,31 +524,27 @@
+     list.update()
+     rh.attach_widget(list)
+ 
+-# See below why this is necessary.
+-global image1
+-image1 = None
+ def MkSWindow(w):
+-    global demo, image1
++    """The ScrolledWindow widget allows you to scroll any kind of Tk
++    widget. It is more versatile than a scrolled canvas widget.
++    """
++    global demo
++
++    text = 'The Tix ScrolledWindow widget allows you to scroll any kind of Tk widget. It is more versatile than a scrolled canvas widget.'
+ 
+-    text = 'The TixScrolledWindow widget allows you to scroll any kind of Tk widget. It is more versatile than a scrolled canvas widget.'
+-    
+     file = os.path.join(demo.dir, 'bitmaps', 'tix.gif')
+     if not os.path.isfile(file):
+         text += ' (Image missing)'
+ 
+     top = Tix.Frame(w, width=330, height=330)
+     bot = Tix.Frame(w)
+-    msg = Tix.Message(top, 
++    msg = Tix.Message(top,
+ 		      relief=Tix.FLAT, width=200, anchor=Tix.N,
+ 		      text=text)
+ 
+     win = Tix.ScrolledWindow(top, scrollbar='auto')
+ 
+-    # This image is not showing up under Python unless it is set to a
+-    # global variable - no problem under Tcl. I assume it is being garbage
+-    # collected some how, even though the tcl command 'image names' shows
+-    # that as far as Tcl is concerned, the image exists and is called pyimage1.
+-    image1 = Tix.Image('photo', file=file)
++    image1 = win.window.image_create('photo', file=file)
+     lbl = Tix.Label(win.window, image=image1)
+     lbl.pack(expand=1, fill=Tix.BOTH)
+ 
+@@ -556,6 +559,7 @@
+     btn.pack(anchor=Tix.CENTER)
+     top.pack(expand=1, fill=Tix.BOTH)
+     bot.pack(fill=Tix.BOTH)
++
+     win.bind('<Map>', func=lambda arg=0, rh=rh, win=win:
+ 	     win.tk.call('tixDoWhenIdle', str(rh), 'attachwidget', str(win)))
+ 
+@@ -565,15 +569,27 @@
+     rh.attach_widget(win)
+ 
+ def MkSText(w):
++    """The TixScrolledWindow widget allows you to scroll any kind of Tk
++    widget. It is more versatile than a scrolled canvas widget."""
+     top = Tix.Frame(w, width=330, height=330)
+     bot = Tix.Frame(w)
+-    msg = Tix.Message(top, 
++    msg = Tix.Message(top,
+ 		      relief=Tix.FLAT, width=200, anchor=Tix.N,
+-		      text='The TixScrolledWindow widget allows you to scroll any kind of Tk widget. It is more versatile than a scrolled canvas widget.')
++		      text='The Tix ScrolledWindow widget allows you to scroll any kind of Tk widget. It is more versatile than a scrolled canvas widget.')
+ 
+     win = Tix.ScrolledText(top, scrollbar='auto')
+-#    win.text['wrap'] = 'none'
+-    win.text.insert(Tix.END, 'This is a text widget embedded in a scrolled window. Although the original Tix demo does not have any text here, I decided to put in some so that you can see the effect of scrollbars etc.')
++    win.text['wrap'] = 'none'
++    win.text.insert(Tix.END, '''When -scrollbar is set to "auto", the
++scrollbars are shown only when needed. 
++Additional modifiers can be used to force a
++scrollbar to be shown or hidden. For example, 
++"auto -y" means the horizontal scrollbar 
++should be shown when needed but the vertical 
++scrollbar should always be hidden;
++"auto +x" means the vertical scrollbar
++should be shown when needed but the horizontal 
++scrollbar should always be shown, and so on.'''
++)
+     win.place(x=30, y=150, width=190, height=100)
+ 
+     rh = Tix.ResizeHandle(top, bg='black',
+@@ -595,13 +611,10 @@
+ 
+ def MkManager(nb, name):
+     w = nb.page(name)
+-    prefix = Tix.OptionName(w)
+-    if not prefix:
+-	prefix = ''
+-    w.option_add('*' + prefix + '*TixLabelFrame*label.padX', 4)
++    options='label.padX 4'
+ 
+-    pane = Tix.LabelFrame(w, label='tixPanedWindow')
+-    note = Tix.LabelFrame(w, label='tixNoteBook')
++    pane = Tix.LabelFrame(w, label='Tix.PanedWindow', options=options)
++    note = Tix.LabelFrame(w, label='Tix.NoteBook', options=options)
+ 
+     MkPanedWindow(pane.frame)
+     MkNoteBook(note.frame)
+@@ -610,7 +623,11 @@
+     note.form(top=0, right=-1, bottom=-1)
+ 
+ def MkPanedWindow(w):
+-    msg = Tix.Message(w, 
++    """The PanedWindow widget allows the user to interactively manipulate
++    the sizes of several panes. The panes can be arranged either vertically
++    or horizontally.
++    """
++    msg = Tix.Message(w,
+ 		      relief=Tix.FLAT, width=240, anchor=Tix.N,
+ 		      text='The PanedWindow widget allows the user to interactively manipulate the sizes of several panes. The panes can be arranged either vertically or horizontally.')
+     group = Tix.LabelEntry(w, label='Newsgroup:', options='entry.width 25')
+@@ -653,18 +670,15 @@
+     pane.pack(side=Tix.TOP, padx=3, pady=3, fill=Tix.BOTH, expand=1)
+ 
+ def MkNoteBook(w):
+-    msg = Tix.Message(w, 
++    msg = Tix.Message(w,
+ 		      relief=Tix.FLAT, width=240, anchor=Tix.N,
+ 		      text='The NoteBook widget allows you to layout a complex interface into individual pages.')
+-    prefix = Tix.OptionName(w)
+-    if not prefix:
+-	prefix = ''
+-    w.option_add('*' + prefix + '*TixControl*entry.width', 10)
+-    w.option_add('*' + prefix + '*TixControl*label.width', 18)
+-    w.option_add('*' + prefix + '*TixControl*label.anchor', Tix.E)
+-    w.option_add('*' + prefix + '*TixNoteBook*tagPadX', 8)
++    # prefix = Tix.OptionName(w)
++    # if not prefix: prefix = ''
++    # w.option_add('*' + prefix + '*TixNoteBook*tagPadX', 8)
++    options = "entry.width %d label.width %d label.anchor %s" % (10, 18, Tix.E)
+ 
+-    nb = Tix.NoteBook(w, ipadx=6, ipady=6)
++    nb = Tix.NoteBook(w, ipadx=6, ipady=6, options=options)
+     nb.add('hard_disk', label="Hard Disk", underline=0)
+     nb.add('network', label="Network", underline=0)
+ 
+@@ -709,30 +723,33 @@
+ 
+ def MkDirList(nb, name):
+     w = nb.page(name)
+-    prefix = Tix.OptionName(w)
+-    if not prefix:
+-	prefix = ''
+-    w.option_add('*' + prefix + '*TixLabelFrame*label.padX', 4)
++    options = "label.padX 4"
+ 
+-    dir = Tix.LabelFrame(w, label='tixDirList')
+-    fsbox = Tix.LabelFrame(w, label='tixExFileSelectBox')
++    dir = Tix.LabelFrame(w, label='Tix.DirList', options=options)
++    fsbox = Tix.LabelFrame(w, label='Tix.ExFileSelectBox', options=options)
+     MkDirListWidget(dir.frame)
+     MkExFileWidget(fsbox.frame)
+     dir.form(top=0, left=0, right='%40', bottom=-1)
+     fsbox.form(top=0, left='%40', right=-1, bottom=-1)
+ 
+ def MkDirListWidget(w):
+-    msg = Tix.Message(w, 
++    """The TixDirList widget gives a graphical representation of the file
++    system directory and makes it easy for the user to choose and access
++    directories.
++    """
++    msg = Tix.Message(w,
+ 		      relief=Tix.FLAT, width=240, anchor=Tix.N,
+-		      text='The TixDirList widget gives a graphical representation of the file system directory and makes it easy for the user to choose and access directories.')
++		      text='The Tix DirList widget gives a graphical representation of the file system directory and makes it easy for the user to choose and access directories.')
+     dirlist = Tix.DirList(w, options='hlist.padY 1 hlist.width 25 hlist.height 16')
+     msg.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=3, pady=3)
+     dirlist.pack(side=Tix.TOP, padx=3, pady=3)
+ 
+ def MkExFileWidget(w):
+-    msg = Tix.Message(w, 
++    """The TixExFileSelectBox widget is more user friendly than the Motif
++    style FileSelectBox.  """
++    msg = Tix.Message(w,
+ 		      relief=Tix.FLAT, width=240, anchor=Tix.N,
+-		      text='The TixExFileSelectBox widget is more user friendly than the Motif style FileSelectBox.')
++		      text='The Tix ExFileSelectBox widget is more user friendly than the Motif style FileSelectBox.')
+     # There's a bug in the ComboBoxes - the scrolledlistbox is destroyed
+     box = Tix.ExFileSelectBox(w, bd=2, relief=Tix.RAISED)
+     msg.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=3, pady=3)
+@@ -768,24 +785,24 @@
+ ##	    {d "Miscellaneous Widgets"	misc	}
+ ##	    {d "Image Types"		image	}
+ ##	}
+-##	
++##
+ ##	set image {
+ ##	    {d "Compound Image"		cmpimg	}
+ ##	    {d "XPM Image"		xpm	{i pixmap}}
+ ##	}
+-##	
++##
+ ##	set cmpimg {
+-##	    {f "In Buttons"		CmpImg.tcl	}
++##done	    {f "In Buttons"		CmpImg.tcl	}
+ ##	    {f "In NoteBook"		CmpImg2.tcl	}
+ ##	    {f "Notebook Color Tabs"	CmpImg4.tcl	}
+ ##	    {f "Icons"			CmpImg3.tcl	}
+ ##	}
+-##	
++##
+ ##	set xpm {
+ ##	    {f "In Button"		Xpm.tcl		{i pixmap}}
+ ##	    {f "In Menu"		Xpm1.tcl	{i pixmap}}
+ ##	}
+-##	
++##
+ ##	set file {
+ ##added	    {f DirList				DirList.tcl	}
+ ##added	    {f DirTree				DirTree.tcl	}
+@@ -794,7 +811,7 @@
+ ##	    {f FileSelectDialog			FileDlg.tcl	}
+ ##	    {f FileEntry			FileEnt.tcl	}
+ ##	}
+-##	
++##
+ ##	set hlist {
+ ##	    {f HList			HList1.tcl	}
+ ##	    {f CheckList		ChkList.tcl	{c tixCheckList}}
+@@ -803,7 +820,7 @@
+ ##done	    {f Tree			Tree.tcl	}
+ ##done	    {f "Tree (Dynamic)"		DynTree.tcl	{v win}}
+ ##	}
+-##	
++##
+ ##	set tlist {
+ ##	    {f "ScrolledTList (1)"	STList1.tcl	{c tixTList}}
+ ##	    {f "ScrolledTList (2)"	STList2.tcl	{c tixTList}}
+@@ -813,26 +830,26 @@
+ ##	if {$tcl_platform(platform) != "windows"} {
+ ##na	lappend tlist     {f "TList File Viewer"	STList3.tcl	{c tixTList}}
+ ##	}
+-##	
++##
+ ##	set grid {
+ ##na	    {f "Simple Grid"		SGrid0.tcl	{c tixGrid}}
+ ##na	    {f "ScrolledGrid"		SGrid1.tcl	{c tixGrid}}
+ ##na	    {f "Editable Grid"		EditGrid.tcl	{c tixGrid}}
+ ##	}
+-##	
++##
+ ##	set scroll {
+ ##	    {f ScrolledListBox		SListBox.tcl	}
+ ##	    {f ScrolledText		SText.tcl	}
+ ##	    {f ScrolledWindow		SWindow.tcl	}
+ ##na	    {f "Canvas Object View"	CObjView.tcl	{c tixCObjView}}
+ ##	}
+-##	
++##
+ ##	set manager {
+-##na	    {f ListNoteBook		ListNBK.tcl	}
++##	    {f ListNoteBook		ListNBK.tcl	}
+ ##done	    {f NoteBook			NoteBook.tcl	}
+ ##done	    {f PanedWindow		PanedWin.tcl	}
+ ##	}
+-##	
++##
+ ##	set misc {
+ ##done	    {f Balloon			Balloon.tcl	}
+ ##done	    {f ButtonBox		BtnBox.tcl	}
+@@ -840,7 +857,7 @@
+ ##done	    {f Control			Control.tcl	}
+ ##	    {f LabelEntry		LabEntry.tcl	}
+ ##	    {f LabelFrame		LabFrame.tcl	}
+-##na	    {f Meter			Meter.tcl	{c tixMeter}}
++##	    {f Meter			Meter.tcl	{c tixMeter}}
+ ##done	    {f OptionMenu		OptMenu.tcl	}
+ ##done	    {f PopupMenu		PopMenu.tcl	}
+ ##	    {f Select			Select.tcl	}
+@@ -857,12 +874,7 @@
+ 
+ def MkSample(nb, name):
+     w = nb.page(name)
+-    prefix = Tix.OptionName(w)
+-    if not prefix:
+-	prefix = ''
+-    else:
+-	prefix = '*' + prefix
+-    w.option_add(prefix + '*TixLabelFrame*label.padX', 4)
++    options = "label.padX 4"
+ 
+     pane = Tix.PanedWindow(w, orientation='horizontal')
+     pane.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH)
+@@ -871,25 +883,19 @@
+     f1['relief'] = 'flat'
+     f2['relief'] = 'flat'
+ 
+-    lab = Tix.Label(f1, text='Select a sample program:', anchor=Tix.W)
+-    lab.pack(side=Tix.TOP, expand=0, fill=Tix.X, padx=5, pady=5)
+-    lab1 = Tix.Label(f2, text='Source:', anchor=Tix.W)
+-    lab1.pack(side=Tix.TOP, expand=0, fill=Tix.X, padx=5, pady=5)
++    lab = Tix.LabelFrame(f1, label='Select a sample program:')
++    lab.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=5, pady=5)
++    lab1 = Tix.LabelFrame(f2, label='Source:')
++    lab1.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=5, pady=5)
+ 
+-    slb = Tix.Tree(f1, options='hlist.width 25')
++    slb = Tix.Tree(lab.frame, options='hlist.width 20')
+     slb.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=5)
+ 
+-    stext = Tix.ScrolledText(f2, name='stext')
++    stext = Tix.ScrolledText(lab1.frame, name='stext')
+     font = root.tk.eval('tix option get fixed_font')
+     stext.text.config(font=font)
+-    stext.text.bind('<Up>', lambda w=stext.text: w.yview(scroll='-1 unit'))
+-    stext.text.bind('<Down>', lambda w=stext.text: w.yview(scroll='1 unit'))
+-    stext.text.bind('<Left>', lambda w=stext.text: w.xview(scroll='-1 unit'))
+-    stext.text.bind('<Right>', lambda w=stext.text: w.xview(scroll='1 unit'))
+-    stext.pack(side=Tix.TOP, expand=1, fill=Tix.BOTH, padx=7)
+ 
+-    frame = Tix.Frame(f2, name='frame')
+-    frame.pack(side=Tix.TOP, expand=0, fill=Tix.X, padx=7)
++    frame = Tix.Frame(lab1.frame, name='frame')
+ 
+     run = Tix.Button(frame, text='Run ...', name='run')
+     view = Tix.Button(frame, text='View Source ...', name='view')
+@@ -901,6 +907,9 @@
+     stext.text['wrap'] = 'none'
+     stext.text['width'] = 80
+ 
++    frame.pack(side=Tix.BOTTOM, expand=0, fill=Tix.X, padx=7)
++    stext.pack(side=Tix.TOP, expand=0, fill=Tix.BOTH, padx=7)
++
+     slb.hlist['separator'] = '.'
+     slb.hlist['width'] = 25
+     slb.hlist['drawbranch'] = 0
--- python2.2-2.2.3dfsg.orig/debian/patches/tkinter-update.dpatch
+++ python2.2-2.2.3dfsg/debian/patches/tkinter-update.dpatch
@@ -0,0 +1,2110 @@
+#! /bin/sh -e
+
+# DP: update _tkinter.c to CVS HEAD (2003-05-19) for compatibility
+# DP: with threaded tk8.4.
+
+dir=
+if [ $# -eq 3 -a "$2" = '-d' ]; then
+    pdir="-d $3"
+    dir="$3/"
+elif [ $# -ne 1 ]; then
+    echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+    exit 1
+fi
+case "$1" in
+    -patch)
+        patch $pdir -f --no-backup-if-mismatch -p0 < $0
+        #cd ${dir}gcc && autoconf
+        ;;
+    -unpatch)
+        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
+        #rm ${dir}gcc/configure
+        ;;
+    *)
+	echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+        exit 1
+esac
+exit 0
+
+--- Lib/pydoc.py.old	2002-12-18 10:35:01.000000000 +0100
++++ Lib/pydoc.py	2002-12-29 13:58:09.000000000 +0100
+@@ -1919,6 +1919,7 @@
+             self.expanded = 0
+             self.window.wm_geometry('%dx%d' % (self.minwidth, self.minheight))
+             self.window.wm_minsize(self.minwidth, self.minheight)
++            self.window.tk.willdispatch()
+ 
+             import threading
+             threading.Thread(
+
+--- Modules/_tkinter.c~	2003-02-21 14:21:30.000000000 +0100
++++ Modules/_tkinter.c	2003-05-19 22:49:21.000000000 +0200
+@@ -9,17 +9,13 @@
+ 
+ /* TCL/TK VERSION INFO:
+ 
+-	Only Tcl/Tk 8.0 and later are supported.  Older versions are not
+-	supported.  (Use Python 1.5.2 if you cannot upgrade your Tcl/Tk
++	Only Tcl/Tk 8.2 and later are supported.  Older versions are not
++	supported.  (Use Python 2.2 if you cannot upgrade your Tcl/Tk
+ 	libraries.)
+ */
+ 
+ /* XXX Further speed-up ideas, involving Tcl 8.0 features:
+ 
+-   - In Tcl_Call(), create Tcl objects from the arguments, possibly using
+-   intelligent mappings between Python objects and Tcl objects (e.g. ints,
+-   floats and Tcl window pointers could be handled specially).
+-
+    - Register a new Tcl type, "Python callable", which can be called more
+    efficiently and passed to Tcl_EvalObj() directly (if this is possible).
+ 
+@@ -41,6 +37,32 @@
+ #define MAC_TCL
+ #endif
+ 
++/* Allow using this code in Python 2.[12] */
++#ifndef PyDoc_STRVAR
++#define PyDoc_STRVAR(name,str) static char name[] = str
++#endif
++
++#ifndef PyMODINIT_FUNC
++#define PyMODINIT_FUNC void
++#endif
++
++#ifndef PyBool_Check
++#define PyBool_Check(o)       0
++#define PyBool_FromLong       PyInt_FromLong
++#endif
++
++/* Starting with Tcl 8.4, many APIs offer const-correctness.  Unfortunately,
++   making _tkinter correct for this API means to break earlier
++   versions. USE_COMPAT_CONST allows to make _tkinter work with both 8.4 and
++   earlier versions. Once Tcl releases before 8.4 don't need to be supported
++   anymore, this should go. */
++#define USE_COMPAT_CONST
++
++/* If Tcl is compiled for threads, we must also define TCL_THREAD. We define
++   it always; if Tcl is not threaded, the thread functions in
++   Tcl are empty.  */
++#define TCL_THREADS
++
+ #ifdef TK_FRAMEWORK
+ #include <Tcl/tcl.h>
+ #include <Tk/tk.h>
+@@ -49,10 +71,29 @@
+ #include <tk.h>
+ #endif
+ 
++/* For Tcl 8.2 and 8.3, CONST* is not defined (except on Cygwin). */
++#ifndef CONST84_RETURN
++#define CONST84_RETURN
++#undef CONST
++#define CONST
++#endif
++
+ #define TKMAJORMINOR (TK_MAJOR_VERSION*1000 + TK_MINOR_VERSION)
+ 
+-#if TKMAJORMINOR < 8000
+-#error "Tk older than 8.0 not supported"
++#if TKMAJORMINOR < 8002
++#error "Tk older than 8.2 not supported"
++#endif
++
++/* Unicode conversion assumes that Tcl_UniChar is two bytes.
++   We cannot test this directly, so we test UTF-8 size instead,
++   expecting that TCL_UTF_MAX is changed if Tcl ever supports
++   either UTF-16 or UCS-4.  
++   Redhat 8 sets TCL_UTF_MAX to 6, and uses wchar_t for 
++   Tcl_Unichar. This is also ok as long as Python uses UCS-4,
++   as well.
++*/
++#if TCL_UTF_MAX != 3 && !(defined(Py_UNICODE_WIDE) && TCL_UTF_MAX==6)
++#error "unsupported Tcl configuration"
+ #endif
+ 
+ #if defined(macintosh)
+@@ -96,9 +137,8 @@
+ 
+ #ifdef WITH_THREAD
+ 
+-/* The threading situation is complicated.  Tcl is not thread-safe, except for
+-   Tcl 8.1, which will probably remain in alpha status for another 6 months
+-   (and the README says that Tk will probably remain thread-unsafe forever).
++/* The threading situation is complicated.  Tcl is not thread-safe, except
++   when configured with --enable-threads.
+    So we need to use a lock around all uses of Tcl.  Previously, the Python
+    interpreter lock was used for this.  However, this causes problems when
+    other Python threads need to run while Tcl is blocked waiting for events.
+@@ -133,31 +173,58 @@
+    These locks expand to several statements and brackets; they should not be
+    used in branches of if statements and the like.
+ 
++   If Tcl is threaded, this approach won't work anymore. The Tcl interpreter is
++   only valid in the thread that created it, and all Tk activity must happen in this
++   thread, also. That means that the mainloop must be invoked in the thread that
++   created the interpreter. Invoking commands from other threads is possible;
++   _tkinter will queue an event for the interpreter thread, which will then
++   execute the command and pass back the result. If the main thread is not in the
++   mainloop, and invoking commands causes an exception; if the main loop is running
++   but not processing events, the command invocation will block.
++
++   In addition, for a threaded Tcl, a single global tcl_tstate won't be sufficient
++   anymore, since multiple Tcl interpreters may simultaneously dispatch in different
++   threads. So we use the Tcl TLS API.
++
+ */
+ 
+ static PyThread_type_lock tcl_lock = 0;
++
++#ifdef TCL_THREADS
++static Tcl_ThreadDataKey state_key;
++typedef PyThreadState *ThreadSpecificData;
++#define tcl_tstate (*(PyThreadState**)Tcl_GetThreadData(&state_key, sizeof(PyThreadState*)))
++#else
+ static PyThreadState *tcl_tstate = NULL;
++#endif
+ 
+ #define ENTER_TCL \
+ 	{ PyThreadState *tstate = PyThreadState_Get(); Py_BEGIN_ALLOW_THREADS \
+-	    PyThread_acquire_lock(tcl_lock, 1); tcl_tstate = tstate;
++	    if(tcl_lock)PyThread_acquire_lock(tcl_lock, 1); tcl_tstate = tstate;
+ 
+ #define LEAVE_TCL \
+-    tcl_tstate = NULL; PyThread_release_lock(tcl_lock); Py_END_ALLOW_THREADS}
++    tcl_tstate = NULL; if(tcl_lock)PyThread_release_lock(tcl_lock); Py_END_ALLOW_THREADS}
+ 
+ #define ENTER_OVERLAP \
+ 	Py_END_ALLOW_THREADS
+ 
+ #define LEAVE_OVERLAP_TCL \
+-	tcl_tstate = NULL; PyThread_release_lock(tcl_lock); }
++	tcl_tstate = NULL; if(tcl_lock)PyThread_release_lock(tcl_lock); }
+ 
+ #define ENTER_PYTHON \
+ 	{ PyThreadState *tstate = tcl_tstate; tcl_tstate = NULL; \
+-            PyThread_release_lock(tcl_lock); PyEval_RestoreThread((tstate)); }
++	    if(tcl_lock)PyThread_release_lock(tcl_lock); PyEval_RestoreThread((tstate)); }
+ 
+ #define LEAVE_PYTHON \
+ 	{ PyThreadState *tstate = PyEval_SaveThread(); \
+-            PyThread_acquire_lock(tcl_lock, 1); tcl_tstate = tstate; }
++	    if(tcl_lock)PyThread_acquire_lock(tcl_lock, 1); tcl_tstate = tstate; }
++
++#define CHECK_TCL_APPARTMENT \
++	if (((TkappObject *)self)->threaded && \
++	    ((TkappObject *)self)->thread_id != Tcl_GetCurrentThread()) { \
++		PyErr_SetString(PyExc_RuntimeError, "Calling Tcl from different appartment"); \
++		return 0; \
++	}
+ 
+ #else
+ 
+@@ -167,6 +234,7 @@
+ #define LEAVE_OVERLAP_TCL
+ #define ENTER_PYTHON
+ #define LEAVE_PYTHON
++#define CHECK_TCL_APPARTMENT
+ 
+ #endif
+ 
+@@ -186,7 +254,7 @@
+ void Tcl_MacSetEventProc(TclMacConvertEventPtr procPtr);
+ int TkMacConvertEvent(EventRecord *eventPtr);
+ 
+-staticforward int PyMacConvertEvent(EventRecord *eventPtr);
++static int PyMacConvertEvent(EventRecord *eventPtr);
+ 
+ #include <SIOUX.h>
+ extern int SIOUXIsAppWindow(WindowPtr);
+@@ -199,11 +267,24 @@
+ 
+ /**** Tkapp Object Declaration ****/
+ 
+-staticforward PyTypeObject Tkapp_Type;
++static PyTypeObject Tkapp_Type;
+ 
+ typedef struct {
+ 	PyObject_HEAD
+ 	Tcl_Interp *interp;
++	int wantobjects;
++	int threaded; /* True if tcl_platform[threaded] */
++	Tcl_ThreadId thread_id;
++	int dispatching;
++	/* We cannot include tclInt.h, as this is internal.
++	   So we cache interesting types here. */
++	Tcl_ObjType *BooleanType;
++	Tcl_ObjType *ByteArrayType;
++	Tcl_ObjType *DoubleType;
++	Tcl_ObjType *IntType;
++	Tcl_ObjType *ListType;
++	Tcl_ObjType *ProcBodyType;
++	Tcl_ObjType *StringType;
+ } TkappObject;
+ 
+ #define Tkapp_Check(v) ((v)->ob_type == &Tkapp_Type)
+@@ -237,6 +318,8 @@
+ 
+ /**** Utils ****/
+ 
++static int Tkinter_busywaitinterval = 20;
++
+ #ifdef WITH_THREAD
+ #ifndef MS_WINDOWS
+ 
+@@ -252,6 +335,25 @@
+ 	select(0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &t);
+ }
+ #endif /* MS_WINDOWS */
++
++/* Wait up to 1s for the mainloop to come up. */
++
++static int
++WaitForMainloop(TkappObject* self)
++{
++	int i;
++	for (i = 0; i < 10; i++) {
++		if (self->dispatching)
++			return 1;
++		Py_BEGIN_ALLOW_THREADS
++		Sleep(100);
++		Py_END_ALLOW_THREADS
++	}
++	if (self->dispatching)
++		return 1;
++	PyErr_SetString(PyExc_RuntimeError, "main thread is not in main loop");
++	return 0;
++}
+ #endif /* WITH_THREAD */
+ 
+ 
+@@ -409,6 +511,67 @@
+ 	return v;
+ }
+ 
++/* In some cases, Tcl will still return strings that are supposed to be
++   lists. SplitObj walks through a nested tuple, finding string objects that
++   need to be split. */
++
++PyObject *
++SplitObj(PyObject *arg)
++{
++	if (PyTuple_Check(arg)) {
++		int i, size;
++		PyObject *elem, *newelem, *result;
++
++		size = PyTuple_Size(arg);
++		result = NULL;
++		/* Recursively invoke SplitObj for all tuple items.
++		   If this does not return a new object, no action is
++		   needed. */
++		for(i = 0; i < size; i++) {
++			elem = PyTuple_GetItem(arg, i);
++			newelem = SplitObj(elem);
++			if (!newelem) {
++				Py_XDECREF(result);
++				return NULL;
++			}
++			if (!result) {
++				int k;
++				if (newelem == elem) {
++					Py_DECREF(newelem);
++					continue;
++				}
++				result = PyTuple_New(size);
++				if (!result)
++					return NULL;
++				for(k = 0; k < i; k++) {
++					elem = PyTuple_GetItem(arg, k);
++					Py_INCREF(elem);
++					PyTuple_SetItem(result, k, elem);
++				}
++			}
++			PyTuple_SetItem(result, i, newelem);
++		}
++		if (result)
++			return result;
++		/* Fall through, returning arg. */
++	}
++	else if (PyString_Check(arg)) {
++		int argc;
++		char **argv;
++		char *list = PyString_AsString(arg);
++
++		if (Tcl_SplitList((Tcl_Interp *)NULL, list, &argc, &argv) != TCL_OK) {
++			Py_INCREF(arg);
++			return arg;
++		}
++		Tcl_Free(FREECAST argv);
++		if (argc > 1)
++			return Split(PyString_AsString(arg));
++		/* Fall through, returning arg. */
++	}
++	Py_INCREF(arg);
++	return arg;
++}
+ 
+ 
+ /**** Tkapp Object ****/
+@@ -443,7 +606,8 @@
+ static void DisableEventHook(void); /* Forward */
+ 
+ static TkappObject *
+-Tkapp_New(char *screenName, char *baseName, char *className, int interactive)
++Tkapp_New(char *screenName, char *baseName, char *className,
++	  int interactive, int wantobjects)
+ {
+ 	TkappObject *v;
+ 	char *argv0;
+@@ -453,6 +617,34 @@
+ 		return NULL;
+ 
+ 	v->interp = Tcl_CreateInterp();
++	v->wantobjects = wantobjects;
++	v->threaded = Tcl_GetVar2Ex(v->interp, "tcl_platform", "threaded",
++				    TCL_GLOBAL_ONLY) != NULL;
++	v->thread_id = Tcl_GetCurrentThread();
++	v->dispatching = 0;
++
++#ifndef TCL_THREADS
++	if (v->threaded) {
++	    PyErr_SetString(PyExc_RuntimeError, "Tcl is threaded but _tkinter is not");
++	    Py_DECREF(v);
++	    return 0;
++	}
++#endif
++#ifdef WITH_THREAD
++	if (v->threaded && tcl_lock) {
++	    /* If Tcl is threaded, we don't need the lock. */
++	    PyThread_free_lock(tcl_lock);
++	    tcl_lock = NULL;
++	}
++#endif
++
++	v->BooleanType = Tcl_GetObjType("boolean");
++	v->ByteArrayType = Tcl_GetObjType("bytearray");
++	v->DoubleType = Tcl_GetObjType("double");
++	v->IntType = Tcl_GetObjType("int");
++	v->ListType = Tcl_GetObjType("list");
++	v->ProcBodyType = Tcl_GetObjType("procbody");
++	v->StringType = Tcl_GetObjType("string");
+ 
+ #if defined(macintosh)
+ 	/* This seems to be needed */
+@@ -495,14 +687,208 @@
+ }
+ 
+ 
++static void
++Tkapp_ThreadSend(TkappObject *self, Tcl_Event *ev,
++		 Tcl_Condition *cond, Tcl_Mutex *mutex)
++{
++	Py_BEGIN_ALLOW_THREADS;
++	Tcl_MutexLock(mutex);
++	Tcl_ThreadQueueEvent(self->thread_id, ev, TCL_QUEUE_TAIL);
++	Tcl_ThreadAlert(self->thread_id);
++	Tcl_ConditionWait(cond, mutex, NULL);
++	Tcl_MutexUnlock(mutex);
++	Py_END_ALLOW_THREADS
++}
++
+ 
+ /** Tcl Eval **/
+ 
+-#if TKMAJORMINOR >= 8001
+-#define USING_OBJECTS
++typedef struct {
++	PyObject_HEAD
++	Tcl_Obj *value;
++	PyObject *string; /* This cannot cause cycles. */
++} PyTclObject;
++
++staticforward PyTypeObject PyTclObject_Type;
++#define PyTclObject_Check(v)	((v)->ob_type == &PyTclObject_Type)
++
++static PyObject *
++newPyTclObject(Tcl_Obj *arg)
++{
++	PyTclObject *self;
++	self = PyObject_New(PyTclObject, &PyTclObject_Type);
++	if (self == NULL)
++		return NULL;
++	Tcl_IncrRefCount(arg);
++	self->value = arg;
++	self->string = NULL;
++	return (PyObject*)self;
++}
++
++static void
++PyTclObject_dealloc(PyTclObject *self)
++{
++	Tcl_DecrRefCount(self->value);
++	Py_XDECREF(self->string);
++	PyObject_Del(self);
++}
++
++static PyObject *
++PyTclObject_str(PyTclObject *self)
++{
++	if (self->string && PyString_Check(self->string)) {
++		Py_INCREF(self->string);
++		return self->string;
++	}
++	/* XXX Could cache value if it is an ASCII string. */
++	return PyString_FromString(Tcl_GetString(self->value));
++}
++
++static char*
++PyTclObject_TclString(PyObject *self)
++{
++	return Tcl_GetString(((PyTclObject*)self)->value);
++}
++
++/* Like _str, but create Unicode if necessary. */
++PyDoc_STRVAR(PyTclObject_string__doc__, 
++"the string representation of this object, either as string or Unicode");
++
++static PyObject *
++PyTclObject_string(PyTclObject *self, void *ignored)
++{
++	char *s;
++	int i, len;
++	if (!self->string) {
++		s = Tcl_GetStringFromObj(self->value, &len);
++		for (i = 0; i < len; i++)
++			if (s[i] & 0x80)
++				break;
++#ifdef Py_USING_UNICODE
++		if (i == len)
++			/* It is an ASCII string. */
++			self->string = PyString_FromStringAndSize(s, len);
++		else {
++			self->string = PyUnicode_DecodeUTF8(s, len, "strict");
++			if (!self->string) {
++				PyErr_Clear();
++				self->string = PyString_FromStringAndSize(s, len);
++			}
++		}
++#else
++		self->string = PyString_FromStringAndSize(s, len);
+ #endif
++		if (!self->string)
++			return NULL;
++	}
++	Py_INCREF(self->string);
++	return self->string;
++}
++
++#ifdef Py_USING_UNICODE
++PyDoc_STRVAR(PyTclObject_unicode__doc__, "convert argument to unicode");
+ 
+-#ifdef USING_OBJECTS
++static PyObject *
++PyTclObject_unicode(PyTclObject *self, void *ignored)
++{
++	char *s;
++	int len;
++	if (self->string && PyUnicode_Check(self->string)) {
++		Py_INCREF(self->string);
++		return self->string;
++	}
++	/* XXX Could chache result if it is non-ASCII. */
++	s = Tcl_GetStringFromObj(self->value, &len);
++	return PyUnicode_DecodeUTF8(s, len, "strict");
++}
++#endif
++
++static PyObject *
++PyTclObject_repr(PyTclObject *self)
++{
++	char buf[50];
++	PyOS_snprintf(buf, 50, "<%s object at 0x%.8x>",
++		      self->value->typePtr->name, (int)self->value);
++	return PyString_FromString(buf);
++}
++
++static int
++PyTclObject_cmp(PyTclObject *self, PyTclObject *other)
++{
++	int res;
++	res = strcmp(Tcl_GetString(self->value),
++		     Tcl_GetString(other->value));
++	if (res < 0) return -1;
++	if (res > 0) return 1;
++	return 0;
++}
++
++PyDoc_STRVAR(get_typename__doc__, "name of the Tcl type");
++
++static PyObject*
++get_typename(PyTclObject* obj, void* ignored)
++{
++	return PyString_FromString(obj->value->typePtr->name);
++}
++
++
++static PyGetSetDef PyTclObject_getsetlist[] = {
++	{"typename", (getter)get_typename, NULL, get_typename__doc__},
++	{"string", (getter)PyTclObject_string, NULL, 
++	 PyTclObject_string__doc__},
++	{0},
++};
++
++static PyMethodDef PyTclObject_methods[] = {
++	{"__unicode__",	(PyCFunction)PyTclObject_unicode, METH_NOARGS,
++	PyTclObject_unicode__doc__},
++	{0}
++};
++
++statichere PyTypeObject PyTclObject_Type = {
++	PyObject_HEAD_INIT(NULL)
++	0,			/*ob_size*/
++	"_tkinter.Tcl_Obj",		/*tp_name*/
++	sizeof(PyTclObject),	/*tp_basicsize*/
++	0,			/*tp_itemsize*/
++	/* methods */
++	(destructor)PyTclObject_dealloc, /*tp_dealloc*/
++	0,			/*tp_print*/
++	0,			/*tp_getattr*/
++	0,			/*tp_setattr*/
++	(cmpfunc)PyTclObject_cmp,	/*tp_compare*/
++	(reprfunc)PyTclObject_repr,	/*tp_repr*/
++	0,			/*tp_as_number*/
++	0,			/*tp_as_sequence*/
++	0,			/*tp_as_mapping*/
++	0,			/*tp_hash*/
++        0,                      /*tp_call*/
++        (reprfunc)PyTclObject_str,        /*tp_str*/
++        PyObject_GenericGetAttr,/*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*/
++        0,                      /*tp_iter*/
++        0,                      /*tp_iternext*/
++        PyTclObject_methods,    /*tp_methods*/
++        0,			/*tp_members*/
++        PyTclObject_getsetlist, /*tp_getset*/
++        0,                      /*tp_base*/
++        0,                      /*tp_dict*/
++        0,                      /*tp_descr_get*/
++        0,                      /*tp_descr_set*/
++        0,                      /*tp_dictoffset*/
++        0,                      /*tp_init*/
++        0,                      /*tp_alloc*/
++        0,                      /*tp_new*/
++        0,                      /*tp_free*/
++        0,                      /*tp_is_gc*/
++};
+ 
+ static Tcl_Obj*
+ AsObj(PyObject *value)
+@@ -512,6 +898,8 @@
+ 	if (PyString_Check(value))
+ 		return Tcl_NewStringObj(PyString_AS_STRING(value),
+ 					PyString_GET_SIZE(value));
++	else if (PyBool_Check(value))
++		return Tcl_NewBooleanObj(PyObject_IsTrue(value));
+ 	else if (PyInt_Check(value))
+ 		return Tcl_NewLongObj(PyInt_AS_LONG(value));
+ 	else if (PyFloat_Check(value))
+@@ -530,28 +918,42 @@
+ 	}
+ #ifdef Py_USING_UNICODE
+ 	else if (PyUnicode_Check(value)) {
+-#if TKMAJORMINOR <= 8001
+-		/* In Tcl 8.1 we must use UTF-8 */
+-		PyObject* utf8 = PyUnicode_AsUTF8String(value);
+-		if (!utf8)
+-			return 0;
+-		result = Tcl_NewStringObj(PyString_AS_STRING(utf8),
+-					  PyString_GET_SIZE(utf8));
+-		Py_DECREF(utf8);
+-		return result;
+-#else /* TKMAJORMINOR > 8001 */
+-		/* In Tcl 8.2 and later, use Tcl_NewUnicodeObj() */
+-		if (sizeof(Py_UNICODE) != sizeof(Tcl_UniChar)) {
+-			/* XXX Should really test this at compile time */
+-			PyErr_SetString(PyExc_SystemError,
+-				"Py_UNICODE and Tcl_UniChar differ in size");
+-			return 0;
++		Py_UNICODE *inbuf = PyUnicode_AS_UNICODE(value);
++		int size = PyUnicode_GET_SIZE(value);
++		/* This #ifdef assumes that Tcl uses UCS-2.
++		   See TCL_UTF_MAX test above. */
++#if defined(Py_UNICODE_WIDE) && TCL_UTF_MAX == 3
++		Tcl_UniChar *outbuf;
++		int i;
++		outbuf = (Tcl_UniChar*)ckalloc(size * sizeof(Tcl_UniChar));
++		if (!outbuf) {
++			PyErr_NoMemory();
++			return NULL;
++		}
++		for (i = 0; i < size; i++) {
++			if (inbuf[i] >= 0x10000) {
++				/* Tcl doesn't do UTF-16, yet. */
++				PyErr_SetString(PyExc_ValueError,
++						"unsupported character");
++				ckfree(FREECAST outbuf);
++				return NULL;
++			}
++			outbuf[i] = inbuf[i];
+ 		}
+-		return Tcl_NewUnicodeObj(PyUnicode_AS_UNICODE(value),
+-					 PyUnicode_GET_SIZE(value));
+-#endif /* TKMAJORMINOR > 8001 */
++		result = Tcl_NewUnicodeObj(outbuf, size);
++		ckfree(FREECAST outbuf);
++		return result;
++#else
++		return Tcl_NewUnicodeObj(inbuf, size);
++#endif
++
+ 	}
+ #endif
++	else if(PyTclObject_Check(value)) {
++		Tcl_Obj *v = ((PyTclObject*)value)->value;
++		Tcl_IncrRefCount(v);
++		return v;
++	} 
+ 	else {
+ 		PyObject *v = PyObject_Str(value);
+ 		if (!v)
+@@ -562,19 +964,157 @@
+ 	}
+ }
+ 
+-static PyObject *
+-Tkapp_Call(PyObject *self, PyObject *args)
++static PyObject*
++FromObj(PyObject* tkapp, Tcl_Obj *value)
+ {
+-	Tcl_Obj *objStore[ARGSZ];
+-	Tcl_Obj **objv = NULL;
+-	int objc = 0, i;
+-	PyObject *res = NULL;
+-	Tcl_Interp *interp = Tkapp_Interp(self);
+-	/* Could add TCL_EVAL_GLOBAL if wrapped by GlobalCall... */
+-	int flags = TCL_EVAL_DIRECT;
++	PyObject *result = NULL;
++	TkappObject *app = (TkappObject*)tkapp;
++
++	if (value->typePtr == NULL) {
++		/* If the result contains any bytes with the top bit set,
++		   it's UTF-8 and we should decode it to Unicode */
++#ifdef Py_USING_UNICODE
++		int i;
++		char *s = value->bytes;
++		int len = value->length;
++		for (i = 0; i < len; i++) {
++			if (value->bytes[i] & 0x80)
++				break;
++		}
+ 
+-	objv = objStore;
++		if (i == value->length)
++			result = PyString_FromStringAndSize(s, len);
++		else {
++			/* Convert UTF-8 to Unicode string */
++			result = PyUnicode_DecodeUTF8(s, len, "strict");
++			if (result == NULL) {
++				PyErr_Clear();
++				result = PyString_FromStringAndSize(s, len);
++			}
++		}
++#else
++		res = PyString_FromStringAndSize(value->bytes, value->length);
++#endif
++		return result;
++	}
++
++	if (value->typePtr == app->BooleanType) {
++		result = value->internalRep.longValue ? Py_True : Py_False;
++		Py_INCREF(result);
++		return result;
++	}
++
++	if (value->typePtr == app->ByteArrayType) {
++		int size;
++		char *data = (char*)Tcl_GetByteArrayFromObj(value, &size);
++		return PyString_FromStringAndSize(data, size);
++	}
++
++	if (value->typePtr == app->DoubleType) {
++		return PyFloat_FromDouble(value->internalRep.doubleValue);
++	}
++
++	if (value->typePtr == app->IntType) {
++		return PyInt_FromLong(value->internalRep.longValue);
++	}
+ 
++	if (value->typePtr == app->ListType) {
++		int size;
++		int i, status;
++		PyObject *elem;
++		Tcl_Obj *tcl_elem;
++
++		status = Tcl_ListObjLength(Tkapp_Interp(tkapp), value, &size);
++		if (status == TCL_ERROR)
++			return Tkinter_Error(tkapp);
++		result = PyTuple_New(size);
++		if (!result)
++			return NULL;
++		for (i = 0; i < size; i++) {
++			status = Tcl_ListObjIndex(Tkapp_Interp(tkapp),
++						  value, i, &tcl_elem);
++			if (status == TCL_ERROR) {
++				Py_DECREF(result);
++				return Tkinter_Error(tkapp);
++			}
++			elem = FromObj(tkapp, tcl_elem);
++			if (!elem) {
++				Py_DECREF(result);
++				return NULL;
++			}
++			PyTuple_SetItem(result, i, elem);
++		}
++		return result;
++	}
++
++	if (value->typePtr == app->ProcBodyType) {
++	  /* fall through: return tcl object. */
++	}
++
++	if (value->typePtr == app->StringType) {
++#ifdef Py_USING_UNICODE
++#if defined(Py_UNICODE_WIDE) && TCL_UTF_MAX==3
++		PyObject *result;
++		int size;
++		Tcl_UniChar *input;
++		Py_UNICODE *output;
++
++		size = Tcl_GetCharLength(value);
++		result = PyUnicode_FromUnicode(NULL, size);
++		if (!result)
++			return NULL;
++		input = Tcl_GetUnicode(value);
++		output = PyUnicode_AS_UNICODE(result);
++		while (size--)
++			*output++ = *input++;
++		return result;
++#else
++		return PyUnicode_FromUnicode(Tcl_GetUnicode(value),
++					     Tcl_GetCharLength(value));
++#endif
++#else
++		int size;
++		char *c;
++		c = Tcl_GetStringFromObj(value, &size);
++		return PyString_FromStringAndSize(c, size);
++#endif
++	}
++
++	return newPyTclObject(value);
++}
++
++/* This mutex synchronizes inter-thread command calls. */
++
++TCL_DECLARE_MUTEX(call_mutex)
++
++typedef struct Tkapp_CallEvent {
++	Tcl_Event ev;	     /* Must be first */
++	TkappObject *self;
++	PyObject *args;
++	int flags;
++	PyObject **res;
++	PyObject **exc_type, **exc_value, **exc_tb;
++	Tcl_Condition done;
++} Tkapp_CallEvent;
++
++void
++Tkapp_CallDeallocArgs(Tcl_Obj** objv, Tcl_Obj** objStore, int objc)
++{
++	int i;
++	for (i = 0; i < objc; i++)
++		Tcl_DecrRefCount(objv[i]);
++	if (objv != objStore)
++		ckfree(FREECAST objv);
++}
++
++/* Convert Python objects to Tcl objects. This must happen in the
++   interpreter thread, which may or may not be the calling thread. */
++
++static Tcl_Obj**
++Tkapp_CallArgs(PyObject *args, Tcl_Obj** objStore, int *pobjc)
++{
++	Tcl_Obj **objv = objStore;
++	int objc = 0, i;
+ 	if (args == NULL)
+ 		/* do nothing */;
+ 
+@@ -613,19 +1153,30 @@
+ 			Tcl_IncrRefCount(objv[i]);
+ 		}
+ 	}
++	*pobjc = objc;
++	return objv;
++finally:
++	Tkapp_CallDeallocArgs(objv, objStore, objc);
++	return NULL;
++}
+ 
+-	ENTER_TCL
+-
+-	i = Tcl_EvalObjv(interp, objc, objv, flags);
++/* Convert the results of a command call into a Python objects. */
+ 
+-	ENTER_OVERLAP
+-	if (i == TCL_ERROR)
+-		Tkinter_Error(self);
+-	else {
+-		/* We could request the object result here, but doing
+-		   so would confuse applications that expect a string. */
+-		char *s = Tcl_GetStringResult(interp);
+-		char *p = s;
++static PyObject*
++Tkapp_CallResult(TkappObject *self)
++{
++	PyObject *res = NULL;
++	if(self->wantobjects) {
++		Tcl_Obj *value = Tcl_GetObjResult(self->interp);
++		/* Not sure whether the IncrRef is necessary, but something
++		   may overwrite the interpreter result while we are
++		   converting it. */
++		Tcl_IncrRefCount(value);
++		res = FromObj((PyObject*)self, value);
++		Tcl_DecrRefCount(value);
++	} else {
++		const char *s = Tcl_GetStringResult(self->interp);
++		const char *p = s;
+ 
+ 		/* If the result contains any bytes with the top bit set,
+ 		   it's UTF-8 and we should decode it to Unicode */
+@@ -652,135 +1203,127 @@
+ 		res = PyString_FromStringAndSize(s, (int)(p-s));
+ #endif
+ 	}
+-
+-	LEAVE_OVERLAP_TCL
+-
+-  finally:
+-	for (i = 0; i < objc; i++)
+-		Tcl_DecrRefCount(objv[i]);
+-	if (objv != objStore)
+-		ckfree(FREECAST objv);
+ 	return res;
+ }
+ 
+-#else /* !USING_OBJECTS */
++/* Tkapp_CallProc is the event procedure that is executed in the context of
++   the Tcl interpreter thread. Initially, it holds the Tcl lock, and doesn't
++   hold the Python lock. */
+ 
+-static PyObject *
+-Tkapp_Call(PyObject *self, PyObject *args)
++static int
++Tkapp_CallProc(Tkapp_CallEvent *e, int flags)
+ {
+-	/* This is copied from Merge() */
+-	PyObject *tmp = NULL;
+-	char *argvStore[ARGSZ];
+-	char **argv = NULL;
+-	int fvStore[ARGSZ];
+-	int *fv = NULL;
+-	int argc = 0, fvc = 0, i;
+-	PyObject *res = NULL; /* except this has a different type */
+-	Tcl_CmdInfo info; /* and this is added */
+-	Tcl_Interp *interp = Tkapp_Interp(self); /* and this too */
+-
+-	if (!(tmp = PyList_New(0)))
+-	    return NULL;
+-
+-	argv = argvStore;
+-	fv = fvStore;
+-
+-	if (args == NULL)
+-		argc = 0;
+-
+-	else if (!PyTuple_Check(args)) {
+-		argc = 1;
+-		fv[0] = 0;
+-		if (!(argv[0] = AsString(args, tmp)))
+-			goto finally;
+-	}
+-	else {
+-		argc = PyTuple_Size(args);
+-
+-		if (argc > ARGSZ) {
+-			argv = (char **)ckalloc(argc * sizeof(char *));
+-			fv = (int *)ckalloc(argc * sizeof(int));
+-			if (argv == NULL || fv == NULL) {
+-				PyErr_NoMemory();
+-				goto finally;
+-			}
+-		}
+-
+-		for (i = 0; i < argc; i++) {
+-			PyObject *v = PyTuple_GetItem(args, i);
+-			if (PyTuple_Check(v)) {
+-				fv[i] = 1;
+-				if (!(argv[i] = Merge(v)))
+-					goto finally;
+-				fvc++;
++	Tcl_Obj *objStore[ARGSZ];
++	Tcl_Obj **objv;
++	int objc;
++	int i;
++	ENTER_PYTHON
++	objv = Tkapp_CallArgs(e->args, objStore, &objc);
++	if (!objv) {
++		PyErr_Fetch(e->exc_type, e->exc_value, e->exc_tb);
++		*(e->res) = NULL;
+ 			}
+-			else if (v == Py_None) {
+-				argc = i;
+-				break;
++	LEAVE_PYTHON
++	if (!objv)
++		goto done;
++	i = Tcl_EvalObjv(e->self->interp, objc, objv, e->flags);
++	ENTER_PYTHON
++	if (i == TCL_ERROR) {
++		*(e->res) = NULL;
++		*(e->exc_type) = NULL;
++		*(e->exc_tb) = NULL;
++		*(e->exc_value) = PyObject_CallFunction(
++			Tkinter_TclError, "s",
++			Tcl_GetStringResult(e->self->interp));
+ 			}
+ 			else {
+-				fv[i] = 0;
+-				if (!(argv[i] = AsString(v, tmp)))
+-					goto finally;
+-				fvc++;
++		*(e->res) = Tkapp_CallResult(e->self);
+ 			}
++	LEAVE_PYTHON
++  done:
++	/* Wake up calling thread. */
++	Tcl_MutexLock(&call_mutex);
++	Tcl_ConditionNotify(&e->done);
++	Tcl_MutexUnlock(&call_mutex);
++	return 1;
++}
++
++/* This is the main entry point for calling a Tcl command.
++   It supports three cases, with regard to threading:
++   1. Tcl is not threaded: Must have the Tcl lock, then can invoke command in
++      the context of the calling thread.
++   2. Tcl is threaded, caller of the command is in the interpreter thread:
++      Execute the command in the calling thread. Since the Tcl lock will
++      not be used, we can merge that with case 1.
++   3. Tcl is threaded, caller is in a different thread: Must queue an event to
++      the interpreter thread. Allocation of Tcl objects needs to occur in the
++      interpreter thread, so we ship the PyObject* args to the target thread,
++      and perform processing there. */
++
++static PyObject *
++Tkapp_Call(PyObject *_self, PyObject *args)
++{
++	Tcl_Obj *objStore[ARGSZ];
++	Tcl_Obj **objv = NULL;
++	int objc, i;
++	PyObject *res = NULL;
++	TkappObject *self = (TkappObject*)_self;
++	/* Could add TCL_EVAL_GLOBAL if wrapped by GlobalCall... */
++	int flags = TCL_EVAL_DIRECT;
++
++#ifdef WITH_THREAD
++	if (self->threaded && self->thread_id != Tcl_GetCurrentThread()) {
++		/* We cannot call the command directly. Instead, we must
++		   marshal the parameters to the interpreter thread. */
++		Tkapp_CallEvent *ev;
++		PyObject *exc_type, *exc_value, *exc_tb;
++		if (!WaitForMainloop(self))
++			return NULL;
++		ev = (Tkapp_CallEvent*)ckalloc(sizeof(Tkapp_CallEvent));
++		ev->ev.proc = (Tcl_EventProc*)Tkapp_CallProc;
++		ev->self = self;
++		ev->args = args;
++		ev->res = &res;
++		ev->exc_type = &exc_type;
++		ev->exc_value = &exc_value;
++		ev->exc_tb = &exc_tb;
++		ev->done = (Tcl_Condition)0;
++
++		Tkapp_ThreadSend(self, (Tcl_Event*)ev, &ev->done, &call_mutex);
++
++		if (res == NULL) {
++			if (exc_type)
++				PyErr_Restore(exc_type, exc_value, exc_tb);
++			else
++				PyErr_SetObject(Tkinter_TclError, exc_value);
+ 		}
+ 	}
+-	/* End code copied from Merge() */
++	else 
++#endif
++	{
++
++		objv = Tkapp_CallArgs(args, objStore, &objc);
++		if (!objv)
++			return NULL;
+ 
+-	/* All this to avoid a call to Tcl_Merge() and the corresponding call
+-	   to Tcl_SplitList() inside Tcl_Eval()...  It can save a bundle! */
+-	if (Py_VerboseFlag >= 2) {
+-		for (i = 0; i < argc; i++)
+-			PySys_WriteStderr("%s ", argv[i]);
+-	}
+ 	ENTER_TCL
+-	info.proc = NULL;
+-	if (argc < 1 ||
+-	    !Tcl_GetCommandInfo(interp, argv[0], &info) ||
+-	    info.proc == NULL)
+-	{
+-		char *cmd;
+-		cmd = Tcl_Merge(argc, argv);
+-		i = Tcl_Eval(interp, cmd);
+-		ckfree(cmd);
+-	}
+-	else {
+-		Tcl_ResetResult(interp);
+-		i = (*info.proc)(info.clientData, interp, argc, argv);
+-	}
++
++		i = Tcl_EvalObjv(self->interp, objc, objv, flags);
++
+ 	ENTER_OVERLAP
+-	if (info.proc == NULL && Py_VerboseFlag >= 2)
+-		PySys_WriteStderr("... use TclEval ");
+-	if (i == TCL_ERROR) {
+-		if (Py_VerboseFlag >= 2)
+-			PySys_WriteStderr("... error: '%s'\n",
+-				Tcl_GetStringResult(interp));
+-		Tkinter_Error(self);
+-	}
+-	else {
+-		if (Py_VerboseFlag >= 2)
+-			PySys_WriteStderr("-> '%s'\n", Tcl_GetStringResult(interp));
+-		res = PyString_FromString(Tcl_GetStringResult(interp));
+-	}
++
++		if (i == TCL_ERROR)
++			Tkinter_Error(_self);
++		else
++			res = Tkapp_CallResult(self);
++
+ 	LEAVE_OVERLAP_TCL
+ 
+-	/* Copied from Merge() again */
+-  finally:
+-	for (i = 0; i < fvc; i++)
+-		if (fv[i]) {
+-			ckfree(argv[i]);
++		Tkapp_CallDeallocArgs(objv, objStore, objc);
+ 		}
+-	if (argv != argvStore)
+-		ckfree(FREECAST argv);
+-	if (fv != fvStore)
+-		ckfree(FREECAST fv);
+-
+-	Py_DECREF(tmp);
+ 	return res;
+ }
+ 
+-#endif /* !USING_OBJECTS */
+ 
+ static PyObject *
+ Tkapp_GlobalCall(PyObject *self, PyObject *args)
+@@ -794,6 +1337,8 @@
+ 	char *cmd;
+ 	PyObject *res = NULL;
+ 
++	CHECK_TCL_APPARTMENT;
++
+ 	cmd  = Merge(args);
+ 	if (cmd) {
+ 		int err;
+@@ -821,6 +1366,8 @@
+ 	if (!PyArg_ParseTuple(args, "s:eval", &script))
+ 		return NULL;
+ 
++	CHECK_TCL_APPARTMENT;
++
+ 	ENTER_TCL
+ 	err = Tcl_Eval(Tkapp_Interp(self), script);
+ 	ENTER_OVERLAP
+@@ -842,6 +1389,8 @@
+ 	if (!PyArg_ParseTuple(args, "s:globaleval", &script))
+ 		return NULL;
+ 
++	CHECK_TCL_APPARTMENT;
++
+ 	ENTER_TCL
+ 	err = Tcl_GlobalEval(Tkapp_Interp(self), script);
+ 	ENTER_OVERLAP
+@@ -863,6 +1412,8 @@
+ 	if (!PyArg_ParseTuple(args, "s:evalfile", &fileName))
+ 		return NULL;
+ 
++	CHECK_TCL_APPARTMENT;
++
+ 	ENTER_TCL
+ 	err = Tcl_EvalFile(Tkapp_Interp(self), fileName);
+ 	ENTER_OVERLAP
+@@ -885,6 +1436,8 @@
+ 	if (!PyArg_ParseTuple(args, "s", &script))
+ 		return NULL;
+ 
++	CHECK_TCL_APPARTMENT;
++
+ 	ENTER_TCL
+ 	err = Tcl_RecordAndEval(Tkapp_Interp(self), script, TCL_NO_EVAL);
+ 	ENTER_OVERLAP
+@@ -903,6 +1456,8 @@
+ 
+ 	if (!PyArg_ParseTuple(args, "s:adderrorinfo", &msg))
+ 		return NULL;
++	CHECK_TCL_APPARTMENT;
++
+ 	ENTER_TCL
+ 	Tcl_AddErrorInfo(Tkapp_Interp(self), msg);
+ 	LEAVE_TCL
+@@ -915,62 +1470,165 @@
+ 
+ /** Tcl Variable **/
+ 
++TCL_DECLARE_MUTEX(var_mutex)
++
++typedef PyObject* (*EventFunc)(PyObject*, PyObject *args, int flags);
++typedef struct VarEvent {
++	Tcl_Event ev; /* must be first */
++	PyObject *self;
++	PyObject *args;
++	int flags;
++	EventFunc func;
++	PyObject **res;
++	PyObject **exc_type;
++	PyObject **exc_val;
++	Tcl_Condition cond;
++} VarEvent;
++
++static int
++varname_converter(PyObject *in, void *_out)
++{
++	char **out = (char**)_out;
++	if (PyString_Check(in)) {
++		*out = PyString_AsString(in);
++		return 1;
++	}
++	if (PyTclObject_Check(in)) {
++		*out = PyTclObject_TclString(in);
++		return 1;
++	}
++	/* XXX: Should give diagnostics. */
++	return 0;
++}	
++
++void
++var_perform(VarEvent *ev)
++{
++	*(ev->res) = ev->func(ev->self, ev->args, ev->flags);
++	if (!*(ev->res)) {
++		PyObject *exc, *val, *tb;
++		PyErr_Fetch(&exc, &val, &tb);
++		PyErr_NormalizeException(&exc, &val, &tb);
++		*(ev->exc_type) = exc;
++		*(ev->exc_val) = val;
++		Py_DECREF(tb);
++	}
++		
++}
++
++static int
++var_proc(VarEvent* ev, int flags)
++{
++	ENTER_PYTHON
++        var_perform(ev);
++	Tcl_MutexLock(&var_mutex);
++	Tcl_ConditionNotify(&ev->cond);
++	Tcl_MutexUnlock(&var_mutex);
++	LEAVE_PYTHON
++	return 1;
++}
++
++static PyObject*
++var_invoke(EventFunc func, PyObject *_self, PyObject *args, int flags)
++{
++	TkappObject *self = (TkappObject*)_self;
++#ifdef WITH_THREAD
++	if (self->threaded && self->thread_id != Tcl_GetCurrentThread()) {
++		TkappObject *self = (TkappObject*)_self;
++		VarEvent *ev;
++		PyObject *res, *exc_type, *exc_val;
++		
++		/* The current thread is not the interpreter thread.  Marshal
++		   the call to the interpreter thread, then wait for
++		   completion. */
++		if (!WaitForMainloop(self))
++			return NULL;
++
++		ev = (VarEvent*)ckalloc(sizeof(VarEvent));
++
++		ev->self = _self;
++		ev->args = args;
++		ev->flags = flags;
++		ev->func = func;
++		ev->res = &res;
++		ev->exc_type = &exc_type;
++		ev->exc_val = &exc_val;
++		ev->cond = NULL;
++		ev->ev.proc = (Tcl_EventProc*)var_proc;
++		Tkapp_ThreadSend(self, (Tcl_Event*)ev, &ev->cond, &var_mutex);
++		if (!res) {
++			PyErr_SetObject(exc_type, exc_val);
++			Py_DECREF(exc_type);
++			Py_DECREF(exc_val);
++			return NULL;
++		}
++		return res;
++	}
++#endif
++        /* Tcl is not threaded, or this is the interpreter thread. */
++	return func(_self, args, flags);
++}
++
+ static PyObject *
+ SetVar(PyObject *self, PyObject *args, int flags)
+ {
+-	char *name1, *name2, *ok, *s;
++	char *name1, *name2;
+ 	PyObject *newValue;
+-	PyObject *tmp;
+-
+-	tmp = PyList_New(0);
+-	if (!tmp)
+-		return NULL;
++	PyObject *res = NULL;
++	Tcl_Obj *newval, *ok;
+ 
+-	if (PyArg_ParseTuple(args, "sO:setvar", &name1, &newValue)) {
+-		/* XXX Merge? */
+-		s = AsString(newValue, tmp);
+-		if (s == NULL)
++	if (PyArg_ParseTuple(args, "O&O:setvar", 
++			     varname_converter, &name1, &newValue)) {
++		/* XXX Acquire tcl lock??? */
++		newval = AsObj(newValue);
++		if (newval == NULL)
+ 			return NULL;
+ 		ENTER_TCL
+-		ok = Tcl_SetVar(Tkapp_Interp(self), name1, s, flags);
+-		LEAVE_TCL
++		ok = Tcl_SetVar2Ex(Tkapp_Interp(self), name1, NULL, 
++				   newval, flags);
++		ENTER_OVERLAP
++		if (!ok)
++			Tkinter_Error(self);
++		else {
++			res = Py_None;
++			Py_INCREF(res);
++		}
++		LEAVE_OVERLAP_TCL
+ 	}
+ 	else {
+ 		PyErr_Clear();
+ 		if (PyArg_ParseTuple(args, "ssO:setvar",
+ 				     &name1, &name2, &newValue)) {
+-			s = AsString(newValue, tmp);
+-			if (s == NULL)
+-				return NULL;
++			/* XXX must hold tcl lock already??? */
++			newval = AsObj(newValue);
+ 			ENTER_TCL
+-			ok = Tcl_SetVar2(Tkapp_Interp(self), name1, name2, 
+-					 s, flags);
+-			LEAVE_TCL
++			ok = Tcl_SetVar2Ex(Tkapp_Interp(self), name1, name2, newval, flags);
++			ENTER_OVERLAP
++			if (!ok)
++				Tkinter_Error(self);
++			else {
++				res = Py_None;
++				Py_INCREF(res);
++			}
++			LEAVE_OVERLAP_TCL
+ 		}
+ 		else {
+-			Py_DECREF(tmp);
+ 			return NULL;
+ 		}
+ 	}
+-	Py_DECREF(tmp);
+-
+-	if (!ok)
+-		return Tkinter_Error(self);
+-
+-	Py_INCREF(Py_None);
+-	return Py_None;
++	return res;
+ }
+ 
+ static PyObject *
+ Tkapp_SetVar(PyObject *self, PyObject *args)
+ {
+-	return SetVar(self, args, TCL_LEAVE_ERR_MSG);
++	return var_invoke(SetVar, self, args, TCL_LEAVE_ERR_MSG);
+ }
+ 
+ static PyObject *
+ Tkapp_GlobalSetVar(PyObject *self, PyObject *args)
+ {
+-	return SetVar(self, args, TCL_LEAVE_ERR_MSG | TCL_GLOBAL_ONLY);
++	return var_invoke(SetVar, self, args, TCL_LEAVE_ERR_MSG | TCL_GLOBAL_ONLY);
+ }
+ 
+ 
+@@ -978,23 +1636,23 @@
+ static PyObject *
+ GetVar(PyObject *self, PyObject *args, int flags)
+ {
+-	char *name1, *name2=NULL, *s;
++	char *name1, *name2=NULL;
+ 	PyObject *res = NULL;
++	Tcl_Obj *tres;
+ 
+-	if (!PyArg_ParseTuple(args, "s|s:getvar", &name1, &name2))
++	if (!PyArg_ParseTuple(args, "O&|s:getvar", 
++			      varname_converter, &name1, &name2))
+ 		return NULL;
+-	ENTER_TCL
+-	if (name2 == NULL)
+-		s = Tcl_GetVar(Tkapp_Interp(self), name1, flags);
+ 
+-	else
+-		s = Tcl_GetVar2(Tkapp_Interp(self), name1, name2, flags);
++	ENTER_TCL
++	tres = Tcl_GetVar2Ex(Tkapp_Interp(self), name1, name2, flags);
+ 	ENTER_OVERLAP
+-
+-	if (s == NULL)
+-		res = Tkinter_Error(self);
+-	else
+-		res = PyString_FromString(s);
++	if (((TkappObject*)self)->wantobjects) {
++		res = FromObj(self, tres);
++	}
++	else {
++		res = PyString_FromString(Tcl_GetString(tres));
++	}
+ 	LEAVE_OVERLAP_TCL
+ 	return res;
+ }
+@@ -1002,13 +1660,13 @@
+ static PyObject *
+ Tkapp_GetVar(PyObject *self, PyObject *args)
+ {
+-	return GetVar(self, args, TCL_LEAVE_ERR_MSG);
++	return var_invoke(GetVar, self, args, TCL_LEAVE_ERR_MSG);
+ }
+ 
+ static PyObject *
+ Tkapp_GlobalGetVar(PyObject *self, PyObject *args)
+ {
+-	return GetVar(self, args, TCL_LEAVE_ERR_MSG | TCL_GLOBAL_ONLY);
++	return var_invoke(GetVar, self, args, TCL_LEAVE_ERR_MSG | TCL_GLOBAL_ONLY);
+ }
+ 
+ 
+@@ -1017,19 +1675,15 @@
+ UnsetVar(PyObject *self, PyObject *args, int flags)
+ {
+ 	char *name1, *name2=NULL;
+-	PyObject *res = NULL;
+ 	int code;
++	PyObject *res = NULL;
+ 
+ 	if (!PyArg_ParseTuple(args, "s|s:unsetvar", &name1, &name2))
+ 		return NULL;
+-	ENTER_TCL
+-	if (name2 == NULL)
+-		code = Tcl_UnsetVar(Tkapp_Interp(self), name1, flags);
+ 
+-	else
++	ENTER_TCL
+ 		code = Tcl_UnsetVar2(Tkapp_Interp(self), name1, name2, flags);
+ 	ENTER_OVERLAP
+-
+ 	if (code == TCL_ERROR)
+ 		res = Tkinter_Error(self);
+ 	else {
+@@ -1043,13 +1697,13 @@
+ static PyObject *
+ Tkapp_UnsetVar(PyObject *self, PyObject *args)
+ {
+-	return UnsetVar(self, args, TCL_LEAVE_ERR_MSG);
++	return var_invoke(UnsetVar, self, args, TCL_LEAVE_ERR_MSG);
+ }
+ 
+ static PyObject *
+ Tkapp_GlobalUnsetVar(PyObject *self, PyObject *args)
+ {
+-	return UnsetVar(self, args, TCL_LEAVE_ERR_MSG | TCL_GLOBAL_ONLY);
++	return var_invoke(UnsetVar, self, args, TCL_LEAVE_ERR_MSG | TCL_GLOBAL_ONLY);
+ }
+ 
+ 
+@@ -1062,6 +1716,13 @@
+ 	char *s;
+ 	int v;
+ 
++	if (PyTuple_Size(args) == 1) {
++		PyObject* o = PyTuple_GetItem(args, 0);
++		if (PyInt_Check(o)) {
++			Py_INCREF(o);
++			return o;
++		}
++	}
+ 	if (!PyArg_ParseTuple(args, "s:getint", &s))
+ 		return NULL;
+ 	if (Tcl_GetInt(Tkapp_Interp(self), s, &v) == TCL_ERROR)
+@@ -1075,6 +1736,13 @@
+ 	char *s;
+ 	double v;
+ 
++	if (PyTuple_Size(args) == 1) {
++		PyObject *o = PyTuple_GetItem(args, 0);
++		if (PyFloat_Check(o)) {
++			Py_INCREF(o);
++			return o;
++		}
++	}
+ 	if (!PyArg_ParseTuple(args, "s:getdouble", &s))
+ 		return NULL;
+ 	if (Tcl_GetDouble(Tkapp_Interp(self), s, &v) == TCL_ERROR)
+@@ -1088,11 +1756,18 @@
+ 	char *s;
+ 	int v;
+ 
++	if (PyTuple_Size(args) == 1) {
++		PyObject *o = PyTuple_GetItem(args, 0);
++		if (PyInt_Check(o)) {
++			Py_INCREF(o);
++			return o;
++		}
++	}
+ 	if (!PyArg_ParseTuple(args, "s:getboolean", &s))
+ 		return NULL;
+ 	if (Tcl_GetBoolean(Tkapp_Interp(self), s, &v) == TCL_ERROR)
+ 		return Tkinter_Error(self);
+-	return Py_BuildValue("i", v);
++	return PyBool_FromLong(v);
+ }
+ 
+ static PyObject *
+@@ -1104,6 +1779,9 @@
+ 
+ 	if (!PyArg_ParseTuple(args, "s:exprstring", &s))
+ 		return NULL;
++	
++	CHECK_TCL_APPARTMENT;
++
+ 	ENTER_TCL
+ 	retval = Tcl_ExprString(Tkapp_Interp(self), s);
+ 	ENTER_OVERLAP
+@@ -1125,6 +1803,9 @@
+ 
+ 	if (!PyArg_ParseTuple(args, "s:exprlong", &s))
+ 		return NULL;
++
++	CHECK_TCL_APPARTMENT;
++
+ 	ENTER_TCL
+ 	retval = Tcl_ExprLong(Tkapp_Interp(self), s, &v);
+ 	ENTER_OVERLAP
+@@ -1146,6 +1827,7 @@
+ 
+ 	if (!PyArg_ParseTuple(args, "s:exprdouble", &s))
+ 		return NULL;
++	CHECK_TCL_APPARTMENT;
+ 	PyFPE_START_PROTECT("Tkapp_ExprDouble", return 0)
+ 	ENTER_TCL
+ 	retval = Tcl_ExprDouble(Tkapp_Interp(self), s, &v);
+@@ -1169,6 +1851,7 @@
+ 
+ 	if (!PyArg_ParseTuple(args, "s:exprboolean", &s))
+ 		return NULL;
++	CHECK_TCL_APPARTMENT;
+ 	ENTER_TCL
+ 	retval = Tcl_ExprBoolean(Tkapp_Interp(self), s, &v);
+ 	ENTER_OVERLAP
+@@ -1191,6 +1874,13 @@
+ 	PyObject *v;
+ 	int i;
+ 
++	if (PyTuple_Size(args) == 1) {
++		v = PyTuple_GetItem(args, 0);
++		if (PyTuple_Check(v)) {
++			Py_INCREF(v);
++			return v;
++		}
++	}
+ 	if (!PyArg_ParseTuple(args, "et:splitlist", "utf-8", &list))
+ 		return NULL;
+ 
+@@ -1219,6 +1909,13 @@
+ {
+ 	char *list;
+ 
++	if (PyTuple_Size(args) == 1) {
++		PyObject* o = PyTuple_GetItem(args, 0);
++		if (PyTuple_Check(o)) {
++			o = SplitObj(o);
++			return o;
++		}
++	}
+ 	if (!PyArg_ParseTuple(args, "et:split", "utf-8", &list))
+ 		return NULL;
+ 	return Split(list);
+@@ -1329,13 +2026,42 @@
+ 
+ 
+ 
++
++TCL_DECLARE_MUTEX(command_mutex)
++
++typedef struct CommandEvent{
++	Tcl_Event ev;
++	Tcl_Interp* interp;
++	char *name;
++	int create;
++	int *status;
++	ClientData *data;
++	Tcl_Condition done;
++} CommandEvent;
++
++static int
++Tkapp_CommandProc(CommandEvent *ev, int flags)
++{
++	if (ev->create)
++		*ev->status = Tcl_CreateCommand(
++			ev->interp, ev->name, PythonCmd,
++			ev->data, PythonCmdDelete) == NULL;
++	else
++		*ev->status = Tcl_DeleteCommand(ev->interp, ev->name);
++	Tcl_MutexLock(&command_mutex);
++	Tcl_ConditionNotify(&ev->done);
++	Tcl_MutexUnlock(&command_mutex);
++	return 1;
++}
++
+ static PyObject *
+-Tkapp_CreateCommand(PyObject *self, PyObject *args)
++Tkapp_CreateCommand(PyObject *_self, PyObject *args)
+ {
++	TkappObject *self = (TkappObject*)_self;
+ 	PythonCmd_ClientData *data;
+ 	char *cmdName;
+ 	PyObject *func;
+-	Tcl_Command err;
++	int err;
+ 
+ 	if (!PyArg_ParseTuple(args, "sO:createcommand", &cmdName, &func))
+ 		return NULL;
+@@ -1344,19 +2070,39 @@
+ 		return NULL;
+ 	}
+ 
++#ifdef WITH_THREAD
++	if (self->threaded && self->thread_id != Tcl_GetCurrentThread() &&
++	    !WaitForMainloop(self))
++		return NULL;
++#endif
++
+ 	data = PyMem_NEW(PythonCmd_ClientData, 1);
+ 	if (!data)
+ 		return PyErr_NoMemory();
+ 	Py_XINCREF(self);
+ 	Py_XINCREF(func);
+-	data->self = self;
++	data->self = _self;
+ 	data->func = func;
+ 
++	if (self->threaded && self->thread_id != Tcl_GetCurrentThread()) {
++		CommandEvent *ev = (CommandEvent*)ckalloc(sizeof(CommandEvent));
++		ev->ev.proc = (Tcl_EventProc*)Tkapp_CommandProc;
++		ev->interp = self->interp;
++		ev->create = 1;
++		ev->name = cmdName;
++		ev->data = (ClientData)data;
++		ev->status = &err;
++		ev->done = NULL;
++		Tkapp_ThreadSend(self, (Tcl_Event*)ev, &ev->done, &command_mutex);
++	}
++	else {
+ 	ENTER_TCL
+-	err = Tcl_CreateCommand(Tkapp_Interp(self), cmdName, PythonCmd,
+-				(ClientData)data, PythonCmdDelete);
++		err = Tcl_CreateCommand(
++			Tkapp_Interp(self), cmdName, PythonCmd,
++			(ClientData)data, PythonCmdDelete) == NULL;
+ 	LEAVE_TCL
+-	if (err == NULL) {
++	}
++	if (err) {
+ 		PyErr_SetString(Tkinter_TclError, "can't create Tcl command");
+ 		PyMem_DEL(data);
+ 		return NULL;
+@@ -1369,16 +2115,31 @@
+ 
+ 
+ static PyObject *
+-Tkapp_DeleteCommand(PyObject *self, PyObject *args)
++Tkapp_DeleteCommand(PyObject *_self, PyObject *args)
+ {
++	TkappObject *self = (TkappObject*)_self;
+ 	char *cmdName;
+ 	int err;
+ 
+ 	if (!PyArg_ParseTuple(args, "s:deletecommand", &cmdName))
+ 		return NULL;
++	if (self->threaded && self->thread_id != Tcl_GetCurrentThread()) {
++		CommandEvent *ev;
++		ev = (CommandEvent*)ckalloc(sizeof(CommandEvent));
++		ev->ev.proc = (Tcl_EventProc*)Tkapp_CommandProc;
++		ev->interp = self->interp;
++		ev->create = 0;
++		ev->name = cmdName;
++		ev->status = &err;
++		ev->done = NULL;
++		Tkapp_ThreadSend(self, (Tcl_Event*)ev, &ev->done, 
++				 &command_mutex);
++	}
++	else {
+ 	ENTER_TCL
+-	err = Tcl_DeleteCommand(Tkapp_Interp(self), cmdName);
++		err = Tcl_DeleteCommand(self->interp, cmdName);
+ 	LEAVE_TCL
++	}
+ 	if (err == -1) {
+ 		PyErr_SetString(Tkinter_TclError, "can't delete Tcl command");
+ 		return NULL;
+@@ -1469,6 +2230,21 @@
+ 	if (!PyArg_ParseTuple(args, "OiO:createfilehandler",
+ 			      &file, &mask, &func))
+ 		return NULL;
++
++#ifdef WITH_THREAD
++	if (!self && !tcl_lock) {
++		/* We don't have the Tcl lock since Tcl is threaded. */
++		PyErr_SetString(PyExc_RuntimeError,
++				"_tkinter.createfilehandler not supported "
++				"for threaded Tcl");
++		return NULL;
++	}
++#endif
++
++	if (self) {
++		CHECK_TCL_APPARTMENT;
++	}
++
+ 	tfile = PyObject_AsFileDescriptor(file);
+ 	if (tfile < 0)
+ 		return NULL;
+@@ -1497,6 +2273,21 @@
+   
+ 	if (!PyArg_ParseTuple(args, "O:deletefilehandler", &file))
+ 		return NULL;
++
++#ifdef WITH_THREAD
++	if (!self && !tcl_lock) {
++		/* We don't have the Tcl lock since Tcl is threaded. */
++		PyErr_SetString(PyExc_RuntimeError,
++				"_tkinter.deletefilehandler not supported "
++				"for threaded Tcl");
++		return NULL;
++	}
++#endif
++
++	if (self) {
++		CHECK_TCL_APPARTMENT;
++	}
++
+ 	tfile = PyObject_AsFileDescriptor(file);
+ 	if (tfile < 0)
+ 		return NULL;
+@@ -1515,7 +2306,7 @@
+ 
+ /**** Tktt Object (timer token) ****/
+ 
+-staticforward PyTypeObject Tktt_Type;
++static PyTypeObject Tktt_Type;
+ 
+ typedef struct {
+ 	PyObject_HEAD
+@@ -1546,7 +2337,7 @@
+ 
+ static PyMethodDef Tktt_methods[] =
+ {
+-	{"deletetimerhandler", Tktt_DeleteTimerHandler, 1},
++	{"deletetimerhandler", Tktt_DeleteTimerHandler, METH_VARARGS},
+ 	{NULL, NULL}
+ };
+ 
+@@ -1661,6 +2452,21 @@
+ 		PyErr_SetString(PyExc_TypeError, "bad argument list");
+ 		return NULL;
+ 	}
++
++#ifdef WITH_THREAD
++	if (!self && !tcl_lock) {
++		/* We don't have the Tcl lock since Tcl is threaded. */
++		PyErr_SetString(PyExc_RuntimeError,
++				"_tkinter.createtimerhandler not supported "
++				"for threaded Tcl");
++		return NULL;
++	}
++#endif
++
++	if (self) {
++		CHECK_TCL_APPARTMENT;
++	}
++
+ 	v = Tktt_New(func);
+ 	v->token = Tcl_CreateTimerHandler(milliseconds, TimerHandler,
+ 					  (ClientData)v);
+@@ -1672,9 +2478,10 @@
+ /** Event Loop **/
+ 
+ static PyObject *
+-Tkapp_MainLoop(PyObject *self, PyObject *args)
++Tkapp_MainLoop(PyObject *_self, PyObject *args)
+ {
+ 	int threshold = 0;
++	TkappObject *self = (TkappObject*)_self;
+ #ifdef WITH_THREAD
+ 	PyThreadState *tstate = PyThreadState_Get();
+ #endif
+@@ -1682,6 +2489,21 @@
+ 	if (!PyArg_ParseTuple(args, "|i:mainloop", &threshold))
+ 		return NULL;
+ 
++#ifdef WITH_THREAD
++	if (!self && !tcl_lock) {
++		/* We don't have the Tcl lock since Tcl is threaded. */
++		PyErr_SetString(PyExc_RuntimeError,
++				"_tkinter.mainloop not supported "
++				"for threaded Tcl");
++		return NULL;
++	}
++#endif
++
++	if (self) {
++		CHECK_TCL_APPARTMENT;
++		self->dispatching = 1;
++	}
++
+ 	quitMainLoop = 0;
+ 	while (Tk_GetNumMainWindows() > threshold &&
+ 	       !quitMainLoop &&
+@@ -1690,24 +2512,37 @@
+ 		int result;
+ 
+ #ifdef WITH_THREAD
++		if (self && self->threaded) {
++			/* Allow other Python threads to run. */
++			ENTER_TCL
++			result = Tcl_DoOneEvent(0);
++			LEAVE_TCL
++		}
++		else {
+ 		Py_BEGIN_ALLOW_THREADS
+-		PyThread_acquire_lock(tcl_lock, 1);
++			if(tcl_lock)PyThread_acquire_lock(tcl_lock, 1);
+ 		tcl_tstate = tstate;
+ 		result = Tcl_DoOneEvent(TCL_DONT_WAIT);
+ 		tcl_tstate = NULL;
+-		PyThread_release_lock(tcl_lock);
++			if(tcl_lock)PyThread_release_lock(tcl_lock);
+ 		if (result == 0)
+-			Sleep(20);
++				Sleep(Tkinter_busywaitinterval);
+ 		Py_END_ALLOW_THREADS
++		}
+ #else
+ 		result = Tcl_DoOneEvent(0);
+ #endif
+ 
+-		if (PyErr_CheckSignals() != 0)
++		if (PyErr_CheckSignals() != 0) {
++			if (self)
++				self->dispatching = 0;
+ 			return NULL;
++		}
+ 		if (result < 0)
+ 			break;
+ 	}
++	if (self)
++		self->dispatching = 0;
+ 	quitMainLoop = 0;
+ 
+ 	if (errorInCmd) {
+@@ -1758,45 +2593,70 @@
+ }
+ 
+ 
++static PyObject *
++Tkapp_WantObjects(PyObject *self, PyObject *args)
++{
++
++	int wantobjects;
++	if (!PyArg_ParseTuple(args, "i:wantobjects", &wantobjects))
++		return NULL;
++	((TkappObject*)self)->wantobjects = wantobjects;
++
++	Py_INCREF(Py_None);
++	return Py_None;
++}
++
++static PyObject *
++Tkapp_WillDispatch(PyObject *self, PyObject *args)
++{
++
++	((TkappObject*)self)->dispatching = 1;
++
++	Py_INCREF(Py_None);
++	return Py_None;
++}
++
+ 
+ /**** Tkapp Method List ****/
+ 
+ static PyMethodDef Tkapp_methods[] =
+ {
+-	{"call", 	       Tkapp_Call, 0},
+-	{"globalcall", 	       Tkapp_GlobalCall, 0},
+-	{"eval", 	       Tkapp_Eval, 1},
+-	{"globaleval", 	       Tkapp_GlobalEval, 1},
+-	{"evalfile", 	       Tkapp_EvalFile, 1},
+-	{"record", 	       Tkapp_Record, 1},
+-	{"adderrorinfo",       Tkapp_AddErrorInfo, 1},
+-	{"setvar", 	       Tkapp_SetVar, 1},
+-	{"globalsetvar",       Tkapp_GlobalSetVar, 1},
+-	{"getvar", 	       Tkapp_GetVar, 1},
+-	{"globalgetvar",       Tkapp_GlobalGetVar, 1},
+-	{"unsetvar", 	       Tkapp_UnsetVar, 1},
+-	{"globalunsetvar",     Tkapp_GlobalUnsetVar, 1},
+-	{"getint", 	       Tkapp_GetInt, 1},
+-	{"getdouble", 	       Tkapp_GetDouble, 1},
+-	{"getboolean", 	       Tkapp_GetBoolean, 1},
+-	{"exprstring", 	       Tkapp_ExprString, 1},
+-	{"exprlong", 	       Tkapp_ExprLong, 1},
+-	{"exprdouble", 	       Tkapp_ExprDouble, 1},
+-	{"exprboolean",        Tkapp_ExprBoolean, 1},
+-	{"splitlist", 	       Tkapp_SplitList, 1},
+-	{"split", 	       Tkapp_Split, 1},
+-	{"merge", 	       Tkapp_Merge, 0},
+-	{"createcommand",      Tkapp_CreateCommand, 1},
+-	{"deletecommand",      Tkapp_DeleteCommand, 1},
++	{"willdispatch",       Tkapp_WillDispatch, METH_NOARGS},
++	{"wantobjects",	       Tkapp_WantObjects, METH_VARARGS},
++	{"call", 	       Tkapp_Call, METH_OLDARGS},
++	{"globalcall", 	       Tkapp_GlobalCall, METH_OLDARGS},
++	{"eval", 	       Tkapp_Eval, METH_VARARGS},
++	{"globaleval", 	       Tkapp_GlobalEval, METH_VARARGS},
++	{"evalfile", 	       Tkapp_EvalFile, METH_VARARGS},
++	{"record", 	       Tkapp_Record, METH_VARARGS},
++	{"adderrorinfo",       Tkapp_AddErrorInfo, METH_VARARGS},
++	{"setvar", 	       Tkapp_SetVar, METH_VARARGS},
++	{"globalsetvar",       Tkapp_GlobalSetVar, METH_VARARGS},
++	{"getvar", 	       Tkapp_GetVar, METH_VARARGS},
++	{"globalgetvar",       Tkapp_GlobalGetVar, METH_VARARGS},
++	{"unsetvar", 	       Tkapp_UnsetVar, METH_VARARGS},
++	{"globalunsetvar",     Tkapp_GlobalUnsetVar, METH_VARARGS},
++	{"getint", 	       Tkapp_GetInt, METH_VARARGS},
++	{"getdouble", 	       Tkapp_GetDouble, METH_VARARGS},
++	{"getboolean", 	       Tkapp_GetBoolean, METH_VARARGS},
++	{"exprstring", 	       Tkapp_ExprString, METH_VARARGS},
++	{"exprlong", 	       Tkapp_ExprLong, METH_VARARGS},
++	{"exprdouble", 	       Tkapp_ExprDouble, METH_VARARGS},
++	{"exprboolean",        Tkapp_ExprBoolean, METH_VARARGS},
++	{"splitlist", 	       Tkapp_SplitList, METH_VARARGS},
++	{"split", 	       Tkapp_Split, METH_VARARGS},
++	{"merge", 	       Tkapp_Merge, METH_OLDARGS},
++	{"createcommand",      Tkapp_CreateCommand, METH_VARARGS},
++	{"deletecommand",      Tkapp_DeleteCommand, METH_VARARGS},
+ #ifdef HAVE_CREATEFILEHANDLER
+-	{"createfilehandler",  Tkapp_CreateFileHandler, 1},
+-	{"deletefilehandler",  Tkapp_DeleteFileHandler, 1},
++	{"createfilehandler",  Tkapp_CreateFileHandler, METH_VARARGS},
++	{"deletefilehandler",  Tkapp_DeleteFileHandler, METH_VARARGS},
+ #endif
+-	{"createtimerhandler", Tkapp_CreateTimerHandler, 1},
+-	{"mainloop", 	       Tkapp_MainLoop, 1},
+-	{"dooneevent", 	       Tkapp_DoOneEvent, 1},
+-	{"quit", 	       Tkapp_Quit, 1},
+-	{"interpaddr",         Tkapp_InterpAddr, 1},
++	{"createtimerhandler", Tkapp_CreateTimerHandler, METH_VARARGS},
++	{"mainloop", 	       Tkapp_MainLoop, METH_VARARGS},
++	{"dooneevent", 	       Tkapp_DoOneEvent, METH_VARARGS},
++	{"quit", 	       Tkapp_Quit, METH_VARARGS},
++	{"interpaddr",         Tkapp_InterpAddr, METH_VARARGS},
+ 	{NULL, 		       NULL}
+ };
+ 
+@@ -1807,6 +2667,7 @@
+ static void
+ Tkapp_Dealloc(PyObject *self)
+ {
++	/*CHECK_TCL_APPARTMENT;*/
+ 	ENTER_TCL
+ 	Tcl_DeleteInterp(Tkapp_Interp(self));
+ 	LEAVE_TCL
+@@ -1959,6 +2820,7 @@
+ 	char *baseName = NULL;
+ 	char *className = NULL;
+ 	int interactive = 0;
++	int wantobjects = 0;
+ 
+ 	baseName = strrchr(Py_GetProgramName(), '/');
+ 	if (baseName != NULL)
+@@ -1967,27 +2829,67 @@
+ 		baseName = Py_GetProgramName();
+ 	className = "Tk";
+   
+-	if (!PyArg_ParseTuple(args, "|zssi:create",
++	if (!PyArg_ParseTuple(args, "|zssii:create",
+ 			      &screenName, &baseName, &className,
+-			      &interactive))
++			      &interactive, &wantobjects))
+ 		return NULL;
+ 
+ 	return (PyObject *) Tkapp_New(screenName, baseName, className, 
+-				      interactive);
++				      interactive, wantobjects);
++}
++
++static PyObject *
++Tkinter_setbusywaitinterval(PyObject *self, PyObject *args)
++{
++	int new_val;
++	if (!PyArg_ParseTuple(args, "i:setbusywaitinterval", &new_val))
++		return NULL;
++	if (new_val < 0) {
++		PyErr_SetString(PyExc_ValueError,
++				"busywaitinterval must be >= 0");
++		return NULL;
++	}
++	Tkinter_busywaitinterval = new_val;
++	Py_INCREF(Py_None);
++	return Py_None;
+ }
+ 
++static char setbusywaitinterval_doc[] =
++"setbusywaitinterval(n) -> None\n\
++\n\
++Set the busy-wait interval in milliseconds between successive\n\
++calls to Tcl_DoOneEvent in a threaded Python interpreter.\n\
++It should be set to a divisor of the maximum time between\n\
++frames in an animation.";
++
++static PyObject *
++Tkinter_getbusywaitinterval(PyObject *self, PyObject *args)
++{
++        return PyInt_FromLong(Tkinter_busywaitinterval);
++}
++
++static char getbusywaitinterval_doc[] =
++"getbusywaitinterval() -> int\n\
++\n\
++Return the current busy-wait interval between successive\n\
++calls to Tcl_DoOneEvent in a threaded Python interpreter.";
++
+ static PyMethodDef moduleMethods[] =
+ {
+-	{"_flatten",           Tkinter_Flatten, 1},
+-	{"create",             Tkinter_Create, 1},
++	{"_flatten",           Tkinter_Flatten, METH_VARARGS},
++	{"create",             Tkinter_Create, METH_VARARGS},
+ #ifdef HAVE_CREATEFILEHANDLER
+-	{"createfilehandler",  Tkapp_CreateFileHandler, 1},
+-	{"deletefilehandler",  Tkapp_DeleteFileHandler, 1},
++	{"createfilehandler",  Tkapp_CreateFileHandler, METH_VARARGS},
++	{"deletefilehandler",  Tkapp_DeleteFileHandler, METH_VARARGS},
+ #endif
+-	{"createtimerhandler", Tkapp_CreateTimerHandler, 1},
+-	{"mainloop",           Tkapp_MainLoop, 1},
+-	{"dooneevent",         Tkapp_DoOneEvent, 1},
+-	{"quit",               Tkapp_Quit, 1},
++	{"createtimerhandler", Tkapp_CreateTimerHandler, METH_VARARGS},
++	{"mainloop",           Tkapp_MainLoop, METH_VARARGS},
++	{"dooneevent",         Tkapp_DoOneEvent, METH_VARARGS},
++	{"quit",               Tkapp_Quit, METH_VARARGS},
++	{"setbusywaitinterval",Tkinter_setbusywaitinterval, METH_VARARGS,
++	                       setbusywaitinterval_doc},
++	{"getbusywaitinterval",(PyCFunction)Tkinter_getbusywaitinterval,
++	                       METH_NOARGS, getbusywaitinterval_doc},
+ 	{NULL,                 NULL}
+ };
+ 
+@@ -2003,7 +2905,9 @@
+ }
+ #endif
+ 
++#ifdef WITH_THREAD
+ static PyThreadState *event_tstate = NULL;
++#endif
+ 
+ static int
+ EventHook(void)
+@@ -2030,15 +2934,15 @@
+ #endif
+ #if defined(WITH_THREAD) || defined(MS_WINDOWS)
+ 		Py_BEGIN_ALLOW_THREADS
+-		PyThread_acquire_lock(tcl_lock, 1);
++		if(tcl_lock)PyThread_acquire_lock(tcl_lock, 1);
+ 		tcl_tstate = event_tstate;
+ 
+ 		result = Tcl_DoOneEvent(TCL_DONT_WAIT);
+ 
+ 		tcl_tstate = NULL;
+-		PyThread_release_lock(tcl_lock);
++		if(tcl_lock)PyThread_release_lock(tcl_lock);
+ 		if (result == 0)
+-			Sleep(20);
++			Sleep(Tkinter_busywaitinterval);
+ 		Py_END_ALLOW_THREADS
+ #else
+ 		result = Tcl_DoOneEvent(0);
+@@ -2109,7 +3013,7 @@
+ }
+ 
+ 
+-DL_EXPORT(void)
++PyMODINIT_FUNC
+ init_tkinter(void)
+ {
+ 	PyObject *m, *d;
+@@ -2123,7 +3027,7 @@
+ 	m = Py_InitModule("_tkinter", moduleMethods);
+ 
+ 	d = PyModule_GetDict(m);
+-	Tkinter_TclError = Py_BuildValue("s", "TclError");
++	Tkinter_TclError = PyErr_NewException("_tkinter.TclError", NULL, NULL);
+ 	PyDict_SetItemString(d, "TclError", Tkinter_TclError);
+ 
+ 	ins_long(d, "READABLE", TCL_READABLE);
+@@ -2143,6 +3047,8 @@
+ 	Tktt_Type.ob_type = &PyType_Type;
+ 	PyDict_SetItemString(d, "TkttType", (PyObject *)&Tktt_Type);
+ 
++	PyTclObject_Type.ob_type = &PyType_Type;
++	PyDict_SetItemString(d, "Tcl_Obj", (PyObject *)&PyTclObject_Type);
+ 
+ #ifdef TK_AQUA
+ 	/* Tk_MacOSXSetupTkNotifier must be called before Tcl's subsystems
--- python2.2-2.2.3dfsg.orig/debian/patches/webbrowser.dpatch
+++ python2.2-2.2.3dfsg/debian/patches/webbrowser.dpatch
@@ -0,0 +1,121 @@
+#! /bin/sh -e
+
+# DP: select correct webbrowser when DISPLAY is unset
+
+dir=
+if [ $# -eq 3 -a "$2" = '-d' ]; then
+    pdir="-d $3"
+    dir="$3/"
+elif [ $# -ne 1 ]; then
+    echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+    exit 1
+fi
+case "$1" in
+    -patch)
+        patch $pdir -f --no-backup-if-mismatch -p0 < $0
+        #cd ${dir}gcc && autoconf
+        ;;
+    -unpatch)
+        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
+        #rm ${dir}gcc/configure
+        ;;
+    *)
+	echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+        exit 1
+esac
+exit 0
+
+--- Lib/webbrowser.py	2002-10-12 00:06:12.000000000 +0200
++++ Lib/webbrowser.py	2002-11-25 20:54:05.000000000 +0100
+@@ -135,6 +135,33 @@
+         self.open(url, 1)
+ 
+ 
++class Galeon:
++    """Launcher class for Galeon browsers."""
++    def __init__(self, name):
++        self.name = name
++        self.basename = os.path.basename(name)
++
++    def _remote(self, action, autoraise):
++        raise_opt = ("--noraise", "")[autoraise]
++        cmd = "%s %s %s >/dev/null 2>&1" % (self.name, raise_opt, action)
++        rc = os.system(cmd)
++        if rc:
++            import time
++            os.system("%s >/dev/null 2>&1 &" % self.name)
++            time.sleep(PROCESS_CREATION_DELAY)
++            rc = os.system(cmd)
++        return not rc
++
++    def open(self, url, new=0, autoraise=1):
++        if new:
++            self._remote("-w '%s'" % url, autoraise)
++        else:
++            self._remote("-n '%s'" % url, autoraise)
++
++    def open_new(self, url):
++        self.open(url, 1)
++
++
+ class Konqueror:
+     """Controller for the KDE File Manager (kfm, or Konqueror).
+ 
+@@ -234,7 +261,7 @@
+ # the TERM and DISPLAY cases, because we might be running Python from inside
+ # an xterm.
+ if os.environ.get("TERM") or os.environ.get("DISPLAY"):
+-    _tryorder = ["mozilla","netscape","kfm","grail","links","lynx","w3m"]
++    _tryorder = ["links", "lynx", "w3m"]
+ 
+     # Easy cases first -- register console browsers if we have them.
+     if os.environ.get("TERM"):
+@@ -250,6 +277,9 @@
+ 
+     # X browsers have more in the way of options
+     if os.environ.get("DISPLAY"):
++        _tryorder = ["galeon", "skipstone", "mozilla", "netscape",
++                     "kfm", "grail"] + _tryorder
++
+         # First, the Netscape series
+         if _iscommand("mozilla"):
+             register("mozilla", None, Netscape("mozilla"))
+@@ -261,6 +291,15 @@
+             register("mosaic", None, GenericBrowser(
+                 "mosaic '%s' >/dev/null &"))
+ 
++        # Gnome's Galeon
++        if _iscommand("galeon"):
++            register("galeon", None, Galeon("galeon"))
++
++        # Skipstone, another Gtk/Mozilla based browser
++        if _iscommand("skipstone"):
++            register("skipstone", None, GenericBrowser(
++                "skipstone '%s' >/dev/null &"))
++
+         # Konqueror/kfm, the KDE browser.
+         if _iscommand("kfm") or _iscommand("konqueror"):
+             register("kfm", Konqueror, Konqueror())
+@@ -312,19 +351,19 @@
+ # OK, now that we know what the default preference orders for each
+ # platform are, allow user to override them with the BROWSER variable.
+ #
+-if os.environ.has_key("BROWSER"):
++if "BROWSER" in os.environ:
+     # It's the user's responsibility to register handlers for any unknown
+     # browser referenced by this value, before calling open().
+     _tryorder = os.environ["BROWSER"].split(os.pathsep)
+ 
+ for cmd in _tryorder:
+-    if not _browsers.has_key(cmd.lower()):
++    if not cmd.lower() in _browsers:
+         if _iscommand(cmd.lower()):
+             register(cmd.lower(), None, GenericBrowser(
+                 "%s '%%s'" % cmd.lower()))
+ cmd = None # to make del work if _tryorder was empty
+ del cmd
+ 
+-_tryorder = filter(lambda x: _browsers.has_key(x.lower())
++_tryorder = filter(lambda x: x.lower() in _browsers
+                    or x.find("%s") > -1, _tryorder)
+ # what to do if _tryorder is now empty?
--- python2.2-2.2.3dfsg.orig/debian/patches/doc-faq.dpatch
+++ python2.2-2.2.3dfsg/debian/patches/doc-faq.dpatch
@@ -0,0 +1,54 @@
+#! /bin/sh -e
+
+# DP: Mention the FAQ on the documentation index page.
+
+dir=
+if [ $# -eq 3 -a "$2" = '-d' ]; then
+    pdir="-d $3"
+    dir="$3/"
+elif [ $# -ne 1 ]; then
+    echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+    exit 1
+fi
+case "$1" in
+    -patch)
+        patch $pdir -f --no-backup-if-mismatch -p0 < $0
+        #cd ${dir}gcc && autoconf
+        ;;
+    -unpatch)
+        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
+        #rm ${dir}gcc/configure
+        ;;
+    *)
+	echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+        exit 1
+esac
+exit 0
+
+--- Doc/html/index.html.in~	2002-04-01 18:11:27.000000000 +0200
++++ Doc/html/index.html.in	2003-04-05 13:33:35.000000000 +0200
+@@ -123,6 +123,24 @@
+           </ul>
+           </td>
+         </tr>
++        <tr>
++          <td valign="baseline" class="left-column">
++          &nbsp;
++          <ul>
++            <li> <a href="../../python/FAQ.html" class="title"
++                >FAQ (local copy)</a>
++              <br>(python package must be installed)
++          </ul>
++          </td>
++          <td valign="baseline" class="right-column">
++          &nbsp;
++          <ul>
++            <li> <a href="http://www.python.org/cgi-bin/faqw.py" class="title"
++                >FAQ (online wizard)</a>
++              <br>(maybe more recent)
++          </ul>
++          </td>
++        </tr>
+       </tbody>
+     </table>
+     <p>
--- python2.2-2.2.3dfsg.orig/debian/patches/patchlevel.dpatch
+++ python2.2-2.2.3dfsg/debian/patches/patchlevel.dpatch
@@ -0,0 +1,38 @@
+#! /bin/sh -e
+
+# DP: Set the PY_RELEASE_SERIAL to 1 (changed from 0)
+
+dir=
+if [ $# -eq 3 -a "$2" = '-d' ]; then
+    pdir="-d $3"
+    dir="$3/"
+elif [ $# -ne 1 ]; then
+    echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+    exit 1
+fi
+case "$1" in
+    -patch)
+        patch $pdir -f --no-backup-if-mismatch -p0 < $0
+        #cd ${dir}gcc && autoconf
+        ;;
+    -unpatch)
+        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
+        #rm ${dir}gcc/configure
+        ;;
+    *)
+	echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+        exit 1
+esac
+exit 0
+
+--- Include/patchlevel.h~	2002-10-14 14:25:20.000000000 +0200
++++ Include/patchlevel.h	2003-05-14 07:58:20.000000000 +0200
+@@ -23,7 +23,7 @@
+ #define PY_MINOR_VERSION	2
+ #define PY_MICRO_VERSION	3
+ #define PY_RELEASE_LEVEL	PY_RELEASE_LEVEL_FINAL
+-#define PY_RELEASE_SERIAL	0
++#define PY_RELEASE_SERIAL	1
+ 
+ /* Version as a string */
+ #define PY_VERSION		"2.2.3+"
--- python2.2-2.2.3dfsg.orig/debian/patches/build-blt.dpatch
+++ python2.2-2.2.3dfsg/debian/patches/build-blt.dpatch
@@ -0,0 +1,41 @@
+#! /bin/sh -e
+
+# DP: configure _tkinter with BLT support
+
+dir=
+if [ $# -eq 3 -a "$2" = '-d' ]; then
+    pdir="-d $3"
+    dir="$3/"
+elif [ $# -ne 1 ]; then
+    echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+    exit 1
+fi
+case "$1" in
+    -patch)
+        patch $pdir -f --no-backup-if-mismatch -p0 < $0
+        #cd ${dir}gcc && autoconf
+        ;;
+    -unpatch)
+        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
+        #rm ${dir}gcc/configure
+        ;;
+    *)
+	echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+        exit 1
+esac
+exit 0
+
+--- setup.py~	2003-05-30 09:05:30.000000000 +0200
++++ setup.py	2003-05-30 09:17:37.000000000 +0200
+@@ -764,9 +764,9 @@
+ 
+         # Check for BLT extension
+         if self.compiler.find_library_file(lib_dirs + added_lib_dirs,
+-                                           'BLT8.0'):
++                                           'BLT'):
+             defs.append( ('WITH_BLT', 1) )
+-            libs.append('BLT8.0')
++            libs.append('BLT')
+ 
+         # Add the Tcl/Tk libraries
+         libs.append('tk'+version)
--- python2.2-2.2.3dfsg.orig/debian/patches/pydoc.dpatch
+++ python2.2-2.2.3dfsg/debian/patches/pydoc.dpatch
@@ -0,0 +1,38 @@
+#! /bin/sh -e
+
+# DP: for usage output use the basename of the script
+
+dir=
+if [ $# -eq 3 -a "$2" = '-d' ]; then
+    pdir="-d $3"
+    dir="$3/"
+elif [ $# -ne 1 ]; then
+    echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+    exit 1
+fi
+case "$1" in
+    -patch)
+        patch $pdir -f --no-backup-if-mismatch -p1 < $0
+        #cd ${dir}gcc && autoconf
+        ;;
+    -unpatch)
+        patch $pdir -f --no-backup-if-mismatch -R -p1 < $0
+        #rm ${dir}gcc/configure
+        ;;
+    *)
+	echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+        exit 1
+esac
+exit 0
+
+--- python2.2-2.2.3.orig/Lib/pydoc.py
++++ python2.2-2.2.3/Lib/pydoc.py
+@@ -2085,7 +2085,7 @@
+                 print value
+ 
+     except (getopt.error, BadUsage):
+-        cmd = sys.argv[0]
++        cmd = os.path.basename(sys.argv[0])
+         print """pydoc - the Python documentation tool
+ 
+ %s <name> ...
--- python2.2-2.2.3dfsg.orig/debian/patches/socket-ipconst.dpatch
+++ python2.2-2.2.3dfsg/debian/patches/socket-ipconst.dpatch
@@ -0,0 +1,39 @@
+#! /bin/sh -e
+
+# DP: Add IPPROTO_IPV6 option to the socketmodule
+
+dir=
+if [ $# -eq 3 -a "$2" = '-d' ]; then
+    pdir="-d $3"
+    dir="$3/"
+elif [ $# -ne 1 ]; then
+    echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+    exit 1
+fi
+case "$1" in
+    -patch)
+        patch $pdir -f --no-backup-if-mismatch -p0 < $0
+        #cd ${dir}gcc && autoconf
+        ;;
+    -unpatch)
+        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
+        #rm ${dir}gcc/configure
+        ;;
+    *)
+	echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+        exit 1
+esac
+exit 0
+
+--- Modules/socketmodule.c~	2003-08-07 13:56:22.000000000 +0200
++++ Modules/socketmodule.c	2003-09-27 10:33:03.000000000 +0200
+@@ -3749,6 +3749,9 @@
+ #ifdef	IPPROTO_IPV4
+ 	PyModule_AddIntConstant(m, "IPPROTO_IPV4", IPPROTO_IPV4);
+ #endif
++#ifdef	IPPROTO_IPV6
++	PyModule_AddIntConstant(m, "IPPROTO_IPV6", IPPROTO_IPV6);
++#endif
+ #ifdef	IPPROTO_IPIP
+ 	PyModule_AddIntConstant(m, "IPPROTO_IPIP", IPPROTO_IPIP);
+ #endif
--- python2.2-2.2.3dfsg.orig/debian/patches/docs.uue
+++ python2.2-2.2.3dfsg/debian/patches/docs.uue
@@ -0,0 +1,36411 @@
+begin-base64 644 docs.tar.bz2

+GqviJZpArSbb8EI6X753YNUwQ6OsxSFUAdkjhkzYho0j7j0hwT0Aq