--- python2.7-2.7.3.orig/debian/PVER-dbg.symbols.in
+++ python2.7-2.7.3/debian/PVER-dbg.symbols.in
@@ -0,0 +1,33 @@
+libpython@VER@_d.so.1.0 python@VER@-dbg #MINVER#
+ Py_InitModule4TraceRefs@Base @VER@
+#include "libpython.symbols"
+ _PyDict_Dummy@Base @VER@
+ _PyMem_DebugFree@Base @VER@
+ _PyMem_DebugMalloc@Base @VER@
+ _PyMem_DebugRealloc@Base @VER@
+ _PyObject_DebugCheckAddress@Base @VER@
+ _PyObject_DebugCheckAddressApi@Base @VER@
+ _PyObject_DebugDumpAddress@Base @VER@
+ _PyObject_DebugFree@Base @VER@
+ _PyObject_DebugFreeApi@Base @VER@
+ _PyObject_DebugMalloc@Base @VER@
+ _PyObject_DebugMallocApi@Base @VER@
+ _PyObject_DebugMallocStats@Base @VER@
+ _PyObject_DebugRealloc@Base @VER@
+ _PyObject_DebugReallocApi@Base @VER@
+ _PySet_Dummy@Base @VER@
+ _Py_AddToAllObjects@Base @VER@
+ _Py_Dealloc@Base @VER@
+ _Py_ForgetReference@Base @VER@
+ _Py_GetObjects@Base @VER@
+ _Py_GetRefTotal@Base @VER@
+ _Py_HashSecret_Initialized@Base @VER@
+ _Py_NegativeRefcount@Base @VER@
+ _Py_NewReference@Base @VER@
+ _Py_PrintReferenceAddresses@Base @VER@
+ _Py_PrintReferences@Base @VER@
+ _Py_RefTotal@Base @VER@
+ _Py_dumptree@Base @VER@
+ _Py_printtree@Base @VER@
+ _Py_showtree@Base @VER@
+ _Py_tok_dump@Base @VER@
--- python2.7-2.7.3.orig/debian/script.py
+++ python2.7-2.7.3/debian/script.py
@@ -0,0 +1,51 @@
+#! /usr/bin/python
+
+# Copyright (C) 2012 Colin Watson <cjwatson@ubuntu.com>.
+#
+# 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+"""Trivial script(1) workalike, but without reading from standard input."""
+
+import os
+import pty
+import select
+import sys
+
+filename = sys.argv[1]
+command = sys.argv[2]
+
+pid, master = pty.fork()
+if pid == 0:  # child
+    os.execlp("sh", "sh", "-c", command)
+
+# parent
+with open(filename, "w") as logfile:
+    try:
+        while True:
+            rfds, _, _ = select.select([master], [], [])
+            if master in rfds:
+                data = os.read(master, 65536)
+                os.write(1, data)
+                logfile.write(data)
+                logfile.flush()
+    except (IOError, OSError):
+        pass
+
+os.close(master)
--- python2.7-2.7.3.orig/debian/idle-PVER.prerm.in
+++ python2.7-2.7.3/debian/idle-PVER.prerm.in
@@ -0,0 +1,15 @@
+#! /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#
+
+exit 0
--- python2.7-2.7.3.orig/debian/copyright
+++ python2.7-2.7.3/debian/copyright
@@ -0,0 +1,732 @@
+This package was put together by Klee Dienes <klee@debian.org> from 
+sources from ftp.python.org:/pub/python, based on the Debianization by 
+the previous maintainers Bernd S. Brentrup <bsb@uni-muenster.de> and 
+Bruce Perens. Current maintainer is Matthias Klose <doko@debian.org>. 
+
+It was downloaded from http://python.org/
+
+Copyright:
+
+Upstream Author: Guido van Rossum <guido@cwi.nl> and others.
+
+License:
+
+The following text includes the Python license and licenses and
+acknowledgements for incorporated software. The licenses can be read
+in the HTML and texinfo versions of the documentation as well, after
+installing the pythonx.y-doc package. Licenses for files not licensed
+under the Python Licenses are found at the end of this file.
+
+
+Python License
+==============
+
+A. HISTORY OF THE SOFTWARE
+==========================
+
+Python was created in the early 1990s by Guido van Rossum at Stichting
+Mathematisch Centrum (CWI, see http://www.cwi.nl) in the Netherlands
+as a successor of a language called ABC.  Guido remains Python's
+principal author, although it includes many contributions from others.
+
+In 1995, Guido continued his work on Python at the Corporation for
+National Research Initiatives (CNRI, see http://www.cnri.reston.va.us)
+in Reston, Virginia where he released several versions of the
+software.
+
+In May 2000, Guido and the Python core development team moved to
+BeOpen.com to form the BeOpen PythonLabs team.  In October of the same
+year, the PythonLabs team moved to Digital Creations (now Zope
+Corporation, see http://www.zope.com).  In 2001, the Python Software
+Foundation (PSF, see http://www.python.org/psf/) was formed, a
+non-profit organization created specifically to own Python-related
+Intellectual Property.  Zope Corporation is a sponsoring member of
+the PSF.
+
+All Python releases are Open Source (see http://www.opensource.org for
+the Open Source Definition).  Historically, most, but not all, Python
+releases have also been GPL-compatible; the table below summarizes
+the various releases.
+
+    Release         Derived     Year        Owner       GPL-
+                    from                                compatible? (1)
+
+    0.9.0 thru 1.2              1991-1995   CWI         yes
+    1.3 thru 1.5.2  1.2         1995-1999   CNRI        yes
+    1.6             1.5.2       2000        CNRI        no
+    2.0             1.6         2000        BeOpen.com  no
+    1.6.1           1.6         2001        CNRI        yes (2)
+    2.1             2.0+1.6.1   2001        PSF         no
+    2.0.1           2.0+1.6.1   2001        PSF         yes
+    2.1.1           2.1+2.0.1   2001        PSF         yes
+    2.2             2.1.1       2001        PSF         yes
+    2.1.2           2.1.1       2002        PSF         yes
+    2.1.3           2.1.2       2002        PSF         yes
+    2.2.1           2.2         2002        PSF         yes
+    2.2.2           2.2.1       2002        PSF         yes
+    2.2.3           2.2.2       2003        PSF         yes
+    2.3             2.2.2       2002-2003   PSF         yes
+    2.3.1           2.3         2002-2003   PSF         yes
+    2.3.2           2.3.1       2002-2003   PSF         yes
+    2.3.3           2.3.2       2002-2003   PSF         yes
+    2.3.4           2.3.3       2004        PSF         yes
+    2.3.5           2.3.4       2005        PSF         yes
+    2.4             2.3         2004        PSF         yes
+    2.4.1           2.4         2005        PSF         yes
+    2.4.2           2.4.1       2005        PSF         yes
+    2.4.3           2.4.2       2006        PSF         yes
+    2.5             2.4         2006        PSF         yes
+    2.5.1           2.5         2007        PSF         yes
+    2.5.2           2.5.1       2008        PSF         yes
+    2.5.3           2.5.2       2008        PSF         yes
+    2.6             2.5         2008        PSF         yes
+    2.6.1           2.6         2008        PSF         yes
+    2.6.2           2.6.1       2009        PSF         yes
+    2.6.3           2.6.2       2009        PSF         yes
+    2.6.4           2.6.3       2009        PSF         yes
+    2.6.5           2.6.4       2010        PSF         yes
+    2.7             2.6         2010        PSF         yes
+
+Footnotes:
+
+(1) GPL-compatible doesn't mean that we're distributing Python under
+    the GPL.  All Python licenses, unlike the GPL, let you distribute
+    a modified version without making your changes open source.  The
+    GPL-compatible licenses make it possible to combine Python with
+    other software that is released under the GPL; the others don't.
+
+(2) According to Richard Stallman, 1.6.1 is not GPL-compatible,
+    because its license has a choice of law clause.  According to
+    CNRI, however, Stallman's lawyer has told CNRI's lawyer that 1.6.1
+    is "not incompatible" with the GPL.
+
+Thanks to the many outside volunteers who have worked under Guido's
+direction to make these releases possible.
+
+
+B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON
+===============================================================
+
+PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
+--------------------------------------------
+
+1. This LICENSE AGREEMENT is between the Python Software Foundation
+("PSF"), and the Individual or Organization ("Licensee") accessing and
+otherwise using this software ("Python") in source or binary form and
+its associated documentation.
+
+2. Subject to the terms and conditions of this License Agreement, PSF
+hereby grants Licensee a nonexclusive, royalty-free, world-wide
+license to reproduce, analyze, test, perform and/or display publicly,
+prepare derivative works, distribute, and otherwise use Python
+alone or in any derivative version, provided, however, that PSF's
+License Agreement and PSF's notice of copyright, i.e., "Copyright (c)
+2001, 2002, 2003, 2004, 2005, 2006, 2007 Python Software Foundation; 
+All Rights Reserved" are retained in Python alone or in any derivative 
+version prepared by Licensee.
+
+3. In the event Licensee prepares a derivative work that is based on
+or incorporates Python or any part thereof, and wants to make
+the derivative work available to others as provided herein, then
+Licensee hereby agrees to include in any such work a brief summary of
+the changes made to Python.
+
+4. PSF is making Python available to Licensee on an "AS IS"
+basis.  PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
+IMPLIED.  BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
+DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
+FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT
+INFRINGE ANY THIRD PARTY RIGHTS.
+
+5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
+FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
+A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,
+OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
+
+6. This License Agreement will automatically terminate upon a material
+breach of its terms and conditions.
+
+7. Nothing in this License Agreement shall be deemed to create any
+relationship of agency, partnership, or joint venture between PSF and
+Licensee.  This License Agreement does not grant permission to use PSF
+trademarks or trade name in a trademark sense to endorse or promote
+products or services of Licensee, or any third party.
+
+8. By copying, installing or otherwise using Python, Licensee
+agrees to be bound by the terms and conditions of this License
+Agreement.
+
+
+BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0
+-------------------------------------------
+
+BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1
+
+1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an
+office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the
+Individual or Organization ("Licensee") accessing and otherwise using
+this software in source or binary form and its associated
+documentation ("the Software").
+
+2. Subject to the terms and conditions of this BeOpen Python License
+Agreement, BeOpen hereby grants Licensee a non-exclusive,
+royalty-free, world-wide license to reproduce, analyze, test, perform
+and/or display publicly, prepare derivative works, distribute, and
+otherwise use the Software alone or in any derivative version,
+provided, however, that the BeOpen Python License is retained in the
+Software, alone or in any derivative version prepared by Licensee.
+
+3. BeOpen is making the Software available to Licensee on an "AS IS"
+basis.  BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
+IMPLIED.  BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND
+DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
+FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT
+INFRINGE ANY THIRD PARTY RIGHTS.
+
+4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE
+SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS
+AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY
+DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
+
+5. This License Agreement will automatically terminate upon a material
+breach of its terms and conditions.
+
+6. This License Agreement shall be governed by and interpreted in all
+respects by the law of the State of California, excluding conflict of
+law provisions.  Nothing in this License Agreement shall be deemed to
+create any relationship of agency, partnership, or joint venture
+between BeOpen and Licensee.  This License Agreement does not grant
+permission to use BeOpen trademarks or trade names in a trademark
+sense to endorse or promote products or services of Licensee, or any
+third party.  As an exception, the "BeOpen Python" logos available at
+http://www.pythonlabs.com/logos.html may be used according to the
+permissions granted on that web page.
+
+7. By copying, installing or otherwise using the software, Licensee
+agrees to be bound by the terms and conditions of this License
+Agreement.
+
+
+CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1
+---------------------------------------
+
+1. This LICENSE AGREEMENT is between the Corporation for National
+Research Initiatives, having an office at 1895 Preston White Drive,
+Reston, VA 20191 ("CNRI"), and the Individual or Organization
+("Licensee") accessing and otherwise using Python 1.6.1 software in
+source or binary form and its associated documentation.
+
+2. Subject to the terms and conditions of this License Agreement, CNRI
+hereby grants Licensee a nonexclusive, royalty-free, world-wide
+license to reproduce, analyze, test, perform and/or display publicly,
+prepare derivative works, distribute, and otherwise use Python 1.6.1
+alone or in any derivative version, provided, however, that CNRI's
+License Agreement and CNRI's notice of copyright, i.e., "Copyright (c)
+1995-2001 Corporation for National Research Initiatives; All Rights
+Reserved" are retained in Python 1.6.1 alone or in any derivative
+version prepared by Licensee.  Alternately, in lieu of CNRI's License
+Agreement, Licensee may substitute the following text (omitting the
+quotes): "Python 1.6.1 is made available subject to the terms and
+conditions in CNRI's License Agreement.  This Agreement together with
+Python 1.6.1 may be located on the Internet using the following
+unique, persistent identifier (known as a handle): 1895.22/1013.  This
+Agreement may also be obtained from a proxy server on the Internet
+using the following URL: http://hdl.handle.net/1895.22/1013".
+
+3. In the event Licensee prepares a derivative work that is based on
+or incorporates Python 1.6.1 or any part thereof, and wants to make
+the derivative work available to others as provided herein, then
+Licensee hereby agrees to include in any such work a brief summary of
+the changes made to Python 1.6.1.
+
+4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS"
+basis.  CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
+IMPLIED.  BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND
+DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
+FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT
+INFRINGE ANY THIRD PARTY RIGHTS.
+
+5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
+1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
+A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1,
+OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
+
+6. This License Agreement will automatically terminate upon a material
+breach of its terms and conditions.
+
+7. This License Agreement shall be governed by the federal
+intellectual property law of the United States, including without
+limitation the federal copyright law, and, to the extent such
+U.S. federal law does not apply, by the law of the Commonwealth of
+Virginia, excluding Virginia's conflict of law provisions.
+Notwithstanding the foregoing, with regard to derivative works based
+on Python 1.6.1 that incorporate non-separable material that was
+previously distributed under the GNU General Public License (GPL), the
+law of the Commonwealth of Virginia shall govern this License
+Agreement only as to issues arising under or with respect to
+Paragraphs 4, 5, and 7 of this License Agreement.  Nothing in this
+License Agreement shall be deemed to create any relationship of
+agency, partnership, or joint venture between CNRI and Licensee.  This
+License Agreement does not grant permission to use CNRI trademarks or
+trade name in a trademark sense to endorse or promote products or
+services of Licensee, or any third party.
+
+8. By clicking on the "ACCEPT" button where indicated, or by copying,
+installing or otherwise using Python 1.6.1, Licensee agrees to be
+bound by the terms and conditions of this License Agreement.
+
+        ACCEPT
+
+
+CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2
+--------------------------------------------------
+
+Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam,
+The Netherlands.  All rights reserved.
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Stichting Mathematisch
+Centrum or CWI not be used in advertising or publicity pertaining to
+distribution of the software without specific, written prior
+permission.
+
+STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
+THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
+FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+
+Licenses and Acknowledgements for Incorporated Software
+=======================================================
+
+Mersenne Twister
+----------------
+
+The `_random' module includes code based on a download from
+`http://www.math.keio.ac.jp/~matumoto/MT2002/emt19937ar.html'.  The
+following are the verbatim comments from the original code:
+
+     A C-program for MT19937, with initialization improved 2002/1/26.
+     Coded by Takuji Nishimura and Makoto Matsumoto.
+
+     Before using, initialize the state by using init_genrand(seed)
+     or init_by_array(init_key, key_length).
+
+     Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
+     All rights reserved.
+
+     Redistribution and use in source and binary forms, with or without
+     modification, are permitted provided that the following conditions
+     are met:
+
+      1. Redistributions of source code must retain the above copyright
+         notice, this list of conditions and the following disclaimer.
+
+      2. Redistributions in binary form must reproduce the above copyright
+         notice, this list of conditions and the following disclaimer in the
+         documentation and/or other materials provided with the distribution.
+
+      3. The names of its contributors may not be used to endorse or promote
+         products derived from this software without specific prior written
+         permission.
+
+     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+     "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+     A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT
+     OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+     TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+     PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+     LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+     NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+     SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+     Any feedback is very welcome.
+     http://www.math.keio.ac.jp/matumoto/emt.html
+     email: matumoto@math.keio.ac.jp
+
+
+Sockets
+-------
+
+The `socket' module uses the functions, `getaddrinfo', and
+`getnameinfo', which are coded in separate source files from the WIDE
+Project, `http://www.wide.ad.jp/about/index.html'.
+
+     Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+     All rights reserved.
+
+     Redistribution and use in source and binary forms, with or without
+     modification, are permitted provided that the following conditions
+     are met:
+     1. Redistributions of source code must retain the above copyright
+        notice, this list of conditions and the following disclaimer.
+     2. Redistributions in binary form must reproduce the above copyright
+        notice, this list of conditions and the following disclaimer in the
+        documentation and/or other materials provided with the distribution.
+     3. Neither the name of the project nor the names of its contributors
+        may be used to endorse or promote products derived from this software
+        without specific prior written permission.
+
+     THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+     GAI_ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+     IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+     ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+     FOR GAI_ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+     CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+     SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+     INTERRUPTION) HOWEVER CAUSED AND ON GAI_ANY THEORY OF LIABILITY, WHETHER
+     IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+     ARISING IN GAI_ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+     OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+Floating point exception control
+--------------------------------
+
+The source for the `fpectl' module includes the following notice:
+
+     ---------------------------------------------------------------------  
+    /                       Copyright (c) 1996.                           \ 
+   |          The Regents of the University of California.                 |
+   |                        All rights reserved.                           |
+   |                                                                       |
+   |   Permission to use, copy, modify, and distribute this software for   |
+   |   any purpose without fee is hereby granted, provided that this en-   |
+   |   tire notice is included in all copies of any software which is or   |
+   |   includes  a  copy  or  modification  of  this software and in all   |
+   |   copies of the supporting documentation for such software.           |
+   |                                                                       |
+   |   This  work was produced at the University of California, Lawrence   |
+   |   Livermore National Laboratory under  contract  no.  W-7405-ENG-48   |
+   |   between  the  U.S.  Department  of  Energy and The Regents of the   |
+   |   University of California for the operation of UC LLNL.              |
+   |                                                                       |
+   |                              DISCLAIMER                               |
+   |                                                                       |
+   |   This  software was prepared as an account of work sponsored by an   |
+   |   agency of the United States Government. Neither the United States   |
+   |   Government  nor the University of California nor any of their em-   |
+   |   ployees, makes any warranty, express or implied, or  assumes  any   |
+   |   liability  or  responsibility  for the accuracy, completeness, or   |
+   |   usefulness of any information,  apparatus,  product,  or  process   |
+   |   disclosed,   or  represents  that  its  use  would  not  infringe   |
+   |   privately-owned rights. Reference herein to any specific  commer-   |
+   |   cial  products,  process,  or  service  by trade name, trademark,   |
+   |   manufacturer, or otherwise, does not  necessarily  constitute  or   |
+   |   imply  its endorsement, recommendation, or favoring by the United   |
+   |   States Government or the University of California. The views  and   |
+   |   opinions  of authors expressed herein do not necessarily state or   |
+   |   reflect those of the United States Government or  the  University   |
+   |   of  California,  and shall not be used for advertising or product   |
+    \  endorsement purposes.                                              / 
+     ---------------------------------------------------------------------
+
+
+Cookie management
+-----------------
+
+The `Cookie' module contains the following notice:
+
+      Copyright 2000 by Timothy O'Malley <timo@alum.mit.edu>
+
+                     All Rights Reserved
+
+      Permission to use, copy, modify, and distribute this software
+      and its documentation for any purpose and without fee is hereby
+      granted, provided that the above copyright notice appear in all
+      copies and that both that copyright notice and this permission
+      notice appear in supporting documentation, and that the name of
+      Timothy O'Malley  not be used in advertising or publicity
+      pertaining to distribution of the software without specific, written
+      prior permission.
+
+      Timothy O'Malley DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+      SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+      AND FITNESS, IN NO EVENT SHALL Timothy O'Malley BE LIABLE FOR
+      ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+      WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+      WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+      ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+      PERFORMANCE OF THIS SOFTWARE.
+
+
+Execution tracing
+-----------------
+
+The `trace' module contains the following notice:
+
+      portions copyright 2001, Autonomous Zones Industries, Inc., all rights...
+      err...  reserved and offered to the public under the terms of the
+      Python 2.2 license.
+      Author: Zooko O'Whielacronx
+      http://zooko.com/
+      mailto:zooko@zooko.com
+
+      Copyright 2000, Mojam Media, Inc., all rights reserved.
+      Author: Skip Montanaro
+
+      Copyright 1999, Bioreason, Inc., all rights reserved.
+      Author: Andrew Dalke
+
+      Copyright 1995-1997, Automatrix, Inc., all rights reserved.
+      Author: Skip Montanaro
+
+      Copyright 1991-1995, Stichting Mathematisch Centrum, all rights reserved.
+
+      Permission to use, copy, modify, and distribute this Python software and
+      its associated documentation for any purpose without fee is hereby
+      granted, provided that the above copyright notice appears in all copies,
+      and that both that copyright notice and this permission notice appear in
+      supporting documentation, and that the name of neither Automatrix,
+      Bioreason or Mojam Media be used in advertising or publicity pertaining
+      to distribution of the software without specific, written prior
+      permission.
+
+
+UUencode and UUdecode functions
+-------------------------------
+
+The `uu' module contains the following notice:
+
+      Copyright 1994 by Lance Ellinghouse
+      Cathedral City, California Republic, United States of America.
+                             All Rights Reserved
+      Permission to use, copy, modify, and distribute this software and its
+      documentation for any purpose and without fee is hereby granted,
+      provided that the above copyright notice appear in all copies and that
+      both that copyright notice and this permission notice appear in
+      supporting documentation, and that the name of Lance Ellinghouse
+      not be used in advertising or publicity pertaining to distribution
+      of the software without specific, written prior permission.
+      LANCE ELLINGHOUSE DISCLAIMS ALL WARRANTIES WITH REGARD TO
+      THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+      FITNESS, IN NO EVENT SHALL LANCE ELLINGHOUSE CENTRUM BE LIABLE
+      FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+      WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+      ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+      OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+      Modified by Jack Jansen, CWI, July 1995:
+      - Use binascii module to do the actual line-by-line conversion
+        between ascii and binary. This results in a 1000-fold speedup. The C
+        version is still 5 times faster, though.
+      - Arguments more compliant with python standard
+
+
+XML Remote Procedure Calls
+--------------------------
+
+The `xmlrpclib' module contains the following notice:
+
+          The XML-RPC client interface is
+
+      Copyright (c) 1999-2002 by Secret Labs AB
+      Copyright (c) 1999-2002 by Fredrik Lundh
+
+      By obtaining, using, and/or copying this software and/or its
+      associated documentation, you agree that you have read, understood,
+      and will comply with the following terms and conditions:
+
+      Permission to use, copy, modify, and distribute this software and
+      its associated documentation for any purpose and without fee is
+      hereby granted, provided that the above copyright notice appears in
+      all copies, and that both that copyright notice and this permission
+      notice appear in supporting documentation, and that the name of
+      Secret Labs AB or the author not be used in advertising or publicity
+      pertaining to distribution of the software without specific, written
+      prior permission.
+
+      SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
+      TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT-
+      ABILITY AND FITNESS.  IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR
+      BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+      DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+      WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+      ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+      OF THIS SOFTWARE.
+
+Licenses for Software linked to
+===============================
+
+Note that the choice of GPL compatibility outlined above doesn't extend
+to modules linked to particular libraries, since they change the
+effective License of the module binary.
+
+
+GNU Readline
+------------
+
+The 'readline' module makes use of GNU Readline.
+
+      The GNU Readline Library is free software; you can redistribute it
+      and/or modify it under the terms of the GNU General Public License as
+      published by the Free Software Foundation; either version 2, or (at
+      your option) any later version.
+
+      On Debian systems, you can find the complete statement in
+      /usr/share/doc/readline-common/copyright'. A copy of the GNU General
+      Public License is available in /usr/share/common-licenses/GPL-2'.
+
+
+OpenSSL
+-------
+
+The '_ssl' module makes use of OpenSSL.
+
+      The OpenSSL toolkit stays under a dual license, i.e. both the
+      conditions of the OpenSSL License and the original SSLeay license
+      apply to the toolkit. Actually both licenses are BSD-style Open
+      Source licenses. Note that both licenses are incompatible with
+      the GPL.
+
+      On Debian systems, you can find the complete license text in
+      /usr/share/doc/openssl/copyright'.
+
+
+Files with other licenses than the Python License
+-------------------------------------------------
+
+Files: Lib/profile.py Lib/pstats.py
+Copyright: Disney Enterprises, Inc.  All Rights Reserved.
+License: # Licensed to PSF under a Contributor Agreement
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+  either express or implied.  See the License for the specific language
+  overning permissions and limitations under the License.
+
+  On Debian systems, the Apache 2.0 license can be found in
+  /usr/share/common-licenses/Apache-2.0.
+
+Files: Modules/zlib/*
+Copyright: (C) 1995-2010 Jean-loup Gailly and Mark Adler
+License: This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+
+  Jean-loup Gailly        Mark Adler
+  jloup@gzip.org          madler@alumni.caltech.edu
+
+ If you use the zlib library in a product, we would appreciate *not* receiving
+ lengthy legal documents to sign.  The sources are provided for free but without
+ warranty of any kind.  The library has been entirely written by Jean-loup
+ Gailly and Mark Adler; it does not include third-party code.
+
+Files: Modules/_ctypes/libffi/*
+Copyright: Copyright (C) 1996-2009 Red Hat, Inc and others.
+License: 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 AUTHORS OR COPYRIGHT
+   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+   DEALINGS IN THE SOFTWARE.
+
+   Documentation:
+   Permission is granted to copy, distribute and/or modify this document
+   under the terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option) any
+   later version.  A copy of the license is included in the
+   section entitled ``GNU General Public License''.
+
+Files: Modules/expat/*
+Copyright: Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
+  and Clark Cooper
+  Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006 Expat maintainers
+License: 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Files: Misc/python-mode.el
+Copyright: Copyright (C) 1992,1993,1994  Tim Peters
+License: This software is provided as-is, without express or implied
+	warranty.  Permission to use, copy, modify, distribute or sell this
+	software, without fee, for any purpose and by any individual or
+	organization, is hereby granted, provided that the above copyright
+	notice and this paragraph appear in all copies.
+
+Files: PC/_subprocess.c
+Copyright: Copyright (c) 2004 by Fredrik Lundh <fredrik@pythonware.com>
+	Copyright (c) 2004 by Secret Labs AB, http://www.pythonware.com
+	Copyright (c) 2004 by Peter Astrand <astrand@lysator.liu.se>
+License:
+ * Permission to use, copy, modify, and distribute this software and
+ * its associated documentation for any purpose and without fee is
+ * hereby granted, provided that the above copyright notice appears in
+ * all copies, and that both that copyright notice and this permission
+ * notice appear in supporting documentation, and that the name of the
+ * authors not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission.
+ *
+ * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
+ * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+Files: PC/winsound.c
+Copyright: Copyright (c) 1999 Toby Dickenson
+License:  * Permission to use this software in any way is granted without
+ * fee, provided that the copyright notice above appears in all
+ * copies. This software is provided "as is" without any warranty.
+ */
+
+/* Modified by Guido van Rossum */
+/* Beep added by Mark Hammond */
+/* Win9X Beep and platform identification added by Uncle Timmy */
--- python2.7-2.7.3.orig/debian/sitecustomize.py.in
+++ python2.7-2.7.3/debian/sitecustomize.py.in
@@ -0,0 +1,7 @@
+# install the apport exception handler if available
+try:
+    import apport_python_hook
+except ImportError:
+    pass
+else:
+    apport_python_hook.install()
--- python2.7-2.7.3.orig/debian/control.stdlib
+++ python2.7-2.7.3/debian/control.stdlib
@@ -0,0 +1,16 @@
+Package: @PVER@-tk
+Architecture: any
+Depends: @PVER@ (= ${Source-Version}), ${shlibs:Depends}
+Suggests: tix
+XB-Python-Version: @VER@
+Description: Tkinter - Writing Tk applications with Python (v@VER@)
+ A module for writing portable GUI applications with Python (v@VER@) using Tk.
+ Also known as Tkinter.
+
+Package: @PVER@-gdbm
+Architecture: any
+Depends: @PVER@ (= ${Source-Version}), ${shlibs:Depends}
+Description: GNU dbm database support for Python (v@VER@)
+ GNU dbm database module for Python. Install this if you want to
+ create or read GNU dbm database files with Python.
+
--- python2.7-2.7.3.orig/debian/README.source
+++ python2.7-2.7.3/debian/README.source
@@ -0,0 +1,7 @@
+The source tarball is lacking the files Lib/profile.py and Lib/pstats.py,
+which Debian considers to have a license non-suitable for main (the use
+of these modules limited to python).
+
+The package uses quilt to apply / unapply patches.
+See /usr/share/doc/quilt/README.source.  The series file is generated
+during the build.
--- python2.7-2.7.3.orig/debian/changelog.shared
+++ python2.7-2.7.3/debian/changelog.shared
@@ -0,0 +1,3 @@
+  * Link the interpreter against the shared runtime library. With
+    gcc-4.1 the difference in the pystones benchmark dropped from about
+    12% to about 5%.
--- python2.7-2.7.3.orig/debian/PVER-doc.doc-base.PVER-api.in
+++ python2.7-2.7.3/debian/PVER-doc.doc-base.PVER-api.in
@@ -0,0 +1,13 @@
+Document: @PVER@-api
+Title: Python/C API Reference Manual (v@VER@)
+Author: Guido van Rossum
+Abstract: This manual documents the API used by C (or C++) programmers who
+ want to write extension modules or embed Python.  It is a
+ companion to *Extending and Embedding the Python Interpreter*,
+ which describes the general principles of extension writing but
+ does not document the API functions in detail.
+Section: Programming/Python
+
+Format: HTML
+Index: /usr/share/doc/@PVER@/html/c-api/index.html
+Files: /usr/share/doc/@PVER@/html/c-api/*.html
--- python2.7-2.7.3.orig/debian/PVER-doc.doc-base.PVER-tut.in
+++ python2.7-2.7.3/debian/PVER-doc.doc-base.PVER-tut.in
@@ -0,0 +1,13 @@
+Document: @PVER@-tut
+Title: Python Tutorial (v@VER@)
+Author: Guido van Rossum, Fred L. Drake, Jr., editor
+Abstract: This tutorial introduces the reader informally to the basic
+ concepts and features of the Python language and system.  It helps
+ to have a Python interpreter handy for hands-on experience, but
+ all examples are self-contained, so the tutorial can be read
+ off-line as well.
+Section: Programming/Python
+
+Format: HTML
+Index: /usr/share/doc/@PVER@/html/tutorial/index.html
+Files: /usr/share/doc/@PVER@/html/tutorial/*.html
--- python2.7-2.7.3.orig/debian/README.PVER.in
+++ python2.7-2.7.3/debian/README.PVER.in
@@ -0,0 +1,95 @@
+
+  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. Therefore, if you need to install 
+a pure python extension, you only need @PVER@. On the other hand, to 
+install a C extension, you need @PVER@-dev.
+
+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.7-2.7.3.orig/debian/PVER-dbg.prerm.in
+++ python2.7-2.7.3/debian/PVER-dbg.prerm.in
@@ -0,0 +1,22 @@
+#! /bin/sh
+
+set -e
+
+case "$1" in
+    remove)
+	rm -f /usr/lib/debug/usr/bin/@PVER@-gdb.py[co]
+	rm -f /usr/lib/debug/usr/lib/lib@PVER@.so.1.0-gdb.py[co]
+        ;;
+    upgrade)
+        ;;
+    deconfigure)
+        ;;
+    failed-upgrade)
+        ;;
+    *)
+        echo "prerm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+#DEBHELPER#
--- python2.7-2.7.3.orig/debian/PVER-minimal.postrm.in
+++ python2.7-2.7.3/debian/PVER-minimal.postrm.in
@@ -0,0 +1,29 @@
+#! /bin/sh -e
+
+if [ "$1" = "remove" ]; then
+
+    (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
+
+    if [ -f /var/lib/python/@PVER@_installed ]; then
+	rm -f /var/lib/python/@PVER@_installed
+	rmdir --ignore-fail-on-non-empty /var/lib/python 2>/dev/null
+    fi
+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
+    rm -f /etc/@PVER@/site.py /etc/@PVER@/sitecustomize.py
+    if [ -d /etc/@PVER@ ]; then
+	rmdir --ignore-fail-on-non-empty /etc/@PVER@ 2>/dev/null
+    fi
+fi
+
+#DEBHELPER#
+
+exit 0
--- python2.7-2.7.3.orig/debian/PVER.pycentral.in
+++ python2.7-2.7.3/debian/PVER.pycentral.in
@@ -0,0 +1,4 @@
+[@PVER@]
+runtime: @PVER@
+interpreter: /usr/bin/@PVER@
+prefix: /usr/lib/@PVER@
--- python2.7-2.7.3.orig/debian/idle-PVER.postinst.in
+++ python2.7-2.7.3/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>.
+#
+
+DIRLIST="/usr/lib/python@VER@/idlelib"
+
+case "$1" in
+    configure|abort-upgrade|abort-remove|abort-deconfigure)
+
+        for i in $DIRLIST ; do
+	    @PVER@ /usr/lib/@PVER@/compileall.py -q $i
+	    if grep -sq '^byte-compile[^#]*optimize' /etc/python/debian_config
+	    then
+		@PVER@ -O /usr/lib/@PVER@/compileall.py -q $i
+	    fi
+	done
+    ;;
+
+    *)
+	echo "postinst called with unknown argument \`$1'" >&2
+	exit 1
+    ;;
+
+esac
+
+#DEBHELPER#
+
+exit 0
--- python2.7-2.7.3.orig/debian/PVER-dbg.README.Debian.in
+++ python2.7-2.7.3/debian/PVER-dbg.README.Debian.in
@@ -0,0 +1,57 @@
+Contents of the @PVER@-dbg package
+-------------------------------------
+
+For debugging python and extension modules, you may want to add the contents
+of /usr/share/doc/@PVER@/gdbinit to your ~/.gdbinit file.
+
+@PVER@-dbg contains two sets of packages:
+
+ - debugging symbols for the standard @PVER@ build. When this package
+   is installed, gdb will automatically load up the debugging symbols
+   from it when debugging @PVER@ or one of the included extension
+   modules.
+
+ - a separate @PVER@-dbg binary, configured --with-pydebug, enabling the
+   additional debugging code to help debug memory management problems.
+
+For the latter, all extension modules have to be recompiled to
+correctly load with an pydebug enabled build.
+
+
+Debian and Ubuntu specific changes to the debug interpreter
+-----------------------------------------------------------
+The python2.4 and python2.5 packages in Ubuntu feisty are modified to
+first look for extension modules under a different name.
+
+  normal build: foo.so
+  debug build:  foo_d.so foo.so
+
+This naming schema allows installation of the extension modules into
+the same path (The naming is directly taken from the Windows builds
+which already uses this naming scheme).
+
+See https://wiki.ubuntu.com/PyDbgBuilds for more information.
+
+
+Using the python-dbg builds
+---------------------------
+
+ * Call the python-dbg or the pythonX.Y-dbg binaries instead of the
+   python or pythonX.Y binaries.
+
+ * Debugging a third party extension requires the availabilty of the
+   extension built for the debug interpreter.  For an extension `foo'
+   make sure that the `python-foo-dbg' package is installed, or else
+   the interpreter falls back to the extension for the normal build.
+   The error on fallback is expected.
+
+ * Properties of the debug build are described in
+   /usr/share/doc/@PVER@/SpecialBuilds.txt.gz.
+   The debug interpreter is built with Py_DEBUG defined.
+
+ * From SpecialBuilds.txt: This is what is generally meant by "a debug
+   build" of Python.  Py_DEBUG implies LLTRACE, Py_REF_DEBUG,
+   Py_TRACE_REFS, and PYMALLOC_DEBUG (if WITH_PYMALLOC is enabled).
+   In addition, C assert()s are enabled (via the C way: by not defining
+   NDEBUG), and some routines do additional sanity checks inside
+   "#ifdef Py_DEBUG" blocks.
--- python2.7-2.7.3.orig/debian/README.maintainers.in
+++ python2.7-2.7.3/debian/README.maintainers.in
@@ -0,0 +1,88 @@
+
+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.
+
+Documentation Tools
+-------------------
+
+If your package ships documentation produced in the Python
+documentation format, you can generate it at build-time by
+build-depending on @PVER@-dev, and you will find the
+templates, tools and scripts in /usr/lib/@PVER@/doc/tools --
+adjust your build scripts accordingly.
+
+
+Makefile.pre.in issues
+----------------------
+
+Python comes with a `universal Unix Makefile for Python extensions' in
+/usr/lib/@PVER@/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/@PVER@
+	$(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/@PVER@/.
+
+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:
+
+  Use dh_python(1) from the debhelper packages to add commands to byte-
+  compile on installation and to remove the byte-compiled files on removal.
+  Your package has to build-depend on: debhelper (>= 4.1.67), python.
+
+  In /usr/share/doc/@PVER@, 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: 2007-10-14
--- python2.7-2.7.3.orig/debian/pyhtml2devhelp.py
+++ python2.7-2.7.3/debian/pyhtml2devhelp.py
@@ -0,0 +1,222 @@
+#! /usr/bin/python
+
+import formatter, htmllib
+import os, sys, re
+
+class PyHTMLParser(htmllib.HTMLParser):
+    pages_to_include = set(('whatsnew/index.html', 'tutorial/index.html', 'using/index.html',
+                            'reference/index.html', 'library/index.html', 'howto/index.html',
+                            'extending/index.html', 'c-api/index.html', 'install/index.html',
+                            'distutils/index.html'))
+
+    def __init__(self, formatter, basedir, fn, indent, parents=set()):
+        htmllib.HTMLParser.__init__(self, formatter)
+        self.basedir = basedir
+        self.dir, self.fn = os.path.split(fn)
+        self.data = ''
+        self.parents = parents
+        self.link = {}
+        self.indent = indent
+        self.last_indent = indent - 1
+        self.sub_indent = 0
+        self.sub_count = 0
+        self.next_link = False
+
+    def process_link(self):
+        new_href = os.path.join(self.dir, self.link['href'])
+        text = self.link['text']
+        indent = self.indent + self.sub_indent
+        if self.last_indent == indent:
+            print '%s</sub>' % ('  ' * self.last_indent)
+            self.sub_count -= 1
+        print '%s<sub link="%s" name="%s">' % ('  ' * indent, new_href, text)
+        self.sub_count += 1
+        self.last_indent = self.indent + self.sub_indent
+
+    def start_li(self, attrs):
+        self.sub_indent += 1
+        self.next_link = True
+
+    def end_li(self):
+        indent = self.indent + self.sub_indent
+        if self.sub_count > 0:
+            print '%s</sub>' % ('  ' * self.last_indent)
+            self.sub_count -= 1
+            self.last_indent -= 1
+        self.sub_indent -= 1
+
+    def start_a(self, attrs):
+        self.link = {}
+        for attr in attrs:
+            self.link[attr[0]] = attr[1]
+        self.data = ''
+        
+    def end_a(self):
+        process = False
+        text = self.data.replace('\t', '').replace('\n', ' ').replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;')
+        self.link['text'] = text
+        # handle a tag without href attribute
+        try:
+            href = self.link['href']
+        except KeyError:
+            return
+
+        abs_href = os.path.join(self.basedir, href)
+        if abs_href in self.parents:
+            return
+        if href.startswith('..') or href.startswith('http:') \
+               or href.startswith('mailto:') or href.startswith('news:'):
+            return
+        if href in ('', 'about.html', 'modindex.html', 'genindex.html', 'glossary.html',
+                    'search.html', 'contents.html', 'download.html', 'bugs.html',
+                    'license.html', 'copyright.html'):
+            return
+
+        if self.link.has_key('class'):
+            if self.link['class'] in ('biglink'):
+                process = True
+            if self.link['class'] in ('reference external'):
+                if self.next_link:
+                    process = True
+                    next_link = False
+
+        if process == True:
+            self.process_link()
+            if href in self.pages_to_include:
+                self.parse_file(os.path.join(self.dir, href))
+
+    def finish(self):
+        if self.sub_count > 0:
+            print '%s</sub>' % ('  ' * self.last_indent)
+
+    def handle_data(self, data):
+        self.data += data
+
+    def parse_file(self, href):
+        # TODO basedir bestimmen
+        parent = os.path.join(self.basedir, self.fn)
+        self.parents.add(parent)
+        parser = PyHTMLParser(formatter.NullFormatter(),
+                              self.basedir, href, self.indent + 1,
+                              self.parents)
+        text = file(self.basedir + '/' + href).read()
+        parser.feed(text)
+        parser.finish()
+        parser.close()
+        if parent in self.parents:
+            self.parents.remove(parent)
+
+class PyIdxHTMLParser(htmllib.HTMLParser):
+    def __init__(self, formatter, basedir, fn, indent):
+        htmllib.HTMLParser.__init__(self, formatter)
+        self.basedir = basedir
+        self.dir, self.fn = os.path.split(fn)
+        self.data = ''
+        self.link = {}
+        self.indent = indent
+        self.active = False
+        self.indented = False
+        self.nolink = False
+        self.header = ''
+        self.last_letter = 'Z'
+        self.last_text = ''
+
+    def process_link(self):
+        new_href = os.path.join(self.dir, self.link['href'])
+        text = self.link['text']
+        if not self.active:
+            return
+        if text.startswith('['):
+            return
+        if self.link.get('rel', None) in ('prev', 'parent', 'next', 'contents', 'index'):
+            return
+        if self.indented:
+            text = self.last_text + ' ' + text
+        else:
+            # Save it in case we need it again
+            self.last_text = re.sub(' \([\w\-\.\s]+\)', '', text)
+        indent = self.indent
+        print '%s<function link="%s" name="%s"/>' % ('  ' * indent, new_href, text)
+
+    def start_dl(self, attrs):
+        if self.last_text:
+            # Looks like we found the second part to a command
+            self.indented = True
+
+    def end_dl(self):
+        self.indented = False
+
+    def start_dt(self, attrs):
+        self.data = ''
+        self.nolink = True
+
+    def end_dt(self):
+        if not self.active:
+            return
+        if self.nolink == True:
+            # Looks like we found the first part to a command
+            self.last_text = re.sub(' \([\w\-\.\s]+\)', '', self.data)
+            self.nolink = False
+
+    def start_h2(self, attrs):
+        for k, v in attrs:
+            if k == 'id':
+                self.header = v
+                if v == '_':
+                    self.active = True
+
+    def start_td(self, attrs):
+        self.indented = False
+        self.last_text = ''
+
+    def start_table(self, attrs):
+        pass
+
+    def end_table(self):
+        if self.header == self.last_letter:
+            self.active = False
+
+    def start_a(self, attrs):
+        self.nolink = False
+        self.link = {}
+        for attr in attrs:
+            self.link[attr[0]] = attr[1]
+        self.data = ''
+        
+    def end_a(self):
+        text = self.data.replace('\t', '').replace('\n', ' ').replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;')
+        self.link['text'] = text
+        # handle a tag without href attribute
+        try:
+            href = self.link['href']
+        except KeyError:
+            return
+        self.process_link()
+
+    def handle_data(self, data):
+        self.data += data
+
+def main():
+    base = sys.argv[1]
+    fn = sys.argv[2]
+    version = sys.argv[3]
+
+    parser = PyHTMLParser(formatter.NullFormatter(), base, fn, indent=0)
+    print '<?xml version="1.0" encoding="iso-8859-1"?>'
+    print '<book title="Python %s Documentation" name="Python" version="%s" link="index.html">' % (version, version)
+    print '<chapters>'
+    parser.parse_file(fn)
+    print '</chapters>'
+
+    print '<functions>'
+
+    fn = 'genindex-all.html'
+    parser = PyIdxHTMLParser(formatter.NullFormatter(), base, fn, indent=1)
+    text = file(base + '/' + fn).read()
+    parser.feed(text)
+    parser.close()
+
+    print '</functions>'
+    print '</book>'
+
+main()
--- python2.7-2.7.3.orig/debian/source.lintian-overrides
+++ python2.7-2.7.3/debian/source.lintian-overrides
@@ -0,0 +1,8 @@
+# this is conditional in the rules file
+python2.7 source: debhelper-script-needs-versioned-build-depends dh_icons (>= 5.0.51~)
+
+# generated during the build
+python2.7 source: quilt-build-dep-but-no-series-file
+
+# doesn't support any newer versions
+python2.7 source: build-depends-on-versioned-berkeley-db
--- python2.7-2.7.3.orig/debian/source.lintian-overrides.in
+++ python2.7-2.7.3/debian/source.lintian-overrides.in
@@ -0,0 +1,8 @@
+# this is conditional in the rules file
+@PVER@ source: debhelper-script-needs-versioned-build-depends dh_icons (>= 5.0.51~)
+
+# generated during the build
+@PVER@ source: quilt-build-dep-but-no-series-file
+
+# doesn't support any newer versions
+@PVER@ source: build-depends-on-versioned-berkeley-db
--- python2.7-2.7.3.orig/debian/PVER-minimal.prerm.in
+++ python2.7-2.7.3/debian/PVER-minimal.prerm.in
@@ -0,0 +1,44 @@
+#! /bin/sh -e
+
+syssite=/usr/lib/@PVER@/site-packages
+localsite=/usr/local/lib/@PVER@/dist-packages
+
+case "$1" in
+    remove)
+	if [ "$DEBIAN_FRONTEND" != noninteractive ]; then
+	    echo "Unlinking and removing bytecode for runtime @PVER@"
+	fi
+	for hook in /usr/share/python/runtime.d/*.rtremove; do
+	    [ -x $hook ] || continue
+	    $hook rtremove @PVER@ || continue
+	done
+	dpkg -L @PVER@-minimal \
+	    | awk '/\.py$/ {print $0"c\n" $0"o"}' \
+	    | xargs rm -f >&2
+
+	if which update-binfmts >/dev/null; then
+	    update-binfmts --package @PVER@ --remove @PVER@ /usr/bin/@PVER@
+	fi
+
+	if [ -h $syssite ]; then
+	    rm -f $syssite
+	fi
+	[ -d $localsite ] && rmdir $localsite 2>/dev/null || true
+	[ -d $(dirname $localsite) ] && rmdir $(dirname $localsite) 2>/dev/null || true
+        ;;
+    upgrade)
+        dpkg -L @PVER@-minimal \
+	    | awk '/\.py$/ {print $0"c\n" $0"o"}' \
+	    | xargs rm -f >&2
+        ;;
+    deconfigure)
+        ;;
+    failed-upgrade)
+        ;;
+    *)
+        echo "prerm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+#DEBHELPER#
--- python2.7-2.7.3.orig/debian/PVER-doc.doc-base.PVER-inst.in
+++ python2.7-2.7.3/debian/PVER-doc.doc-base.PVER-inst.in
@@ -0,0 +1,12 @@
+Document: @PVER@-inst
+Title: Installing Python Modules (v@VER@)
+Author: Greg Ward
+Abstract: This document describes the Python Distribution Utilities
+ (``Distutils'') from the end-user's point-of-view, describing how to
+ extend the capabilities of a standard Python installation by building
+ and installing third-party Python modules and extensions.
+Section: Programming/Python
+
+Format: HTML
+Index: /usr/share/doc/@PVER@/html/install/index.html
+Files: /usr/share/doc/@PVER@/html/install/*.html
--- python2.7-2.7.3.orig/debian/README.Tk
+++ python2.7-2.7.3/debian/README.Tk
@@ -0,0 +1,8 @@
+Tkinter documentation can be found at
+
+    http://www.pythonware.com/library/index.htm
+
+more specific:
+
+    http://www.pythonware.com/library/tkinter/introduction/index.htm
+    http://www.pythonware.com/library/tkinter/an-introduction-to-tkinter.pdf
--- python2.7-2.7.3.orig/debian/PVER.postinst.in
+++ python2.7-2.7.3/debian/PVER.postinst.in
@@ -0,0 +1,37 @@
+#! /bin/sh -e
+
+if [ "$1" = configure ]; then
+    (
+    files=$(dpkg -L @PVER@ | sed -n '/^\/usr\/lib\/@PVER@\/.*\.py$/p')
+	@PVER@ /usr/lib/@PVER@/py_compile.py $files
+	if grep -sq '^byte-compile[^#]*optimize' /etc/python/debian_config; then
+	    @PVER@ -O /usr/lib/@PVER@/py_compile.py $files
+	fi
+    )
+fi
+
+case "$1" in
+    configure|abort-upgrade|abort-remove|abort-deconfigure)
+
+        # 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
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+#DEBHELPER#
+
+exit 0
--- python2.7-2.7.3.orig/debian/idle-PVER.1.in
+++ python2.7-2.7.3/debian/idle-PVER.1.in
@@ -0,0 +1,104 @@
+.TH IDLE 1 "21 September 2004"
+.SH NAME
+\fBIDLE\fP \- An Integrated DeveLopment Environment for Python
+.SH SYNTAX
+.B idle [ \fI-dins\fP ] [ \fI-t title\fP ] [ \fIfile\fP ...]
+.PP
+.B idle [ \fI-dins\fP ] [ \fI-t title\fP ] ( \fI-c cmd\fP | \fI-r file\fP ) [ \fIarg\fP ...]
+.PP
+.B idle [ \fI-dins\fP ] [ \fI-t title\fP ] - [ \fIarg\fP ...]
+.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 \-h
+.PD
+Print this help message and exit.
+.TP
+.B \-n
+.PD
+Run IDLE without a subprocess (see Help/IDLE Help for details).
+.PP
+The following options will override the IDLE 'settings' configuration:
+.TP
+.B \-e
+.PD
+Open an edit window.
+.TP
+.B \-i
+.PD
+Open a shell window.
+.PP
+The following options imply -i and will open a shell:
+.TP
+.B \-c cmd
+.PD
+Run the command in a shell, or
+.TP
+.B \-r file
+.PD
+Run script from file.
+.PP
+.TP
+.B \-d
+.PD
+Enable the debugger.
+.TP
+.B \-s
+.PD
+Run $IDLESTARTUP or $PYTHONSTARTUP before anything else.
+.TP
+.B \-t title
+.PD
+Set title of shell window.
+.PP
+A default edit window will be bypassed when -c, -r, or - are used.
+.PP
+[arg]* and [file]* are passed to the command (-c) or script (-r) in sys.argv[1:].
+.SH EXAMPLES
+.TP
+idle
+.PD
+Open an edit window or shell depending on IDLE's configuration.
+.TP
+idle foo.py foobar.py
+.PD
+Edit the files, also open a shell if configured to start with shell.
+.TP
+idle -est "Baz" foo.py
+.PD
+Run $IDLESTARTUP or $PYTHONSTARTUP, edit foo.py, and open a shell
+window with the title "Baz".
+.TP
+idle -c "import sys; print sys.argv" "foo"
+.PD
+Open a shell window and run the command, passing "-c" in sys.argv[0]
+and "foo" in sys.argv[1].
+.TP
+idle -d -s -r foo.py "Hello World"
+.PD
+Open a shell window, run a startup script, enable the debugger, and
+run foo.py, passing "foo.py" in sys.argv[0] and "Hello World" in
+sys.argv[1].
+.TP
+echo "import sys; print sys.argv" | idle - "foobar"
+.PD
+Open a shell window, run the script piped in, passing '' in sys.argv[0]
+and "foobar" in sys.argv[1].
+.SH SEE ALSO
+python(1).
+.SH AUTHORS
+Various.
--- python2.7-2.7.3.orig/debian/depgraph.py
+++ python2.7-2.7.3/debian/depgraph.py
@@ -0,0 +1,199 @@
+#! /usr/bin/python
+
+# Copyright 2004 Toby Dickenson
+#
+# 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+import sys, getopt, colorsys, imp, md5
+
+class pydepgraphdot:
+
+    def main(self,argv):    
+        opts,args = getopt.getopt(argv,'',['mono'])
+        self.colored = 1
+        for o,v in opts:
+            if o=='--mono':
+                self.colored = 0
+        self.render()
+
+    def fix(self,s):
+        # Convert a module name to a syntactically correct node name
+        return s.replace('.','_')
+    
+    def render(self):
+        p,t = self.get_data()
+
+        # normalise our input data
+        for k,d in p.items():
+            for v in d.keys():
+                if not p.has_key(v):
+                    p[v] = {}
+                    
+        f = self.get_output_file()                    
+                    
+        f.write('digraph G {\n')
+        #f.write('concentrate = true;\n')
+        #f.write('ordering = out;\n')
+        f.write('ranksep=1.0;\n')
+        f.write('node [style=filled,fontname=Helvetica,fontsize=10];\n')
+        allkd = p.items()
+        allkd.sort()
+        for k,d in allkd:
+            tk = t.get(k)
+            if self.use(k,tk):
+                allv = d.keys()
+                allv.sort()
+                for v in allv:
+                    tv = t.get(v)
+                    if self.use(v,tv) and not self.toocommon(v,tv):
+                        f.write('%s -> %s' % ( self.fix(k),self.fix(v) ) )
+                        self.write_attributes(f,self.edge_attributes(k,v))
+                        f.write(';\n')
+                f.write(self.fix(k))
+                self.write_attributes(f,self.node_attributes(k,tk))
+                f.write(';\n')
+        f.write('}\n')
+
+    def write_attributes(self,f,a):
+        if a:
+            f.write(' [')
+            f.write(','.join(a))
+            f.write(']')
+
+    def node_attributes(self,k,type):
+        a = []
+        a.append('label="%s"' % self.label(k))
+        if self.colored:
+            a.append('fillcolor="%s"' % self.color(k,type))
+        else:
+            a.append('fillcolor=white')
+        if self.toocommon(k,type):
+            a.append('peripheries=2')
+        return a
+                
+    def edge_attributes(self,k,v):
+        a = []
+        weight = self.weight(k,v)
+        if weight!=1:
+            a.append('weight=%d' % weight)
+        length = self.alien(k,v)
+        if length:
+            a.append('minlen=%d' % length)
+        return a
+            
+    def get_data(self):
+        t = eval(sys.stdin.read())
+        return t['depgraph'],t['types']
+    
+    def get_output_file(self):
+        return sys.stdout
+
+    def use(self,s,type):
+        # Return true if this module is interesting and should be drawn. Return false
+        # if it should be completely omitted. This is a default policy - please override.
+        if s=='__main__':
+            return 0
+        #if s in ('os','sys','time','__future__','types','re','string'):
+        if s in ('sys'):
+            # nearly all modules use all of these... more or less. They add nothing to
+            # our diagram.
+            return 0
+        if s.startswith('encodings.'):
+            return 0
+        if self.toocommon(s,type):
+            # A module where we dont want to draw references _to_. Dot doesnt handle these
+            # well, so it is probably best to not draw them at all.
+            return 0
+        return 1
+
+    def toocommon(self,s,type):
+        # Return true if references to this module are uninteresting. Such references
+        # do not get drawn. This is a default policy - please override.
+        #
+        if s=='__main__':
+            # references *to* __main__ are never interesting. omitting them means
+            # that main floats to the top of the page
+            return 1
+        #if type==imp.PKG_DIRECTORY:
+        #    # dont draw references to packages.
+        #    return 1
+        return 0
+        
+    def weight(self,a,b):
+        # Return the weight of the dependency from a to b. Higher weights
+        # usually have shorter straighter edges. Return 1 if it has normal weight.
+        # A value of 4 is usually good for ensuring that a related pair of modules 
+        # are drawn next to each other. This is a default policy - please override.
+        #
+        if b.split('.')[-1].startswith('_'):
+            # A module that starts with an underscore. You need a special reason to
+            # import these (for example random imports _random), so draw them close
+            # together
+            return 4
+        return 1
+    
+    def alien(self,a,b):
+        # Return non-zero if references to this module are strange, and should be drawn
+        # extra-long. the value defines the length, in rank. This is also good for putting some
+        # vertical space between seperate subsystems. This is a default policy - please override.
+        #
+        return 0
+
+    def label(self,s):
+        # Convert a module name to a formatted node label. This is a default policy - please override.
+        #
+        return '\\.\\n'.join(s.split('.'))
+
+    def color(self,s,type):
+        # Return the node color for this module name. This is a default policy - please override.
+        #
+        # Calculate a color systematically based on the hash of the module name. Modules in the
+        # same package have the same color. Unpackaged modules are grey
+        t = self.normalise_module_name_for_hash_coloring(s,type)
+        return self.color_from_name(t)
+        
+    def normalise_module_name_for_hash_coloring(self,s,type):
+        if type==imp.PKG_DIRECTORY:
+            return s
+        else:
+            i = s.rfind('.')
+            if i<0:
+                return ''
+            else:
+                return s[:i]
+        
+    def color_from_name(self,name):
+        n = md5.md5(name).digest()
+        hf = float(ord(n[0])+ord(n[1])*0xff)/0xffff
+        sf = float(ord(n[2]))/0xff
+        vf = float(ord(n[3]))/0xff
+        r,g,b = colorsys.hsv_to_rgb(hf, 0.3+0.6*sf, 0.8+0.2*vf)
+        return '#%02x%02x%02x' % (r*256,g*256,b*256)
+
+
+def main():
+    pydepgraphdot().main(sys.argv[1:])
+
+if __name__=='__main__':
+    main()
+
+
+
--- python2.7-2.7.3.orig/debian/libpython.symbols.in
+++ python2.7-2.7.3/debian/libpython.symbols.in
@@ -0,0 +1,1263 @@
+ PyAST_Check@Base @VER@
+ PyAST_Compile@Base @VER@
+ PyAST_FromNode@Base @VER@
+ PyAST_mod2obj@Base @VER@
+ PyAST_obj2mod@Base @VER@
+ PyArena_AddPyObject@Base @VER@
+ PyArena_Free@Base @VER@
+ PyArena_Malloc@Base @VER@
+ PyArena_New@Base @VER@
+ PyArg_Parse@Base @VER@
+ PyArg_ParseTuple@Base @VER@
+ PyArg_ParseTupleAndKeywords@Base @VER@
+ PyArg_UnpackTuple@Base @VER@
+ PyArg_VaParse@Base @VER@
+ PyArg_VaParseTupleAndKeywords@Base @VER@
+ PyBaseObject_Type@Base @VER@
+ PyBaseString_Type@Base @VER@
+ PyBool_FromLong@Base @VER@
+ PyBool_Type@Base @VER@
+ PyBuffer_FillContiguousStrides@Base @VER@
+ PyBuffer_FillInfo@Base @VER@
+ PyBuffer_FromContiguous@Base @VER@
+ PyBuffer_FromMemory@Base @VER@
+ PyBuffer_FromObject@Base @VER@
+ PyBuffer_FromReadWriteMemory@Base @VER@
+ PyBuffer_FromReadWriteObject@Base @VER@
+ PyBuffer_GetPointer@Base @VER@
+ PyBuffer_IsContiguous@Base @VER@
+ PyBuffer_New@Base @VER@
+ PyBuffer_Release@Base @VER@
+ PyBuffer_ToContiguous@Base @VER@
+ PyBuffer_Type@Base @VER@
+ PyByteArrayIter_Type@Base @VER@
+ PyByteArray_AsString@Base @VER@
+ PyByteArray_Concat@Base @VER@
+ PyByteArray_Fini@Base @VER@
+ PyByteArray_FromObject@Base @VER@
+ PyByteArray_FromStringAndSize@Base @VER@
+ PyByteArray_Init@Base @VER@
+ PyByteArray_Resize@Base @VER@
+ PyByteArray_Size@Base @VER@
+ PyByteArray_Type@Base @VER@
+ PyCFunction_Call@Base @VER@
+ PyCFunction_ClearFreeList@Base @VER@
+ PyCFunction_Fini@Base @VER@
+ PyCFunction_GetFlags@Base @VER@
+ PyCFunction_GetFunction@Base @VER@
+ PyCFunction_GetSelf@Base @VER@
+ PyCFunction_New@Base @VER@
+ PyCFunction_NewEx@Base @VER@
+ PyCFunction_Type@Base @VER@
+ PyCObject_AsVoidPtr@Base @VER@
+ PyCObject_FromVoidPtr@Base @VER@
+ PyCObject_FromVoidPtrAndDesc@Base @VER@
+ PyCObject_GetDesc@Base @VER@
+ PyCObject_Import@Base @VER@
+ PyCObject_SetVoidPtr@Base @VER@
+ PyCObject_Type@Base @VER@
+ PyCallIter_New@Base @VER@
+ PyCallIter_Type@Base @VER@
+ PyCallable_Check@Base @VER@
+ PyCapsule_GetContext@Base @VER@
+ PyCapsule_GetDestructor@Base @VER@
+ PyCapsule_GetName@Base @VER@
+ PyCapsule_GetPointer@Base @VER@
+ PyCapsule_Import@Base @VER@
+ PyCapsule_IsValid@Base @VER@
+ PyCapsule_New@Base @VER@
+ PyCapsule_SetContext@Base @VER@
+ PyCapsule_SetDestructor@Base @VER@
+ PyCapsule_SetName@Base @VER@
+ PyCapsule_SetPointer@Base @VER@
+ PyCapsule_Type@Base @VER@
+ PyCell_Get@Base @VER@
+ PyCell_New@Base @VER@
+ PyCell_Set@Base @VER@
+ PyCell_Type@Base @VER@
+ PyClassMethod_New@Base @VER@
+ PyClassMethod_Type@Base @VER@
+ PyClass_IsSubclass@Base @VER@
+ PyClass_New@Base @VER@
+ PyClass_Type@Base @VER@
+ PyCode_Addr2Line@Base @VER@
+ PyCode_New@Base @VER@
+ PyCode_NewEmpty@Base @VER@
+ PyCode_Optimize@Base @VER@
+ PyCode_Type@Base @VER@
+ PyCodec_BackslashReplaceErrors@Base @VER@
+ PyCodec_Decode@Base @VER@
+ PyCodec_Decoder@Base @VER@
+ PyCodec_Encode@Base @VER@
+ PyCodec_Encoder@Base @VER@
+ PyCodec_IgnoreErrors@Base @VER@
+ PyCodec_IncrementalDecoder@Base @VER@
+ PyCodec_IncrementalEncoder@Base @VER@
+ PyCodec_LookupError@Base @VER@
+ PyCodec_Register@Base @VER@
+ PyCodec_RegisterError@Base @VER@
+ PyCodec_ReplaceErrors@Base @VER@
+ PyCodec_StreamReader@Base @VER@
+ PyCodec_StreamWriter@Base @VER@
+ PyCodec_StrictErrors@Base @VER@
+ PyCodec_XMLCharRefReplaceErrors@Base @VER@
+ PyComplex_AsCComplex@Base @VER@
+ PyComplex_FromCComplex@Base @VER@
+ PyComplex_FromDoubles@Base @VER@
+ PyComplex_ImagAsDouble@Base @VER@
+ PyComplex_RealAsDouble@Base @VER@
+ PyComplex_Type@Base @VER@
+ PyDescr_NewClassMethod@Base @VER@
+ PyDescr_NewGetSet@Base @VER@
+ PyDescr_NewMember@Base @VER@
+ PyDescr_NewMethod@Base @VER@
+ PyDescr_NewWrapper@Base @VER@
+ PyDictItems_Type@Base @VER@
+ PyDictIterItem_Type@Base @VER@
+ PyDictIterKey_Type@Base @VER@
+ PyDictIterValue_Type@Base @VER@
+ PyDictKeys_Type@Base @VER@
+ PyDictProxy_New@Base @VER@
+ PyDictProxy_Type@Base @VER@
+ PyDictValues_Type@Base @VER@
+ PyDict_Clear@Base @VER@
+ PyDict_Contains@Base @VER@
+ PyDict_Copy@Base @VER@
+ PyDict_DelItem@Base @VER@
+ PyDict_DelItemString@Base @VER@
+ PyDict_Fini@Base @VER@
+ PyDict_GetItem@Base @VER@
+ PyDict_GetItemString@Base @VER@
+ PyDict_Items@Base @VER@
+ PyDict_Keys@Base @VER@
+ PyDict_Merge@Base @VER@
+ PyDict_MergeFromSeq2@Base @VER@
+ PyDict_New@Base @VER@
+ PyDict_Next@Base @VER@
+ PyDict_SetItem@Base @VER@
+ PyDict_SetItemString@Base @VER@
+ PyDict_Size@Base @VER@
+ PyDict_Type@Base @VER@
+ PyDict_Update@Base @VER@
+ PyDict_Values@Base @VER@
+ PyEllipsis_Type@Base @VER@
+ PyEnum_Type@Base @VER@
+ PyErr_BadArgument@Base @VER@
+ PyErr_BadInternalCall@Base @VER@
+ PyErr_CheckSignals@Base @VER@
+ PyErr_Clear@Base @VER@
+ PyErr_Display@Base @VER@
+ PyErr_ExceptionMatches@Base @VER@
+ PyErr_Fetch@Base @VER@
+ PyErr_Format@Base @VER@
+ PyErr_GivenExceptionMatches@Base @VER@
+ PyErr_NewException@Base @VER@
+ PyErr_NewExceptionWithDoc@Base @VER@
+ PyErr_NoMemory@Base @VER@
+ PyErr_NormalizeException@Base @VER@
+ PyErr_Occurred@Base @VER@
+ PyErr_Print@Base @VER@
+ PyErr_PrintEx@Base @VER@
+ PyErr_ProgramText@Base @VER@
+ PyErr_Restore@Base @VER@
+ PyErr_SetFromErrno@Base @VER@
+ PyErr_SetFromErrnoWithFilename@Base @VER@
+ PyErr_SetFromErrnoWithFilenameObject@Base @VER@
+ PyErr_SetInterrupt@Base @VER@
+ PyErr_SetNone@Base @VER@
+ PyErr_SetObject@Base @VER@
+ PyErr_SetString@Base @VER@
+ PyErr_SyntaxLocation@Base @VER@
+ PyErr_Warn@Base @VER@
+ PyErr_WarnEx@Base @VER@
+ PyErr_WarnExplicit@Base @VER@
+ PyErr_WriteUnraisable@Base @VER@
+ PyEval_AcquireLock@Base @VER@
+ PyEval_AcquireThread@Base @VER@
+ PyEval_CallFunction@Base @VER@
+ PyEval_CallMethod@Base @VER@
+ PyEval_CallObjectWithKeywords@Base @VER@
+ PyEval_EvalCode@Base @VER@
+ PyEval_EvalCodeEx@Base @VER@
+ PyEval_EvalFrame@Base @VER@
+ PyEval_EvalFrameEx@Base @VER@
+ PyEval_GetBuiltins@Base @VER@
+ PyEval_GetCallStats@Base @VER@
+ PyEval_GetFrame@Base @VER@
+ PyEval_GetFuncDesc@Base @VER@
+ PyEval_GetFuncName@Base @VER@
+ PyEval_GetGlobals@Base @VER@
+ PyEval_GetLocals@Base @VER@
+ PyEval_GetRestricted@Base @VER@
+ PyEval_InitThreads@Base @VER@
+ PyEval_MergeCompilerFlags@Base @VER@
+ PyEval_ReInitThreads@Base @VER@
+ PyEval_ReleaseLock@Base @VER@
+ PyEval_ReleaseThread@Base @VER@
+ PyEval_RestoreThread@Base @VER@
+ PyEval_SaveThread@Base @VER@
+ PyEval_SetProfile@Base @VER@
+ PyEval_SetTrace@Base @VER@
+ PyEval_ThreadsInitialized@Base @VER@
+ PyExc_ArithmeticError@Base @VER@
+ PyExc_AssertionError@Base @VER@
+ PyExc_AttributeError@Base @VER@
+ PyExc_BaseException@Base @VER@
+ PyExc_BufferError@Base @VER@
+ PyExc_BytesWarning@Base @VER@
+ PyExc_DeprecationWarning@Base @VER@
+ PyExc_EOFError@Base @VER@
+ PyExc_EnvironmentError@Base @VER@
+ PyExc_Exception@Base @VER@
+ PyExc_FloatingPointError@Base @VER@
+ PyExc_FutureWarning@Base @VER@
+ PyExc_GeneratorExit@Base @VER@
+ PyExc_IOError@Base @VER@
+ PyExc_ImportError@Base @VER@
+ PyExc_ImportWarning@Base @VER@
+ PyExc_IndentationError@Base @VER@
+ PyExc_IndexError@Base @VER@
+ PyExc_KeyError@Base @VER@
+ PyExc_KeyboardInterrupt@Base @VER@
+ PyExc_LookupError@Base @VER@
+ PyExc_MemoryError@Base @VER@
+ PyExc_MemoryErrorInst@Base @VER@
+ PyExc_NameError@Base @VER@
+ PyExc_NotImplementedError@Base @VER@
+ PyExc_OSError@Base @VER@
+ PyExc_OverflowError@Base @VER@
+ PyExc_PendingDeprecationWarning@Base @VER@
+ PyExc_RecursionErrorInst@Base @VER@
+ PyExc_ReferenceError@Base @VER@
+ PyExc_RuntimeError@Base @VER@
+ PyExc_RuntimeWarning@Base @VER@
+ PyExc_StandardError@Base @VER@
+ PyExc_StopIteration@Base @VER@
+ PyExc_SyntaxError@Base @VER@
+ PyExc_SyntaxWarning@Base @VER@
+ PyExc_SystemError@Base @VER@
+ PyExc_SystemExit@Base @VER@
+ PyExc_TabError@Base @VER@
+ PyExc_TypeError@Base @VER@
+ PyExc_UnboundLocalError@Base @VER@
+ PyExc_UnicodeDecodeError@Base @VER@
+ PyExc_UnicodeEncodeError@Base @VER@
+ PyExc_UnicodeError@Base @VER@
+ PyExc_UnicodeTranslateError@Base @VER@
+ PyExc_UnicodeWarning@Base @VER@
+ PyExc_UserWarning@Base @VER@
+ PyExc_ValueError@Base @VER@
+ PyExc_Warning@Base @VER@
+ PyExc_ZeroDivisionError@Base @VER@
+ PyFile_AsFile@Base @VER@
+ PyFile_DecUseCount@Base @VER@
+ PyFile_FromFile@Base @VER@
+ PyFile_FromString@Base @VER@
+ PyFile_GetLine@Base @VER@
+ PyFile_IncUseCount@Base @VER@
+ PyFile_Name@Base @VER@
+ PyFile_SetBufSize@Base @VER@
+ PyFile_SetEncoding@Base @VER@
+ PyFile_SetEncodingAndErrors@Base @VER@
+ PyFile_SoftSpace@Base @VER@
+ PyFile_Type@Base @VER@
+ PyFile_WriteObject@Base @VER@
+ PyFile_WriteString@Base @VER@
+ PyFloat_AsDouble@Base @VER@
+ PyFloat_AsReprString@Base @VER@
+ PyFloat_AsString@Base @VER@
+ PyFloat_ClearFreeList@Base @VER@
+ PyFloat_Fini@Base @VER@
+ PyFloat_FromDouble@Base @VER@
+ PyFloat_FromString@Base @VER@
+ PyFloat_GetInfo@Base @VER@
+ PyFloat_GetMax@Base @VER@
+ PyFloat_GetMin@Base @VER@
+ PyFloat_Type@Base @VER@
+ PyFrame_BlockPop@Base @VER@
+ PyFrame_BlockSetup@Base @VER@
+ PyFrame_ClearFreeList@Base @VER@
+ PyFrame_FastToLocals@Base @VER@
+ PyFrame_Fini@Base @VER@
+ PyFrame_GetLineNumber@Base @VER@
+ PyFrame_LocalsToFast@Base @VER@
+ PyFrame_New@Base @VER@
+ PyFrame_Type@Base @VER@
+ PyFrozenSet_New@Base @VER@
+ PyFrozenSet_Type@Base @VER@
+ PyFunction_GetClosure@Base @VER@
+ PyFunction_GetCode@Base @VER@
+ PyFunction_GetDefaults@Base @VER@
+ PyFunction_GetGlobals@Base @VER@
+ PyFunction_GetModule@Base @VER@
+ PyFunction_New@Base @VER@
+ PyFunction_SetClosure@Base @VER@
+ PyFunction_SetDefaults@Base @VER@
+ PyFunction_Type@Base @VER@
+ PyFuture_FromAST@Base @VER@
+ PyGC_Collect@Base @VER@
+ PyGILState_Ensure@Base @VER@
+ PyGILState_GetThisThreadState@Base @VER@
+ PyGILState_Release@Base @VER@
+ PyGen_NeedsFinalizing@Base @VER@
+ PyGen_New@Base @VER@
+ PyGen_Type@Base @VER@
+ PyGetSetDescr_Type@Base @VER@
+ PyGrammar_AddAccelerators@Base @VER@
+ PyGrammar_FindDFA@Base @VER@
+ PyGrammar_LabelRepr@Base @VER@
+ PyGrammar_RemoveAccelerators@Base @VER@
+ PyImport_AddModule@Base @VER@
+ PyImport_AppendInittab@Base @VER@
+ PyImport_Cleanup@Base @VER@
+ PyImport_ExecCodeModule@Base @VER@
+ PyImport_ExecCodeModuleEx@Base @VER@
+ PyImport_ExtendInittab@Base @VER@
+ PyImport_FrozenModules@Base @VER@
+ PyImport_GetImporter@Base @VER@
+ PyImport_GetMagicNumber@Base @VER@
+ PyImport_GetModuleDict@Base @VER@
+ PyImport_Import@Base @VER@
+ PyImport_ImportFrozenModule@Base @VER@
+ PyImport_ImportModule@Base @VER@
+ PyImport_ImportModuleLevel@Base @VER@
+ PyImport_ImportModuleNoBlock@Base @VER@
+ PyImport_Inittab@Base @VER@
+ PyImport_ReloadModule@Base @VER@
+ PyInstance_New@Base @VER@
+ PyInstance_NewRaw@Base @VER@
+ PyInstance_Type@Base @VER@
+ PyInt_AsLong@Base @VER@
+ PyInt_AsSsize_t@Base @VER@
+ PyInt_AsUnsignedLongLongMask@Base @VER@
+ PyInt_AsUnsignedLongMask@Base @VER@
+ PyInt_ClearFreeList@Base @VER@
+ PyInt_Fini@Base @VER@
+ PyInt_FromLong@Base @VER@
+ PyInt_FromSize_t@Base @VER@
+ PyInt_FromSsize_t@Base @VER@
+ PyInt_FromString@Base @VER@
+ PyInt_FromUnicode@Base @VER@
+ PyInt_GetMax@Base @VER@
+ PyInt_Type@Base @VER@
+ PyInterpreterState_Clear@Base @VER@
+ PyInterpreterState_Delete@Base @VER@
+ PyInterpreterState_Head@Base @VER@
+ PyInterpreterState_New@Base @VER@
+ PyInterpreterState_Next@Base @VER@
+ PyInterpreterState_ThreadHead@Base @VER@
+ PyIter_Next@Base @VER@
+ PyListIter_Type@Base @VER@
+ PyListRevIter_Type@Base @VER@
+ PyList_Append@Base @VER@
+ PyList_AsTuple@Base @VER@
+ PyList_Fini@Base @VER@
+ PyList_GetItem@Base @VER@
+ PyList_GetSlice@Base @VER@
+ PyList_Insert@Base @VER@
+ PyList_New@Base @VER@
+ PyList_Reverse@Base @VER@
+ PyList_SetItem@Base @VER@
+ PyList_SetSlice@Base @VER@
+ PyList_Size@Base @VER@
+ PyList_Sort@Base @VER@
+ PyList_Type@Base @VER@
+ PyLong_AsDouble@Base @VER@
+ PyLong_AsLong@Base @VER@
+ PyLong_AsLongAndOverflow@Base @VER@
+ PyLong_AsLongLong@Base @VER@
+ PyLong_AsLongLongAndOverflow@Base @VER@
+ PyLong_AsSsize_t@Base @VER@
+ PyLong_AsUnsignedLong@Base @VER@
+ PyLong_AsUnsignedLongLong@Base @VER@
+ PyLong_AsUnsignedLongLongMask@Base @VER@
+ PyLong_AsUnsignedLongMask@Base @VER@
+ PyLong_AsVoidPtr@Base @VER@
+ PyLong_FromDouble@Base @VER@
+ PyLong_FromLong@Base @VER@
+ PyLong_FromLongLong@Base @VER@
+ PyLong_FromSize_t@Base @VER@
+ PyLong_FromSsize_t@Base @VER@
+ PyLong_FromString@Base @VER@
+ PyLong_FromUnicode@Base @VER@
+ PyLong_FromUnsignedLong@Base @VER@
+ PyLong_FromUnsignedLongLong@Base @VER@
+ PyLong_FromVoidPtr@Base @VER@
+ PyLong_GetInfo@Base @VER@
+ PyLong_Type@Base @VER@
+ PyMapping_Check@Base @VER@
+ PyMapping_GetItemString@Base @VER@
+ PyMapping_HasKey@Base @VER@
+ PyMapping_HasKeyString@Base @VER@
+ PyMapping_Length@Base @VER@
+ PyMapping_SetItemString@Base @VER@
+ PyMapping_Size@Base @VER@
+ PyMarshal_Init@Base @VER@
+ PyMarshal_ReadLastObjectFromFile@Base @VER@
+ PyMarshal_ReadLongFromFile@Base @VER@
+ PyMarshal_ReadObjectFromFile@Base @VER@
+ PyMarshal_ReadObjectFromString@Base @VER@
+ PyMarshal_ReadShortFromFile@Base @VER@
+ PyMarshal_WriteLongToFile@Base @VER@
+ PyMarshal_WriteObjectToFile@Base @VER@
+ PyMarshal_WriteObjectToString@Base @VER@
+ PyMem_Free@Base @VER@
+ PyMem_Malloc@Base @VER@
+ PyMem_Realloc@Base @VER@
+ PyMemberDescr_Type@Base @VER@
+ PyMember_Get@Base @VER@
+ PyMember_GetOne@Base @VER@
+ PyMember_Set@Base @VER@
+ PyMember_SetOne@Base @VER@
+ PyMemoryView_FromBuffer@Base @VER@
+ PyMemoryView_FromObject@Base @VER@
+ PyMemoryView_GetContiguous@Base @VER@
+ PyMemoryView_Type@Base @VER@
+ PyMethod_Class@Base @VER@
+ PyMethod_ClearFreeList@Base @VER@
+ PyMethod_Fini@Base @VER@
+ PyMethod_Function@Base @VER@
+ PyMethod_New@Base @VER@
+ PyMethod_Self@Base @VER@
+ PyMethod_Type@Base @VER@
+ PyModule_AddIntConstant@Base @VER@
+ PyModule_AddObject@Base @VER@
+ PyModule_AddStringConstant@Base @VER@
+ PyModule_GetDict@Base @VER@
+ PyModule_GetFilename@Base @VER@
+ PyModule_GetName@Base @VER@
+ PyModule_GetWarningsModule@Base @VER@
+ PyModule_New@Base @VER@
+ PyModule_Type@Base @VER@
+ PyNode_AddChild@Base @VER@
+ PyNode_Compile@Base @VER@
+ PyNode_Free@Base @VER@
+ PyNode_ListTree@Base @VER@
+ PyNode_New@Base @VER@
+ PyNullImporter_Type@Base @VER@
+ PyNumber_Absolute@Base @VER@
+ PyNumber_Add@Base @VER@
+ PyNumber_And@Base @VER@
+ PyNumber_AsSsize_t@Base @VER@
+ PyNumber_Check@Base @VER@
+ PyNumber_Coerce@Base @VER@
+ PyNumber_CoerceEx@Base @VER@
+ PyNumber_Divide@Base @VER@
+ PyNumber_Divmod@Base @VER@
+ PyNumber_Float@Base @VER@
+ PyNumber_FloorDivide@Base @VER@
+ PyNumber_InPlaceAdd@Base @VER@
+ PyNumber_InPlaceAnd@Base @VER@
+ PyNumber_InPlaceDivide@Base @VER@
+ PyNumber_InPlaceFloorDivide@Base @VER@
+ PyNumber_InPlaceLshift@Base @VER@
+ PyNumber_InPlaceMultiply@Base @VER@
+ PyNumber_InPlaceOr@Base @VER@
+ PyNumber_InPlacePower@Base @VER@
+ PyNumber_InPlaceRemainder@Base @VER@
+ PyNumber_InPlaceRshift@Base @VER@
+ PyNumber_InPlaceSubtract@Base @VER@
+ PyNumber_InPlaceTrueDivide@Base @VER@
+ PyNumber_InPlaceXor@Base @VER@
+ PyNumber_Index@Base @VER@
+ PyNumber_Int@Base @VER@
+ PyNumber_Invert@Base @VER@
+ PyNumber_Long@Base @VER@
+ PyNumber_Lshift@Base @VER@
+ PyNumber_Multiply@Base @VER@
+ PyNumber_Negative@Base @VER@
+ PyNumber_Or@Base @VER@
+ PyNumber_Positive@Base @VER@
+ PyNumber_Power@Base @VER@
+ PyNumber_Remainder@Base @VER@
+ PyNumber_Rshift@Base @VER@
+ PyNumber_Subtract@Base @VER@
+ PyNumber_ToBase@Base @VER@
+ PyNumber_TrueDivide@Base @VER@
+ PyNumber_Xor@Base @VER@
+ PyOS_AfterFork@Base @VER@
+ PyOS_FiniInterrupts@Base @VER@
+ PyOS_InitInterrupts@Base @VER@
+ PyOS_InputHook@Base @VER@
+ PyOS_InterruptOccurred@Base @VER@
+ PyOS_Readline@Base @VER@
+ PyOS_ReadlineFunctionPointer@Base @VER@
+ PyOS_StdioReadline@Base @VER@
+ PyOS_ascii_atof@Base @VER@
+ PyOS_ascii_formatd@Base @VER@
+ PyOS_ascii_strtod@Base @VER@
+ PyOS_double_to_string@Base @VER@
+ PyOS_getsig@Base @VER@
+ PyOS_mystricmp@Base @VER@
+ PyOS_mystrnicmp@Base @VER@
+ PyOS_setsig@Base @VER@
+ PyOS_snprintf@Base @VER@
+ PyOS_string_to_double@Base @VER@
+ PyOS_strtol@Base @VER@
+ PyOS_strtoul@Base @VER@
+ PyOS_vsnprintf@Base @VER@
+ PyObject_AsCharBuffer@Base @VER@
+ PyObject_AsFileDescriptor@Base @VER@
+ PyObject_AsReadBuffer@Base @VER@
+ PyObject_AsWriteBuffer@Base @VER@
+ PyObject_Call@Base @VER@
+ PyObject_CallFunction@Base @VER@
+ PyObject_CallFunctionObjArgs@Base @VER@
+ PyObject_CallMethod@Base @VER@
+ PyObject_CallMethodObjArgs@Base @VER@
+ PyObject_CallObject@Base @VER@
+ PyObject_CheckReadBuffer@Base @VER@
+ PyObject_ClearWeakRefs@Base @VER@
+ PyObject_Cmp@Base @VER@
+ PyObject_Compare@Base @VER@
+ PyObject_CopyData@Base @VER@
+ PyObject_DelItem@Base @VER@
+ PyObject_DelItemString@Base @VER@
+ PyObject_Dir@Base @VER@
+ PyObject_Format@Base @VER@
+ PyObject_Free@Base @VER@
+ PyObject_GC_Del@Base @VER@
+ PyObject_GC_Track@Base @VER@
+ PyObject_GC_UnTrack@Base @VER@
+ PyObject_GenericGetAttr@Base @VER@
+ PyObject_GenericSetAttr@Base @VER@
+ PyObject_GetAttr@Base @VER@
+ PyObject_GetAttrString@Base @VER@
+ PyObject_GetBuffer@Base @VER@
+ PyObject_GetItem@Base @VER@
+ PyObject_GetIter@Base @VER@
+ PyObject_HasAttr@Base @VER@
+ PyObject_HasAttrString@Base @VER@
+ PyObject_Hash@Base @VER@
+ PyObject_HashNotImplemented@Base @VER@
+ PyObject_Init@Base @VER@
+ PyObject_InitVar@Base @VER@
+ PyObject_IsInstance@Base @VER@
+ PyObject_IsSubclass@Base @VER@
+ PyObject_IsTrue@Base @VER@
+ PyObject_Length@Base @VER@
+ PyObject_Malloc@Base @VER@
+ PyObject_Not@Base @VER@
+ PyObject_Print@Base @VER@
+ PyObject_Realloc@Base @VER@
+ PyObject_Repr@Base @VER@
+ PyObject_RichCompare@Base @VER@
+ PyObject_RichCompareBool@Base @VER@
+ PyObject_SelfIter@Base @VER@
+ PyObject_SetAttr@Base @VER@
+ PyObject_SetAttrString@Base @VER@
+ PyObject_SetItem@Base @VER@
+ PyObject_Size@Base @VER@
+ PyObject_Str@Base @VER@
+ PyObject_Type@Base @VER@
+ PyObject_Unicode@Base @VER@
+ PyParser_ASTFromFile@Base @VER@
+ PyParser_ASTFromString@Base @VER@
+ PyParser_AddToken@Base @VER@
+ PyParser_Delete@Base @VER@
+ PyParser_New@Base @VER@
+ PyParser_ParseFile@Base @VER@
+ PyParser_ParseFileFlags@Base @VER@
+ PyParser_ParseFileFlagsEx@Base @VER@
+ PyParser_ParseString@Base @VER@
+ PyParser_ParseStringFlags@Base @VER@
+ PyParser_ParseStringFlagsFilename@Base @VER@
+ PyParser_ParseStringFlagsFilenameEx@Base @VER@
+ PyParser_SetError@Base @VER@
+ PyParser_SimpleParseFile@Base @VER@
+ PyParser_SimpleParseFileFlags@Base @VER@
+ PyParser_SimpleParseString@Base @VER@
+ PyParser_SimpleParseStringFilename@Base @VER@
+ PyParser_SimpleParseStringFlags@Base @VER@
+ PyParser_SimpleParseStringFlagsFilename@Base @VER@
+ PyProperty_Type@Base @VER@
+ PyRange_Type@Base @VER@
+ PyReversed_Type@Base @VER@
+ PyRun_AnyFile@Base @VER@
+ PyRun_AnyFileEx@Base @VER@
+ PyRun_AnyFileExFlags@Base @VER@
+ PyRun_AnyFileFlags@Base @VER@
+ PyRun_File@Base @VER@
+ PyRun_FileEx@Base @VER@
+ PyRun_FileExFlags@Base @VER@
+ PyRun_FileFlags@Base @VER@
+ PyRun_InteractiveLoop@Base @VER@
+ PyRun_InteractiveLoopFlags@Base @VER@
+ PyRun_InteractiveOne@Base @VER@
+ PyRun_InteractiveOneFlags@Base @VER@
+ PyRun_SimpleFile@Base @VER@
+ PyRun_SimpleFileEx@Base @VER@
+ PyRun_SimpleFileExFlags@Base @VER@
+ PyRun_SimpleString@Base @VER@
+ PyRun_SimpleStringFlags@Base @VER@
+ PyRun_String@Base @VER@
+ PyRun_StringFlags@Base @VER@
+ PySTEntry_Type@Base @VER@
+ PyST_GetScope@Base @VER@
+ PySeqIter_New@Base @VER@
+ PySeqIter_Type@Base @VER@
+ PySequence_Check@Base @VER@
+ PySequence_Concat@Base @VER@
+ PySequence_Contains@Base @VER@
+ PySequence_Count@Base @VER@
+ PySequence_DelItem@Base @VER@
+ PySequence_DelSlice@Base @VER@
+ PySequence_Fast@Base @VER@
+ PySequence_GetItem@Base @VER@
+ PySequence_GetSlice@Base @VER@
+ PySequence_In@Base @VER@
+ PySequence_InPlaceConcat@Base @VER@
+ PySequence_InPlaceRepeat@Base @VER@
+ PySequence_Index@Base @VER@
+ PySequence_Length@Base @VER@
+ PySequence_List@Base @VER@
+ PySequence_Repeat@Base @VER@
+ PySequence_SetItem@Base @VER@
+ PySequence_SetSlice@Base @VER@
+ PySequence_Size@Base @VER@
+ PySequence_Tuple@Base @VER@
+ PySet_Add@Base @VER@
+ PySet_Clear@Base @VER@
+ PySet_Contains@Base @VER@
+ PySet_Discard@Base @VER@
+ PySet_Fini@Base @VER@
+ PySet_New@Base @VER@
+ PySet_Pop@Base @VER@
+ PySet_Size@Base @VER@
+ PySet_Type@Base @VER@
+ PySignal_SetWakeupFd@Base @VER@
+ PySlice_GetIndices@Base @VER@
+ PySlice_GetIndicesEx@Base @VER@
+ PySlice_New@Base @VER@
+ PySlice_Type@Base @VER@
+ PyStaticMethod_New@Base @VER@
+ PyStaticMethod_Type@Base @VER@
+ PyString_AsDecodedObject@Base @VER@
+ PyString_AsDecodedString@Base @VER@
+ PyString_AsEncodedObject@Base @VER@
+ PyString_AsEncodedString@Base @VER@
+ PyString_AsString@Base @VER@
+ PyString_AsStringAndSize@Base @VER@
+ PyString_Concat@Base @VER@
+ PyString_ConcatAndDel@Base @VER@
+ PyString_Decode@Base @VER@
+ PyString_DecodeEscape@Base @VER@
+ PyString_Encode@Base @VER@
+ PyString_Fini@Base @VER@
+ PyString_Format@Base @VER@
+ PyString_FromFormat@Base @VER@
+ PyString_FromFormatV@Base @VER@
+ PyString_FromString@Base @VER@
+ PyString_FromStringAndSize@Base @VER@
+ PyString_InternFromString@Base @VER@
+ PyString_InternImmortal@Base @VER@
+ PyString_InternInPlace@Base @VER@
+ PyString_Repr@Base @VER@
+ PyString_Size@Base @VER@
+ PyString_Type@Base @VER@
+ PyStructSequence_InitType@Base @VER@
+ PyStructSequence_New@Base @VER@
+ PyStructSequence_UnnamedField@Base @VER@
+ PySuper_Type@Base @VER@
+ PySymtable_Build@Base @VER@
+ PySymtable_Free@Base @VER@
+ PySymtable_Lookup@Base @VER@
+ PySys_AddWarnOption@Base @VER@
+ PySys_GetFile@Base @VER@
+ PySys_GetObject@Base @VER@
+ PySys_HasWarnOptions@Base @VER@
+ PySys_ResetWarnOptions@Base @VER@
+ PySys_SetArgv@Base @VER@
+ PySys_SetArgvEx@Base @VER@
+ PySys_SetObject@Base @VER@
+ PySys_SetPath@Base @VER@
+ PySys_WriteStderr@Base @VER@
+ PySys_WriteStdout@Base @VER@
+ PyThreadState_Clear@Base @VER@
+ PyThreadState_Delete@Base @VER@
+ PyThreadState_DeleteCurrent@Base @VER@
+ PyThreadState_Get@Base @VER@
+ PyThreadState_GetDict@Base @VER@
+ PyThreadState_New@Base @VER@
+ PyThreadState_Next@Base @VER@
+ PyThreadState_SetAsyncExc@Base @VER@
+ PyThreadState_Swap@Base @VER@
+ PyThread_ReInitTLS@Base @VER@
+ PyThread_acquire_lock@Base @VER@
+ PyThread_allocate_lock@Base @VER@
+ PyThread_create_key@Base @VER@
+ PyThread_delete_key@Base @VER@
+ PyThread_delete_key_value@Base @VER@
+ PyThread_exit_thread@Base @VER@
+ PyThread_free_lock@Base @VER@
+ PyThread_get_key_value@Base @VER@
+ PyThread_get_stacksize@Base @VER@
+ PyThread_get_thread_ident@Base @VER@
+ PyThread_init_thread@Base @VER@
+ PyThread_release_lock@Base @VER@
+ PyThread_set_key_value@Base @VER@
+ PyThread_set_stacksize@Base @VER@
+ PyThread_start_new_thread@Base @VER@
+ PyToken_OneChar@Base @VER@
+ PyToken_ThreeChars@Base @VER@
+ PyToken_TwoChars@Base @VER@
+ PyTokenizer_Free@Base @VER@
+ PyTokenizer_FromFile@Base @VER@
+ PyTokenizer_FromString@Base @VER@
+ PyTokenizer_Get@Base @VER@
+ PyTokenizer_RestoreEncoding@Base @VER@
+ PyTraceBack_Here@Base @VER@
+ PyTraceBack_Print@Base @VER@
+ PyTraceBack_Type@Base @VER@
+ PyTupleIter_Type@Base @VER@
+ PyTuple_ClearFreeList@Base @VER@
+ PyTuple_Fini@Base @VER@
+ PyTuple_GetItem@Base @VER@
+ PyTuple_GetSlice@Base @VER@
+ PyTuple_New@Base @VER@
+ PyTuple_Pack@Base @VER@
+ PyTuple_SetItem@Base @VER@
+ PyTuple_Size@Base @VER@
+ PyTuple_Type@Base @VER@
+ PyType_ClearCache@Base @VER@
+ PyType_GenericAlloc@Base @VER@
+ PyType_GenericNew@Base @VER@
+ PyType_IsSubtype@Base @VER@
+ PyType_Modified@Base @VER@
+ PyType_Ready@Base @VER@
+ PyType_Type@Base @VER@
+ PyUnicodeDecodeError_Create@Base @VER@
+ PyUnicodeDecodeError_GetEncoding@Base @VER@
+ PyUnicodeDecodeError_GetEnd@Base @VER@
+ PyUnicodeDecodeError_GetObject@Base @VER@
+ PyUnicodeDecodeError_GetReason@Base @VER@
+ PyUnicodeDecodeError_GetStart@Base @VER@
+ PyUnicodeDecodeError_SetEnd@Base @VER@
+ PyUnicodeDecodeError_SetReason@Base @VER@
+ PyUnicodeDecodeError_SetStart@Base @VER@
+ PyUnicodeEncodeError_Create@Base @VER@
+ PyUnicodeEncodeError_GetEncoding@Base @VER@
+ PyUnicodeEncodeError_GetEnd@Base @VER@
+ PyUnicodeEncodeError_GetObject@Base @VER@
+ PyUnicodeEncodeError_GetReason@Base @VER@
+ PyUnicodeEncodeError_GetStart@Base @VER@
+ PyUnicodeEncodeError_SetEnd@Base @VER@
+ PyUnicodeEncodeError_SetReason@Base @VER@
+ PyUnicodeEncodeError_SetStart@Base @VER@
+ PyUnicodeTranslateError_Create@Base @VER@
+ PyUnicodeTranslateError_GetEnd@Base @VER@
+ PyUnicodeTranslateError_GetObject@Base @VER@
+ PyUnicodeTranslateError_GetReason@Base @VER@
+ PyUnicodeTranslateError_GetStart@Base @VER@
+ PyUnicodeTranslateError_SetEnd@Base @VER@
+ PyUnicodeTranslateError_SetReason@Base @VER@
+ PyUnicodeTranslateError_SetStart@Base @VER@
+ PyUnicodeUCS4_AsASCIIString@Base @VER@
+ PyUnicodeUCS4_AsCharmapString@Base @VER@
+ PyUnicodeUCS4_AsEncodedObject@Base @VER@
+ PyUnicodeUCS4_AsEncodedString@Base @VER@
+ PyUnicodeUCS4_AsLatin1String@Base @VER@
+ PyUnicodeUCS4_AsRawUnicodeEscapeString@Base @VER@
+ PyUnicodeUCS4_AsUTF16String@Base @VER@
+ PyUnicodeUCS4_AsUTF32String@Base @VER@
+ PyUnicodeUCS4_AsUTF8String@Base @VER@
+ PyUnicodeUCS4_AsUnicode@Base @VER@
+ PyUnicodeUCS4_AsUnicodeEscapeString@Base @VER@
+ PyUnicodeUCS4_AsWideChar@Base @VER@
+ PyUnicodeUCS4_ClearFreelist@Base @VER@
+ PyUnicodeUCS4_Compare@Base @VER@
+ PyUnicodeUCS4_Concat@Base @VER@
+ PyUnicodeUCS4_Contains@Base @VER@
+ PyUnicodeUCS4_Count@Base @VER@
+ PyUnicodeUCS4_Decode@Base @VER@
+ PyUnicodeUCS4_DecodeASCII@Base @VER@
+ PyUnicodeUCS4_DecodeCharmap@Base @VER@
+ PyUnicodeUCS4_DecodeLatin1@Base @VER@
+ PyUnicodeUCS4_DecodeRawUnicodeEscape@Base @VER@
+ PyUnicodeUCS4_DecodeUTF16@Base @VER@
+ PyUnicodeUCS4_DecodeUTF16Stateful@Base @VER@
+ PyUnicodeUCS4_DecodeUTF32@Base @VER@
+ PyUnicodeUCS4_DecodeUTF32Stateful@Base @VER@
+ PyUnicodeUCS4_DecodeUTF8@Base @VER@
+ PyUnicodeUCS4_DecodeUTF8Stateful@Base @VER@
+ PyUnicodeUCS4_DecodeUnicodeEscape@Base @VER@
+ PyUnicodeUCS4_Encode@Base @VER@
+ PyUnicodeUCS4_EncodeASCII@Base @VER@
+ PyUnicodeUCS4_EncodeCharmap@Base @VER@
+ PyUnicodeUCS4_EncodeDecimal@Base @VER@
+ PyUnicodeUCS4_EncodeLatin1@Base @VER@
+ PyUnicodeUCS4_EncodeRawUnicodeEscape@Base @VER@
+ PyUnicodeUCS4_EncodeUTF16@Base @VER@
+ PyUnicodeUCS4_EncodeUTF32@Base @VER@
+ PyUnicodeUCS4_EncodeUTF8@Base @VER@
+ PyUnicodeUCS4_EncodeUnicodeEscape@Base @VER@
+ PyUnicodeUCS4_Find@Base @VER@
+ PyUnicodeUCS4_Format@Base @VER@
+ PyUnicodeUCS4_FromEncodedObject@Base @VER@
+ PyUnicodeUCS4_FromFormat@Base @VER@
+ PyUnicodeUCS4_FromFormatV@Base @VER@
+ PyUnicodeUCS4_FromObject@Base @VER@
+ PyUnicodeUCS4_FromOrdinal@Base @VER@
+ PyUnicodeUCS4_FromString@Base @VER@
+ PyUnicodeUCS4_FromStringAndSize@Base @VER@
+ PyUnicodeUCS4_FromUnicode@Base @VER@
+ PyUnicodeUCS4_FromWideChar@Base @VER@
+ PyUnicodeUCS4_GetDefaultEncoding@Base @VER@
+ PyUnicodeUCS4_GetMax@Base @VER@
+ PyUnicodeUCS4_GetSize@Base @VER@
+ PyUnicodeUCS4_Join@Base @VER@
+ PyUnicodeUCS4_Partition@Base @VER@
+ PyUnicodeUCS4_RPartition@Base @VER@
+ PyUnicodeUCS4_RSplit@Base @VER@
+ PyUnicodeUCS4_Replace@Base @VER@
+ PyUnicodeUCS4_Resize@Base @VER@
+ PyUnicodeUCS4_RichCompare@Base @VER@
+ PyUnicodeUCS4_SetDefaultEncoding@Base @VER@
+ PyUnicodeUCS4_Split@Base @VER@
+ PyUnicodeUCS4_Splitlines@Base @VER@
+ PyUnicodeUCS4_Tailmatch@Base @VER@
+ PyUnicodeUCS4_Translate@Base @VER@
+ PyUnicodeUCS4_TranslateCharmap@Base @VER@
+ PyUnicode_AsDecodedObject@Base @VER@
+ PyUnicode_BuildEncodingMap@Base @VER@
+ PyUnicode_DecodeUTF7@Base @VER@
+ PyUnicode_DecodeUTF7Stateful@Base @VER@
+ PyUnicode_EncodeUTF7@Base @VER@
+ PyUnicode_Type@Base @VER@
+ PyWeakref_GetObject@Base @VER@
+ PyWeakref_NewProxy@Base @VER@
+ PyWeakref_NewRef@Base @VER@
+ PyWrapperDescr_Type@Base @VER@
+ PyWrapper_New@Base @VER@
+ Py_AddPendingCall@Base @VER@
+ Py_AtExit@Base @VER@
+ Py_BuildValue@Base @VER@
+ Py_BytesWarningFlag@Base @VER@
+ Py_CompileString@Base @VER@
+ Py_CompileStringFlags@Base @VER@
+ Py_DebugFlag@Base @VER@
+ Py_DecRef@Base @VER@
+ Py_DivisionWarningFlag@Base @VER@
+ Py_DontWriteBytecodeFlag@Base @VER@
+ Py_EndInterpreter@Base @VER@
+ Py_Exit@Base @VER@
+ Py_FatalError@Base @VER@
+ Py_FdIsInteractive@Base @VER@
+ Py_FileSystemDefaultEncoding@Base @VER@
+ Py_Finalize@Base @VER@
+ Py_FindMethod@Base @VER@
+ Py_FindMethodInChain@Base @VER@
+ Py_FlushLine@Base @VER@
+ Py_FrozenFlag@Base @VER@
+ Py_FrozenMain@Base @VER@
+ Py_GetArgcArgv@Base @VER@
+ Py_GetBuildInfo@Base @VER@
+ Py_GetCompiler@Base @VER@
+ Py_GetCopyright@Base @VER@
+ Py_GetExecPrefix@Base @VER@
+ Py_GetPath@Base @VER@
+ Py_GetPlatform@Base @VER@
+ Py_GetPrefix@Base @VER@
+ Py_GetProgramFullPath@Base @VER@
+ Py_GetProgramName@Base @VER@
+ Py_GetPythonHome@Base @VER@
+ Py_GetRecursionLimit@Base @VER@
+ Py_GetVersion@Base @VER@
+ Py_HashRandomizationFlag@Base @VER@
+ Py_IgnoreEnvironmentFlag@Base @VER@
+ Py_IncRef@Base @VER@
+ Py_Initialize@Base @VER@
+ Py_InitializeEx@Base @VER@
+ Py_InspectFlag@Base @VER@
+ Py_InteractiveFlag@Base @VER@
+ Py_IsInitialized@Base @VER@
+ Py_Main@Base @VER@
+ Py_MakePendingCalls@Base @VER@
+ Py_NewInterpreter@Base @VER@
+ Py_NoSiteFlag@Base @VER@
+ Py_NoUserSiteDirectory@Base @VER@
+ Py_OptimizeFlag@Base @VER@
+ Py_Py3kWarningFlag@Base @VER@
+ Py_ReprEnter@Base @VER@
+ Py_ReprLeave@Base @VER@
+ Py_SetProgramName@Base @VER@
+ Py_SetPythonHome@Base @VER@
+ Py_SetRecursionLimit@Base @VER@
+ Py_SubversionRevision@Base @VER@
+ Py_SubversionShortBranch@Base @VER@
+ Py_SymtableString@Base @VER@
+ Py_TabcheckFlag@Base @VER@
+ Py_UnicodeFlag@Base @VER@
+ Py_UniversalNewlineFgets@Base @VER@
+ Py_UniversalNewlineFread@Base @VER@
+ Py_UseClassExceptionsFlag@Base @VER@
+ Py_VaBuildValue@Base @VER@
+ Py_VerboseFlag@Base @VER@
+ Py_meta_grammar@Base @VER@
+ Py_pgen@Base @VER@
+ _PyArg_NoKeywords@Base @VER@
+ _PyArg_ParseTupleAndKeywords_SizeT@Base @VER@
+ _PyArg_ParseTuple_SizeT@Base @VER@
+ _PyArg_Parse_SizeT@Base @VER@
+ _PyArg_VaParseTupleAndKeywords_SizeT@Base @VER@
+ _PyArg_VaParse_SizeT@Base @VER@
+ _PyBuiltin_Init@Base @VER@
+ _PyByteArray_empty_string@Base @VER@
+ _PyBytes_FormatAdvanced@Base @VER@
+ _PyCode_CheckLineNumber@Base @VER@
+ _PyCodec_Lookup@Base @VER@
+ _PyComplex_FormatAdvanced@Base @VER@
+ _PyDict_Contains@Base @VER@
+ _PyDict_MaybeUntrack@Base @VER@
+ _PyDict_NewPresized@Base @VER@
+ _PyDict_Next@Base @VER@
+ _PyErr_BadInternalCall@Base @VER@
+ _PyEval_CallTracing@Base @VER@
+ _PyEval_SliceIndex@Base @VER@
+ _PyExc_Fini@Base @VER@
+ _PyExc_Init@Base @VER@
+ _PyFile_SanitizeMode@Base @VER@
+ _PyFloat_FormatAdvanced@Base @VER@
+ _PyFloat_Init@Base @VER@
+ _PyFloat_Pack4@Base @VER@
+ _PyFloat_Pack8@Base @VER@
+ _PyFloat_Unpack4@Base @VER@
+ _PyFloat_Unpack8@Base @VER@
+ _PyFrame_Init@Base @VER@
+ _PyGC_Dump@Base @VER@
+ _PyGC_generation0@Base @VER@
+ _PyGILState_Fini@Base @VER@
+ _PyGILState_Init@Base @VER@
+ _PyImportHooks_Init@Base @VER@
+ _PyImport_AcquireLock@Base @VER@
+ _PyImport_DynLoadFiletab@Base @VER@
+ _PyImport_Filetab@Base @VER@
+ _PyImport_FindExtension@Base @VER@
+ _PyImport_FindModule@Base @VER@
+ _PyImport_Fini@Base @VER@
+ _PyImport_FixupExtension@Base @VER@
+ _PyImport_GetDynLoadFunc@Base @VER@
+ _PyImport_Init@Base @VER@
+ _PyImport_Inittab@Base @VER@
+ _PyImport_IsScript@Base @VER@
+ _PyImport_LoadDynamicModule@Base @VER@
+ _PyImport_ReleaseLock@Base @VER@
+ _PyImport_ReInitLock@Base @VER@
+ _PyInstance_Lookup@Base @VER@
+ _PyInt_Format@Base @VER@
+ _PyInt_FormatAdvanced@Base @VER@
+ _PyInt_Init@Base @VER@
+ _PyList_Extend@Base @VER@
+ _PyLong_AsByteArray@Base @VER@
+ _PyLong_Copy@Base @VER@
+ _PyLong_DigitValue@Base @VER@
+ _PyLong_Format@Base @VER@
+ _PyLong_FormatAdvanced@Base @VER@
+ _PyLong_Frexp@Base @VER@
+ _PyLong_FromByteArray@Base @VER@
+ _PyLong_Init@Base @VER@
+ _PyLong_New@Base @VER@
+ _PyLong_NumBits@Base @VER@
+ _PyLong_Sign@Base @VER@
+ _PyModule_Clear@Base @VER@
+ _PyNumber_ConvertIntegralToInt@Base @VER@
+ _PyOS_GetOpt@Base @VER@
+ _PyOS_ReadlineTState@Base @VER@
+ _PyOS_ResetGetOpt@Base @VER@
+ _PyOS_URandom@Base @VER@
+ _PyOS_ascii_formatd@Base @VER@
+ _PyOS_ascii_strtod@Base @VER@
+ _PyOS_optarg@Base @VER@
+ _PyOS_opterr@Base @VER@
+ _PyOS_optind@Base @VER@
+ _PyObject_CallFunction_SizeT@Base @VER@
+ _PyObject_CallMethod_SizeT@Base @VER@
+ _PyObject_Del@Base @VER@
+ _PyObject_Dump@Base @VER@
+ _PyObject_GC_Del@Base @VER@
+ _PyObject_GC_Malloc@Base @VER@
+ _PyObject_GC_New@Base @VER@
+ _PyObject_GC_NewVar@Base @VER@
+ _PyObject_GC_Resize@Base @VER@
+ _PyObject_GC_Track@Base @VER@
+ _PyObject_GC_UnTrack@Base @VER@
+ _PyObject_GenericGetAttrWithDict@Base @VER@
+ _PyObject_GenericSetAttrWithDict@Base @VER@
+ _PyObject_GetDictPtr@Base @VER@
+ _PyObject_LengthHint@Base @VER@
+ _PyObject_LookupSpecial@Base @VER@
+ _PyObject_New@Base @VER@
+ _PyObject_NewVar@Base @VER@
+ _PyObject_NextNotImplemented@Base @VER@
+ _PyObject_RealIsInstance@Base @VER@
+ _PyObject_RealIsSubclass@Base @VER@
+ _PyObject_SlotCompare@Base @VER@
+ _PyObject_Str@Base @VER@
+ _PyParser_Grammar@Base @VER@
+ _PyParser_TokenNames@Base @VER@
+ _PyRandom_Init@Base @VER@
+ _PySequence_IterSearch@Base @VER@
+ _PySet_Next@Base @VER@
+ _PySet_NextEntry@Base @VER@
+ _PySet_Update@Base @VER@
+ _PySlice_FromIndices@Base @VER@
+ _PyString_Eq@Base @VER@
+ _PyString_FormatLong@Base @VER@
+ _PyString_InsertThousandsGrouping@Base @VER@
+ _PyString_Join@Base @VER@
+ _PyString_Resize@Base @VER@
+ _PySys_Init@Base @VER@
+ _PyThreadState_Current@Base @VER@
+ _PyThreadState_GetFrame@Base @VER@
+ _PyThreadState_Init@Base @VER@
+ _PyThreadState_Prealloc@Base @VER@
+ _PyThread_CurrentFrames@Base @VER@
+ _PyTime_DoubleToTimet@Base @VER@
+ _PyTrash_delete_later@Base @VER@
+ _PyTrash_delete_nesting@Base @VER@
+ _PyTrash_deposit_object@Base @VER@
+ _PyTrash_destroy_chain@Base @VER@
+ _PyTuple_MaybeUntrack@Base @VER@
+ _PyTuple_Resize@Base @VER@
+ _PyType_Lookup@Base @VER@
+ _PyUnicodeUCS4_AsDefaultEncodedString@Base @VER@
+ _PyUnicodeUCS4_Fini@Base @VER@
+ _PyUnicodeUCS4_Init@Base @VER@
+ _PyUnicodeUCS4_IsAlpha@Base @VER@
+ _PyUnicodeUCS4_IsDecimalDigit@Base @VER@
+ _PyUnicodeUCS4_IsDigit@Base @VER@
+ _PyUnicodeUCS4_IsLinebreak@Base @VER@
+ _PyUnicodeUCS4_IsLowercase@Base @VER@
+ _PyUnicodeUCS4_IsNumeric@Base @VER@
+ _PyUnicodeUCS4_IsTitlecase@Base @VER@
+ _PyUnicodeUCS4_IsUppercase@Base @VER@
+ _PyUnicodeUCS4_IsWhitespace@Base @VER@
+ _PyUnicodeUCS4_ToDecimalDigit@Base @VER@
+ _PyUnicodeUCS4_ToDigit@Base @VER@
+ _PyUnicodeUCS4_ToLowercase@Base @VER@
+ _PyUnicodeUCS4_ToNumeric@Base @VER@
+ _PyUnicodeUCS4_ToTitlecase@Base @VER@
+ _PyUnicodeUCS4_ToUppercase@Base @VER@
+ _PyUnicode_BidirectionalNames@Base @VER@
+ _PyUnicode_CategoryNames@Base @VER@
+ _PyUnicode_Database_Records@Base @VER@
+ _PyUnicode_DecodeUnicodeInternal@Base @VER@
+ _PyUnicode_EastAsianWidthNames@Base @VER@
+ _PyUnicode_FormatAdvanced@Base @VER@
+ _PyUnicode_TypeRecords@Base @VER@
+ _PyUnicode_XStrip@Base @VER@
+ _PyWarnings_Init@Base @VER@
+ _PyWeakref_CallableProxyType@Base @VER@
+ _PyWeakref_ClearRef@Base @VER@
+ _PyWeakref_GetWeakrefCount@Base @VER@
+ _PyWeakref_ProxyType@Base @VER@
+ _PyWeakref_RefType@Base @VER@
+ _Py_Assert@Base @VER@
+ _Py_Assign@Base @VER@
+ _Py_Attribute@Base @VER@
+ _Py_AugAssign@Base @VER@
+ _Py_BinOp@Base @VER@
+ _Py_BoolOp@Base @VER@
+ _Py_Break@Base @VER@
+ _Py_BuildValue_SizeT@Base @VER@
+ _Py_Call@Base @VER@
+ _Py_CheckInterval@Base @VER@
+ _Py_CheckRecursionLimit@Base @VER@
+ _Py_CheckRecursiveCall@Base @VER@
+ _Py_ClassDef@Base @VER@
+ _Py_Compare@Base @VER@
+ _Py_Continue@Base @VER@
+ _Py_Delete@Base @VER@
+ _Py_Dict@Base @VER@
+ _Py_DictComp@Base @VER@
+ _Py_DisplaySourceLine@Base @VER@
+ _Py_Ellipsis@Base @VER@
+ _Py_EllipsisObject@Base @VER@
+ _Py_ExceptHandler@Base @VER@
+ _Py_Exec@Base @VER@
+ _Py_Expr@Base @VER@
+ _Py_Expression@Base @VER@
+ _Py_ExtSlice@Base @VER@
+ _Py_For@Base @VER@
+ _Py_FunctionDef@Base @VER@
+ _Py_GeneratorExp@Base @VER@
+ _Py_Global@Base @VER@
+ _Py_HashDouble@Base @VER@
+ _Py_HashPointer@Base @VER@
+ _Py_HashSecret@Base @VER@
+ _Py_If@Base @VER@
+ _Py_IfExp@Base @VER@
+ _Py_Import@Base @VER@
+ _Py_ImportFrom@Base @VER@
+ _Py_Index@Base @VER@
+ _Py_InsertThousandsGroupingLocale@Base @VER@
+ _Py_Interactive@Base @VER@
+ _Py_Lambda@Base @VER@
+ _Py_List@Base @VER@
+ _Py_ListComp@Base @VER@
+ _Py_Mangle@Base @VER@
+ _Py_Module@Base @VER@
+ _Py_Name@Base @VER@
+ _Py_NoneStruct@Base @VER@
+ _Py_NotImplementedStruct@Base @VER@
+ _Py_Num@Base @VER@
+ _Py_PackageContext@Base @VER@
+ _Py_Pass@Base @VER@
+ _Py_Print@Base @VER@
+ _Py_QnewFlag@Base @VER@
+ _Py_Raise@Base @VER@
+ _Py_ReadyTypes@Base @VER@
+ _Py_ReleaseInternedStrings@Base @VER@
+ _Py_Repr@Base @VER@
+ _Py_Return@Base @VER@
+ _Py_Set@Base @VER@
+ _Py_SetComp@Base @VER@
+ _Py_Slice@Base @VER@
+ _Py_Str@Base @VER@
+ _Py_Subscript@Base @VER@
+ _Py_Suite@Base @VER@
+ _Py_SwappedOp@Base @VER@
+ _Py_Ticker@Base @VER@
+ _Py_TrueStruct@Base @VER@
+ _Py_TryExcept@Base @VER@
+ _Py_TryFinally@Base @VER@
+ _Py_Tuple@Base @VER@
+ _Py_UnaryOp@Base @VER@
+ _Py_VaBuildValue_SizeT@Base @VER@
+ _Py_While@Base @VER@
+ _Py_With@Base @VER@
+ _Py_Yield@Base @VER@
+ _Py_ZeroStruct@Base @VER@
+ _Py_abstract_hack@Base @VER@
+ _Py_add_one_to_index_C@Base @VER@
+ _Py_add_one_to_index_F@Base @VER@
+ (optional)_Py_acosh@Base @VER@
+ _Py_addarc@Base @VER@
+ _Py_addbit@Base @VER@
+ _Py_adddfa@Base @VER@
+ _Py_addfirstsets@Base @VER@
+ _Py_addlabel@Base @VER@
+ _Py_addstate@Base @VER@
+ _Py_alias@Base @VER@
+ _Py_arguments@Base @VER@
+ _Py_ascii_whitespace@Base @VER@
+ (optional)_Py_asinh@Base @VER@
+ (optional)_Py_atanh@Base @VER@
+ _Py_bytes_capitalize@Base @VER@
+ _Py_bytes_isalnum@Base @VER@
+ _Py_bytes_isalpha@Base @VER@
+ _Py_bytes_isdigit@Base @VER@
+ _Py_bytes_islower@Base @VER@
+ _Py_bytes_isspace@Base @VER@
+ _Py_bytes_istitle@Base @VER@
+ _Py_bytes_isupper@Base @VER@
+ _Py_bytes_lower@Base @VER@
+ _Py_bytes_swapcase@Base @VER@
+ _Py_bytes_title@Base @VER@
+ _Py_bytes_upper@Base @VER@
+ _Py_c_abs@Base @VER@
+ _Py_c_diff@Base @VER@
+ _Py_c_neg@Base @VER@
+ _Py_c_pow@Base @VER@
+ _Py_c_prod@Base @VER@
+ _Py_c_quot@Base @VER@
+ _Py_c_sum@Base @VER@
+ _Py_capitalize__doc__@Base @VER@
+ _Py_capsule_hack@Base @VER@
+ _Py_cobject_hack@Base @VER@
+ _Py_comprehension@Base @VER@
+ _Py_ctype_table@Base @VER@
+ _Py_ctype_tolower@Base @VER@
+ _Py_ctype_toupper@Base @VER@
+ _Py_delbitset@Base @VER@
+ (arch=!m68k)_Py_dg_dtoa@Base @VER@
+ (arch=!m68k)_Py_dg_freedtoa@Base @VER@
+ (arch=!m68k)_Py_dg_strtod@Base @VER@
+ _Py_double_round@Base @VER@
+ (optional)_Py_expm1@Base @VER@
+ _Py_findlabel@Base @VER@
+ (arch=i386 lpia m68k)_Py_force_double@Base @VER@
+ (arch=amd64 i386 lpia)_Py_get_387controlword@Base @VER@
+ _Py_hgidentifier@Base 2.7.1
+ _Py_hgversion@Base 2.7.1
+ _Py_isalnum__doc__@Base @VER@
+ _Py_isalpha__doc__@Base @VER@
+ _Py_isdigit__doc__@Base @VER@
+ _Py_islower__doc__@Base @VER@
+ _Py_isspace__doc__@Base @VER@
+ _Py_istitle__doc__@Base @VER@
+ _Py_isupper__doc__@Base @VER@
+ _Py_keyword@Base @VER@
+ (optional)_Py_log1p@Base @VER@
+ _Py_lower__doc__@Base @VER@
+ _Py_mergebitset@Base @VER@
+ _Py_meta_grammar@Base @VER@
+ _Py_newbitset@Base @VER@
+ _Py_newgrammar@Base @VER@
+ (optional)_Py_parse_inf_or_nan@Base @VER@
+ _Py_pgen@Base @VER@
+ _Py_samebitset@Base @VER@
+ (arch=amd64 i386 lpia)_Py_set_387controlword@Base @VER@
+ _Py_svnversion@Base @VER@
+ _Py_swapcase__doc__@Base @VER@
+ _Py_title__doc__@Base @VER@
+ _Py_translatelabels@Base @VER@
+ _Py_upper__doc__@Base @VER@
+
+ PyFPE_counter@Base @VER@
+ PyFPE_dummy@Base @VER@
+ PyFPE_jbuf@Base @VER@
+
+ asdl_int_seq_new@Base @VER@
+ asdl_seq_new@Base @VER@
+
+# don't check for the following symbols, found in extensions
+# which either can be built as builtin or extension.
+
+ (optional)fast_save_leave@Base @VER@
+ (optional)partial_reduce@Base @VER@
+ (optional)partial_setstate@Base @VER@
+
+# _check_for_multiple_distdirs@Base @VER@
+ (optional)init_ast@Base @VER@
+ (optional)init_bisect@Base @VER@
+ (optional)init_codecs@Base @VER@
+ (optional)init_collections@Base @VER@
+ (optional)init_functools@Base @VER@
+ (optional)init_hashlib@Base @VER@
+ (optional)init_heapq@Base @VER@
+ (optional)init_locale@Base @VER@
+ (optional)init_random@Base @VER@
+ (optional)init_socket@Base @VER@
+ (optional)init_sockobject@Base @VER@
+ (optional)init_sre@Base @VER@
+ (optional)init_ssl@Base @VER@
+ (optional)init_struct@Base @VER@
+ (optional)init_symtable@Base @VER@
+ (optional)init_weakref@Base @VER@
+ (optional)initarray@Base @VER@
+ (optional)initbinascii@Base @VER@
+ (optional)initcPickle@Base @VER@
+ (optional)initcStringIO@Base @VER@
+ (optional)initcmath@Base @VER@
+ (optional)initerrno@Base @VER@
+ (optional)initfcntl@Base @VER@
+ (optional)initgc@Base @VER@
+ (optional)initgrp@Base @VER@
+ (optional)initimp@Base @VER@
+ (optional)inititertools@Base @VER@
+ (optional)initmath@Base @VER@
+ (optional)initoperator@Base @VER@
+ (optional)initposix@Base @VER@
+ (optional)initpwd@Base @VER@
+ (optional)initselect@Base @VER@
+ (optional)initsignal@Base @VER@
+ (optional)initspwd@Base @VER@
+ (optional)initstrop@Base @VER@
+ (optional)initsyslog@Base @VER@
+ (optional)initthread@Base @VER@
+ (optional)inittime@Base @VER@
+ (optional)initunicodedata@Base @VER@
+ (optional)initxxsubtype@Base @VER@
+ (optional)initzipimport@Base @VER@
+ (optional)initzlib@Base @VER@
--- python2.7-2.7.3.orig/debian/PVER.overrides.in
+++ python2.7-2.7.3/debian/PVER.overrides.in
@@ -0,0 +1,14 @@
+# idlelib images
+@PVER@ binary: image-file-in-usr-lib
+
+# yes, we have to
+@PVER@ binary: depends-on-python-minimal
+
+@PVER@ binary: desktop-command-not-in-package
+@PVER@ binary: menu-command-not-in-package
+
+# license file referred by the standard library
+@PVER@ binary: extra-license-file
+
+# no, not useless
+@PVER@ binary: manpage-has-useless-whatis-entry
--- python2.7-2.7.3.orig/debian/_sysconfigdata.py
+++ python2.7-2.7.3/debian/_sysconfigdata.py
@@ -0,0 +1,6 @@
+import sys
+
+if hasattr(sys, 'gettotalrefcount'):
+    from _sysconfigdata_d import *
+else:
+    from _sysconfigdata_nd import *
--- python2.7-2.7.3.orig/debian/PVER-dbg.overrides.in
+++ python2.7-2.7.3/debian/PVER-dbg.overrides.in
@@ -0,0 +1,8 @@
+@PVER@-dbg binary: package-name-doesnt-match-sonames
+@PVER@-dbg binary: non-dev-pkg-with-shlib-symlink
+
+# no, it's not unusual
+@PVER@-dbg binary: unusual-interpreter
+
+# just the gdb debug file
+@PVER@-dbg binary: python-script-but-no-python-dep
--- python2.7-2.7.3.orig/debian/mincheck.py
+++ python2.7-2.7.3/debian/mincheck.py
@@ -0,0 +1,41 @@
+
+import sys
+
+def get_listed(fn):
+    modules = set()
+    for line in file(fn).readlines():
+        modules.add(line.split()[1])
+    return modules
+
+def get_dependencies(fn):
+    t = eval(file(fn).read())
+    modules = set()
+    depgraph = t['depgraph']
+    for mod, deps in depgraph.iteritems():
+        if mod != '__main__':
+            modules.add(mod)
+        modules.update(deps.keys())
+    return depgraph, modules
+
+def main():
+    mods = get_listed(sys.argv[1])
+    depgraph, deps = get_dependencies(sys.argv[2])
+    print "Listed modules:", sorted(mods)
+    print
+    print "Dependent modules:", sorted(deps)
+    print
+
+    missing = deps.difference(mods)
+    if missing:
+        print "Missing modules in python-minimal:"
+        print missing
+    for m in missing:
+        users = []
+        for caller, callees in depgraph.iteritems():
+            if m in callees:
+                users.append(caller)
+        print m, "used in: ", users
+    sys.exit(len(missing))
+
+main()
+
--- python2.7-2.7.3.orig/debian/README.python
+++ python2.7-2.7.3/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.7-2.7.3.orig/debian/libPVER.overrides.in
+++ python2.7-2.7.3/debian/libPVER.overrides.in
@@ -0,0 +1 @@
+lib@PVER@ binary: package-name-doesnt-match-sonames
--- python2.7-2.7.3.orig/debian/PVER.prerm.in
+++ python2.7-2.7.3/debian/PVER.prerm.in
@@ -0,0 +1,27 @@
+#! /bin/sh -e
+#
+# prerm script for the Debian @PVER@-base package.
+# Written 1998 by Gregor Hoffleit <flight@debian.org>.
+#
+
+case "$1" in
+    remove|upgrade)
+	dpkg -L @PVER@ \
+	    | awk '/\.py$/ {print $0"c\n" $0"o"}' \
+	    | xargs rm -f >&2
+        ;;
+    deconfigure)
+        ;;
+    failed-upgrade)
+        ;;
+    *)
+        echo "prerm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+rmdir /usr/local/lib/python@VER@/site-packages 2>/dev/null && \
+        rmdir /usr/local/lib/python@VER@ 2>/dev/null || \
+        true
+
+#DEBHELPER#
--- python2.7-2.7.3.orig/debian/libPVER.symbols.in
+++ python2.7-2.7.3/debian/libPVER.symbols.in
@@ -0,0 +1,3 @@
+libpython@VER@.so.1.0 libpython@VER@ #MINVER#
+ Py_InitModule4@Base @VER@
+#include "libpython.symbols"
--- python2.7-2.7.3.orig/debian/pydoc.1.in
+++ python2.7-2.7.3/debian/pydoc.1.in
@@ -0,0 +1,53 @@
+.TH PYDOC@VER@ 1
+.SH NAME
+pydoc@VER@ \- the Python documentation tool
+.SH SYNOPSIS
+.PP
+.B pydoc@VER@
+.I name
+.PP
+.B pydoc@VER@ -k
+.I keyword
+.PP
+.B pydoc@VER@ -p
+.I port
+.PP
+.B pydoc@VER@ -g
+.PP
+.B pydoc@VER@ -w
+.I module [...]
+.SH DESCRIPTION
+.PP
+.B pydoc@VER@
+.I name
+Show text documentation on something.
+.I name
+may be the name of a
+Python keyword, topic, function, module, or package, or a dotted
+reference to a class or function within a module or module in a
+package.  If
+.I name
+contains a '/', it is used as the path to a
+Python source file to document. If name is 'keywords', 'topics',
+or 'modules', a listing of these things is displayed.
+.PP
+.B pydoc@VER@ -k
+.I keyword
+Search for a keyword in the synopsis lines of all available modules.
+.PP
+.B pydoc@VER@ -p
+.I port
+Start an HTTP server on the given port on the local machine.
+.PP
+.B pydoc@VER@ -g
+Pop up a graphical interface for finding and serving documentation.
+.PP
+.B pydoc@VER@ -w
+.I name [...]
+Write out the HTML documentation for a module to a file in the current
+directory.  If
+.I name
+contains a '/', it is treated as a filename; if
+it names a directory, documentation is written for all the contents.
+.SH AUTHOR
+Moshe Zadka, based on "pydoc --help"
--- python2.7-2.7.3.orig/debian/PVER-doc.overrides.in
+++ python2.7-2.7.3/debian/PVER-doc.overrides.in
@@ -0,0 +1,2 @@
+# this is referenced by the html docs
+@PVER@-doc binary: extra-license-file
--- python2.7-2.7.3.orig/debian/FAQ.html
+++ python2.7-2.7.3/debian/FAQ.html
@@ -0,0 +1,8997 @@
+<HTML>
+<HEAD>
+<TITLE>The Whole Python FAQ</TITLE>
+</HEAD>
+
+<BODY BACKGROUND="http://www.python.org/pics/RedShort.gif"
+      BGCOLOR="#FFFFFF"
+      TEXT="#000000"
+      LINK="#AA0000"
+      VLINK="#906A6A">
+<H1>The Whole Python FAQ</H1>
+Last changed on Wed Feb 12 21:31:08 2003 CET
+
+<P>(Entries marked with ** were changed within the last 24 hours;
+entries marked with * were changed within the last 7 days.)
+<P>
+
+<P>
+<HR>
+<H2>1. General information and availability</H2>
+<UL>
+<LI><A HREF="#1.1">1.1. What is Python?</A>
+<LI><A HREF="#1.2">1.2. Why is it called Python?</A>
+<LI><A HREF="#1.3">1.3. How do I obtain a copy of the Python source?</A>
+<LI><A HREF="#1.4">1.4. How do I get documentation on Python?</A>
+<LI><A HREF="#1.5">1.5. Are there other ftp sites that mirror the Python distribution?</A>
+<LI><A HREF="#1.6">1.6. Is there a newsgroup or mailing list devoted to Python?</A>
+<LI><A HREF="#1.7">1.7. Is there a WWW page devoted to Python?</A>
+<LI><A HREF="#1.8">1.8. Is the Python documentation available on the WWW?</A>
+<LI><A HREF="#1.9">1.9. Are there any books on Python?</A>
+<LI><A HREF="#1.10">1.10. Are there any published articles about Python that I can reference?</A>
+<LI><A HREF="#1.11">1.11. Are there short introductory papers or talks on Python?</A>
+<LI><A HREF="#1.12">1.12. How does the Python version numbering scheme work?</A>
+<LI><A HREF="#1.13">1.13. How do I get a beta test version of Python?</A>
+<LI><A HREF="#1.14">1.14. Are there copyright restrictions on the use of Python?</A>
+<LI><A HREF="#1.15">1.15. Why was Python created in the first place?</A>
+<LI><A HREF="#1.16">1.16. Do I have to like &quot;Monty Python's Flying Circus&quot;?</A>
+<LI><A HREF="#1.17">1.17. What is Python good for?</A>
+<LI><A HREF="#1.18">1.18. Can I use the FAQ Wizard software to maintain my own FAQ?</A>
+<LI><A HREF="#1.19">1.19. Which editor has good support for editing Python source code?</A>
+<LI><A HREF="#1.20">1.20. I've never programmed before. Is there a Python tutorial?</A>
+<LI><A HREF="#1.21">1.21. Where in the world is www.python.org located?</A>
+
+</UL>
+
+<P>
+<HR>
+<H2>2. Python in the real world</H2>
+<UL>
+<LI><A HREF="#2.1">2.1. How many people are using Python?</A>
+<LI><A HREF="#2.2">2.2. Have any significant projects been done in Python?</A>
+<LI><A HREF="#2.3">2.3. Are there any commercial projects going on using Python?</A>
+<LI><A HREF="#2.4">2.4. How stable is Python?</A>
+<LI><A HREF="#2.5">2.5. What new developments are expected for Python in the future?</A>
+<LI><A HREF="#2.6">2.6. Is it reasonable to propose incompatible changes to Python?</A>
+<LI><A HREF="#2.7">2.7. What is the future of Python?</A>
+<LI><A HREF="#2.8">2.8. What was the PSA, anyway?</A>
+<LI><A HREF="#2.9">2.9. Deleted</A>
+<LI><A HREF="#2.10">2.10. Deleted</A>
+<LI><A HREF="#2.11">2.11. Is Python Y2K (Year 2000) Compliant?</A>
+<LI><A HREF="#2.12">2.12. Is Python a good language in a class for beginning programmers?</A>
+
+</UL>
+
+<P>
+<HR>
+<H2>3. Building Python and Other Known Bugs</H2>
+<UL>
+<LI><A HREF="#3.1">3.1. Is there a test set?</A>
+<LI><A HREF="#3.2">3.2. When running the test set, I get complaints about floating point operations, but when playing with floating point operations I cannot find anything wrong with them.</A>
+<LI><A HREF="#3.3">3.3. Link errors after rerunning the configure script.</A>
+<LI><A HREF="#3.4">3.4. The python interpreter complains about options passed to a script (after the script name).</A>
+<LI><A HREF="#3.5">3.5. When building on the SGI, make tries to run python to create glmodule.c, but python hasn't been built or installed yet.</A>
+<LI><A HREF="#3.6">3.6. I use VPATH but some targets are built in the source directory.</A>
+<LI><A HREF="#3.7">3.7. Trouble building or linking with the GNU readline library.</A>
+<LI><A HREF="#3.8">3.8. Trouble with socket I/O on older Linux 1.x versions.</A>
+<LI><A HREF="#3.9">3.9. Trouble with prototypes on Ultrix.</A>
+<LI><A HREF="#3.10">3.10. Other trouble building Python on platform X.</A>
+<LI><A HREF="#3.11">3.11. How to configure dynamic loading on Linux.</A>
+<LI><A HREF="#3.12">3.12. I can't get shared modules to work on Linux 2.0 (Slackware96)?</A>
+<LI><A HREF="#3.13">3.13. Trouble when making modules shared on Linux.</A>
+<LI><A HREF="#3.14">3.14. [deleted]</A>
+<LI><A HREF="#3.15">3.15. Errors when linking with a shared library containing C++ code.</A>
+<LI><A HREF="#3.16">3.16. Deleted</A>
+<LI><A HREF="#3.17">3.17. Deleted.</A>
+<LI><A HREF="#3.18">3.18. Compilation or link errors for the _tkinter module</A>
+<LI><A HREF="#3.19">3.19. I configured and built Python for Tcl/Tk but &quot;import Tkinter&quot; fails.</A>
+<LI><A HREF="#3.20">3.20. [deleted]</A>
+<LI><A HREF="#3.21">3.21. Several common system calls are missing from the posix module.</A>
+<LI><A HREF="#3.22">3.22. ImportError: No module named string, on MS Windows.</A>
+<LI><A HREF="#3.23">3.23. Core dump on SGI when using the gl module.</A>
+<LI><A HREF="#3.24">3.24. &quot;Initializer not a constant&quot; while building DLL on MS-Windows</A>
+<LI><A HREF="#3.25">3.25. Output directed to a pipe or file disappears on Linux.</A>
+<LI><A HREF="#3.26">3.26. [deleted]</A>
+<LI><A HREF="#3.27">3.27. [deleted]</A>
+<LI><A HREF="#3.28">3.28. How can I test if Tkinter is working?</A>
+<LI><A HREF="#3.29">3.29. Is there a way to get the interactive mode of the python interpreter to perform function/variable name completion?</A>
+<LI><A HREF="#3.30">3.30. Why is the Python interpreter not built as a shared library?</A>
+<LI><A HREF="#3.31">3.31. Build with GCC on Solaris 2.6 (SunOS 5.6) fails</A>
+<LI><A HREF="#3.32">3.32. Running &quot;make clean&quot; seems to leave problematic files that cause subsequent builds to fail.</A>
+<LI><A HREF="#3.33">3.33. Submitting bug reports and patches</A>
+<LI><A HREF="#3.34">3.34. I can't load shared libraries under Python 1.5.2, Solaris 7, and gcc 2.95.2</A>
+<LI><A HREF="#3.35">3.35. In the regression test, test___all__ fails for the profile module. What's wrong?</A>
+<LI><A HREF="#3.36">3.36. relocations remain against allocatable but non-writable sections</A>
+
+</UL>
+
+<P>
+<HR>
+<H2>4. Programming in Python</H2>
+<UL>
+<LI><A HREF="#4.1">4.1. Is there a source code level debugger with breakpoints, step, etc.?</A>
+<LI><A HREF="#4.2">4.2. Can I create an object class with some methods implemented in C and others in Python (e.g. through inheritance)? (Also phrased as: Can I use a built-in type as base class?)</A>
+<LI><A HREF="#4.3">4.3. Is there a curses/termcap package for Python?</A>
+<LI><A HREF="#4.4">4.4. Is there an equivalent to C's onexit() in Python?</A>
+<LI><A HREF="#4.5">4.5. [deleted]</A>
+<LI><A HREF="#4.6">4.6. How do I iterate over a sequence in reverse order?</A>
+<LI><A HREF="#4.7">4.7. My program is too slow. How do I speed it up?</A>
+<LI><A HREF="#4.8">4.8. When I have imported a module, then edit it, and import it again (into the same Python process), the changes don't seem to take place. What is going on?</A>
+<LI><A HREF="#4.9">4.9. How do I find the current module name?</A>
+<LI><A HREF="#4.10">4.10. I have a module in which I want to execute some extra code when it is run as a script. How do I find out whether I am running as a script?</A>
+<LI><A HREF="#4.11">4.11. I try to run a program from the Demo directory but it fails with ImportError: No module named ...; what gives?</A>
+<LI><A HREF="#4.12">4.12. [deleted]</A>
+<LI><A HREF="#4.13">4.13. What GUI toolkits exist for Python?</A>
+<LI><A HREF="#4.14">4.14. Are there any interfaces to database packages in Python?</A>
+<LI><A HREF="#4.15">4.15. Is it possible to write obfuscated one-liners in Python?</A>
+<LI><A HREF="#4.16">4.16. Is there an equivalent of C's &quot;?:&quot; ternary operator?</A>
+<LI><A HREF="#4.17">4.17. My class defines __del__ but it is not called when I delete the object.</A>
+<LI><A HREF="#4.18">4.18. How do I change the shell environment for programs called using os.popen() or os.system()? Changing os.environ doesn't work.</A>
+<LI><A HREF="#4.19">4.19. What is a class?</A>
+<LI><A HREF="#4.20">4.20. What is a method?</A>
+<LI><A HREF="#4.21">4.21. What is self?</A>
+<LI><A HREF="#4.22">4.22. What is an unbound method?</A>
+<LI><A HREF="#4.23">4.23. How do I call a method defined in a base class from a derived class that overrides it?</A>
+<LI><A HREF="#4.24">4.24. How do I call a method from a base class without using the name of the base class?</A>
+<LI><A HREF="#4.25">4.25. How can I organize my code to make it easier to change the base class?</A>
+<LI><A HREF="#4.26">4.26. How can I find the methods or attributes of an object?</A>
+<LI><A HREF="#4.27">4.27. I can't seem to use os.read() on a pipe created with os.popen().</A>
+<LI><A HREF="#4.28">4.28. How can I create a stand-alone binary from a Python script?</A>
+<LI><A HREF="#4.29">4.29. What WWW tools are there for Python?</A>
+<LI><A HREF="#4.30">4.30. How do I run a subprocess with pipes connected to both input and output?</A>
+<LI><A HREF="#4.31">4.31. How do I call a function if I have the arguments in a tuple?</A>
+<LI><A HREF="#4.32">4.32. How do I enable font-lock-mode for Python in Emacs?</A>
+<LI><A HREF="#4.33">4.33. Is there a scanf() or sscanf() equivalent?</A>
+<LI><A HREF="#4.34">4.34. Can I have Tk events handled while waiting for I/O?</A>
+<LI><A HREF="#4.35">4.35. How do I write a function with output parameters (call by reference)?</A>
+<LI><A HREF="#4.36">4.36. Please explain the rules for local and global variables in Python.</A>
+<LI><A HREF="#4.37">4.37. How can I have modules that mutually import each other?</A>
+<LI><A HREF="#4.38">4.38. How do I copy an object in Python?</A>
+<LI><A HREF="#4.39">4.39. How to implement persistent objects in Python? (Persistent == automatically saved to and restored from disk.)</A>
+<LI><A HREF="#4.40">4.40. I try to use __spam and I get an error about _SomeClassName__spam.</A>
+<LI><A HREF="#4.41">4.41. How do I delete a file? And other file questions.</A>
+<LI><A HREF="#4.42">4.42. How to modify urllib or httplib to support HTTP/1.1?</A>
+<LI><A HREF="#4.43">4.43. Unexplicable syntax errors in compile() or exec.</A>
+<LI><A HREF="#4.44">4.44. How do I convert a string to a number?</A>
+<LI><A HREF="#4.45">4.45. How do I convert a number to a string?</A>
+<LI><A HREF="#4.46">4.46. How do I copy a file?</A>
+<LI><A HREF="#4.47">4.47. How do I check if an object is an instance of a given class or of a subclass of it?</A>
+<LI><A HREF="#4.48">4.48. What is delegation?</A>
+<LI><A HREF="#4.49">4.49. How do I test a Python program or component.</A>
+<LI><A HREF="#4.50">4.50. My multidimensional list (array) is broken! What gives?</A>
+<LI><A HREF="#4.51">4.51. I want to do a complicated sort: can you do a Schwartzian Transform in Python?</A>
+<LI><A HREF="#4.52">4.52. How to convert between tuples and lists?</A>
+<LI><A HREF="#4.53">4.53. Files retrieved with urllib contain leading garbage that looks like email headers.</A>
+<LI><A HREF="#4.54">4.54. How do I get a list of all instances of a given class?</A>
+<LI><A HREF="#4.55">4.55. A regular expression fails with regex.error: match failure.</A>
+<LI><A HREF="#4.56">4.56. I can't get signal handlers to work.</A>
+<LI><A HREF="#4.57">4.57. I can't use a global variable in a function? Help!</A>
+<LI><A HREF="#4.58">4.58. What's a negative index? Why doesn't list.insert() use them?</A>
+<LI><A HREF="#4.59">4.59. How can I sort one list by values from another list?</A>
+<LI><A HREF="#4.60">4.60. Why doesn't dir() work on builtin types like files and lists?</A>
+<LI><A HREF="#4.61">4.61. How can I mimic CGI form submission (METHOD=POST)?</A>
+<LI><A HREF="#4.62">4.62. If my program crashes with a bsddb (or anydbm) database open, it gets corrupted. How come?</A>
+<LI><A HREF="#4.63">4.63. How do I make a Python script executable on Unix?</A>
+<LI><A HREF="#4.64">4.64. How do you remove duplicates from a list?</A>
+<LI><A HREF="#4.65">4.65. Are there any known year 2000 problems in Python?</A>
+<LI><A HREF="#4.66">4.66. I want a version of map that applies a method to a sequence of objects! Help!</A>
+<LI><A HREF="#4.67">4.67. How do I generate random numbers in Python?</A>
+<LI><A HREF="#4.68">4.68. How do I access the serial (RS232) port?</A>
+<LI><A HREF="#4.69">4.69. Images on Tk-Buttons don't work in Py15?</A>
+<LI><A HREF="#4.70">4.70. Where is the math.py (socket.py, regex.py, etc.) source file?</A>
+<LI><A HREF="#4.71">4.71. How do I send mail from a Python script?</A>
+<LI><A HREF="#4.72">4.72. How do I avoid blocking in connect() of a socket?</A>
+<LI><A HREF="#4.73">4.73. How do I specify hexadecimal and octal integers?</A>
+<LI><A HREF="#4.74">4.74. How to get a single keypress at a time?</A>
+<LI><A HREF="#4.75">4.75. How can I overload constructors (or methods) in Python?</A>
+<LI><A HREF="#4.76">4.76. How do I pass keyword arguments from one method to another?</A>
+<LI><A HREF="#4.77">4.77. What module should I use to help with generating HTML?</A>
+<LI><A HREF="#4.78">4.78. How do I create documentation from doc strings?</A>
+<LI><A HREF="#4.79">4.79. How do I read (or write) binary data?</A>
+<LI><A HREF="#4.80">4.80. I can't get key bindings to work in Tkinter</A>
+<LI><A HREF="#4.81">4.81. &quot;import crypt&quot; fails</A>
+<LI><A HREF="#4.82">4.82. Are there coding standards or a style guide for Python programs?</A>
+<LI><A HREF="#4.83">4.83. How do I freeze Tkinter applications?</A>
+<LI><A HREF="#4.84">4.84. How do I create static class data and static class methods?</A>
+<LI><A HREF="#4.85">4.85. __import__('x.y.z') returns &lt;module 'x'&gt;; how do I get z?</A>
+<LI><A HREF="#4.86">4.86. Basic thread wisdom</A>
+<LI><A HREF="#4.87">4.87. Why doesn't closing sys.stdout (stdin, stderr) really close it?</A>
+<LI><A HREF="#4.88">4.88. What kinds of global value mutation are thread-safe?</A>
+<LI><A HREF="#4.89">4.89. How do I modify a string in place?</A>
+<LI><A HREF="#4.90">4.90. How to pass on keyword/optional parameters/arguments</A>
+<LI><A HREF="#4.91">4.91. How can I get a dictionary to display its keys in a consistent order?</A>
+<LI><A HREF="#4.92">4.92. Is there a Python tutorial?</A>
+<LI><A HREF="#4.93">4.93. Deleted</A>
+<LI><A HREF="#4.94">4.94. How do I get a single keypress without blocking?</A>
+<LI><A HREF="#4.95">4.95. Is there an equivalent to Perl chomp()? (Remove trailing newline from string)</A>
+<LI><A HREF="#4.96">4.96. Why is join() a string method when I'm really joining the elements of a (list, tuple, sequence)?</A>
+<LI><A HREF="#4.97">4.97. How can my code discover the name of an object?</A>
+<LI><A HREF="#4.98">4.98. Why are floating point calculations so inaccurate?</A>
+<LI><A HREF="#4.99">4.99. I tried to open Berkeley DB file, but bsddb produces bsddb.error: (22, 'Invalid argument'). Help! How can I restore my data?</A>
+<LI><A HREF="#4.100">4.100. What are the &quot;best practices&quot; for using import in a module?</A>
+<LI><A HREF="#4.101">4.101. Is there a tool to help find bugs or perform static analysis?</A>
+<LI><A HREF="#4.102">4.102. UnicodeError: ASCII [decoding,encoding] error: ordinal not in range(128)</A>
+<LI><A HREF="#4.103">4.103. Using strings to call functions/methods</A>
+<LI><A HREF="#4.104">4.104. How fast are exceptions?</A>
+<LI><A HREF="#4.105">4.105. Sharing global variables across modules</A>
+<LI><A HREF="#4.106">4.106. Why is cPickle so slow?</A>
+<LI><A HREF="#4.107">4.107. When importing module XXX, why do I get &quot;undefined symbol: PyUnicodeUCS2_...&quot; ?</A>
+<LI><A HREF="#4.108">4.108. How do I create a .pyc file?</A>
+
+</UL>
+
+<P>
+<HR>
+<H2>5. Extending Python</H2>
+<UL>
+<LI><A HREF="#5.1">5.1. Can I create my own functions in C?</A>
+<LI><A HREF="#5.2">5.2. Can I create my own functions in C++?</A>
+<LI><A HREF="#5.3">5.3. How can I execute arbitrary Python statements from C?</A>
+<LI><A HREF="#5.4">5.4. How can I evaluate an arbitrary Python expression from C?</A>
+<LI><A HREF="#5.5">5.5. How do I extract C values from a Python object?</A>
+<LI><A HREF="#5.6">5.6. How do I use Py_BuildValue() to create a tuple of arbitrary length?</A>
+<LI><A HREF="#5.7">5.7. How do I call an object's method from C?</A>
+<LI><A HREF="#5.8">5.8. How do I catch the output from PyErr_Print() (or anything that prints to stdout/stderr)?</A>
+<LI><A HREF="#5.9">5.9. How do I access a module written in Python from C?</A>
+<LI><A HREF="#5.10">5.10. How do I interface to C++ objects from Python?</A>
+<LI><A HREF="#5.11">5.11. mSQLmodule (or other old module) won't build with Python 1.5 (or later)</A>
+<LI><A HREF="#5.12">5.12. I added a module using the Setup file and the make fails! Huh?</A>
+<LI><A HREF="#5.13">5.13. I want to compile a Python module on my Red Hat Linux system, but some files are missing.</A>
+<LI><A HREF="#5.14">5.14. What does &quot;SystemError: _PyImport_FixupExtension: module yourmodule not loaded&quot; mean?</A>
+<LI><A HREF="#5.15">5.15. How to tell &quot;incomplete input&quot; from &quot;invalid input&quot;?</A>
+<LI><A HREF="#5.16">5.16. How do I debug an extension?</A>
+<LI><A HREF="#5.17">5.17. How do I find undefined Linux g++ symbols, __builtin_new or __pure_virtural</A>
+<LI><A HREF="#5.18">5.18. How do I define and create objects corresponding to built-in/extension types</A>
+
+</UL>
+
+<P>
+<HR>
+<H2>6. Python's design</H2>
+<UL>
+<LI><A HREF="#6.1">6.1. Why isn't there a switch or case statement in Python?</A>
+<LI><A HREF="#6.2">6.2. Why does Python use indentation for grouping of statements?</A>
+<LI><A HREF="#6.3">6.3. Why are Python strings immutable?</A>
+<LI><A HREF="#6.4">6.4. Delete</A>
+<LI><A HREF="#6.5">6.5. Why does Python use methods for some functionality (e.g. list.index()) but functions for other (e.g. len(list))?</A>
+<LI><A HREF="#6.6">6.6. Why can't I derive a class from built-in types (e.g. lists or files)?</A>
+<LI><A HREF="#6.7">6.7. Why must 'self' be declared and used explicitly in method definitions and calls?</A>
+<LI><A HREF="#6.8">6.8. Can't you emulate threads in the interpreter instead of relying on an OS-specific thread implementation?</A>
+<LI><A HREF="#6.9">6.9. Why can't lambda forms contain statements?</A>
+<LI><A HREF="#6.10">6.10. [deleted]</A>
+<LI><A HREF="#6.11">6.11. [deleted]</A>
+<LI><A HREF="#6.12">6.12. Why is there no more efficient way of iterating over a dictionary than first constructing the list of keys()?</A>
+<LI><A HREF="#6.13">6.13. Can Python be compiled to machine code, C or some other language?</A>
+<LI><A HREF="#6.14">6.14. How does Python manage memory?</A>
+<LI><A HREF="#6.15">6.15. Why are there separate tuple and list data types?</A>
+<LI><A HREF="#6.16">6.16. How are lists implemented?</A>
+<LI><A HREF="#6.17">6.17. How are dictionaries implemented?</A>
+<LI><A HREF="#6.18">6.18. Why must dictionary keys be immutable?</A>
+<LI><A HREF="#6.19">6.19. How the heck do you make an array in Python?</A>
+<LI><A HREF="#6.20">6.20. Why doesn't list.sort() return the sorted list?</A>
+<LI><A HREF="#6.21">6.21. How do you specify and enforce an interface spec in Python?</A>
+<LI><A HREF="#6.22">6.22. Why do all classes have the same type? Why do instances all have the same type?</A>
+<LI><A HREF="#6.23">6.23. Why isn't all memory freed when Python exits?</A>
+<LI><A HREF="#6.24">6.24. Why no class methods or mutable class variables?</A>
+<LI><A HREF="#6.25">6.25. Why are default values sometimes shared between objects?</A>
+<LI><A HREF="#6.26">6.26. Why no goto?</A>
+<LI><A HREF="#6.27">6.27. How do you make a higher order function in Python?</A>
+<LI><A HREF="#6.28">6.28. Why do I get a SyntaxError for a 'continue' inside a 'try'?</A>
+<LI><A HREF="#6.29">6.29. Why can't raw strings (r-strings) end with a backslash?</A>
+<LI><A HREF="#6.30">6.30. Why can't I use an assignment in an expression?</A>
+<LI><A HREF="#6.31">6.31. Why doesn't Python have a &quot;with&quot; statement like some other languages?</A>
+<LI><A HREF="#6.32">6.32. Why are colons required for if/while/def/class?</A>
+<LI><A HREF="#6.33">6.33. Can't we get rid of the Global Interpreter Lock?</A>
+
+</UL>
+
+<P>
+<HR>
+<H2>7. Using Python on non-UNIX platforms</H2>
+<UL>
+<LI><A HREF="#7.1">7.1. Is there a Mac version of Python?</A>
+<LI><A HREF="#7.2">7.2. Are there DOS and Windows versions of Python?</A>
+<LI><A HREF="#7.3">7.3. Is there an OS/2 version of Python?</A>
+<LI><A HREF="#7.4">7.4. Is there a VMS version of Python?</A>
+<LI><A HREF="#7.5">7.5. What about IBM mainframes, or other non-UNIX platforms?</A>
+<LI><A HREF="#7.6">7.6. Where are the source or Makefiles for the non-UNIX versions?</A>
+<LI><A HREF="#7.7">7.7. What is the status and support for the non-UNIX versions?</A>
+<LI><A HREF="#7.8">7.8. I have a PC version but it appears to be only a binary. Where's the library?</A>
+<LI><A HREF="#7.9">7.9. Where's the documentation for the Mac or PC version?</A>
+<LI><A HREF="#7.10">7.10. How do I create a Python program file on the Mac or PC?</A>
+<LI><A HREF="#7.11">7.11. How can I use Tkinter on Windows 95/NT?</A>
+<LI><A HREF="#7.12">7.12. cgi.py (or other CGI programming) doesn't work sometimes on NT or win95!</A>
+<LI><A HREF="#7.13">7.13. Why doesn't os.popen() work in PythonWin on NT?</A>
+<LI><A HREF="#7.14">7.14. How do I use different functionality on different platforms with the same program?</A>
+<LI><A HREF="#7.15">7.15. Is there an Amiga version of Python?</A>
+<LI><A HREF="#7.16">7.16. Why doesn't os.popen()/win32pipe.popen() work on Win9x?</A>
+
+</UL>
+
+<P>
+<HR>
+<H2>8. Python on Windows</H2>
+<UL>
+<LI><A HREF="#8.1">8.1. Using Python for CGI on Microsoft Windows</A>
+<LI><A HREF="#8.2">8.2. How to check for a keypress without blocking?</A>
+<LI><A HREF="#8.3">8.3. $PYTHONPATH</A>
+<LI><A HREF="#8.4">8.4. dedent syntax errors</A>
+<LI><A HREF="#8.5">8.5. How do I emulate os.kill() in Windows?</A>
+<LI><A HREF="#8.6">8.6. Why does os.path.isdir() fail on NT shared directories?</A>
+<LI><A HREF="#8.7">8.7. PyRun_SimpleFile() crashes on Windows but not on Unix</A>
+<LI><A HREF="#8.8">8.8. Import of _tkinter fails on Windows 95/98</A>
+<LI><A HREF="#8.9">8.9. Can't extract the downloaded documentation on Windows</A>
+<LI><A HREF="#8.10">8.10. Can't get Py_RunSimpleFile() to work.</A>
+<LI><A HREF="#8.11">8.11. Where is Freeze for Windows?</A>
+<LI><A HREF="#8.12">8.12. Is a *.pyd file the same as a DLL?</A>
+<LI><A HREF="#8.13">8.13. Missing cw3215mt.dll (or missing cw3215.dll)</A>
+<LI><A HREF="#8.14">8.14. How to make python scripts executable:</A>
+<LI><A HREF="#8.15">8.15. Warning about CTL3D32 version from installer</A>
+<LI><A HREF="#8.16">8.16. How can I embed Python into a Windows application?</A>
+<LI><A HREF="#8.17">8.17. Setting up IIS 5 to use Python for CGI</A>
+<LI><A HREF="#8.18">8.18. How do I run a Python program under Windows?</A>
+
+</UL>
+
+<HR>
+<H1>1. General information and availability</H1>
+
+<HR>
+<H2><A NAME="1.1">1.1. What is Python?</A></H2>
+Python is an interpreted, interactive, object-oriented programming
+language.  It incorporates modules, exceptions, dynamic typing, very
+high level dynamic data types, and classes.  Python combines
+remarkable power with very clear syntax.  It has interfaces to many
+system calls and libraries, as well as to various window systems, and
+is extensible in C or C++.  It is also usable as an extension language
+for applications that need a programmable interface.  Finally, Python
+is portable: it runs on many brands of UNIX, on the Mac, and on PCs
+under MS-DOS, Windows, Windows NT, and OS/2.
+<P>
+To find out more, the best thing to do is to start reading the
+tutorial from the documentation set (see a few questions further
+down).
+<P>
+See also question 1.17 (what is Python good for).
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq01.001.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq01.001.htp">Log info</A>
+
+/ Last changed on Mon May 26 16:05:18 1997 by
+<A HREF="mailto:guido@cnri.reston.va.us">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="1.2">1.2. Why is it called Python?</A></H2>
+Apart from being a computer scientist, I'm also a fan of "Monty
+Python's Flying Circus" (a BBC comedy series from the seventies, in
+the -- unlikely -- case you didn't know).  It occurred to me one day
+that I needed a name that was short, unique, and slightly mysterious.
+And I happened to be reading some scripts from the series at the
+time...  So then I decided to call my language Python.
+<P>
+By now I don't care any more whether you use a Python, some other
+snake, a foot or 16-ton weight, or a wood rat as a logo for Python!
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq01.002.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq01.002.htp">Log info</A>
+
+/ Last changed on Thu Aug 24 00:50:41 2000 by
+<A HREF="mailto:guido@beopen.com">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="1.3">1.3. How do I obtain a copy of the Python source?</A></H2>
+The latest Python source distribution is always available from
+python.org, at <A HREF="http://www.python.org/download">http://www.python.org/download</A>.  The latest development sources can be obtained via anonymous CVS from SourceForge, at <A HREF="http://www.sf.net/projects/python">http://www.sf.net/projects/python</A> .
+<P>
+The source distribution is a gzipped tar file containing the complete C source, LaTeX
+documentation, Python library modules, example programs, and several
+useful pieces of freely distributable software.  This will compile and
+run out of the box on most UNIX platforms.  (See section 7 for
+non-UNIX information.)
+<P>
+Older versions of Python are also available from python.org.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq01.003.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq01.003.htp">Log info</A>
+
+/ Last changed on Tue Apr  9 17:06:16 2002 by
+<A HREF="mailto:akuchlin@mems-exchange.org">A.M. Kuchling</A>
+<P>
+
+<HR>
+<H2><A NAME="1.4">1.4. How do I get documentation on Python?</A></H2>
+All documentation is available on-line, starting at <A HREF="http://www.python.org/doc">http://www.python.org/doc</A>/. 
+<P>
+The LaTeX source for the documentation is part of the source
+distribution.  If you don't have LaTeX, the latest Python
+documentation set is available, in various formats like postscript 
+and html, by anonymous ftp - visit the above URL for links to the
+current versions.
+<P>
+PostScript for a high-level description of Python is in the file nluug-paper.ps 
+(a separate file on the ftp site).
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq01.004.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq01.004.htp">Log info</A>
+
+/ Last changed on Wed Jan 21 12:02:55 1998 by
+<A HREF="mailto:klm@python.org">Ken Manheimer</A>
+<P>
+
+<HR>
+<H2><A NAME="1.5">1.5. Are there other ftp sites that mirror the Python distribution?</A></H2>
+The following anonymous ftp sites keep mirrors of the Python
+distribution:
+<P>
+USA:
+<P>
+<PRE>
+        <A HREF="ftp://ftp.python.org/pub/python">ftp://ftp.python.org/pub/python</A>/
+        <A HREF="ftp://gatekeeper.dec.com/pub/plan/python">ftp://gatekeeper.dec.com/pub/plan/python</A>/
+        <A HREF="ftp://ftp.uu.net/languages/python">ftp://ftp.uu.net/languages/python</A>/
+        <A HREF="ftp://ftp.wustl.edu/graphics/graphics/sgi-stuff/python">ftp://ftp.wustl.edu/graphics/graphics/sgi-stuff/python</A>/
+        <A HREF="ftp://ftp.sterling.com/programming/languages/python">ftp://ftp.sterling.com/programming/languages/python</A>/
+        <A HREF="ftp://uiarchive.cso.uiuc.edu/pub/lang/python">ftp://uiarchive.cso.uiuc.edu/pub/lang/python</A>/
+        <A HREF="ftp://ftp.pht.com/mirrors/python/python">ftp://ftp.pht.com/mirrors/python/python</A>/
+	<A HREF="ftp://ftp.cdrom.com/pub/python">ftp://ftp.cdrom.com/pub/python</A>/
+</PRE>
+Europe:
+<P>
+<PRE>
+        <A HREF="ftp://ftp.cwi.nl/pub/python">ftp://ftp.cwi.nl/pub/python</A>/
+        <A HREF="ftp://ftp.funet.fi/pub/languages/python">ftp://ftp.funet.fi/pub/languages/python</A>/
+        <A HREF="ftp://ftp.sunet.se/pub/lang/python">ftp://ftp.sunet.se/pub/lang/python</A>/
+        <A HREF="ftp://unix.hensa.ac.uk/mirrors/uunet/languages/python">ftp://unix.hensa.ac.uk/mirrors/uunet/languages/python</A>/
+        <A HREF="ftp://ftp.lip6.fr/pub/python">ftp://ftp.lip6.fr/pub/python</A>/
+        <A HREF="ftp://sunsite.cnlab-switch.ch/mirror/python">ftp://sunsite.cnlab-switch.ch/mirror/python</A>/
+        <A HREF="ftp://ftp.informatik.tu-muenchen.de/pub/comp/programming/languages/python">ftp://ftp.informatik.tu-muenchen.de/pub/comp/programming/languages/python</A>/
+</PRE>
+Australia:
+<P>
+<PRE>
+        <A HREF="ftp://ftp.dstc.edu.au/pub/python">ftp://ftp.dstc.edu.au/pub/python</A>/
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq01.005.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq01.005.htp">Log info</A>
+
+/ Last changed on Wed Mar 24 09:20:49 1999 by
+<A HREF="mailto:akuchlin@cnri.reston.va.us">A.M. Kuchling</A>
+<P>
+
+<HR>
+<H2><A NAME="1.6">1.6. Is there a newsgroup or mailing list devoted to Python?</A></H2>
+There is a newsgroup, comp.lang.python,
+and a mailing list.  The newsgroup and mailing list are gatewayed into
+each other -- if you can read news it's unnecessary to subscribe to
+the mailing list.  To subscribe to the mailing list
+(<A HREF="mailto:python-list@python.org">python-list@python.org</A>) visit its Mailman webpage at
+<A HREF="http://www.python.org/mailman/listinfo/python-list">http://www.python.org/mailman/listinfo/python-list</A>
+<P>
+More info about the newsgroup and mailing list, and about other lists,
+can be found at
+<A HREF="http://www.python.org/psa/MailingLists.html">http://www.python.org/psa/MailingLists.html</A>.
+<P>
+Archives of the newsgroup are kept by Deja News and accessible
+through the "Python newsgroup search" web page,
+<A HREF="http://www.python.org/search/search_news.html">http://www.python.org/search/search_news.html</A>.
+This page also contains pointer to other archival collections.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq01.006.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq01.006.htp">Log info</A>
+
+/ Last changed on Wed Jun 23 09:29:36 1999 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="1.7">1.7. Is there a WWW page devoted to Python?</A></H2>
+Yes, <A HREF="http://www.python.org">http://www.python.org</A>/ is the official Python home page.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq01.007.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq01.007.htp">Log info</A>
+
+/ Last changed on Fri May 23 14:42:59 1997 by
+<A HREF="mailto:klm@python.org">Ken Manheimer</A>
+<P>
+
+<HR>
+<H2><A NAME="1.8">1.8. Is the Python documentation available on the WWW?</A></H2>
+Yes. Python 2.0 documentation is available from
+<A HREF="http://www.pythonlabs.com/tech/python2.0/doc">http://www.pythonlabs.com/tech/python2.0/doc</A>/ and from
+<A HREF="http://www.python.org/doc">http://www.python.org/doc</A>/.  Note that most documentation
+is available for on-line browsing as well as for downloading.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq01.008.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq01.008.htp">Log info</A>
+
+/ Last changed on Tue Jan  2 03:14:08 2001 by
+<A HREF="mailto:moshez@zadka.site.co.il">Moshe Zadka</A>
+<P>
+
+<HR>
+<H2><A NAME="1.9">1.9. Are there any books on Python?</A></H2>
+Yes, many, and more are being published.  See
+the python.org Wiki at <A HREF="http://www.python.org/cgi-bin/moinmoin/PythonBooks">http://www.python.org/cgi-bin/moinmoin/PythonBooks</A> for a list.
+<P>
+You can also search online bookstores for "Python"
+(and filter out the Monty Python references; or
+perhaps search for "Python" and "language").
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq01.009.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq01.009.htp">Log info</A>
+
+/ Last changed on Mon Aug  5 19:08:49 2002 by
+<A HREF="mailto:akuchlin@mems-exchange.org">amk</A>
+<P>
+
+<HR>
+<H2><A NAME="1.10">1.10. Are there any published articles about Python that I can reference?</A></H2>
+If you can't reference the web site, and you don't want to reference the books
+(see previous question), there are several articles on Python that you could
+reference.
+<P>
+Most publications about Python are collected on the Python web site:
+<P>
+<PRE>
+    <A HREF="http://www.python.org/doc/Publications.html">http://www.python.org/doc/Publications.html</A>
+</PRE>
+It is no longer recommended to reference this
+very old article by Python's author:
+<P>
+<PRE>
+    Guido van Rossum and Jelke de Boer, "Interactively Testing Remote
+    Servers Using the Python Programming Language", CWI Quarterly, Volume
+    4, Issue 4 (December 1991), Amsterdam, pp 283-303.
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq01.010.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq01.010.htp">Log info</A>
+
+/ Last changed on Sat Jul  4 20:52:31 1998 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="1.11">1.11. Are there short introductory papers or talks on Python?</A></H2>
+There are several - you can find links to some of them collected at
+<A HREF="http://www.python.org/doc/Hints.html#intros">http://www.python.org/doc/Hints.html#intros</A>.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq01.011.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq01.011.htp">Log info</A>
+
+/ Last changed on Fri May 23 15:04:05 1997 by
+<A HREF="mailto:klm@python.org">Ken Manheimer</A>
+<P>
+
+<HR>
+<H2><A NAME="1.12">1.12. How does the Python version numbering scheme work?</A></H2>
+Python versions are numbered A.B.C or A.B.  A is the major version
+number -- it is only incremented for really major changes in the
+language.  B is the minor version number, incremented for less
+earth-shattering changes.  C is the micro-level -- it is
+incremented for each bugfix release.  See PEP 6 for more information
+about bugfix releases.
+<P>
+Not all releases have bugfix releases.
+Note that in the past (ending with 1.5.2),
+micro releases have added significant changes;
+in fact the changeover from 0.9.9 to 1.0.0 was the first time
+that either A or B changed!
+<P>
+Alpha, beta and release candidate versions have an additional suffixes.
+The suffix for an alpha version is "aN" for some small number N, the
+suffix for a beta version is "bN" for some small number N, and the
+suffix for a release candidate version is "cN" for some small number N.
+<P>
+Note that (for instance) all versions labeled 2.0aN precede the
+versions labeled 2.0bN, which precede versions labeled 2.0cN, and
+<I>those</I> precede 2.0.
+<P>
+As a rule, no changes are made between release candidates and the final
+release unless there are show-stopper bugs.
+<P>
+You may also find version numbers with a "+" suffix, e.g. "2.2+".
+These are unreleased versions, built directly from the CVS trunk.
+<P>
+See also the documentation for sys.version, sys.hexversion, and
+sys.version_info.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq01.012.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq01.012.htp">Log info</A>
+
+/ Last changed on Mon Jan 14 06:34:17 2002 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="1.13">1.13. How do I get a beta test version of Python?</A></H2>
+All releases, including alphas, betas and release candidates, are announced on
+comp.lang.python and comp.lang.python.announce newsgroups,
+which are gatewayed into the <A HREF="mailto:python-list@python.org">python-list@python.org</A> and
+<A HREF="mailto:python-announce@python.org">python-announce@python.org</A>. In addition, all these announcements appear on
+the Python home page, at <A HREF="http://www.python.org">http://www.python.org</A>.
+<P>
+You can also access the development version of Python through CVS.  See <A HREF="http://sourceforge.net/cvs/?group_id=5470">http://sourceforge.net/cvs/?group_id=5470</A> for details.  If you're not familiar with CVS, documents like <A HREF="http://linux.oreillynet.com/pub/a/linux/2002/01/03/cvs_intro.html">http://linux.oreillynet.com/pub/a/linux/2002/01/03/cvs_intro.html</A>
+provide an introduction.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq01.013.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq01.013.htp">Log info</A>
+
+/ Last changed on Mon Jun  3 00:57:08 2002 by
+<A HREF="mailto:neal@metaslash.com">Neal Norwitz</A>
+<P>
+
+<HR>
+<H2><A NAME="1.14">1.14. Are there copyright restrictions on the use of Python?</A></H2>
+Hardly.  You can do anything you want with the source, as long as
+you leave the copyrights in, and display those copyrights in any
+documentation about Python that you produce.  Also, don't use the
+author's institute's name in publicity without prior written
+permission, and don't hold them responsible for anything (read the
+actual copyright for a precise legal wording).
+<P>
+In particular, if you honor the copyright rules, it's OK to use Python
+for commercial use, to sell copies of Python in source or binary form,
+or to sell products that enhance Python or incorporate Python (or part
+of it) in some form.  I would still like to know about all commercial
+use of Python!
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq01.014.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq01.014.htp">Log info</A>
+<P>
+
+<HR>
+<H2><A NAME="1.15">1.15. Why was Python created in the first place?</A></H2>
+Here's a <I>very</I> brief summary of what got me started:
+<P>
+I had extensive experience with implementing an interpreted language
+in the ABC group at CWI, and from working with this group I had
+learned a lot about language design.  This is the origin of many
+Python features, including the use of indentation for statement
+grouping and the inclusion of very-high-level data types (although the
+details are all different in Python).
+<P>
+I had a number of gripes about the ABC language, but also liked many
+of its features.  It was impossible to extend the ABC language (or its
+implementation) to remedy my complaints -- in fact its lack of
+extensibility was one of its biggest problems.
+I had some experience with using Modula-2+ and talked with the
+designers of Modula-3 (and read the M3 report).  M3 is the origin of
+the syntax and semantics used for exceptions, and some other Python
+features.
+<P>
+I was working in the Amoeba distributed operating system group at
+CWI.  We needed a better way to do system administration than by
+writing either C programs or Bourne shell scripts, since Amoeba had
+its own system call interface which wasn't easily accessible from the
+Bourne shell.  My experience with error handling in Amoeba made me
+acutely aware of the importance of exceptions as a programming
+language feature.
+<P>
+It occurred to me that a scripting language with a syntax like ABC
+but with access to the Amoeba system calls would fill the need.  I
+realized that it would be foolish to write an Amoeba-specific
+language, so I decided that I needed a language that was generally
+extensible.
+<P>
+During the 1989 Christmas holidays, I had a lot of time on my hand,
+so I decided to give it a try.  During the next year, while still
+mostly working on it in my own time, Python was used in the Amoeba
+project with increasing success, and the feedback from colleagues made
+me add many early improvements.
+<P>
+In February 1991, after just over a year of development, I decided
+to post to USENET.  The rest is in the Misc/HISTORY file.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq01.015.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq01.015.htp">Log info</A>
+
+/ Last changed on Fri May 23 00:06:23 1997 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="1.16">1.16. Do I have to like &quot;Monty Python's Flying Circus&quot;?</A></H2>
+No, but it helps.  Pythonistas like the occasional reference to SPAM,
+and of course, nobody expects the Spanish Inquisition
+<P>
+The two main reasons to use Python are:
+<P>
+<PRE>
+ - Portable
+ - Easy to learn
+</PRE>
+The <I>three</I> main reasons to use Python are:
+<P>
+<PRE>
+ - Portable
+ - Easy to learn
+ - Powerful standard library
+</PRE>
+(And nice red uniforms.)
+<P>
+And remember, there is <I>no</I> rule six.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq01.016.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq01.016.htp">Log info</A>
+
+/ Last changed on Wed May 28 10:39:21 1997 by
+<A HREF="mailto:guido@cnri.reston.va.us">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="1.17">1.17. What is Python good for?</A></H2>
+Python is used in many situations where a great deal of dynamism,
+ease of use, power, and flexibility are required.  
+<P>
+In the area of basic text
+manipulation core Python (without any non-core extensions) is easier
+to use and is roughly as fast as just  about any language, and this makes Python
+good for many system administration type tasks and for CGI programming
+and other application areas that manipulate text and strings and such.
+<P>
+When augmented with
+standard extensions (such as PIL, COM, Numeric, oracledb, kjbuckets, 
+tkinter, win32api, etc.)
+or special purpose extensions (that you write, perhaps using helper tools such
+as SWIG, or using object protocols such as ILU/CORBA or COM) Python 
+becomes a very convenient "glue" or "steering"
+language that helps make heterogeneous collections of unrelated
+software packages work together.
+For example by combining Numeric with oracledb you can help your
+SQL database do statistical analysis, or even Fourier transforms.
+One of the features that makes Python excel in the "glue language" role
+is Python's simple, usable, and powerful C language runtime API.
+<P>
+Many developers also use Python extensively as a graphical user
+interface development aide.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq01.017.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq01.017.htp">Log info</A>
+
+/ Last changed on Sat May 24 10:13:11 1997 by
+<A HREF="mailto:aaron_watters@msn.com">Aaron Watters</A>
+<P>
+
+<HR>
+<H2><A NAME="1.18">1.18. Can I use the FAQ Wizard software to maintain my own FAQ?</A></H2>
+Sure.  It's in Tools/faqwiz/ of the python source tree.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq01.018.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq01.018.htp">Log info</A>
+
+/ Last changed on Fri Mar 29 06:50:32 2002 by
+<A HREF="mailto:aahz@pythoncraft.com">Aahz</A>
+<P>
+
+<HR>
+<H2><A NAME="1.19">1.19. Which editor has good support for editing Python source code?</A></H2>
+On Unix, the first choice is Emacs/XEmacs.  There's an elaborate
+mode for editing Python code, which is available from the Python
+source distribution (Misc/python-mode.el).  It's also bundled
+with XEmacs (we're still working on legal details to make it possible
+to bundle it with FSF Emacs).  And it has its own web page:
+<P>
+<PRE>
+    <A HREF="http://www.python.org/emacs/python-mode/index.html">http://www.python.org/emacs/python-mode/index.html</A>
+</PRE>
+There are many other choices, for Unix, Windows or Macintosh.
+Richard Jones compiled a table from postings on the Python newsgroup:
+<P>
+<PRE>
+    <A HREF="http://www.bofh.asn.au/~richard/editors.html">http://www.bofh.asn.au/~richard/editors.html</A>
+</PRE>
+See also FAQ question 7.10 for some more Mac and Win options.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq01.019.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq01.019.htp">Log info</A>
+
+/ Last changed on Mon Jun 15 23:21:04 1998 by
+<A HREF="mailto:guido@python.org">Gvr</A>
+<P>
+
+<HR>
+<H2><A NAME="1.20">1.20. I've never programmed before. Is there a Python tutorial?</A></H2>
+There are several, and at least one book.  
+All information for beginning Python programmers is collected here:
+<P>
+<PRE>
+    <A HREF="http://www.python.org/doc/Newbies.html">http://www.python.org/doc/Newbies.html</A>
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq01.020.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq01.020.htp">Log info</A>
+
+/ Last changed on Wed Sep  5 05:34:07 2001 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="1.21">1.21. Where in the world is www.python.org located?</A></H2>
+It's currently in Amsterdam, graciously hosted by XS4ALL:
+<P>
+<PRE>
+    <A HREF="http://www.xs4all.nl">http://www.xs4all.nl</A>
+</PRE>
+Thanks to Thomas Wouters for setting this up!!!!
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq01.021.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq01.021.htp">Log info</A>
+
+/ Last changed on Fri Aug  3 21:49:27 2001 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H1>2. Python in the real world</H1>
+
+<HR>
+<H2><A NAME="2.1">2.1. How many people are using Python?</A></H2>
+Certainly thousands, and quite probably tens of thousands of users.
+More are seeing the light each day.  The comp.lang.python newsgroup is
+very active, but overall there is no accurate estimate of the number of subscribers or Python users.
+<P>
+Jacek Artymiak has created a Python Users Counter; you can see the 
+current count by visiting
+<A HREF="http://www.wszechnica.safenet.pl/cgi-bin/checkpythonuserscounter.py">http://www.wszechnica.safenet.pl/cgi-bin/checkpythonuserscounter.py</A>
+(this will not increment the counter; use the link there if you haven't
+added yourself already). Most Python users appear not to have registered themselves.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq02.001.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq02.001.htp">Log info</A>
+
+/ Last changed on Thu Feb 21 23:29:18 2002 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="2.2">2.2. Have any significant projects been done in Python?</A></H2>
+At CWI (the former home of Python), we have written a 20,000 line
+authoring environment for transportable hypermedia presentations, a
+5,000 line multimedia teleconferencing tool, as well as many many
+smaller programs.
+<P>
+At CNRI (Python's new home), we have written two large applications:
+Grail, a fully featured web browser (see
+<A HREF="http://grail.cnri.reston.va.us">http://grail.cnri.reston.va.us</A>),
+and the Knowbot Operating Environment,
+a distributed environment for mobile code.
+<P>
+The University of Virginia uses Python to control a virtual reality
+engine.  See <A HREF="http://alice.cs.cmu.edu">http://alice.cs.cmu.edu</A>.
+<P>
+The ILU project at Xerox PARC can generate Python glue for ILU
+interfaces.  See <A HREF="ftp://ftp.parc.xerox.com/pub/ilu/ilu.html">ftp://ftp.parc.xerox.com/pub/ilu/ilu.html</A>.  ILU
+is a free CORBA compliant ORB which supplies distributed object
+connectivity to a host of platforms using a host of languages.
+<P>
+Mark Hammond and Greg Stein and others are interfacing Python to
+Microsoft's COM and ActiveX architectures.  This means, among other
+things, that Python may be used in active server pages or as a COM
+controller (for example to automatically extract from or insert information
+into Excel or MSAccess or any other COM aware application).
+Mark claims Python can even be a ActiveX scripting host (which
+means you could embed JScript inside a Python application, if you
+had a strange sense of humor).  Python/AX/COM is distributed as part
+of the PythonWin distribution.
+<P>
+The University of California, Irvine uses a student administration
+system called TELE-Vision written entirely in Python.  Contact: Ray
+Price <A HREF="mailto:rlprice@uci.edu">rlprice@uci.edu</A>.
+<P>
+The Melbourne Cricket Ground (MCG) in Australia (a 100,000+ person venue)
+has it's scoreboard system written largely in Python on MS Windows.
+Python expressions are used to create almost every scoring entry that
+appears on the board.  The move to Python/C++ away from exclusive C++
+has provided a level of functionality that would simply not have been
+viable otherwise.
+<P>
+See also the next question.
+<P>
+Note: this FAQ entry is really old.
+See <A HREF="http://www.python.org/psa/Users.html">http://www.python.org/psa/Users.html</A> for a more recent list.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq02.002.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq02.002.htp">Log info</A>
+
+/ Last changed on Wed Oct 25 13:24:15 2000 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="2.3">2.3. Are there any commercial projects going on using Python?</A></H2>
+Yes, there's lots of commercial activity using Python.  See
+<A HREF="http://www.python.org/psa/Users.html">http://www.python.org/psa/Users.html</A> for a list.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq02.003.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq02.003.htp">Log info</A>
+
+/ Last changed on Wed Oct 14 18:17:33 1998 by
+<A HREF="mailto:klm@python.org">ken</A>
+<P>
+
+<HR>
+<H2><A NAME="2.4">2.4. How stable is Python?</A></H2>
+Very stable.  New, stable releases have been coming out roughly every 3 to 12 months since 1991, and this seems likely to continue.
+<P>
+With the introduction of retrospective "bugfix" releases the stability of the language implementations can be, and is being, improved independently of the new features offered by more recent major or minor releases. Bugfix releases, indicated by a third component of the version number, only fix known problems and do not gratuitously introduce new and possibly incompatible features or modified library functionality.
+<P>
+Release 2.2 got its first bugfix on April 10, 2002. The new version
+number is now 2.2.1. The 2.1 release, at 2.1.3, can probably be
+considered the "most stable" platform because it has been bugfixed
+twice.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq02.004.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq02.004.htp">Log info</A>
+
+/ Last changed on Tue Jul 23 10:20:04 2002 by
+<A HREF="mailto:kubieziel@gmx.de">Jens Kubieziel</A>
+<P>
+
+<HR>
+<H2><A NAME="2.5">2.5. What new developments are expected for Python in the future?</A></H2>
+See <A HREF="http://www.python.org/peps">http://www.python.org/peps</A>/ for the Python Enhancement 
+Proposals (PEPs). PEPs are design
+documents 
+describing a  suggested new feature for Python, providing
+a concise technical specification and a rationale.
+<P>
+Also, follow the discussions on the python-dev mailing list.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq02.005.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq02.005.htp">Log info</A>
+
+/ Last changed on Tue Apr  9 17:09:51 2002 by
+<A HREF="mailto:akuchlin@mems-exchange.org">A.M. Kuchling</A>
+<P>
+
+<HR>
+<H2><A NAME="2.6">2.6. Is it reasonable to propose incompatible changes to Python?</A></H2>
+In general, no.  There are already millions of lines of Python code
+around the world, so any changes in the language that invalidates more
+than a very small fraction of existing programs has to be frowned
+upon.  Even if you can provide a conversion program, there still is
+the problem of updating all documentation.  Providing a gradual
+upgrade path is the only way if a feature has to be changed.
+<P>
+See <A HREF="http://www.python.org/peps/pep-0005.html">http://www.python.org/peps/pep-0005.html</A> for the proposed
+mechanism for creating backwards-incompatibilities.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq02.006.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq02.006.htp">Log info</A>
+
+/ Last changed on Mon Apr  1 22:13:47 2002 by
+<A HREF="mailto:fdrake@acm.org">Fred Drake</A>
+<P>
+
+<HR>
+<H2><A NAME="2.7">2.7. What is the future of Python?</A></H2>
+Please see <A HREF="http://www.python.org/peps">http://www.python.org/peps</A>/ for proposals of future
+activities. One of the PEPs (Python Enhancement Proposals) deals
+with the PEP process and PEP format -- see
+<A HREF="http://www.python.org/peps/pep-0001.html">http://www.python.org/peps/pep-0001.html</A> if you want to
+submit a PEP. In <A HREF="http://www.python.org/peps/pep-0042.html">http://www.python.org/peps/pep-0042.html</A> there
+is a list of wishlists the Python Development team plans to tackle.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq02.007.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq02.007.htp">Log info</A>
+
+/ Last changed on Mon Apr  1 22:15:46 2002 by
+<A HREF="mailto:fdrake@acm.org">Fred Drake</A>
+<P>
+
+<HR>
+<H2><A NAME="2.8">2.8. What was the PSA, anyway?</A></H2>
+The Python Software Activity was
+created by a number of Python aficionados who want Python to be more
+than the product and responsibility of a single individual.
+The PSA was not an independent organization, but lived
+under the umbrealla of CNRI.
+<P>
+The PSA has been superseded by the Python Software Foundation,
+an independent non-profit organization.  The PSF's home page
+is at <A HREF="http://www.python.org/psf">http://www.python.org/psf</A>/.
+<P>
+Some pages created by the PSA still live at
+<A HREF="http://www.python.org/psa">http://www.python.org/psa</A>/
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq02.008.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq02.008.htp">Log info</A>
+
+/ Last changed on Thu Jul 25 18:19:44 2002 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="2.9">2.9. Deleted</A></H2>
+<P>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq02.009.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq02.009.htp">Log info</A>
+
+/ Last changed on Tue Jan  2 02:51:30 2001 by
+<A HREF="mailto:moshez@zadka.site.co.il">Moshe Zadka</A>
+<P>
+
+<HR>
+<H2><A NAME="2.10">2.10. Deleted</A></H2>
+<P>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq02.010.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq02.010.htp">Log info</A>
+
+/ Last changed on Tue Jan  2 02:52:19 2001 by
+<A HREF="mailto:moshez@zadka.site.co.il">Moshe Zadka</A>
+<P>
+
+<HR>
+<H2><A NAME="2.11">2.11. Is Python Y2K (Year 2000) Compliant?</A></H2>
+As of January, 2001 no major problems have been reported and Y2K
+compliance seems to be a non-issue.
+<P>
+Since Python is available free of charge, there are no absolute
+guarantees.  If there <I>are</I> unforeseen problems, liability is the
+user's rather than the developers', and there is nobody you can sue for damages.
+<P>
+Python does few 
+date manipulations, and what it does is all based on the Unix
+representation for time (even on non-Unix systems) which uses seconds
+since 1970 and won't overflow until 2038.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq02.011.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq02.011.htp">Log info</A>
+
+/ Last changed on Mon Jan  8 17:19:32 2001 by
+<A HREF="mailto:sholden@holdenweb.com">Steve Holden</A>
+<P>
+
+<HR>
+<H2><A NAME="2.12">2.12. Is Python a good language in a class for beginning programmers?</A></H2>
+Yes.  This long answer attempts to address any concerns you might
+have with teaching Python as a programmer's first language.  
+(If you want to discuss Python's use in education, then 
+you may be interested in joining the edu-sig mailinglist.
+See <A HREF="http://www.python.org/sigs/edu-sig">http://www.python.org/sigs/edu-sig</A>/ )
+<P>
+It is still common to start students with a procedural
+(subset of a) statically typed language such as Pascal, C, or
+a subset of C++ or Java.  I think that students may be better
+served by learning Python as their first language.  Python has
+a very simple and consistent syntax and a large standard library.
+Most importantly, using Python in a beginning programming course
+permits students to concentrate on important programming skills,
+such as problem decomposition and data type design.
+<P>
+With Python, students can be quickly introduced to basic concepts
+such as loops and procedures.  They can even probably work with
+user-defined objects in their very first course.  They could
+implement a tree structure as nested Python lists, for example.
+They could be introduced to objects in their first course if
+desired.  For a student who has never programmed before, using
+a statically typed language seems unnatural.  It presents
+additional complexity that the student must master and slows
+the pace of the course.  The students are trying to learn to
+think like a computer, decompose problems, design consistent
+interfaces, and encapsulate data.  While learning to use a
+statically typed language is important, it is not necessarily the
+best topic to address in the students' first programming course.
+<P>
+Many other aspects of Python make it a good first language.
+Python has a large standard library (like Java) so that
+students can be assigned programming projects very early in the
+course that <I>do</I> something.  Assignments aren't restricted to the
+standard four-function calculator and check balancing programs.
+By using the standard library, students can gain the satisfaction
+of working on realistic applications as they learn the fundamentals
+of programming.  Using the standard library also teaches students
+about code reuse.
+<P>
+Python's interactive interpreter also enables students to
+test language features while they're programming.  They can keep
+a window with the interpreter running while they enter their
+programs' source in another window.  If they can't remember the
+methods for a list, they can do something like this:
+<P>
+<PRE>
+ >>> L = []
+ >>> dir(L)
+ ['append', 'count', 'extend', 'index', 'insert', 'pop', 'remove',
+ 'reverse', 'sort']
+ >>> print L.append.__doc__
+ L.append(object) -- append object to end
+ >>> L.append(1)
+ >>> L
+ [1]
+</PRE>
+With the interpreter, documentation is never far from the
+student as he's programming.
+<P>
+There are also good IDEs for Python.  Guido van Rossum's IDLE
+is a cross-platform IDE for Python that is written in Python
+using Tk.  There is also a Windows specific IDE called PythonWin.
+Emacs users will be happy to know that there is a very good Python
+mode for Emacs.  All of these programming environments provide
+syntax highlighting, auto-indenting, and access to the interactive
+interpreter while coding.  For more information about IDEs, see XXX.
+<P>
+If your department is currently using Pascal because it was
+designed to be a teaching language, then you'll be happy to
+know that Guido van Rossum designed Python to be simple to
+teach to everyone but powerful enough to implement real world
+applications.  Python makes a good language for first time
+programmers because that was one of Python's design goals.
+There are papers at <A HREF="http://www.python.org/doc/essays">http://www.python.org/doc/essays</A>/ on the Python website 
+by Python's creator explaining his objectives for the language.
+One that may interest you is titled "Computer Programming for Everybody" 
+<A HREF="http://www.python.org/doc/essays/cp4e.html">http://www.python.org/doc/essays/cp4e.html</A>
+<P>
+If you're seriously considering Python as a language for your
+school,  Guido van Rossum may even be willing to correspond with
+you about how the language would fit in your curriculum.
+See <A HREF="http://www.python.org/doc/FAQ.html#2.2">http://www.python.org/doc/FAQ.html#2.2</A> for examples of
+Python's use in the "real world."
+<P>
+While Python, its source code, and its IDEs are freely
+available, this consideration should not rule 
+out other languages.  There are other free languages (Java, 
+free C compilers), and many companies are willing to waive some
+or all of their fees for student programming tools if it
+guarantees that a whole graduating class will know how to
+use their tools.  That is, if one of the requirements for 
+the language that will be taught is that it be freely 
+available, then Python qualifies, but this requirement 
+does not preclude other languages.
+<P>
+While Python jobs may not be as prevalent as C/C++/Java jobs,
+teachers should not worry about teaching students critical job
+skills in their first course.  The skills that win students a
+job are those they learn in their senior classes and internships.
+Their first programming courses are there to lay a solid
+foundation in programming fundamentals.  The primary question
+in choosing the language for such a course should be which
+language permits the students to learn this material without
+hindering or limiting them.
+<P>
+Another argument for Python is that there are many tasks for
+which something like C++ is overkill.  That's where languages
+like Python, Perl, Tcl, and Visual Basic thrive.  It's critical
+for students to know something about these languages.   (Every
+employer for whom I've worked used at least one such language.)
+Of the languages listed above, Python probably makes the best
+language in a programming curriculum since its syntax is simple,
+consistent, and not unlike other languages (C/C++/Java) that
+are probably in the curriculum.  By starting students with
+Python, a department simultaneously lays the foundations for
+other programming courses and introduces students to the type
+of language that is often used as a "glue" language.  As an
+added bonus, Python can be used to interface with Microsoft's
+COM components (thanks to Mark Hammond).  There is also Jython, 
+a Java implementation of the Python interpreter, that can be 
+used to connect Java components.
+<P>
+If you currently start students with Pascal or C/C++ or Java,
+you may be worried they will have trouble learning a statically
+typed language after starting with Python.  I think that this
+fear most often stems from the fact that the teacher started
+with a statically typed language, and we tend to like to teach
+others in the same way we were taught.  In reality, the
+transition from Python to one of these other languages is
+quite simple.
+<P>
+To motivate a statically typed language such as C++, begin the
+course by explaining that unlike Python, their first language,
+C++ is compiled to a machine dependent executable.  Explain
+that the point is to make a very fast executable.  To permit
+the compiler to make optimizations, programmers must help it
+by specifying the "types" of variables.  By restricting each
+variable to a specific type, the compiler can reduce the
+book-keeping it has to do to permit dynamic types.  The compiler
+also has to resolve references at compile time.  Thus, the
+language gains speed by sacrificing some of Python's dynamic
+features.  Then again, the C++ compiler provides type safety
+and catches many bugs at compile time instead of run time (a
+critical consideration for many commercial applications).  C++
+is also designed for very large programs where one may want to
+guarantee that others don't touch an object's implementation.
+C++ provides very strong language features to separate an object's
+implementation from its interface.  Explain why this separation
+is a good thing.
+<P>
+The first day of a C++ course could then be a whirlwind introduction
+to what C++ requires and provides.  The point here is that after
+a semester or two of Python, students are hopefully competent
+programmers.  They know how to handle loops and write procedures.
+They've also worked with objects, thought about the benefits of
+consistent interfaces, and used the technique of subclassing to
+specialize behavior.  Thus, a whirlwind introduction to C++ could
+show them how objects and subclassing looks in C++.  The
+potentially difficult concepts of object-oriented design were
+taught without the additional obstacles presented by a language
+such as C++ or Java.  When learning one of these languages,
+the students would already understand the "road map."  They
+understand objects; they would just be learning how objects
+fit in a statically typed languages.  Language requirements
+and compiler errors that seem unnatural to beginning programmers
+make sense in this new context.  Many students will find it
+helpful to be able to write a fast prototype of their algorithms
+in Python.  Thus, they can test and debug their ideas before
+they attempt to write the code in the new language, saving the
+effort of working with C++ types for when they've discovered a
+working solution for their assignments.  When they get annoyed
+with the rigidity of types, they'll be happy to learn about
+containers and templates to regain some of the lost flexibility
+Python afforded them.  Students may also gain an appreciation
+for the fact that no language is best for every task.  They'll
+see that C++ is faster, but they'll know that they can gain
+flexibility and development speed with a Python when execution
+speed isn't critical.
+<P>
+If you have any concerns that weren't addressed here, try
+posting to the Python newsgroup.  Others there have done some
+work with using Python as an instructional tool.  Good luck.
+We'd love to hear about it if you choose Python for your course.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq02.012.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq02.012.htp">Log info</A>
+
+/ Last changed on Mon Dec  2 19:32:35 2002 by
+<A HREF="mailto:sconce@in-spec-inc.com">Bill Sconce</A>
+<P>
+
+<HR>
+<H1>3. Building Python and Other Known Bugs</H1>
+
+<HR>
+<H2><A NAME="3.1">3.1. Is there a test set?</A></H2>
+Sure.  You can run it after building with "make test", or you can
+run it manually with this command at the Python prompt:
+<P>
+<PRE>
+ import test.autotest
+</PRE>
+In Python 1.4 or earlier, use
+<P>
+<PRE>
+ import autotest
+</PRE>
+The test set doesn't test <I>all</I> features of Python,
+but it goes a long way to confirm that Python is actually working.
+<P>
+NOTE: if "make test" fails, don't just mail the output to the
+newsgroup -- this doesn't give enough information to debug the
+problem.  Instead, find out which test fails, and run that test
+manually from an interactive interpreter.  For example, if
+"make test" reports that test_spam fails, try this interactively:
+<P>
+<PRE>
+ import test.test_spam
+</PRE>
+This generally produces more verbose output which can be diagnosed
+to debug the problem.  If you find a bug in Python or the libraries, or in the tests, please report this in the Python bug tracker at SourceForge:
+<P>
+<A HREF="http://sourceforge.net/tracker/?func=add&amp;group_id=5470&amp;atid=105470">http://sourceforge.net/tracker/?func=add&amp;group_id=5470&amp;atid=105470</A>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq03.001.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq03.001.htp">Log info</A>
+
+/ Last changed on Fri Apr 27 10:29:36 2001 by
+<A HREF="mailto:fdrake@acm.org">Fred Drake</A>
+<P>
+
+<HR>
+<H2><A NAME="3.2">3.2. When running the test set, I get complaints about floating point operations, but when playing with floating point operations I cannot find anything wrong with them.</A></H2>
+The test set makes occasional unwarranted assumptions about the
+semantics of C floating point operations.  Until someone donates a
+better floating point test set, you will have to comment out the
+offending floating point tests and execute similar tests manually.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq03.002.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq03.002.htp">Log info</A>
+<P>
+
+<HR>
+<H2><A NAME="3.3">3.3. Link errors after rerunning the configure script.</A></H2>
+It is generally necessary to run "make clean" after a configuration
+change.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq03.003.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq03.003.htp">Log info</A>
+<P>
+
+<HR>
+<H2><A NAME="3.4">3.4. The python interpreter complains about options passed to a script (after the script name).</A></H2>
+You are probably linking with GNU getopt, e.g. through -liberty.
+Don't.  The reason for the complaint is that GNU getopt, unlike System
+V getopt and other getopt implementations, doesn't consider a
+non-option to be the end of the option list.  A quick (and compatible)
+fix for scripts is to add "--" to the interpreter, like this:
+<P>
+<PRE>
+        #! /usr/local/bin/python --
+</PRE>
+You can also use this interactively:
+<P>
+<PRE>
+        python -- script.py [options]
+</PRE>
+Note that a working getopt implementation is provided in the Python
+distribution (in Python/getopt.c) but not automatically used.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq03.004.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq03.004.htp">Log info</A>
+<P>
+
+<HR>
+<H2><A NAME="3.5">3.5. When building on the SGI, make tries to run python to create glmodule.c, but python hasn't been built or installed yet.</A></H2>
+Comment out the line mentioning glmodule.c in Setup and build a
+python without gl first; install it or make sure it is in your $PATH,
+then edit the Setup file again to turn on the gl module, and make
+again.  You don't need to do "make clean"; you do need to run "make
+Makefile" in the Modules subdirectory (or just run "make" at the
+toplevel).
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq03.005.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq03.005.htp">Log info</A>
+<P>
+
+<HR>
+<H2><A NAME="3.6">3.6. I use VPATH but some targets are built in the source directory.</A></H2>
+On some systems (e.g. Sun), if the target already exists in the
+source directory, it is created there instead of in the build
+directory.  This is usually because you have previously built without
+VPATH.  Try running "make clobber" in the source directory.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq03.006.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq03.006.htp">Log info</A>
+<P>
+
+<HR>
+<H2><A NAME="3.7">3.7. Trouble building or linking with the GNU readline library.</A></H2>
+You can use the GNU readline library to improve the interactive user
+interface: this gives you line editing and command history when
+calling python interactively. Its sources are distributed with 
+Python (at least for 2.0).  Uncomment the line 
+<P>
+#readline readline.c -lreadline -ltermcap
+<P>
+in Modules/Setup.  The configuration option --with-readline 
+is no longer supported, at least in Python 2.0.  Some hints on 
+building and using the readline library:
+On SGI IRIX 5, you may have to add the following
+to rldefs.h:
+<P>
+<PRE>
+        #ifndef sigmask
+        #define sigmask(sig) (1L &lt;&lt; ((sig)-1))
+        #endif
+</PRE>
+On some systems, you will have to add #include "rldefs.h" to the
+top of several source files, and if you use the VPATH feature, you
+will have to add dependencies of the form foo.o: foo.c to the
+Makefile for several values of foo.
+The readline library requires use of the termcap library. A
+known problem with this is that it contains entry points which
+cause conflicts with the STDWIN and SGI GL libraries. The STDWIN
+conflict can be solved by adding a line saying '#define werase w_erase' to the
+stdwin.h file (in the STDWIN distribution, subdirectory H). The
+GL conflict has been solved in the Python configure script by a
+hack that forces use of the static version of the termcap library.
+Check the newsgroup gnu.bash.bug news:gnu.bash.bug for
+specific problems with the readline library (I don't read this group
+but I've been told that it is the place for readline bugs).
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq03.007.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq03.007.htp">Log info</A>
+
+/ Last changed on Sat Dec  2 18:23:48 2000 by
+<A HREF="mailto:trotts@llnl.gov">Issac Trotts</A>
+<P>
+
+<HR>
+<H2><A NAME="3.8">3.8. Trouble with socket I/O on older Linux 1.x versions.</A></H2>
+Once you've built Python, use it to run the regen script in the
+Lib/plat-linux2 directory.  Apparently the files as distributed don't match the system headers on some Linux versions.
+<P>
+Note that this FAQ entry only applies to Linux kernel versions 1.x.y;
+these are hardly around any more.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq03.008.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq03.008.htp">Log info</A>
+
+/ Last changed on Tue Jul 30 20:05:52 2002 by
+<A HREF="mailto:kubieziel@gmx.de">Jens Kubieziel</A>
+<P>
+
+<HR>
+<H2><A NAME="3.9">3.9. Trouble with prototypes on Ultrix.</A></H2>
+Ultrix cc seems broken -- use gcc, or edit config.h to #undef
+HAVE_PROTOTYPES.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq03.009.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq03.009.htp">Log info</A>
+<P>
+
+<HR>
+<H2><A NAME="3.10">3.10. Other trouble building Python on platform X.</A></H2>
+Please submit the details to the SourceForge bug tracker:
+<P>
+<PRE>
+  <A HREF="http://sourceforge.net/tracker/?group_id=5470&amp;atid=105470">http://sourceforge.net/tracker/?group_id=5470&amp;atid=105470</A>
+</PRE>
+and we'll look
+into it.  Please provide as many details as possible.  In particular,
+if you don't tell us what type of computer and what operating system
+(and version) you are using it will be difficult for us to figure out
+what is the matter.  If you have compilation output logs,
+please use file uploads -- don't paste everything in the message box.
+<P>
+In many cases, we won't have access to the same hardware or operating system version, so <I>please</I>, if you have a SourceForge account, log in before filing your report, or if you don't have an account, include an email address at which we can reach you for further questions.  Logging in to SourceForge first will also cause SourceForge to send you updates as we act on your report.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq03.010.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq03.010.htp">Log info</A>
+
+/ Last changed on Fri Apr 27 10:53:18 2001 by
+<A HREF="mailto:fdrake@acm.org">Fred Drake</A>
+<P>
+
+<HR>
+<H2><A NAME="3.11">3.11. How to configure dynamic loading on Linux.</A></H2>
+This is now automatic as long as your Linux version uses the ELF
+object format (all recent Linuxes do).
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq03.011.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq03.011.htp">Log info</A>
+<P>
+
+<HR>
+<H2><A NAME="3.12">3.12. I can't get shared modules to work on Linux 2.0 (Slackware96)?</A></H2>
+This is a bug in the Slackware96 release. The fix is simple: Make sure
+that there is a link from /lib/libdl.so to /lib/libdl.so.1 so that the
+following links are setup: /lib/libdl.so -&gt; /lib/libdl.so.1
+/lib/libdl.so.1 -&gt; /lib/libdl.so.1.7.14 You may have to rerun the
+configure script, after rm'ing the config.cache file, before you
+attempt to rebuild python after this fix.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq03.012.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq03.012.htp">Log info</A>
+
+/ Last changed on Wed May 21 15:45:03 1997 by
+<A HREF="mailto:guido2@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="3.13">3.13. Trouble when making modules shared on Linux.</A></H2>
+This happens when you have built Python for static linking and then
+enable
+<PRE>
+  *shared*
+</PRE>
+in the Setup file.  Shared library code must be
+compiled with "-fpic".  If a .o file for the module already exist that
+was compiled for static linking, you must remove it or do "make clean"
+in the Modules directory.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq03.013.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq03.013.htp">Log info</A>
+
+/ Last changed on Fri May 23 13:42:30 1997 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="3.14">3.14. [deleted]</A></H2>
+[ancient information on threads on linux (when thread support
+was not standard) used to be here]
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq03.014.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq03.014.htp">Log info</A>
+
+/ Last changed on Sun Jun  2 17:27:13 2002 by
+<A HREF="mailto:erno-pyfaq@erno.iki.fi">Erno Kuusela</A>
+<P>
+
+<HR>
+<H2><A NAME="3.15">3.15. Errors when linking with a shared library containing C++ code.</A></H2>
+Link the main Python binary with C++.  Change the definition of
+LINKCC in Modules/Makefile to be your C++ compiler.  You may have to
+edit config.c slightly to make it compilable with C++.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq03.015.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq03.015.htp">Log info</A>
+<P>
+
+<HR>
+<H2><A NAME="3.16">3.16. Deleted</A></H2>
+<P>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq03.016.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq03.016.htp">Log info</A>
+
+/ Last changed on Tue Sep 11 16:02:22 2001 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="3.17">3.17. Deleted.</A></H2>
+<P>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq03.017.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq03.017.htp">Log info</A>
+
+/ Last changed on Tue Sep 11 15:54:57 2001 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="3.18">3.18. Compilation or link errors for the _tkinter module</A></H2>
+Most likely, there's a version mismatch between the Tcl/Tk header
+files (tcl.h and tk.h) and the Tcl/Tk libraries you are using e.g.
+"-ltk8.0" and "-ltcl8.0" arguments for _tkinter in the Setup file).
+It is possible to install several versions of the Tcl/Tk libraries,
+but there can only be one version of the tcl.h and tk.h header
+files.  If the library doesn't match the header, you'll get
+problems, either when linking the module, or when importing it.
+Fortunately, the version number is clearly stated in each file,
+so this is easy to find.  Reinstalling and using the latest
+version usually fixes the problem.
+<P>
+(Also note that when compiling unpatched Python 1.5.1 against
+Tcl/Tk 7.6/4.2 or older, you get an error on Tcl_Finalize.  See
+the 1.5.1 patch page at <A HREF="http://www.python.org/1.5/patches-1.5.1">http://www.python.org/1.5/patches-1.5.1</A>/.)
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq03.018.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq03.018.htp">Log info</A>
+
+/ Last changed on Thu Jun 11 00:49:14 1998 by
+<A HREF="mailto:guido@python.org">Gvr</A>
+<P>
+
+<HR>
+<H2><A NAME="3.19">3.19. I configured and built Python for Tcl/Tk but &quot;import Tkinter&quot; fails.</A></H2>
+Most likely, you forgot to enable the line in Setup that says
+"TKPATH=:$(DESTLIB)/tkinter".
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq03.019.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq03.019.htp">Log info</A>
+<P>
+
+<HR>
+<H2><A NAME="3.20">3.20. [deleted]</A></H2>
+[ancient information on a gcc+tkinter bug on alpha was here]
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq03.020.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq03.020.htp">Log info</A>
+
+/ Last changed on Mon Jun  3 16:46:23 2002 by
+<A HREF="mailto:erno-pyfaq@erno.iki.fi">Erno Kuusela</A>
+<P>
+
+<HR>
+<H2><A NAME="3.21">3.21. Several common system calls are missing from the posix module.</A></H2>
+Most likely, <I>all</I> test compilations run by the configure script
+are failing for some reason or another.  Have a look in config.log to
+see what could be the reason.  A common reason is specifying a
+directory to the --with-readline option that doesn't contain the
+libreadline.a file.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq03.021.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq03.021.htp">Log info</A>
+<P>
+
+<HR>
+<H2><A NAME="3.22">3.22. ImportError: No module named string, on MS Windows.</A></H2>
+Most likely, your PYTHONPATH environment variable should be set to
+something like:
+<P>
+set PYTHONPATH=c:\python;c:\python\lib;c:\python\scripts
+<P>
+(assuming Python was installed in c:\python)
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq03.022.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq03.022.htp">Log info</A>
+<P>
+
+<HR>
+<H2><A NAME="3.23">3.23. Core dump on SGI when using the gl module.</A></H2>
+There are conflicts between entry points in the termcap and curses
+libraries and an entry point in the GL library.  There's a hack of a
+fix for the termcap library if it's needed for the GNU readline
+library, but it doesn't work when you're using curses.  Concluding,
+you can't build a Python binary containing both the curses and gl
+modules.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq03.023.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq03.023.htp">Log info</A>
+<P>
+
+<HR>
+<H2><A NAME="3.24">3.24. &quot;Initializer not a constant&quot; while building DLL on MS-Windows</A></H2>
+Static type object initializers in extension modules may cause compiles to
+fail with an error message like "initializer not a constant".  
+Fredrik Lundh &lt;<A HREF="mailto:Fredrik.Lundh@image.combitech.se">Fredrik.Lundh@image.combitech.se</A>&gt; explains:
+<P>
+This shows up when building DLL under MSVC.  There's two ways to
+address this: either compile the module as C++, or change your code to
+something like:
+<P>
+<PRE>
+  statichere PyTypeObject bstreamtype = {
+      PyObject_HEAD_INIT(NULL) /* must be set by init function */
+      0,
+      "bstream",
+      sizeof(bstreamobject),
+</PRE>
+<PRE>
+  ...
+</PRE>
+<PRE>
+  void
+  initbstream()
+  {
+      /* Patch object type */
+      bstreamtype.ob_type = &amp;PyType_Type;
+      Py_InitModule("bstream", functions);
+      ...
+  }
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq03.024.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq03.024.htp">Log info</A>
+
+/ Last changed on Sun May 25 14:58:05 1997 by
+<A HREF="mailto:aaron_watters@msn.com">Aaron Watters</A>
+<P>
+
+<HR>
+<H2><A NAME="3.25">3.25. Output directed to a pipe or file disappears on Linux.</A></H2>
+Some people have reported that when they run their script
+interactively, it runs great, but that when they redirect it
+to a pipe or file, no output appears.
+<P>
+<PRE>
+    % python script.py
+    ...some output...
+    % python script.py >file
+    % cat file
+    % # no output
+    % python script.py | cat
+    % # no output
+    %
+</PRE>
+This was a bug in Linux kernel. It is fixed and should not appear anymore. So most Linux users are <I>not</I> affected by this.
+<P>
+If redirection doesn't work on your Linux system, check what shell you are using. Shells like (t)csh doesn't support redirection.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq03.025.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq03.025.htp">Log info</A>
+
+/ Last changed on Thu Jan 16 13:38:30 2003 by
+<A HREF="mailto:kubieziel@gmx.de">Jens Kubieziel</A>
+<P>
+
+<HR>
+<H2><A NAME="3.26">3.26. [deleted]</A></H2>
+[ancient libc/linux problem was here]
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq03.026.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq03.026.htp">Log info</A>
+
+/ Last changed on Mon Jun  3 16:48:08 2002 by
+<A HREF="mailto:erno-pyfaq@erno.iki.fi">Erno Kuusela</A>
+<P>
+
+<HR>
+<H2><A NAME="3.27">3.27. [deleted]</A></H2>
+[ancient linux + threads + tk problem was described here]
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq03.027.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq03.027.htp">Log info</A>
+
+/ Last changed on Mon Jun  3 16:49:08 2002 by
+<A HREF="mailto:erno-pyfaq@erno.iki.fi">Erno Kuusela</A>
+<P>
+
+<HR>
+<H2><A NAME="3.28">3.28. How can I test if Tkinter is working?</A></H2>
+Try the following:
+<P>
+<PRE>
+  python
+  >>> import _tkinter
+  >>> import Tkinter
+  >>> Tkinter._test()
+</PRE>
+This should pop up a window with two buttons,
+one "Click me" and one "Quit".
+<P>
+If the first statement (import _tkinter) fails, your Python
+installation probably has not been configured to support Tcl/Tk.
+On Unix, if you have installed Tcl/Tk, you have to rebuild Python
+after editing the Modules/Setup file to enable the _tkinter module
+and the TKPATH environment variable.
+<P>
+It is also possible to get complaints about Tcl/Tk version
+number mismatches or missing TCL_LIBRARY or TK_LIBRARY
+environment variables.  These have to do with Tcl/Tk installation
+problems.
+<P>
+A common problem is to have installed versions of tcl.h and tk.h
+that don't match the installed version of the Tcl/Tk libraries;
+this usually results in linker errors or (when using dynamic
+loading) complaints about missing symbols during loading
+the shared library.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq03.028.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq03.028.htp">Log info</A>
+
+/ Last changed on Thu Aug 28 17:01:46 1997 by
+<A HREF="mailto:guido@python.org">Guido van Rossum</A>
+<P>
+
+<HR>
+<H2><A NAME="3.29">3.29. Is there a way to get the interactive mode of the python interpreter to perform function/variable name completion?</A></H2>
+(From a posting by Guido van Rossum)
+<P>
+On Unix, if you have enabled the readline module (i.e. if Emacs-style
+command line editing and bash-style history works for you), you can
+add this by importing the undocumented standard library module
+"rlcompleter".  When completing a simple identifier, it
+completes keywords, built-ins and globals in __main__; when completing
+NAME.NAME..., it evaluates (!) the expression up to the last dot and
+completes its attributes.
+<P>
+This way, you can do "import string", type "string.", hit the
+completion key twice, and see the list of names defined by the
+string module.
+<P>
+Tip: to use the tab key as the completion key, call
+<P>
+<PRE>
+    readline.parse_and_bind("tab: complete")
+</PRE>
+You can put this in a ~/.pythonrc file, and set the PYTHONSTARTUP
+environment variable to ~/.pythonrc.  This will cause the completion to be enabled
+whenever you run Python interactively.  
+<P>
+Notes (see the docstring for rlcompleter.py for more information):
+<P>
+* The evaluation of the NAME.NAME... form may cause arbitrary 
+application defined code to be executed if an object with a
+__getattr__ hook is found.  Since it is the responsibility of the
+application (or the user) to enable this feature, I consider this an
+acceptable risk.  More complicated expressions (e.g. function calls or
+indexing operations) are <I>not</I> evaluated.
+<P>
+* GNU readline is also used by the built-in functions input() and
+raw_input(), and thus these also benefit/suffer from the complete
+features.  Clearly an interactive application can benefit by
+specifying its own completer function and using raw_input() for all
+its input.
+<P>
+* When stdin is not a tty device, GNU readline is never
+used, and this module (and the readline module) are silently inactive.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq03.029.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq03.029.htp">Log info</A>
+
+/ Last changed on Fri Jun 12 09:55:24 1998 by
+<A HREF="mailto:akuchlin@cnri.reston.va.us">A.M. Kuchling</A>
+<P>
+
+<HR>
+<H2><A NAME="3.30">3.30. Why is the Python interpreter not built as a shared library?</A></H2>
+(This is a Unix question; on Mac and Windows, it <I>is</I> a shared
+library.)
+<P>
+It's just a nightmare to get this to work on all different platforms.
+Shared library portability is a pain.  And yes, I know about GNU libtool
+-- but it requires me to use its conventions for filenames etc, and it 
+would require a complete and utter rewrite of all the makefile and
+config tools I'm currently using.
+<P>
+In practice, few applications embed Python -- it's much more common to
+have Python extensions, which already are shared libraries.  Also,
+serious embedders often want total control over which Python version
+and configuration they use so they wouldn't want to use a standard
+shared library anyway.  So while the motivation of saving space
+when lots of apps embed Python is nice in theory, I
+doubt that it will save much in practice.  (Hence the low priority I
+give to making a shared library.)
+<P>
+For Linux systems, the simplest method of producing libpython1.5.so seems to 
+be (originally from the Minotaur project web page,  
+<A HREF="http://www.equi4.com/minotaur/minotaur.html">http://www.equi4.com/minotaur/minotaur.html</A>): 
+<P>
+<PRE>
+  make distclean 
+  ./configure 
+  make OPT="-fpic -O2" 
+  mkdir .extract 
+  (cd .extract; ar xv ../libpython1.5.a) 
+  gcc -shared -o libpython1.5.so .extract/*.o 
+  rm -rf .extract
+</PRE>
+In Python 2.3 this will be supported by the standard build routine
+(at least on Linux) with --enable-shared.  Note however that there
+is little advantage, and it slows down Python because of the need
+for PIC code and the extra cost at startup time to find the library.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq03.030.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq03.030.htp">Log info</A>
+
+/ Last changed on Thu May 30 13:36:55 2002 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="3.31">3.31. Build with GCC on Solaris 2.6 (SunOS 5.6) fails</A></H2>
+If you have upgraded Solaris 2.5 or 2.5.1 to Solaris 2.6,
+but you have not upgraded
+your GCC installation, the compile may fail, e.g. like this:
+<P>
+<PRE>
+ In file included from /usr/include/sys/stream.h:26,
+                  from /usr/include/netinet/in.h:38,
+                  from /usr/include/netdb.h:96,
+                  from ./socketmodule.c:121:
+ /usr/include/sys/model.h:32: #error "No DATAMODEL_NATIVE specified"
+</PRE>
+Solution: rebuild GCC for Solaris 2.6. 
+You might be able to simply re-run fixincludes, but
+people have had mixed success with doing that.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq03.031.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq03.031.htp">Log info</A>
+
+/ Last changed on Wed Oct 21 11:18:46 1998 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="3.32">3.32. Running &quot;make clean&quot; seems to leave problematic files that cause subsequent builds to fail.</A></H2>
+Use "make clobber" instead.  
+<P>
+Use "make clean" to reduce the size of the source/build directory
+after you're happy with your build and installation.
+If you have already tried to build python and you'd like to start 
+over, you should use "make clobber".  It does a "make clean" and also 
+removes files such as the partially built Python library from a previous build.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq03.032.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq03.032.htp">Log info</A>
+
+/ Last changed on Thu Jun 24 20:39:26 1999 by
+<A HREF="mailto:tbryan@python.net">TAB</A>
+<P>
+
+<HR>
+<H2><A NAME="3.33">3.33. Submitting bug reports and patches</A></H2>
+To report a bug or submit a patch, please use the relevant service
+from the Python project at SourceForge.
+<P>
+Bugs: <A HREF="http://sourceforge.net/tracker/?group_id=5470&amp;atid=105470">http://sourceforge.net/tracker/?group_id=5470&amp;atid=105470</A>
+<P>
+Patches: <A HREF="http://sourceforge.net/tracker/?group_id=5470&amp;atid=305470">http://sourceforge.net/tracker/?group_id=5470&amp;atid=305470</A>
+<P>
+If you have a SourceForge account, please log in before submitting your bug report; this will make it easier for us to contact you regarding your report in the event we have follow-up questions.  It will also enable SourceForge to send you update information as we act on your bug.  If you do not have a SourceForge account, please consider leaving your name and email address as part of the report.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq03.033.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq03.033.htp">Log info</A>
+
+/ Last changed on Fri Apr 27 10:58:26 2001 by
+<A HREF="mailto:fdrake@acm.org">Fred Drake</A>
+<P>
+
+<HR>
+<H2><A NAME="3.34">3.34. I can't load shared libraries under Python 1.5.2, Solaris 7, and gcc 2.95.2</A></H2>
+When trying to load shared libraries, you may see errors like:
+ImportError: ld.so.1: python: fatal: relocation error: file /usr/local/lib/python1.5/site-packages/Perp/util/du_SweepUtilc.so:
+<PRE>
+ symbol PyExc_RuntimeError: referenced symbol not found
+</PRE>
+<P>
+There is a problem with the configure script for Python 1.5.2
+under Solaris 7 with gcc 2.95 .  configure should set the make variable
+LINKFORSHARED=-Xlinker -export-dynamic
+<P>
+<P>
+in Modules/Makefile, 
+<P>
+Manually add this line to the Modules/Makefile.
+This builds a Python executable that can load shared library extensions (xxx.so) .
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq03.034.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq03.034.htp">Log info</A>
+
+/ Last changed on Mon Feb 19 10:37:05 2001 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="3.35">3.35. In the regression test, test___all__ fails for the profile module. What's wrong?</A></H2>
+If you have been using the profile module, and have properly calibrated a copy of the module as described in the documentation for the profiler:
+<P>
+<A HREF="http://www.python.org/doc/current/lib/profile-calibration.html">http://www.python.org/doc/current/lib/profile-calibration.html</A>
+<P>
+then it is possible that the regression test "test___all__" will fail if you run the regression test manually rather than using "make test" in the Python source directory.  This will happen if you have set your PYTHONPATH environment variable to include the directory containing your calibrated profile module.  You have probably calibrated the profiler using an older version of the profile module which does not define the __all__ value, added to the module as of Python 2.1.
+<P>
+The problem can be fixed by removing the old calibrated version of the profile module and using the latest version to do a fresh calibration. In general, you will need to re-calibrate for each version of Python anyway, since the performance characteristics can change in subtle ways that impact profiling.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq03.035.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq03.035.htp">Log info</A>
+
+/ Last changed on Fri Apr 27 10:44:10 2001 by
+<A HREF="mailto:fdrake@acm.org">Fred Drake</A>
+<P>
+
+<HR>
+<H2><A NAME="3.36">3.36. relocations remain against allocatable but non-writable sections</A></H2>
+This linker error occurs on Solaris if you attempt to build an extension module which incorporates position-dependent (non-PIC) code. A common source of problems is that a static library (.a file), such as libreadline.a or libcrypto.a is linked with the extension module. The error specifically occurs when using gcc as the compiler, but /usr/ccs/bin/ld as the linker.
+<P>
+The following solutions and work-arounds are known:
+<P>
+1. Rebuild the libraries (libreadline, libcrypto) with -fPIC (-KPIC if using the system compiler). This is recommended; all object files in a shared library should be position-independent.
+<P>
+2. Statically link the extension module and its libraries into the Python interpreter, by editing Modules/Setup.
+<P>
+3. Use GNU ld instead of /usr/ccs/bin/ld; GNU ld will accept non-PIC code in shared libraries (and mark the section writable)
+<P>
+4. Pass -mimpure-text to GCC when linking the module. This will force gcc to not pass -z text to ld; in turn, ld will make all text sections writable.
+<P>
+Options 3 and 4 are not recommended, since the ability to share code across processes is lost.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq03.036.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq03.036.htp">Log info</A>
+
+/ Last changed on Tue Jan 29 12:05:11 2002 by
+<A HREF="mailto:loewis@informatik.hu-berlin.de">Martin v. Löwis</A>
+<P>
+
+<HR>
+<H1>4. Programming in Python</H1>
+
+<HR>
+<H2><A NAME="4.1">4.1. Is there a source code level debugger with breakpoints, step, etc.?</A></H2>
+Yes.  
+<P>
+Module pdb is a rudimentary but adequate console-mode debugger for Python. It is part of the standard Python library, and is documented in the Library Reference Manual. (You can also write your own debugger by using the code for pdb as an example.)
+<P>
+The IDLE interactive development environment, which is part of the standard Python distribution (normally available in Tools/idle), includes a graphical debugger.  There is documentation for the IDLE debugger at <A HREF="http://www.python.org/idle/doc/idle2.html#Debugger">http://www.python.org/idle/doc/idle2.html#Debugger</A>
+<P>
+Pythonwin is a Python IDE that includes a GUI debugger based on bdb.  The Pythonwin debugger colors breakpoints and has quite a few cool features (including debugging non-Pythonwin programs).  A reference can be found at <A HREF="http://www.python.org/ftp/python/pythonwin/pwindex.html">http://www.python.org/ftp/python/pythonwin/pwindex.html</A>
+More recent versions of PythonWin are available as a part of the ActivePython distribution (see   <A HREF="http://www.activestate.com/Products/ActivePython/index.html">http://www.activestate.com/Products/ActivePython/index.html</A>).
+<P>
+Pydb is a version of the standard Python debugger pdb, modified for use with DDD (Data Display Debugger), a popular graphical debugger front end.  Pydb can be found at  <A HREF="http://packages.debian.org/unstable/devel/pydb.html">http://packages.debian.org/unstable/devel/pydb.html</A>
+and DDD can be found at <A HREF="http://www.gnu.org/software/ddd">http://www.gnu.org/software/ddd</A>/
+<P>
+There are a number of commmercial Python IDEs that include graphical debuggers.  They include:
+<P>
+<PRE>
+ * Wing IDE (<A HREF="http://wingide.com">http://wingide.com</A>/) 
+ * Komodo IDE (<A HREF="http://www.activestate.com/Products/Komodo">http://www.activestate.com/Products/Komodo</A>/)
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.001.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.001.htp">Log info</A>
+
+/ Last changed on Tue Jan 28 01:43:41 2003 by
+<A HREF="mailto:steve@ferg.org">Stephen Ferg</A>
+<P>
+
+<HR>
+<H2><A NAME="4.2">4.2. Can I create an object class with some methods implemented in C and others in Python (e.g. through inheritance)? (Also phrased as: Can I use a built-in type as base class?)</A></H2>
+In Python 2.2, you can inherit from builtin classes such as int, list, dict, etc.
+<P>
+In previous versions of Python, you can easily create a Python class which serves as a wrapper around a built-in object, e.g. (for dictionaries):
+<P>
+<PRE>
+        # A user-defined class behaving almost identical
+        # to a built-in dictionary.
+        class UserDict:
+                def __init__(self): self.data = {}
+                def __repr__(self): return repr(self.data)
+                def __cmp__(self, dict):
+                        if type(dict) == type(self.data):
+                                return cmp(self.data, dict)
+                        else:
+                                return cmp(self.data, dict.data)
+                def __len__(self): return len(self.data)
+                def __getitem__(self, key): return self.data[key]
+                def __setitem__(self, key, item): self.data[key] = item
+                def __delitem__(self, key): del self.data[key]
+                def keys(self): return self.data.keys()
+                def items(self): return self.data.items()
+                def values(self): return self.data.values()
+                def has_key(self, key): return self.data.has_key(key)
+</PRE>
+A2. See Jim Fulton's ExtensionClass for an example of a mechanism
+which allows you to have superclasses which you can inherit from in
+Python -- that way you can have some methods from a C superclass (call
+it a mixin) and some methods from either a Python superclass or your
+subclass.  ExtensionClass is distributed as a part of Zope (see
+<A HREF="http://www.zope.org">http://www.zope.org</A>), but will be phased out with Zope 3, since
+Zope 3 uses Python 2.2 or later which supports direct inheritance
+from built-in types.  Here's a link to the original paper about
+ExtensionClass:
+<A HREF="http://debian.acm.ndsu.nodak.edu/doc/python-extclass/ExtensionClass.html">http://debian.acm.ndsu.nodak.edu/doc/python-extclass/ExtensionClass.html</A>
+<P>
+A3. The Boost Python Library (BPL, <A HREF="http://www.boost.org/libs/python/doc/index.html">http://www.boost.org/libs/python/doc/index.html</A>)
+provides a way of doing this from C++ (i.e. you can inherit from an
+extension class written in C++ using the BPL).
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.002.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.002.htp">Log info</A>
+
+/ Last changed on Tue May 28 21:09:52 2002 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="4.3">4.3. Is there a curses/termcap package for Python?</A></H2>
+The standard Python source distribution comes with a curses module in
+the Modules/ subdirectory, though it's not compiled by default (note
+that this is not available in the Windows distribution -- there is
+no curses module for Windows).
+<P>
+In Python versions before 2.0 the module only supported plain curses; 
+you couldn't use ncurses features like colors with it (though it would 
+link with ncurses).
+<P>
+In Python 2.0, the curses module has been greatly extended, starting 
+from Oliver Andrich's enhanced version, to provide many additional 
+functions from ncurses and SYSV curses, such as colour, alternative
+character set support, pads, and mouse support. This means the
+module is no longer compatible with operating systems that only
+have BSD curses, but there don't seem to be any currently
+maintained OSes that fall into this category.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.003.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.003.htp">Log info</A>
+
+/ Last changed on Sun Jun 23 20:24:06 2002 by
+<A HREF="mailto:tim.one@comcast.net">Tim Peters</A>
+<P>
+
+<HR>
+<H2><A NAME="4.4">4.4. Is there an equivalent to C's onexit() in Python?</A></H2>
+For Python 2.0: The new atexit module provides a register function that
+is similar to C's onexit. See the Library Reference for details. For
+2.0 you should <I>not</I> assign to sys.exitfunc!
+<P>
+For Python 1.5.2: You need to import sys and assign a function to 
+sys.exitfunc, it will be called when your program exits, is 
+killed by an unhandled exception, or (on UNIX) receives a 
+SIGHUP or SIGTERM signal.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.004.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.004.htp">Log info</A>
+
+/ Last changed on Thu Dec 28 12:14:55 2000 by
+<A HREF="mailto:pbjorn@uswest.net">Bjorn Pettersen</A>
+<P>
+
+<HR>
+<H2><A NAME="4.5">4.5. [deleted]</A></H2>
+[python used to lack nested scopes, it was explained here]
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.005.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.005.htp">Log info</A>
+
+/ Last changed on Thu Mar 21 05:18:22 2002 by
+<A HREF="mailto:erno-pyfaq@erno.iki.fi">Erno Kuusela</A>
+<P>
+
+<HR>
+<H2><A NAME="4.6">4.6. How do I iterate over a sequence in reverse order?</A></H2>
+If it is a list, the fastest solution is
+<P>
+<PRE>
+        list.reverse()
+        try:
+                for x in list:
+                        "do something with x"
+        finally:
+                list.reverse()
+</PRE>
+This has the disadvantage that while you are in the loop, the list
+is temporarily reversed.  If you don't like this, you can make a copy.
+This appears expensive but is actually faster than other solutions:
+<P>
+<PRE>
+        rev = list[:]
+        rev.reverse()
+        for x in rev:
+                &lt;do something with x&gt;
+</PRE>
+If it's not a list, a more general but slower solution is:
+<P>
+<PRE>
+        for i in range(len(sequence)-1, -1, -1):
+                x = sequence[i]
+                &lt;do something with x&gt;
+</PRE>
+A more elegant solution, is to define a class which acts as a sequence
+and yields the elements in reverse order (solution due to Steve
+Majewski):
+<P>
+<PRE>
+        class Rev:
+                def __init__(self, seq):
+                        self.forw = seq
+                def __len__(self):
+                        return len(self.forw)
+                def __getitem__(self, i):
+                        return self.forw[-(i + 1)]
+</PRE>
+You can now simply write:
+<P>
+<PRE>
+        for x in Rev(list):
+                &lt;do something with x&gt;
+</PRE>
+Unfortunately, this solution is slowest of all, due to the method
+call overhead...
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.006.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.006.htp">Log info</A>
+
+/ Last changed on Sun May 25 21:10:50 1997 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="4.7">4.7. My program is too slow. How do I speed it up?</A></H2>
+That's a tough one, in general.  There are many tricks to speed up
+Python code; I would consider rewriting parts in C only as a last
+resort.  One thing to notice is that function and (especially) method
+calls are rather expensive; if you have designed a purely OO interface
+with lots of tiny functions that don't do much more than get or set an
+instance variable or call another method, you may consider using a
+more direct way, e.g. directly accessing instance variables.  Also see
+the standard module "profile" (described in the Library Reference
+manual) which makes it possible to find out where
+your program is spending most of its time (if you have some patience
+-- the profiling itself can slow your program down by an order of
+magnitude).
+<P>
+Remember that many standard optimization heuristics you
+may know from other programming experience may well apply
+to Python.  For example it may be faster to send output to output
+devices using larger writes rather than smaller ones in order to
+avoid the overhead of kernel system calls.  Thus CGI scripts
+that write all output in "one shot" may be notably faster than
+those that write lots of small pieces of output.
+<P>
+Also, be sure to use "aggregate" operations where appropriate.
+For example the "slicing" feature allows programs to chop up
+lists and other sequence objects in a single tick of the interpreter
+mainloop using highly optimized C implementations.  Thus to 
+get the same effect as
+<P>
+<PRE>
+  L2 = []
+  for i in range[3]:
+       L2.append(L1[i])
+</PRE>
+it is much shorter and far faster to use
+<P>
+<PRE>
+  L2 = list(L1[:3]) # "list" is redundant if L1 is a list.
+</PRE>
+Note that the map() function, particularly used with
+builtin methods or builtin functions can be a convenient
+accelerator.  For example to pair the elements of two
+lists together:
+<P>
+<PRE>
+  >>> map(None, [1,2,3], [4,5,6])
+  [(1, 4), (2, 5), (3, 6)]
+</PRE>
+or to compute a number of sines:
+<P>
+<PRE>
+  >>> map( math.sin, (1,2,3,4))
+  [0.841470984808, 0.909297426826, 0.14112000806,   -0.756802495308]
+</PRE>
+The map operation completes very quickly in such cases.
+<P>
+Other examples of aggregate operations include the join and split
+methods of string objects.  For example if s1..s7 are large (10K+) strings then
+"".join([s1,s2,s3,s4,s5,s6,s7]) may be far faster than
+the more obvious s1+s2+s3+s4+s5+s6+s7, since the "summation"
+will compute many subexpressions, whereas join does all
+copying in one pass.  For manipulating strings also consider the 
+regular expression libraries and the "substitution" operations
+String % tuple and String % dictionary.  Also be sure to use
+the list.sort builtin method to do sorting, and see FAQ's 4.51
+and 4.59 for examples of moderately advanced usage -- list.sort beats
+other techniques for sorting in all but the most extreme
+circumstances.
+<P>
+There are many other aggregate operations
+available in the standard libraries and in contributed libraries
+and extensions.
+<P>
+Another common trick is to "push loops into functions or methods."
+For example suppose you have a program that runs slowly and you
+use the profiler (profile.run) to determine that a Python function ff
+is being called lots of times.  If you notice that ff 
+<P>
+<PRE>
+   def ff(x):
+       ...do something with x computing result...
+       return result
+</PRE>
+tends to be called in loops like (A)
+<P>
+<PRE>
+   list = map(ff, oldlist)
+</PRE>
+or (B)
+<P>
+<PRE>
+   for x in sequence:
+       value = ff(x)
+       ...do something with value...
+</PRE>
+then you can often eliminate function call overhead by rewriting
+ff to
+<P>
+<PRE>
+   def ffseq(seq):
+       resultseq = []
+       for x in seq:
+           ...do something with x computing result...
+           resultseq.append(result)
+       return resultseq
+</PRE>
+and rewrite (A) to
+<P>
+<PRE>
+    list = ffseq(oldlist)
+</PRE>
+and (B) to
+<P>
+<PRE>
+    for value in ffseq(sequence):
+        ...do something with value...
+</PRE>
+Other single calls ff(x) translate to ffseq([x])[0] with little
+penalty.  Of course this technique is not always appropriate
+and there are other variants, which you can figure out.
+<P>
+You can gain some performance by explicitly storing the results of
+a function or method lookup into a local variable.  A loop like
+<P>
+<PRE>
+    for key in token:
+        dict[key] = dict.get(key, 0) + 1
+</PRE>
+resolves dict.get every iteration.  If the method isn't going to
+change, a faster implementation is
+<P>
+<PRE>
+    dict_get = dict.get  # look up the method once
+    for key in token:
+        dict[key] = dict_get(key, 0) + 1
+</PRE>
+Default arguments can be used to determine values once, at
+compile time instead of at run time.  This can only be done for
+functions or objects which will not be changed during program
+execution, such as replacing
+<P>
+<PRE>
+    def degree_sin(deg):
+        return math.sin(deg * math.pi / 180.0)
+</PRE>
+with
+<P>
+<PRE>
+    def degree_sin(deg, factor = math.pi/180.0, sin = math.sin):
+        return sin(deg * factor)
+</PRE>
+Because this trick uses default arguments for terms which should
+not be changed, it should only be used when you are not concerned
+with presenting a possibly confusing API to your users.
+<P>
+<P>
+For an anecdote related to optimization, see
+<P>
+<PRE>
+	<A HREF="http://www.python.org/doc/essays/list2str.html">http://www.python.org/doc/essays/list2str.html</A>
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.007.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.007.htp">Log info</A>
+
+/ Last changed on Mon Jun  3 01:03:54 2002 by
+<A HREF="mailto:neal@metaslash.com">Neal Norwitz</A>
+<P>
+
+<HR>
+<H2><A NAME="4.8">4.8. When I have imported a module, then edit it, and import it again (into the same Python process), the changes don't seem to take place. What is going on?</A></H2>
+For reasons of efficiency as well as consistency, Python only reads
+the module file on the first time a module is imported.  (Otherwise a
+program consisting of many modules, each of which imports the same
+basic module, would read the basic module over and over again.)  To
+force rereading of a changed module, do this:
+<P>
+<PRE>
+        import modname
+        reload(modname)
+</PRE>
+Warning: this technique is not 100% fool-proof.  In particular,
+modules containing statements like
+<P>
+<PRE>
+        from modname import some_objects
+</PRE>
+will continue to work with the old version of the imported objects.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.008.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.008.htp">Log info</A>
+<P>
+
+<HR>
+<H2><A NAME="4.9">4.9. How do I find the current module name?</A></H2>
+A module can find out its own module name by looking at the
+(predefined) global variable __name__.  If this has the value
+'__main__' you are running as a script.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.009.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.009.htp">Log info</A>
+<P>
+
+<HR>
+<H2><A NAME="4.10">4.10. I have a module in which I want to execute some extra code when it is run as a script. How do I find out whether I am running as a script?</A></H2>
+See the previous question.  E.g. if you put the following on the
+last line of your module, main() is called only when your module is
+running as a script:
+<P>
+<PRE>
+        if __name__ == '__main__': main()
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.010.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.010.htp">Log info</A>
+<P>
+
+<HR>
+<H2><A NAME="4.11">4.11. I try to run a program from the Demo directory but it fails with ImportError: No module named ...; what gives?</A></H2>
+This is probably an optional module (written in C!) which hasn't
+been configured on your system.  This especially happens with modules
+like "Tkinter", "stdwin", "gl", "Xt" or "Xm".  For Tkinter, STDWIN and
+many other modules, see Modules/Setup.in for info on how to add these
+modules to your Python, if it is possible at all.  Sometimes you will
+have to ftp and build another package first (e.g. Tcl and Tk for Tkinter).
+Sometimes the module only works on specific platforms (e.g. gl only works
+on SGI machines).
+<P>
+NOTE: if the complaint is about "Tkinter" (upper case T) and you have
+already configured module "tkinter" (lower case t), the solution is
+<I>not</I> to rename tkinter to Tkinter or vice versa.  There is probably
+something wrong with your module search path.  Check out the value of
+sys.path.
+<P>
+For X-related modules (Xt and Xm) you will have to do more work: they
+are currently not part of the standard Python distribution.  You will
+have to ftp the Extensions tar file, i.e.
+<A HREF="ftp://ftp.python.org/pub/python/src/X-extension.tar.gz">ftp://ftp.python.org/pub/python/src/X-extension.tar.gz</A> and follow
+the instructions there.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.011.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.011.htp">Log info</A>
+
+/ Last changed on Wed Feb 12 21:31:08 2003 by
+<A HREF="mailto:kubieziel@gmx.de">Jens Kubieziel</A>
+<P>
+
+<HR>
+<H2><A NAME="4.12">4.12. [deleted]</A></H2>
+[stdwin (long dead windowing library) entry deleted]
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.012.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.012.htp">Log info</A>
+
+/ Last changed on Thu Mar 21 08:30:13 2002 by
+<A HREF="mailto:erno-pyfaq@erno.iki.fi">Erno Kuusela</A>
+<P>
+
+<HR>
+<H2><A NAME="4.13">4.13. What GUI toolkits exist for Python?</A></H2>
+Depending on what platform(s) you are aiming at, there are several.
+<P>
+Currently supported solutions:
+<P>
+Cross-platform:
+<P>
+Tk:
+<P>
+There's a neat object-oriented interface to the Tcl/Tk widget set,
+called Tkinter.  It is part of the standard Python distribution and
+well-supported -- all you need to do is build and install Tcl/Tk and
+enable the _tkinter module and the TKPATH definition in Modules/Setup
+when building Python.  This is probably the easiest to install and
+use, and the most complete widget set.  It is also very likely that in
+the future the standard Python GUI API will be based on or at least
+look very much like the Tkinter interface.  For more info about Tk,
+including pointers to the source, see the Tcl/Tk home page at
+<A HREF="http://www.scriptics.com">http://www.scriptics.com</A>.  Tcl/Tk is now fully
+portable to the Mac and Windows platforms (NT and 95 only); you need
+Python 1.4beta3 or later and Tk 4.1patch1 or later.
+<P>
+wxWindows:
+<P>
+There's an interface to wxWindows called wxPython.  wxWindows is a 
+portable GUI class library written in C++.  It supports GTK, Motif, 
+MS-Windows and Mac as targets.  Ports to other platforms are being 
+contemplated or have already had some work done on them.  wxWindows 
+preserves the look and feel of the underlying graphics toolkit, and 
+there is quite a rich widget set and collection of GDI classes.  
+See the wxWindows page at <A HREF="http://www.wxwindows.org">http://www.wxwindows.org</A>/ for more details.  
+wxPython is a python extension module that wraps many of the wxWindows 
+C++ classes, and is quickly gaining popularity amongst Python 
+developers.  You can get wxPython as part of the source or CVS 
+distribution of wxWindows, or directly from its home page at 
+<A HREF="http://alldunn.com/wxPython">http://alldunn.com/wxPython</A>/.
+<P>
+Gtk+:
+<P>
+PyGtk bindings for the Gtk+ Toolkit by James Henstridge exist; see <A HREF="ftp://ftp.daa.com.au/pub/james/python">ftp://ftp.daa.com.au/pub/james/python</A>/.  Note that there are two incompatible bindings.  If you are using Gtk+ 1.2.x you should get the 0.6.x PyGtk bindings from
+<P>
+<PRE>
+    <A HREF="ftp://ftp.gtk.org/pub/python/v1.2">ftp://ftp.gtk.org/pub/python/v1.2</A>
+</PRE>
+If you plan to use Gtk+ 2.0 with Python (highly recommended if you are just starting with Gtk), get the most recent distribution from
+<P>
+<PRE>
+    <A HREF="ftp://ftp.gtk.org/pub/python/v2.0">ftp://ftp.gtk.org/pub/python/v2.0</A>
+</PRE>
+If you are adventurous, you can also check out the source from the Gnome CVS repository.  Set your CVS directory to :pserver:<A HREF="mailto:anonymous@anoncvs.gnome.org">anonymous@anoncvs.gnome.org</A>:/cvs/gnome and check the gnome-python module out from the repository.
+<P>
+Other:
+<P>
+There are also bindings available for the Qt toolkit (PyQt), and for KDE (PyKDE); see <A HREF="http://www.thekompany.com/projects/pykde">http://www.thekompany.com/projects/pykde</A>/.
+<P>
+For OpenGL bindings, see <A HREF="http://starship.python.net/~da/PyOpenGL">http://starship.python.net/~da/PyOpenGL</A>.
+<P>
+Platform specific:
+<P>
+The Mac port has a rich and ever-growing set of modules that support
+the native Mac toolbox calls.  See the documentation that comes with
+the Mac port.  See <A HREF="ftp://ftp.python.org/pub/python/mac">ftp://ftp.python.org/pub/python/mac</A>.  Support
+by Jack Jansen <A HREF="mailto:jack@cwi.nl">jack@cwi.nl</A>.
+<P>
+Pythonwin by Mark Hammond (<A HREF="mailto:MHammond@skippinet.com.au">MHammond@skippinet.com.au</A>)
+includes an interface to the Microsoft Foundation
+Classes and a Python programming environment using it that's written
+mostly in Python.  See <A HREF="http://www.python.org/windows">http://www.python.org/windows</A>/.
+<P>
+There's an object-oriented GUI based on the Microsoft Foundation
+Classes model called WPY, supported by Jim Ahlstrom <A HREF="mailto:jim@interet.com">jim@interet.com</A>.
+Programs written in WPY run unchanged and with native look and feel on
+Windows NT/95, Windows 3.1 (using win32s), and on Unix (using Tk).
+Source and binaries for Windows and Linux are available in
+<A HREF="ftp://ftp.python.org/pub/python/wpy">ftp://ftp.python.org/pub/python/wpy</A>/.
+<P>
+Obsolete or minority solutions:
+<P>
+There's an interface to X11, including the Athena and Motif widget
+sets (and a few individual widgets, like Mosaic's HTML widget and
+SGI's GL widget) available from
+<A HREF="ftp://ftp.python.org/pub/python/src/X-extension.tar.gz">ftp://ftp.python.org/pub/python/src/X-extension.tar.gz</A>.
+Support by Sjoerd Mullender <A HREF="mailto:sjoerd@cwi.nl">sjoerd@cwi.nl</A>.
+<P>
+On top of the X11 interface there's the vpApp
+toolkit by Per Spilling, now also maintained by Sjoerd Mullender
+<A HREF="mailto:sjoerd@cwi.nl">sjoerd@cwi.nl</A>.  See <A HREF="ftp://ftp.cwi.nl/pub/sjoerd/vpApp.tar.gz">ftp://ftp.cwi.nl/pub/sjoerd/vpApp.tar.gz</A>.
+<P>
+For SGI IRIX only, there are unsupported interfaces to the complete
+GL (Graphics Library -- low level but very good 3D capabilities) as
+well as to FORMS (a buttons-and-sliders-etc package built on top of GL
+by Mark Overmars -- ftp'able from
+<A HREF="ftp://ftp.cs.ruu.nl/pub/SGI/FORMS">ftp://ftp.cs.ruu.nl/pub/SGI/FORMS</A>/).  This is probably also
+becoming obsolete, as OpenGL takes over (see above).
+<P>
+There's an interface to STDWIN, a platform-independent low-level
+windowing interface for Mac and X11.  This is totally unsupported and
+rapidly becoming obsolete.  The STDWIN sources are at
+<A HREF="ftp://ftp.cwi.nl/pub/stdwin">ftp://ftp.cwi.nl/pub/stdwin</A>/.
+<P>
+There is an interface to WAFE, a Tcl interface to the X11
+Motif and Athena widget sets.  WAFE is at
+<A HREF="http://www.wu-wien.ac.at/wafe/wafe.html">http://www.wu-wien.ac.at/wafe/wafe.html</A>.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.013.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.013.htp">Log info</A>
+
+/ Last changed on Mon May 13 21:40:39 2002 by
+<A HREF="mailto:skip@pobox.com">Skip Montanaro</A>
+<P>
+
+<HR>
+<H2><A NAME="4.14">4.14. Are there any interfaces to database packages in Python?</A></H2>
+Yes!  See the Database Topic Guide at 
+<A HREF="http://www.python.org/topics/database">http://www.python.org/topics/database</A>/ for details.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.014.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.014.htp">Log info</A>
+
+/ Last changed on Tue Jan  4 20:12:19 2000 by
+<A HREF="mailto:bwarsaw@python.org">Barney Warplug</A>
+<P>
+
+<HR>
+<H2><A NAME="4.15">4.15. Is it possible to write obfuscated one-liners in Python?</A></H2>
+Yes.  See the following three examples, due to Ulf Bartelt:
+<P>
+<PRE>
+        # Primes &lt; 1000
+        print filter(None,map(lambda y:y*reduce(lambda x,y:x*y!=0,
+        map(lambda x,y=y:y%x,range(2,int(pow(y,0.5)+1))),1),range(2,1000)))
+</PRE>
+<PRE>
+        # First 10 Fibonacci numbers
+        print map(lambda x,f=lambda x,f:(x&lt;=1) or (f(x-1,f)+f(x-2,f)): f(x,f),
+        range(10))
+</PRE>
+<PRE>
+        # Mandelbrot set
+        print (lambda Ru,Ro,Iu,Io,IM,Sx,Sy:reduce(lambda x,y:x+y,map(lambda y,
+        Iu=Iu,Io=Io,Ru=Ru,Ro=Ro,Sy=Sy,L=lambda yc,Iu=Iu,Io=Io,Ru=Ru,Ro=Ro,i=IM,
+        Sx=Sx,Sy=Sy:reduce(lambda x,y:x+y,map(lambda x,xc=Ru,yc=yc,Ru=Ru,Ro=Ro,
+        i=i,Sx=Sx,F=lambda xc,yc,x,y,k,f=lambda xc,yc,x,y,k,f:(k&lt;=0)or (x*x+y*y
+        >=4.0) or 1+f(xc,yc,x*x-y*y+xc,2.0*x*y+yc,k-1,f):f(xc,yc,x,y,k,f):chr(
+        64+F(Ru+x*(Ro-Ru)/Sx,yc,0,0,i)),range(Sx))):L(Iu+y*(Io-Iu)/Sy),range(Sy
+        ))))(-2.1, 0.7, -1.2, 1.2, 30, 80, 24)
+        #    \___ ___/  \___ ___/  |   |   |__ lines on screen
+        #        V          V      |   |______ columns on screen
+        #        |          |      |__________ maximum of "iterations"
+        #        |          |_________________ range on y axis
+        #        |____________________________ range on x axis
+</PRE>
+Don't try this at home, kids!
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.015.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.015.htp">Log info</A>
+
+/ Last changed on Wed May 21 15:48:33 1997 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="4.16">4.16. Is there an equivalent of C's &quot;?:&quot; ternary operator?</A></H2>
+Not directly.  In many cases you can mimic a?b:c with "a and b or
+c", but there's a flaw: if b is zero (or empty, or None -- anything
+that tests false) then c will be selected instead.  In many cases you
+can prove by looking at the code that this can't happen (e.g. because
+b is a constant or has a type that can never be false), but in general
+this can be a problem.
+<P>
+Tim Peters (who wishes it was Steve Majewski) suggested the following
+solution: (a and [b] or [c])[0].  Because [b] is a singleton list it
+is never false, so the wrong path is never taken; then applying [0] to
+the whole thing gets the b or c that you really wanted.  Ugly, but it
+gets you there in the rare cases where it is really inconvenient to
+rewrite your code using 'if'.
+<P>
+As a last resort it is possible to implement the "?:" operator as a function:
+<P>
+<PRE>
+    def q(cond,on_true,on_false):
+        from inspect import isfunction
+</PRE>
+<PRE>
+        if cond:
+            if not isfunction(on_true): return on_true
+            else: return apply(on_true)
+        else:
+            if not isfunction(on_false): return on_false 
+            else: return apply(on_false)
+</PRE>
+In most cases you'll pass b and c directly: q(a,b,c).  To avoid evaluating b
+or c when they shouldn't be, encapsulate them
+within a lambda function, e.g.: q(a,lambda: b, lambda: c).
+<P>
+<P>
+<P>
+It has been asked <I>why</I> Python has no if-then-else expression,
+since most language have one; it is a frequently requested feature.
+<P>
+There are several possible answers: just as many languages do
+just fine without one; it can easily lead to less readable code;
+no sufficiently "Pythonic" syntax has been discovered; a search
+of the standard library found remarkably few places where using an
+if-then-else expression would make the code more understandable.
+<P>
+Nevertheless, in an effort to decide once and for all whether
+an if-then-else expression should be added to the language,
+PEP 308 (<A HREF="http://www.python.org/peps/pep-0308.html">http://www.python.org/peps/pep-0308.html</A>) has been
+put forward, proposing a specific syntax.  The community can
+now vote on this issue.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.016.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.016.htp">Log info</A>
+
+/ Last changed on Fri Feb  7 19:41:13 2003 by
+<A HREF="mailto:goodger@python.org">David Goodger</A>
+<P>
+
+<HR>
+<H2><A NAME="4.17">4.17. My class defines __del__ but it is not called when I delete the object.</A></H2>
+There are several possible reasons for this.
+<P>
+The del statement does not necessarily call __del__ -- it simply
+decrements the object's reference count, and if this reaches zero
+__del__ is called.
+<P>
+If your data structures contain circular links (e.g. a tree where
+each child has a parent pointer and each parent has a list of
+children) the reference counts will never go back to zero.  You'll
+have to define an explicit close() method which removes those
+pointers.  Please don't ever call __del__ directly -- __del__ should
+call close() and close() should make sure that it can be called more
+than once for the same object.
+<P>
+If the object has ever been a local variable (or argument, which is
+really the same thing) to a function that caught an expression in an
+except clause, chances are that a reference to the object still exists
+in that function's stack frame as contained in the stack trace.
+Normally, deleting (better: assigning None to) sys.exc_traceback will
+take care of this.  If a stack was printed for an unhandled
+exception in an interactive interpreter, delete sys.last_traceback
+instead.
+<P>
+There is code that deletes all objects when the interpreter exits,
+but it is not called if your Python has been configured to support
+threads (because other threads may still be active).  You can define
+your own cleanup function using sys.exitfunc (see question 4.4).
+<P>
+Finally, if your __del__ method raises an exception, a warning message is printed to sys.stderr.
+<P>
+<P>
+Starting with Python 2.0, a garbage collector periodically reclaims the space used by most cycles with no external references. (See the "gc" module documentation for details.) There <I>are</I>, however, pathological cases where it can be expected to fail. Moreover, the garbage collector runs some time after the last reference to your data structure vanishes, so your __del__ method may be called at an inconvenient and random time. This is inconvenient if you're trying to reproduce a problem. Worse, the order in which object's __del__ methods are executed is arbitrary.
+<P>
+Another way to avoid cyclical references is to use the "weakref" module, which allows you to point to objects without incrementing their reference count. Tree data structures, for instance, should use weak references for their parent  and sibling pointers (if they need them!).
+<P>
+Question 6.14 is intended to explain the new garbage collection algorithm.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.017.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.017.htp">Log info</A>
+
+/ Last changed on Mon Jun 10 15:27:28 2002 by
+<A HREF="mailto:smurf@noris.de">Matthias Urlichs</A>
+<P>
+
+<HR>
+<H2><A NAME="4.18">4.18. How do I change the shell environment for programs called using os.popen() or os.system()? Changing os.environ doesn't work.</A></H2>
+You must be using either a version of python before 1.4, or on a
+(rare) system that doesn't have the putenv() library function.
+<P>
+Before Python 1.4, modifying the environment passed to subshells was
+left out of the interpreter because there seemed to be no
+well-established portable way to do it (in particular, some systems,
+have putenv(), others have setenv(), and some have none at all).  As
+of Python 1.4, almost all Unix systems <I>do</I> have putenv(), and so does
+the Win32 API, and thus the os module was modified so that changes to
+os.environ are trapped and the corresponding putenv() call is made.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.018.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.018.htp">Log info</A>
+<P>
+
+<HR>
+<H2><A NAME="4.19">4.19. What is a class?</A></H2>
+A class is the particular object type created by executing
+a class statement.  Class objects are used as templates, to create
+instance objects, which embody both the data structure
+(attributes) and program routines (methods) specific to a datatype.
+<P>
+A class can be based on one or more other classes, called its base
+class(es). It then inherits the attributes and methods of its base classes. This allows an object model to be successively refined
+by inheritance.
+<P>
+The term "classic class" is used to refer to the original
+class implementation in Python. One problem with classic
+classes is their inability to use the built-in data types
+(such as list and dictionary) as base classes. Starting
+with Python 2.2 an attempt is in progress to unify user-defined
+classes and built-in types. It is now possible to declare classes
+that inherit from built-in types.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.019.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.019.htp">Log info</A>
+
+/ Last changed on Mon May 27 01:31:21 2002 by
+<A HREF="mailto:sholden@holdenweb.com">Steve Holden</A>
+<P>
+
+<HR>
+<H2><A NAME="4.20">4.20. What is a method?</A></H2>
+A method is a function that you normally call as
+x.name(arguments...) for some object x.  The term is used for methods
+of classes and class instances as well as for methods of built-in
+objects.  (The latter have a completely different implementation and
+only share the way their calls look in Python code.)  Methods of
+classes (and class instances) are defined as functions inside the
+class definition.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.020.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.020.htp">Log info</A>
+<P>
+
+<HR>
+<H2><A NAME="4.21">4.21. What is self?</A></H2>
+Self is merely a conventional name for the first argument of a
+method -- i.e. a function defined inside a class definition.  A method
+defined as meth(self, a, b, c) should be called as x.meth(a, b, c) for
+some instance x of the class in which the definition occurs;
+the called method will think it is called as meth(x, a, b, c).
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.021.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.021.htp">Log info</A>
+<P>
+
+<HR>
+<H2><A NAME="4.22">4.22. What is an unbound method?</A></H2>
+An unbound method is a method defined in a class that is not yet
+bound to an instance.  You get an unbound method if you ask for a
+class attribute that happens to be a function. You get a bound method
+if you ask for an instance attribute.  A bound method knows which
+instance it belongs to and calling it supplies the instance automatically;
+an unbound method only knows which class it wants for its first
+argument (a derived class is also OK).  Calling an unbound method
+doesn't "magically" derive the first argument from the context -- you
+have to provide it explicitly.
+<P>
+Trivia note regarding bound methods:  each reference to a bound
+method of a particular object creates a bound method object.  If you
+have two such references (a = inst.meth; b = inst.meth), they will
+compare equal (a == b) but are not the same (a is not b).
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.022.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.022.htp">Log info</A>
+
+/ Last changed on Wed May  6 18:07:25 1998 by
+<A HREF="mailto:clarence@avtel.com">Clarence Gardner</A>
+<P>
+
+<HR>
+<H2><A NAME="4.23">4.23. How do I call a method defined in a base class from a derived class that overrides it?</A></H2>
+If your class definition starts with "class Derived(Base): ..."
+then you can call method meth defined in Base (or one of Base's base
+classes) as Base.meth(self, arguments...).  Here, Base.meth is an
+unbound method (see previous question).
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.023.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.023.htp">Log info</A>
+<P>
+
+<HR>
+<H2><A NAME="4.24">4.24. How do I call a method from a base class without using the name of the base class?</A></H2>
+DON'T DO THIS.  REALLY.  I MEAN IT.  It appears that you could call
+self.__class__.__bases__[0].meth(self, arguments...) but this fails when
+a doubly-derived method is derived from your class: for its instances,
+self.__class__.__bases__[0] is your class, not its base class -- so
+(assuming you are doing this from within Derived.meth) you would start
+a recursive call.
+<P>
+Often when you want to do this you are forgetting that classes
+are first class in Python.  You can "point to" the class you want
+to delegate an operation to either at the instance or at the
+subclass level.  For example if you want to use a "glorp"
+operation of a superclass you can point to the right superclass
+to use.
+<P>
+<PRE>
+  class subclass(superclass1, superclass2, superclass3):
+      delegate_glorp = superclass2
+      ...
+      def glorp(self, arg1, arg2):
+            ... subclass specific stuff ...
+            self.delegate_glorp.glorp(self, arg1, arg2)
+       ...
+</PRE>
+<PRE>
+  class subsubclass(subclass):
+       delegate_glorp = superclass3
+       ...
+</PRE>
+Note, however that setting delegate_glorp to subclass in
+subsubclass would cause an infinite recursion on subclass.delegate_glorp.  Careful!  Maybe you are getting too fancy for your own good.  Consider simplifying the design (?).
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.024.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.024.htp">Log info</A>
+
+/ Last changed on Mon Jul 28 13:58:22 1997 by
+<A HREF="mailto:aaron_watters@msn.com">aaron watters</A>
+<P>
+
+<HR>
+<H2><A NAME="4.25">4.25. How can I organize my code to make it easier to change the base class?</A></H2>
+You could define an alias for the base class, assign the real base
+class to it before your class definition, and use the alias throughout
+your class.  Then all you have to change is the value assigned to the
+alias.  Incidentally, this trick is also handy if you want to decide
+dynamically (e.g. depending on availability of resources) which base
+class to use.  Example:
+<P>
+<PRE>
+        BaseAlias = &lt;real base class&gt;
+        class Derived(BaseAlias):
+                def meth(self):
+                        BaseAlias.meth(self)
+                        ...
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.025.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.025.htp">Log info</A>
+
+/ Last changed on Wed May 21 15:49:57 1997 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="4.26">4.26. How can I find the methods or attributes of an object?</A></H2>
+This depends on the object type.
+<P>
+For an instance x of a user-defined class, instance attributes are
+found in the dictionary x.__dict__, and methods and attributes defined
+by its class are found in x.__class__.__bases__[i].__dict__ (for i in
+range(len(x.__class__.__bases__))).  You'll have to walk the tree of
+base classes to find <I>all</I> class methods and attributes.
+<P>
+Many, but not all built-in types define a list of their method names
+in x.__methods__, and if they have data attributes, their names may be
+found in x.__members__.  However this is only a convention.
+<P>
+For more information, read the source of the standard (but
+undocumented) module newdir.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.026.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.026.htp">Log info</A>
+<P>
+
+<HR>
+<H2><A NAME="4.27">4.27. I can't seem to use os.read() on a pipe created with os.popen().</A></H2>
+os.read() is a low-level function which takes a file descriptor (a
+small integer).  os.popen() creates a high-level file object -- the
+same type used for sys.std{in,out,err} and returned by the builtin
+open() function.  Thus, to read n bytes from a pipe p created with
+os.popen(), you need to use p.read(n).
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.027.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.027.htp">Log info</A>
+<P>
+
+<HR>
+<H2><A NAME="4.28">4.28. How can I create a stand-alone binary from a Python script?</A></H2>
+Even though there are Python compilers being developed,
+you probably don't need a <I>real</I> compiler, if all you want
+is a stand-alone program. There are three solutions to that. 
+<P>
+One is to use the freeze tool, which is included in the Python
+source tree as Tools/freeze. It converts Python byte
+code to C arrays.  Using a C compiler, you can embed all
+your modules into a new program, which is then linked
+with the standard Python modules. 
+<P>
+It works by scanning your source recursively for import statements
+(in both forms) and looking for the modules in the standard Python path
+as well as in the source directory (for built-in modules).  It then
+1 the modules written in Python to C code (array initializers
+that can be turned into code objects using the marshal module) and
+creates a custom-made config file that only contains those built-in
+modules which are actually used in the program.  It then compiles the
+generated C code and links it with the rest of the Python interpreter
+to form a self-contained binary which acts exactly like your script.
+<P>
+(Hint: the freeze program only works if your script's filename ends in
+".py".)
+<P>
+There are several utilities which may be helpful.  The first is Gordon McMillan's installer at
+<P>
+<PRE>
+    <A HREF="http://www.mcmillan-inc.com/install1.html">http://www.mcmillan-inc.com/install1.html</A>
+</PRE>
+which works on Windows, Linux and at least some forms of Unix.
+<P>
+Another is Thomas Heller's py2exe (Windows only) at
+<P>
+<PRE>
+    <A HREF="http://starship.python.net/crew/theller/py2exe">http://starship.python.net/crew/theller/py2exe</A>/
+</PRE>
+A third is Christian Tismer's SQFREEZE
+(<A HREF="http://starship.python.net/crew/pirx">http://starship.python.net/crew/pirx</A>/) which appends the byte code
+to a specially-prepared Python interpreter, which
+will find the byte code in executable. 
+<P>
+A fourth is Fredrik Lundh's Squeeze
+(<A HREF="http://www.pythonware.com/products/python/squeeze">http://www.pythonware.com/products/python/squeeze</A>/).
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.028.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.028.htp">Log info</A>
+
+/ Last changed on Wed Jun 19 14:01:30 2002 by
+<A HREF="mailto:gmcm@hypernet.com">Gordon McMillan</A>
+<P>
+
+<HR>
+<H2><A NAME="4.29">4.29. What WWW tools are there for Python?</A></H2>
+See the chapters titled "Internet Protocols and Support" and
+"Internet Data Handling" in the Library Reference
+Manual. Python is full of good things which will help you build server-side and client-side web systems.
+<P>
+A summary of available frameworks is maintained by Paul Boddie at
+<P>
+<PRE>
+    <A HREF="http://thor.prohosting.com/~pboddie/Python/web_modules.html">http://thor.prohosting.com/~pboddie/Python/web_modules.html</A>
+</PRE>
+Cameron Laird maintains a useful set of pages about Python web technologies at
+<P>
+<PRE>
+   <A HREF="http://starbase.neosoft.com/~claird/comp.lang.python/web_python.html">http://starbase.neosoft.com/~claird/comp.lang.python/web_python.html</A>/
+</PRE>
+There was a web browser written in Python, called Grail --
+see <A HREF="http://sourceforge.net/project/grail">http://sourceforge.net/project/grail</A>/. This project has been terminated; <A HREF="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/grail/grail/README">http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/grail/grail/README</A> gives more details.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.029.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.029.htp">Log info</A>
+
+/ Last changed on Mon Nov 11 22:48:25 2002 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="4.30">4.30. How do I run a subprocess with pipes connected to both input and output?</A></H2>
+Use the standard popen2 module.  For example:
+<P>
+<PRE>
+	import popen2
+	fromchild, tochild = popen2.popen2("command")
+	tochild.write("input\n")
+	tochild.flush()
+	output = fromchild.readline()
+</PRE>
+Warning: in general, it is unwise to
+do this, because you can easily cause a deadlock where your
+process is blocked waiting for output from the child, while the child
+is blocked waiting for input from you.  This can be caused
+because the parent expects the child to output more text than it does,
+or it can be caused by data being stuck in stdio buffers due to lack
+of flushing.  The Python parent can of course explicitly flush the data
+it sends to the child before it reads any output, but if the child is
+a naive C program it can easily have been written to never explicitly
+flush its output, even if it is interactive, since flushing is
+normally automatic.
+<P>
+Note that a deadlock is also possible if you use popen3 to read
+stdout and stderr. If one of the two is too large for the internal
+buffer (increasing the buffersize does not help) and you read()
+the other one first, there is a deadlock, too.
+<P>
+Note on a bug in popen2: unless your program calls wait()
+or waitpid(), finished child processes are never removed,
+and eventually calls to popen2 will fail because of a limit on
+the number of child processes.  Calling os.waitpid with the
+os.WNOHANG option can prevent this; a good place to insert such
+a call would be before calling popen2 again.
+<P>
+Another way to produce a deadlock: Call a wait() and there is
+still more output from the program than what fits into the 
+internal buffers.
+<P>
+In many cases, all you really need is to run some data through a
+command and get the result back.  Unless the data is infinite in size,
+the easiest (and often the most efficient!) way to do this is to write
+it to a temporary file and run the command with that temporary file as
+input.  The standard module tempfile exports a function mktemp() which
+generates unique temporary file names.
+<P>
+<PRE>
+ import tempfile
+ import os
+ class Popen3:
+    """
+    This is a deadlock-save version of popen, that returns
+    an object with errorlevel, out (a string) and err (a string).
+    (capturestderr may not work under windows.)
+    Example: print Popen3('grep spam','\n\nhere spam\n\n').out
+    """
+    def __init__(self,command,input=None,capturestderr=None):
+        outfile=tempfile.mktemp()
+        command="( %s ) > %s" % (command,outfile)
+        if input:
+            infile=tempfile.mktemp()
+            open(infile,"w").write(input)
+            command=command+" &lt;"+infile
+        if capturestderr:
+            errfile=tempfile.mktemp()
+            command=command+" 2>"+errfile
+        self.errorlevel=os.system(command) >> 8
+        self.out=open(outfile,"r").read()
+        os.remove(outfile)
+        if input:
+            os.remove(infile)
+        if capturestderr:
+            self.err=open(errfile,"r").read()
+            os.remove(errfile)
+</PRE>
+Note that many interactive programs (e.g. vi) don't work well with
+pipes substituted for standard input and output.  You will have to use
+pseudo ttys ("ptys") instead of pipes.  There is some undocumented
+code to use these in the library module pty.py -- I'm afraid you're on
+your own here.
+<P>
+A different answer is a Python interface to Don Libes' "expect"
+library.  A Python extension that interfaces to expect is called "expy"
+and available from
+<A HREF="http://expectpy.sourceforge.net">http://expectpy.sourceforge.net</A>/.
+<P>
+A pure Python solution that works like expect is pexpect of Noah Spurrier.
+A beta version is available from
+<A HREF="http://pexpect.sourceforge.net">http://pexpect.sourceforge.net</A>/
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.030.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.030.htp">Log info</A>
+
+/ Last changed on Tue Sep  3 16:31:31 2002 by
+<A HREF="mailto:polzin@gmx.de">Tobias Polzin</A>
+<P>
+
+<HR>
+<H2><A NAME="4.31">4.31. How do I call a function if I have the arguments in a tuple?</A></H2>
+Use the built-in function apply().  For instance,
+<P>
+<PRE>
+    func(1, 2, 3)
+</PRE>
+is equivalent to
+<P>
+<PRE>
+    args = (1, 2, 3)
+    apply(func, args)
+</PRE>
+Note that func(args) is not the same -- it calls func() with exactly
+one argument, the tuple args, instead of three arguments, the integers
+1, 2 and 3.
+<P>
+In Python 2.0, you can also use extended call syntax:
+<P>
+f(*args) is equivalent to apply(f, args)
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.031.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.031.htp">Log info</A>
+
+/ Last changed on Tue Jan  2 03:42:50 2001 by
+<A HREF="mailto:moshez@zadka.site.co.il">Moshe Zadka</A>
+<P>
+
+<HR>
+<H2><A NAME="4.32">4.32. How do I enable font-lock-mode for Python in Emacs?</A></H2>
+If you are using XEmacs 19.14 or later, any XEmacs 20, FSF Emacs 19.34
+or any Emacs 20, font-lock should work automatically for you if you
+are using the latest python-mode.el.
+<P>
+If you are using an older version of XEmacs or Emacs you will need 
+to put this in your .emacs file:
+<P>
+<PRE>
+        (defun my-python-mode-hook ()
+          (setq font-lock-keywords python-font-lock-keywords)
+          (font-lock-mode 1))
+        (add-hook 'python-mode-hook 'my-python-mode-hook)
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.032.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.032.htp">Log info</A>
+
+/ Last changed on Mon Apr  6 16:18:46 1998 by
+<A HREF="mailto:bwarsaw@python.org">Barry Warsaw</A>
+<P>
+
+<HR>
+<H2><A NAME="4.33">4.33. Is there a scanf() or sscanf() equivalent?</A></H2>
+Not as such.
+<P>
+For simple input parsing, the easiest approach is usually to split
+the line into whitespace-delimited words using string.split(), and to
+convert decimal strings to numeric values using int(),
+long() or float().  (Python's int() is 32-bit and its
+long() is arbitrary precision.)  string.split supports an optional
+"sep" parameter which is useful if the line uses something other
+than whitespace as a delimiter.
+<P>
+For more complicated input parsing, regular expressions (see module re)
+are better suited and more powerful than C's sscanf().
+<P>
+There's a contributed module that emulates sscanf(), by Steve Clift;
+see contrib/Misc/sscanfmodule.c of the ftp site:
+<P>
+<PRE>
+    <A HREF="http://www.python.org/ftp/python/contrib-09-Dec-1999/Misc">http://www.python.org/ftp/python/contrib-09-Dec-1999/Misc</A>/
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.033.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.033.htp">Log info</A>
+
+/ Last changed on Mon Jun  3 01:07:51 2002 by
+<A HREF="mailto:neal@metaslash.com">Neal Norwitz</A>
+<P>
+
+<HR>
+<H2><A NAME="4.34">4.34. Can I have Tk events handled while waiting for I/O?</A></H2>
+Yes, and you don't even need threads!  But you'll have to
+restructure your I/O code a bit.  Tk has the equivalent of Xt's
+XtAddInput() call, which allows you to register a callback function
+which will be called from the Tk mainloop when I/O is possible on a
+file descriptor.  Here's what you need:
+<P>
+<PRE>
+        from Tkinter import tkinter
+        tkinter.createfilehandler(file, mask, callback)
+</PRE>
+The file may be a Python file or socket object (actually, anything
+with a fileno() method), or an integer file descriptor.  The mask is
+one of the constants tkinter.READABLE or tkinter.WRITABLE.  The
+callback is called as follows:
+<P>
+<PRE>
+        callback(file, mask)
+</PRE>
+You must unregister the callback when you're done, using
+<P>
+<PRE>
+        tkinter.deletefilehandler(file)
+</PRE>
+Note: since you don't know *how many bytes* are available for reading,
+you can't use the Python file object's read or readline methods, since
+these will insist on reading a predefined number of bytes.  For
+sockets, the recv() or recvfrom() methods will work fine; for other
+files, use os.read(file.fileno(), maxbytecount).
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.034.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.034.htp">Log info</A>
+<P>
+
+<HR>
+<H2><A NAME="4.35">4.35. How do I write a function with output parameters (call by reference)?</A></H2>
+[Mark Lutz] The thing to remember is that arguments are passed by
+assignment in Python.  Since assignment just creates references to
+objects, there's no alias between an argument name in the caller and
+callee, and so no call-by-reference per se.  But you can simulate it
+in a number of ways:
+<P>
+1) By using global variables; but you probably shouldn't :-)
+<P>
+2) By passing a mutable (changeable in-place) object:
+<P>
+<PRE>
+      def func1(a):
+          a[0] = 'new-value'     # 'a' references a mutable list
+          a[1] = a[1] + 1        # changes a shared object
+</PRE>
+<PRE>
+      args = ['old-value', 99]
+      func1(args)
+      print args[0], args[1]     # output: new-value 100
+</PRE>
+3) By returning a tuple, holding the final values of arguments:
+<P>
+<PRE>
+      def func2(a, b):
+          a = 'new-value'        # a and b are local names
+          b = b + 1              # assigned to new objects
+          return a, b            # return new values
+</PRE>
+<PRE>
+      x, y = 'old-value', 99
+      x, y = func2(x, y)
+      print x, y                 # output: new-value 100
+</PRE>
+4) And other ideas that fall-out from Python's object model. For instance, it might be clearer to pass in a mutable dictionary:
+<P>
+<PRE>
+      def func3(args):
+          args['a'] = 'new-value'     # args is a mutable dictionary
+          args['b'] = args['b'] + 1   # change it in-place
+</PRE>
+<PRE>
+      args = {'a':' old-value', 'b': 99}
+      func3(args)
+      print args['a'], args['b']
+</PRE>
+5) Or bundle-up values in a class instance:
+<P>
+<PRE>
+      class callByRef:
+          def __init__(self, **args):
+              for (key, value) in args.items():
+                  setattr(self, key, value)
+</PRE>
+<PRE>
+      def func4(args):
+          args.a = 'new-value'        # args is a mutable callByRef
+          args.b = args.b + 1         # change object in-place
+</PRE>
+<PRE>
+      args = callByRef(a='old-value', b=99)
+      func4(args)
+      print args.a, args.b
+</PRE>
+<PRE>
+   But there's probably no good reason to get this complicated :-).
+</PRE>
+[Python's author favors solution 3 in most cases.]
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.035.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.035.htp">Log info</A>
+
+/ Last changed on Sun Jun  8 23:49:46 1997 by
+<A HREF="mailto:david_ascher@brown.edu">David Ascher</A>
+<P>
+
+<HR>
+<H2><A NAME="4.36">4.36. Please explain the rules for local and global variables in Python.</A></H2>
+[Ken Manheimer] In Python, procedure variables are implicitly
+global, unless they are assigned anywhere within the block.
+In that case
+they are implicitly local, and you need to explicitly declare them as
+'global'.
+<P>
+Though a bit surprising at first, a moment's consideration explains
+this.  On one hand, requirement of 'global' for assigned vars provides
+a bar against unintended side-effects.  On the other hand, if global
+were required for all global references, you'd be using global all the
+time.  Eg, you'd have to declare as global every reference to a
+builtin function, or to a component of an imported module.  This
+clutter would defeat the usefulness of the 'global' declaration for
+identifying side-effects.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.036.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.036.htp">Log info</A>
+
+/ Last changed on Fri Aug 28 09:53:27 1998 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="4.37">4.37. How can I have modules that mutually import each other?</A></H2>
+Suppose you have the following modules:
+<P>
+foo.py:
+<P>
+<PRE>
+	from bar import bar_var
+	foo_var=1
+</PRE>
+bar.py:
+<P>
+<PRE>
+	from foo import foo_var
+	bar_var=2
+</PRE>
+The problem is that the above is processed by the interpreter thus:
+<P>
+<PRE>
+	main imports foo
+	Empty globals for foo are created
+	foo is compiled and starts executing
+	foo imports bar
+	Empty globals for bar are created
+	bar is compiled and starts executing
+	bar imports foo (which is a no-op since there already is a module named foo)
+	bar.foo_var = foo.foo_var
+	...
+</PRE>
+The last step fails, because Python isn't done with interpreting foo yet and the global symbol dict for foo is still empty.
+<P>
+The same thing happens when you use "import foo", and then try to access "foo.one" in global code.
+<P>
+<P>
+There are (at least) three possible workarounds for this problem. 
+<P>
+Guido van Rossum recommends to avoid all uses of "from &lt;module&gt; import ..." (so everything from an imported module is referenced as &lt;module&gt;.&lt;name&gt;) and to place all code inside functions. Initializations of global variables and class variables should use constants or built-in functions only.
+<P>
+<P>
+Jim Roskind suggests the following order in each module:
+<P>
+<PRE>
+ exports (globals, functions, and classes that don't need imported base classes)
+ import statements
+ active code (including globals that are initialized from imported values).
+</PRE>
+Python's author doesn't like this approach much because the imports
+appear in a strange place, but has to admit that it works.
+<P>
+<P>
+<P>
+Matthias Urlichs recommends to restructure your code so that the recursive import is not necessary in the first place.
+<P>
+<P>
+These solutions are not mutually exclusive.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.037.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.037.htp">Log info</A>
+
+/ Last changed on Mon Jun  3 06:52:51 2002 by
+<A HREF="mailto:smurf@noris.de">Matthias Urlichs</A>
+<P>
+
+<HR>
+<H2><A NAME="4.38">4.38. How do I copy an object in Python?</A></H2>
+Try copy.copy() or copy.deepcopy() for the general case. Not all objects can be copied, but most can.
+<P>
+Dictionaries have a copy method. Sequences can be copied by slicing:
+<PRE>
+ new_l = l[:]
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.038.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.038.htp">Log info</A>
+
+/ Last changed on Thu Mar 21 05:40:26 2002 by
+<A HREF="mailto:erno-pyfaq@erno.iki.fi">Erno Kuusela</A>
+<P>
+
+<HR>
+<H2><A NAME="4.39">4.39. How to implement persistent objects in Python? (Persistent == automatically saved to and restored from disk.)</A></H2>
+The library module "pickle" now solves this in a very general way
+(though you still can't store things like open files, sockets or
+windows), and the library module "shelve" uses pickle and (g)dbm to
+create persistent mappings containing arbitrary Python objects.
+For possibly better performance also look for the latest version
+of the relatively recent cPickle module.
+<P>
+A more awkward way of doing things is to use pickle's little sister,
+marshal.  The marshal module provides very fast ways to store
+noncircular basic Python types to files and strings, and back again.
+Although marshal does not do fancy things like store instances or
+handle shared references properly, it does run extremely fast.  For
+example loading a half megabyte of data may take less than a
+third of a second (on some machines).  This often beats doing
+something more complex and general such as using gdbm with
+pickle/shelve.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.039.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.039.htp">Log info</A>
+
+/ Last changed on Sun Jun  8 22:59:00 1997 by
+<A HREF="mailto:david_ascher@brown.edu">David Ascher</A>
+<P>
+
+<HR>
+<H2><A NAME="4.40">4.40. I try to use __spam and I get an error about _SomeClassName__spam.</A></H2>
+Variables with double leading underscore are "mangled" to provide a
+simple but effective way to define class private variables.  See the
+chapter "New in Release 1.4" in the Python Tutorial.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.040.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.040.htp">Log info</A>
+<P>
+
+<HR>
+<H2><A NAME="4.41">4.41. How do I delete a file? And other file questions.</A></H2>
+Use os.remove(filename) or os.unlink(filename); for documentation,
+see the posix section of the library manual.  They are the same,
+unlink() is simply the Unix name for this function.  In earlier
+versions of Python, only os.unlink() was available.
+<P>
+To remove a directory, use os.rmdir(); use os.mkdir() to create one.
+<P>
+To rename a file, use os.rename().
+<P>
+To truncate a file, open it using f = open(filename, "r+"), and use
+f.truncate(offset); offset defaults to the current seek position.
+(The "r+" mode opens the file for reading and writing.)
+There's also os.ftruncate(fd, offset) for files opened with os.open()
+-- for advanced Unix hacks only.
+<P>
+The shutil module also contains a number of functions to work on files
+including copyfile, copytree, and rmtree amongst others.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.041.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.041.htp">Log info</A>
+
+/ Last changed on Thu Dec 28 12:30:01 2000 by
+<A HREF="mailto:pbjorn@uswest.net">Bjorn Pettersen</A>
+<P>
+
+<HR>
+<H2><A NAME="4.42">4.42. How to modify urllib or httplib to support HTTP/1.1?</A></H2>
+Recent versions of Python (2.0 and onwards) support HTTP/1.1 natively.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.042.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.042.htp">Log info</A>
+
+/ Last changed on Tue Jan  2 02:56:56 2001 by
+<A HREF="mailto:moshez@zadka.site.co.il">Moshe Zadka</A>
+<P>
+
+<HR>
+<H2><A NAME="4.43">4.43. Unexplicable syntax errors in compile() or exec.</A></H2>
+When a statement suite (as opposed to an expression) is compiled by
+compile(), exec or execfile(), it <I>must</I> end in a newline.  In some
+cases, when the source ends in an indented block it appears that at
+least two newlines are required.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.043.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.043.htp">Log info</A>
+<P>
+
+<HR>
+<H2><A NAME="4.44">4.44. How do I convert a string to a number?</A></H2>
+For integers, use the built-in int() function, e.g. int('144') == 144.  Similarly, long() converts from string to long integer, e.g. long('144') == 144L; and float() to floating-point, e.g. float('144') == 144.0.
+<P>
+Note that these are restricted to decimal interpretation, so 
+that int('0144') == 144 and int('0x144') raises ValueError. For Python
+2.0 int takes the base to convert from as a second optional argument, so
+int('0x144', 16) == 324.
+<P>
+For greater flexibility, or before Python 1.5, import the module 
+string and use the string.atoi() function for integers, 
+string.atol() for long integers, or string.atof() for 
+floating-point.  E.g., 
+string.atoi('100', 16) == string.atoi('0x100', 0) == 256.  
+See the library reference manual section for the string module for 
+more details.
+<P>
+While you could use the built-in function eval() instead of
+any of those, this is not recommended, because someone could pass you
+a Python expression that might have unwanted side effects (like
+reformatting your disk). It also has the effect of interpreting numbers
+as Python expressions, so that e.g. eval('09') gives a syntax error
+since Python regards numbers starting with '0' as octal (base 8).
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.044.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.044.htp">Log info</A>
+
+/ Last changed on Thu Dec 28 12:37:34 2000 by
+<A HREF="mailto:pbjorn@uswest.net">Bjorn Pettersen</A>
+<P>
+
+<HR>
+<H2><A NAME="4.45">4.45. How do I convert a number to a string?</A></H2>
+To convert, e.g., the number 144 to the string '144', use the
+built-in function repr() or the backquote notation (these are
+equivalent).  If you want a hexadecimal or octal representation, use
+the built-in functions hex() or oct(), respectively.  For fancy
+formatting, use the % operator on strings, just like C printf formats,
+e.g. "%04d" % 144 yields '0144' and "%.3f" % (1/3.0) yields '0.333'.
+See the library reference manual for details.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.045.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.045.htp">Log info</A>
+<P>
+
+<HR>
+<H2><A NAME="4.46">4.46. How do I copy a file?</A></H2>
+There's the shutil module which contains a copyfile()
+function that implements a copy loop;
+it isn't good enough for the Macintosh, though:
+it doesn't copy the resource fork and Finder info.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.046.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.046.htp">Log info</A>
+
+/ Last changed on Tue Jan  2 02:59:40 2001 by
+<A HREF="mailto:moshez@zadka.site.co.il">Moshe Zadka</A>
+<P>
+
+<HR>
+<H2><A NAME="4.47">4.47. How do I check if an object is an instance of a given class or of a subclass of it?</A></H2>
+If you are developing the classes from scratch it might be better to
+program in a more proper object-oriented style -- instead of doing a different
+thing based on class membership, why not use a method and define the
+method differently in different classes?
+<P>
+However, there are some legitimate situations
+where you need to test for class membership.
+<P>
+In Python 1.5, you can use the built-in function isinstance(obj, cls).
+<P>
+The following approaches can be used with earlier Python versions:
+<P>
+An unobvious method is to raise the object
+as an exception and to try to catch the exception with the class you're
+testing for:
+<P>
+<PRE>
+	def is_instance_of(the_instance, the_class):
+	    try:
+		raise the_instance
+	    except the_class:
+		return 1
+	    except:
+		return 0
+</PRE>
+This technique can be used to distinguish "subclassness"
+from a collection of classes as well
+<P>
+<PRE>
+                try:
+                              raise the_instance
+                except Audible:
+                              the_instance.play(largo)
+                except Visual:
+                              the_instance.display(gaudy)
+                except Olfactory:
+                              sniff(the_instance)
+                except:
+                              raise ValueError, "dunno what to do with this!"
+</PRE>
+This uses the fact that exception catching tests for class or subclass
+membership.
+<P>
+A different approach is to test for the presence of a class attribute that
+is presumably unique for the given class.  For instance:
+<P>
+<PRE>
+	class MyClass:
+	    ThisIsMyClass = 1
+	    ...
+</PRE>
+<PRE>
+	def is_a_MyClass(the_instance):
+	    return hasattr(the_instance, 'ThisIsMyClass')
+</PRE>
+This version is easier to inline, and probably faster (inlined it
+is definitely faster).  The disadvantage is that someone else could cheat:
+<P>
+<PRE>
+	class IntruderClass:
+	    ThisIsMyClass = 1    # Masquerade as MyClass
+	    ...
+</PRE>
+but this may be seen as a feature (anyway, there are plenty of other ways
+to cheat in Python).  Another disadvantage is that the class must be
+prepared for the membership test.  If you do not "control the
+source code" for the class it may not be advisable to modify the
+class to support testability.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.047.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.047.htp">Log info</A>
+
+/ Last changed on Fri Jan  2 15:16:04 1998 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="4.48">4.48. What is delegation?</A></H2>
+Delegation refers to an object oriented technique Python programmers
+may implement with particular ease.  Consider the following:
+<P>
+<PRE>
+  from string import upper
+</PRE>
+<PRE>
+  class UpperOut:
+        def __init__(self, outfile):
+              self.__outfile = outfile
+        def write(self, str):
+              self.__outfile.write( upper(str) )
+        def __getattr__(self, name):
+              return getattr(self.__outfile, name)
+</PRE>
+Here the UpperOut class redefines the write method
+to convert the argument string to upper case before
+calling the underlying self.__outfile.write method, but
+all other methods are delegated to the underlying 
+self.__outfile object.  The delegation is accomplished
+via the "magic" __getattr__ method.  Please see the
+language reference for more information on the use
+of this method.
+<P>
+Note that for more general cases delegation can
+get trickier. Particularly when attributes must be set
+as well as gotten the class must define a __settattr__
+method too, and it must do so carefully.
+<P>
+The basic implementation of __setattr__ is roughly
+equivalent to the following:
+<P>
+<PRE>
+   class X:
+        ...
+        def __setattr__(self, name, value):
+             self.__dict__[name] = value
+        ...
+</PRE>
+Most __setattr__ implementations must modify
+self.__dict__ to store local state for self without
+causing an infinite recursion.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.048.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.048.htp">Log info</A>
+
+/ Last changed on Wed Aug 13 07:11:24 1997 by
+<A HREF="mailto:aaron_watters@msn.com">aaron watters</A>
+<P>
+
+<HR>
+<H2><A NAME="4.49">4.49. How do I test a Python program or component.</A></H2>
+We presume for the purposes of this question you are interested
+in standalone testing, rather than testing your components inside
+a testing framework. The best-known testing framework for Python
+is the PyUnit module, maintained at
+<P>
+<PRE>
+    <A HREF="http://pyunit.sourceforge.net">http://pyunit.sourceforge.net</A>/
+</PRE>
+For standalone testing, it helps to write the program so that
+it may be easily tested by using good modular design.
+In particular your program
+should have almost all functionality encapsulated in either functions
+or class methods -- and this sometimes has the surprising and
+delightful effect of making the program run faster (because
+local variable accesses are faster than global accesses).
+Furthermore the program should avoid depending on mutating
+global variables, since this makes testing much more difficult to do.
+<P>
+The "global main logic" of your program may be as simple
+as
+<P>
+<PRE>
+  if __name__=="__main__":
+       main_logic()
+</PRE>
+at the bottom of the main module of your program.
+<P>
+Once your program is organized as a tractable collection
+of functions and class behaviours you should write test
+functions that exercise the behaviours.  A test suite 
+can be associated with each module which automates
+a sequence of tests.  This sounds like a lot of work, but
+since Python is so terse and flexible it's surprisingly easy.
+You can make coding much more pleasant and fun by
+writing your test functions in parallel with the "production
+code", since this makes it easy to find bugs and even
+design flaws earlier.
+<P>
+"Support modules" that are not intended to be the main
+module of a program may include a "test script interpretation"
+which invokes a self test of the module.
+<P>
+<PRE>
+   if __name__ == "__main__":
+      self_test()
+</PRE>
+Even programs that interact with complex external
+interfaces may be tested when the external interfaces are
+unavailable by using "fake" interfaces implemented in
+Python.  For an example of a "fake" interface, the following
+class defines (part of) a "fake" file interface:
+<P>
+<PRE>
+ import string
+ testdata = "just a random sequence of characters"
+</PRE>
+<PRE>
+ class FakeInputFile:
+   data = testdata
+   position = 0
+   closed = 0
+</PRE>
+<PRE>
+   def read(self, n=None):
+       self.testclosed()
+       p = self.position
+       if n is None:
+          result= self.data[p:]
+       else:
+          result= self.data[p: p+n]
+       self.position = p + len(result)
+       return result
+</PRE>
+<PRE>
+   def seek(self, n, m=0):
+       self.testclosed()
+       last = len(self.data)
+       p = self.position
+       if m==0: 
+          final=n
+       elif m==1:
+          final=n+p
+       elif m==2:
+          final=len(self.data)+n
+       else:
+          raise ValueError, "bad m"
+       if final&lt;0:
+          raise IOError, "negative seek"
+       self.position = final
+</PRE>
+<PRE>
+   def isatty(self):
+       return 0
+</PRE>
+<PRE>
+   def tell(self):
+       return self.position
+</PRE>
+<PRE>
+   def close(self):
+       self.closed = 1
+</PRE>
+<PRE>
+   def testclosed(self):
+       if self.closed:
+          raise IOError, "file closed"
+</PRE>
+Try f=FakeInputFile() and test out its operations.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.049.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.049.htp">Log info</A>
+
+/ Last changed on Mon Jun  3 01:12:10 2002 by
+<A HREF="mailto:neal@metaslash.com">Neal Norwitz</A>
+<P>
+
+<HR>
+<H2><A NAME="4.50">4.50. My multidimensional list (array) is broken! What gives?</A></H2>
+You probably tried to make a multidimensional array like this.
+<P>
+<PRE>
+   A = [[None] * 2] * 3
+</PRE>
+This makes a list containing 3 references to the same list of length
+two.  Changes to one row will show in all rows, which is probably not
+what you want.  The following works much better:
+<P>
+<PRE>
+   A = [None]*3
+   for i in range(3):
+        A[i] = [None] * 2
+</PRE>
+This generates a list containing 3 different lists of length two.
+<P>
+If you feel weird, you can also do it in the following way:
+<P>
+<PRE>
+   w, h = 2, 3
+   A = map(lambda i,w=w: [None] * w, range(h))
+</PRE>
+For Python 2.0 the above can be spelled using a list comprehension:
+<P>
+<PRE>
+   w,h = 2,3
+   A = [ [None]*w for i in range(h) ]
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.050.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.050.htp">Log info</A>
+
+/ Last changed on Thu Dec 28 12:18:35 2000 by
+<A HREF="mailto:pbjorn@uswest.net">Bjorn Pettersen</A>
+<P>
+
+<HR>
+<H2><A NAME="4.51">4.51. I want to do a complicated sort: can you do a Schwartzian Transform in Python?</A></H2>
+Yes, and in Python you only have to write it once:
+<P>
+<PRE>
+ def st(List, Metric):
+     def pairing(element, M = Metric):
+           return (M(element), element)
+     paired = map(pairing, List)
+     paired.sort()
+     return map(stripit, paired)
+</PRE>
+<PRE>
+ def stripit(pair):
+     return pair[1]
+</PRE>
+This technique, attributed to Randal Schwartz, sorts the elements
+of a list by a metric which maps each element to its "sort value".
+For example, if L is a list of string then
+<P>
+<PRE>
+   import string
+   Usorted = st(L, string.upper)
+</PRE>
+<PRE>
+   def intfield(s):
+         return string.atoi( string.strip(s[10:15] ) )
+</PRE>
+<PRE>
+   Isorted = st(L, intfield)
+</PRE>
+Usorted gives the elements of L sorted as if they were upper
+case, and Isorted gives the elements of L sorted by the integer
+values that appear in the string slices starting at position 10
+and ending at position 15. In Python 2.0 this can be done more
+naturally with list comprehensions:
+<P>
+<PRE>
+  tmp1 = [ (x.upper(), x) for x in L ] # Schwartzian transform
+  tmp1.sort()
+  Usorted = [ x[1] for x in tmp1 ]
+</PRE>
+<PRE>
+  tmp2 = [ (int(s[10:15]), s) for s in L ] # Schwartzian transform
+  tmp2.sort()
+  Isorted = [ x[1] for x in tmp2 ]
+</PRE>
+<P>
+Note that Isorted may also be computed by
+<P>
+<PRE>
+   def Icmp(s1, s2):
+         return cmp( intfield(s1), intfield(s2) )
+</PRE>
+<PRE>
+   Isorted = L[:]
+   Isorted.sort(Icmp)
+</PRE>
+but since this method computes intfield many times for each
+element of L, it is slower than the Schwartzian Transform.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.051.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.051.htp">Log info</A>
+
+/ Last changed on Sat Jun  1 19:18:46 2002 by
+<A HREF="mailto:neal@metaslash.com">Neal Norwitz</A>
+<P>
+
+<HR>
+<H2><A NAME="4.52">4.52. How to convert between tuples and lists?</A></H2>
+The function tuple(seq) converts any sequence into a tuple with
+the same items in the same order.
+For example, tuple([1, 2, 3]) yields (1, 2, 3) and tuple('abc')
+yields ('a', 'b', 'c').  If the argument is
+a tuple, it does not make a copy but returns the same object, so
+it is cheap to call tuple() when you aren't sure that an object
+is already a tuple.
+<P>
+The function list(seq) converts any sequence into a list with
+the same items in the same order.
+For example, list((1, 2, 3)) yields [1, 2, 3] and list('abc')
+yields ['a', 'b', 'c'].  If the argument is a list,
+it makes a copy just like seq[:] would.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.052.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.052.htp">Log info</A>
+
+/ Last changed on Sun Jun 14 14:18:53 1998 by
+<A HREF="mailto:tim_one@email.msn.com">Tim Peters</A>
+<P>
+
+<HR>
+<H2><A NAME="4.53">4.53. Files retrieved with urllib contain leading garbage that looks like email headers.</A></H2>
+<I>Extremely</I> old  versions of Python supplied libraries which
+did not support HTTP/1.1; the vanilla httplib in Python 1.4
+only recognized HTTP/1.0.  In Python 2.0 full HTTP/1.1 support is included.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.053.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.053.htp">Log info</A>
+
+/ Last changed on Mon Jan  8 17:26:18 2001 by
+<A HREF="mailto:sholden@holdenweb.com">Steve Holden</A>
+<P>
+
+<HR>
+<H2><A NAME="4.54">4.54. How do I get a list of all instances of a given class?</A></H2>
+Python does not keep track of all instances of a class (or of a
+built-in type).
+<P>
+You can program the class's constructor to keep track of all
+instances, but unless you're very clever, this has the disadvantage
+that the instances never get deleted,because your list of all
+instances keeps a reference to them.
+<P>
+(The trick is to regularly inspect the reference counts of the
+instances you've retained, and if the reference count is below a
+certain level, remove it from the list.  Determining that level is
+tricky -- it's definitely larger than 1.)
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.054.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.054.htp">Log info</A>
+
+/ Last changed on Tue May 27 23:52:16 1997 by
+<A HREF="mailto:guido@cnri.reston.va.us">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="4.55">4.55. A regular expression fails with regex.error: match failure.</A></H2>
+This is usually caused by too much backtracking; the regular
+expression engine has a fixed size stack which holds at most 4000
+backtrack points.  Every character matched by e.g. ".*" accounts for a
+backtrack point, so even a simple search like
+<P>
+<PRE>
+  regex.match('.*x',"x"*5000)
+</PRE>
+will fail.
+<P>
+This is fixed in the re module introduced with 
+Python 1.5; consult the Library Reference section on re for more information.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.055.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.055.htp">Log info</A>
+
+/ Last changed on Thu Jul 30 12:35:49 1998 by
+<A HREF="mailto:akuchlin@cnri.reston.va.us">A.M. Kuchling</A>
+<P>
+
+<HR>
+<H2><A NAME="4.56">4.56. I can't get signal handlers to work.</A></H2>
+The most common problem is that the signal handler is declared
+with the wrong argument list.  It is called as
+<P>
+<PRE>
+	handler(signum, frame)
+</PRE>
+so it should be declared with two arguments:
+<P>
+<PRE>
+	def handler(signum, frame):
+		...
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.056.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.056.htp">Log info</A>
+
+/ Last changed on Wed May 28 09:29:08 1997 by
+<A HREF="mailto:guido@cnri.reston.va.us">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="4.57">4.57. I can't use a global variable in a function? Help!</A></H2>
+Did you do something like this?
+<P>
+<PRE>
+   x = 1 # make a global
+</PRE>
+<PRE>
+   def f():
+         print x # try to print the global
+         ...
+         for j in range(100):
+              if q>3:
+                 x=4
+</PRE>
+Any variable assigned in a function is local to that function.
+unless it is specifically declared global. Since a value is bound
+to x as the last statement of the function body, the compiler
+assumes that x is local. Consequently the "print x"
+attempts to print an uninitialized local variable and will
+trigger a NameError.
+<P>
+In such cases the solution is to insert an explicit global
+declaration at the start of the function, making it
+<P>
+<P>
+<PRE>
+   def f():
+         global x
+         print x # try to print the global
+         ...
+         for j in range(100):
+              if q>3:
+                 x=4
+</PRE>
+<P>
+In this case, all references to x are interpreted as references
+to the x from the module namespace.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.057.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.057.htp">Log info</A>
+
+/ Last changed on Mon Feb 12 15:52:12 2001 by
+<A HREF="mailto:sholden@holdenweb.com">Steve Holden</A>
+<P>
+
+<HR>
+<H2><A NAME="4.58">4.58. What's a negative index? Why doesn't list.insert() use them?</A></H2>
+Python sequences are indexed with positive numbers and
+negative numbers.  For positive numbers 0 is the first index
+1 is the second index and so forth.  For negative indices -1
+is the last index and -2 is the pentultimate (next to last) index
+and so forth.  Think of seq[-n] as the same as seq[len(seq)-n].
+<P>
+Using negative indices can be very convenient.  For example
+if the string Line ends in a newline then Line[:-1] is all of Line except
+the newline.
+<P>
+Sadly the list builtin method L.insert does not observe negative
+indices.  This feature could be considered a mistake but since
+existing programs depend on this feature it may stay around 
+forever.  L.insert for negative indices inserts at the start of the
+list.  To get "proper" negative index behaviour use L[n:n] = [x]
+in place of the insert method.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.058.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.058.htp">Log info</A>
+
+/ Last changed on Wed Aug 13 07:03:18 1997 by
+<A HREF="mailto:aaron_watters@msn.com">aaron watters</A>
+<P>
+
+<HR>
+<H2><A NAME="4.59">4.59. How can I sort one list by values from another list?</A></H2>
+You can sort lists of  tuples.
+<P>
+<PRE>
+  >>> list1 = ["what", "I'm", "sorting", "by"]
+  >>> list2 = ["something", "else", "to", "sort"]
+  >>> pairs = map(None, list1, list2)
+  >>> pairs
+  [('what', 'something'), ("I'm", 'else'), ('sorting', 'to'), ('by', 'sort')]
+  >>> pairs.sort()
+  >>> pairs
+  [("I'm", 'else'), ('by', 'sort'), ('sorting', 'to'), ('what', 'something')]
+  >>> result = pairs[:]
+  >>> for i in xrange(len(result)): result[i] = result[i][1]
+  ...
+  >>> result
+  ['else', 'sort', 'to', 'something']
+</PRE>
+And if you didn't understand the question, please see the
+example above ;c).  Note that "I'm" sorts before "by" because
+uppercase "I" comes before lowercase "b" in the ascii order.
+Also see 4.51.
+<P>
+In Python 2.0 this can be done like:
+<P>
+<PRE>
+ >>> list1 = ["what", "I'm", "sorting", "by"]
+ >>> list2 = ["something", "else", "to", "sort"]
+ >>> pairs = zip(list1, list2)
+ >>> pairs
+ [('what', 'something'), ("I'm", 'else'), ('sorting', 'to'), ('by', 'sort')]
+ >>> pairs.sort()
+ >>> result = [ x[1] for x in pairs ]
+ >>> result
+ ['else', 'sort', 'to', 'something']
+</PRE>
+[Followup]
+<P>
+Someone asked, why not this for the last steps:
+<P>
+<PRE>
+  result = []
+  for p in pairs: result.append(p[1])
+</PRE>
+This is much more legible.  However, a quick test shows that
+it is almost twice as slow for long lists.  Why?  First of all,
+the append() operation has to reallocate memory, and while it
+uses some tricks to avoid doing that each time, it still has
+to do it occasionally, and apparently that costs quite a bit.
+Second, the expression "result.append" requires an extra
+attribute lookup.  The attribute lookup could be done away
+with by rewriting as follows:
+<P>
+<PRE>
+  result = []
+  append = result.append
+  for p in pairs: append(p[1])
+</PRE>
+which gains back some speed, but is still considerably slower
+than the original solution, and hardly less convoluted.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.059.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.059.htp">Log info</A>
+
+/ Last changed on Thu Dec 28 12:56:35 2000 by
+<A HREF="mailto:pbjorn@uswest.net">Bjorn Pettersen</A>
+<P>
+
+<HR>
+<H2><A NAME="4.60">4.60. Why doesn't dir() work on builtin types like files and lists?</A></H2>
+It does starting with Python 1.5.
+<P>
+Using 1.4, you can find out which methods a given object supports
+by looking at its __methods__ attribute:
+<P>
+<PRE>
+    >>> List = []
+    >>> List.__methods__
+    ['append', 'count', 'index', 'insert', 'remove', 'reverse', 'sort']
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.060.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.060.htp">Log info</A>
+
+/ Last changed on Thu Sep 16 14:56:42 1999 by
+<A HREF="mailto:skip@mojam.com">Skip Montanaro</A>
+<P>
+
+<HR>
+<H2><A NAME="4.61">4.61. How can I mimic CGI form submission (METHOD=POST)?</A></H2>
+I would like to retrieve web pages that are the result of POSTing a
+form. Is there existing code that would let me do this easily?
+<P>
+Yes. Here's a simple example that uses httplib.  
+<P>
+<PRE>
+    #!/usr/local/bin/python
+</PRE>
+<PRE>
+    import httplib, sys, time
+</PRE>
+<PRE>
+    ### build the query string
+    qs = "First=Josephine&amp;MI=Q&amp;Last=Public"
+</PRE>
+<PRE>
+    ### connect and send the server a path
+    httpobj = httplib.HTTP('www.some-server.out-there', 80)
+    httpobj.putrequest('POST', '/cgi-bin/some-cgi-script')
+    ### now generate the rest of the HTTP headers...
+    httpobj.putheader('Accept', '*/*')
+    httpobj.putheader('Connection', 'Keep-Alive')
+    httpobj.putheader('Content-type', 'application/x-www-form-urlencoded')
+    httpobj.putheader('Content-length', '%d' % len(qs))
+    httpobj.endheaders()
+    httpobj.send(qs)
+    ### find out what the server said in response...
+    reply, msg, hdrs = httpobj.getreply()
+    if reply != 200:
+	sys.stdout.write(httpobj.getfile().read())
+</PRE>
+Note that in general for "url encoded posts" (the default) query strings must be "quoted" to, for example, change equals signs and spaces to an encoded form when they occur in name or value.  Use urllib.quote to perform this quoting.  For example to send name="Guy Steele, Jr.":
+<P>
+<PRE>
+   >>> from urllib import quote
+   >>> x = quote("Guy Steele, Jr.")
+   >>> x
+   'Guy%20Steele,%20Jr.'
+   >>> query_string = "name="+x
+   >>> query_string
+   'name=Guy%20Steele,%20Jr.'
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.061.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.061.htp">Log info</A>
+
+/ Last changed on Mon Jun 21 03:47:07 1999 by
+<A HREF="mailto:tbryan@python.net">TAB</A>
+<P>
+
+<HR>
+<H2><A NAME="4.62">4.62. If my program crashes with a bsddb (or anydbm) database open, it gets corrupted. How come?</A></H2>
+Databases opened for write access with the bsddb module (and often by
+the anydbm module, since it will preferentially use bsddb) must
+explicitly be closed using the close method of the database.  The
+underlying libdb package caches database contents which need to be
+converted to on-disk form and written, unlike regular open files which
+already have the on-disk bits in the kernel's write buffer, where they
+can just be dumped by the kernel with the program exits.
+<P>
+If you have initialized a new bsddb database but not written anything to
+it before the program crashes, you will often wind up with a zero-length
+file and encounter an exception the next time the file is opened.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.062.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.062.htp">Log info</A>
+
+/ Last changed on Mon Jun  3 01:15:01 2002 by
+<A HREF="mailto:neal@metaslash.com">Neal Norwitz</A>
+<P>
+
+<HR>
+<H2><A NAME="4.63">4.63. How do I make a Python script executable on Unix?</A></H2>
+You need to do two things: the script file's mode must be executable
+(include the 'x' bit), and the first line must begin with #!
+followed by the pathname for the Python interpreter.
+<P>
+The first is done by executing 'chmod +x scriptfile' or perhaps
+'chmod 755 scriptfile'.
+<P>
+The second can be done in a number of way.  The most straightforward
+way is to write
+<P>
+<PRE>
+  #!/usr/local/bin/python
+</PRE>
+as the very first line of your file - or whatever the pathname is
+where the python interpreter is installed on your platform.
+<P>
+If you would like the script to be independent of where the python
+interpreter lives, you can use the "env" program.  On almost all
+platforms, the following will work, assuming the python interpreter
+is in a directory on the user's $PATH:
+<P>
+<PRE>
+  #! /usr/bin/env python
+</PRE>
+Note -- *don't* do this for CGI scripts.  The $PATH variable for
+CGI scripts is often very minimal, so you need to use the actual
+absolute pathname of the interpreter.
+<P>
+Occasionally, a user's environment is so full that the /usr/bin/env
+program fails; or there's no env program at all.
+In that case, you can try the following hack (due to Alex Rezinsky):
+<P>
+<PRE>
+  #! /bin/sh
+  """:"
+  exec python $0 ${1+"$@"}
+  """
+</PRE>
+The disadvantage is that this defines the script's __doc__ string.
+However, you can fix that by adding
+<P>
+<PRE>
+  __doc__ = """...Whatever..."""
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.063.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.063.htp">Log info</A>
+
+/ Last changed on Mon Jan 15 09:19:16 2001 by
+<A HREF="mailto:neal@metaslash.com">Neal Norwitz</A>
+<P>
+
+<HR>
+<H2><A NAME="4.64">4.64. How do you remove duplicates from a list?</A></H2>
+See the Python Cookbook for a long discussion of many cool ways:
+<P>
+<PRE>
+    <A HREF="http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52560">http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52560</A>
+</PRE>
+Generally, if you don't mind reordering the List
+<P>
+<PRE>
+   if List:
+      List.sort()
+      last = List[-1]
+      for i in range(len(List)-2, -1, -1):
+          if last==List[i]: del List[i]
+          else: last=List[i]
+</PRE>
+If all elements of the list may be used as
+dictionary keys (ie, they are all hashable)
+this is often faster
+<P>
+<PRE>
+   d = {}
+   for x in List: d[x]=x
+   List = d.values()
+</PRE>
+Also, for extremely large lists you might
+consider more optimal alternatives to the first one.
+The second one is pretty good whenever it can
+be used.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.064.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.064.htp">Log info</A>
+
+/ Last changed on Fri May 24 21:56:33 2002 by
+<A HREF="mailto:tim.one@comcast.net">Tim Peters</A>
+<P>
+
+<HR>
+<H2><A NAME="4.65">4.65. Are there any known year 2000 problems in Python?</A></H2>
+I am not aware of year 2000 deficiencies in Python 1.5.  Python does
+very few date calculations and for what it does, it relies on the C
+library functions.  Python generally represent times either as seconds
+since 1970 or as a tuple (year, month, day, ...) where the year is
+expressed with four digits, which makes Y2K bugs unlikely.  So as long
+as your C library is okay, Python should be okay.  Of course, I cannot
+vouch for <I>your</I> Python code!
+<P>
+Given the nature of freely available software, I have to add that this statement is not
+legally binding.  The Python copyright notice contains the following
+disclaimer:
+<P>
+<PRE>
+  STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
+  REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
+  MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
+  CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+  DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+  PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+  TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+  PERFORMANCE OF THIS SOFTWARE.
+</PRE>
+The good news is that <I>if</I> you encounter a problem, you have full
+source available to track it down and fix it!
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.065.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.065.htp">Log info</A>
+
+/ Last changed on Fri Apr 10 14:59:31 1998 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="4.66">4.66. I want a version of map that applies a method to a sequence of objects! Help!</A></H2>
+Get fancy!
+<P>
+<PRE>
+  def method_map(objects, method, arguments):
+       """method_map([a,b], "flog", (1,2)) gives [a.flog(1,2), b.flog(1,2)]"""
+       nobjects = len(objects)
+       methods = map(getattr, objects, [method]*nobjects)
+       return map(apply, methods, [arguments]*nobjects)
+</PRE>
+It's generally a good idea to get to know the mysteries of map and apply
+and getattr and the other dynamic features of Python.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.066.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.066.htp">Log info</A>
+
+/ Last changed on Mon Jan  5 14:21:14 1998 by
+<A HREF="mailto:aaron_watters@msn.com">Aaron Watters</A>
+<P>
+
+<HR>
+<H2><A NAME="4.67">4.67. How do I generate random numbers in Python?</A></H2>
+The standard library module "random" implements a random number
+generator.  Usage is simple:
+<P>
+<PRE>
+    import random
+</PRE>
+<PRE>
+    random.random()
+</PRE>
+This returns a random floating point number in the range [0, 1).
+<P>
+There are also many other specialized generators in this module, such
+as
+<P>
+<PRE>
+    randrange(a, b) chooses an integer in the range [a, b)
+    uniform(a, b) chooses a floating point number in the range [a, b)
+    normalvariate(mean, sdev) sample from normal (Gaussian) distribution
+</PRE>
+Some higher-level functions operate on sequences directly, such as
+<P>
+<PRE>
+    choice(S) chooses random element from a given sequence
+    shuffle(L) shuffles a list in-place, i.e. permutes it randomly
+</PRE>
+There's also a class, Random, which you can instantiate
+to create independent multiple random number generators.
+<P>
+All this is documented in the library reference manual.  Note that
+the module "whrandom" is obsolete.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.067.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.067.htp">Log info</A>
+
+/ Last changed on Mon Jun  3 01:16:51 2002 by
+<A HREF="mailto:neal@metaslash.com">Neal Norwitz</A>
+<P>
+
+<HR>
+<H2><A NAME="4.68">4.68. How do I access the serial (RS232) port?</A></H2>
+There's a Windows serial communication module (for communication
+over RS 232 serial ports) at
+<P>
+<PRE>
+  <A HREF="ftp://ftp.python.org/pub/python/contrib/sio-151.zip">ftp://ftp.python.org/pub/python/contrib/sio-151.zip</A>
+  <A HREF="http://www.python.org/ftp/python/contrib/sio-151.zip">http://www.python.org/ftp/python/contrib/sio-151.zip</A>
+</PRE>
+For DOS, try Hans Nowak's Python-DX, which supports this, at:
+<P>
+<PRE>
+  <A HREF="http://www.cuci.nl/~hnowak">http://www.cuci.nl/~hnowak</A>/
+</PRE>
+For Unix, see a usenet post by Mitch Chapman:
+<P>
+<PRE>
+  <A HREF="http://groups.google.com/groups?selm=34A04430.CF9@ohioee.com">http://groups.google.com/groups?selm=34A04430.CF9@ohioee.com</A>
+</PRE>
+For Win32, POSIX(Linux, BSD, *), Jython, Chris':
+<P>
+<PRE>
+  <A HREF="http://pyserial.sourceforge.net">http://pyserial.sourceforge.net</A>
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.068.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.068.htp">Log info</A>
+
+/ Last changed on Tue Jul  2 21:11:07 2002 by
+<A HREF="mailto:cliechti@gmx.net">Chris Liechti</A>
+<P>
+
+<HR>
+<H2><A NAME="4.69">4.69. Images on Tk-Buttons don't work in Py15?</A></H2>
+They <I>do</I> work, but you must keep your own <I>reference</I> to the image 
+object now. More verbosely, you must make sure that, say, a global 
+variable or a class attribute refers to the object.
+<P>
+Quoting Fredrik Lundh from the mailinglist:
+<P>
+<PRE>
+  Well, the Tk button widget keeps a reference to the internal
+  photoimage object, but Tkinter does not.  So when the last
+  Python reference goes away, Tkinter tells Tk to release the
+  photoimage.  But since the image is in use by a widget, Tk
+  doesn't destroy it.  Not completely.  It just blanks the image,
+  making it completely transparent...
+</PRE>
+<PRE>
+  And yes, there was a bug in the keyword argument handling
+  in 1.4 that kept an extra reference around in some cases.  And
+  when Guido fixed that bug in 1.5, he broke quite a few Tkinter
+  programs...
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.069.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.069.htp">Log info</A>
+
+/ Last changed on Tue Feb  3 11:31:03 1998 by
+<A HREF="mailto:cjr@euronet.nl">Case Roole</A>
+<P>
+
+<HR>
+<H2><A NAME="4.70">4.70. Where is the math.py (socket.py, regex.py, etc.) source file?</A></H2>
+If you can't find a source file for a module it may be a builtin
+or dynamically loaded module implemented in C, C++ or other
+compiled language.  In this case you may not have the source
+file or it may be something like mathmodule.c, somewhere in
+a C source directory (not on the Python Path).
+<P>
+Fredrik Lundh (<A HREF="mailto:fredrik@pythonware.com">fredrik@pythonware.com</A>) explains (on the python-list):
+<P>
+There are (at least) three kinds of modules in Python:
+1) modules written in Python (.py);
+2) modules written in C and dynamically loaded (.dll, .pyd, .so, .sl, etc);
+3) modules written in C and linked with the interpreter; to get a list
+of these, type:
+<P>
+<PRE>
+    import sys
+    print sys.builtin_module_names
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.070.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.070.htp">Log info</A>
+
+/ Last changed on Tue Feb  3 13:55:33 1998 by
+<A HREF="mailto:aaron_watters@msn.com">Aaron Watters</A>
+<P>
+
+<HR>
+<H2><A NAME="4.71">4.71. How do I send mail from a Python script?</A></H2>
+The standard library module smtplib does this.
+Here's a very simple interactive mail
+sender that uses it.  This method will work on any host that
+supports an SMTP listener.
+<P>
+<PRE>
+    import sys, smtplib
+</PRE>
+<PRE>
+    fromaddr = raw_input("From: ")
+    toaddrs  = raw_input("To: ").split(',')
+    print "Enter message, end with ^D:"
+    msg = ''
+    while 1:
+        line = sys.stdin.readline()
+        if not line:
+            break
+        msg = msg + line
+</PRE>
+<PRE>
+    # The actual mail send
+    server = smtplib.SMTP('localhost')
+    server.sendmail(fromaddr, toaddrs, msg)
+    server.quit()
+</PRE>
+If the local host doesn't have an SMTP listener, you need to find one. The simple method is to ask the user. Alternately, you can use the DNS system to find the mail gateway(s) responsible for the source address.
+<P>
+A Unix-only alternative uses sendmail.  The location of the
+sendmail program varies between systems; sometimes it is
+/usr/lib/sendmail, sometime /usr/sbin/sendmail.  The sendmail manual
+page will help you out.  Here's some sample code:
+<P>
+<PRE>
+  SENDMAIL = "/usr/sbin/sendmail" # sendmail location
+  import os
+  p = os.popen("%s -t -i" % SENDMAIL, "w")
+  p.write("To: <A HREF="mailto:cary@ratatosk.org">cary@ratatosk.org</A>\n")
+  p.write("Subject: test\n")
+  p.write("\n") # blank line separating headers from body
+  p.write("Some text\n")
+  p.write("some more text\n")
+  sts = p.close()
+  if sts != 0:
+      print "Sendmail exit status", sts
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.071.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.071.htp">Log info</A>
+
+/ Last changed on Mon Jun  3 07:05:12 2002 by
+<A HREF="mailto:smurf@noris.de">Matthias Urlichs</A>
+<P>
+
+<HR>
+<H2><A NAME="4.72">4.72. How do I avoid blocking in connect() of a socket?</A></H2>
+The select module is widely known to help with asynchronous
+I/O on sockets once they are connected.  However, it is less
+than common knowledge how to avoid blocking on the initial
+connect() call.  Jeremy Hylton has the following advice (slightly
+edited):
+<P>
+To prevent the TCP connect from blocking, you can set the socket to 
+non-blocking mode.  Then when you do the connect(), you will either 
+connect immediately (unlikely) or get an exception that contains the 
+errno.  errno.EINPROGRESS indicates that the connection is in 
+progress, but hasn't finished yet.  Different OSes will return 
+different errnos, so you're going to have to check.  I can tell you 
+that different versions of Solaris return different errno values. 
+<P>
+In Python 1.5 and later, you can use connect_ex() to avoid
+creating an exception.  It will just return the errno value. 
+<P>
+To poll, you can call connect_ex() again later -- 0 or errno.EISCONN 
+indicate that you're connected -- or you can pass this socket to 
+select (checking to see if it is writeable).
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.072.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.072.htp">Log info</A>
+
+/ Last changed on Tue Feb 24 21:30:45 1998 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="4.73">4.73. How do I specify hexadecimal and octal integers?</A></H2>
+To specify an octal digit, precede the octal value with a zero.  For example,
+to set the variable "a" to the octal value "10" (8 in decimal), type:
+<P>
+<PRE>
+    >>> a = 010
+</PRE>
+To verify that this works, you can type "a" and hit enter while in the
+interpreter, which will cause Python to spit out the current value of "a"
+in decimal:
+<P>
+<PRE>
+    >>> a
+    8
+</PRE>
+Hexadecimal is just as easy.  Simply precede the hexadecimal number with a
+zero, and then a lower or uppercase "x".  Hexadecimal digits can be specified
+in lower or uppercase.  For example, in the Python interpreter:
+<P>
+<PRE>
+    >>> a = 0xa5
+    >>> a
+    165
+    >>> b = 0XB2
+    >>> b
+    178
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.073.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.073.htp">Log info</A>
+
+/ Last changed on Tue Mar  3 12:53:16 1998 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="4.74">4.74. How to get a single keypress at a time?</A></H2>
+For Windows, see question 8.2.  Here is an answer for Unix (see also 4.94).
+<P>
+There are several solutions; some involve using curses, which is a
+pretty big thing to learn.  Here's a solution without curses, due
+to Andrew Kuchling (adapted from code to do a PGP-style
+randomness pool):
+<P>
+<PRE>
+        import termios, sys, os
+        fd = sys.stdin.fileno()
+        old = termios.tcgetattr(fd)
+        new = termios.tcgetattr(fd)
+        new[3] = new[3] &amp; ~termios.ICANON &amp; ~termios.ECHO
+        new[6][termios.VMIN] = 1
+        new[6][termios.VTIME] = 0
+        termios.tcsetattr(fd, termios.TCSANOW, new)
+        s = ''    # We'll save the characters typed and add them to the pool.
+        try:
+            while 1:
+                c = os.read(fd, 1)
+                print "Got character", `c`
+                s = s+c
+        finally:
+            termios.tcsetattr(fd, termios.TCSAFLUSH, old)
+</PRE>
+You need the termios module for any of this to work, and I've only
+tried it on Linux, though it should work elsewhere.  It turns off
+stdin's echoing and disables canonical mode, and then reads a
+character at a time from stdin, noting the time after each keystroke.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.074.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.074.htp">Log info</A>
+
+/ Last changed on Thu Oct 24 00:36:56 2002 by
+<A HREF="mailto:cliechti@gmx.net">chris</A>
+<P>
+
+<HR>
+<H2><A NAME="4.75">4.75. How can I overload constructors (or methods) in Python?</A></H2>
+(This actually applies to all methods, but somehow the question
+usually comes up first in the context of constructors.)
+<P>
+Where in C++ you'd write
+<P>
+<PRE>
+    class C {
+        C() { cout &lt;&lt; "No arguments\n"; }
+        C(int i) { cout &lt;&lt; "Argument is " &lt;&lt; i &lt;&lt; "\n"; }
+    }
+</PRE>
+in Python you have to write a single constructor that catches all
+cases using default arguments.  For example:
+<P>
+<PRE>
+    class C:
+        def __init__(self, i=None):
+            if i is None:
+                print "No arguments"
+            else:
+                print "Argument is", i
+</PRE>
+This is not entirely equivalent, but close enough in practice.
+<P>
+You could also try a variable-length argument list, e.g.
+<P>
+<PRE>
+        def __init__(self, *args):
+            ....
+</PRE>
+The same approach works for all method definitions.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.075.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.075.htp">Log info</A>
+
+/ Last changed on Mon Apr 20 11:55:55 1998 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="4.76">4.76. How do I pass keyword arguments from one method to another?</A></H2>
+Use apply.  For example:
+<P>
+<PRE>
+    class Account:
+        def __init__(self, **kw):
+            self.accountType = kw.get('accountType')
+            self.balance = kw.get('balance')
+</PRE>
+<PRE>
+    class CheckingAccount(Account):
+        def __init__(self, **kw):
+            kw['accountType'] = 'checking'
+            apply(Account.__init__, (self,), kw)
+</PRE>
+<PRE>
+    myAccount = CheckingAccount(balance=100.00)
+</PRE>
+In Python 2.0 you can call it directly using the new ** syntax:
+<P>
+<PRE>
+    class CheckingAccount(Account):
+        def __init__(self, **kw):
+            kw['accountType'] = 'checking'
+            Account.__init__(self, **kw)
+</PRE>
+or more generally:
+<P>
+<PRE>
+ >>> def f(x, *y, **z):
+ ...  print x,y,z
+ ...
+ >>> Y = [1,2,3]
+ >>> Z = {'foo':3,'bar':None}
+ >>> f('hello', *Y, **Z)
+ hello (1, 2, 3) {'foo': 3, 'bar': None}
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.076.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.076.htp">Log info</A>
+
+/ Last changed on Thu Dec 28 13:04:01 2000 by
+<A HREF="mailto:pbjorn@uswest.net">Bjorn Pettersen</A>
+<P>
+
+<HR>
+<H2><A NAME="4.77">4.77. What module should I use to help with generating HTML?</A></H2>
+Check out HTMLgen written by Robin Friedrich. It's a class library
+of objects corresponding to all the HTML 3.2 markup tags. It's used
+when you are writing in Python and wish to synthesize HTML pages for
+generating a web or for CGI forms, etc. 
+<P>
+It can be found in the FTP contrib area on python.org or on the 
+Starship. Use the search engines there to locate the latest version.
+<P>
+It might also be useful to consider DocumentTemplate, which offers clear 
+separation between Python code and HTML code.  DocumentTemplate is part 
+of the Bobo objects publishing system (http:/www.digicool.com/releases) 
+but can be used independantly of course!
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.077.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.077.htp">Log info</A>
+
+/ Last changed on Fri Aug 28 09:54:58 1998 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="4.78">4.78. How do I create documentation from doc strings?</A></H2>
+Use gendoc, by Daniel Larson.  See
+<P>
+<A HREF="http://starship.python.net/crew/danilo">http://starship.python.net/crew/danilo</A>/
+<P>
+It can create HTML from the doc strings in your Python source code.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.078.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.078.htp">Log info</A>
+
+/ Last changed on Mon Oct  7 17:15:51 2002 by
+<A HREF="mailto:phil@dspfactory.com">Phil Rittenhouse</A>
+<P>
+
+<HR>
+<H2><A NAME="4.79">4.79. How do I read (or write) binary data?</A></H2>
+For complex data formats, it's best to use
+use the struct module.  It's documented in the library reference.
+It allows you to take a string read from a file containing binary
+data (usually numbers) and convert it to Python objects; and vice
+versa.
+<P>
+For example, the following code reads two 2-byte integers
+and one 4-byte integer in big-endian format from a file:
+<P>
+<PRE>
+  import struct
+</PRE>
+<PRE>
+  f = open(filename, "rb")  # Open in binary mode for portability
+  s = f.read(8)
+  x, y, z = struct.unpack(">hhl", s)
+</PRE>
+The '>' in the format string forces bin-endian data; the letter
+'h' reads one "short integer" (2 bytes), and 'l' reads one
+"long integer" (4 bytes) from the string.
+<P>
+For data that is more regular (e.g. a homogeneous list of ints or
+floats), you can also use the array module, also documented
+in the library reference.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.079.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.079.htp">Log info</A>
+
+/ Last changed on Wed Oct  7 09:16:45 1998 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="4.80">4.80. I can't get key bindings to work in Tkinter</A></H2>
+An oft-heard complaint is that event handlers bound to events
+with the bind() method don't get handled even when the appropriate
+key is pressed.
+<P>
+The most common cause is that the widget to which the binding applies
+doesn't have "keyboard focus".  Check out the Tk documentation
+for the focus command.  Usually a widget is given the keyboard
+focus by clicking in it (but not for labels; see the taketocus
+option).
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.080.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.080.htp">Log info</A>
+
+/ Last changed on Fri Jun 12 09:37:33 1998 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="4.81">4.81. &quot;import crypt&quot; fails</A></H2>
+[Unix]
+<P>
+Starting with Python 1.5, the crypt module is disabled by default.
+In order to enable it, you must go into the Python source tree and
+edit the file Modules/Setup to enable it (remove a '#' sign in
+front of the line starting with '#crypt').  Then rebuild.
+You may also have to add the string '-lcrypt' to that same line.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.081.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.081.htp">Log info</A>
+
+/ Last changed on Wed Aug  5 08:57:09 1998 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="4.82">4.82. Are there coding standards or a style guide for Python programs?</A></H2>
+Yes, Guido has written the "Python Style Guide".  See
+<A HREF="http://www.python.org/doc/essays/styleguide.html">http://www.python.org/doc/essays/styleguide.html</A>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.082.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.082.htp">Log info</A>
+
+/ Last changed on Tue Sep 29 09:50:27 1998 by
+<A HREF="mailto:vanandel@ucar.edu">Joseph VanAndel</A>
+<P>
+
+<HR>
+<H2><A NAME="4.83">4.83. How do I freeze Tkinter applications?</A></H2>
+Freeze is a tool to create stand-alone applications (see 4.28).
+<P>
+When freezing Tkinter applications, the applications will not be
+truly stand-alone, as the application will still need the tcl and
+tk libraries.
+<P>
+One solution is to ship the application with the tcl and tk libraries,
+and point to them at run-time using the TCL_LIBRARY and TK_LIBRARY
+environment variables.
+<P>
+To get truly stand-alone applications, the Tcl scripts that form
+the library have to be integrated into the application as well. One
+tool supporting that is SAM (stand-alone modules), which is part
+of the Tix distribution (<A HREF="http://tix.mne.com">http://tix.mne.com</A>). Build Tix with SAM 
+enabled, perform the appropriate call to Tclsam_init etc inside 
+Python's Modules/tkappinit.c, and link with libtclsam
+and libtksam (you might include the Tix libraries as well).
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.083.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.083.htp">Log info</A>
+
+/ Last changed on Wed Jan 20 17:35:01 1999 by
+<A HREF="mailto:loewis@informatik.hu-berlin.de">Martin v. Löwis</A>
+<P>
+
+<HR>
+<H2><A NAME="4.84">4.84. How do I create static class data and static class methods?</A></H2>
+[Tim Peters, <A HREF="mailto:tim_one@email.msn.com">tim_one@email.msn.com</A>]
+<P>
+Static data (in the sense of C++ or Java) is easy; static methods (again in the sense of C++ or Java) are not supported directly.
+<P>
+STATIC DATA
+<P>
+For example,
+<P>
+<PRE>
+    class C:
+        count = 0   # number of times C.__init__ called
+</PRE>
+<PRE>
+        def __init__(self):
+            C.count = C.count + 1
+</PRE>
+<PRE>
+        def getcount(self):
+            return C.count  # or return self.count
+</PRE>
+c.count also refers to C.count for any c such that isinstance(c, C) holds, unless overridden by c itself or by some class on the base-class search path from c.__class__ back to C.
+<P>
+Caution:  within a method of C,
+<P>
+<PRE>
+    self.count = 42
+</PRE>
+creates a new and unrelated instance vrbl named "count" in self's own dict.  So rebinding of a class-static data name needs the
+<P>
+<PRE>
+    C.count = 314
+</PRE>
+form whether inside a method or not.
+<P>
+<P>
+STATIC METHODS
+<P>
+Static methods (as opposed to static data) are unnatural in Python, because
+<P>
+<PRE>
+    C.getcount
+</PRE>
+returns an unbound method object, which can't be invoked without supplying an instance of C as the first argument.
+<P>
+The intended way to get the effect of a static method is via a module-level function:
+<P>
+<PRE>
+    def getcount():
+        return C.count
+</PRE>
+If your code is structured so as to define one class (or tightly related class hierarchy) per module, this supplies the desired encapsulation.
+<P>
+Several tortured schemes for faking static methods can be found by searching DejaNews.  Most people feel such cures are worse than the disease.  Perhaps the least obnoxious is due to Pekka Pessi (mailto:<A HREF="mailto:ppessi@hut.fi">ppessi@hut.fi</A>):
+<P>
+<PRE>
+    # helper class to disguise function objects
+    class _static:
+        def __init__(self, f):
+            self.__call__ = f
+</PRE>
+<PRE>
+    class C:
+        count = 0
+</PRE>
+<PRE>
+        def __init__(self):
+            C.count = C.count + 1
+</PRE>
+<PRE>
+        def getcount():
+            return C.count
+        getcount = _static(getcount)
+</PRE>
+<PRE>
+        def sum(x, y):
+            return x + y
+        sum = _static(sum)
+</PRE>
+<PRE>
+    C(); C()
+    c = C()
+    print C.getcount()  # prints 3
+    print c.getcount()  # prints 3
+    print C.sum(27, 15) # prints 42
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.084.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.084.htp">Log info</A>
+
+/ Last changed on Thu Jan 21 21:35:38 1999 by
+<A HREF="mailto:tim_one@email.msn.com">Tim Peters</A>
+<P>
+
+<HR>
+<H2><A NAME="4.85">4.85. __import__('x.y.z') returns &lt;module 'x'&gt;; how do I get z?</A></H2>
+Try
+<P>
+<PRE>
+   __import__('x.y.z').y.z
+</PRE>
+For more realistic situations, you may have to do something like
+<P>
+<PRE>
+   m = __import__(s)
+   for i in string.split(s, ".")[1:]:
+       m = getattr(m, i)
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.085.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.085.htp">Log info</A>
+
+/ Last changed on Thu Jan 28 11:01:43 1999 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="4.86">4.86. Basic thread wisdom</A></H2>
+Please note that there is no way to take advantage of
+multiprocessor hardware using the Python thread model. The interpreter
+uses a global interpreter lock (GIL),
+which does not allow multiple threads to be concurrently active.
+<P>
+If you write a simple test program like this:
+<P>
+<PRE>
+  import thread
+  def run(name, n):
+      for i in range(n): print name, i
+  for i in range(10):
+      thread.start_new(run, (i, 100))
+</PRE>
+none of the threads seem to run!  The reason is that as soon as
+the main thread exits, all threads are killed.
+<P>
+A simple fix is to add a sleep to the end of the program,
+sufficiently long for all threads to finish:
+<P>
+<PRE>
+  import thread, time
+  def run(name, n):
+      for i in range(n): print name, i
+  for i in range(10):
+      thread.start_new(run, (i, 100))
+  time.sleep(10) # &lt;----------------------------!
+</PRE>
+But now (on many platforms) the threads don't run in parallel,
+but appear to run sequentially, one at a time!  The reason is
+that the OS thread scheduler doesn't start a new thread until
+the previous thread is blocked.
+<P>
+A simple fix is to add a tiny sleep to the start of the run
+function:
+<P>
+<PRE>
+  import thread, time
+  def run(name, n):
+      time.sleep(0.001) # &lt;---------------------!
+      for i in range(n): print name, i
+  for i in range(10):
+      thread.start_new(run, (i, 100))
+  time.sleep(10)
+</PRE>
+Some more hints:
+<P>
+Instead of using a time.sleep() call at the end, it's
+better to use some kind of semaphore mechanism.  One idea is to
+use a the Queue module to create a queue object, let each thread
+append a token to the queue when it finishes, and let the main
+thread read as many tokens from the queue as there are threads.
+<P>
+Use the threading module instead of the thread module.  It's part
+of Python since version 1.5.1.  It takes care of all these details,
+and has many other nice features too!
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.086.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.086.htp">Log info</A>
+
+/ Last changed on Fri Feb  7 16:21:55 2003 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="4.87">4.87. Why doesn't closing sys.stdout (stdin, stderr) really close it?</A></H2>
+Python file objects are a high-level layer of abstraction on top of C streams, which in turn are a medium-level layer of abstraction on top of (among other things) low-level C file descriptors.
+<P>
+For most file objects f you create in Python via the builtin "open" function, f.close() marks the Python file object as being closed from Python's point of view, and also arranges to close the underlying C stream.  This happens automatically too, in f's destructor, when f becomes garbage.
+<P>
+But stdin, stdout and stderr are treated specially by Python, because of the special status also given to them by C:  doing
+<P>
+<PRE>
+    sys.stdout.close() # ditto for stdin and stderr
+</PRE>
+marks the Python-level file object as being closed, but does <I>not</I> close the associated C stream (provided sys.stdout is still bound to its default value, which is the stream C also calls "stdout").
+<P>
+To close the underlying C stream for one of these three, you should first be sure that's what you really want to do (e.g., you may confuse the heck out of extension modules trying to do I/O).  If it is, use os.close:
+<P>
+<PRE>
+    os.close(0)   # close C's stdin stream
+    os.close(1)   # close C's stdout stream
+    os.close(2)   # close C's stderr stream
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.087.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.087.htp">Log info</A>
+
+/ Last changed on Sat Apr 17 02:22:35 1999 by
+<A HREF="mailto:tim_one@email.msn.com">Tim Peters</A>
+<P>
+
+<HR>
+<H2><A NAME="4.88">4.88. What kinds of global value mutation are thread-safe?</A></H2>
+[adapted from c.l.py responses by Gordon McMillan &amp; GvR]
+<P>
+A global interpreter lock (GIL) is used internally to ensure that only one thread runs in the Python VM at a time.  In general, Python offers to switch among threads only between bytecode instructions (how frequently it offers to switch can be set via sys.setcheckinterval).  Each bytecode instruction-- and all the C implementation code reached from it --is therefore atomic.
+<P>
+In theory, this means an exact accounting requires an exact understanding of the PVM bytecode implementation.  In practice, it means that operations on shared vrbls of builtin data types (ints, lists, dicts, etc) that "look atomic" really are.
+<P>
+For example, these are atomic (L, L1, L2 are lists, D, D1, D2 are dicts, x, y
+are objects, i, j are ints):
+<P>
+<PRE>
+    L.append(x)
+    L1.extend(L2)
+    x = L[i]
+    x = L.pop()
+    L1[i:j] = L2
+    L.sort()
+    x = y
+    x.field = y
+    D[x] = y
+    D1.update(D2)
+    D.keys()
+</PRE>
+These aren't:
+<P>
+<PRE>
+    i = i+1
+    L.append(L[-1])
+    L[i] = L[j]
+    D[x] = D[x] + 1
+</PRE>
+Note: operations that replace other objects may invoke those other objects' __del__ method when their reference count reaches zero, and that can affect things.  This is especially true for the mass updates to dictionaries and lists.  When in doubt, use a mutex!
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.088.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.088.htp">Log info</A>
+
+/ Last changed on Fri Feb  7 16:21:03 2003 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="4.89">4.89. How do I modify a string in place?</A></H2>
+Strings are immutable (see question 6.2) so you cannot modify a string
+directly.  If you need an object with this ability, try converting the
+string to a list or take a look at the array module.
+<P>
+<PRE>
+    >>> s = "Hello, world"
+    >>> a = list(s)
+    >>> print a
+    ['H', 'e', 'l', 'l', 'o', ',', ' ', 'w', 'o', 'r', 'l', 'd']
+    >>> a[7:] = list("there!")
+    >>> import string
+    >>> print string.join(a, '')
+    'Hello, there!'
+</PRE>
+<PRE>
+    >>> import array
+    >>> a = array.array('c', s)
+    >>> print a
+    array('c', 'Hello, world')
+    >>> a[0] = 'y' ; print a
+    array('c', 'yello world')
+    >>> a.tostring()
+    'yello, world'
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.089.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.089.htp">Log info</A>
+
+/ Last changed on Tue May 18 01:22:47 1999 by
+<A HREF="mailto:dalke@bioreason.com">Andrew Dalke</A>
+<P>
+
+<HR>
+<H2><A NAME="4.90">4.90. How to pass on keyword/optional parameters/arguments</A></H2>
+Q: How can I pass on optional or keyword parameters from one function to another?
+<P>
+<PRE>
+	def f1(a, *b, **c):
+		...
+</PRE>
+A: In Python 2.0 and above:
+<P>
+<PRE>
+	def f2(x, *y, **z):
+		...
+		z['width']='14.3c'
+		...
+		f1(x, *y, **z)
+</PRE>
+<PRE>
+   Note: y can be any sequence (e.g., list or tuple) and z must be a dict.
+</PRE>
+<P>
+A: For versions prior to 2.0, use 'apply', like:
+<P>
+<PRE>
+	def f2(x, *y, **z):
+		...
+		z['width']='14.3c'
+		...
+		apply(f1, (x,)+y, z)
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.090.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.090.htp">Log info</A>
+
+/ Last changed on Mon Jun  3 07:20:56 2002 by
+<A HREF="mailto:smurf@noris.de">Matthias Urlichs</A>
+<P>
+
+<HR>
+<H2><A NAME="4.91">4.91. How can I get a dictionary to display its keys in a consistent order?</A></H2>
+In general, dictionaries store their keys in an unpredictable order,
+so the display order of a dictionary's elements will be similarly
+unpredictable.
+(See 
+<a href="http://www.python.org/doc/FAQ.html#6.12">Question 6.12</a>
+to understand why this is so.)
+<P>
+This can be frustrating if you want to save a printable version to a 
+file, make some changes and then compare it with some other printed
+dictionary.  If you have such needs you can subclass UserDict.UserDict
+to create a SortedDict class that prints itself in a predictable order.
+Here's one simpleminded implementation of such a class:
+<P>
+<PRE>
+  import UserDict, string
+</PRE>
+<PRE>
+  class SortedDict(UserDict.UserDict):
+    def __repr__(self):
+      result = []
+      append = result.append
+      keys = self.data.keys()
+      keys.sort()
+      for k in keys:
+        append("%s: %s" % (`k`, `self.data[k]`))
+      return "{%s}" % string.join(result, ", ")
+</PRE>
+<PRE>
+    ___str__ = __repr__
+</PRE>
+<P>
+This will work for many common situations you might encounter, though
+it's far from a perfect solution. (It won't have any effect on the
+pprint module and does not transparently handle values that are or
+contain dictionaries.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.091.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.091.htp">Log info</A>
+
+/ Last changed on Thu Sep 16 17:31:06 1999 by
+<A HREF="mailto:skip@mojam.com">Skip Montanaro</A>
+<P>
+
+<HR>
+<H2><A NAME="4.92">4.92. Is there a Python tutorial?</A></H2>
+Yes.  See question 1.20 at 
+<A HREF="http://www.python.org/doc/FAQ.html#1.20">http://www.python.org/doc/FAQ.html#1.20</A>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.092.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.092.htp">Log info</A>
+
+/ Last changed on Sat Dec  4 16:04:00 1999 by
+<A HREF="mailto:tbryan@python.net">TAB</A>
+<P>
+
+<HR>
+<H2><A NAME="4.93">4.93. Deleted</A></H2>
+See 4.28
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.093.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.093.htp">Log info</A>
+
+/ Last changed on Tue May 28 20:40:37 2002 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="4.94">4.94. How do I get a single keypress without blocking?</A></H2>
+There are several solutions; some involve using curses, which is a
+pretty big thing to learn.  Here's a solution without curses. (see also 4.74, for Windows, see question 8.2)
+<P>
+<PRE>
+  import termios, fcntl, sys, os
+  fd = sys.stdin.fileno()
+</PRE>
+<PRE>
+  oldterm = termios.tcgetattr(fd)
+  newattr = termios.tcgetattr(fd)
+  newattr[3] = newattr[3] &amp; ~termios.ICANON &amp; ~termios.ECHO
+  termios.tcsetattr(fd, termios.TCSANOW, newattr)
+</PRE>
+<PRE>
+  oldflags = fcntl.fcntl(fd, fcntl.F_GETFL)
+  fcntl.fcntl(fd, fcntl.F_SETFL, oldflags | os.O_NONBLOCK)
+</PRE>
+<PRE>
+  try:
+      while 1:
+          try:
+              c = sys.stdin.read(1)
+              print "Got character", `c`
+          except IOError: pass
+  finally:
+      termios.tcsetattr(fd, termios.TCSAFLUSH, oldterm)
+      fcntl.fcntl(fd, fcntl.F_SETFL, oldflags)
+</PRE>
+<P>
+You need the termios and the fcntl module for any of this to work, 
+and I've only tried it on Linux, though it should work elsewhere. 
+<P>
+In this code, characters are read and printed one at a time.
+<P>
+termios.tcsetattr() turns off stdin's echoing and disables canonical
+mode.  fcntl.fnctl() is used to obtain stdin's file descriptor flags
+and modify them for non-blocking mode.  Since reading stdin when it is
+empty results in an IOError, this error is caught and ignored.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.094.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.094.htp">Log info</A>
+
+/ Last changed on Thu Oct 24 00:39:06 2002 by
+<A HREF="mailto:cliechti@gmx.net">chris</A>
+<P>
+
+<HR>
+<H2><A NAME="4.95">4.95. Is there an equivalent to Perl chomp()? (Remove trailing newline from string)</A></H2>
+There are two partial substitutes. If you want to remove all trailing
+whitespace, use the method string.rstrip(). Otherwise, if there is only
+one line in the string, use string.splitlines()[0].
+<P>
+<PRE>
+ -----------------------------------------------------------------------
+</PRE>
+<PRE>
+ rstrip() is too greedy, it strips all trailing white spaces.
+ splitlines() takes ControlM as line boundary.
+ Consider these strings as input:
+   "python python    \r\n"
+   "python\rpython\r\n"
+   "python python   \r\r\r\n"
+ The results from rstrip()/splitlines() are perhaps not what we want.
+</PRE>
+<PRE>
+ It seems re can perform this task.
+</PRE>
+<P>
+<PRE>
+ #!/usr/bin/python 
+ # requires python2                                                             
+</PRE>
+<PRE>
+ import re, os, StringIO
+</PRE>
+<PRE>
+ lines=StringIO.StringIO(
+   "The Python Programming Language\r\n"
+   "The Python Programming Language \r \r \r\r\n"
+   "The\rProgramming\rLanguage\r\n"
+   "The\rProgramming\rLanguage\r\r\r\r\n"
+   "The\r\rProgramming\r\rLanguage\r\r\r\r\n"
+ )
+</PRE>
+<PRE>
+ ln=re.compile("(?:[\r]?\n|\r)$") # dos:\r\n, unix:\n, mac:\r, others: unknown
+ # os.linesep does not work if someone ftps(in binary mode) a dos/mac text file
+ # to your unix box
+ #ln=re.compile(os.linesep + "$")
+</PRE>
+<PRE>
+ while 1:
+   s=lines.readline()
+   if not s: break
+   print "1.(%s)" % `s.rstrip()`
+   print "2.(%s)" % `ln.sub( "", s, 1)`
+   print "3.(%s)" % `s.splitlines()[0]`
+   print "4.(%s)" % `s.splitlines()`
+   print
+</PRE>
+<PRE>
+ lines.close()
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.095.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.095.htp">Log info</A>
+
+/ Last changed on Wed Aug  8 09:51:34 2001 by
+<A HREF="mailto:serpent@ms5.hinet.net">Crystal</A>
+<P>
+
+<HR>
+<H2><A NAME="4.96">4.96. Why is join() a string method when I'm really joining the elements of a (list, tuple, sequence)?</A></H2>
+Strings became much more like other standard types starting in release 1.6, when methods were added which give the same functionality that has always been available using the functions of the string module.  These new methods have been widely accepted, but the one which appears to make (some) programmers feel uncomfortable is:
+<P>
+<PRE>
+    ", ".join(['1', '2', '4', '8', '16'])
+</PRE>
+which gives the result
+<P>
+<PRE>
+    "1, 2, 4, 8, 16"
+</PRE>
+There are two usual arguments against this usage.
+<P>
+The first runs along the lines of: "It looks really ugly using a method of a string literal (string constant)", to which the answer is that it might, but a string literal is just a fixed value. If the methods are to be allowed on names bound to strings there is no logical reason to make them unavailable on literals. Get over it!
+<P>
+The second objection is typically cast as: "I am really telling a sequence to join its members together with a string constant". Sadly, you aren't. For some reason there seems to be much less difficulty with having split() as a string method, since in that case it is easy to see that
+<P>
+<PRE>
+    "1, 2, 4, 8, 16".split(", ")
+</PRE>
+is an instruction to a string literal to return the substrings delimited by the given separator (or, by default, arbitrary runs of white space). In this case a Unicode string returns a list of Unicode strings, an ASCII string returns a list of ASCII strings, and everyone is happy.
+<P>
+join() is a string method because in using it you are telling the separator string to iterate over an arbitrary sequence, forming string representations of each of the elements, and inserting itself between the elements' representations.  This method can be used with any argument which obeys the rules for sequence objects, inluding any new classes you might define yourself.
+<P>
+Because this is a string method it can work for Unicode strings as well as plain ASCII strings. If join() were a method of the sequence types then the sequence types would have to decide which type of string to return depending on the type of the separator.
+<P>
+If none of these arguments persuade you, then for the moment you can continue to use the join() function from the string module, which allows you to write
+<P>
+<PRE>
+    string.join(['1', '2', '4', '8', '16'], ", ")
+</PRE>
+You will just have to try and forget that the string module actually uses the syntax you are compaining about to implement the syntax you prefer!
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.096.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.096.htp">Log info</A>
+
+/ Last changed on Fri Aug  2 15:51:58 2002 by
+<A HREF="mailto:sholden@holdenweb.com">Steve Holden</A>
+<P>
+
+<HR>
+<H2><A NAME="4.97">4.97. How can my code discover the name of an object?</A></H2>
+Generally speaking, it can't, because objects don't really have names. The assignment statement does not store the assigned value in the name but a reference to it. Essentially, assignment creates a binding of a name to a value. The same is true of <I>def</I> and <I>class</I> statements, but in that case the value is a callable. Consider the following code:
+<P>
+<PRE>
+    class A:
+        pass
+</PRE>
+<PRE>
+    B = A
+</PRE>
+<PRE>
+    a = B()
+    b = a
+    print b
+    &lt;__main__.A instance at 016D07CC&gt;
+    print a
+    &lt;__main__.A instance at 016D07CC&gt;
+</PRE>
+<P>
+Arguably the class has a name: even though it is bound to two names and invoked through the name B the created instance is still reported as an instance of class A. However, it is impossible to say whether the instance's name is a or b, since both names are bound to the same value.
+<P>
+Generally speaking it should not be necessary for your code to "know the names" of particular values. Unless you are deliberately writing introspective programs, this is usually an indication that a change of approach might be beneficial.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.097.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.097.htp">Log info</A>
+
+/ Last changed on Thu Mar  8 03:53:39 2001 by
+<A HREF="mailto:sholden@holdenweb.com">Steve Holden</A>
+<P>
+
+<HR>
+<H2><A NAME="4.98">4.98. Why are floating point calculations so inaccurate?</A></H2>
+The development version of the Python Tutorial now contains an Appendix with more info:
+<PRE>
+    <A HREF="http://www.python.org/doc/current/tut/node14.html">http://www.python.org/doc/current/tut/node14.html</A>
+</PRE>
+People are often very surprised by results like this:
+<P>
+<PRE>
+ >>> 1.2-1.0
+ 0.199999999999999996
+</PRE>
+And think it is a bug in Python. It's not. It's a problem caused by
+the internal representation of a floating point number. A floating point
+number is stored as a fixed number of binary digits.
+<P>
+In decimal math, there are many numbers that can't be represented
+with a fixed number of decimal digits, i.e.
+1/3 = 0.3333333333.......
+<P>
+In the binary case, 1/2 = 0.1, 1/4 = 0.01, 1/8 = 0.001, etc. There are 
+a lot of numbers that can't be represented. The digits are cut off at
+some point.
+<P>
+Since Python 1.6, a floating point's repr() function prints as many
+digits are necessary to make eval(repr(f)) == f true for any float f.
+The str() function prints the more sensible number that was probably
+intended:
+<P>
+<PRE>
+ >>> 0.2
+ 0.20000000000000001
+ >>> print 0.2
+ 0.2
+</PRE>
+Again, this has nothing to do with Python, but with the way the
+underlying C platform handles floating points, and ultimately with
+the inaccuracy you'll always have when writing down numbers of fixed
+number of digit strings.
+<P>
+One of the consequences of this is that it is dangerous to compare 
+the result of some computation to a float with == ! 
+Tiny inaccuracies may mean that == fails.
+<P>
+Instead try something like this:
+<P>
+<PRE>
+ epsilon = 0.0000000000001 # Tiny allowed error
+ expected_result = 0.4
+</PRE>
+<PRE>
+ if expected_result-epsilon &lt;= computation() &lt;= expected_result+epsilon:
+    ...
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.098.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.098.htp">Log info</A>
+
+/ Last changed on Mon Apr  1 22:18:47 2002 by
+<A HREF="mailto:fdrake@acm.org">Fred Drake</A>
+<P>
+
+<HR>
+<H2><A NAME="4.99">4.99. I tried to open Berkeley DB file, but bsddb produces bsddb.error: (22, 'Invalid argument'). Help! How can I restore my data?</A></H2>
+Don't panic! Your data are probably intact. The most frequent cause
+for the error is that you tried to open an earlier Berkeley DB file
+with a later version of the Berkeley DB library.
+<P>
+Many Linux systems now have all three versions of Berkeley DB
+available.  If you are migrating from version 1 to a newer version use
+db_dump185 to dump a plain text version of the database.
+If you are migrating from version 2 to version 3 use db2_dump to create
+a plain text version of the database.  In either case, use db_load to
+create a new native database for the latest version installed on your
+computer.  If you have version 3 of Berkeley DB installed, you should
+be able to use db2_load to create a native version 2 database.
+<P>
+You should probably move away from Berkeley DB version 1 files because
+the hash file code contains known bugs that can corrupt your data.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.099.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.099.htp">Log info</A>
+
+/ Last changed on Wed Aug 29 16:04:29 2001 by
+<A HREF="mailto:skip@pobox.com">Skip Montanaro</A>
+<P>
+
+<HR>
+<H2><A NAME="4.100">4.100. What are the &quot;best practices&quot; for using import in a module?</A></H2>
+First, the standard modules are great.  Use them!  The standard Python library is large and varied.  Using modules can save you time and effort and will reduce maintainenance cost of your code.  (Other programs are dedicated to supporting and fixing bugs in the standard Python modules.  Coworkers may also be familiar with themodules that you use, reducing the amount of time it takes them to understand your code.)
+<P>
+The rest of this answer is largely a matter of personal preference, but here's what some newsgroup posters said (thanks to all who responded)
+<P>
+In general, don't use 
+<PRE>
+ from modulename import *
+</PRE>
+Doing so clutters the importer's namespace.  Some avoid this idiom even with the few modules that were designed to be imported in this manner.  (Modules designed in this manner include Tkinter, thread, and wxPython.)
+<P>
+Import modules at the top of a file, one module per line.  Doing so makes it clear what other modules your code requires and avoids questions of whether the module name is in scope.  Using one import per line makes it easy to add and delete module imports.
+<P>
+Move imports into a local scope (such as at the top of a function definition) if there are a lot of imports, and you're trying to avoid the cost (lots of initialization time) of many imports.  This technique is especially helpful if many of the imports are unnecessary depending on how the program executes.  You may also want to move imports into a function if the modules are only ever used in that function.  Note that loading a module the first time may be expensive (because of the one time initialization of the module) but that loading a module multiple times is virtually free (a couple of dictionary lookups).  Even if the module name has gone out of scope, the module is probably available in sys.modules.  Thus, there isn't really anything wrong with putting no imports at the module level (if they aren't needed) and putting all of the imports at the function level.  
+<P>
+It is sometimes necessary to move imports to a function or class to avoid problems with circular imports.  Gordon says:
+<PRE>
+ Circular imports are fine where both modules use the "import &lt;module&gt;"
+ form of import. They fail when the 2nd module wants to grab a name
+ out of the first ("from module import name") and the import is at
+ the top level. That's because names in the 1st are not yet available,
+ (the first module is busy importing the 2nd).  
+</PRE>
+In this case, if the 2nd module is only used in one function, then the  import can easily be moved into that function.  By the time the import is called, the first module will have finished initializing, and the second module can do its import.
+<P>
+It may also be necessary to move imports out of the top level of code 
+if some of the modules are platform-specific.  In that case, it may not even be possible to import all of the modules at the top of the file.  In this case, importing the correct modules in the corresponding platform-specific code is a good option.   
+<P>
+If only instances of a specific class uses a module, then it is reasonable to import the module in the class's __init__ method and then assign the module to an instance variable so that the module is always available (via that instance variable) during the life of the object.  Note that to delay an import until the class is instantiated, the import must be inside a method.  Putting the import inside the class but outside of any method still causes the import to occur when the module is initialized.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.100.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.100.htp">Log info</A>
+
+/ Last changed on Sat Aug  4 04:44:47 2001 by
+<A HREF="mailto:tbryan@python.net">TAB</A>
+<P>
+
+<HR>
+<H2><A NAME="4.101">4.101. Is there a tool to help find bugs or perform static analysis?</A></H2>
+Yes.  PyChecker is a static analysis tool for finding bugs 
+in Python source code as well as warning about code complexity 
+and style.
+<P>
+You can get PyChecker from:  <A HREF="http://pychecker.sf.net">http://pychecker.sf.net</A>.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.101.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.101.htp">Log info</A>
+
+/ Last changed on Fri Aug 10 15:42:11 2001 by
+<A HREF="mailto:neal@metaslash.com">Neal</A>
+<P>
+
+<HR>
+<H2><A NAME="4.102">4.102. UnicodeError: ASCII [decoding,encoding] error: ordinal not in range(128)</A></H2>
+This error indicates that your Python installation can handle
+only 7-bit ASCII strings.  There are a couple ways to fix or
+workaround the problem.
+<P>
+If your programs must handle data in arbitary character set encodings, the environment the application runs in will generally identify the encoding of the data it is handing you.  You need to convert the input to Unicode data using that encoding.  For instance, a program that handles email or web input will typically find character set encoding information in Content-Type headers.  This can then be used to properly convert input data to Unicode. Assuming the string referred to by "value" is encoded as UTF-8:
+<P>
+<PRE>
+    value = unicode(value, "utf-8")
+</PRE>
+will return a Unicode object.  If the data is not correctly encoded as UTF-8, the above call will raise a UnicodeError.
+<P>
+If you only want strings coverted to Unicode which have non-ASCII data, you can try converting them first assuming an ASCII encoding, and then generate Unicode objects if that fails:
+<P>
+<PRE>
+    try:
+        x = unicode(value, "ascii")
+    except UnicodeError:
+        value = unicode(value, "utf-8")
+    else:
+        # value was valid ASCII data
+        pass
+</PRE>
+<P>
+If you normally use a character set encoding other than US-ASCII and only need to handle data in that encoding, the simplest way to fix the problem may be simply to set the encoding in sitecustomize.py. The following code is just a modified version of the encoding setup code from site.py with the relevant lines uncommented.
+<P>
+<PRE>
+    # Set the string encoding used by the Unicode implementation.
+    # The default is 'ascii'
+    encoding = "ascii" # &lt;= CHANGE THIS if you wish
+</PRE>
+<PRE>
+    # Enable to support locale aware default string encodings.
+    import locale
+    loc = locale.getdefaultlocale()
+    if loc[1]:
+        encoding = loc[1]
+    if encoding != "ascii":
+        import sys
+        sys.setdefaultencoding(encoding)
+</PRE>
+<P>
+Also note that on Windows, there is an encoding known as "mbcs", which uses an encoding specific to your current locale.  In many cases, and particularly when working with COM, this may be an appropriate default encoding to use.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.102.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.102.htp">Log info</A>
+
+/ Last changed on Sat Apr 13 04:45:41 2002 by
+<A HREF="mailto:skip@pobox.com">Skip Montanaro</A>
+<P>
+
+<HR>
+<H2><A NAME="4.103">4.103. Using strings to call functions/methods</A></H2>
+There are various techniques:
+<P>
+* Use a dictionary pre-loaded with strings and functions.  The primary
+advantage of this technique is that the strings do not need to match the
+names of the functions.  This is also the primary technique used to
+emulate a case construct:
+<P>
+<PRE>
+    def a():
+        pass
+</PRE>
+<PRE>
+    def b():
+        pass
+</PRE>
+<PRE>
+    dispatch = {'go': a, 'stop': b}  # Note lack of parens for funcs
+</PRE>
+<PRE>
+    dispatch[get_input()]()  # Note trailing parens to call function
+</PRE>
+* Use the built-in function getattr():
+<P>
+<PRE>
+    import foo
+    getattr(foo, 'bar')()
+</PRE>
+Note that getattr() works on any object, including classes, class
+instances, modules, and so on.
+<P>
+This is used in several places in the standard library, like
+this:
+<P>
+<PRE>
+    class Foo:
+        def do_foo(self):
+            ...
+</PRE>
+<PRE>
+        def do_bar(self):
+            ...
+</PRE>
+<PRE>
+     f = getattr(foo_instance, 'do_' + opname)
+     f()
+</PRE>
+<P>
+* Use locals() or eval() to resolve the function name:
+<P>
+def myFunc():
+<PRE>
+    print "hello"
+</PRE>
+fname = "myFunc"
+<P>
+f = locals()[fname]
+f()
+<P>
+f = eval(fname)
+f()
+<P>
+Note: Using eval() can be dangerous. If you don't have absolute control
+over the contents of the string, all sorts of things could happen...
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.103.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.103.htp">Log info</A>
+
+/ Last changed on Thu Mar 21 08:14:58 2002 by
+<A HREF="mailto:erno-pyfaq@erno.iki.fi">Erno Kuusela</A>
+<P>
+
+<HR>
+<H2><A NAME="4.104">4.104. How fast are exceptions?</A></H2>
+A try/except block is extremely efficient.  Actually executing an
+exception is expensive.  In older versions of Python (prior to 2.0), it
+was common to code this idiom:
+<P>
+<PRE>
+    try:
+        value = dict[key]
+    except KeyError:
+        dict[key] = getvalue(key)
+        value = dict[key]
+</PRE>
+This idiom only made sense when you expected the dict to have the key
+95% of the time or more; other times, you coded it like this:
+<P>
+<PRE>
+    if dict.has_key(key):
+        value = dict[key]
+    else:
+        dict[key] = getvalue(key)
+        value = dict[key]
+</PRE>
+In Python 2.0 and higher, of course, you can code this as
+<P>
+<PRE>
+    value = dict.setdefault(key, getvalue(key))
+</PRE>
+However this evaluates getvalue(key) always, regardless of whether it's needed or not.  So if it's slow or has a side effect you should use one of the above variants.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.104.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.104.htp">Log info</A>
+
+/ Last changed on Mon Dec  9 10:12:30 2002 by
+<A HREF="mailto:yeti@physics.muni.cz">Yeti</A>
+<P>
+
+<HR>
+<H2><A NAME="4.105">4.105. Sharing global variables across modules</A></H2>
+The canonical way to share information across modules within a single
+program is to create a special module (often called config or cfg).
+Just import the config module in all modules of your application; the
+module then becomes available as a global name.  Because there is only
+one instance of each module, any changes made to the module object get
+reflected everywhere.  For example:
+<P>
+config.py:
+<P>
+<PRE>
+    pass
+</PRE>
+mod.py:
+<P>
+<PRE>
+    import config
+    config.x = 1
+</PRE>
+main.py:
+<P>
+<PRE>
+    import config
+    import mod
+    print config.x
+</PRE>
+Note that using a module is also the basis for implementing the
+Singleton design pattern, for the same reason.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.105.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.105.htp">Log info</A>
+
+/ Last changed on Tue Apr 23 23:07:19 2002 by
+<A HREF="mailto:aahz@pythoncraft.com">Aahz</A>
+<P>
+
+<HR>
+<H2><A NAME="4.106">4.106. Why is cPickle so slow?</A></H2>
+Use the binary option.  We'd like to make that the default, but it would
+break backward compatibility:
+<P>
+<PRE>
+    largeString = 'z' * (100 * 1024)
+    myPickle = cPickle.dumps(largeString, 1)
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.106.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.106.htp">Log info</A>
+
+/ Last changed on Thu Aug 22 19:54:25 2002 by
+<A HREF="mailto:aahz@pythoncraft.com">Aahz</A>
+<P>
+
+<HR>
+<H2><A NAME="4.107">4.107. When importing module XXX, why do I get &quot;undefined symbol: PyUnicodeUCS2_...&quot; ?</A></H2>
+You are using a version of Python that uses a 4-byte representation for
+Unicode characters, but the extension module you are importing (possibly
+indirectly) was compiled using a Python that uses a 2-byte representation
+for Unicode characters (the default).
+<P>
+If instead the name of the undefined symbol starts with PyUnicodeUCS4_,
+the problem is the same by the relationship is reversed:  Python was
+built using 2-byte Unicode characters, and the extension module was
+compiled using a Python with 4-byte Unicode characters.
+<P>
+This can easily occur when using pre-built extension packages.  RedHat
+Linux 7.x, in particular, provides a "python2" binary that is compiled
+with 4-byte Unicode.  This only causes the link failure if the extension
+uses any of the PyUnicode_*() functions.  It is also a problem if if an
+extension uses any of the Unicode-related format specifiers for
+Py_BuildValue (or similar) or parameter-specifications for
+PyArg_ParseTuple().
+<P>
+You can check the size of the Unicode character a Python interpreter is
+using by checking the value of sys.maxunicode:
+<P>
+<PRE>
+  >>> import sys
+  >>> if sys.maxunicode > 65535:
+  ...     print 'UCS4 build'
+  ... else:
+  ...     print 'UCS2 build'
+</PRE>
+The only way to solve this problem is to use extension modules compiled
+with a Python binary built using the same size for Unicode characters.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.107.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.107.htp">Log info</A>
+
+/ Last changed on Tue Aug 27 15:00:17 2002 by
+<A HREF="mailto:fdrake@acm.org">Fred Drake</A>
+<P>
+
+<HR>
+<H2><A NAME="4.108">4.108. How do I create a .pyc file?</A></H2>
+QUESTION:
+<P>
+I have a module and I wish to generate a .pyc file.  
+How do I do it? Everything I read says that generation of a .pyc file is 
+"automatic", but I'm not getting anywhere.  
+<P>
+<P>
+ANSWER: 
+<P>
+When a module is imported for the first time (or when the source is more
+recent than the current compiled file) a .pyc file containing the compiled code should be created in the
+same directory as the .py file.
+<P>
+One reason that a .pyc file may not be created is permissions problems with the directory. This can happen, for example, if you develop as one user but run as another, such as if you are testing with a web server.
+<P>
+However, in most cases, that's not the problem.
+<P>
+Creation of a .pyc file is "automatic" if you are importing a module and Python has the
+ability (permissions, free space, etc...) to write the compiled module
+back to the directory. But note that running Python on a top level script is not considered an
+import and so no .pyc will be created automatically.  For example, if you have a top-level module abc.py that imports another module xyz.py, when you run abc, xyz.pyc will be created since xyz is imported, but no abc.pyc file will be created since abc isn't imported.
+<P>
+If you need to create abc.pyc -- that is, to create a .pyc file for a
+module that is not imported -- you can.  (Look up
+the py_compile and compileall modules in the Library Reference.) 
+<P>
+You can manually compile any module using the "py_compile" module.  One
+way is to use the compile() function in that module interactively:
+<P>
+<PRE>
+    >>> import py_compile
+    >>> py_compile.compile('abc.py')
+</PRE>
+This will write the .pyc to the same location as abc.py (or you
+can override that with the optional parameter cfile).
+<P>
+You can also automatically compile all files in a directory or
+directories using the "compileall" module, which can also be run
+straight from the command line.
+<P>
+You can do it from the shell (or DOS) prompt by entering:
+<PRE>
+       python compile.py abc.py
+</PRE>
+or 
+<PRE>
+       python compile.py *
+</PRE>
+Or you can write a script to do it on a list of filenames that you enter.
+<P>
+<PRE>
+     import sys
+     from py_compile import compile
+</PRE>
+<PRE>
+     if len(sys.argv) &lt;= 1:
+        sys.exit(1)
+</PRE>
+<PRE>
+     for file in sys.argv[1:]:
+        compile(file)
+</PRE>
+ACKNOWLEDGMENTS:
+<P>
+Steve Holden, David Bolen, Rich Somerfield,  Oleg Broytmann, Steve Ferg
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq04.108.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq04.108.htp">Log info</A>
+
+/ Last changed on Wed Feb 12 15:58:25 2003 by
+<A HREF="mailto:steve@ferg.org">Stephen Ferg</A>
+<P>
+
+<HR>
+<H1>5. Extending Python</H1>
+
+<HR>
+<H2><A NAME="5.1">5.1. Can I create my own functions in C?</A></H2>
+Yes, you can create built-in modules containing functions,
+variables, exceptions and even new types in C.  This is explained in
+the document "Extending and Embedding the Python Interpreter" (<A HREF="http://www.python.org/doc/current/ext/ext.html">http://www.python.org/doc/current/ext/ext.html</A>).  Also read the chapter
+on dynamic loading.
+<P>
+There's more information on this in each of the Python books:
+Programming Python, Internet Programming with Python, and Das Python-Buch
+(in German).
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq05.001.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq05.001.htp">Log info</A>
+
+/ Last changed on Mon Dec 10 05:18:57 2001 by
+<A HREF="mailto:fdrake@acm.org">Fred L. Drake, Jr.</A>
+<P>
+
+<HR>
+<H2><A NAME="5.2">5.2. Can I create my own functions in C++?</A></H2>
+Yes, using the C-compatibility features found in C++.  Basically
+you place extern "C" { ... } around the Python include files and put
+extern "C" before each function that is going to be called by the
+Python interpreter.  Global or static C++ objects with constructors
+are probably not a good idea.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq05.002.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq05.002.htp">Log info</A>
+<P>
+
+<HR>
+<H2><A NAME="5.3">5.3. How can I execute arbitrary Python statements from C?</A></H2>
+The highest-level function to do this is PyRun_SimpleString() which takes
+a single string argument which is executed in the context of module
+__main__ and returns 0 for success and -1 when an exception occurred
+(including SyntaxError).  If you want more control, use PyRun_String();
+see the source for PyRun_SimpleString() in Python/pythonrun.c.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq05.003.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq05.003.htp">Log info</A>
+
+/ Last changed on Fri May 23 20:08:14 1997 by
+<A HREF="mailto:billtut@microsoft.com">Bill Tutt</A>
+<P>
+
+<HR>
+<H2><A NAME="5.4">5.4. How can I evaluate an arbitrary Python expression from C?</A></H2>
+Call the function PyRun_String() from the previous question with the
+start symbol eval_input (Py_eval_input starting with 1.5a1); it 
+parses an expression, evaluates it and returns its value.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq05.004.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq05.004.htp">Log info</A>
+
+/ Last changed on Wed May 21 22:23:18 1997 by
+<A HREF="mailto:david_ascher@brown.edu">David Ascher</A>
+<P>
+
+<HR>
+<H2><A NAME="5.5">5.5. How do I extract C values from a Python object?</A></H2>
+That depends on the object's type.  If it's a tuple,
+PyTupleSize(o) returns its length and PyTuple_GetItem(o, i)
+returns its i'th item; similar for lists with PyListSize(o)
+and PyList_GetItem(o, i).  For strings, PyString_Size(o) returns
+its length and PyString_AsString(o) a pointer to its value
+(note that Python strings may contain null bytes so strlen()
+is not safe).  To test which type an object is, first make sure
+it isn't NULL, and then use PyString_Check(o), PyTuple_Check(o),
+PyList_Check(o), etc.
+<P>
+There is also a high-level API to Python objects which is
+provided by the so-called 'abstract' interface -- read
+Include/abstract.h for further details.  It allows for example 
+interfacing with any kind of Python sequence (e.g. lists and tuples)
+using calls like PySequence_Length(), PySequence_GetItem(), etc.)
+as well as many other useful protocols.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq05.005.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq05.005.htp">Log info</A>
+
+/ Last changed on Wed May 21 22:34:20 1997 by
+<A HREF="mailto:david_ascher@brown.edu">David Ascher</A>
+<P>
+
+<HR>
+<H2><A NAME="5.6">5.6. How do I use Py_BuildValue() to create a tuple of arbitrary length?</A></H2>
+You can't.  Use t = PyTuple_New(n) instead, and fill it with
+objects using PyTuple_SetItem(t, i, o) -- note that this "eats" a
+reference count of o.  Similar for lists with PyList_New(n) and
+PyList_SetItem(l, i, o).  Note that you <I>must</I> set all the tuple items to
+some value before you pass the tuple to Python code --
+PyTuple_New(n) initializes them to NULL, which isn't a valid Python
+value.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq05.006.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq05.006.htp">Log info</A>
+
+/ Last changed on Thu Jul 31 18:15:29 1997 by
+<A HREF="mailto:guido@python.org">Guido van Rossum</A>
+<P>
+
+<HR>
+<H2><A NAME="5.7">5.7. How do I call an object's method from C?</A></H2>
+The PyObject_CallMethod() function can be used to call an arbitrary
+method of an object.  The parameters are the object, the name of the
+method to call, a format string like that used with Py_BuildValue(), and the argument values:
+<P>
+<PRE>
+    PyObject *
+    PyObject_CallMethod(PyObject *object, char *method_name,
+                        char *arg_format, ...);
+</PRE>
+This works for any object that has methods -- whether built-in or
+user-defined.  You are responsible for eventually DECREF'ing the
+return value.
+<P>
+To call, e.g., a file object's "seek" method with arguments 10, 0
+(assuming the file object pointer is "f"):
+<P>
+<PRE>
+        res = PyObject_CallMethod(f, "seek", "(ii)", 10, 0);
+        if (res == NULL) {
+                ... an exception occurred ...
+        }
+        else {
+                Py_DECREF(res);
+        }
+</PRE>
+Note that since PyObject_CallObject() <I>always</I> wants a tuple for the
+argument list, to call a function without arguments, pass "()" for the
+format, and to call a function with one argument, surround the argument
+in parentheses, e.g. "(i)".
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq05.007.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq05.007.htp">Log info</A>
+
+/ Last changed on Thu Jun  6 16:15:46 2002 by
+<A HREF="mailto:neal@metaslash.com">Neal Norwitz</A>
+<P>
+
+<HR>
+<H2><A NAME="5.8">5.8. How do I catch the output from PyErr_Print() (or anything that prints to stdout/stderr)?</A></H2>
+(Due to Mark Hammond):
+<P>
+In Python code, define an object that supports the "write()" method.
+Redirect sys.stdout and sys.stderr to this object.
+Call print_error, or just allow the standard traceback mechanism to
+work. Then, the output will go wherever your write() method sends it.
+<P>
+The easiest way to do this is to use the StringIO class in the standard
+library.
+<P>
+Sample code and use for catching stdout:
+<PRE>
+	>>> class StdoutCatcher:
+	...  def __init__(self):
+	...   self.data = ''
+	...  def write(self, stuff):
+	...   self.data = self.data + stuff
+	...  
+	>>> import sys
+	>>> sys.stdout = StdoutCatcher()
+	>>> print 'foo'
+	>>> print 'hello world!'
+	>>> sys.stderr.write(sys.stdout.data)
+	foo
+	hello world!
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq05.008.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq05.008.htp">Log info</A>
+
+/ Last changed on Wed Dec 16 18:34:25 1998 by
+<A HREF="mailto:richard@bofh.asn.au">Richard Jones</A>
+<P>
+
+<HR>
+<H2><A NAME="5.9">5.9. How do I access a module written in Python from C?</A></H2>
+You can get a pointer to the module object as follows:
+<P>
+<PRE>
+        module = PyImport_ImportModule("&lt;modulename&gt;");
+</PRE>
+If the module hasn't been imported yet (i.e. it is not yet present in
+sys.modules), this initializes the module; otherwise it simply returns
+the value of sys.modules["&lt;modulename&gt;"].  Note that it doesn't enter
+the module into any namespace -- it only ensures it has been
+initialized and is stored in sys.modules.
+<P>
+You can then access the module's attributes (i.e. any name defined in
+the module) as follows:
+<P>
+<PRE>
+        attr = PyObject_GetAttrString(module, "&lt;attrname&gt;");
+</PRE>
+Calling PyObject_SetAttrString(), to assign to variables in the module, also works.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq05.009.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq05.009.htp">Log info</A>
+
+/ Last changed on Wed May 21 22:56:40 1997 by
+<A HREF="mailto:david_ascher@brown.edu">david ascher</A>
+<P>
+
+<HR>
+<H2><A NAME="5.10">5.10. How do I interface to C++ objects from Python?</A></H2>
+Depending on your requirements, there are many approaches.  To do
+this manually, begin by reading the "Extending and Embedding" document
+(Doc/ext.tex, see also <A HREF="http://www.python.org/doc">http://www.python.org/doc</A>/).  Realize
+that for the Python run-time system, there isn't a whole lot of
+difference between C and C++ -- so the strategy to build a new Python
+type around a C structure (pointer) type will also work for C++
+objects.
+<P>
+A useful automated approach (which also works for C) is SWIG:
+<A HREF="http://www.swig.org">http://www.swig.org</A>/.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq05.010.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq05.010.htp">Log info</A>
+
+/ Last changed on Fri Oct 15 05:14:01 1999 by
+<A HREF="mailto:sjoerd.mullender@oratrix.nl">Sjoerd Mullender</A>
+<P>
+
+<HR>
+<H2><A NAME="5.11">5.11. mSQLmodule (or other old module) won't build with Python 1.5 (or later)</A></H2>
+Since python-1.4 "Python.h" will have the file includes needed in an 
+extension module.
+Backward compatibility is dropped after version 1.4 and therefore 
+mSQLmodule.c will not build as "allobjects.h" cannot be found. 
+The following change in mSQLmodule.c is harmless when building it with
+1.4 and necessary when doing so for later python versions:
+<P>
+Remove lines:
+<P>
+<PRE>
+	#include "allobjects.h"
+	#include "modsupport.h"
+</PRE>
+And insert instead:
+<P>
+<PRE>
+	#include "Python.h"
+</PRE>
+You may also need to add
+<P>
+<PRE>
+                #include "rename2.h"
+</PRE>
+if the module uses "old names".
+<P>
+This may happen with other ancient python modules as well,
+and the same fix applies.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq05.011.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq05.011.htp">Log info</A>
+
+/ Last changed on Sun Dec 21 02:03:35 1997 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="5.12">5.12. I added a module using the Setup file and the make fails! Huh?</A></H2>
+Setup must end in a newline, if there is no newline there it gets
+very sad.  Aside from this possibility, maybe you have other
+non-Python-specific linkage problems.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq05.012.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq05.012.htp">Log info</A>
+
+/ Last changed on Tue Jun 24 15:54:01 1997 by
+<A HREF="mailto:aaron_watters@msn.com">aaron watters</A>
+<P>
+
+<HR>
+<H2><A NAME="5.13">5.13. I want to compile a Python module on my Red Hat Linux system, but some files are missing.</A></H2>
+Red Hat's RPM for Python doesn't include the 
+/usr/lib/python1.x/config/ directory, which contains various files required 
+for compiling Python extensions.
+Install the python-devel RPM to get the necessary files.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq05.013.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq05.013.htp">Log info</A>
+
+/ Last changed on Tue Jan 26 13:44:04 1999 by
+<A HREF="mailto:akuchling@acm.org">A.M. Kuchling</A>
+<P>
+
+<HR>
+<H2><A NAME="5.14">5.14. What does &quot;SystemError: _PyImport_FixupExtension: module yourmodule not loaded&quot; mean?</A></H2>
+This means that you have created an extension module named "yourmodule", but your module init function does not initialize with that name.
+<P>
+Every module init function will have a line similar to:
+<P>
+<PRE>
+  module = Py_InitModule("yourmodule", yourmodule_functions);
+</PRE>
+If the string passed to this function is not the same name as your extenion module, the SystemError will be raised.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq05.014.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq05.014.htp">Log info</A>
+
+/ Last changed on Thu Mar 25 07:16:08 1999 by
+<A HREF="mailto:mhammond@skippinet.com.au">Mark Hammond</A>
+<P>
+
+<HR>
+<H2><A NAME="5.15">5.15. How to tell &quot;incomplete input&quot; from &quot;invalid input&quot;?</A></H2>
+Sometimes you want to emulate the Python interactive interpreter's
+behavior, where it gives you a continuation prompt when the input
+is incomplete (e.g. you typed the start of an "if" statement
+or you didn't close your parentheses or triple string quotes),
+but it gives you a syntax error message immediately when the input
+is invalid.
+<P>
+In Python you can use the codeop module, which approximates the
+parser's behavior sufficiently.  IDLE uses this, for example.
+<P>
+The easiest way to do it in C is to call PyRun_InteractiveLoop()
+(in a separate thread maybe) and let the Python interpreter handle
+the input for you. You can also set the PyOS_ReadlineFunctionPointer
+to point at your custom input function. See Modules/readline.c and
+Parser/myreadline.c for more hints.
+<P>
+However sometimes you have to run the embedded Python interpreter
+in the same thread as your rest application and you can't allow the
+PyRun_InteractiveLoop() to stop while waiting for user input.
+The one solution then is to call PyParser_ParseString()
+and test for e.error equal to E_EOF (then the input is incomplete).
+Sample code fragment, untested, inspired by code from  Alex Farber:
+<P>
+<PRE>
+  #include &lt;Python.h&gt;
+  #include &lt;node.h&gt;
+  #include &lt;errcode.h&gt;
+  #include &lt;grammar.h&gt;
+  #include &lt;parsetok.h&gt;
+  #include &lt;compile.h&gt;
+</PRE>
+<PRE>
+  int testcomplete(char *code)
+    /* code should end in \n */
+    /* return -1 for error, 0 for incomplete, 1 for complete */
+  {
+    node *n;
+    perrdetail e;
+</PRE>
+<PRE>
+    n = PyParser_ParseString(code, &amp;_PyParser_Grammar,
+                             Py_file_input, &amp;e);
+    if (n == NULL) {
+      if (e.error == E_EOF) 
+        return 0;
+      return -1;
+    }
+</PRE>
+<PRE>
+    PyNode_Free(n);
+    return 1;
+  }
+</PRE>
+Another solution is trying to compile the received string with 
+Py_CompileString(). If it compiles fine - try to execute the returned 
+code object by calling PyEval_EvalCode(). Otherwise save the input for 
+later. If the compilation fails, find out if it's an error or just 
+more input is required - by extracting the message string from the 
+exception tuple and comparing it to the "unexpected EOF while parsing".
+Here is a complete example using the GNU readline library (you may
+want to ignore SIGINT while calling readline()):
+<P>
+<PRE>
+  #include &lt;stdio.h&gt;
+  #include &lt;readline.h&gt;
+</PRE>
+<PRE>
+  #include &lt;Python.h&gt;
+  #include &lt;object.h&gt;
+  #include &lt;compile.h&gt;
+  #include &lt;eval.h&gt;
+</PRE>
+<PRE>
+  int main (int argc, char* argv[])
+  {
+    int i, j, done = 0;                          /* lengths of line, code */
+    char ps1[] = ">>> ";
+    char ps2[] = "... ";
+    char *prompt = ps1;
+    char *msg, *line, *code = NULL;
+    PyObject *src, *glb, *loc;
+    PyObject *exc, *val, *trb, *obj, *dum;
+</PRE>
+<PRE>
+    Py_Initialize ();
+    loc = PyDict_New ();
+    glb = PyDict_New ();
+    PyDict_SetItemString (glb, "__builtins__", PyEval_GetBuiltins ());
+</PRE>
+<PRE>
+    while (!done)
+    {
+      line = readline (prompt);
+</PRE>
+<PRE>
+      if (NULL == line)                          /* CTRL-D pressed */
+      {
+        done = 1;
+      }
+      else
+      {
+        i = strlen (line);
+</PRE>
+<PRE>
+        if (i > 0)
+          add_history (line);                    /* save non-empty lines */
+</PRE>
+<PRE>
+        if (NULL == code)                        /* nothing in code yet */
+          j = 0;
+        else
+          j = strlen (code);
+</PRE>
+<PRE>
+        code = realloc (code, i + j + 2);
+        if (NULL == code)                        /* out of memory */
+          exit (1);
+</PRE>
+<PRE>
+        if (0 == j)                              /* code was empty, so */
+          code[0] = '\0';                        /* keep strncat happy */
+</PRE>
+<PRE>
+        strncat (code, line, i);                 /* append line to code */
+        code[i + j] = '\n';                      /* append '\n' to code */
+        code[i + j + 1] = '\0';
+</PRE>
+<PRE>
+        src = Py_CompileString (code, "&lt;stdin&gt;", Py_single_input);       
+</PRE>
+<PRE>
+        if (NULL != src)                         /* compiled just fine - */
+        {
+          if (ps1  == prompt ||                  /* "&gt;&gt;&gt; " or */
+              '\n' == code[i + j - 1])           /* "... " and double '\n' */
+          {                                               /* so execute it */
+            dum = PyEval_EvalCode ((PyCodeObject *)src, glb, loc);
+            Py_XDECREF (dum);
+            Py_XDECREF (src);
+            free (code);
+            code = NULL;
+            if (PyErr_Occurred ())
+              PyErr_Print ();
+            prompt = ps1;
+          }
+        }                                        /* syntax error or E_EOF? */
+        else if (PyErr_ExceptionMatches (PyExc_SyntaxError))           
+        {
+          PyErr_Fetch (&amp;exc, &amp;val, &amp;trb);        /* clears exception! */
+</PRE>
+<PRE>
+          if (PyArg_ParseTuple (val, "sO", &amp;msg, &amp;obj) &amp;&amp;
+              !strcmp (msg, "unexpected EOF while parsing")) /* E_EOF */
+          {
+            Py_XDECREF (exc);
+            Py_XDECREF (val);
+            Py_XDECREF (trb);
+            prompt = ps2;
+          }
+          else                                   /* some other syntax error */
+          {
+            PyErr_Restore (exc, val, trb);
+            PyErr_Print ();
+            free (code);
+            code = NULL;
+            prompt = ps1;
+          }
+        }
+        else                                     /* some non-syntax error */
+        {
+          PyErr_Print ();
+          free (code);
+          code = NULL;
+          prompt = ps1;
+        }
+</PRE>
+<PRE>
+        free (line);
+      }
+    }
+</PRE>
+<PRE>
+    Py_XDECREF(glb);
+    Py_XDECREF(loc);
+    Py_Finalize();
+    exit(0);
+  }
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq05.015.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq05.015.htp">Log info</A>
+
+/ Last changed on Wed Mar 15 09:47:24 2000 by
+<A HREF="mailto:farber@cpan.org">Alex Farber</A>
+<P>
+
+<HR>
+<H2><A NAME="5.16">5.16. How do I debug an extension?</A></H2>
+When using gdb with dynamically loaded extensions, you can't set a 
+breakpoint in your extension until your extension is loaded.
+<P>
+In your .gdbinit file (or interactively), add the command
+<P>
+br _PyImport_LoadDynamicModule
+<P>
+<P>
+$ gdb /local/bin/python
+<P>
+gdb) run myscript.py
+<P>
+gdb) continue # repeat until your extension is loaded
+<P>
+gdb) finish   # so that your extension is loaded
+<P>
+gdb) br myfunction.c:50
+<P>
+gdb) continue
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq05.016.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq05.016.htp">Log info</A>
+
+/ Last changed on Fri Oct 20 11:10:32 2000 by
+<A HREF="mailto:vanandel@ucar.edu">Joe VanAndel</A>
+<P>
+
+<HR>
+<H2><A NAME="5.17">5.17. How do I find undefined Linux g++ symbols, __builtin_new or __pure_virtural</A></H2>
+To dynamically load g++ extension modules, you must recompile python, relink python using g++ (change LINKCC in the python Modules Makefile), and link your extension module using g++ (e.g., "g++ -shared -o mymodule.so mymodule.o").
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq05.017.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq05.017.htp">Log info</A>
+
+/ Last changed on Sun Jan 14 18:03:51 2001 by
+<A HREF="mailto:dbo@angryduck.com">douglas orr</A>
+<P>
+
+<HR>
+<H2><A NAME="5.18">5.18. How do I define and create objects corresponding to built-in/extension types</A></H2>
+Usually you would like to be able to inherit from a Python type when
+you ask this question. The bottom line for Python 2.2 is: types and classes are miscible. You build instances by calling classes, and you can build subclasses to your heart's desire.
+<P>
+You need to be careful when instantiating immutable types like integers or strings. See <A HREF="http://www.amk.ca/python/2.2">http://www.amk.ca/python/2.2</A>/, section 2, for details.
+<P>
+Prior to version 2.2, Python (like Java) insisted that there are first-class and second-class objects (the former are types, the latter classes), and never the twain shall meet.
+<P>
+The library has, however, done a good job of providing class wrappers for the more commonly desired objects (see UserDict, UserList and UserString for examples), and more are always welcome if you happen to be in the mood to write code. These wrappers still exist in Python 2.2.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq05.018.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq05.018.htp">Log info</A>
+
+/ Last changed on Mon Jun 10 15:14:07 2002 by
+<A HREF="mailto:smurf@noris.de">Matthias Urlichs</A>
+<P>
+
+<HR>
+<H1>6. Python's design</H1>
+
+<HR>
+<H2><A NAME="6.1">6.1. Why isn't there a switch or case statement in Python?</A></H2>
+You can do this easily enough with a sequence of
+if... elif... elif... else.  There have been some proposals for switch
+statement syntax, but there is no consensus (yet) on whether and how
+to do range tests.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq06.001.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq06.001.htp">Log info</A>
+<P>
+
+<HR>
+<H2><A NAME="6.2">6.2. Why does Python use indentation for grouping of statements?</A></H2>
+Basically I believe that using indentation for grouping is
+extremely elegant and contributes a lot to the clarity of the average
+Python program.  Most people learn to love this feature after a while.
+Some arguments for it:
+<P>
+Since there are no begin/end brackets there cannot be a disagreement
+between grouping perceived by the parser and the human reader.  I
+remember long ago seeing a C fragment like this:
+<P>
+<PRE>
+        if (x &lt;= y)
+                x++;
+                y--;
+        z++;
+</PRE>
+and staring a long time at it wondering why y was being decremented
+even for x > y...  (And I wasn't a C newbie then either.)
+<P>
+Since there are no begin/end brackets, Python is much less prone to
+coding-style conflicts.  In C there are loads of different ways to
+place the braces (including the choice whether to place braces around
+single statements in certain cases, for consistency).  If you're used
+to reading (and writing) code that uses one style, you will feel at
+least slightly uneasy when reading (or being required to write)
+another style.
+Many coding styles place begin/end brackets on a line by themself.
+This makes programs considerably longer and wastes valuable screen
+space, making it harder to get a good overview over a program.
+Ideally, a function should fit on one basic tty screen (say, 20
+lines).  20 lines of Python are worth a LOT more than 20 lines of C.
+This is not solely due to the lack of begin/end brackets (the lack of
+declarations also helps, and the powerful operations of course), but
+it certainly helps!
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq06.002.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq06.002.htp">Log info</A>
+
+/ Last changed on Wed May 21 16:00:15 1997 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="6.3">6.3. Why are Python strings immutable?</A></H2>
+There are two advantages.  One is performance: knowing that a
+string is immutable makes it easy to lay it out at construction time
+-- fixed and unchanging storage requirements.  (This is also one of
+the reasons for the distinction between tuples and lists.)  The
+other is that strings in Python are considered as "elemental" as
+numbers.  No amount of activity will change the value 8 to anything
+else, and in Python, no amount of activity will change the string
+"eight" to anything else.  (Adapted from Jim Roskind)
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq06.003.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq06.003.htp">Log info</A>
+<P>
+
+<HR>
+<H2><A NAME="6.4">6.4. Delete</A></H2>
+<P>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq06.004.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq06.004.htp">Log info</A>
+
+/ Last changed on Tue Jan  2 03:05:25 2001 by
+<A HREF="mailto:moshez@zadka.site.co.il">Moshe Zadka</A>
+<P>
+
+<HR>
+<H2><A NAME="6.5">6.5. Why does Python use methods for some functionality (e.g. list.index()) but functions for other (e.g. len(list))?</A></H2>
+The major reason is history. Functions were used for those
+operations that were generic for a group of types and which
+were intended to work even for objects that didn't have
+methods at all (e.g. numbers before type/class unification
+began, or tuples).
+<P>
+It is also convenient to have a function that can readily be applied
+to an amorphous collection of objects when you use the functional features of Python (map(), apply() et al).
+<P>
+In fact, implementing len(), max(), min() as a built-in function is
+actually less code than implementing them as methods for each type.
+One can quibble about individual cases but it's a part of Python,
+and it's too late to change such things fundamentally now. The
+functions have to remain to avoid massive code breakage.
+<P>
+Note that for string operations Python has moved from external functions
+(the string module) to methods.  However, len() is still a function.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq06.005.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq06.005.htp">Log info</A>
+
+/ Last changed on Thu May 30 14:08:58 2002 by
+<A HREF="mailto:sholden@holdenweb.com">Steve Holden</A>
+<P>
+
+<HR>
+<H2><A NAME="6.6">6.6. Why can't I derive a class from built-in types (e.g. lists or files)?</A></H2>
+As of Python 2.2, you can derive from built-in types.  For previous versions, the answer is:
+<P>
+This is caused by the relatively late addition of (user-defined)
+classes to the language -- the implementation framework doesn't easily
+allow it.  See the answer to question 4.2 for a work-around.  This
+<I>may</I> be fixed in the (distant) future.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq06.006.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq06.006.htp">Log info</A>
+
+/ Last changed on Thu May 23 02:53:22 2002 by
+<A HREF="mailto:neal@metaslash.com">Neal Norwitz</A>
+<P>
+
+<HR>
+<H2><A NAME="6.7">6.7. Why must 'self' be declared and used explicitly in method definitions and calls?</A></H2>
+So, is your current programming language C++ or Java? :-)
+When classes were added to Python, this was (again) the simplest way of
+implementing methods without too many changes to the interpreter.  The
+idea was borrowed from Modula-3.  It turns out to be very useful, for
+a variety of reasons.
+<P>
+First, it makes it more obvious that you are using a method or
+instance attribute instead of a local variable.  Reading "self.x" or
+"self.meth()" makes it absolutely clear that an instance variable or
+method is used even if you don't know the class definition by heart.
+In C++, you can sort of tell by the lack of a local variable
+declaration (assuming globals are rare or easily recognizable) -- but
+in Python, there are no local variable declarations, so you'd have to
+look up the class definition to be sure.
+<P>
+Second, it means that no special syntax is necessary if you want to
+explicitly reference or call the method from a particular class.  In
+C++, if you want to use a method from base class that is overridden in
+a derived class, you have to use the :: operator -- in Python you can
+write baseclass.methodname(self, &lt;argument list&gt;).  This is
+particularly useful for __init__() methods, and in general in cases
+where a derived class method wants to extend the base class method of
+the same name and thus has to call the base class method somehow.
+<P>
+Lastly, for instance variables, it solves a syntactic problem with
+assignment: since local variables in Python are (by definition!) those
+variables to which a value assigned in a function body (and that
+aren't explicitly declared global), there has to be some way to tell
+the interpreter that an assignment was meant to assign to an instance
+variable instead of to a local variable, and it should preferably be
+syntactic (for efficiency reasons).  C++ does this through
+declarations, but Python doesn't have declarations and it would be a
+pity having to introduce them just for this purpose.  Using the
+explicit "self.var" solves this nicely.  Similarly, for using instance
+variables, having to write "self.var" means that references to
+unqualified names inside a method don't have to search the instance's
+directories.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq06.007.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq06.007.htp">Log info</A>
+
+/ Last changed on Fri Jan 12 08:01:50 2001 by
+<A HREF="mailto:sholden@holdenweb.com">Steve Holden</A>
+<P>
+
+<HR>
+<H2><A NAME="6.8">6.8. Can't you emulate threads in the interpreter instead of relying on an OS-specific thread implementation?</A></H2>
+Answer 1: Unfortunately, the interpreter pushes at least one C stack
+frame for each Python stack frame.  Also, extensions can call back into
+Python at almost random moments.  Therefore a complete threads
+implementation requires thread support for C.
+<P>
+Answer 2: Fortunately, there is Stackless Python, which has a completely redesigned interpreter loop that avoids the C stack. It's still experimental but looks very promising. Although it is binary compatible with standard Python, it's still unclear whether Stackless will make it into the core -- maybe it's just too revolutionary. Stackless Python currently lives here: <A HREF="http://www.stackless.com">http://www.stackless.com</A>. A microthread implementation that uses it can be found here: <A HREF="http://world.std.com/~wware/uthread.html">http://world.std.com/~wware/uthread.html</A>.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq06.008.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq06.008.htp">Log info</A>
+
+/ Last changed on Sat Apr 15 08:18:16 2000 by
+<A HREF="mailto:just@letterror.com">Just van Rossum</A>
+<P>
+
+<HR>
+<H2><A NAME="6.9">6.9. Why can't lambda forms contain statements?</A></H2>
+Python lambda forms cannot contain statements because Python's
+syntactic framework can't handle statements nested inside expressions.
+<P>
+However, in Python, this is not a serious problem.  Unlike lambda
+forms in other languages, where they add functionality, Python lambdas
+are only a shorthand notation if you're too lazy to define a function.
+<P>
+Functions are already first class objects in Python, and can be
+declared in a local scope.  Therefore the only advantage of using a
+lambda form instead of a locally-defined function is that you don't need to invent a name for the function -- but that's just a local variable to which the function object (which is exactly the same type of object that a lambda form yields) is assigned!
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq06.009.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq06.009.htp">Log info</A>
+
+/ Last changed on Sun Jun 14 14:15:17 1998 by
+<A HREF="mailto:tim_one@email.msn.com">Tim Peters</A>
+<P>
+
+<HR>
+<H2><A NAME="6.10">6.10. [deleted]</A></H2>
+[lambda vs non-nested scopes used to be here]
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq06.010.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq06.010.htp">Log info</A>
+
+/ Last changed on Thu Mar 21 05:20:56 2002 by
+<A HREF="mailto:erno-pyfaq@erno.iki.fi">Erno Kuusela</A>
+<P>
+
+<HR>
+<H2><A NAME="6.11">6.11. [deleted]</A></H2>
+[recursive functions vs non-nested scopes used to be here]
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq06.011.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq06.011.htp">Log info</A>
+
+/ Last changed on Thu Mar 21 05:22:04 2002 by
+<A HREF="mailto:erno-pyfaq@erno.iki.fi">Erno Kuusela</A>
+<P>
+
+<HR>
+<H2><A NAME="6.12">6.12. Why is there no more efficient way of iterating over a dictionary than first constructing the list of keys()?</A></H2>
+As of Python 2.2, you can now iterate over a dictionary directly,
+using the new implied dictionary iterator:
+<P>
+<PRE>
+    for k in d: ...
+</PRE>
+There are also methods returning iterators over the values and items:
+<P>
+<PRE>
+    for k in d.iterkeys(): # same as above
+    for v in d.itervalues(): # iterate over values
+    for k, v in d.iteritems(): # iterate over items
+</PRE>
+All these require that you do not modify the dictionary during the loop.
+<P>
+For previous Python versions, the following defense should do:
+<P>
+Have you tried it?  I bet it's fast enough for your purposes!  In
+most cases such a list takes only a few percent of the space occupied
+by the dictionary.  Apart from the fixed header,
+the list needs only 4 bytes (the size of a pointer) per
+key.  A dictionary uses 12 bytes per key plus between 30 and 70
+percent hash table overhead, plus the space for the keys and values.
+By necessity, all keys are distinct objects, and a string object (the most
+common key type) costs at least 20 bytes plus the length of the
+string.  Add to that the values contained in the dictionary, and you
+see that 4 bytes more per item really isn't that much more memory...
+<P>
+A call to dict.keys() makes one fast scan over the dictionary
+(internally, the iteration function does exist) copying the pointers
+to the key objects into a pre-allocated list object of the right size.
+The iteration time isn't lost (since you'll have to iterate anyway --
+unless in the majority of cases your loop terminates very prematurely
+(which I doubt since you're getting the keys in random order).
+<P>
+I don't expose the dictionary iteration operation to Python
+programmers because the dictionary shouldn't be modified during the
+entire iteration -- if it is, there's a small chance that the
+dictionary is reorganized because the hash table becomes too full, and
+then the iteration may miss some items and see others twice.  Exactly
+because this only occurs rarely, it would lead to hidden bugs in
+programs: it's easy never to have it happen during test runs if you
+only insert or delete a few items per iteration -- but your users will 
+surely hit upon it sooner or later.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq06.012.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq06.012.htp">Log info</A>
+
+/ Last changed on Fri May 24 21:24:08 2002 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="6.13">6.13. Can Python be compiled to machine code, C or some other language?</A></H2>
+Not easily.  Python's high level data types, dynamic typing of
+objects and run-time invocation of the interpreter (using eval() or
+exec) together mean that a "compiled" Python program would probably
+consist mostly of calls into the Python run-time system, even for
+seemingly simple operations like "x+1".
+<P>
+Several projects described in the Python newsgroup or at past
+Python conferences have shown that this approach is feasible,
+although the speedups reached so far are only modest (e.g. 2x).
+JPython uses the same strategy for compiling to Java bytecode.
+(Jim Hugunin has demonstrated that in combination with whole-program
+analysis, speedups of 1000x are feasible for small demo programs.
+See the website for the 1997 Python conference.)
+<P>
+Internally, Python source code is always translated into a "virtual
+machine code" or "byte code" representation before it is interpreted
+(by the "Python virtual machine" or "bytecode interpreter").  In order
+to avoid the overhead of parsing and translating modules that rarely
+change over and over again, this byte code is written on a file whose
+name ends in ".pyc" whenever a module is parsed (from a file whose
+name ends in ".py").  When the corresponding .py file is changed, it
+is parsed and translated again and the .pyc file is rewritten.
+<P>
+There is no performance difference once the .pyc file has been loaded
+(the bytecode read from the .pyc file is exactly the same as the bytecode
+created by direct translation).  The only difference is that loading
+code from a .pyc file is faster than parsing and translating a .py
+file, so the presence of precompiled .pyc files will generally improve
+start-up time of Python scripts.  If desired, the Lib/compileall.py
+module/script can be used to force creation of valid .pyc files for a
+given set of modules.
+<P>
+Note that the main script executed by Python, even if its filename
+ends in .py, is not compiled to a .pyc file.  It is compiled to
+bytecode, but the bytecode is not saved to a file.
+<P>
+If you are looking for a way to translate Python programs in order to
+distribute them in binary form, without the need to distribute the
+interpreter and library as well, have a look at the freeze.py script
+in the Tools/freeze directory.  This creates a single binary file
+incorporating your program, the Python interpreter, and those parts of
+the Python library that are needed by your program.  Of course, the
+resulting binary will only run on the same type of platform as that
+used to create it.
+<P>
+Newsflash: there are now several programs that do this, to some extent.
+Look for Psyco, Pyrex, PyInline, Py2Cmod, and Weave.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq06.013.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq06.013.htp">Log info</A>
+
+/ Last changed on Fri May 24 21:26:19 2002 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="6.14">6.14. How does Python manage memory?</A></H2>
+The details of Python memory management depend on the implementation.
+The standard Python implementation (the C implementation) uses reference
+counting and another mechanism to collect reference cycles.
+<P>
+Jython relies on the Java runtime; so it uses
+the JVM's garbage collector.  This difference can cause some subtle
+porting problems if your Python code depends on the behavior of
+the reference counting implementation.
+<P>
+The reference cycle collector was added in CPython 2.0. It
+periodically executes a cycle detection algorithm which looks for inaccessible cycles and deletes the objects involved. A new gc module provides functions to perform a garbage collection, obtain debugging statistics, and tuning the collector's parameters. 
+<P>
+The detection of cycles can be disabled when Python is compiled, if you can't afford even a tiny speed penalty or suspect that the cycle collection is buggy, by specifying the "--without-cycle-gc" switch when running the configure script. 
+<P>
+Sometimes objects get stuck in "tracebacks" temporarily and hence are not deallocated when you might expect.  Clear the tracebacks via
+<P>
+<PRE>
+       import sys
+       sys.exc_traceback = sys.last_traceback = None
+</PRE>
+Tracebacks are used for reporting errors and implementing debuggers and related things.  They contain a portion of the program state extracted during the handling of an exception (usually the most recent exception).
+<P>
+In the absence of circularities and modulo tracebacks, Python programs need not explicitly manage memory.
+<P>
+Why python doesn't use a more traditional garbage collection
+scheme? For one thing, unless this were
+added to C as a standard feature, it's a portability pain in the ass.
+And yes, I know about the Xerox library.  It has bits of assembler
+code for <I>most</I> <I>common</I> platforms.  Not for all.  And although it is
+mostly transparent, it isn't completely transparent (when I once
+linked Python with it, it dumped core).
+<P>
+Traditional GC also becomes a problem when Python gets embedded into
+other applications.  While in a stand-alone Python it may be fine to
+replace the standard malloc() and free() with versions provided by the
+GC library, an application embedding Python may want to have its <I>own</I>
+substitute for malloc() and free(), and may not want Python's.  Right
+now, Python works with anything that implements malloc() and free()
+properly.
+<P>
+In Jython, the following code (which is 
+fine in C Python) will probably run out of file descriptors long before
+it runs out of memory:
+<P>
+<PRE>
+        for file in &lt;very long list of files&gt;:
+                f = open(file)
+                c = f.read(1)
+</PRE>
+Using the current reference counting and destructor scheme, each new
+assignment to f closes the previous file.  Using GC, this is not
+guaranteed.  Sure, you can think of ways to fix this.  But it's not
+off-the-shelf technology.  If you want to write code that will
+work with any Python implementation, you should explicitly close
+the file; this will work regardless of GC:
+<P>
+<PRE>
+       for file in &lt;very long list of files&gt;:
+                f = open(file)
+                c = f.read(1)
+                f.close()
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq06.014.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq06.014.htp">Log info</A>
+
+/ Last changed on Thu Mar 21 05:35:38 2002 by
+<A HREF="mailto:erno-pyfaq@erno.iki.fi">Erno Kuusela</A>
+<P>
+
+<HR>
+<H2><A NAME="6.15">6.15. Why are there separate tuple and list data types?</A></H2>
+This is done so that tuples can be immutable while lists are mutable.
+<P>
+Immutable tuples are useful in situations where you need to pass a few
+items to a function and don't want the function to modify the tuple;
+for example,
+<P>
+<PRE>
+	point1 = (120, 140)
+	point2 = (200, 300)
+	record(point1, point2)
+	draw(point1, point2)
+</PRE>
+You don't want to have to think about what would happen if record()
+changed the coordinates -- it can't, because the tuples are immutable.
+<P>
+On the other hand, when creating large lists dynamically, it is
+absolutely crucial that they are mutable -- adding elements to a tuple
+one by one requires using the concatenation operator, which makes it
+quadratic in time.
+<P>
+As a general guideline, use tuples like you would use structs in C or
+records in Pascal, use lists like (variable length) arrays.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq06.015.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq06.015.htp">Log info</A>
+
+/ Last changed on Fri May 23 15:26:03 1997 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="6.16">6.16. How are lists implemented?</A></H2>
+Despite what a Lisper might think, Python's lists are really
+variable-length arrays.  The implementation uses a contiguous
+array of references to other objects, and keeps a pointer
+to this array (as well as its length) in a list head structure.
+<P>
+This makes indexing a list (a[i]) an operation whose cost is
+independent of the size of the list or the value of the index.
+<P>
+When items are appended or inserted, the array of references is resized.
+Some cleverness is applied to improve the performance of appending
+items repeatedly; when the array must be grown, some extra space
+is allocated so the next few times don't require an actual resize.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq06.016.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq06.016.htp">Log info</A>
+
+/ Last changed on Fri May 23 15:32:24 1997 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="6.17">6.17. How are dictionaries implemented?</A></H2>
+Python's dictionaries are implemented as resizable hash tables.
+<P>
+Compared to B-trees, this gives better performance for lookup
+(the most common operation by far) under most circumstances,
+and the implementation is simpler.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq06.017.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq06.017.htp">Log info</A>
+
+/ Last changed on Fri May 23 23:51:14 1997 by
+<A HREF="mailto:Vladimir.Marangozov@inrialpes.fr">Vladimir Marangozov</A>
+<P>
+
+<HR>
+<H2><A NAME="6.18">6.18. Why must dictionary keys be immutable?</A></H2>
+The hash table implementation of dictionaries uses a hash value
+calculated from the key value to find the key.  If the key were
+a mutable object, its value could change, and thus its hash could
+change.  But since whoever changes the key object can't tell that
+is incorporated in a dictionary, it can't move the entry around in
+the dictionary.  Then, when you try to look up the same object
+in the dictionary, it won't be found, since its hash value is different;
+and if you try to look up the old value, it won't be found either,
+since the value of the object found in that hash bin differs.
+<P>
+If you think you need to have a dictionary indexed with a list,
+try to use a tuple instead.  The function tuple(l) creates a tuple
+with the same entries as the list l.
+<P>
+Some unacceptable solutions that have been proposed:
+<P>
+- Hash lists by their address (object ID).  This doesn't work because
+if you construct a new list with the same value it won't be found;
+e.g.,
+<P>
+<PRE>
+  d = {[1,2]: '12'}
+  print d[[1,2]]
+</PRE>
+will raise a KeyError exception because the id of the [1,2] used
+in the second line differs from that in the first line.
+In other words, dictionary keys should be compared using '==', not using 'is'.
+<P>
+- Make a copy when using a list as a key.  This doesn't work because
+the list (being a mutable object) could contain a reference to itself,
+and then the copying code would run into an infinite loop.
+<P>
+- Allow lists as keys but tell the user not to modify them.  This would
+allow a class of hard-to-track bugs in programs that I'd rather not see;
+it invalidates an important invariant of dictionaries (every value in
+d.keys() is usable as a key of the dictionary).
+<P>
+- Mark lists as read-only once they are used as a dictionary key.
+The problem is that it's not just the top-level object that could change
+its value; you could use a tuple containing a list as a key.  Entering
+anything as a key into a dictionary would require marking all objects
+reachable from there as read-only -- and again, self-referential objects
+could cause an infinite loop again (and again and again).
+<P>
+There is a trick to get around this if you need to, but
+use it at your own risk:  You
+can wrap a mutable structure inside a class instance which
+has both a __cmp__ and a __hash__ method.  
+<P>
+<PRE>
+   class listwrapper:
+        def __init__(self, the_list):
+              self.the_list = the_list
+        def __cmp__(self, other):
+              return self.the_list == other.the_list
+        def __hash__(self):
+              l = self.the_list
+              result = 98767 - len(l)*555
+              for i in range(len(l)):
+                   try:
+                        result = result + (hash(l[i]) % 9999999) * 1001 + i
+                   except:
+                        result = (result % 7777777) + i * 333
+              return result
+</PRE>
+Note that the hash computation is complicated by the
+possibility that some members of the list may be unhashable
+and also by the possibility of arithmetic overflow.
+<P>
+You must make
+sure that the hash value for all such wrapper objects that reside in a
+dictionary (or other hash based structure), remain fixed while
+the object is in the dictionary (or other structure).
+<P>
+Furthermore it must always be the case that if
+o1 == o2 (ie o1.__cmp__(o2)==0) then hash(o1)==hash(o2)
+(ie, o1.__hash__() == o2.__hash__()), regardless of whether
+the object is in a dictionary or not.
+If you fail to meet these restrictions dictionaries and other
+hash based structures may misbehave!
+<P>
+In the case of listwrapper above whenever the wrapper
+object is in a dictionary the wrapped list must not change
+to avoid anomalies.  Don't do this unless you are prepared
+to think hard about the requirements and the consequences
+of not meeting them correctly.  You've been warned!
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq06.018.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq06.018.htp">Log info</A>
+
+/ Last changed on Thu Jul 10 10:08:40 1997 by
+<A HREF="mailto:aaron_watters@msn.com">aaron watters</A>
+<P>
+
+<HR>
+<H2><A NAME="6.19">6.19. How the heck do you make an array in Python?</A></H2>
+["this", 1, "is", "an", "array"]
+<P>
+Lists are arrays in the C or Pascal sense of the word (see question
+6.16).  The array module also provides methods for creating arrays
+of fixed types with compact representations (but they are slower to
+index than lists).  Also note that the Numerics extensions and others
+define array-like structures with various characteristics as well.
+<P>
+To get Lisp-like lists, emulate cons cells
+<P>
+<PRE>
+    lisp_list = ("like",  ("this",  ("example", None) ) )
+</PRE>
+using tuples (or lists, if you want mutability).  Here the analogue
+of lisp car is lisp_list[0] and the analogue of cdr is lisp_list[1].
+Only do this if you're sure you really need to (it's usually a lot
+slower than using Python lists).
+<P>
+Think of Python lists as mutable heterogeneous arrays of
+Python objects (say that 10 times fast :) ).
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq06.019.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq06.019.htp">Log info</A>
+
+/ Last changed on Wed Aug 13 07:08:27 1997 by
+<A HREF="mailto:aaron_watters@msn.com">aaron watters</A>
+<P>
+
+<HR>
+<H2><A NAME="6.20">6.20. Why doesn't list.sort() return the sorted list?</A></H2>
+In situations where performance matters, making a copy of the list
+just to sort it would be wasteful.  Therefore, list.sort() sorts
+the list in place.  In order to remind you of that fact, it does
+not return the sorted list.  This way, you won't be fooled into
+accidentally overwriting a list when you need a sorted copy but also
+need to keep the unsorted version around.
+<P>
+As a result, here's the idiom to iterate over the keys of a dictionary
+in sorted order:
+<P>
+<PRE>
+	keys = dict.keys()
+	keys.sort()
+	for key in keys:
+		...do whatever with dict[key]...
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq06.020.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq06.020.htp">Log info</A>
+
+/ Last changed on Thu Dec  2 17:01:52 1999 by
+<A HREF="mailto:fdrake@acm.org">Fred L. Drake, Jr.</A>
+<P>
+
+<HR>
+<H2><A NAME="6.21">6.21. How do you specify and enforce an interface spec in Python?</A></H2>
+An interfaces specification for a module as provided
+by languages such as C++ and java describes the prototypes
+for the methods and functions of the module.  Many feel
+that compile time enforcement of interface specifications
+help aid in the construction of large programs.  Python
+does not support interface specifications directly, but many
+of their advantages can be obtained by an appropriate
+test discipline for components, which can often be very
+easily accomplished in Python.  There is also a tool, PyChecker,
+which can be used to find problems due to subclassing.
+<P>
+A good test suite for a module can at
+once provide a regression test and serve as a module interface
+specification (even better since it also gives example usage).  Look to
+many of the standard libraries which often have a "script
+interpretation" which provides a simple "self test."  Even
+modules which use complex external interfaces can often
+be tested in isolation using trivial "stub" emulations of the
+external interface.
+<P>
+An appropriate testing discipline (if enforced) can help
+build large complex applications in Python as well as having interface
+specifications would do (or better).  Of course Python allows you 
+to get sloppy and not do it.  Also you might want to design
+your code with an eye to make it easily tested.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq06.021.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq06.021.htp">Log info</A>
+
+/ Last changed on Thu May 23 03:05:29 2002 by
+<A HREF="mailto:neal@metaslash.com">Neal Norwitz</A>
+<P>
+
+<HR>
+<H2><A NAME="6.22">6.22. Why do all classes have the same type? Why do instances all have the same type?</A></H2>
+The Pythonic use of the word "type" is quite different from
+common usage in much of the rest of the programming language
+world.  A "type" in Python is a description for an object's operations
+as implemented in C.  All classes have the same operations
+implemented in C which sometimes "call back" to differing program
+fragments implemented in Python, and hence all classes have the
+same type.  Similarly at the C level all class instances have the
+same C implementation, and hence all instances have the same
+type.
+<P>
+Remember that in Python usage "type" refers to a C implementation
+of an object.  To distinguish among instances of different classes
+use Instance.__class__, and also look to 4.47.  Sorry for the
+terminological confusion, but at this point in Python's development
+nothing can be done!
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq06.022.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq06.022.htp">Log info</A>
+
+/ Last changed on Tue Jul  1 12:35:47 1997 by
+<A HREF="mailto:aaron_watters@msn.com">aaron watters</A>
+<P>
+
+<HR>
+<H2><A NAME="6.23">6.23. Why isn't all memory freed when Python exits?</A></H2>
+Objects referenced from Python module global name spaces are
+not always deallocated when Python exits.
+<P>
+This may happen if there are circular references (see question
+4.17).  There are also certain bits of memory that are allocated
+by the C library that are impossible to free (e.g. a tool
+like Purify will complain about these).
+<P>
+But in general, Python 1.5 and beyond
+(in contrast with earlier versions) is quite agressive about
+cleaning up memory on exit.
+<P>
+If you want to force Python to delete certain things on deallocation
+use the sys.exitfunc hook to force those deletions.  For example
+if you are debugging an extension module using a memory analysis
+tool and you wish to make Python deallocate almost everything
+you might use an exitfunc like this one:
+<P>
+<PRE>
+  import sys
+</PRE>
+<PRE>
+  def my_exitfunc():
+       print "cleaning up"
+       import sys
+       # do order dependant deletions here
+       ...
+       # now delete everything else in arbitrary order
+       for x in sys.modules.values():
+            d = x.__dict__
+            for name in d.keys():
+                 del d[name]
+</PRE>
+<PRE>
+  sys.exitfunc = my_exitfunc
+</PRE>
+Other exitfuncs can be less drastic, of course.
+<P>
+(In fact, this one just does what Python now already does itself;
+but the example of using sys.exitfunc to force cleanups is still
+useful.)
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq06.023.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq06.023.htp">Log info</A>
+
+/ Last changed on Tue Sep 29 09:46:26 1998 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="6.24">6.24. Why no class methods or mutable class variables?</A></H2>
+The notation
+<P>
+<PRE>
+    instance.attribute(arg1, arg2)
+</PRE>
+usually translates to the equivalent of
+<P>
+<PRE>
+    Class.attribute(instance, arg1, arg2)
+</PRE>
+where Class is a (super)class of instance.  Similarly
+<P>
+<PRE>
+    instance.attribute = value
+</PRE>
+sets an attribute of an instance (overriding any attribute of a class
+that instance inherits).  
+<P>
+Sometimes programmers want to have
+different behaviours -- they want a method which does not bind
+to the instance and a class attribute which changes in place.
+Python does not preclude these behaviours, but you have to
+adopt a convention to implement them.  One way to accomplish
+this is to use "list wrappers" and global functions.
+<P>
+<PRE>
+   def C_hello():
+         print "hello"
+</PRE>
+<PRE>
+   class C:
+        hello = [C_hello]
+        counter = [0]
+</PRE>
+<PRE>
+    I = C()
+</PRE>
+Here I.hello[0]() acts very much like a "class method" and
+I.counter[0] = 2 alters C.counter (and doesn't override it).
+If you don't understand why you'd ever want to do this, that's
+because you are pure of mind, and you probably never will
+want to do it!  This is dangerous trickery, not recommended
+when avoidable.  (Inspired by Tim Peter's discussion.)
+<P>
+In Python 2.2, you can do this using the new built-in operations
+classmethod and staticmethod.
+See <A HREF="http://www.python.org/2.2/descrintro.html#staticmethods">http://www.python.org/2.2/descrintro.html#staticmethods</A>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq06.024.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq06.024.htp">Log info</A>
+
+/ Last changed on Tue Sep 11 15:59:37 2001 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="6.25">6.25. Why are default values sometimes shared between objects?</A></H2>
+It is often expected that a function CALL creates new objects for default
+values. This is not what happens. Default values are created when the
+function is DEFINED, that is, there is only one such object that all 
+functions refer to. If that object is changed, subsequent calls to the 
+function will refer to this changed object. By definition, immutable objects
+(like numbers, strings, tuples, None) are safe from change. Changes to mutable 
+objects (like dictionaries, lists, class instances) is what causes the
+confusion.
+<P>
+Because of this feature it is good programming practice not to use mutable
+objects as default values, but to introduce them in the function.
+Don't write:
+<P>
+<PRE>
+	def foo(dict={}):  # XXX shared reference to one dict for all calls
+	    ...
+</PRE>
+but:
+<PRE>
+	def foo(dict=None):
+		if dict is None:
+			dict = {} # create a new dict for local namespace
+</PRE>
+See page 182 of "Internet Programming with Python" for one discussion
+of this feature. Or see the top of page 144 or bottom of page 277 in 
+"Programming Python" for another discussion.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq06.025.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq06.025.htp">Log info</A>
+
+/ Last changed on Sat Aug 16 07:03:35 1997 by
+<A HREF="mailto:cjr@bound.xs4all.nl">Case Roole</A>
+<P>
+
+<HR>
+<H2><A NAME="6.26">6.26. Why no goto?</A></H2>
+Actually, you can use exceptions to provide a "structured goto"
+that even works across function calls.  Many feel that exceptions
+can conveniently emulate all reasonable uses of the "go" or "goto"
+constructs of C, Fortran, and other languages.  For example:
+<P>
+<PRE>
+   class label: pass # declare a label
+   try:
+        ...
+        if (condition): raise label() # goto label
+        ...
+   except label: # where to goto
+        pass
+   ...
+</PRE>
+This doesn't allow you to jump into the middle of a loop, but
+that's usually considered an abuse of goto anyway.  Use sparingly.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq06.026.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq06.026.htp">Log info</A>
+
+/ Last changed on Wed Sep 10 07:16:44 1997 by
+<A HREF="mailto:aaron_watters@msn.com">aaron watters</A>
+<P>
+
+<HR>
+<H2><A NAME="6.27">6.27. How do you make a higher order function in Python?</A></H2>
+You have two choices: you can use default arguments and override
+them or you can use "callable objects."  For example suppose you
+wanted to define linear(a,b) which returns a function f where f(x)
+computes the value a*x+b.  Using default arguments:
+<P>
+<PRE>
+     def linear(a,b):
+         def result(x, a=a, b=b):
+             return a*x + b
+         return result
+</PRE>
+Or using callable objects:
+<P>
+<PRE>
+     class linear:
+        def __init__(self, a, b):
+            self.a, self.b = a,b
+        def __call__(self, x):
+            return self.a * x + self.b
+</PRE>
+In both cases:
+<P>
+<PRE>
+     taxes = linear(0.3,2)
+</PRE>
+gives a callable object where taxes(10e6) == 0.3 * 10e6 + 2.
+<P>
+The defaults strategy has the disadvantage that the default arguments
+could be accidentally or maliciously overridden.  The callable objects
+approach has the disadvantage that it is a bit slower and a bit
+longer.  Note however that a collection of callables can share
+their signature via inheritance.  EG
+<P>
+<PRE>
+      class exponential(linear):
+         # __init__ inherited
+         def __call__(self, x):
+             return self.a * (x ** self.b)
+</PRE>
+On comp.lang.python, <A HREF="mailto:zenin@bawdycaste.org">zenin@bawdycaste.org</A> points out that
+an object can encapsulate state for several methods in order
+to emulate the "closure" concept from functional programming
+languages, for example:
+<P>
+<PRE>
+    class counter:
+        value = 0
+        def set(self, x): self.value = x
+        def up(self): self.value=self.value+1
+        def down(self): self.value=self.value-1
+</PRE>
+<PRE>
+    count = counter()
+    inc, dec, reset = count.up, count.down, count.set
+</PRE>
+Here inc, dec and reset act like "functions which share the
+same closure containing the variable count.value" (if you
+like that way of thinking).
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq06.027.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq06.027.htp">Log info</A>
+
+/ Last changed on Fri Sep 25 08:38:35 1998 by
+<A HREF="mailto:arw@pythonpros.com">Aaron Watters</A>
+<P>
+
+<HR>
+<H2><A NAME="6.28">6.28. Why do I get a SyntaxError for a 'continue' inside a 'try'?</A></H2>
+This is an implementation limitation,
+caused by the extremely simple-minded
+way Python generates bytecode.  The try block pushes something on the
+"block stack" which the continue would have to pop off again.  The
+current code generator doesn't have the data structures around so that 
+'continue' can generate the right code.
+<P>
+Note that JPython doesn't have this restriction!
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq06.028.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq06.028.htp">Log info</A>
+
+/ Last changed on Fri May 22 15:01:07 1998 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="6.29">6.29. Why can't raw strings (r-strings) end with a backslash?</A></H2>
+More precisely, they can't end with an odd number of backslashes:
+the unpaired backslash at the end escapes the closing quote character,
+leaving an unterminated string.
+<P>
+Raw strings were designed to ease creating input for processors (chiefly
+regular expression engines) that want to do their own backslash escape processing. Such processors consider an unmatched trailing backslash to be an error anyway, so raw strings disallow that.  In return, they allow you to pass on the string quote character by escaping it with a backslash.  These rules work well when r-strings are used for their intended purpose.
+<P>
+If you're trying to build Windows pathnames, note that all Windows system calls accept forward slashes too:
+<P>
+<PRE>
+    f = open("/mydir/file.txt") # works fine!
+</PRE>
+If you're trying to build a pathname for a DOS command, try e.g. one of
+<P>
+<PRE>
+    dir = r"\this\is\my\dos\dir" "\\"
+    dir = r"\this\is\my\dos\dir\ "[:-1]
+    dir = "\\this\\is\\my\\dos\\dir\\"
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq06.029.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq06.029.htp">Log info</A>
+
+/ Last changed on Mon Jul 13 20:50:20 1998 by
+<A HREF="mailto:tim_one@email.msn.com">Tim Peters</A>
+<P>
+
+<HR>
+<H2><A NAME="6.30">6.30. Why can't I use an assignment in an expression?</A></H2>
+Many people used to C or Perl complain that they want to be able to
+use e.g. this C idiom:
+<P>
+<PRE>
+    while (line = readline(f)) {
+        ...do something with line...
+    }
+</PRE>
+where in Python you're forced to write this:
+<P>
+<PRE>
+    while 1:
+        line = f.readline()
+        if not line:
+            break
+        ...do something with line...
+</PRE>
+This issue comes up in the Python newsgroup with alarming frequency
+-- search Deja News for past messages about assignment expression.
+The reason for not allowing assignment in Python expressions
+is a common, hard-to-find bug in those other languages,
+caused by this construct:
+<P>
+<PRE>
+    if (x = 0) {
+        ...error handling...
+    }
+    else {
+        ...code that only works for nonzero x...
+    }
+</PRE>
+Many alternatives have been proposed.  Most are hacks that save some
+typing but use arbitrary or cryptic syntax or keywords,
+and fail the simple criterion that I use for language change proposals:
+it should intuitively suggest the proper meaning to a human reader
+who has not yet been introduced with the construct.
+<P>
+The earliest time something can be done about this will be with
+Python 2.0 -- if it is decided that it is worth fixing.
+An interesting phenomenon is that most experienced Python programmers
+recognize the "while 1" idiom and don't seem to be missing the
+assignment in expression construct much; it's only the newcomers
+who express a strong desire to add this to the language.
+<P>
+One fairly elegant solution would be to introduce a new operator
+for assignment in expressions spelled ":=" -- this avoids the "="
+instead of "==" problem.  It would have the same precedence
+as comparison operators but the parser would flag combination with
+other comparisons (without disambiguating parentheses) as an error.
+<P>
+Finally -- there's an alternative way of spelling this that seems
+attractive but is generally less robust than the "while 1" solution:
+<P>
+<PRE>
+    line = f.readline()
+    while line:
+        ...do something with line...
+        line = f.readline()
+</PRE>
+The problem with this is that if you change your mind about exactly
+how you get the next line (e.g. you want to change it into
+sys.stdin.readline()) you have to remember to change two places
+in your program -- the second one hidden at the bottom of the loop.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq06.030.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq06.030.htp">Log info</A>
+
+/ Last changed on Tue May 18 00:57:41 1999 by
+<A HREF="mailto:dalke@bioreason.com">Andrew Dalke</A>
+<P>
+
+<HR>
+<H2><A NAME="6.31">6.31. Why doesn't Python have a &quot;with&quot; statement like some other languages?</A></H2>
+Basically, because such a construct would be terribly ambiguous. Thanks to Carlos Ribeiro for the following remarks:
+<P>
+Some languages, such as Object Pascal, Delphi, and C++, use static types. So it is possible to know, in an unambiguous way, what member is being assigned in a "with" clause. This is the main point - the compiler <I>always</I>  knows the scope of every variable at compile time.
+<P>
+Python uses dynamic types. It is impossible to know in advance which 
+attribute will be referenced at runtime. Member attributes may be added or removed from objects on the fly. This would make it impossible to know, from a simple reading, what attribute is being referenced - a local one, a global one, or a member attribute.
+<P>
+For instance, take the following snippet (it is incomplete btw, just to 
+give you the idea):
+<P>
+<PRE>
+   def with_is_broken(a):
+      with a:
+         print x
+</PRE>
+The snippet assumes that "a" must have a member attribute called "x". 
+However, there is nothing in Python that guarantees that. What should 
+happen if "a" is, let us say, an integer? And if I have a global variable named "x", will it end up being used inside the with block? As you see, the dynamic nature of Python makes such choices much harder.
+<P>
+The primary benefit of "with" and similar language features (reduction of code volume) can, however, easily be achieved in Python by assignment. Instead of:
+<P>
+<PRE>
+    function(args).dict[index][index].a = 21
+    function(args).dict[index][index].b = 42
+    function(args).dict[index][index].c = 63
+</PRE>
+would become:
+<P>
+<PRE>
+    ref = function(args).dict[index][index]
+    ref.a = 21
+    ref.b = 42
+    ref.c = 63
+</PRE>
+This also has the happy side-effect of increasing execution speed, since name bindings are resolved at run-time in Python, and the second method only needs to perform the resolution once. If the referenced object does not have a, b and c attributes, of course, the end result is still a run-time exception.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq06.031.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq06.031.htp">Log info</A>
+
+/ Last changed on Fri Jan 11 14:32:58 2002 by
+<A HREF="mailto:sholden@holdenweb.com">Steve Holden</A>
+<P>
+
+<HR>
+<H2><A NAME="6.32">6.32. Why are colons required for if/while/def/class?</A></H2>
+The colon is required primarily to enhance readability (one of the
+results of the experimental ABC language).  Consider this:
+<P>
+<PRE>
+    if a==b
+        print a
+</PRE>
+versus
+<P>
+<PRE>
+    if a==b:
+        print a
+</PRE>
+Notice how the second one is slightly easier to read.  Notice further how
+a colon sets off the example in the second line of this FAQ answer; it's
+a standard usage in English.  Finally, the colon makes it easier for
+editors with syntax highlighting.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq06.032.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq06.032.htp">Log info</A>
+
+/ Last changed on Mon Jun  3 07:22:57 2002 by
+<A HREF="mailto:smurf@noris.de">Matthias Urlichs</A>
+<P>
+
+<HR>
+<H2><A NAME="6.33">6.33. Can't we get rid of the Global Interpreter Lock?</A></H2>
+The Global Interpreter Lock (GIL) is often seen as a hindrance to
+Python's deployment on high-end multiprocessor server machines,
+because a multi-threaded Python program effectively only uses
+one CPU, due to the insistence that (almost) all Python code
+can only run while the GIL is held.
+<P>
+Back in the days of Python 1.5, Greg Stein actually implemented
+a comprehensive patch set ("free threading")
+that removed the GIL, replacing it with
+fine-grained locking.  Unfortunately, even on Windows (where locks
+are very efficient) this ran ordinary Python code about twice as
+slow as the interpreter using the GIL.  On Linux the performance
+loss was even worse (pthread locks aren't as efficient).
+<P>
+Since then, the idea of getting rid of the GIL has occasionally
+come up but nobody has found a way to deal with the expected slowdown;
+Greg's free threading patch set has not been kept up-to-date for
+later Python versions.
+<P>
+This doesn't mean that you can't make good use of Python on
+multi-CPU machines!  You just have to be creative with dividing
+the work up between multiple <I>processes</I> rather than multiple
+<I>threads</I>.
+<P>
+<P>
+It has been suggested that the GIL should be a per-interpreter-state
+lock rather than truly global; interpreters then wouldn't be able
+to share objects.  Unfortunately, this isn't likely to happen either.
+<P>
+It would be a tremendous amount of work, because many object
+implementations currently have global state.  E.g. small ints and
+small strings are cached; these caches would have to be moved to the
+interpreter state.  Other object types have their own free list; these
+free lists would have to be moved to the interpreter state.  And so
+on.
+<P>
+And I doubt that it can even be done in finite time, because the same
+problem exists for 3rd party extensions.  It is likely that 3rd party
+extensions are being written at a faster rate than you can convert
+them to store all their global state in the interpreter state.
+<P>
+And finally, once you have multiple interpreters not sharing any
+state, what have you gained over running each interpreter
+in a separate process?
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq06.033.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq06.033.htp">Log info</A>
+
+/ Last changed on Fri Feb  7 16:34:01 2003 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H1>7. Using Python on non-UNIX platforms</H1>
+
+<HR>
+<H2><A NAME="7.1">7.1. Is there a Mac version of Python?</A></H2>
+Yes, it is maintained by Jack Jansen.  See Jack's MacPython Page:
+<P>
+<PRE>
+  <A HREF="http://www.cwi.nl/~jack/macpython.html">http://www.cwi.nl/~jack/macpython.html</A>
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq07.001.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq07.001.htp">Log info</A>
+
+/ Last changed on Fri May  4 09:33:42 2001 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="7.2">7.2. Are there DOS and Windows versions of Python?</A></H2>
+Yes.  The core windows binaries are available from <A HREF="http://www.python.org/windows">http://www.python.org/windows</A>/. There is a plethora of Windows extensions available, including a large number of not-always-compatible GUI toolkits.  The core binaries include the standard Tkinter GUI extension.
+<P>
+Most windows extensions can be found (or referenced) at <A HREF="http://www.python.org/windows">http://www.python.org/windows</A>/ 
+<P>
+Windows 3.1/DOS support seems to have dropped off recently.  You may need to settle for an old version of Python one these platforms.  One such port is WPY
+<P>
+WPY: Ports to DOS, Windows 3.1(1), Windows 95, Windows NT and OS/2.
+Also contains a GUI package that offers portability between Windows 
+(not DOS) and Unix, and native look and feel on both.
+<A HREF="ftp://ftp.python.org/pub/python/wpy">ftp://ftp.python.org/pub/python/wpy</A>/.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq07.002.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq07.002.htp">Log info</A>
+
+/ Last changed on Tue Jun  2 20:21:57 1998 by
+<A HREF="mailto:MHammond@skippinet.com.au">Mark Hammond</A>
+<P>
+
+<HR>
+<H2><A NAME="7.3">7.3. Is there an OS/2 version of Python?</A></H2>
+Yes, see <A HREF="http://www.python.org/download/download_os2.html">http://www.python.org/download/download_os2.html</A>.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq07.003.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq07.003.htp">Log info</A>
+
+/ Last changed on Tue Sep  7 11:33:16 1999 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="7.4">7.4. Is there a VMS version of Python?</A></H2>
+Jean-François Piéronne has ported 2.1.3 to OpenVMS.  It can be found at
+&lt;<A HREF="http://vmspython.dyndns.org">http://vmspython.dyndns.org</A>/&gt;.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq07.004.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq07.004.htp">Log info</A>
+
+/ Last changed on Thu Sep 19 15:40:38 2002 by
+<A HREF="mailto:skip@pobox.com">Skip Montanaro</A>
+<P>
+
+<HR>
+<H2><A NAME="7.5">7.5. What about IBM mainframes, or other non-UNIX platforms?</A></H2>
+I haven't heard about these, except I remember hearing about an
+OS/9 port and a port to Vxworks (both operating systems for embedded
+systems).  If you're interested in any of this, go directly to the
+newsgroup and ask there, you may find exactly what you need.  For
+example, a port to MPE/iX 5.0 on HP3000 computers was just announced,
+see <A HREF="http://www.allegro.com/software">http://www.allegro.com/software</A>/.
+<P>
+On the IBM mainframe side, for Z/OS there's a port of python 1.4 that goes with their open-unix package, formely OpenEdition MVS, (<A HREF="http://www-1.ibm.com/servers/eserver/zseries/zos/unix/python.html">http://www-1.ibm.com/servers/eserver/zseries/zos/unix/python.html</A>). On a side note, there's also a java vm ported - so, in theory, jython could run too.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq07.005.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq07.005.htp">Log info</A>
+
+/ Last changed on Mon Nov 18 03:18:39 2002 by
+<A HREF="mailto:bjessen@uol.com.br">Bruno Jessen</A>
+<P>
+
+<HR>
+<H2><A NAME="7.6">7.6. Where are the source or Makefiles for the non-UNIX versions?</A></H2>
+The standard sources can (almost) be used.  Additional sources can
+be found in the platform-specific subdirectories of the distribution.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq07.006.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq07.006.htp">Log info</A>
+<P>
+
+<HR>
+<H2><A NAME="7.7">7.7. What is the status and support for the non-UNIX versions?</A></H2>
+I don't have access to most of these platforms, so in general I am
+dependent on material submitted by volunteers.  However I strive to
+integrate all changes needed to get it to compile on a particular
+platform back into the standard sources, so porting of the next
+version to the various non-UNIX platforms should be easy.
+(Note that Linux is classified as a UNIX platform here. :-)
+<P>
+Some specific platforms:
+<P>
+Windows: all versions (95, 98, ME, NT, 2000, XP) are supported,
+all python.org releases come with a Windows installer.
+<P>
+MacOS: Jack Jansen does an admirable job of keeping the Mac version
+up to date (both MacOS X and older versions);
+see <A HREF="http://www.cwi.nl/~jack/macpython.html">http://www.cwi.nl/~jack/macpython.html</A>
+<P>
+For all supported platforms, see <A HREF="http://www.python.org/download">http://www.python.org/download</A>/
+(follow the link to "Other platforms" for less common platforms)
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq07.007.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq07.007.htp">Log info</A>
+
+/ Last changed on Fri May 24 21:34:24 2002 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="7.8">7.8. I have a PC version but it appears to be only a binary. Where's the library?</A></H2>
+If you are running any version of Windows, then you have the wrong distribution.  The FAQ lists current Windows versions.  Notably, Pythonwin and wpy provide fully functional installations.
+<P>
+But if you are sure you have the only distribution with a hope of working on
+your system, then...
+<P>
+You still need to copy the files from the distribution directory
+"python/Lib" to your system.  If you don't have the full distribution,
+you can get the file lib&lt;version&gt;.tar.gz from most ftp sites carrying
+Python; this is a subset of the distribution containing just those
+files, e.g.  <A HREF="ftp://ftp.python.org/pub/python/src/lib1.4.tar.gz">ftp://ftp.python.org/pub/python/src/lib1.4.tar.gz</A>.
+<P>
+Once you have installed the library, you need to point sys.path to it.
+Assuming the library is in C:\misc\python\lib, the following commands
+will point your Python interpreter to it (note the doubled backslashes
+-- you can also use single forward slashes instead):
+<P>
+<PRE>
+        >>> import sys
+        >>> sys.path.insert(0, 'C:\\misc\\python\\lib')
+        >>>
+</PRE>
+For a more permanent effect, set the environment variable PYTHONPATH,
+as follows (talking to a DOS prompt):
+<P>
+<PRE>
+        C> SET PYTHONPATH=C:\misc\python\lib
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq07.008.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq07.008.htp">Log info</A>
+
+/ Last changed on Fri May 23 16:28:27 1997 by
+<A HREF="mailto:klm@python.org">Ken Manheimer</A>
+<P>
+
+<HR>
+<H2><A NAME="7.9">7.9. Where's the documentation for the Mac or PC version?</A></H2>
+The documentation for the Unix version also applies to the Mac and
+PC versions.  Where applicable, differences are indicated in the text.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq07.009.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq07.009.htp">Log info</A>
+<P>
+
+<HR>
+<H2><A NAME="7.10">7.10. How do I create a Python program file on the Mac or PC?</A></H2>
+Use an external editor.  On the Mac, BBEdit seems to be a popular
+no-frills text editor.  I work like this: start the interpreter; edit
+a module file using BBedit; import and test it in the interpreter;
+edit again in BBedit; then use the built-in function reload() to
+re-read the imported module; etc. In the 1.4 distribution 
+you will find a BBEdit extension that makes life a little easier: 
+it can tell the interpreter to execute the current window. 
+See :Mac:Tools:BBPy:README. 
+<P>
+Regarding the same question for the PC, Kurt Wm. Hemr writes: "While
+anyone with a pulse could certainly figure out how to do the same on
+MS-Windows, I would recommend the NotGNU Emacs clone for MS-Windows.
+Not only can you easily resave and "reload()" from Python after making
+changes, but since WinNot auto-copies to the clipboard any text you
+select, you can simply select the entire procedure (function) which
+you changed in WinNot, switch to QWPython, and shift-ins to reenter
+the changed program unit."
+<P>
+If you're using Windows95 or Windows NT, you should also know about
+PythonWin, which provides a GUI framework, with an mouse-driven
+editor, an object browser, and a GUI-based debugger.  See
+<PRE>
+       <A HREF="http://www.python.org/ftp/python/pythonwin">http://www.python.org/ftp/python/pythonwin</A>/
+</PRE>
+for details.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq07.010.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq07.010.htp">Log info</A>
+
+/ Last changed on Sun May 25 10:04:25 1997 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="7.11">7.11. How can I use Tkinter on Windows 95/NT?</A></H2>
+Starting from Python 1.5, it's very easy -- just download and install
+Python and Tcl/Tk and you're in business.  See 
+<P>
+<PRE>
+  <A HREF="http://www.python.org/download/download_windows.html">http://www.python.org/download/download_windows.html</A>
+</PRE>
+One warning: don't attempt to use Tkinter from PythonWin
+(Mark Hammond's IDE).  Use it from the command line interface
+(python.exe) or the windowless interpreter (pythonw.exe).
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq07.011.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq07.011.htp">Log info</A>
+
+/ Last changed on Fri Jun 12 09:32:48 1998 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="7.12">7.12. cgi.py (or other CGI programming) doesn't work sometimes on NT or win95!</A></H2>
+Be sure you have the latest python.exe, that you are using
+python.exe rather than a GUI version of python and that you
+have configured the server to execute
+<P>
+<PRE>
+     "...\python.exe -u ..."
+</PRE>
+for the cgi execution.  The -u (unbuffered) option on NT and
+win95 prevents the interpreter from altering newlines in the
+standard input and output.  Without it post/multipart requests
+will seem to have the wrong length and binary (eg, GIF)
+responses may get garbled (resulting in, eg, a "broken image").
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq07.012.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq07.012.htp">Log info</A>
+
+/ Last changed on Wed Jul 30 10:48:02 1997 by
+<A HREF="mailto:aaron_watters@msn.com">aaron watters</A>
+<P>
+
+<HR>
+<H2><A NAME="7.13">7.13. Why doesn't os.popen() work in PythonWin on NT?</A></H2>
+The reason that os.popen() doesn't work from within PythonWin is due to a bug in Microsoft's C Runtime Library (CRT). The CRT assumes you  have a Win32 console attached to the process.
+<P>
+You should use the win32pipe module's popen() instead which doesn't depend on having an attached Win32 console.
+<P>
+Example:
+<PRE>
+ import win32pipe
+ f = win32pipe.popen('dir /c c:\\')
+ print f.readlines()
+ f.close()
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq07.013.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq07.013.htp">Log info</A>
+
+/ Last changed on Thu Jul 31 15:34:09 1997 by
+<A HREF="mailto:billtut@microsoft.com">Bill Tutt</A>
+<P>
+
+<HR>
+<H2><A NAME="7.14">7.14. How do I use different functionality on different platforms with the same program?</A></H2>
+Remember that Python is extremely dynamic and that you
+can use this dynamism to configure a program at run-time to
+use available functionality on different platforms.  For example
+you can test the sys.platform and import different modules based
+on its value.
+<P>
+<PRE>
+   import sys
+   if sys.platform == "win32":
+      import win32pipe
+      popen = win32pipe.popen
+   else:
+      import os
+      popen = os.popen
+</PRE>
+(See FAQ 7.13 for an explanation of why you might want to
+do something like this.)  Also you can try to import a module
+and use a fallback if the import fails:
+<P>
+<PRE>
+    try:
+         import really_fast_implementation
+         choice = really_fast_implementation
+    except ImportError:
+         import slower_implementation
+         choice = slower_implementation
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq07.014.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq07.014.htp">Log info</A>
+
+/ Last changed on Wed Aug 13 07:39:06 1997 by
+<A HREF="mailto:aaron_watters@msn.com">aaron watters</A>
+<P>
+
+<HR>
+<H2><A NAME="7.15">7.15. Is there an Amiga version of Python?</A></H2>
+Yes. See the AmigaPython homepage at <A HREF="http://www.bigfoot.com/~irmen/python.html">http://www.bigfoot.com/~irmen/python.html</A>.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq07.015.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq07.015.htp">Log info</A>
+
+/ Last changed on Mon Dec 14 06:53:32 1998 by
+<A HREF="mailto:irmen@bigfoot.com">Irmen de Jong</A>
+<P>
+
+<HR>
+<H2><A NAME="7.16">7.16. Why doesn't os.popen()/win32pipe.popen() work on Win9x?</A></H2>
+There is a bug in Win9x that prevents os.popen/win32pipe.popen* from working. The good news is there is a way to work around this problem.
+The Microsoft Knowledge Base article that you need to lookup is: Q150956. You will find links to the knowledge base at:
+<A HREF="http://www.microsoft.com/kb">http://www.microsoft.com/kb</A>.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq07.016.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq07.016.htp">Log info</A>
+
+/ Last changed on Fri Jun 25 10:45:38 1999 by
+<A HREF="mailto:billtut@microsoft.com">Bill Tutt</A>
+<P>
+
+<HR>
+<H1>8. Python on Windows</H1>
+
+<HR>
+<H2><A NAME="8.1">8.1. Using Python for CGI on Microsoft Windows</A></H2>
+** Setting up the Microsoft IIS Server/Peer Server
+<P>
+On the Microsoft IIS 
+server or on the Win95 MS Personal Web Server
+you set up python in the same way that you 
+would set up any other scripting engine. 
+<P>
+Run regedt32 and go to: 
+<P>
+HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W3SVC\Parameters\ScriptMap 
+<P>
+and enter the following line (making any specific changes that your system may need) 
+<P>
+.py :REG_SZ: c:\&lt;path to python&gt;\python.exe -u %s %s 
+<P>
+This line will allow you to call your script with a simple reference like:
+http://yourserver/scripts/yourscript.py 
+provided "scripts" is an "executable" directory for your server (which
+it usually is by default).
+The "-u" flag specifies unbuffered and binary mode for stdin - needed when working with binary data
+<P>
+In addition, it is recommended by people who would know that using ".py" may 
+not be a good idea for the file extensions when used in this context
+(you might want to reserve *.py for support modules and use *.cgi or *.cgp
+for "main program" scripts).
+However, that issue is beyond this Windows FAQ entry.
+<P>
+<P>
+** Apache configuration
+<P>
+In the Apache configuration file httpd.conf, add the following line at 
+the end of the file:
+<P>
+ScriptInterpreterSource Registry
+<P>
+Then, give your Python CGI-scripts the extension .py and put them in the cgi-bin directory.
+<P>
+<P>
+** Netscape Servers:
+Information on this topic exists at:
+<A HREF="http://home.netscape.com/comprod/server_central/support/fasttrack_man/programs.htm#1010870">http://home.netscape.com/comprod/server_central/support/fasttrack_man/programs.htm#1010870</A>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq08.001.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq08.001.htp">Log info</A>
+
+/ Last changed on Wed Mar 27 12:25:54 2002 by
+<A HREF="mailto:gerhard@bigfoot.de">Gerhard Häring</A>
+<P>
+
+<HR>
+<H2><A NAME="8.2">8.2. How to check for a keypress without blocking?</A></H2>
+Use the msvcrt module.  This is a standard Windows-specific extensions
+in Python 1.5 and beyond.  It defines a function kbhit() which checks
+whether a keyboard hit is present; also getch() which gets one
+character without echo.  Plus a few other goodies.
+<P>
+(Search for "keypress" to find an answer for Unix as well.)
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq08.002.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq08.002.htp">Log info</A>
+
+/ Last changed on Mon Mar 30 16:21:46 1998 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="8.3">8.3. $PYTHONPATH</A></H2>
+In MS-DOS derived environments, a unix variable such as $PYTHONPATH is 
+set as PYTHONPATH, without the dollar sign.  PYTHONPATH is useful for
+specifying the location of library files.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq08.003.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq08.003.htp">Log info</A>
+
+/ Last changed on Thu Jun 11 00:41:26 1998 by
+<A HREF="mailto:guido@python.org">Gvr</A>
+<P>
+
+<HR>
+<H2><A NAME="8.4">8.4. dedent syntax errors</A></H2>
+The FAQ does not recommend using tabs, and Guido's Python Style Guide recommends 4 spaces for distributed Python code; this is also the Emacs python-mode default; see
+<P>
+<PRE>
+    <A HREF="http://www.python.org/doc/essays/styleguide.html">http://www.python.org/doc/essays/styleguide.html</A>
+</PRE>
+Under any editor mixing tabs and spaces is a bad idea.  MSVC is no different in this respect, and is easily configured to use spaces:  Take Tools -> Options -> Tabs, and for file type "Default" set "Tab size" and "Indent size" to 4, and select the "Insert spaces" radio button.
+<P>
+If you suspect mixed tabs and spaces are causing problems in leading whitespace, run Python with the -t switch or, run Tools/Scripts/tabnanny.py to check a directory tree in batch mode.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq08.004.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq08.004.htp">Log info</A>
+
+/ Last changed on Mon Feb 12 15:04:14 2001 by
+<A HREF="mailto:sholden@holdenweb.com">Steve Holden</A>
+<P>
+
+<HR>
+<H2><A NAME="8.5">8.5. How do I emulate os.kill() in Windows?</A></H2>
+Use win32api:
+<P>
+<PRE>
+    def kill(pid):
+        """kill function for Win32"""
+        import win32api
+        handle = win32api.OpenProcess(1, 0, pid)
+        return (0 != win32api.TerminateProcess(handle, 0))
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq08.005.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq08.005.htp">Log info</A>
+
+/ Last changed on Sat Aug  8 18:55:06 1998 by
+<A HREF="mailto:jeffbauer@bigfoot.com">Jeff Bauer</A>
+<P>
+
+<HR>
+<H2><A NAME="8.6">8.6. Why does os.path.isdir() fail on NT shared directories?</A></H2>
+The solution appears to be always append the "\\" on 
+the end of shared drives.
+<P>
+<PRE>
+  >>> import os
+  >>> os.path.isdir( '\\\\rorschach\\public')
+  0
+  >>> os.path.isdir( '\\\\rorschach\\public\\')
+  1
+</PRE>
+[Blake Winton responds:]
+I've had the same problem doing "Start >> Run" and then a
+directory on a shared drive.  If I use "\\rorschach\public", 
+it will fail, but if I use "\\rorschach\public\", it will 
+work.  For that matter, os.stat() does the same thing (well, 
+it gives an error for "\\\\rorschach\\public", but you get 
+the idea)...
+<P>
+I've got a theory about why this happens, but it's only 
+a theory.  NT knows the difference between shared directories, 
+and regular directories.  "\\rorschach\public" isn't a 
+directory, it's _really_ an IPC abstraction.  This is sort 
+of lended credence to by the fact that when you're mapping 
+a network drive, you can't map "\\rorschach\public\utils", 
+but only "\\rorschach\public".
+<P>
+[Clarification by <A HREF="mailto:funkster@midwinter.com">funkster@midwinter.com</A>]
+It's not actually a Python 
+question, as Python is working just fine; it's clearing up something 
+a bit muddled about Windows networked drives.
+<P>
+It helps to think of share points as being like drive letters.
+Example:
+<PRE>
+        k: is not a directory
+        k:\ is a directory
+        k:\media is a directory
+        k:\media\ is not a directory
+</PRE>
+The same rules apply if you substitute "k:" with "\\conky\foo":
+<PRE>
+        \\conky\foo  is not a directory
+        \\conky\foo\ is a directory
+        \\conky\foo\media is a directory
+        \\conky\foo\media\ is not a directory
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq08.006.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq08.006.htp">Log info</A>
+
+/ Last changed on Sun Jan 31 08:44:48 1999 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="8.7">8.7. PyRun_SimpleFile() crashes on Windows but not on Unix</A></H2>
+I've seen a number of reports of PyRun_SimpleFile() failing
+in a Windows port of an application embedding Python that worked
+fine on Unix.  PyRun_SimpleString() works fine on both platforms.
+<P>
+I think this happens because the application was compiled with a 
+different set of compiler flags than Python15.DLL.  It seems that some 
+compiler flags affect the standard I/O library in such a way that 
+using different flags makes calls fail.  You need to set it for 
+the non-debug multi-threaded DLL (/MD on the command line, or can be set via MSVC under Project Settings-&gt;C++/Code Generation then the "Use rum-time library" dropdown.)
+<P>
+Also note that you can not mix-and-match Debug and Release versions.  If you wish to use the Debug Multithreaded DLL, then your module _must_ have an "_d" appended to the base name.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq08.007.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq08.007.htp">Log info</A>
+
+/ Last changed on Wed Nov 17 17:37:07 1999 by
+<A HREF="mailto:mhammond@skippinet.com.au">Mark Hammond</A>
+<P>
+
+<HR>
+<H2><A NAME="8.8">8.8. Import of _tkinter fails on Windows 95/98</A></H2>
+Sometimes, the import of _tkinter fails on Windows 95 or 98,
+complaining with a message like the following:
+<P>
+<PRE>
+  ImportError: DLL load failed: One of the library files needed
+  to run this application cannot be found.
+</PRE>
+It could be that you haven't installed Tcl/Tk, but if you did
+install Tcl/Tk, and the Wish application works correctly,
+the problem may be that its installer didn't
+manage to edit the autoexec.bat file correctly.  It tries to add a
+statement that changes the PATH environment variable to include
+the Tcl/Tk 'bin' subdirectory, but sometimes this edit doesn't
+quite work.  Opening it with notepad usually reveals what the
+problem is.
+<P>
+(One additional hint, noted by David Szafranski: you can't use
+long filenames here; e.g. use C:\PROGRA~1\Tcl\bin instead of
+C:\Program Files\Tcl\bin.)
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq08.008.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq08.008.htp">Log info</A>
+
+/ Last changed on Wed Dec  2 22:32:41 1998 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="8.9">8.9. Can't extract the downloaded documentation on Windows</A></H2>
+Sometimes, when you download the documentation package to a Windows
+machine using a web browser, the file extension of the saved file
+ends up being .EXE.  This is a mistake; the extension should be .TGZ.
+<P>
+Simply rename the downloaded file to have the .TGZ extension, and
+WinZip will be able to handle it.  (If your copy of WinZip doesn't,
+get a newer one from <A HREF="http://www.winzip.com">http://www.winzip.com</A>.)
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq08.009.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq08.009.htp">Log info</A>
+
+/ Last changed on Sat Nov 21 13:41:35 1998 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="8.10">8.10. Can't get Py_RunSimpleFile() to work.</A></H2>
+This is very sensitive to the compiler vendor, version and (perhaps)
+even options.  If the FILE* structure in your embedding program isn't
+the same as is assumed by the Python interpreter it won't work.
+<P>
+The Python 1.5.* DLLs (python15.dll) are all compiled
+with MS VC++ 5.0 and with multithreading-DLL options (/MD, I think).
+<P>
+If you can't change compilers or flags, try using Py_RunSimpleString().
+A trick to get it to run an arbitrary file is to construct a call to
+execfile() with the name of your file as argument.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq08.010.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq08.010.htp">Log info</A>
+
+/ Last changed on Wed Jan 13 10:58:14 1999 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="8.11">8.11. Where is Freeze for Windows?</A></H2>
+("Freeze" is a program that allows you to ship a Python program
+as a single stand-alone executable file.  It is <I>not</I> a compiler,
+your programs don't run any faster, but they are more easily
+distributable (to platforms with the same OS and CPU).  Read the
+README file of the freeze program for more disclaimers.)
+<P>
+You can use freeze on Windows, but you must download the source
+tree (see <A HREF="http://www.python.org/download/download_source.html">http://www.python.org/download/download_source.html</A>).
+This is recommended for Python 1.5.2 (and betas thereof) only;
+older versions don't quite work.
+<P>
+You need the Microsoft VC++ 5.0 compiler (maybe it works with
+6.0 too).  You probably need to build Python -- the project files
+are all in the PCbuild directory.
+<P>
+The freeze program is in the Tools\freeze subdirectory of the source
+tree.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq08.011.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq08.011.htp">Log info</A>
+
+/ Last changed on Wed Feb 17 18:47:24 1999 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="8.12">8.12. Is a *.pyd file the same as a DLL?</A></H2>
+Yes, .pyd files are dll's.  But there are a few differences.  If you
+have a DLL named foo.pyd, then it must have a function initfoo().  You
+can then write Python "import foo", and Python will search for foo.pyd
+(as well as foo.py, foo.pyc) and if it finds it, will attempt to call
+initfoo() to initialize it.  You do not link your .exe with foo.lib,
+as that would cause Windows to require the DLL to be present.
+<P>
+Note that the search path for foo.pyd is PYTHONPATH, not the same as
+the path that Windows uses to search for foo.dll.  Also, foo.pyd need
+not be present to run your program, whereas if you linked your program
+with a dll, the dll is required.  Of course, foo.pyd is required if
+you want to say "import foo".  In a dll, linkage is declared in the
+source code with __declspec(dllexport).  In a .pyd, linkage is defined
+in a list of available functions.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq08.012.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq08.012.htp">Log info</A>
+
+/ Last changed on Tue Nov 23 02:40:08 1999 by
+<A HREF="mailto:jquinn+psa@cs.oberlin.edu">Jameson Quinn</A>
+<P>
+
+<HR>
+<H2><A NAME="8.13">8.13. Missing cw3215mt.dll (or missing cw3215.dll)</A></H2>
+Sometimes, when using Tkinter on Windows, you get an error that
+cw3215mt.dll or cw3215.dll is missing.
+<P>
+Cause: you have an old Tcl/Tk DLL built with cygwin in your path
+(probably C:\Windows).  You must use the Tcl/Tk DLLs from the
+standard Tcl/Tk installation (Python 1.5.2 comes with one).
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq08.013.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq08.013.htp">Log info</A>
+
+/ Last changed on Fri Jun 11 00:54:13 1999 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="8.14">8.14. How to make python scripts executable:</A></H2>
+[Blake Coverett]
+<P>
+Win2K:
+<P>
+The standard installer already associates the .py extension with a file type
+(Python.File) and gives that file type an open command that runs the
+interpreter (D:\Program Files\Python\python.exe "%1" %*).  This is enough to
+make scripts executable from the command prompt as 'foo.py'.  If you'd
+rather be able to execute the script by simple typing 'foo' with no
+extension you need to add .py to the PATHEXT environment variable.
+<P>
+WinNT:
+<P>
+The steps taken by the installed as described above allow you do run a
+script with 'foo.py', but a long time bug in the NT command processor
+prevents you from redirecting the input or output of any script executed in
+this way.  This is often important.
+<P>
+An appropriate incantation for making a Python script executable under WinNT
+is to give the file an extension of .cmd and add the following as the first
+line:
+<P>
+<PRE>
+    @setlocal enableextensions &amp; python -x %~f0 %* &amp; goto :EOF
+</PRE>
+Win9x:
+<P>
+[Due to Bruce Eckel]
+<P>
+<PRE>
+  @echo off
+  rem = """
+  rem run python on this bat file. Needs the full path where
+  rem you keep your python files. The -x causes python to skip
+  rem the first line of the file:
+  python -x c:\aaa\Python\\"%0".bat %1 %2 %3 %4 %5 %6 %7 %8 %9
+  goto endofpython
+  rem """
+</PRE>
+<PRE>
+  # The python program goes here:
+</PRE>
+<PRE>
+  print "hello, Python"
+</PRE>
+<PRE>
+  # For the end of the batch file:
+  rem = """
+  :endofpython
+  rem """
+</PRE>
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq08.014.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq08.014.htp">Log info</A>
+
+/ Last changed on Tue Nov 30 10:25:17 1999 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="8.15">8.15. Warning about CTL3D32 version from installer</A></H2>
+The Python installer issues a warning like this:
+<P>
+<PRE>
+  This version uses CTL3D32.DLL whitch is not the correct version.
+  This version is used for windows NT applications only.
+</PRE>
+[Tim Peters]
+This is a Microsoft DLL, and a notorious
+source of problems.  The msg means what it says:  you have the wrong version
+of this DLL for your operating system.  The Python installation did not
+cause this -- something else you installed previous to this overwrote the
+DLL that came with your OS (probably older shareware of some sort, but
+there's no way to tell now).  If you search for "CTL3D32" using any search
+engine (AltaVista, for example), you'll find hundreds and hundreds of web
+pages complaining about the same problem with all sorts of installation
+programs.  They'll point you to ways to get the correct version reinstalled
+on your system (since Python doesn't cause this, we can't fix it).
+<P>
+David A Burton has written a little program to fix this.  Go to
+<A HREF="http://www.burtonsys.com/download.html">http://www.burtonsys.com/download.html</A> and click on "ctl3dfix.zip"
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq08.015.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq08.015.htp">Log info</A>
+
+/ Last changed on Thu Oct 26 15:42:00 2000 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<H2><A NAME="8.16">8.16. How can I embed Python into a Windows application?</A></H2>
+Edward K. Ream &lt;<A HREF="mailto:edream@tds.net">edream@tds.net</A>&gt; writes
+<P>
+When '##' appears in a file name below, it is an abbreviated version number.  For example, for Python 2.1.1, ## will be replaced by 21.
+<P>
+Embedding the Python interpreter in a Windows app can be summarized as
+follows:
+<P>
+1. Do _not_ build Python into your .exe file directly.  On Windows,
+Python must be a DLL to handle importing modules that are themselves
+DLL's.  (This is the first key undocumented fact.) Instead, link to
+python##.dll; it is typically installed in c:\Windows\System.  
+<P>
+You can link to Python statically or dynamically.  Linking statically
+means linking against python##.lib The drawback is that your app won't
+run if python##.dll does not exist on your system.
+<P>
+General note: python##.lib is the so-called "import lib" corresponding
+to python.dll.  It merely defines symbols for the linker.
+<P>
+Borland note: convert python##.lib to OMF format using Coff2Omf.exe
+first.
+<P>
+Linking dynamically greatly simplifies link options; everything happens
+at run time.  Your code must load python##.dll using the Windows
+LoadLibraryEx() routine.  The code must also use access routines and
+data in python##.dll (that is, Python's C API's) using pointers
+obtained by the Windows GetProcAddress() routine.  Macros can make
+using these pointers transparent to any C code that calls routines in
+Python's C API.
+<P>
+2. If you use SWIG, it is easy to create a Python "extension module"
+that will make the app's data and methods available to Python.  SWIG
+will handle just about all the grungy details for you.  The result is C
+code that you link _into your .exe file_ (!)  You do _not_ have to
+create a DLL file, and this also simplifies linking.
+<P>
+3.  SWIG will create an init function (a C function) whose name depends
+on the name of the extension module.  For example, if the name of the
+module is leo, the init function will be called initleo().  If you use
+SWIG shadow classes, as you should, the init function will be called
+initleoc().  This initializes a mostly hidden helper class used by the
+shadow class.
+<P>
+The reason you can link the C code in step 2 into your .exe file is that
+calling the initialization function is equivalent to importing the
+module into Python! (This is the second key undocumented fact.)
+<P>
+4. In short, you can use the following code to initialize the Python
+interpreter with your extension module.
+<P>
+<PRE>
+    #include "python.h"
+    ...
+    Py_Initialize();  // Initialize Python.
+    initmyAppc();  // Initialize (import) the helper class. 
+    PyRun_SimpleString("import myApp") ;  // Import the shadow class.
+</PRE>
+5. There are two problems with Python's C API which will become apparent
+if you use a compiler other than MSVC, the compiler used to build
+python##.dll.
+<P>
+Problem 1: The so-called "Very High Level" functions that take FILE *
+arguments will not work in a multi-compiler environment; each compiler's
+notion of a struct FILE will be different.  From an implementation
+standpoint these are very _low_ level functions.
+<P>
+Problem 2: SWIG generates the following code when generating wrappers to
+void functions:
+<P>
+<PRE>
+    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+</PRE>
+Alas, Py_None is a macro that expands to a reference to a complex data
+structure called _Py_NoneStruct inside python##.dll.  Again, this code
+will fail in a mult-compiler environment.  Replace such code by:
+<P>
+<PRE>
+    return Py_BuildValue("");
+</PRE>
+It may be possible to use SWIG's %typemap command to make the change
+automatically, though I have not been able to get this to work (I'm a
+complete SWIG newbie).
+<P>
+6. Using a Python shell script to put up a Python interpreter window
+from inside your Windows app is not a good idea; the resulting window
+will be independent of your app's windowing system.  Rather, you (or the
+wxPythonWindow class) should create a "native" interpreter window.  It
+is easy to connect that window to the Python interpreter.  You can
+redirect Python's i/o to _any_ object that supports read and write, so
+all you need is a Python object (defined in your extension module) that
+contains read() and write() methods.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq08.016.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq08.016.htp">Log info</A>
+
+/ Last changed on Thu Jan 31 16:29:34 2002 by
+<A HREF="mailto:vkryukov@ufg.com">Victor Kryukov</A>
+<P>
+
+<HR>
+<H2><A NAME="8.17">8.17. Setting up IIS 5 to use Python for CGI</A></H2>
+In order to set up Internet Information Services 5 to use Python for CGI processing, please see the following links:
+<P>
+<A HREF="http://www.e-coli.net/pyiis_server.html">http://www.e-coli.net/pyiis_server.html</A> (for Win2k Server)
+<A HREF="http://www.e-coli.net/pyiis.html">http://www.e-coli.net/pyiis.html</A> (for Win2k pro)
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq08.017.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq08.017.htp">Log info</A>
+
+/ Last changed on Fri Mar 22 22:05:51 2002 by
+<A HREF="mailto:dsavitsk@e-coli.net">douglas savitsky</A>
+<P>
+
+<HR>
+<H2><A NAME="8.18">8.18. How do I run a Python program under Windows?</A></H2>
+This is not necessarily quite the straightforward question it appears
+to be. If you are already familiar with running programs from the
+Windows command line then everything will seem really easy and
+obvious. If your computer experience is limited then you might need a
+little more guidance. Also there are differences between Windows 95,
+98, NT, ME, 2000 and XP which can add to the confusion. You might
+think of this as "why I pay software support charges" if you have a
+helpful and friendly administrator to help you set things up without
+having to understand all this yourself. If so, then great! Show them
+this page and it should be a done deal.
+<P>
+Unless you use some sort of integrated development environment (such
+as PythonWin or IDLE, to name only two in a growing family) then you
+will end up <I>typing</I> Windows commands into what is variously referred
+to as a "DOS window" or "Command prompt window". Usually you can
+create such a window from your Start menu (under Windows 2000 I use
+"Start | Programs | Accessories | Command Prompt").  You should be
+able to recognize when you have started such a window because you will
+see a Windows "command prompt", which usually looks like this:
+<P>
+<PRE>
+    C:\>
+</PRE>
+The letter may be different, and there might be other things after it,
+so you might just as easily see something like:
+<P>
+<PRE>
+    D:\Steve\Projects\Python>
+</PRE>
+depending on how your computer has been set up and what else you have
+recently done with it. Once you have started such a window, you are
+well on the way to running Python programs.
+<P>
+You need to realize that your Python scripts have to be processed by
+another program, usually called the "Python interpreter". The
+interpreter reads your script, "compiles" it into "Python bytecodes"
+(which are instructions for an imaginary computer known as the "Python
+Virtual Machine") and then executes the bytecodes to run your
+program. So, how do you arrange for the interpreter to handle your
+Python?
+<P>
+First, you need to make sure that your command window recognises the
+word "python" as an instruction to start the interpreter. If you have
+opened a command window, you should try entering the command:
+<P>
+<PRE>
+    python
+</PRE>
+and hitting return. If you then see something like:
+<P>
+<PRE>
+    Python 2.2 (#28, Dec 21 2001, 12:21:22) [MSC 32 bit (Intel)] on win32
+    Type "help", "copyright", "credits" or "license" for more information.
+    >>>
+</PRE>
+then this part of the job has been correctly managed during Python's
+installation process, and you have started the interpreter in
+"interactive mode". That means you can enter Python statements or
+expressions interactively and have them executed or evaluated while
+you wait. This is one of Python's strongest features, but it takes a
+little getting used to. Check it by entering a few expressions of your
+choice and seeing the results...
+<P>
+<PRE>
+    >>> print "Hello"
+    Hello
+    >>> "Hello" * 3
+    HelloHelloHello
+</PRE>
+When you want to end your interactive Python session, enter a
+terminator (hold the Ctrl key down while you enter a Z, then hit the
+"Enter" key) to get back to your Windows command prompt.  You may also
+find that you have a Start-menu entry such as "Start | Programs |
+Python 2.2 | Python (command line)" that results in you seeing the
+">>>" prompt in a new window. If so, the window will disappear after
+you enter the terminator -- Windows runs a single "python" command in
+the window, which terminates when you terminate the interpreter.
+<P>
+If the "python" command, instead of displaying the interpreter prompt ">>>", gives you a message like
+<P>
+<PRE>
+    'python' is not recognized as an internal or external command,
+    operable program or batch file.
+</PRE>
+or
+<P>
+<PRE>
+    Bad command or filename
+</PRE>
+then you need to make sure that your computer knows where to find the
+Python interpreter. To do this you will have to modify a setting
+called the PATH, which is a just list of directories where Windows
+will look for programs. Rather than just enter the right command every
+time you create a command window, you should arrange for Python's
+installation directory to be added to the PATH of every command window
+as it starts. If you installed Python fairly recently then the command
+<P>
+<PRE>
+    dir C:\py*
+</PRE>
+will probably tell you where it is installed. Alternatively, perhaps
+you made a note. Otherwise you will be reduced to a search of your
+whole disk ... break out the Windows explorer and use "Tools | Find"
+or hit the "Search" button and look for "python.exe". Suppose you
+discover that Python is installed in the C:\Python22 directory (the
+default at the time of writing) then you should make sure that
+entering the command
+<P>
+<PRE>
+    c:\Python22\python
+</PRE>
+starts up the interpreter as above (and don't forget you'll need a
+"CTRL-Z" and an "Enter" to get out of it). Once you have verified the
+directory, you need to add it to the start-up routines your computer
+goes through.  For older versions of Windows the easiest way to do
+this is to edit the C:\AUTOEXEC.BAT file. You would want to add a line
+like the following to AUTOEXEC.BAT:
+<P>
+<PRE>
+    PATH C:\Python22;%PATH%
+</PRE>
+For Windows NT, 2000 and (I assume) XP, you will need to add a string
+such as
+<P>
+<PRE>
+    ;C:\Python22
+</PRE>
+to the current setting for the PATH environment variable, which you
+will find in the properties window of "My Computer" under the
+"Advanced" tab. Note that if you have sufficient privilege you might
+get a choice of installing the settings either for the Current User or
+for System. The latter is preferred if you want everybody to be able
+to run Python on the machine.
+<P>
+If you aren't confident doing any of these manipulations yourself, ask
+for help!  At this stage you may or may not want to reboot your system
+to make absolutely sure the new setting has "taken" (don't you love
+the way Windows gives you these freqeuent coffee breaks). You probably
+won't need to for Windows NT, XP or 2000. You can also avoid it in
+earlier versions by editing the file C:\WINDOWS\COMMAND\CMDINIT.BAT
+instead of AUTOEXEC.BAT.
+<P>
+You should now be able to start a new command window, enter
+<P>
+<PRE>
+    python
+</PRE>
+at the "C:>" (or whatever) prompt, and see the ">>>" prompt that
+indicates the Python interpreter is reading interactive commands.
+<P>
+Let's suppose you have a program called "pytest.py" in directory
+"C:\Steve\Projects\Python". A session to run that program might look
+like this:
+<P>
+<PRE>
+    C:\> cd \Steve\Projects\Python
+    C:\Steve\Projects\Python> python pytest.py
+</PRE>
+Because you added a file name to the command to start the interpreter,
+when it starts up it reads the Python script in the named file,
+compiles it, executes it, and terminates (so you see another "C:\>"
+prompt).  You might also have entered
+<P>
+<PRE>
+    C:\> python \Steve\Projects\Python\pytest.py
+</PRE>
+if you hadn't wanted to change your current directory.
+<P>
+Under NT, 2000 and XP you may well find that the installation process
+has also arranged that the command
+<P>
+<PRE>
+    pytest.py
+</PRE>
+(or, if the file isn't in the current directory)
+<P>
+<PRE>
+    C:\Steve\Projects\Python\pytest.py
+</PRE>
+will automatically recognize the ".py" extension and run the Python
+interpreter on the named file. Using this feature is fine, but <I>some</I>
+versions of Windows have bugs which mean that this form isn't exactly
+equivalent to using the interpreter explicitly, so be careful. Easier
+to remember, for now, that
+<P>
+<PRE>
+    python C:\Steve\Projects\Python\pytest.py
+</PRE>
+works pretty close to the same, and redirection will work (more)
+reliably.
+<P>
+The important things to remember are:
+<P>
+1. Start Python from the Start Menu, or make sure the PATH is set
+correctly so Windows can find the Python interpreter.
+<P>
+<PRE>
+    python
+</PRE>
+should give you a '>>>" prompt from the Python interpreter. Don't
+forget the CTRL-Z and ENTER to terminate the interpreter (and, if you
+started the window from the Start Menu, make the window disappear).
+<P>
+2. Once this works, you run programs with commands:
+<P>
+<PRE>
+    python {program-file}
+</PRE>
+3. When you know the commands to use you can build Windows shortcuts
+to run the Python interpreter on any of your scripts, naming
+particular working directories, and adding them to your menus, but
+that's another lessFAQ. Take a look at
+<P>
+<PRE>
+    python --help
+</PRE>
+if your needs are complex.
+<P>
+4. Interactive mode (where you see the ">>>" prompt) is best used
+<I>not</I> for running programs, which are better executed as in steps 2
+and 3, but for checking that individual statements and expressions do
+what you think they will, and for developing code by experiment.
+<P>
+
+<A HREF="faqw.py?req=edit&amp;file=faq08.018.htp">Edit this entry</A> /
+<A HREF="faqw.py?req=log&amp;file=faq08.018.htp">Log info</A>
+
+/ Last changed on Tue Aug 20 16:19:53 2002 by
+<A HREF="mailto:guido@python.org">GvR</A>
+<P>
+
+<HR>
+<A HREF="http://www.python.org">Python home</A> /
+<A HREF="faqw.py?req=home">Python FAQ Wizard 1.0.3</A> /
+Feedback to <A HREF="mailto:guido@python.org">GvR</A>
+<P><A HREF="http://www.python.org/"><IMG
+SRC="http://www.python.org/pics/PythonPowered.gif" 
+ALIGN=top WIDTH=110 HEIGHT=44 ALT="Python Powered" BORDER=0></A><BR>
+</BODY>
+</HTML>
--- python2.7-2.7.3.orig/debian/PVER-doc.doc-base.PVER-dist.in
+++ python2.7-2.7.3/debian/PVER-doc.doc-base.PVER-dist.in
@@ -0,0 +1,13 @@
+Document: @PVER@-dist
+Title: Distributing Python Modules (v@VER@)
+Author: Greg Ward
+Abstract: This document describes the Python Distribution Utilities
+ (``Distutils'') from the module developer's point-of-view, describing
+ how to use the Distutils to make Python modules and extensions easily
+ available to a wider audience with very little overhead for
+ build/release/install mechanics.
+Section: Programming/Python
+
+Format: HTML
+Index: /usr/share/doc/@PVER@/html/distutils/index.html
+Files: /usr/share/doc/@PVER@/html/distutils/*.html
--- python2.7-2.7.3.orig/debian/idle.desktop.in
+++ python2.7-2.7.3/debian/idle.desktop.in
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Name=IDLE (using Python-@VER@)
+Comment=Integrated Development Environment for Python (using Python-@VER@)
+Exec=/usr/bin/idle-@PVER@
+Icon=/usr/share/pixmaps/@PVER@.xpm
+Terminal=false
+Type=Application
+Categories=Application;Development;
+StartupNotify=true
--- python2.7-2.7.3.orig/debian/pdb.1.in
+++ python2.7-2.7.3/debian/pdb.1.in
@@ -0,0 +1,16 @@
+.TH PDB@VER@ 1
+.SH NAME
+pdb@VER@ \- the Python debugger
+.SH SYNOPSIS
+.PP
+.B pdb@VER@
+.I script [...]
+.SH DESCRIPTION
+.PP
+See /usr/lib/python@VER@/pdb.doc for more information on the use
+of pdb.  When the debugger is started, help is available via the
+help command.
+.SH SEE ALSO
+python@VER@(1). Chapter 9 of the Python Library Reference
+(The Python Debugger). Available in the python@VER@-doc package at
+/usr/share/doc/python@VER@/html/lib/module-pdb.html.
--- python2.7-2.7.3.orig/debian/dh_rmemptydirs
+++ python2.7-2.7.3/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.7-2.7.3.orig/debian/PVER-minimal.preinst.in
+++ python2.7-2.7.3/debian/PVER-minimal.preinst.in
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+set -e
+
+syssite=/usr/lib/@PVER@/site-packages
+oldsite=/usr/lib/@PVER@/old-site-packages
+localsite=/usr/local/lib/@PVER@/dist-packages
+syslink=../../${localsite#/usr/*}
+
+case "$1" in
+    install)
+	if [ -z "$2" ] && [ -d $syssite ] && [ ! -h $syssite ]; then
+	    echo "new installation of @PVER@-minimal; $syssite is a directory"
+	    echo "which is expected a symlink to $localsite."
+	    echo "please find the package shipping files in $syssite and"
+	    echo "file a bug report to ship these in /usr/lib/@PVER@/dist-packages instead"
+	    echo "aborting installation of @PVER@-minimal"
+	    exit 1
+	fi
+
+	# remember newly installed runtime
+	mkdir -p /var/lib/python
+	touch /var/lib/python/@PVER@_installed
+    ;;
+    upgrade)
+    ;;
+
+    abort-upgrade)
+    ;;
+
+    *)
+        echo "preinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+#DEBHELPER#
+
+exit 0
--- python2.7-2.7.3.orig/debian/PVER-minimal.postinst.in
+++ python2.7-2.7.3/debian/PVER-minimal.postinst.in
@@ -0,0 +1,76 @@
+#! /bin/sh
+
+set -e
+
+if [ ! -f /etc/@PVER@/sitecustomize.py ]; then
+    cat <<-EOF
+	# Empty sitecustomize.py to avoid a dangling symlink
+EOF
+fi
+
+syssite=/usr/lib/@PVER@/site-packages
+localsite=/usr/local/lib/@PVER@/dist-packages
+syslink=../../${localsite#/usr/*}
+
+case "$1" in
+    configure)
+        # Create empty directories in /usr/local
+        if [ ! -e /usr/local/lib/@PVER@ ]; then
+            mkdir -p /usr/local/lib/@PVER@ 2> /dev/null || true
+            chmod 2775 /usr/local/lib/@PVER@ 2> /dev/null || true
+            chown root:staff /usr/local/lib/@PVER@ 2> /dev/null || true
+        fi
+        if [ ! -e $localsite ]; then
+            mkdir -p $localsite 2> /dev/null || true
+            chmod 2775 $localsite 2> /dev/null || true
+            chown root:staff $localsite 2> /dev/null || true
+        fi
+	#if [ ! -h $syssite ]; then
+	#    ln -s $syslink $syssite
+	#fi
+
+	if which update-binfmts >/dev/null; then
+	    update-binfmts --import @PVER@
+	fi
+
+    ;;
+esac
+
+if [ "$1" = configure ]; then
+    (
+    files=$(dpkg -L @PVER@-minimal | sed -n '/^\/usr\/lib\/@PVER@\/.*\.py$/p')
+	@PVER@ /usr/lib/@PVER@/py_compile.py $files
+	if grep -sq '^byte-compile[^#]*optimize' /etc/python/debian_config; then
+	    @PVER@ -O /usr/lib/@PVER@/py_compile.py $files
+	fi
+    )
+    bc=no
+    if [ -z "$2" ] || dpkg --compare-versions "$2" lt 2.7-9 \
+        || [ -f /var/lib/python/@PVER@_installed ]; then
+    	bc=yes
+    fi
+    if grep -sq '^unsupported-versions[^#]*@PVER@' /usr/share/python/debian_defaults
+    then
+	# FIXME: byte compile anyway?
+	bc=no
+    fi
+    if [ "$bc" = yes ]; then
+	# new installation or installation of first version with hook support
+	if [ "$DEBIAN_FRONTEND" != noninteractive ]; then
+	    echo "Linking and byte-compiling packages for runtime @PVER@..."
+	fi
+	version=$(dpkg -s @PVER@-minimal | awk '/^Version:/ {print $2}')
+	for hook in /usr/share/python/runtime.d/*.rtinstall; do
+	    [ -x $hook ] || continue
+	    $hook rtinstall @PVER@ "$2" "$version"
+	done
+	if [ -f /var/lib/python/@PVER@_installed ]; then
+	    rm -f /var/lib/python/@PVER@_installed
+	    rmdir --ignore-fail-on-non-empty /var/lib/python 2>/dev/null
+	fi
+    fi
+fi
+
+#DEBHELPER#
+
+exit 0
--- python2.7-2.7.3.orig/debian/PVER-doc.doc-base.PVER-new.in
+++ python2.7-2.7.3/debian/PVER-doc.doc-base.PVER-new.in
@@ -0,0 +1,10 @@
+Document: @PVER@-new
+Title: What's new in Python @VER@
+Author: A.M. Kuchling
+Abstract: This documents lists new features and changes worth mentioning
+ in Python @VER@.
+Section: Programming/Python
+
+Format: HTML
+Index: /usr/share/doc/@PVER@/html/whatsnew/@VER@.html
+Files: /usr/share/doc/@PVER@/html/whatsnew/@VER@.html
--- python2.7-2.7.3.orig/debian/README.idle-PVER.in
+++ python2.7-2.7.3/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.7-2.7.3.orig/debian/idle-PVER.overrides.in
+++ python2.7-2.7.3/debian/idle-PVER.overrides.in
@@ -0,0 +1,3 @@
+# icon in dependent package
+idle-@PVER@ binary: menu-icon-missing
+idle-@PVER@ binary: image-file-in-usr-lib
--- python2.7-2.7.3.orig/debian/PVER-minimal.README.Debian.in
+++ python2.7-2.7.3/debian/PVER-minimal.README.Debian.in
@@ -0,0 +1,147 @@
+Contents of the @PVER@-minimal package
+-----------------------------------------
+
+@PVER@-minimal consists of a minimum set of modules which may be needed
+for python scripts used during the boot process.  If other packages
+are needed in these scripts, don't work around the missing module, but
+file a bug report against this package. The modules in this package
+are:
+
+  __builtin__		builtin
+  __future__		module
+  _abcoll		module
+  _bisect		extension
+  _bytesio		extension
+  _codecs		builtin
+  _collections		extension
+  _fileio		extension
+  _functools		extension
+  _hashlib		extensionx
+  _heapq		extension
+  _locale		extension
+  _random		extension
+  _socket		extension
+  _sre			builtin
+  _ssl			extensionx
+  _struct		extension
+  _symtable		builtin
+  _sysconfigdata	module
+  _sysconfigdata_nd	module
+  _types		builtin
+  _warnings		builtin
+  _weakref		extension
+  _weakrefset		module
+  abc			module
+  atexit		module
+  ConfigParser		module
+  StringIO		module
+  UserDict		module
+  cPickle		extension
+  cStringIO		extension
+  array			extension
+  base64		module
+  binascii		extension
+  bisect		module
+  cmath			extension
+  codecs		module
+  collections		module
+  compileall		module
+  copy			module
+  copy_reg		module
+  dis			module
+  errno			builtin
+  exceptions		builtin
+  fcntl			extension
+  fnmatch		module
+  functools		module
+  gc			builtin
+  genericpath		module
+  getopt		module
+  glob			module
+  grp			extension
+  hashlib		module
+  heapq			module
+  imp			builtin
+  inspect		module
+  itertools		extension
+  keyword		module
+  linecache		module
+  logging		package
+  marshal		builtin
+  math			extension
+  md5			module
+  opcode		module
+  operator		extension
+  optparse		module
+  os			module
+  pickle		module
+  platform		module
+  popen2		module
+  posix			builtin
+  posixpath		module
+  pkgutil		module
+  pwd			builtin
+  py_compile		module
+  random		module
+  re			module
+  repr			module
+  runpy			module
+  select		extension
+  sha			module
+  shutil		module
+  signal		builtin
+  socket		module
+  spwd			extension
+  sre			module
+  sre_compile		module
+  sre_constants		module
+  sre_parse		module
+  ssl			module
+  stat			module
+  string		module
+  strop			extension
+  struct		module
+  subprocess		module
+  sys			builtin
+  syslog		extension
+  sysconfig		module
+  tempfile		module
+  textwrap		module
+  time			extension
+  token			module
+  thread		builtin
+  token			module
+  tokenize		module
+  traceback		module
+  types			module
+  unicodedata		extension
+  weakref		module
+  warnings		module
+  zipimport		extension
+  zlib			extension
+
+Included are as well the codecs and stringprep modules, and the encodings
+modules for all encodings except the multibyte encodings and the bz2 codec.
+
+The following modules are excluded, their import is guarded from the
+importing module:
+
+  Used in       Excluded
+  ------------  ------------------------------------
+  os		nt ntpath os2 os2emxpath mac macpath
+		riscos riscospath riscosenviron
+  optparse	gettext
+  pickle	doctest
+  subprocess	threading
+
+This list was derived by looking at the modules in the perl-base package,
+then adding python specific "core modules".
+
+TODO's
+------
+
+- time.strptime cannot be used. The required _strptime module is not
+  included in the -minimal package yet. _strptime, locale, _locale and
+  calendar have to be added.
+
+- modules used very often in the testsuite: copy, cPickle, operator.
--- python2.7-2.7.3.orig/debian/README.Debian.in
+++ python2.7-2.7.3/debian/README.Debian.in
@@ -0,0 +1,8 @@
+The documentation for this package is in /usr/share/doc/@PVER@/.
+
+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.7-2.7.3.orig/debian/watch
+++ python2.7-2.7.3/debian/watch
@@ -0,0 +1,3 @@
+version=3
+opts=dversionmangle=s/.*\+//,uversionmangle=s/([abcr]+[1-9])$/~$1/ \
+  http://www.python.org/ftp/python/2\.7(\.\d)?/Python-(2\.7[.\dabcr]*)\.tgz
--- python2.7-2.7.3.orig/debian/locale-gen
+++ python2.7-2.7.3/debian/locale-gen
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+LOCPATH=`pwd`/locales
+export LOCPATH
+
+[ -d $LOCPATH ] || mkdir -p $LOCPATH
+
+umask 022
+
+echo "Generating locales..."
+while read locale charset; do
+	case $locale in \#*) continue;; esac
+	[ -n "$locale" -a -n "$charset" ] || continue
+	echo -n "  `echo $locale | sed 's/\([^.\@]*\).*/\1/'`"
+	echo -n ".$charset"
+	echo -n `echo $locale | sed 's/\([^\@]*\)\(\@.*\)*/\2/'`
+	echo -n '...'
+        if [ -f $LOCPATH/$locale ]; then
+	    input=$locale
+	else
+            input=`echo $locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`
+	fi
+	localedef -i $input -c -f $charset $LOCPATH/$locale #-A /etc/locale.alias
+	echo ' done'; \
+done <<EOF
+# This file lists locales that the python testsuite depends on
+en_US			ISO-8859-1
+en_US.UTF-8		UTF-8
+EOF
+
+echo "Generation complete."
--- python2.7-2.7.3.orig/debian/dh_doclink
+++ python2.7-2.7.3/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.7-2.7.3.orig/debian/pymindeps.py
+++ python2.7-2.7.3/debian/pymindeps.py
@@ -0,0 +1,175 @@
+#! /usr/bin/python
+
+# Matthias Klose
+# Modified to only exclude module imports from a given module.
+
+# Copyright 2004 Toby Dickenson
+#
+# 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+import os, sys, pprint
+import modulefinder
+import imp
+
+class mymf(modulefinder.ModuleFinder):
+    def __init__(self,*args,**kwargs):
+        self._depgraph = {}
+        self._types = {}
+        self._last_caller = None
+        modulefinder.ModuleFinder.__init__(self, *args, **kwargs)
+        
+    def import_hook(self, name, caller=None, fromlist=None, level=-1):
+        old_last_caller = self._last_caller
+        try:
+            self._last_caller = caller
+            return modulefinder.ModuleFinder.import_hook(self, name, caller,
+                                                         fromlist, level)
+        finally:
+            self._last_caller = old_last_caller
+            
+    def import_module(self, partnam, fqname, parent):
+        m = modulefinder.ModuleFinder.import_module(self,
+                                                    partnam, fqname, parent)
+        if m is not None and self._last_caller:
+            caller = self._last_caller.__name__
+            if '.' in caller:
+                caller = caller[:caller.index('.')]
+            callee =  m.__name__
+            if '.' in callee:
+                callee = callee[:callee.index('.')]
+            #print "XXX last_caller", caller, "MOD", callee
+            #self._depgraph.setdefault(self._last_caller.__name__,{})[r.__name__] = 1
+            #if caller in ('pdb', 'doctest') or callee in ('pdb', 'doctest'):
+            #    print caller, "-->", callee
+            if caller != callee:
+                self._depgraph.setdefault(caller,{})[callee] = 1
+        return m
+    
+    def find_module(self, name, path, parent=None):
+        if parent is not None:
+            # assert path is not None
+            fullname = parent.__name__+'.'+name
+        elif name == "__init__":
+            fullname = os.path.basename(path[0])
+        else:
+            fullname = name
+        if self._last_caller:
+            caller = self._last_caller.__name__
+            if fullname in excluded_imports.get(caller, []):
+                #self.msgout(3, "find_module -> Excluded", fullname)
+                raise ImportError, name
+
+        if fullname in self.excludes:
+            #self.msgout(3, "find_module -> Excluded", fullname)
+            raise ImportError, name
+
+        if path is None:
+            if name in sys.builtin_module_names:
+                return (None, None, ("", "", imp.C_BUILTIN))
+
+            path = self.path
+        return imp.find_module(name, path)
+
+    def load_module(self, fqname, fp, pathname, file_info):
+        suffix, mode, type = file_info
+        m = modulefinder.ModuleFinder.load_module(self, fqname,
+                                                  fp, pathname, file_info)
+        if m is not None:
+            self._types[m.__name__] = type
+        return m
+
+    def load_package(self, fqname, pathname):
+        m = modulefinder.ModuleFinder.load_package(self, fqname,pathname)
+        if m is not None:
+            self._types[m.__name__] = imp.PKG_DIRECTORY
+        return m
+ 
+def reduce_depgraph(dg):
+    pass
+
+# guarded imports, which don't need to be included in python-minimal
+excluded_imports = {
+    'codecs': set(('encodings',)),
+    'collections': set(('doctest', 'dummy_thread', 'cPickle')),
+    'copy': set(('reprlib',)),
+    'difflib': set(('doctest',)),
+    'hashlib': set(('logging',)),
+    #'hashlib': set(('_hashlib', '_md5', '_sha', '_sha256','_sha512',)),
+    'heapq': set(('doctest',)),
+    'inspect': set(('compiler',)),
+    'os': set(('nt', 'ntpath', 'os2', 'os2emxpath', 'mac', 'macpath',
+               'riscos', 'riscospath', 'riscosenviron')),
+    'optparse': set(('gettext',)),
+    'pickle': set(('doctest',)),
+    'platform': set(('plistlib', 'tempfile')),
+    #'socket': set(('_ssl', 'ssl')),
+    'tempfile': set(('dummy_thread',)),
+    'subprocess': set(('threading',)),
+    'shutil': set(('distutils', 'tarfile', 'zipfile')),
+    'sysconfig': set(('pprint',)),
+    }
+
+def main(argv):
+    # Parse command line
+    import getopt
+    try:
+        opts, args = getopt.getopt(sys.argv[1:], "dmp:qx:")
+    except getopt.error as msg:
+        print(msg)
+        return
+
+    # Process options
+    debug = 1
+    domods = 0
+    addpath = []
+    exclude = []
+    for o, a in opts:
+        if o == '-d':
+            debug = debug + 1
+        if o == '-m':
+            domods = 1
+        if o == '-p':
+            addpath = addpath + a.split(os.pathsep)
+        if o == '-q':
+            debug = 0
+        if o == '-x':
+            exclude.append(a)
+
+    path = sys.path[:]
+    path = addpath + path
+
+    if debug > 1:
+        print("version:", sys.version)
+        print("path:")
+        for item in path:
+            print("   ", repr(item))
+
+    #exclude = ['__builtin__', 'sys', 'os']
+    exclude = []
+    mf = mymf(path, debug, exclude)
+    for arg in args:
+        mf.run_script(arg)
+
+    depgraph = reduce_depgraph(mf._depgraph)
+    
+    pprint.pprint({'depgraph':mf._depgraph, 'types':mf._types})
+    
+if __name__=='__main__':
+    main(sys.argv[1:])
--- python2.7-2.7.3.orig/debian/2to3-2.7.1
+++ python2.7-2.7.3/debian/2to3-2.7.1
@@ -0,0 +1,41 @@
+.\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.40.4.
+.TH 2TO3-2.7 "1" "January 2012" "2to3-2.7 2.7" "User Commands"
+.SH NAME
+2to3-2.7 \- Python2 to Python3 converter
+.SH SYNOPSIS
+.B 2to3
+[\fIoptions\fR] \fIfile|dir \fR...
+.SH OPTIONS
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+show this help message and exit
+.TP
+\fB\-d\fR, \fB\-\-doctests_only\fR
+Fix up doctests only
+.TP
+\fB\-f\fR FIX, \fB\-\-fix\fR=\fIFIX\fR
+Each FIX specifies a transformation; default: all
+.TP
+\fB\-j\fR PROCESSES, \fB\-\-processes\fR=\fIPROCESSES\fR
+Run 2to3 concurrently
+.TP
+\fB\-x\fR NOFIX, \fB\-\-nofix\fR=\fINOFIX\fR
+Prevent a transformation from being run
+.TP
+\fB\-l\fR, \fB\-\-list\-fixes\fR
+List available transformations
+.TP
+\fB\-p\fR, \fB\-\-print\-function\fR
+Modify the grammar so that print() is a function
+.TP
+\fB\-v\fR, \fB\-\-verbose\fR
+More verbose logging
+.TP
+\fB\-\-no\-diffs\fR
+Don't show diffs of the refactoring
+.TP
+\fB\-w\fR, \fB\-\-write\fR
+Write back modified files
+.TP
+\fB\-n\fR, \fB\-\-nobackups\fR
+Don't write backups for modified files
--- python2.7-2.7.3.orig/debian/pygettext.1
+++ python2.7-2.7.3/debian/pygettext.1
@@ -0,0 +1,108 @@
+.TH PYGETTEXT 1 "" "pygettext 1.4"
+.SH NAME
+pygettext \- Python equivalent of xgettext(1)
+.SH SYNOPSIS
+.B pygettext
+[\fIOPTIONS\fR] \fIINPUTFILE \fR...
+.SH DESCRIPTION
+pygettext is deprecated. The current version of xgettext supports
+many languages, including Python.
+
+pygettext uses Python's standard tokenize module to scan Python
+source code, generating .pot files identical to what GNU xgettext generates
+for C and C++ code.  From there, the standard GNU tools can be used.
+.PP
+pygettext searches only for _() by default, even though GNU xgettext
+recognizes the following keywords: gettext, dgettext, dcgettext,
+and gettext_noop. See the \fB\-k\fR/\fB\--keyword\fR flag below for how to
+augment this.
+.PP
+.SH OPTIONS
+.TP
+\fB\-a\fR, \fB\-\-extract\-all\fR
+Extract all strings.
+.TP
+\fB\-d\fR, \fB\-\-default\-domain\fR=\fINAME\fR
+Rename the default output file from messages.pot to name.pot.
+.TP
+\fB\-E\fR, \fB\-\-escape\fR
+Replace non-ASCII characters with octal escape sequences.
+.TP
+\fB\-D\fR, \fB\-\-docstrings\fR
+Extract module, class, method, and function docstrings.
+These do not need to be wrapped in _() markers, and in fact cannot
+be for Python to consider them docstrings. (See also the \fB\-X\fR option).
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+Print this help message and exit.
+.TP
+\fB\-k\fR, \fB\-\-keyword\fR=\fIWORD\fR
+Keywords to look for in addition to the default set, which are: _
+.IP
+You can have multiple \fB\-k\fR flags on the command line.
+.TP
+\fB\-K\fR, \fB\-\-no\-default\-keywords\fR
+Disable the default set of keywords (see above).
+Any keywords explicitly added with the \fB\-k\fR/\fB\--keyword\fR option
+are still recognized.
+.TP
+\fB\-\-no\-location\fR
+Do not write filename/lineno location comments.
+.TP
+\fB\-n\fR, \fB\-\-add\-location\fR
+Write filename/lineno location comments indicating where each
+extracted string is found in the source.  These lines appear before
+each msgid.  The style of comments is controlled by the
+\fB\-S\fR/\fB\--style\fR option.  This is the default.
+.TP
+\fB\-o\fR, \fB\-\-output\fR=\fIFILENAME\fR
+Rename the default output file from messages.pot to FILENAME.
+If FILENAME is `-' then the output is sent to standard out.
+.TP
+\fB\-p\fR, \fB\-\-output\-dir\fR=\fIDIR\fR
+Output files will be placed in directory DIR.
+.TP
+\fB\-S\fR, \fB\-\-style\fR=\fISTYLENAME\fR
+Specify which style to use for location comments.
+Two styles are supported:
+.RS
+.IP \(bu 4
+Solaris	# File: filename, line: line-number
+.IP \(bu 4
+GNU		#: filename:line
+.RE
+.IP
+The style name is case insensitive.
+GNU style is the default.
+.TP
+\fB\-v\fR, \fB\-\-verbose\fR
+Print the names of the files being processed.
+.TP
+\fB\-V\fR, \fB\-\-version\fR
+Print the version of pygettext and exit.
+.TP
+\fB\-w\fR, \fB\-\-width\fR=\fICOLUMNS\fR
+Set width of output to columns.
+.TP
+\fB\-x\fR, \fB\-\-exclude\-file\fR=\fIFILENAME\fR
+Specify a file that contains a list of strings that are not be
+extracted from the input files.  Each string to be excluded must
+appear on a line by itself in the file.
+.TP
+\fB\-X\fR, \fB\-\-no\-docstrings\fR=\fIFILENAME\fR
+Specify a file that contains a list of files (one per line) that
+should not have their docstrings extracted.  This is only useful in
+conjunction with the \fB\-D\fR option above.
+.PP
+If `INPUTFILE' is -, standard input is read.
+.SH BUGS
+pygettext attempts to be option and feature compatible with GNU xgettext
+where ever possible.  However some options are still missing or are not fully
+implemented.  Also, xgettext's use of command line switches with option
+arguments is broken, and in these cases, pygettext just defines additional
+switches.
+.SH AUTHOR
+pygettext is written by Barry Warsaw <barry@zope.com>.
+.PP
+Joonas Paalasmaa <joonas.paalasmaa@iki.fi> put this manual page together
+based on "pygettext --help".
--- python2.7-2.7.3.orig/debian/PVER-examples.overrides.in
+++ python2.7-2.7.3/debian/PVER-examples.overrides.in
@@ -0,0 +1,2 @@
+# don't care about permissions of the example files
+@PVER@-examples binary: executable-not-elf-or-script
--- python2.7-2.7.3.orig/debian/control
+++ python2.7-2.7.3/debian/control
@@ -0,0 +1,122 @@
+Source: python2.7
+Section: python
+Priority: optional
+Maintainer: Matthias Klose <doko@debian.org>
+Build-Depends: debhelper (>= 5), quilt, autoconf, lsb-release, sharutils,
+  libreadline-dev, libtinfo-dev, libncursesw5-dev (>= 5.3),
+  tk8.5-dev, blt-dev (>= 2.4z), libssl-dev,
+  zlib1g-dev, libbz2-dev,
+  libexpat1-dev (>= 2.1),
+  libbluetooth-dev [linux-any],
+  locales [!armel !avr32 !hppa !ia64 !mipsel],
+  libsqlite3-dev, libffi-dev (>= 3.0.5),
+  libgpm2 [linux-any],
+  mime-support, netbase, bzip2,
+  libdb5.1-dev, libgdbm-dev, gdb, python, help2man,
+  xvfb, xauth
+Build-Depends-Indep: python-sphinx
+Build-Conflicts: tcl8.4-dev, tk8.4-dev, python2.7-xml, python-xml, autoconf2.13, python-cxx-dev
+Standards-Version: 3.9.3
+Vcs-Browser: https://code.launchpad.net/~doko/python/pkg2.7-debian
+Vcs-Bzr: http://bazaar.launchpad.net/~doko/python/pkg2.7-debian
+
+Package: python2.7
+Architecture: any
+Priority: optional
+Depends: python2.7-minimal (= ${binary:Version}), mime-support, ${shlibs:Depends}, ${misc:Depends}
+Suggests: python2.7-doc, binutils
+Provides: python2.7-cjkcodecs, python2.7-ctypes, python2.7-elementtree, python2.7-celementtree, python2.7-wsgiref, python2.7-profiler, python2.7-argparse, python-argparse
+Conflicts: python-profiler (<= 2.7.1-2)
+Breaks: python-virtualenv (<< 1.7.1.2-2~), vim-nox (<< 2:7.3.547-4), vim-gtk (<< 2:7.3.547-4), vim-gnome (<< 2:7.3.547-4), vim-athena (<< 2:7.3.547-4)
+Replaces: python-profiler (<= 2.7.1-2)
+Description: Interactive high-level object-oriented language (version 2.7)
+ Version 2.7 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.7-minimal
+Architecture: any
+Priority: optional
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Recommends: python2.7
+Suggests: binfmt-support
+Replaces: python2.7 (<< 2.7.1~rc1-2~)
+Conflicts: binfmt-support (<< 1.1.2)
+Description: Minimal subset of the Python language (version 2.7)
+ This package contains the interpreter and some essential modules.  It can
+ be used in the boot process for some basic tasks.
+ See /usr/share/doc/python2.7-minimal/README.Debian for a list of the modules
+ contained in this package.
+
+Package: libpython2.7
+Architecture: any
+Section: libs
+Priority: optional
+Depends: python2.7 (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
+Replaces: python2.7 (<< 2.6)
+Description: Shared Python runtime library (version 2.7)
+ Version 2.7 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.
+ .
+ This package contains the shared runtime library, normally not needed
+ for programs using the statically linked interpreter.
+
+Package: python2.7-examples
+Architecture: all
+Depends: python2.7 (>= ${source:Version}), ${misc:Depends}
+Description: Examples for the Python language (v2.7)
+ Examples, Demos and Tools for Python (v2.7). These are files included in
+ the upstream Python distribution (v2.7).
+
+Package: python2.7-dev
+Architecture: any
+Depends: python2.7 (= ${binary:Version}), libpython2.7 (= ${binary:Version}), libexpat1-dev, libssl-dev, ${shlibs:Depends}, ${misc:Depends}
+Recommends: libc6-dev | libc-dev
+Replaces: python2.7 (<< 2.7-3)
+Description: Header files and a static library for Python (v2.7)
+ Header files, a static library and development tools for building
+ Python (v2.7) modules, extending the Python interpreter or embedding
+ Python (v2.7) in applications.
+ .
+ Maintainers of Python packages should read README.maintainers.
+
+Package: idle-python2.7
+Architecture: all
+Depends: python2.7, python-tk (>= 2.6~a3), python2.7-tk, ${misc:Depends}
+Enhances: python2.7
+Replaces: python2.7 (<< 2.6.1-2)
+Description: IDE for Python (v2.7) using Tkinter
+ IDLE is an Integrated Development Environment for Python (v2.7).
+ IDLE is written using Tkinter and therefore quite platform-independent.
+
+Package: python2.7-doc
+Section: doc
+Architecture: all
+Depends: libjs-jquery, ${misc:Depends}
+Suggests: python2.7
+Description: Documentation for the high-level object-oriented language Python (v2.7)
+ These is the official set of documentation for the interactive high-level
+ object-oriented language Python (v2.7). All documents are provided
+ in HTML format. The package consists of ten documents:
+ .
+   * What's New in Python2.7
+   * 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
+
+Package: python2.7-dbg
+Section: debug
+Architecture: any
+Priority: extra
+Depends: python2.7 (>= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
+Suggests: python-gdbm-dbg, python-tk-dbg
+Description: Debug Build of the Python Interpreter (version 2.7)
+ Python interpreter configured with --pydebug. Dynamically loaded modules are
+ searched in /usr/lib/python2.7/lib-dynload/debug first.
--- python2.7-2.7.3.orig/debian/README.dbm
+++ python2.7-2.7.3/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.7-2.7.3.orig/debian/PVER.menu.in
+++ python2.7-2.7.3/debian/PVER.menu.in
@@ -0,0 +1,4 @@
+?package(@PVER@):needs="text" section="Applications/Programming"\
+	title="Python (v@VER@)"\
+	icon="/usr/share/pixmaps/@PVER@.xpm"\
+	command="/usr/bin/python@VER@"
--- python2.7-2.7.3.orig/debian/idle-PVER.menu.in
+++ python2.7-2.7.3/debian/idle-PVER.menu.in
@@ -0,0 +1,5 @@
+?package(idle-@PVER@):needs="X11" section="Applications/Programming"\
+	title="IDLE (Python v@VER@)"\
+	icon="/usr/share/pixmaps/@PVER@.xpm"\
+	command="/usr/bin/idle-@PVER@" \
+	hints="Environments"
--- python2.7-2.7.3.orig/debian/PVER-doc.doc-base.PVER-ext.in
+++ python2.7-2.7.3/debian/PVER-doc.doc-base.PVER-ext.in
@@ -0,0 +1,16 @@
+Document: @PVER@-ext
+Title: Extending and Embedding the Python Interpreter (v@VER@)
+Author: Guido van Rossum
+Abstract: This document describes how to write modules in C or C++ to extend
+ the Python interpreter with new modules.  Those modules can define
+ new functions but also new object types and their methods.  The
+ document also describes how to embed the Python interpreter in
+ another application, for use as an extension language.  Finally,
+ it shows how to compile and link extension modules so that they
+ can be loaded dynamically (at run time) into the interpreter, if
+ the underlying operating system supports this feature.
+Section: Programming/Python
+
+Format: HTML
+Index: /usr/share/doc/@PVER@/html/extending/index.html
+Files: /usr/share/doc/@PVER@/html/extending/*.html
--- python2.7-2.7.3.orig/debian/python-config.1
+++ python2.7-2.7.3/debian/python-config.1
@@ -0,0 +1,90 @@
+.TH PYTHON\-CONFIG 1 "November 27, 2011"
+.SH NAME
+python\-config \- output build options for python C/C++ extensions or embedding
+.SH SYNOPSIS
+.BI "python\-config"
+[
+.BI "\-\-prefix"
+]
+[
+.BI "\-\-exec\-prefix"
+]
+[
+.BI "\-\-includes"
+]
+[
+.BI "\-\-libs"
+]
+[
+.BI "\-\-cflags"
+]
+[
+.BI "\-\-ldflags"
+]
+[
+.BI "\-\-help"
+]
+.SH DESCRIPTION
+.B python\-config
+helps compiling and linking programs, which embed the Python interpreter, or
+extension modules that can be loaded dynamically (at run time) into
+the interpreter.
+.SH OPTIONS
+.TP
+.BI "\-\-cflags"
+print the C compiler flags.
+.TP
+.BI "\-\-ldflags"
+print the flags that should be passed to the linker.
+.TP
+.BI "\-\-includes"
+similar to \fI\-\-cflags\fP but only with \-I options (path to python header files).
+.TP
+.BI "\-\-libs"
+similar to \fI\-\-ldflags\fP but only with \-l options (used libraries).
+.TP
+.BI "\-\-prefix"
+prints the prefix (base directory) under which python can be found.
+.TP
+.BI "\-\-exec\-prefix"
+print the prefix used for executable program directories (such as bin, sbin, etc).
+.TP
+.BI "\-\-help"
+print the usage message.
+.PP
+
+.SH EXAMPLES
+To build the singe\-file c program \fIprog\fP against the python library, use
+.PP
+.RS
+gcc $(python\-config \-\-cflags \-\-ldflags) progr.cpp \-o progr.cpp
+.RE
+.PP
+The same in a makefile:
+.PP
+.RS
+CFLAGS+=$(shell python\-config \-\-cflags)
+.RE
+.RS
+LDFLAGS+=$(shell python\-config \-\-ldflags)
+.RE
+.RS
+all: progr
+.RE
+
+To build a dynamically loadable python module, use
+.PP
+.RS
+gcc $(python\-config \-\-cflags \-\-ldflags) \-shared \-fPIC progr.cpp \-o progr.so
+.RE
+
+.SH "SEE ALSO"
+python (1)
+.br
+http://docs.python.org/extending/extending.html
+.br
+/usr/share/doc/python/faq/extending.html
+
+.SH AUTHORS
+This manual page was written by Johann Felix Soden <johfel@gmx.de>
+for the Debian project (and may be used by others).
--- python2.7-2.7.3.orig/debian/idle-PVER.postrm.in
+++ python2.7-2.7.3/debian/idle-PVER.postrm.in
@@ -0,0 +1,9 @@
+#! /bin/sh -e
+
+if [ "$1" = "purge" ]; then
+    rm -rf /etc/idle-@PVER@
+fi
+
+#DEBHELPER#
+
+exit 0
--- python2.7-2.7.3.orig/debian/PVER.desktop.in
+++ python2.7-2.7.3/debian/PVER.desktop.in
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Name=Python (v@VER@)
+Comment=Python Interpreter (v@VER@)
+Exec=/usr/bin/@PVER@
+Icon=/usr/share/pixmaps/@PVER@.xpm
+Terminal=true
+Type=Application
+Categories=Development;
+StartupNotify=true
+NoDisplay=true
--- python2.7-2.7.3.orig/debian/pylogo.xpm
+++ python2.7-2.7.3/debian/pylogo.xpm
@@ -0,0 +1,351 @@
+/* XPM */
+static char * pylogo_xpm[] = {
+"32 32 316 2",
+"  	c None",
+". 	c #8DB0CE",
+"+ 	c #6396BF",
+"@ 	c #4985B7",
+"# 	c #4181B5",
+"$ 	c #417EB2",
+"% 	c #417EB1",
+"& 	c #4D83B0",
+"* 	c #6290B6",
+"= 	c #94B2CA",
+"- 	c #70A1C8",
+"; 	c #3D83BC",
+"> 	c #3881BD",
+", 	c #387DB6",
+"' 	c #387CB5",
+") 	c #387BB3",
+"! 	c #3779B0",
+"~ 	c #3778AE",
+"{ 	c #3776AB",
+"] 	c #3776AA",
+"^ 	c #3775A9",
+"/ 	c #4A7FAC",
+"( 	c #709FC5",
+"_ 	c #3A83BE",
+": 	c #5795C7",
+"< 	c #94B9DB",
+"[ 	c #73A4CE",
+"} 	c #3D80B7",
+"| 	c #387CB4",
+"1 	c #377AB2",
+"2 	c #377AB0",
+"3 	c #3777AC",
+"4 	c #3774A7",
+"5 	c #3773A5",
+"6 	c #3C73A5",
+"7 	c #4586BB",
+"8 	c #4489C1",
+"9 	c #A7C7E1",
+"0 	c #F7F9FD",
+"a 	c #E1E9F1",
+"b 	c #4C89BC",
+"c 	c #3779AF",
+"d 	c #3778AD",
+"e 	c #3873A5",
+"f 	c #4B7CA4",
+"g 	c #3982BE",
+"h 	c #4389C1",
+"i 	c #A6C6E1",
+"j 	c #F6F9FC",
+"k 	c #D6E4F0",
+"l 	c #4A88BB",
+"m 	c #3773A6",
+"n 	c #366F9F",
+"o 	c #366E9D",
+"p 	c #376E9C",
+"q 	c #4A8BC0",
+"r 	c #79A7CD",
+"s 	c #548EBD",
+"t 	c #387AB0",
+"u 	c #3773A4",
+"v 	c #366D9C",
+"w 	c #387FBA",
+"x 	c #387DB7",
+"y 	c #387BB4",
+"z 	c #3775A8",
+"A 	c #366FA0",
+"B 	c #4981AF",
+"C 	c #427BAA",
+"D 	c #3772A4",
+"E 	c #376B97",
+"F 	c #77A3C8",
+"G 	c #4586BC",
+"H 	c #3882BE",
+"I 	c #3B76A7",
+"J 	c #3B76A6",
+"K 	c #366E9E",
+"L 	c #376B98",
+"M 	c #376B96",
+"N 	c #5681A3",
+"O 	c #F5EEB8",
+"P 	c #FFED60",
+"Q 	c #FFE85B",
+"R 	c #FFE659",
+"S 	c #FDE55F",
+"T 	c #5592C4",
+"U 	c #3A83BF",
+"V 	c #3882BD",
+"W 	c #387FB9",
+"X 	c #3779AE",
+"Y 	c #366F9E",
+"Z 	c #366C98",
+"` 	c #376A94",
+" .	c #5D85A7",
+"..	c #F5EDB7",
+"+.	c #FFEA5D",
+"@.	c #FFE75A",
+"#.	c #FFE354",
+"$.	c #FDDD56",
+"%.	c #669DC8",
+"&.	c #3885C3",
+"*.	c #3884C2",
+"=.	c #387EB8",
+"-.	c #387CB6",
+";.	c #377AB1",
+">.	c #3772A3",
+",.	c #366D9B",
+"'.	c #F5EBB5",
+").	c #FFE557",
+"!.	c #FFE455",
+"~.	c #FFDF50",
+"{.	c #FFDB4C",
+"].	c #FAD862",
+"^.	c #8EB4D2",
+"/.	c #3C86C1",
+"(.	c #3883C0",
+"_.	c #3882BF",
+":.	c #3881BC",
+"<.	c #3880BB",
+"[.	c #3775AA",
+"}.	c #F5EAB3",
+"|.	c #FFE051",
+"1.	c #FFDE4F",
+"2.	c #FFDA4A",
+"3.	c #FED446",
+"4.	c #F5DF9D",
+"5.	c #77A5CA",
+"6.	c #3885C2",
+"7.	c #387BB2",
+"8.	c #6B8EA8",
+"9.	c #F8E7A1",
+"0.	c #FFE153",
+"a.	c #FFDD4E",
+"b.	c #FFDB4B",
+"c.	c #FFD746",
+"d.	c #FFD645",
+"e.	c #FFD342",
+"f.	c #F6DB8D",
+"g.	c #508DBE",
+"h.	c #3771A3",
+"i.	c #376A95",
+"j.	c #3D6F97",
+"k.	c #C3CBC2",
+"l.	c #FBD964",
+"m.	c #FFDC4D",
+"n.	c #FFD544",
+"o.	c #FFD040",
+"p.	c #F9CF58",
+"q.	c #3F83BB",
+"r.	c #376B95",
+"s.	c #3A6C95",
+"t.	c #4E7BA0",
+"u.	c #91AABC",
+"v.	c #F6E4A3",
+"w.	c #FFDA4B",
+"x.	c #FFD646",
+"y.	c #FFD443",
+"z.	c #FFD241",
+"A.	c #FFCE3D",
+"B.	c #FFCC3B",
+"C.	c #FCC83E",
+"D.	c #3880BC",
+"E.	c #3C79AC",
+"F.	c #5F8DB4",
+"G.	c #7AA0C0",
+"H.	c #82A6C3",
+"I.	c #82A3BF",
+"J.	c #82A2BE",
+"K.	c #82A1BB",
+"L.	c #82A1B9",
+"M.	c #8BA4B5",
+"N.	c #C1C5AE",
+"O.	c #F2E19F",
+"P.	c #FDD74C",
+"Q.	c #FFD94A",
+"R.	c #FFD343",
+"S.	c #FFCE3E",
+"T.	c #FFCB39",
+"U.	c #FFC937",
+"V.	c #FEC636",
+"W.	c #3D79AB",
+"X.	c #9DB6C6",
+"Y.	c #D0CFA2",
+"Z.	c #EFE598",
+"`.	c #F8EE9B",
+" +	c #F8EB97",
+".+	c #F8E996",
+"++	c #F8E894",
+"@+	c #FAE489",
+"#+	c #FCDB64",
+"$+	c #FFDA4D",
+"%+	c #FFCF3E",
+"&+	c #FFCB3A",
+"*+	c #FFC734",
+"=+	c #FFC532",
+"-+	c #3F82B7",
+";+	c #387EB9",
+">+	c #9EB9D0",
+",+	c #F2E287",
+"'+	c #FDEB69",
+")+	c #FEEC60",
+"!+	c #FFEB5E",
+"~+	c #FFE254",
+"{+	c #FFE152",
+"]+	c #FFD747",
+"^+	c #FFC633",
+"/+	c #FCC235",
+"(+	c #578FBE",
+"_+	c #6996BC",
+":+	c #DED9A8",
+"<+	c #FEEC62",
+"[+	c #FFE658",
+"}+	c #FFDF51",
+"|+	c #FFDE50",
+"1+	c #FFD03F",
+"2+	c #FFCD3C",
+"3+	c #FFC431",
+"4+	c #FFBF2C",
+"5+	c #FAC244",
+"6+	c #85AACA",
+"7+	c #A1BBD2",
+"8+	c #F7E47C",
+"9+	c #FFE456",
+"0+	c #FFC735",
+"a+	c #FFBC29",
+"b+	c #F7D280",
+"c+	c #9DBAD2",
+"d+	c #3B7CB2",
+"e+	c #ABC2D6",
+"f+	c #FDEB7B",
+"g+	c #FFC12E",
+"h+	c #FDBD30",
+"i+	c #F4DEA8",
+"j+	c #5F91BA",
+"k+	c #ABC1D4",
+"l+	c #FDEE7E",
+"m+	c #FFE253",
+"n+	c #FFCC3C",
+"o+	c #FFBA27",
+"p+	c #FAC75B",
+"q+	c #4A82B0",
+"r+	c #3877AB",
+"s+	c #3774A6",
+"t+	c #AAC0D4",
+"u+	c #FDEE7D",
+"v+	c #FFEC5F",
+"w+	c #FFE255",
+"x+	c #FFD848",
+"y+	c #FFD444",
+"z+	c #FFCF3F",
+"A+	c #FFBC2A",
+"B+	c #FFBB28",
+"C+	c #FDBA32",
+"D+	c #447AA8",
+"E+	c #4379A7",
+"F+	c #FFE95C",
+"G+	c #FFE558",
+"H+	c #FFE355",
+"I+	c #FED84B",
+"J+	c #FCD149",
+"K+	c #FBCE47",
+"L+	c #FBCD46",
+"M+	c #FBC840",
+"N+	c #FBC63E",
+"O+	c #FBC037",
+"P+	c #FAC448",
+"Q+	c #FDD44C",
+"R+	c #FCD14E",
+"S+	c #FFC836",
+"T+	c #FFC22F",
+"U+	c #FFC02D",
+"V+	c #FFE052",
+"W+	c #FFC636",
+"X+	c #FFCF5C",
+"Y+	c #FFD573",
+"Z+	c #FFC33E",
+"`+	c #FEBD2D",
+" @	c #FFDB4D",
+".@	c #FFD949",
+"+@	c #FFD545",
+"@@	c #FFD140",
+"#@	c #FFCB48",
+"$@	c #FFF7E4",
+"%@	c #FFFCF6",
+"&@	c #FFE09D",
+"*@	c #FFBA2E",
+"=@	c #FDBE2F",
+"-@	c #FFD748",
+";@	c #FFCA38",
+">@	c #FFC844",
+",@	c #FFF2D7",
+"'@	c #FFF9EC",
+")@	c #FFDB94",
+"!@	c #FFB92D",
+"~@	c #FAC54D",
+"{@	c #FDD54E",
+"]@	c #FFBD2D",
+"^@	c #FFC858",
+"/@	c #FFD174",
+"(@	c #FFBF3E",
+"_@	c #FCBD3C",
+":@	c #FAD66A",
+"<@	c #FECD3F",
+"[@	c #FFC330",
+"}@	c #FFBD2A",
+"|@	c #FFB724",
+"1@	c #FFB521",
+"2@	c #FFB526",
+"3@	c #FBC457",
+"4@	c #F7E09E",
+"5@	c #F8D781",
+"6@	c #FAC349",
+"7@	c #FCC134",
+"8@	c #FEBE2C",
+"9@	c #FBBE3F",
+"0@	c #F7CF79",
+"a@	c #F5D795",
+"                      . + @ # $ % % & * =                       ",
+"                  - ; > > , ' ) ! ~ { ] ^ /                     ",
+"                ( _ : < [ } | 1 2 ~ 3 4 5 5 6                   ",
+"                7 8 9 0 a b 2 c d 3 { 5 5 5 e f                 ",
+"                g h i j k l c ~ { { m 5 5 n o p                 ",
+"                > > q r s t c c d 4 5 u n v v v                 ",
+"                w x ' y 2 c d d z 5 u A v v v v                 ",
+"                              B C 5 D v v v v E                 ",
+"      F G H H H x ' ) c c c d I J 5 K v v L M N O P Q R S       ",
+"    T U H V V W ' ) c c X ~ 5 5 5 Y v v Z ` `  ...+.@.#.#.$.    ",
+"  %.&.*.> w W =.-.;.c 3 { ^ 5 5 >.o v ,.E ` `  .'.).!.#.~.{.].  ",
+"^./.(._.:.<., ' ) ;.X d [.5 5 >.K v ,.E ` ` `  .}.#.|.1.{.2.3.4.",
+"5.6.(.H H x ' 7.c c 3 3 4 5 D K v v ,.` ` ` ` 8.9.0.a.b.c.d.e.f.",
+"g._.> <.w ' ' | 2 3 { z 5 5 h.v v v i.` ` ` j.k.l.m.{.d.n.e.o.p.",
+"q.> > :.-.' 1 c c c ] 5 5 >.v v ,.r.` ` s.t.u.v.{.w.x.y.z.A.B.C.",
+"D.D.w -.' 1 c c c E.F.G.H.I.J.J.K.L.L.L.M.N.O.P.Q.c.R.S.B.T.U.V.",
+"D.D.=.' ' 1 c c W.X.Y.Z.`.`.`.`.`. +.+++@+#+$+Q.d.R.%+B.&+*+=+=+",
+"-+;+-.' ;.2 c c >+,+'+)+P P P !+Q R ~+{+1.{.]+d.y.%+B.&+^+=+=+/+",
+"(+' ' ;.c X X _+:+<+P P P P !+R [+~+}+|+{.]+n.R.1+2+&+^+=+3+4+5+",
+"6+' ) ! ~ { { 7+8+P P P P !+R 9+#.{+{.w.]+y.z.S.&+0+=+=+3+4+a+b+",
+"c+d+7.! d 3 z e+f+P P P !+R 9+#.{+m.{.]+y.1+B.&+0+=+=+g+4+a+h+i+",
+"  j+c d 3 { 4 k+l+P P !+@.9+m+1.m.{.]+y.1+n+B.*+=+=+g+a+a+o+p+  ",
+"    q+r+{ s+m t+u+v+@.R w+{+}+{.x+d.y+z+n+B.0+=+=+g+A+a+B+C+    ",
+"      * D+E+E+  +.F+G+H+}+}+{.I+J+K+L+M+M+M+M+N+O+O+O+O+P+      ",
+"                ).).#.{+a.{.x+Q+R+                              ",
+"                #.m+1.a.{.x+y.o.2+B.S+=+=+T+U+O+                ",
+"                0.V+{.{.x+n.o.2+B.B.W+X+Y+Z+a+`+                ",
+"                 @{..@+@n.@@B.B.S+^+#@$@%@&@*@=@                ",
+"                ].-@x.y.o.%+;@S+=+=+>@,@'@)@!@~@                ",
+"                  {@z.z+2+U.=+=+=+T+]@^@/@(@_@                  ",
+"                    :@<@U.=+=+[@4+}@|@1@2@3@                    ",
+"                      4@5@6@7@8@a+a+9@0@a@                      "};
--- python2.7-2.7.3.orig/debian/mkbinfmt.py
+++ python2.7-2.7.3/debian/mkbinfmt.py
@@ -0,0 +1,17 @@
+# mkbinfmt.py
+import imp, sys, string, os.path
+
+magic = string.join(["\\x%.2x" % ord(c) for c in imp.get_magic()],"")
+
+name = sys.argv[1]
+ 
+binfmt = '''\
+package %s
+interpreter /usr/bin/%s
+magic %s\
+''' % (name, name, magic)
+
+#filename = '/usr/share/binfmts/' + name
+#open(filename,'w+').write(binfmt)
+
+print binfmt
--- python2.7-2.7.3.orig/debian/rules
+++ python2.7-2.7.3/debian/rules
@@ -0,0 +1,1136 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
+
+unexport LANG LC_ALL LC_CTYPE LC_COLLATE LC_TIME LC_NUMERIC LC_MESSAGES
+unexport CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
+
+export SHELL = /bin/bash
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+vafilt = $(subst $(2)=,,$(filter $(2)=%,$(1)))
+
+DPKG_VARS		:= $(shell dpkg-architecture)
+DEB_HOST_ARCH		?= $(call vafilt,$(DPKG_VARS),DEB_HOST_ARCH)
+DEB_HOST_ARCH_BITS	?= $(call vafilt,$(DPKG_VARS),DEB_HOST_ARCH_BITS)
+DEB_HOST_ARCH_OS	?= $(call vafilt,$(DPKG_VARS),DEB_HOST_ARCH_OS)
+
+changelog_values := $(shell dpkg-parsechangelog \
+			| awk '/^(Version|Source):/ {print $$2}')
+PKGSOURCE  := $(word 1, $(changelog_values))
+PKGVERSION := $(word 2, $(changelog_values))
+
+on_buildd := $(shell [ -f /CurrentlyBuilding -o "$$LOGNAME" = buildd ] && echo yes)
+
+ifneq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
+  WITHOUT_CHECK := yes
+endif
+WITHOUT_BENCH :=
+ifneq (,$(findstring nobench, $(DEB_BUILD_OPTIONS)))
+  WITHOUT_BENCH := yes
+endif
+ifneq (,$(filter $(DEB_HOST_ARCH), hurd-i386))
+  WITHOUT_BENCH := disabled on $(DEB_HOST_ARCH)
+endif
+ifeq ($(on_buildd),yes)
+  ifneq (,$(findstring $(DEB_HOST_ARCH), hppa mips mipsel s390))
+#    WITHOUT_CHECK := yes
+  endif
+endif
+ifneq (,$(filter $(DEB_HOST_ARCH), hurd-i386 kfreebsd-amd64 kfreebsd-i386))
+  WITHOUT_CHECK := yes
+endif
+
+COMMA = ,
+ifneq (,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS))))
+  NJOBS := -j $(subst parallel=,,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS))))
+endif
+
+distribution := $(shell lsb_release -is)
+#distribution := Ubuntu
+
+VER=2.7
+NVER=2.8
+PVER=python2.7
+PRIORITY=$(shell echo $(VER) | tr -d '.')0
+
+PREVVER	:= $(shell awk '/^python/ && NR > 1 {print substr($$2,2,length($$2)-2); exit}' debian/changelog)
+
+# default versions are built from the python-defaults source package
+# keep the definition to adjust package priorities.
+DEFAULT_VERSION = no
+STATIC_PYTHON=yes
+
+MIN_MODS := $(shell awk '/^  / && $$2 == "module" { print $$1 }' \
+		debian/PVER-minimal.README.Debian.in)
+MIN_EXTS := $(shell awk '/^  / && $$2 ~ /^extension/ { print $$1 }' \
+		debian/PVER-minimal.README.Debian.in)
+MIN_BUILTINS := $(shell awk '/^  / && $$2 == "builtin" { print $$1 }' \
+		debian/PVER-minimal.README.Debian.in)
+MIN_PACKAGES := $(shell awk '/^  / && $$2 == "package" { print $$1 }' \
+		debian/PVER-minimal.README.Debian.in)
+MIN_ENCODINGS := $(foreach i, \
+			$(filter-out \
+			  big5% bz2% cp932.py cp949.py cp950.py euc_% \
+			  gb% iso2022% johab.py shift_jis% , \
+			  $(shell cd Lib/encodings && echo *.py)), \
+			encodings/$(i)) \
+		 codecs.py stringprep.py
+
+with_tk := no
+with_gdbm := no
+with_interp := static
+#with_interp := shared
+
+PY_INTERPRETER = /usr/bin/python$(VER)
+
+ifeq ($(DEFAULT_VERSION),yes)
+  PY_PRIO = standard
+  #PYSTDDEP = , python (>= $(VER))
+  ifeq ($(distribution),Ubuntu)
+    PY_MINPRIO = required
+  else
+    PY_MINPRIO = $(PY_PRIO)
+  endif
+else
+  PY_PRIO = optional
+  PY_MINPRIO = $(PY_PRIO)
+endif
+with_fpectl = yes
+
+CC = gcc
+
+DPKG_CFLAGS  := $(shell dpkg-buildflags --get CPPFLAGS; dpkg-buildflags --get CFLAGS)
+DPKG_LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS)
+OPT_CFLAGS   := $(filter-out -O%,$(DPKG_CFLAGS)) # default is -O3
+DEBUG_CFLAGS := $(patsubst -O%,-O0,$(DPKG_CFLAGS))
+
+# on alpha, use -O2 only, use -mieee
+ifeq ($(DEB_HOST_ARCH),alpha)
+    OPT_CFLAGS += -mieee
+    DEBUG_CFLAGS += -mieee
+    EXTRA_OPT_FLAGS += -O2
+endif
+# issues with ia64 and m68k with -O3
+ifeq ($(DEB_HOST_ARCH),m68k)
+    EXTRA_OPT_FLAGS += -O2
+endif
+
+ifeq ($(DEB_HOST_ARCH_OS),linux)
+  ifneq (,$(findstring $(DEB_HOST_ARCH), amd64 armel armhf i386 powerpc ppc64))
+    with_pgo := yes
+  endif
+endif
+
+ifneq (,$(findstring $(DEB_HOST_ARCH), amd64 armel armhf i386))
+  with_lto := yes
+endif
+
+ifneq (,$(findstring noopt, $(DEB_BUILD_OPTIONS)))
+    OPT_CFLAGS := $(filter-out -O%, $(OPT_CFLAGS))
+    EXTRA_OPT_CFLAGS = -O0
+    with_pgo =
+    with_lto =
+endif
+
+ifeq ($(with_lto),yes)
+    LTO_CFLAGS = -g -flto -fuse-linker-plugin
+    EXTRA_OPT_CFLAGS += $(LTO_CFLAGS)
+endif
+
+make_build_target = $(if $(with_pgo),profile-opt)
+
+buildd_static	:= $(CURDIR)/build-static
+buildd_shared	:= $(CURDIR)/build-shared
+buildd_debug	:= $(CURDIR)/build-debug
+buildd_shdebug	:= $(CURDIR)/build-shdebug
+
+d		:= debian/tmp
+scriptdir	=  usr/share/lib/python$(VER)
+scriptdir	=  usr/share/python$(VER)
+scriptdir	=  usr/lib/python$(VER)
+
+# package names and directories
+p_base	:= $(PVER)
+p_min	:= $(PVER)-minimal
+p_lib	:= lib$(PVER)
+p_tk	:= $(PVER)-tk
+p_gdbm	:= $(PVER)-gdbm
+p_dev	:= $(PVER)-dev
+p_exam	:= $(PVER)-examples
+p_idle	:= idle-$(PVER)
+p_doc	:= $(PVER)-doc
+p_dbg	:= $(PVER)-dbg
+
+d_base	:= debian/$(p_base)
+d_min	:= debian/$(p_min)
+d_lib	:= debian/$(p_lib)
+d_tk	:= debian/$(p_tk)
+d_gdbm	:= debian/$(p_gdbm)
+d_dev	:= debian/$(p_dev)
+d_exam	:= debian/$(p_exam)
+d_idle	:= debian/$(p_idle)
+d_doc	:= debian/$(p_doc)
+d_dbg	:= debian/$(p_dbg)
+
+build-arch: stamps/stamp-build
+build-indep: stamps/stamp-build-doc
+build: build-arch
+stamps/stamp-build: stamps/stamp-build-static stamps/stamp-mincheck \
+    stamps/stamp-build-shared stamps/stamp-build-debug \
+    stamps/stamp-build-shared-debug \
+    stamps/stamp-check stamps/stamp-pystone stamps/stamp-pybench
+	touch $@
+
+PROFILE_EXCLUDES = test_compiler test_distutils test_platform test_subprocess \
+	test_multiprocessing test_cprofile \
+	test_thread test_threaded_import test_threadedtempfile \
+	test_socketserver \
+	test_threading test_threading_local test_threadsignals \
+	test_dbm_dumb test_dbm_ndbm test_pydoc test_sundry test_gdb \
+
+ifneq (,$(filter $(DEB_HOST_ARCH), arm armel))
+  PROFILE_EXCLUDES += test_float
+endif
+ifneq (,$(filter $(DEB_HOST_ARCH), kfreebsd-amd64 kfreebsd-i386))
+  PROFILE_EXCLUDES += test_io
+endif
+PROFILE_EXCLUDES += test_zipfile
+PROFILE_EXCLUDES += test_xmlrpc
+PROFILE_EXCLUDES += test_bsddb3
+
+PROFILE_TASK = ../Lib/test/regrtest.py \
+	-x $(sort $(TEST_EXCLUDES) $(PROFILE_EXCLUDES))
+
+stamps/stamp-build-static: stamps/stamp-configure-static
+	dh_testdir
+	$(MAKE) $(NJOBS) -C $(buildd_static) \
+		EXTRA_CFLAGS="$(EXTRA_OPT_CFLAGS)" \
+		PROFILE_TASK='$(PROFILE_TASK)' $(make_build_target)
+	touch stamps/stamp-build-static
+
+stamps/stamp-build-shared: stamps/stamp-configure-shared
+	dh_testdir
+	$(MAKE) $(NJOBS) -C $(buildd_shared) \
+		EXTRA_CFLAGS="$(EXTRA_OPT_CFLAGS)"
+#	: # build the shared library
+#	$(MAKE) $(NJOBS) -C $(buildd_shared) \
+#		libpython$(VER).so
+	: # build a static library with PIC objects
+	$(MAKE) $(NJOBS) -C $(buildd_shared) \
+		EXTRA_CFLAGS="$(EXTRA_OPT_CFLAGS)" \
+		LIBRARY=libpython$(VER)-pic.a libpython$(VER)-pic.a
+	touch stamps/stamp-build-shared
+
+stamps/stamp-build-debug: stamps/stamp-configure-debug
+	dh_testdir
+	$(MAKE) $(NJOBS) -C $(buildd_debug) \
+		EXTRA_CFLAGS="$(DEBUG_CFLAGS)"
+	touch stamps/stamp-build-debug
+
+stamps/stamp-build-shared-debug: stamps/stamp-configure-shared-debug
+	dh_testdir
+	: # build the shared debug library
+	$(MAKE) $(NJOBS) -C $(buildd_shdebug) \
+		EXTRA_CFLAGS="$(DEBUG_CFLAGS)" \
+		libpython$(VER)_d.so
+	touch stamps/stamp-build-shared-debug
+
+common_configure_args = \
+		--prefix=/usr \
+		--enable-ipv6 \
+		--enable-unicode=ucs4 \
+		--with-dbmliborder=bdb:gdbm \
+		--with-system-expat
+
+ifeq ($(DEB_HOST_ARCH), avr32)
+  common_configure_args += --without-ffi
+else
+  common_configure_args += --with-system-ffi
+endif
+
+ifeq ($(with_fpectl),yes)
+  common_configure_args += \
+		--with-fpectl
+endif
+
+stamps/stamp-configure-shared: stamps/stamp-patch
+	rm -rf $(buildd_shared)
+	mkdir -p $(buildd_shared)
+	cd $(buildd_shared) && \
+	  CC="$(CC)" CFLAGS="$(OPT_CFLAGS)" LDFLAGS="$(DPKG_LDFLAGS)" \
+	    ../configure \
+		--enable-shared \
+		$(common_configure_args)
+
+	$(call __post_configure,$(buildd_shared))
+
+	touch stamps/stamp-configure-shared
+
+stamps/stamp-configure-static: stamps/stamp-patch
+	rm -rf $(buildd_static)
+	mkdir -p $(buildd_static)
+	cd $(buildd_static) && \
+	  CC="$(CC)" CFLAGS="$(OPT_CFLAGS)" LDFLAGS="$(DPKG_LDFLAGS)" \
+	    ../configure \
+		$(common_configure_args)
+
+	$(call __post_configure,$(buildd_static))
+
+	touch stamps/stamp-configure-static
+
+stamps/stamp-configure-debug: stamps/stamp-patch
+	rm -rf $(buildd_debug)
+	mkdir -p $(buildd_debug)
+	cd $(buildd_debug) && \
+	  CC="$(CC)" CFLAGS="$(DEBUG_CFLAGS)" LDFLAGS="$(DPKG_LDFLAGS)" \
+	    ../configure \
+		$(common_configure_args) \
+		--with-pydebug
+
+	$(call __post_configure,$(buildd_debug))
+
+	touch stamps/stamp-configure-debug
+
+stamps/stamp-configure-shared-debug: stamps/stamp-patch
+	rm -rf $(buildd_shdebug)
+	mkdir -p $(buildd_shdebug)
+	cd $(buildd_shdebug) && \
+	  CC="$(CC)" CFLAGS="$(DEBUG_CFLAGS)" LDFLAGS="$(DPKG_LDFLAGS)" \
+	    ../configure \
+		$(common_configure_args) \
+		--enable-shared \
+		--with-pydebug
+
+	$(call __post_configure,$(buildd_shdebug))
+
+	touch stamps/stamp-configure-shared-debug
+
+define __post_configure
+	egrep \
+	  "^#($$(awk -v ORS='|' '$$2 ~ /^extension$$/ {print $$1}' debian/PVER-minimal.README.Debian.in)XX)" \
+	  Modules/Setup.dist \
+	    | sed -e 's/^#//' -e 's/-Wl,-Bdynamic//;s/-Wl,-Bstatic//' \
+	    >> $(1)/Modules/Setup.local
+
+	: # unconditionally run makesetup
+	cd $(1) && \
+	  ../Modules/makesetup -c ../Modules/config.c.in -s Modules \
+	    Modules/Setup.config Modules/Setup.local Modules/Setup
+	mv $(1)/config.c $(1)/Modules/
+
+	: # and fix the timestamps
+	$(MAKE) -C $(1) Makefile Modules/config.c
+
+	: # apply workaround for missing os.fsync
+	sed 's/HAVE_SYNC/HAVE_FSYNC/g' $(1)/pyconfig.h \
+		> $(1)/pyconfig.h.new
+	touch -r $(1)/pyconfig.h $(1)/pyconfig.h.new
+	mv -f $(1)/pyconfig.h.new $(1)/pyconfig.h
+endef
+
+stamps/stamp-mincheck: stamps/stamp-build-static debian/PVER-minimal.README.Debian.in
+	for m in $(MIN_MODS) $(MIN_PACKAGES) $(MIN_EXTS) $(MIN_BUILTINS); do \
+	  echo "import $$m"; \
+	done > $(buildd_static)/minmods.py
+	cd $(buildd_static) && ./python ../debian/pymindeps.py minmods.py \
+	  > $(buildd_static)/mindeps.txt
+	if [ -x /usr/bin/dot ]; then \
+	  python debian/depgraph.py < $(buildd_static)/mindeps.txt \
+	    > $(buildd_static)/mindeps.dot; \
+	  dot -Tpng -o $(buildd_static)/mindeps.png \
+	    $(buildd_static)/mindeps.dot; \
+	else true; fi
+	cd $(buildd_static) && ./python ../debian/mincheck.py \
+		minmods.py mindeps.txt
+	touch stamps/stamp-mincheck
+
+TEST_RESOURCES = all
+ifeq ($(on_buildd),yes)
+  TEST_RESOURCES := $(TEST_RESOURCES),-network,-urlfetch
+endif
+TESTOPTS = -w -l -u$(TEST_RESOURCES)
+TEST_EXCLUDES =
+ifeq ($(on_buildd),yes)
+  TEST_EXCLUDES += test_codecmaps_cn test_codecmaps_hk \
+        test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw \
+        test_normalization test_ossaudiodev
+  ifneq (,$(filter $(DEB_HOST_ARCH), mips mipsel powerpc kfreebsd-i386 sparc))
+    TEST_EXCLUDES += test_threading
+  endif
+  ifeq (,$(wildcard $(HOME)))
+    TEST_EXCLUDES += test_site
+  endif
+endif
+ifeq (,$(wildcard /dev/dsp))
+  TEST_EXCLUDES += test_linuxaudiodev test_ossaudiodev
+endif
+ifneq (,$(filter $(DEB_HOST_ARCH), armel hppa powerpc))
+  TEST_EXCLUDES += test_multiprocessing
+endif
+ifneq (,$(filter $(DEB_HOST_ARCH), hppa))
+  TEST_EXCLUDES += test_fork1 test_socketserver test_threading test_wait3 test_wait4 test_gdb
+endif
+ifneq (,$(filter $(DEB_HOST_ARCH), arm avr32))
+  TEST_EXCLUDES += test_ctypes
+endif
+ifneq (,$(filter $(DEB_HOST_ARCH), m68k avr32 kfreebsd-amd64 kfreebsd-i386))
+  TEST_EXCLUDES += test_bsddb3
+endif
+ifneq (,$(filter $(DEB_HOST_ARCH), arm armel avr32 m68k))
+  ifeq ($(on_buildd),yes)
+    TEST_EXCLUDES += test_compiler
+  endif
+endif
+TEST_EXCLUDES += test_gdb
+# fails on some buildds
+ifneq (,$(filter $(DEB_HOST_ARCH), amd64))
+  TEST_EXCLUDES += test_io
+endif
+ifneq (,$(filter $(DEB_HOST_ARCH), kfreebsd-amd64 kfreebsd-i386))
+  TEST_EXCLUDES += test_io test_signal
+endif
+ifneq (,$(filter $(DEB_HOST_ARCH), hurd-i386))
+  TEST_EXCLUDES += test_io test_random test_signal test_socket test_socketserver test_ssl \
+	test_threading test_subprocess
+endif
+ifneq (,$(filter $(DEB_HOST_ARCH), ia64))
+  TEST_EXCLUDES += test_threading test_subprocess
+endif
+ifneq (,$(TEST_EXCLUDES))
+  TESTOPTS += -x $(sort $(TEST_EXCLUDES))
+  ifneq (,$(filter $(DEB_HOST_ARCH), mips mipsel))
+    TESTOPTS_DEBUG := $(TESTOPTS)
+  else
+    TESTOPTS_DEBUG := $(filter-out test_gdb,$(TESTOPTS))
+  endif
+endif
+
+ifneq (,$(wildcard /usr/bin/localedef))
+  SET_LOCPATH = LOCPATH=$(CURDIR)/locales
+endif
+
+stamps/stamp-check:
+ifeq ($(WITHOUT_CHECK),yes)
+	echo "check run disabled for this build" > $(buildd_static)/test_results
+else
+	: # build locales needed by the testsuite
+	rm -rf locales
+	mkdir locales
+	if which localedef >/dev/null 2>&1; then \
+	  sh debian/locale-gen; \
+	fi
+
+	@echo ========== test environment ============
+	@env
+	@echo ========================================
+  ifeq (,$(findstring $(DEB_HOST_ARCH), alpha))
+	( \
+	  echo '#! /bin/sh'; \
+	  echo 'set -x'; \
+	  echo 'export TERM=$${TERM:-dumb}'; \
+	  echo '$(buildd_static)/python $(CURDIR)/debian/script.py test_results '\''make test TESTOPTS="$(TESTOPTS_DEBUG)"'\'; \
+	  echo 'echo DONE'; \
+	) > $(buildd_debug)/run_tests
+	chmod 755 $(buildd_debug)/run_tests
+	@echo "BEGIN test debug"
+	-cd $(buildd_debug) && time xvfb-run -a -e xvfb-run.log ./run_tests
+	@echo "END test debug"
+  endif
+
+	( \
+	  echo '#! /bin/sh'; \
+	  echo 'set -x'; \
+	  echo 'export TERM=$${TERM:-dumb}'; \
+	  echo 'export $(SET_LOCPATH)'; \
+	  echo '$(buildd_static)/python $(CURDIR)/debian/script.py test_results '\''make test EXTRA_CFLAGS="$(EXTRA_OPT_CFLAGS)" TESTOPTS="$(TESTOPTS)"'\'; \
+	  echo 'echo DONE'; \
+	) > $(buildd_static)/run_tests
+	chmod 755 $(buildd_static)/run_tests
+	@echo "BEGIN test static"
+	-cd $(buildd_static) && time xvfb-run -a -e xvfb-run.log ./run_tests
+	@echo "END test static"
+
+	( \
+	  echo '#! /bin/sh'; \
+	  echo 'set -x'; \
+	  echo 'export TERM=$${TERM:-dumb}'; \
+	  echo 'export $(SET_LOCPATH)'; \
+	  echo '$(buildd_static)/python $(CURDIR)/debian/script.py test_results '\''make test EXTRA_CFLAGS="$(EXTRA_OPT_CFLAGS)" TESTOPTS="$(TESTOPTS)"'\'; \
+	  echo 'echo DONE'; \
+	) > $(buildd_shared)/run_tests
+	chmod 755 $(buildd_shared)/run_tests
+	@echo "BEGIN test shared"
+	-cd $(buildd_shared) && time xvfb-run -a -e xvfb-run.log ./run_tests
+	@echo "END test shared"
+endif
+	cp -p $(buildd_static)/test_results debian/
+	touch stamps/stamp-check
+
+stamps/stamp-pystone:
+	@echo "BEGIN pystone static"
+	cd $(buildd_static) && ./python ../Lib/test/pystone.py
+	cd $(buildd_static) && ./python ../Lib/test/pystone.py
+	@echo "END pystone static"
+	@echo "BEGIN pystone shared"
+	cd $(buildd_shared) \
+		&& LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}. ./python ../Lib/test/pystone.py
+	cd $(buildd_shared) \
+		&& LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}. ./python ../Lib/test/pystone.py
+	@echo "END pystone shared"
+	@echo "BEGIN pystone debug"
+	cd $(buildd_debug) && ./python ../Lib/test/pystone.py
+	cd $(buildd_debug) && ./python ../Lib/test/pystone.py
+	@echo "END pystone debug"
+	touch stamps/stamp-pystone
+
+#ifeq (,$(filter $(DEB_HOST_ARCH), arm armel avr32 hppa mips mipsel m68k))
+  pybench_options = -C 2 -n 5 -w 4
+#endif
+
+stamps/stamp-pybench:
+ifeq ($(WITHOUT_BENCH),yes)
+	echo "pybench run disabled for this build" > $(buildd_static)/pybench.log
+else
+	@echo "BEGIN pybench static"
+	cd $(buildd_static) \
+	  && time ./python ../Tools/pybench/pybench.py -f run1.pybench $(pybench_options)
+	cd $(buildd_static) \
+	  && ./python ../Tools/pybench/pybench.py -f run2.pybench -c run1.pybench $(pybench_options)
+	@echo "END pybench static"
+	@echo "BEGIN pybench shared"
+	cd $(buildd_shared) \
+	  && LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}. \
+		./python ../Tools/pybench/pybench.py -f run1.pybench $(pybench_options)
+	cd $(buildd_shared) \
+	  && LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}. \
+		./python ../Tools/pybench/pybench.py -f run2.pybench -c run1.pybench $(pybench_options)
+	@echo "END pybench shared"
+	@echo "BEGIN shared/static comparision"
+	$(buildd_static)/python Tools/pybench/pybench.py \
+	  -s $(buildd_static)/run2.pybench -c $(buildd_shared)/run2.pybench \
+	  | tee $(buildd_static)/pybench.log
+	@echo "END shared/static comparision"
+endif
+	touch stamps/stamp-pybench
+
+minimal-test:
+	rm -rf mintest
+	mkdir -p mintest/lib mintest/dynlib mintest/testlib mintest/all-lib
+	cp -p $(buildd_static)/python mintest/
+	cp -p $(foreach i,$(MIN_MODS),Lib/$(i).py) \
+		mintest/lib/
+	cp -a $(foreach i,$(MIN_PACKAGES),Lib/$(i)) \
+		mintest/lib/
+	cp -p $(wildcard $(foreach i,$(MIN_EXTS),$(buildd_static)/build/lib*/$(i).*.so)) \
+		mintest/dynlib/
+	cp -p Lib/unittest.py mintest/lib/
+	cp -pr Lib/test mintest/lib/
+	cp -pr Lib mintest/all-lib
+	cp -p $(buildd_static)/build/lib*/*.so mintest/all-lib/
+	( \
+	  echo "import sys"; \
+	  echo "sys.path = ["; \
+	  echo "    '$(CURDIR)/mintest/lib',"; \
+	  echo "    '$(CURDIR)/mintest/dynlib',"; \
+	  echo "]"; \
+	  cat Lib/test/regrtest.py; \
+	) > mintest/lib/test/mintest.py
+	cd mintest && ./python -E -S lib/test/mintest.py \
+	     -x test_codecencodings_cn test_codecencodings_hk \
+		test_codecencodings_jp test_codecencodings_kr \
+		test_codecencodings_tw test_codecs test_multibytecodec \
+
+stamps/stamp-doc-html:
+	dh_testdir
+	$(MAKE) -C Doc html
+	touch stamps/stamp-doc-html
+
+build-doc: stamps/stamp-patch stamps/stamp-build-doc
+stamps/stamp-build-doc: stamps/stamp-doc-html
+	touch stamps/stamp-build-doc
+
+control-file:
+	sed -e "s/@PVER@/$(PVER)/g" \
+	    -e "s/@VER@/$(VER)/g" \
+	    -e "s/@PYSTDDEP@/$(PYSTDDEP)/g" \
+	    -e "s/@PRIO@/$(PY_PRIO)/g" \
+	    -e "s/@MINPRIO@/$(PY_MINPRIO)/g" \
+		debian/control.in > debian/control.tmp
+ifeq ($(distribution),Ubuntu)
+  ifneq (,$(findstring ubuntu, $(PKGVERSION)))
+	m='Ubuntu Core Developers <ubuntu-devel-discuss@lists.ubuntu.com>'; \
+	sed -i "/^Maintainer:/s/\(.*\)/Maintainer: $$m\nXSBC-Original-\1/" \
+	  debian/control.tmp
+  endif
+endif
+	[ -e debian/control ] \
+	  && cmp -s debian/control debian/control.tmp \
+	  && rm -f debian/control.tmp && exit 0; \
+	  mv debian/control.tmp debian/control
+
+
+
+clean: control-file
+	dh_testdir
+	dh_testroot
+	$(MAKE) -f debian/rules unpatch
+	rm -rf stamps .pc
+	rm -f debian/test_results
+
+	$(MAKE) -C Doc clean
+	sed 's/^@/#/' Makefile.pre.in | $(MAKE) -f - srcdir=. distclean
+	rm -rf Lib/test/db_home
+	rm -rf $(buildd_static) $(buildd_shared) $(buildd_debug) $(buildd_shdebug)
+	find -name '*.py[co]' | xargs -r rm -f
+	rm -f Lib/lib2to3/*.pickle
+	rm -rf locales
+	rm -rf $(d)-dbg
+
+	for f in debian/*.in; do \
+	  f2=`echo $$f | sed "s,PVER,$(PVER),g;s/@VER@/$(VER)/g;s,\.in$$,,"`; \
+	  if [ $$f2 != debian/control ] && [ $$f2 != debian/source.lintian-overrides ]; then \
+	    rm -f $$f2; \
+	  fi; \
+	done
+	dh_clean
+
+stamps/stamp-control:
+	: # We have to prepare the various control files
+
+	for f in debian/*.in; do \
+	  f2=`echo $$f | sed "s,PVER,$(PVER),g;s/@VER@/$(VER)/g;s,\.in$$,,"`; \
+	  if [ $$f2 != debian/control ]; then \
+	    sed -e "s/@PVER@/$(PVER)/g;s/@VER@/$(VER)/g" \
+		    -e "s/@PRIORITY@/$(PRIORITY)/g" \
+		    -e "s,@SCRIPTDIR@,/$(scriptdir),g" \
+		    -e "s,@INFO@,$(info_docs),g" \
+		  <$$f >$$f2; \
+	  fi; \
+	done
+ifeq ($(DEB_HOST_ARCH_BITS),64)
+	sed -i 's/\(Py_InitModule4[^@]*\)@/\1_64@/' \
+		debian/lib$(PVER).symbols debian/$(PVER)-dbg.symbols
+endif
+
+2to3-man:
+	help2man --no-info --version-string=$(VER) --no-discard-stderr \
+	  --name 'Python2 to Python3 converter' \
+	  2to3-$(VER) > debian/2to3-$(VER).1
+
+install: build-arch stamps/stamp-install
+stamps/stamp-install: stamps/stamp-build control-file stamps/stamp-control
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+	dh_installdirs
+
+	: # make install into tmp and subsequently move the files into
+	: # their packages' directories.
+	install -d $(d)/usr
+ifeq ($(with_interp),static)
+	$(MAKE) -C $(buildd_static) install prefix=$(CURDIR)/$(d)/usr
+else
+	$(MAKE) -C $(buildd_shared) install prefix=$(CURDIR)/$(d)/usr
+endif
+	mv $(d)/$(scriptdir)/_sysconfigdata.py \
+		$(d)/$(scriptdir)/_sysconfigdata_nd.py
+	sed -i 's/ -O3 / -O2 /g;s/$(LTO_CFLAGS)//g' \
+		$(d)/$(scriptdir)/_sysconfigdata_nd.py
+	cp -p debian/_sysconfigdata.py $(d)/$(scriptdir)/
+
+	-find $(d)/usr/lib/python$(VER) -name '*_failed*.so'
+	find $(d)/usr/lib/python$(VER) -name '*_failed*.so' | xargs -r rm -f
+
+	test -f $(d)/usr/lib/python$(VER)/lib-dynload/_bsddb.so
+
+	mv $(d)/usr/lib/python$(VER)/site-packages \
+		$(d)/usr/lib/python$(VER)/dist-packages
+
+	: # remove files, which are not packaged
+	rm -f $(d)/usr/bin/smtpd.py
+	rm -rf $(d)/usr/lib/python$(VER)/ctypes/macholib
+	rm -f $(d)/usr/lib/pkgconfig/python.pc
+	rm -f $(d)/usr/lib/pkgconfig/python2.pc
+	rm -f $(d)/usr/bin/python2{,-config}
+	rm -f $(d)/usr/share/man/man1/python2{,-config}.1
+
+	: # cannot build it, zlib maintainer won't provide a mingw build
+	find $(d) -name 'wininst*.exe' | xargs -r rm -f
+
+	: # fix some file permissions
+	chmod a-x $(d)/$(scriptdir)/{fractions,lib-tk/Tix}.py
+
+	: # move manpages to new names
+	if [ -d $(d)/usr/man/man1 ]; then \
+	    mkdir -p $(d)/usr/share/man; \
+	    mv $(d)/usr/man/man1/* $(d)/usr/share/man/man1/; \
+	    rm -rf $(d)/usr/man/; \
+	fi
+	cp -p debian/pydoc.1 $(d)/usr/share/man/man1/pydoc$(VER).1
+
+	: # Symlinks to /usr/bin for some tools
+	ln -sf ../lib/python$(VER)/pdb.py $(d)/usr/bin/pdb$(VER)
+	cp -p debian/pdb.1 $(d)/usr/share/man/man1/pdb$(VER).1
+
+	: # versioned install only
+	rm -f $(d)/usr/bin/python-config
+
+	mv $(d)/usr/bin/2to3 $(d)/usr/bin/2to3-$(VER)
+	cp debian/2to3-$(VER).1 $(d)/usr/share/man/man1/2to3-$(VER).1
+
+#	: # remove the bsddb stuff
+#	rm -rf $(d)/$(scriptdir)/bsddb
+#	rm -f $(d)/$(scriptdir)/lib-dynload/_bsddb.so
+
+	: # Remove version information from the egg-info file
+	mv $(d)/$(scriptdir)/lib-dynload/Python-$(VER)*.egg-info \
+		$(d)/$(scriptdir)/lib-dynload/Python-$(VER).egg-info
+
+	dh_installdirs -p$(p_lib) \
+		$(scriptdir)/config \
+		usr/share/doc
+	: # install the shared library
+	cp -p $(buildd_shared)/libpython$(VER).so.1.0 $(d_lib)/usr/lib/
+	ln -sf libpython$(VER).so.1.0 $(d_lib)/usr/lib/libpython$(VER).so.1
+	ln -sf ../../libpython$(VER).so.1 \
+		$(d_lib)/$(scriptdir)/config/libpython$(VER).so
+	ln -sf $(p_base) $(d_lib)/usr/share/doc/$(p_lib)
+
+	ln -sf libpython$(VER).so.1 $(d)/usr/lib/libpython$(VER).so
+
+ifeq ($(with_interp),shared)
+	: # install the statically linked runtime
+	install -m755 $(buildd_static)/python $(d)/usr/bin/python$(VER)-static
+endif
+
+	mv $(d)/usr/bin/pydoc $(d)/usr/bin/pydoc$(VER)
+	cp -p Tools/i18n/pygettext.py $(d)/usr/bin/pygettext$(VER)
+	cp -p debian/pygettext.1 $(d)/usr/share/man/man1/pygettext$(VER).1
+
+	: # install the Makefile of the shared python build
+	sed -e '/^OPT/s,-O3,-O2,' \
+	    -e 's/$(LTO_CFLAGS)//g' \
+	    -e 's,^RUNSHARED *=.*,RUNSHARED=,' \
+		build-shared/Makefile > $(d)/$(scriptdir)/config/Makefile
+
+	: # Move the binary and the minimal libraries into $(p_min).
+	dh_installdirs -p$(p_min) \
+		etc/$(PVER) \
+		usr/bin \
+		usr/include/$(PVER) \
+		usr/share/man/man1 \
+		$(scriptdir)/lib-dynload \
+		$(scriptdir)/config
+	DH_COMPAT=2 dh_movefiles -p$(p_min) --sourcedir=$(d) \
+		usr/bin/python$(VER) \
+		usr/share/man/man1/python$(VER).1 \
+		$(foreach i,$(MIN_MODS),$(scriptdir)/$(i).py) \
+		$(foreach i,$(MIN_PACKAGES),$(scriptdir)/$(i)) \
+		$(foreach i,$(MIN_ENCODINGS),$(scriptdir)/$(i)) \
+		$(scriptdir)/config/Makefile \
+		usr/include/$(PVER)/pyconfig.h \
+		$(scriptdir)/site.py \
+		$$( cd $(d); for i in $(MIN_EXTS); do \
+			test -e $(scriptdir)/lib-dynload/$$i.so \
+			  && echo $(scriptdir)/lib-dynload/$$i.so; \
+		  done; true)
+
+	: # Install sitecustomize.py.
+	cp -p debian/sitecustomize.py $(d_min)/etc/$(PVER)/
+	patch --no-backup -d $(d_min)/$(scriptdir) < debian/patches/site-builddir.diff
+	dh_link -p$(p_min) /etc/$(PVER)/sitecustomize.py \
+		/$(scriptdir)/sitecustomize.py
+
+	: # Move the static library and the header files into $(p_dev).
+#	mv $(d)/usr/share/include/python$(VER)/* $(d)/usr/include/python$(VER)/.
+#	rm -rf $(d)/usr/share/include
+	dh_installdirs -p$(p_dev) \
+		usr/share/doc/python$(VER) \
+		$(scriptdir) \
+		$(scriptdir)/doc/html \
+		usr/include \
+		usr/share/man/man1 \
+		usr/lib
+	cp -p Misc/HISTORY Misc/README.valgrind Misc/gdbinit \
+		debian/README.maintainers \
+		debian/test_results $(buildd_static)/pybench.log \
+	    $(d_dev)/usr/share/doc/python$(VER)/
+
+	DH_COMPAT=2 dh_movefiles -p$(p_dev) --sourcedir=$(d) \
+		usr/lib/python$(VER)/config \
+		usr/include/python$(VER) \
+		usr/lib/libpython$(VER).so \
+		usr/lib/libpython$(VER).a \
+		usr/lib/pkgconfig/python-$(VER).pc \
+		usr/bin/python$(VER)-config \
+		usr/lib/python$(VER)/distutils/command/wininst-*.exe
+
+	ln -sf $(PVER)/config/libpython$(VER).a \
+		$(d_dev)/usr/lib/libpython$(VER).a
+
+	cp -p debian/python-config.1 \
+		$(d_dev)/usr/share/man/man1/python$(VER)-config.1
+	cp -p $(buildd_shared)/libpython$(VER)-pic.a \
+		$(d_dev)/usr/lib/python$(VER)/config/
+
+ifeq ($(with_tk),yes)
+	: # Move the Tkinter files into $(p_tk).
+	dh_installdirs -p$(p_tk) \
+		$(scriptdir) \
+		usr/lib/python$(VER)/lib-dynload
+	DH_COMPAT=2 dh_movefiles -p$(p_tk) --sourcedir=$(d) \
+		usr/lib/python$(VER)/lib-dynload/_tkinter.so
+endif
+
+ifeq ($(with_gdbm),yes)
+	: # gdbm and dbm modules into $(p_gdbm).
+	dh_installdirs -p$(p_gdbm) \
+		usr/lib/python$(VER)/lib-dynload
+	DH_COMPAT=2 dh_movefiles -p$(p_gdbm) --sourcedir=$(d) \
+		usr/lib/python$(VER)/lib-dynload/gdbm.so
+endif
+
+#	: # The test framework into $(p_base), regression tests dropped
+	DH_COMPAT=2 dh_movefiles -p$(p_base) --sourcedir=$(d) \
+		$(scriptdir)/test/{regrtest.py,test_support.py,__init__.py,pystone.py}
+	rm -rf $(d)/$(scriptdir)/test
+	rm -rf $(d)/$(scriptdir)/ctypes/test
+	rm -rf $(d)/$(scriptdir)/bsddb/test
+	rm -rf $(d)/$(scriptdir)/email/test
+	rm -rf $(d)/$(scriptdir)/json/tests
+	rm -rf $(d)/$(scriptdir)/sqlite3/test
+	rm -rf $(d)/$(scriptdir)/distutils/tests
+	rm -rf $(d)/$(scriptdir)/lib2to3/tests
+	rm -rf $(d)/$(scriptdir)/unittest/test
+	rm -rf $(d)/$(scriptdir)/lib-tk/test
+
+	: # IDLE
+	mv $(d)/usr/bin/idle $(d)/usr/bin/idle-python$(VER)
+	rm -f $(d)/usr/lib/python$(VER)/idlelib/idle.bat
+	dh_installdirs -p$(p_idle) \
+		usr/bin \
+		usr/share/man/man1
+	DH_COMPAT=2 dh_movefiles -p$(p_idle) --sourcedir=$(d) \
+		usr/lib/python$(VER)/idlelib \
+		usr/bin/idle-python$(VER)
+	cp -p debian/idle-$(PVER).1 $(d_idle)/usr/share/man/man1/
+
+	: # Move the demos and tools into $(p_exam)'s doc directory
+	dh_installdirs -p$(p_exam) \
+		usr/share/doc/python$(VER)/examples
+
+	cp -rp Demo Tools $(d_exam)/usr/share/doc/python$(VER)/examples/
+	rm -rf $(d_exam)/usr/share/doc/python$(VER)/examples/Demo/sgi
+	: # IDLE is in its own package:
+	rm -rf $(d_exam)/usr/share/doc/python$(VER)/examples/Tools/idle
+	: # XXX: We don't need rgb.txt, we'll use our own:
+	rm -rf $(d_exam)/usr/share/doc/python$(VER)/examples/Tools/pynche/X
+
+	: # XXX: Some files in upstream Demo and Tools have strange
+	: # exec permissions, make lintian glad:
+	-chmod 644 $(d_tk)/$(scriptdir)/lib-tk/Tix.py
+	-chmod 644 $(d)/$(scriptdir)/runpy.py
+
+	cd $(d_exam)/usr/share/doc/python$(VER)/examples && chmod 644 \
+	  Demo/{classes/*.py*,comparisons/patterns} \
+	  Demo/{rpc/test,threads/*.py*,md5test/*} \
+	  Demo/pdist/{client.py,cmdfw.py,cmptree.py,cvslib.py,cvslock.py,FSProxy.py,mac.py,rcsclient.py,rcslib.py,security.py,server.py,sumtree.py} \
+	  Demo/scripts/{morse.py,newslist.doc} \
+	  Demo/sockets/{broadcast.py,ftp.py,mcast.py,radio.py} \
+	  Demo/tix/{bitmaps/{tix.gif,*x[pb]m*},samples/*.py} \
+	  Demo/tkinter/guido/{AttrDialog.py,hanoi.py,hello.py,imagedraw.py,imageview.py,listtree.py,ManPage.py,ShellWindow.py,wish.py} \
+	  Tools/scripts/pydocgui.pyw \
+	  Tools/scripts/mailerdaemon.py
+
+	: # Replace all '#!' calls to python with $(PY_INTERPRETER)
+	: # and make them executable
+	for i in `find debian -mindepth 3 -type f ! -name '*.dpatch'`; do \
+	  sed '1s,#!.*python[^ ]*\(.*\),#! $(PY_INTERPRETER)\1,' \
+		$$i > $$i.temp; \
+	  if cmp --quiet $$i $$i.temp; then \
+	    rm -f $$i.temp; \
+	  else \
+	    mv -f $$i.temp $$i; \
+	    chmod 755 $$i; \
+	    echo "fixed interpreter: $$i"; \
+	  fi; \
+	done
+
+	: # Move the docs into $(p_base)'s /usr/share/doc/$(PVER) directory,
+	: # all other packages only have a copyright file.
+	dh_installdocs -p$(p_base) \
+		README Misc/NEWS Misc/ACKS
+	ln -sf NEWS.gz $(d_base)/usr/share/doc/$(p_base)/changelog.gz
+	dh_installdocs --all -N$(p_base) -N$(p_dev) -N$(p_dbg) -N$(p_lib) debian/README.Debian
+
+	: # IDLE has its own changelogs, docs...
+	dh_installchangelogs -p$(p_idle) Lib/idlelib/ChangeLog
+	dh_installdocs -p$(p_idle) Lib/idlelib/{NEWS,README,TODO,extend}.txt
+
+	mkdir -p $(d_idle)/usr/share/applications
+	cp -p debian/idle.desktop \
+		$(d_idle)/usr/share/applications/idle-$(PVER).desktop
+
+	: # those packages have own README.Debian's
+	install -m 644 -p debian/README.$(p_base) \
+		$(d_base)/usr/share/doc/$(PVER)/README.Debian
+	install -m 644 -p debian/README.$(p_idle) \
+		$(d_idle)/usr/share/doc/$(p_idle)/README.Debian
+ifeq ($(with_tk),yes)
+	cp -p debian/README.Tk $(d_tk)/usr/share/doc/$(p_tk)/
+endif
+
+	: # The rest goes into $(p_base)
+	mkdir -p $(d)/usr/lib/python$(VER)/dist-packages
+	(cd $(d) && tar cf - .) | (cd $(d_base) && tar xpf -)
+	sh debian/dh_rmemptydirs -p$(p_base)
+	rm -f $(d_base)/usr/bin/python
+
+	: # install egg-info for arparse
+	install -m 644 debian/argparse.egg-info $(d_base)/$(scriptdir)/
+
+	: # Install menu icon
+	dh_installdirs -p$(p_base) usr/share/pixmaps
+	cp -p debian/pylogo.xpm $(d_base)/usr/share/pixmaps/$(PVER).xpm
+
+	: # generate binfmt file
+	mkdir -p $(d_min)/usr/share/binfmts
+	$(buildd_static)/python debian/mkbinfmt.py $(PVER) \
+		> $(d_min)/usr/share/binfmts/$(PVER)
+
+	: # desktop entry
+	mkdir -p $(d_base)/usr/share/applications
+	cp -p debian/$(PVER).desktop \
+		$(d_base)/usr/share/applications/$(PVER).desktop
+
+	: # remove some things
+	-find debian -name .cvsignore | xargs rm -f
+	-find debian -name '*.py[co]' | xargs rm -f
+
+	: # remove empty directories, when all components are in place
+	-find debian ! -name lib-dynload -type d -empty -delete
+
+	: # install debug package
+	rm -rf $(d)-dbg
+	$(MAKE) -C $(buildd_debug) install DESTDIR=$(CURDIR)/$(d)-dbg
+	mv $(d)-dbg/$(scriptdir)/_sysconfigdata.py \
+		$(d)-dbg/$(scriptdir)/_sysconfigdata_d.py
+	dh_installdirs -p$(p_dbg) \
+		usr/bin \
+		usr/share/man/man1 \
+		$(scriptdir)/lib-dynload \
+		usr/include/$(PVER)_d \
+		usr/lib/pkgconfig \
+		usr/share/doc/$(p_base)
+	cp -p Misc/SpecialBuilds.txt $(d_dbg)/usr/share/doc/$(p_base)/
+	cp -p debian/$(PVER)-dbg.README.Debian \
+		$(d_dbg)/usr/share/doc/$(p_base)/README.debug
+	cp -p $(buildd_debug)/python $(d_dbg)/usr/bin/$(PVER)-dbg
+	sed '1s,#!.*python[^ ]*\(.*\),#! $(PY_INTERPRETER)-dbg\1,' \
+		$(d)-dbg/usr/bin/$(PVER)-config \
+		> $(d_dbg)/usr/bin/$(PVER)-dbg-config
+	chmod 755 $(d_dbg)/usr/bin/$(PVER)-dbg-config
+	cp -p $(buildd_debug)/build/lib*/*_d.so \
+		$(d_dbg)/$(scriptdir)/lib-dynload/
+	cp -p $(d)-dbg/$(scriptdir)/_sysconfigdata_d.py \
+		$(d_dbg)/$(scriptdir)/
+	cp -p $(buildd_shdebug)/libpython$(VER)_d.so.1.0 $(d_dbg)/usr/lib/
+	ln -sf libpython$(VER)_d.so.1.0 $(d_dbg)/usr/lib/libpython$(VER)_d.so.1
+	ln -sf libpython$(VER)_d.so.1 $(d_dbg)/usr/lib/libpython$(VER)_d.so
+	sed -e '/^Libs:/s,-lpython$(VER),-lpython$(VER)_d,' \
+	  -e '/^Cflags:/s,python$(VER),python$(VER)_d,' \
+	  $(d)-dbg/usr/lib/pkgconfig/python-$(VER).pc \
+	  > $(d_dbg)/usr/lib/pkgconfig/python-$(VER)-dbg.pc
+ifneq ($(with_gdbm),yes)
+	rm -f $(d_dbg)/$(scriptdir)/lib-dynload/gdbm_d.so
+	rm -f $(d_dbg)/usr/lib/debug/$(scriptdir)/lib-dynload/gdbm.so
+endif
+ifneq ($(with_tk),yes)
+	rm -f $(d_dbg)/$(scriptdir)/lib-dynload/_tkinter_d.so
+	rm -f $(d_dbg)/usr/lib/debug/$(scriptdir)/lib-dynload/_tkinter.so
+endif
+#	rm -f $(d_dbg)/$(scriptdir)/lib-dynload/_bsddb_d.so
+
+	cp -a $(d)-dbg/$(scriptdir)/config_d $(d_dbg)/$(scriptdir)/
+	ln -sf ../../libpython$(VER)_d.so \
+		$(d_dbg)/$(scriptdir)/config_d/libpython$(VER)_d.so
+	ln -sf libpython$(VER)_d.so \
+		$(d_dbg)/$(scriptdir)/config_d/libpython$(VER).so
+	ln -sf libpython$(VER)_d.a \
+		$(d_dbg)/$(scriptdir)/config_d/libpython$(VER).a
+
+	for i in $(d_dev)/usr/include/$(PVER)/*; do \
+	  i=$$(basename $$i); \
+	  case $$i in pyconfig.h) continue; esac; \
+	  ln -sf ../$(PVER)/$$i $(d_dbg)/usr/include/$(PVER)_d/$$i; \
+	done
+	cp -p $(buildd_debug)/pyconfig.h $(d_dbg)/usr/include/$(PVER)_d/
+	ln -sf $(PVER).1.gz $(d_dbg)/usr/share/man/man1/$(PVER)-dbg.1.gz
+	ln -sf $(PVER)-config.1.gz $(d_dbg)/usr/share/man/man1/$(PVER)-dbg-config.1.gz
+
+	for i in debian/*.overrides; do \
+	  b=$$(basename $$i .overrides); \
+	  install -D -m 644 $$i debian/$$b/usr/share/lintian/overrides/$$b; \
+	done
+
+	touch stamps/stamp-install
+
+# Build architecture-independent files here.
+binary-indep: build-indep install stamps/stamp-control
+	dh_testdir -i
+	dh_testroot -i
+
+	: # $(p_doc) package
+	dh_installdirs -p$(p_doc) \
+		usr/share/doc/$(p_base) \
+		usr/share/doc/$(p_doc)
+	dh_installdocs -p$(p_doc)
+	cp -a Doc/build/html $(d_doc)/usr/share/doc/$(p_base)/
+	rm -f $(d_doc)/usr/share/doc/$(p_base)/html/_static/jquery.js
+	rm -f $(d_doc)/usr/share/doc/$(p_base)/html/_static/underscore.js
+	dh_link -p$(p_doc) \
+		/usr/share/doc/$(p_base)/html \
+			/usr/share/doc/$(p_doc)/html \
+		/usr/share/javascript/jquery/jquery.js \
+			/usr/share/doc/$(p_base)/html/_static/jquery.js \
+		/usr/share/javascript/underscore/underscore.js \
+			/usr/share/doc/$(p_base)/html/_static/underscore.js
+
+	: # devhelp docs
+	python debian/pyhtml2devhelp.py \
+		$(d_doc)/usr/share/doc/$(p_base)/html index.html $(VER) \
+		> $(d_doc)/usr/share/doc/$(p_base)/html/$(PVER).devhelp
+	gzip -9v $(d_doc)/usr/share/doc/$(p_base)/html/$(PVER).devhelp
+	dh_link -p$(p_doc) \
+		/usr/share/doc/$(p_base)/html /usr/share/devhelp/books/$(PVER)
+
+	dh_installdebconf -i $(dh_args)
+	dh_installexamples -i $(dh_args)
+	dh_installmenu -i $(dh_args)
+	-dh_icons -i $(dh_args) || dh_iconcache -i $(dh_args)
+	dh_installchangelogs -i $(dh_args)
+	dh_link -i $(dh_args)
+	dh_compress -i $(dh_args) -X.py -X.cls -X.css -X.txt -X.json -X.js -Xobjects.inv -Xgdbinit
+	dh_fixperms -i $(dh_args)
+
+	: # make python scripts starting with '#!' executable
+	for i in `find debian -mindepth 3 -type f ! -name '*.dpatch' ! -perm 755`; do \
+	  if head -1 $$i | grep -q '^#!'; then \
+	    chmod 755 $$i; \
+	    echo "make executable: $$i"; \
+	  fi; \
+	done
+	-find $(d_doc) -name '*.txt' -perm 755 -exec chmod 644 {} \;
+
+	dh_installdeb -i $(dh_args)
+	dh_gencontrol -i $(dh_args)
+	dh_md5sums -i $(dh_args)
+	dh_builddeb -i $(dh_args)
+
+# Build architecture-dependent files here.
+binary-arch: build-arch install
+	dh_testdir -a
+	dh_testroot -a
+#	dh_installdebconf -a
+	dh_installexamples -a
+	dh_installmenu -a
+	-dh_icons -a || dh_iconcache -a
+#	dh_installmime -a
+	dh_installchangelogs -a
+	for i in $(p_dev) $(p_dbg) $(p_lib); do \
+	  rm -rf debian/$$i/usr/share/doc/$$i; \
+	  ln -s $(p_base) debian/$$i/usr/share/doc/$$i; \
+	done
+	-find debian ! -perm -200 -print -exec chmod +w {} \;
+ifneq ($(with_tk),yes)
+	rm -f $(d_base)/$(scriptdir)/lib-dynload/_tkinter.so
+endif
+ifneq ($(with_gdbm),yes)
+	rm -f $(d_base)/$(scriptdir)/lib-dynload/gdbm.so
+endif
+	dh_strip -a -N$(p_dbg) -Xdebug -Xdbg --dbg-package=$(p_dbg)
+	cp Tools/gdb/libpython.py $(d_dbg)/usr/lib/debug/usr/bin/$(PVER)-gdb.py
+	ln -sf $(PVER)-gdb.py $(d_dbg)/usr/lib/debug/usr/bin/$(PVER)-dbg-gdb.py
+	ln -sf ../bin/$(PVER)-gdb.py \
+		$(d_dbg)/usr/lib/debug/usr/lib/lib$(PVER).so.1.0-gdb.py
+	ln -sf ../bin/$(PVER)-gdb.py \
+		$(d_dbg)/usr/lib/lib$(PVER)_d.so.1.0-gdb.py
+	dh_link -a
+	dh_compress -a -X.py
+	dh_fixperms -a
+
+	: # make python scripts starting with '#!' executable
+	for i in `find debian -mindepth 3 -type f ! -name '*.dpatch' ! -perm 755`; do \
+	  if head -1 $$i | grep -q '^#!'; then \
+	    chmod 755 $$i; \
+	    echo "make executable: $$i"; \
+	  fi; \
+	done
+
+	dh_makeshlibs -p$(p_lib) -V '$(p_lib)'
+	dh_makeshlibs -p$(p_dbg) -V '$(p_dbg)'
+# don't include the following symbols, found in extensions
+# which either can be built as builtin or extension.
+	sed -ri '/^ (_check_|asdl_|fast_save_|init)/d' \
+	  $(d_lib)/DEBIAN/symbols $(d_dbg)/DEBIAN/symbols
+	dh_installdeb -a
+	dh_shlibdeps -a
+	dh_gencontrol -a
+	dh_md5sums -a
+	dh_builddeb -a
+
+# rules to patch the unpacked files in the source directory
+# ---------------------------------------------------------------------------
+# various rules to unpack addons and (un)apply patches.
+# 	- patch / apply-patches
+#	- unpatch / reverse-patches
+
+patchdir	= debian/patches
+
+glibc_version := $(shell dpkg -s locales | awk '/^Version:/ {print $$2}')
+broken_utimes := $(shell dpkg --compare-versions $(glibc_version) lt 2.3.5 && echo yes || echo no)
+
+$(patchdir)/series: $(patchdir)/series.in
+	cpp -E \
+	  -D$(distribution) \
+	  $(if $(filter $(broken_utimes),yes),-DBROKEN_UTIMES) \
+	  $(if $(filter $(with_fpectl),yes),-DWITH_FPECTL) \
+	  -Darch_os_$(DEB_HOST_ARCH_OS) -Darch_$(DEB_HOST_ARCH) \
+	  -o - $(patchdir)/series.in \
+	  | egrep -v '^(#.*|$$)' > $(patchdir)/series
+
+patch: stamps/stamp-patch
+stamps/stamp-patch: $(patchdir)/series
+	dh_testdir
+	QUILT_PATCHES=$(patchdir) quilt push -a || test $$? = 2
+	rm -rf autom4te.cache configure
+	autoconf
+	mkdir -p stamps
+	echo ""; echo "Patches applied in this version:" > stamps/pxx
+	for i in $$(cat $(patchdir)/series); do \
+	  echo ""; echo "$$i:"; \
+	  sed -n 's/^# *DP: */  /p' $(patchdir)/$$i; \
+	done >> stamps/pxx
+	mv stamps/pxx $@
+
+reverse-patches: unpatch
+unpatch:
+	QUILT_PATCHES=$(patchdir) quilt pop -a -R || test $$? = 2
+	rm -f stamps/stamp-patch $(patchdir)/series
+	rm -rf configure autom4te.cache
+
+update-patches: $(patchdir)/series
+	export QUILT_PATCHES=$(patchdir); \
+	export QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"; \
+	export QUILT_DIFF_ARGS="--no-timestamps --no-index -pab"; \
+	while quilt push; do quilt refresh; done
+
+binary: binary-indep binary-arch
+
+.PHONY: control-file configure build clean binary-indep binary-arch binary install
+
+# Local Variables:
+# mode: makefile
+# end:
--- python2.7-2.7.3.orig/debian/control.in
+++ python2.7-2.7.3/debian/control.in
@@ -0,0 +1,122 @@
+Source: @PVER@
+Section: python
+Priority: optional
+Maintainer: Matthias Klose <doko@debian.org>
+Build-Depends: debhelper (>= 5), quilt, autoconf, lsb-release, sharutils,
+  libreadline-dev, libtinfo-dev, libncursesw5-dev (>= 5.3),
+  tk8.5-dev, blt-dev (>= 2.4z), libssl-dev,
+  zlib1g-dev, libbz2-dev,
+  libexpat1-dev (>= 2.1),
+  libbluetooth-dev [linux-any],
+  locales [!armel !avr32 !hppa !ia64 !mipsel],
+  libsqlite3-dev, libffi-dev (>= 3.0.5),
+  libgpm2 [linux-any],
+  mime-support, netbase, bzip2,
+  libdb5.1-dev, libgdbm-dev, gdb, python, help2man,
+  xvfb, xauth
+Build-Depends-Indep: python-sphinx
+Build-Conflicts: tcl8.4-dev, tk8.4-dev, @PVER@-xml, python-xml, autoconf2.13, python-cxx-dev
+Standards-Version: 3.9.3
+Vcs-Browser: https://code.launchpad.net/~doko/python/pkg@VER@-debian
+Vcs-Bzr: http://bazaar.launchpad.net/~doko/python/pkg@VER@-debian
+
+Package: @PVER@
+Architecture: any
+Priority: @PRIO@
+Depends: @PVER@-minimal (= ${binary:Version}), mime-support, ${shlibs:Depends}, ${misc:Depends}
+Suggests: @PVER@-doc, binutils
+Provides: @PVER@-cjkcodecs, @PVER@-ctypes, @PVER@-elementtree, @PVER@-celementtree, @PVER@-wsgiref, @PVER@-profiler, @PVER@-argparse, python-argparse
+Conflicts: python-profiler (<= 2.7.1-2)
+Breaks: python-virtualenv (<< 1.7.1.2-2~), vim-nox (<< 2:7.3.547-4), vim-gtk (<< 2:7.3.547-4), vim-gnome (<< 2:7.3.547-4), vim-athena (<< 2:7.3.547-4)
+Replaces: python-profiler (<= 2.7.1-2)
+Description: Interactive high-level object-oriented language (version @VER@)
+ Version @VER@ 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: @PVER@-minimal
+Architecture: any
+Priority: @MINPRIO@
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Recommends: @PVER@
+Suggests: binfmt-support
+Replaces: @PVER@ (<< 2.7.1~rc1-2~)
+Conflicts: binfmt-support (<< 1.1.2)
+Description: Minimal subset of the Python language (version @VER@)
+ This package contains the interpreter and some essential modules.  It can
+ be used in the boot process for some basic tasks.
+ See /usr/share/doc/@PVER@-minimal/README.Debian for a list of the modules
+ contained in this package.
+
+Package: lib@PVER@
+Architecture: any
+Section: libs
+Priority: optional
+Depends: @PVER@ (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
+Replaces: @PVER@ (<< 2.6)
+Description: Shared Python runtime library (version @VER@)
+ Version @VER@ 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.
+ .
+ This package contains the shared runtime library, normally not needed
+ for programs using the statically linked interpreter.
+
+Package: @PVER@-examples
+Architecture: all
+Depends: @PVER@ (>= ${source:Version}), ${misc:Depends}
+Description: Examples for the Python language (v@VER@)
+ Examples, Demos and Tools for Python (v@VER@). These are files included in
+ the upstream Python distribution (v@VER@).
+
+Package: @PVER@-dev
+Architecture: any
+Depends: @PVER@ (= ${binary:Version}), lib@PVER@ (= ${binary:Version}), libexpat1-dev, libssl-dev, ${shlibs:Depends}, ${misc:Depends}
+Recommends: libc6-dev | libc-dev
+Replaces: @PVER@ (<< 2.7-3)
+Description: Header files and a static library for Python (v@VER@)
+ Header files, a static library and development tools for building
+ Python (v@VER@) modules, extending the Python interpreter or embedding
+ Python (v@VER@) in applications.
+ .
+ Maintainers of Python packages should read README.maintainers.
+
+Package: idle-@PVER@
+Architecture: all
+Depends: @PVER@, python-tk (>= 2.6~a3), @PVER@-tk, ${misc:Depends}
+Enhances: @PVER@
+Replaces: @PVER@ (<< 2.6.1-2)
+Description: IDE for Python (v@VER@) using Tkinter
+ IDLE is an Integrated Development Environment for Python (v@VER@).
+ IDLE is written using Tkinter and therefore quite platform-independent.
+
+Package: @PVER@-doc
+Section: doc
+Architecture: all
+Depends: libjs-jquery, ${misc:Depends}
+Suggests: @PVER@
+Description: Documentation for the high-level object-oriented language Python (v@VER@)
+ These is the official set of documentation for the interactive high-level
+ object-oriented language Python (v@VER@). All documents are provided
+ in HTML format. The package consists of ten documents:
+ .
+   * What's New in Python@VER@
+   * 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
+
+Package: @PVER@-dbg
+Section: debug
+Architecture: any
+Priority: extra
+Depends: @PVER@ (>= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
+Suggests: python-gdbm-dbg, python-tk-dbg
+Description: Debug Build of the Python Interpreter (version @VER@)
+ Python interpreter configured with --pydebug. Dynamically loaded modules are
+ searched in /usr/lib/@PVER@/lib-dynload/debug first.
--- python2.7-2.7.3.orig/debian/PVER-doc.doc-base.PVER-lib.in
+++ python2.7-2.7.3/debian/PVER-doc.doc-base.PVER-lib.in
@@ -0,0 +1,15 @@
+Document: @PVER@-lib
+Title: Python Library Reference (v@VER@)
+Author: Guido van Rossum
+Abstract: This library reference manual documents Python's standard library,
+ as well as many optional library modules (which may or may not be
+ available, depending on whether the underlying platform supports
+ them and on the configuration choices made at compile time).  It
+ also documents the standard types of the language and its built-in
+ functions and exceptions, many of which are not or incompletely
+ documented in the Reference Manual.
+Section: Programming/Python
+
+Format: HTML
+Index: /usr/share/doc/@PVER@/html/library/index.html
+Files: /usr/share/doc/@PVER@/html/library/*.html
--- python2.7-2.7.3.orig/debian/PVER-doc.doc-base.PVER-ref.in
+++ python2.7-2.7.3/debian/PVER-doc.doc-base.PVER-ref.in
@@ -0,0 +1,18 @@
+Document: @PVER@-ref
+Title: Python Reference Manual (v@VER@)
+Author: Guido van Rossum
+Abstract: This reference manual describes the syntax and "core semantics" of
+ the language.  It is terse, but attempts to be exact and complete.
+ The semantics of non-essential built-in object types and of the
+ built-in functions and modules are described in the *Python
+ Library Reference*.  For an informal introduction to the language,
+ see the *Python Tutorial*.  For C or C++ programmers, two
+ additional manuals exist: *Extending and Embedding the Python
+ Interpreter* describes the high-level picture of how to write a
+ Python extension module, and the *Python/C API Reference Manual*
+ describes the interfaces available to C/C++ programmers in detail.
+Section: Programming/Python
+
+Format: HTML
+Index: /usr/share/doc/@PVER@/html/reference/index.html
+Files: /usr/share/doc/@PVER@/html/reference/*.html
--- python2.7-2.7.3.orig/debian/argparse.egg-info
+++ python2.7-2.7.3/debian/argparse.egg-info
@@ -0,0 +1,8 @@
+Metadata-Version: 1.0
+Name: argparse
+Version: 1.2.1
+Summary: Python command-line parsing library
+Author: Steven Bethard
+Author-email: steven.bethard@gmail.com
+License: Python Software Foundation License
+Platform: any
--- python2.7-2.7.3.orig/debian/changelog
+++ python2.7-2.7.3/debian/changelog
@@ -0,0 +1,2795 @@
+python2.7 (2.7.3-6+deb7u3) wheezy-security; urgency=low
+
+  * Non-maintainer upload by the Wheezy LTS Team. 
+  * CVE-2016-0772
+    A vulnerability in smtplib allowing MITM attacker to perform a 
+    startTLS stripping attack. smtplib does not seem to raise an 
+    exception when the remote end (smtp server) is capable of 
+    negotiating starttls but fails to respond with 220 (ok) to an 
+    explicit call of SMTP.starttls(). This may allow a malicious 
+    MITM to perform a startTLS stripping attack if the client code 
+    does not explicitly check the response code for startTLS.
+  * CVE-2016-5636
+    Issue #26171: Fix possible integer overflow and heap corruption 
+    in zipimporter.get_data().
+  * CVE-2016-5699
+    Protocol injection can occur not only if an application sets a 
+    header based on user-supplied values, but also if the application 
+    ever tries to fetch a URL specified by an attacker (SSRF case) OR 
+    if the application ever accesses any malicious web server 
+    (redirection case).
+
+ -- Thorsten Alteholz <debian@alteholz.de>  Sun, 19 Jun 2016 17:03:02 +0200
+
+python2.7 (2.7.3-6+deb7u2) stable-security; urgency=low
+
+  * Fix installation of modules in python2.7-minimal, thanks to
+    Jakub Wilk for the analysis
+
+ -- Moritz MÃ¼hlenhoff <jmm@debian.org>  Wed, 12 Mar 2014 23:45:44 +0100
+
+python2.7 (2.7.3-6+deb7u1) stable-security; urgency=low
+
+  * CVE-2014-1912, CVE-2013-4238
+
+ -- Moritz MÃ¼hlenhoff <jmm@debian.org>  Wed, 05 Mar 2014 00:18:28 +0100
+
+python2.7 (2.7.3-6) unstable; urgency=low
+
+  * During purge, check for existance of /etc/python2.7 before trying
+    to remove it. Closes: #696023.
+  * Revert the fix for issue #14635, requested by the Debian release team.
+  * Revert the fixes for issues #15512, #15487, #15469, #15424, #15402,
+    requested by the Debian release team.
+
+ -- Matthias Klose <doko@debian.org>  Wed, 02 Jan 2013 01:12:22 +0100
+
+python2.7 (2.7.3-5) unstable; urgency=low
+
+  * Enable verbose build for the sharedmods target.
+  * Fix issue #15847: allow args to be a tuple in parse_args. Closes: #686583.
+  * Fix issue #15340: Fix importing the random module when /dev/urandom cannot
+    be opened.  Regression caused by the hash randomization patch.
+  * Don't use `-n' anymore to start idle in the desktop/menu files, not
+    needed anymore for multiseat installations.
+
+ -- Matthias Klose <doko@debian.org>  Sun, 09 Sep 2012 16:54:26 +0200
+
+python2.7 (2.7.3-4) unstable; urgency=low
+
+  * Follwup for issue #9374. Restore the removed attributes in the
+    urlparse module.
+  * Update symbols files.
+  * Disable test_subprocess on the Hurd buildds.
+  * Call dh_movefiles with --srcdir. Closes: #685543.
+
+ -- Matthias Klose <doko@debian.org>  Sun, 26 Aug 2012 12:24:31 +0200
+
+python2.7 (2.7.3-3) unstable; urgency=low
+
+  * Update to 20120814, taken from the 2.7 branch. Posix relevant patches:
+    - Issue #15041: Update "see also" list in tkinter documentation.
+    - Issue #14579: Fix error handling bug in the utf-16 decoder.
+    - Issue #15368: An issue that caused bytecode generation to be
+      non-deterministic when using randomized hashing (-R) has been fixed.
+    - Issue #15567: Fix NameError when running threading._test
+    - Issue #15424: Add a __sizeof__ implementation for array objects.
+    - Issue #13052: Fix IDLE crashing when replace string in Search/Replace
+      dialog ended with '\'.
+    - Issue #15538: Fix compilation of the getnameinfo() / getaddrinfo()
+      emulation code.
+    - Issue #9803: Don't close IDLE on saving if breakpoint is open.
+    - Issue #12288: Consider '0' and '0.0' as valid initialvalue
+      for tkinter SimpleDialog.
+    - Issue #15489: Add a __sizeof__ implementation for BytesIO objects.
+    - Issue #15469: Add a __sizeof__ implementation for deque objects.
+    - Issue #15487: Add a __sizeof__ implementation for buffered I/O objects.
+    - Issue #15512: Add a __sizeof__ implementation for parser.
+    - Issue #15402: An issue in the struct module that caused sys.getsizeof to
+      return incorrect results for struct.Struct instances has been fixed.
+    - Issue #15232: when mangle_from is True, email.Generator now correctly
+      mangles lines that start with 'From ' that occur in a MIME preamble
+      or epilog.
+    - Issue #13922: argparse no longer incorrectly strips '--'s that appear
+      after the first one.
+    - Issue #12353: argparse now correctly handles null argument values.
+    - Issue #14635: telnetlib will use poll() rather than select() when possible
+      to avoid failing due to the select() file descriptor limit.
+    - Issue #6056: Make multiprocessing use setblocking(True) on the
+      sockets it uses.
+    - Issue #15630: Add an example for "continue" stmt in the tutorial.
+    - Issue #15250: Document that filecmp.dircmp compares files shallowly.
+  * Fortified build.
+  * Python/import.c: Don't export isdir().
+  * Modules/socketmodule.c: Don't export netdb_lock.
+  * Add breaks for vim-{nox,gtk,gnome,athena}. Closes: #682034.
+  * Don't ship python2.pc, should be shipped with python-dev instead.
+    Closes: #684612.
+
+ -- Matthias Klose <doko@debian.org>  Tue, 14 Aug 2012 17:55:32 +0200
+
+python2.7 (2.7.3-2) unstable; urgency=low
+
+  * Update to 20120713, taken from the 2.7 branch.
+    - Issue #15033: Fix the exit status bug when modules invoked using -m swith,
+      return the proper failure return value (1).
+    - Issue #12268: File readline, readlines and read() methods no longer lose
+      data when an underlying read system call is interrupted.  IOError is no
+      longer raised due to a read system call returning EINTR from within these
+      methods.
+    - Issue #13512: Create ~/.pypirc securely (CVE-2011-4944).
+    - Issue #7719: Make distutils ignore ``.nfs*`` files instead of choking
+      later on.
+    - Issue #10053: Don't close FDs when FileIO.__init__ fails.
+    - Issue #15247: FileIO now raises an error when given a file descriptor
+      pointing to a directory.
+    - Issue #14591: Fix bug in Random.jumpahead that could produce an invalid
+      Mersenne Twister state on 64-bit machines.
+    - Issue #5346: Preserve permissions of mbox, MMDF and Babyl mailbox
+      files on flush().
+    - Issue #15219: Fix a reference leak when hashlib.new() is called with
+      invalid parameters.
+    - Issue #9559: If messages were only added, a new file is no longer
+      created and renamed over the old file when flush() is called on an
+      mbox, MMDF or Babyl mailbox.
+    - Issue #14653: email.utils.mktime_tz() no longer relies on system
+      mktime() when timezone offest is supplied.
+    - Issue #15101: Make pool finalizer avoid joining current thread.
+    - Issue #15054: A bug in tokenize.tokenize that caused string literals
+      with 'b' and 'br' prefixes to be incorrectly tokenized has been fixed.
+    - Issue #15036: Mailbox no longer throws an error if a flush is done
+      between operations when removing or changing multiple items in mbox,
+      MMDF, or Babyl mailboxes.
+    - Issue #15043: test_gdb is now skipped entirely if gdb security settings
+      block loading of the gdb hooks
+    - Issue #13557: Clarify effect of giving two different namespaces to exec or
+      execfile().
+  * Don't build the _hashlib and _ssl extensions as a builtin, but as
+    extensions. Closes: #680930.
+  * Backport issue #13150: sysconfig no longer parses the Makefile and config.h
+    files when imported, instead doing it at build time.  This makes importing
+    sysconfig faster and reduces Python startup time by 20%.
+  * python2.7: Add a break for python-virtualenv (<< 1.7.1.2-2~).
+  * Don't run the test_gdb test on mips/mipsel, not even in debug mode.
+  * For lto builds, use -g instead of -g1; filter out lto flags in the
+    installed Makefile. Closes: #681348.
+
+ -- Matthias Klose <doko@debian.org>  Fri, 13 Jul 2012 05:03:43 +0200
+
+python2.7 (2.7.3-1) unstable; urgency=low
+
+  * Python 2.7.3 release.
+  * Update to 20120615, taken from the 2.7 branch.
+  * The wininst-* files cannot be built within Debian from the included
+    sources, needing a zlib mingw build, which the zlib maintainer isn't
+    going to provide. Closes: #639407.
+  * Let pydoc handle dist-packages the same as site-packages.
+    Closes: #671021.
+  * python2.7-doc: Fix underscore.js symlink. Closes: #671795, #676339.
+  * Do not italicize punctuation in python(1) manual page (Matt Kraai).
+    Closes: #579269.
+  * Build _heapq as a builtin (and move it to -minimal).
+
+ -- Matthias Klose <doko@debian.org>  Fri, 15 Jun 2012 15:26:21 +0200
+
+python2.7 (2.7.3~rc2-2.1) unstable; urgency=low
+
+  * Non-maintainer upload (with maintainer's permission).
+  * Disable testsuite on GNU/kFreeBSD.  (Closes: #669281)
+
+ -- Robert Millan <rmh@debian.org>  Sun, 22 Apr 2012 22:04:26 +0200
+
+python2.7 (2.7.3~rc2-2) unstable; urgency=low
+
+  * Use xdg-open/gvfs-open in Lib/webbrowser.py (Michael Vogt). 
+    LP: #971311.
+  * Add a paragraph about python-foo-dbg packages to README.debug.
+    LP: #872050.
+  * Disable some tests (no feedback from porters):
+    - test_socket on hurd-i386.
+    - test_io on amd64.
+    - test_signal on kfreebsd-*. Closes: #654783.
+    - test_threading on sparc.
+  * Tighten build dependency on libexpat-dev. Closes: #665346.
+  * Build-depend on db-5.1, don't care about testsuite regressions on
+    some esoteric ports.  If packages rely on threaded applications or
+    transactions, please use the python-bsddb3 package.
+    Closes: #621374.
+  * Don't ship the python2 and python2-config symlinks, move these
+    to the python-minimal and python-dev packages. Closes: #663874.
+  * Remove PVER-doc.doc-base.PVER-doc.in. Closes: #656763.
+  * Update symbols files.
+  * Avoid runtime path for the sqlite extension.
+  * CVE-2011-4944, distutils creates ~/.pypirc insecurely. Closes: #650555.
+  * Fix issue #14505, file descriptor leak when deallocating file objects
+    created with PyFile_FromString(). Closes: #664529.
+
+ -- Matthias Klose <doko@debian.org>  Thu, 05 Apr 2012 15:47:03 +0200
+
+python2.7 (2.7.3~rc2-1) unstable; urgency=low
+
+  * Python 2.7.3 release candidate 2.
+  * Build-depend on expat >= 2.1~.
+
+ -- Matthias Klose <doko@debian.org>  Wed, 21 Mar 2012 05:21:47 +0100
+
+python2.7 (2.7.3~rc1-1) unstable; urgency=low
+
+  * Python 2.7.3 release candidate 1.
+  * Update to 20120309, taken from the 2.7 branch.
+  * Fix dangling libpython.a symlink. Closes: #660231.
+
+ -- Matthias Klose <doko@debian.org>  Fri, 09 Mar 2012 19:28:43 +0100
+
+python2.7 (2.7.2-13) unstable; urgency=low
+
+  * Update to 20120120, taken from the 2.7 branch.
+  * Remove patch integrated upstream (issue9054.diff).
+  * Backport Issue #9189 to distutils/sysconfig.py as well.
+    Closes: #656118.
+  * Disable test_io on kfreebsd again. Closes: #654783.
+  * Disable test_bsddb3 tests on kfreebsd again.
+
+ -- Matthias Klose <doko@debian.org>  Fri, 20 Jan 2012 16:33:47 +0100
+
+python2.7 (2.7.2-12) unstable; urgency=low
+
+  * Run the tests with a script command which doesn't exit immediatly
+    when stdin is /dev/null (Colin Watson).
+
+ -- Matthias Klose <doko@debian.org>  Fri, 13 Jan 2012 11:04:31 +0100
+
+python2.7 (2.7.2-11) unstable; urgency=low
+
+  * Don't run the test_site tests when $HOME doesn't exist.
+
+ -- Matthias Klose <doko@debian.org>  Wed, 11 Jan 2012 09:19:00 +0100
+
+python2.7 (2.7.2-10) unstable; urgency=low
+
+  * Update to 20120110, taken from the 2.7 branch.
+  * Overwrite some lintian warnings:
+    - The -dbg interpreters are not unusual.
+    - The -gdb.py files don't need a python dependency.
+    - lintian can't handle a whatis entry starting with one word on the line.
+  * Fix test failures related to distutils debian installation layout.
+  * Add build-arch/build-indep targets.
+  * Regenerate Setup and Makefiles after correcting Setup.local.
+  * profiled-build.diff: Pass PY_CFLAGS instead of CFLAGS for the profiled
+    build.
+  * Pass dpkg-buildflags to the build process, and build third party
+    extensions with these flags.
+  * Add support to build using -flto (and -g1) on some architectures.
+  * Disable pgo builds for some architectures (for now, keep just
+    amd64 armel armhf i386 powerpc ppc64).
+  * Build-depend on libgdbm-dev to build and run the gdbm tests.
+  * Build-depend on xvfb to run the tkinter tests.
+  * python2.7: Provide python2.7-argparse and python-argparse.
+  * Don't run test_threading on mips/mipsel.
+  * Run the test_gdb test for the debug build only.
+  * Add build conflict to python-cxx-dev (pydoc test failures).
+  * Disable test_ssl certificate check, certificate expired on python.org.
+
+ -- Matthias Klose <doko@debian.org>  Tue, 10 Jan 2012 16:44:56 +0100
+
+python2.7 (2.7.2-9) unstable; urgency=low
+
+  * Update to 20111217, taken from the 2.7 branch.
+
+ -- Matthias Klose <doko@debian.org>  Sat, 17 Dec 2011 17:36:27 +0100
+
+python2.7 (2.7.2-8) unstable; urgency=low
+
+  * Update to 20111130, taken from the 2.7 branch.
+  * New patch, ctypes-arm, allow for ",hard-float" after libc6 in ldconfig -p
+    output (Loic Minier). LP: #898172.
+  * debian/rules: Define DPKG_VARS (Alban Browaeys). Closes: #647419).
+  * Add python-config man page (Johann Felix Soden). Closes: #650181).
+
+ -- Matthias Klose <doko@debian.org>  Wed, 30 Nov 2011 19:16:23 +0100
+
+python2.7 (2.7.2-7) unstable; urgency=low
+
+  * Adjust patches for removed Lib/plat-linux3.
+  * Add build conflict to libncurses5-dev, let configure search for
+    ncurses headers in /usr/include/ncursesw too.
+
+ -- Matthias Klose <doko@debian.org>  Wed, 05 Oct 2011 11:30:16 +0200
+
+python2.7 (2.7.2-6) unstable; urgency=low
+
+  * Update to 20111004, taken from the 2.7 branch.
+  * Use the ncursesw include directory when linking with ncursesw.
+  * Rebuild with libreadline not linked with libncurses*. Closes: #643816.
+  * Fix typos in the multiprocessing module. Closes: #643856.
+
+ -- Matthias Klose <doko@debian.org>  Tue, 04 Oct 2011 16:09:29 +0200
+
+python2.7 (2.7.2-5) unstable; urgency=low
+
+  * Update to 20110816, taken from the 2.7 branch.
+    - Fix issue#12752. LP: #824734.
+  * Don't run test_threading on the kfreebsd-i386 buildd.
+
+ -- Matthias Klose <doko@debian.org>  Tue, 16 Aug 2011 08:33:31 +0200
+
+python2.7 (2.7.2-4) unstable; urgency=low
+
+  * Update to 20110803, taken from the 2.7 branch.
+  * Fix build on s390x. Closes: #636033.
+  * Use linux-any for some build dependencies. Closes: #634809.
+  * Revert previous change to treat Linux 3.x as Linux 2. Use the
+    plat-linux3 directory instead.
+
+ -- Matthias Klose <doko@debian.org>  Wed, 03 Aug 2011 12:36:05 +0200
+
+python2.7 (2.7.2-3) unstable; urgency=low
+
+  * Update to 20110709, taken from the 2.7 branch.
+  * Make the conflict against python-profiler a versioned conflict.
+  * Don't run the bsddb3 tests on kfreebsd-i386.
+  * Don't add the bsddb multilib path, if already in the standard lib path.
+  * Treat Linux 3.x as Linux 2. Closes: #633015.
+  * Assume working semaphores on Linux, don't rely on running kernel
+    for the check. Closes: #631188.
+
+ -- Matthias Klose <doko@debian.org>  Sat, 09 Jul 2011 13:19:47 +0200
+
+python2.7 (2.7.2-2) unstable; urgency=low
+
+  * Update to 20110628, taken from the 2.7 branch.
+  * Add profile/pstats to the python2.7 package, update debian copyright.
+  * Don't run the bsddb3 tests on kfreebsd-amd64.
+  * Don't run the benchmark on hurd-i386.
+
+ -- Matthias Klose <doko@debian.org>  Tue, 28 Jun 2011 23:05:21 +0200
+
+python2.7 (2.7.2-1) unstable; urgency=low
+
+  * Python 2.7.2 release.
+
+ -- Matthias Klose <doko@debian.org>  Sun, 12 Jun 2011 21:04:24 +0200
+
+python2.7 (2.7.2~rc1-2) unstable; urgency=medium
+
+  * Set pyexpat dummy version string.
+
+ -- Matthias Klose <doko@debian.org>  Tue, 31 May 2011 12:05:56 +0200
+
+python2.7 (2.7.2~rc1-1) unstable; urgency=low
+
+  * Python 2.7.2 release candidate 1.
+  * Update libpython symbols file for m68k (Thorsten Glaser). Closes: #627458.
+  * Apply proposed patch for issue #670664. LP: #357067.
+
+ -- Matthias Klose <doko@debian.org>  Mon, 30 May 2011 06:44:23 +0200
+
+python2.7 (2.7.1-9) unstable; urgency=low
+
+  * Update to 20110520, taken from the 2.7 branch.
+
+ -- Matthias Klose <doko@debian.org>  Fri, 20 May 2011 13:43:12 +0200
+
+python2.7 (2.7.1-8) unstable; urgency=low
+
+  * Keep the ssl.PROTOCOL_SSLv2 module constant , just raise an exception
+    when trying to create a PySSL object. Closes: #623423.
+
+ -- Matthias Klose <doko@debian.org>  Wed, 20 Apr 2011 12:31:03 +0200
+
+python2.7 (2.7.1-7) unstable; urgency=low
+
+  * Update to 20110419, taken from the 2.7 branch.
+  * Build without OpenSSL v2 support. Closes: #620581.
+  * Force linking the curses module against libncursesw. Closes: #622064.
+  * Link libpython with --whole-archive. Closes: #614711.
+  * Re-enable running the testsuite during the build.
+
+ -- Matthias Klose <doko@debian.org>  Tue, 19 Apr 2011 17:36:56 +0200
+
+python2.7 (2.7.1-6) unstable; urgency=low
+
+  * Update to 20110307, taken from the 2.7 branch.
+  * Disable the profile guided build on ia64, sparc.
+
+ -- Matthias Klose <doko@debian.org>  Mon, 07 Mar 2011 02:19:02 +0100
+
+python2.7 (2.7.1-5) experimental; urgency=low
+
+  * Update to 20110224, taken from the 2.7 branch.
+  * Update patches.
+  * Re-enable profile guided build.
+
+ -- Matthias Klose <doko@debian.org>  Thu, 24 Feb 2011 06:01:42 +0100
+
+python2.7 (2.7.1-4) experimental; urgency=low
+
+  * Update to 20110119, taken from the 2.7 branch.
+
+ -- Matthias Klose <doko@debian.org>  Wed, 19 Jan 2011 04:21:14 +0100
+
+python2.7 (2.7.1-3) experimental; urgency=low
+
+  * Do not run test_multiprocessing when running the testsuite.
+    Fails on armel and powerpc on some buildds.
+
+ -- Matthias Klose <doko@debian.org>  Fri, 24 Dec 2010 01:46:55 +0100
+
+python2.7 (2.7.1-2) experimental; urgency=low
+
+  * Update to 20101222, taken from the 2.7 branch.
+  * Re-enable the distutils-sysconfig.diff patch, apparently
+    lost when updating the patches for 2.7.
+  * Disable the profiled builds on all architectures.
+
+ -- Matthias Klose <doko@debian.org>  Wed, 22 Dec 2010 15:39:48 +0100
+
+python2.7 (2.7.1-1) experimental; urgency=low
+
+  * Python 2.7.1 release.
+
+ -- Matthias Klose <doko@debian.org>  Sun, 28 Nov 2010 12:05:23 +0100
+
+python2.7 (2.7.1~rc1-2) experimental; urgency=low
+
+  * Move the pyconfig.h file into the -min package, required by sysconfig.
+    Closes: #603237.
+
+ -- Matthias Klose <doko@debian.org>  Sun, 14 Nov 2010 09:40:09 +0100
+
+python2.7 (2.7.1~rc1-1) experimental; urgency=low
+
+  * Python 2.7.1 release candidate 1.
+  * Move the Makefile into the -min package, required by sysconfig.
+    Closes: #603237.
+
+ -- Matthias Klose <doko@debian.org>  Sun, 14 Nov 2010 00:33:48 +0100
+
+python2.7 (2.7-9) experimental; urgency=low
+
+  * Update to 20101016, taken from the 2.7 branch.
+
+ -- Matthias Klose <doko@debian.org>  Sat, 16 Oct 2010 12:46:57 +0200
+
+python2.7 (2.7-8) experimental; urgency=low
+
+  * Disabled the profiled build on armel.
+
+ -- Matthias Klose <doko@debian.org>  Thu, 23 Sep 2010 15:06:06 +0200
+
+python2.7 (2.7-7) experimental; urgency=low
+
+  * Update to 20100922, taken from the 2.7 branch.
+  * Update GNU/Hurd patches (Pino Toscano). Closes: #597419.
+
+ -- Matthias Klose <doko@ubuntu.com>  Wed, 22 Sep 2010 20:35:24 +0200
+
+python2.7 (2.7-6) experimental; urgency=low
+
+  * Update to 20100915, taken from the 2.7 branch.
+    - Fix issue #9729, Unconnected SSLSocket.{send,recv} raises TypeError
+      (Andrew Bennetts). LP: #637821.
+  * Add copyright information for expat, libffi and zlib. Addresses: #596276.
+  * Apply proposed fix for issue 9054, configure --with-system-expat.
+  * Provide Lib/plat-gnukfreebsd[78] (Jakub Wilk). Addresses: #593818.
+
+ -- Matthias Klose <doko@debian.org>  Wed, 15 Sep 2010 17:43:18 +0200
+
+python2.7 (2.7-5) experimental; urgency=low
+
+  * Update to 20100829, taken from the 2.7 branch.
+  * Don't configure --with-system-expat, segfaults the interpreter in the
+    testsuite.
+  * Disable more tests on hppa and hurd-i386, which fail on the buildds.
+
+ -- Matthias Klose <doko@debian.org>  Sun, 29 Aug 2010 16:22:37 +0200
+
+python2.7 (2.7-4) experimental; urgency=low
+
+  * Update to 20100822, taken from the 2.7 branch.
+  * Fixed in previous 2.7 uploads: Multiple integer overflows in audioop.c
+    in the audioop module (CVE-2010-1634).
+  * Fix some lintian warnings.
+  * Configure --with-system-expat.
+
+ -- Matthias Klose <doko@debian.org>  Mon, 23 Aug 2010 13:03:40 +0200
+
+python2.7 (2.7-3) experimental; urgency=low
+
+  * Update to 20100807, taken from the 2.7 branch.
+  * Move '/usr/local/.../dist-packages' before '/usr/lib/.../dist-packages'
+    in sys.path. Adresses: #588342.
+  * Fix detection of ffi.h header file. Closes: #591408.
+  * python2-7-dev: Depend on libssl-dev. LP: #611845.
+
+ -- Matthias Klose <doko@debian.org>  Sat, 07 Aug 2010 21:28:04 +0200
+
+python2.7 (2.7-2) experimental; urgency=low
+
+  * Complete debug-build.diff, some parts lost in quilt conversion.
+  * Move the pkgconfig file into the -dev package.
+
+ -- Matthias Klose <doko@debian.org>  Tue, 06 Jul 2010 21:07:48 +0200
+
+python2.7 (2.7-1) experimental; urgency=low
+
+  * Python 2.7 release.
+  * Update to 20100706, taken from the trunk.
+  * Update symbols files.
+
+ -- Matthias Klose <doko@debian.org>  Tue, 06 Jul 2010 07:21:23 +0200
+
+python2.7 (2.7~rc2-3) experimental; urgency=low
+
+  * Update to 20100703, taken from the trunk.
+  * Move the _weakrefset module, not extension to -minimal. Closes: #587568.
+  * Move the sysconfig module to -minimal. Closes: #586113.
+  * Move the shutil module to python2.6-minimal. Addresses: #587628.
+
+ -- Matthias Klose <doko@debian.org>  Sat, 03 Jul 2010 13:27:36 +0200
+
+python2.7 (2.7~rc2-2) experimental; urgency=low
+
+  * Fix applying plat-linux2* patches.
+  * Use the profiled build on armel, sparc and sparc64.
+
+ -- Matthias Klose <doko@debian.org>  Tue, 29 Jun 2010 08:04:59 +0200
+
+python2.7 (2.7~rc2-1) experimental; urgency=low
+
+  * Python 2.7 release candidate 2.
+  * Update to 20100628, taken from the trunk.
+  * Merge packaging changes from python2.6 (2.6.5+20100628-1).
+
+ -- Matthias Klose <doko@debian.org>  Tue, 29 Jun 2010 00:57:00 +0200
+
+python2.7 (2.7~b1-2) experimental; urgency=low
+
+  * Update to 20100508, taken from the trunk.
+
+ -- Matthias Klose <doko@debian.org>  Sat, 08 May 2010 17:34:07 +0200
+
+python2.7 (2.7~b1-1) experimental; urgency=low
+
+  * Python 2.7 beta1.
+  * Update to 20100420, taken from the trunk.
+  * Update libpython symbols files.
+  * Apply proposed patch for issue #7332, segfaults in
+    PyMarshal_ReadLastObjectFromFile in import_submodule.
+  * Don't build-depend on locales on avr32. Closes: #575144.
+
+ -- Matthias Klose <doko@debian.org>  Tue, 20 Apr 2010 23:53:42 +0200
+
+python2.7 (2.7~a4-1) experimental; urgency=low
+
+  * Python 2.7 alpha4.
+  * Update to 20100316, taken from the trunk.
+  * Point distutils.sysconfig to the system installation. Closes: #573363.
+
+ -- Matthias Klose <doko@ubuntu.com>  Tue, 16 Mar 2010 15:45:07 +0100
+
+python2.7 (2.7~a3-1) experimental; urgency=low
+
+  * Python 2.7 alpha3.
+
+ -- Matthias Klose <doko@debian.org>  Tue, 16 Feb 2010 03:04:01 +0100
+
+python2.7 (2.7~a2-1) experimental; urgency=low
+
+  * Python 2.7 alpha2.
+
+ -- Matthias Klose <doko@debian.org>  Sat, 16 Jan 2010 14:49:59 +0100
+
+python2.6 (2.6.5+20100628-1) unstable; urgency=low
+
+  * Update to 20100614, taken from the 2.6 release branch (r82337).
+  * Apply plat-linux2-<arch> patch for alpha, hppa, mips, mipsel, sparc
+    and sparc64.
+
+ -- Matthias Klose <doko@debian.org>  Mon, 28 Jun 2010 21:26:43 +0200
+
+python2.6 (2.6.5+20100626-1) unstable; urgency=low
+
+  * Update to 20100614, taken from the 2.6 release branch (r82245).
+  * Update libpython symbols files. Closes: #587012.
+  * Move the logging package and the runpy module to python2.6-minimal.
+
+ -- Matthias Klose <doko@debian.org>  Sat, 26 Jun 2010 14:29:41 +0200
+
+python2.6 (2.6.5+20100616-1) unstable; urgency=medium
+
+  * Update to 20100614, taken from the 2.6 release branch (r81601).
+  * Reapply the backport for issue #8233, lost in the conversion to
+    quilt.
+  * Disable the profiled build on alpha.
+  * Make pydoc more robust not to fail on exceptions other than import
+    exceptions.
+  * posixmodule: Add flags for statvfs.f_flag to constant list.
+
+ -- Matthias Klose <doko@debian.org>  Wed, 16 Jun 2010 07:56:40 +0200
+
+python2.6 (2.6.5+20100529-1) unstable; urgency=low
+
+  * Update to 20100529, taken from the 2.6 release branch (r81601).
+    - Fix issue #5753, CVE-2008-5983 python: untrusted python modules
+      search path. Closes: #572010.
+  * Convert internal dpatch system to quilt.
+  * Build the ossaudio extension on GNU/kFreeBSD. Closes: #574696.
+
+ -- Matthias Klose <doko@debian.org>  Sat, 29 May 2010 15:07:51 +0200
+
+python2.6 (2.6.5-2) unstable; urgency=low
+
+  * Update libpython symbols files.
+  * debian/patches/issue8032.dpatch: Update to version from the
+    trunk.
+  * Fix issue #8329: Don't return the same lists from select.select
+    when no fds are changed.
+  * Fix issue #8310: Allow dis to examine new style classes.
+  * Fix issues #8279: Fix test_gdb failures.
+  * Fix issue #8233: When run as a script, py_compile.py optionally
+    takes a single argument `-`.
+  * Apply proposed patch for issue #7332, segfaults in
+    PyMarshal_ReadLastObjectFromFile in import_submodule.
+  * Don't build-depend on locales on avr32. Closes: #575144.
+
+ -- Matthias Klose <doko@debian.org>  Tue, 20 Apr 2010 19:41:36 +0200
+
+python2.6 (2.6.5-1ubuntu6) lucid; urgency=low
+
+  * Fix applying patch for issue #8310.
+
+ -- Matthias Klose <doko@ubuntu.com>  Fri, 16 Apr 2010 14:20:35 +0200
+
+python2.6 (2.6.5-1ubuntu5) lucid; urgency=low
+
+  * Fix issue #8329: Don't return the same lists from select.select
+    when no fds are changed.
+  * Fix issue #8310: Allow dis to examine new style classes.
+
+ -- Matthias Klose <doko@ubuntu.com>  Thu, 15 Apr 2010 01:21:07 +0200
+
+python2.6 (2.6.5-1ubuntu4) lucid; urgency=low
+
+  * debian/patches/issue8032.dpatch: Update to version from the
+    trunk. Upload for beta2 to avoid apport errors.
+    - Handle PyFrameObject's: LP: #543624, #548723.
+    - Detect cycles in object reference graph and add extra
+      protection: LP: #544823, LP: #552356.
+
+ -- Matthias Klose <doko@ubuntu.com>  Thu, 01 Apr 2010 22:53:06 +0200
+
+python2.6 (2.6.5-1ubuntu3) lucid; urgency=low
+
+  * debian/patches/issue8140.dpatch: Incomplete patch; regenerate.
+  * debian/patches/issue8032.dpatch: Update to v4:
+    - Add support for PySetObject (set/frozenset).
+    - Add support for PyBaseExceptionObject (BaseException).
+    - Fix a signed vs unsigned char issue that led to exceptions
+      in gdb for PyStringObject instances.
+    - Handle the case of loops in the object reference graph.
+    - Unit tests for all of the above.
+
+ -- Matthias Klose <doko@ubuntu.com>  Wed, 31 Mar 2010 18:52:32 +0200
+
+python2.6 (2.6.5-1ubuntu2) lucid; urgency=low
+
+  * Disable profiled build on powerpc.
+
+ -- Matthias Klose <doko@ubuntu.com>  Sat, 20 Mar 2010 15:17:18 +0100
+
+python2.6 (2.6.5-1ubuntu1) lucid; urgency=low
+
+  * Merge with Debian (2.6.5-1).
+
+ -- Matthias Klose <doko@ubuntu.com>  Sat, 20 Mar 2010 03:57:17 +0100
+
+python2.6 (2.6.5-1) unstable; urgency=low
+
+  * Python 2.6.5 final release.
+  * Fix issue #4961: Inconsistent/wrong result of askyesno function in
+    tkMessageBox with Tcl8.5. LP: #462950.
+  * Issue #8154, fix segfault with os.execlp('true'). LP: #418848.
+  * Apply proposed patch for issue #8032, gdb7 hooks for debugging.
+
+ -- Matthias Klose <doko@debian.org>  Fri, 19 Mar 2010 00:12:55 +0100
+
+python2.6 (2.6.5~rc2-2) unstable; urgency=low
+
+  * Add copyright notices for the readline and _ssl extensions.
+    Closes: #573866.
+  * Backport issue #8140: Extend compileall to compile single files.
+    Add -i option.
+  * Backport issue #6949, build _bsddb extension with db-4.8.x.
+
+ -- Matthias Klose <doko@debian.org>  Tue, 16 Mar 2010 03:02:21 +0100
+
+python2.6 (2.6.5~rc2-1) unstable; urgency=low
+
+  * Python 2.6.5 release candidate 2.
+    - Replace the Monty Python audio test file. Closes: #568674.
+  * Fix build failure on sparc64. Closes: #570845.
+
+ -- Matthias Klose <doko@debian.org>  Thu, 11 Mar 2010 16:50:03 +0100
+
+python2.6 (2.6.5~rc2-0ubuntu1) lucid; urgency=low
+
+  * Python 2.6.5 release candidate 2.
+
+ -- Matthias Klose <doko@ubuntu.com>  Thu, 11 Mar 2010 13:30:19 +0100
+
+python2.6 (2.6.4-6ubuntu1) lucid; urgency=low
+
+  * Merge with Debian (2.6.4-6).
+
+ -- Matthias Klose <doko@ubuntu.com>  Tue, 16 Feb 2010 01:08:50 +0100
+
+python2.6 (2.6.4-6) unstable; urgency=low
+
+  * Update to 20100215, taken from the 2.6 release branch.
+  * python2.6-minimal: Skip moving syssite contents to new location, if
+    /usr/local/lib/python2.6 cannot be written. Closes: #569532. LP: #338227.
+  * libpython2.6: Fix symlink in /usr/lib/python2.6/config. LP: #521050.
+
+ -- Matthias Klose <doko@debian.org>  Mon, 15 Feb 2010 22:12:18 +0100
+
+python2.6 (2.6.4-5ubuntu1) lucid; urgency=low
+
+  * Merge with Debian (2.6.4-5).
+
+ -- Matthias Klose <doko@ubuntu.com>  Sun, 31 Jan 2010 22:31:41 +0100
+
+python2.6 (2.6.4-5) unstable; urgency=low
+
+  * Update to 20100131, taken from the 2.6 release branch.
+    - Fix typo in os.execvp docstring. Closes: #558764.
+  * distutils.sysconfig.get_python_lib(): Only return ".../dist-packages" if
+    prefix is the default prefix and if PYTHONUSERBASE is not set in the
+    environment and if --user option is not present. LP: #476005.
+  * distutils install: Don't install into /usr/local/local, if option
+    --prefix=/usr/local is present, without changing the install prefix.
+    LP: #510211.
+
+ -- Matthias Klose <doko@debian.org>  Sun, 31 Jan 2010 21:16:51 +0100
+
+python2.6 (2.6.4-4ubuntu1) lucid; urgency=low
+
+  * Update to 20100122, taken from the 2.6 release branch.
+    - Fix DoS via XML document with malformed UTF-8 sequences (CVE_2009_3560).
+      Closes: #566233.
+    - Fix typo in os.execvp docstring. Closes: #558764.
+  * python2.6-doc: Fix searching in local documentation. LP: #456025.
+  * Update locale module from the trunk. LP: #223281.
+  * Merge with Debian (2.6.4-4).
+
+ -- Matthias Klose <doko@ubuntu.com>  Fri, 22 Jan 2010 11:37:29 +0100
+
+python2.6 (2.6.4-4) unstable; urgency=low
+
+  * Update to 20100122, taken from the 2.6 release branch.
+    - Fix DoS via XML document with malformed UTF-8 sequences (CVE_2009_3560).
+      Closes: #566233.
+  * Hurd fixes (Pino Toscano). Closes: #565693:
+    - hurd-broken-poll.dpatch: ported from 2.5.
+    - hurd-disable-nonworking-constants.dpatch: disable a few constants from
+      the public API whose C counterparts are not implemented, so using them
+      either always blocks or always fails (caused issues in the test suite).
+    - Exclude the profiled build for hurd.
+    - Disable four blocking tests from the test suite.
+
+ -- Matthias Klose <doko@debian.org>  Fri, 22 Jan 2010 11:10:41 +0100
+
+python2.6 (2.6.4-3) unstable; urgency=low
+
+  * Disable the profiled build on s390, mips, mipsel.
+  * Fix symbol files for kfreebsd-amd64 and sparc64.
+
+ -- Matthias Klose <doko@debian.org>  Sat, 16 Jan 2010 16:12:17 +0100
+
+python2.6 (2.6.4-2) unstable; urgency=low
+
+  * Update to 20100116, taken from the 2.6 release branch.
+  * Fix bashism in makesetup shell script. Closes: #530170, #530171.
+  * Fix build issues on avr (Bradley Smith). Closes: #528439.
+    - Configure --without-ffi.
+    - Don't run lengthly tests.
+  * locale.py: Update locale aliases from the 2.7 branch.
+
+ -- Matthias Klose <doko@debian.org>  Sat, 16 Jan 2010 11:05:12 +0100
+
+python2.6 (2.6.4-1) experimental; urgency=low
+
+  * Python 2.6.4 final release.
+    - Issue #7120: logging: Removed import of multiprocessing which is causing
+      crash in GAE.
+    - Issue #7149: fix exception in urllib when detecting proxy settings
+      on OSX.
+    - Issue #7115: Fixed the extension module builds that is failing when
+      using paths in the extension name instead of dotted names. LP: #449734.
+    - Issue #6894: Fixed the issue urllib2 doesn't respect "no_proxy"
+      environment.
+    - Issue #7052: Removed nonexisting NullHandler from logging.__all__.
+    - Issue #7039: Fixed distutils.tests.test_sysconfig when running on
+      installation with no build.
+    - Issue #7019: Raise ValueError when unmarshalling bad long data, instead
+      of producing internally inconsistent Python longs.
+  * distutils install: Don't install into /usr/local/local, if option
+    --prefix=/usr/local is present.
+
+ -- Matthias Klose <doko@debian.org>  Tue, 27 Oct 2009 01:22:21 +0100
+
+python2.6 (2.6.4~rc1-1) experimental; urgency=low
+
+  * Python 2.6.4 release candidate 1.
+    - Issue #7052: Removed nonexisting NullHandler from logging.__all__.
+    - Issue #7039: Fixed distutils.tests.test_sysconfig when running on
+      installation with no build.
+    - Issue #7019: Raise ValueError when unmarshalling bad long data, instead
+      of producing internally inconsistent Python longs.
+    - Issue #7068: Fixed the partial renaming that occured in r72594.
+    - Issue #7042: Fix test_signal (test_itimer_virtual) failure on OS X 10.6.
+  * Remove the conflict with python-setuptools (fixed in issue #7068).
+  * Build _hashlib as a builtin.
+  * python2.6-doc: Don't compress the sphinx inventory.
+  * python2.6-doc: Fix jquery.js symlink.
+
+ -- Matthias Klose <doko@debian.org>  Sat, 10 Oct 2009 10:21:02 +0200
+
+python2.6 (2.6.3-1) experimental; urgency=low
+
+  * Final Python 2.6.3 release.
+    - Issue #5329: Fix os.popen* regression from 2.5 with commands as a
+      sequence running through the shell.
+    - Issue #6990: Fix threading.local subclasses leaving old state around
+      after a reference cycle GC which could be recycled by new locals.
+    - Issue #6790: Make it possible again to pass an `array.array` to
+      `httplib.HTTPConnection.send`.
+    - Issue #6922: Fix an infinite loop when trying to decode an invalid
+      UTF-32 stream with a non-raising error handler like "replace" or
+      "ignore".
+    - Issue #1590864: Fix potential deadlock when mixing threads and fork().
+    - Issue #6844: Do not emit DeprecationWarnings when accessing a "message"
+      attribute on exceptions that was set explicitly.
+    - Issue #6236, #6348: Fix various failures in the `io` module under AIX
+      and other platforms, when using a non-gcc compiler. Patch by egreen.
+    - Issue #6851: Fix urllib.urlopen crash on secondairy threads on OSX 10.6
+    - Issue #6947: Fix distutils test on windows. Patch by Hirokazu Yamamoto.
+    - Issue #4606: Passing 'None' if ctypes argtype is set to POINTER(...)
+      does now always result in NULL.
+    - Issue #5042: ctypes Structure sub-subclass does now initialize
+      correctly with base class positional arguments.
+    - Issue #6938: Fix a TypeError in string formatting of a multiprocessing
+      debug message.
+    - Issue #6944: Fix a SystemError when socket.getnameinfo() was called
+      with something other than a tuple as first argument.
+    - Issue #6980: Fix ctypes build failure on armel-linux-gnueabi with
+      -mfloat-abi=softfp.
+  * python2.6-dbg: Don't create debug subdirectory in /usr/local. No
+    separate debug directory needed anymore.
+  * Run the benchmark with -C 2 -n 5 -w 4 on all architectures.
+  * Build-depend on the versioned db4.x-dev to avoid unexpected updates
+    for anydbm databases.
+
+ -- Matthias Klose <doko@debian.org>  Sat, 03 Oct 2009 13:19:56 +0200
+
+python2.6 (2.6.2-3) experimental; urgency=low
+
+  * Update to 20090919, taken from the 2.6 release branch.
+  * Add a conflict to python-setuptools (<< 0.6c9-3), C extension
+    builds broken.
+  * Add new symbols for update from the branch.
+
+ -- Matthias Klose <doko@debian.org>  Sat, 19 Sep 2009 10:36:34 +0200
+
+python2.6 (2.6.2-2) experimental; urgency=low
+
+  * Symbol _Py_force_double@Base is i386 only. Closes: #534208.
+
+ -- Matthias Klose <doko@debian.org>  Tue, 23 Jun 2009 06:14:40 +0200
+
+python2.6 (2.6.2-1) experimental; urgency=low
+
+  * Final Python 2.6.2 release.
+    - Update Doc/tools/sphinxext/download.html. Closes: #526797.
+  * Update to 20090621, taken from the 2.6 release branch.
+	
+  * Address issues when working with PYTHONUSERBASE and non standard prefix
+    (pointed out by Larry Hastings):
+    - distutils.sysconfig.get_python_lib(): Only return ".../dist-packages" if
+      prefix is the default prefix and if PYTHONUSERBASE is not set in the
+      environment.
+    - site.addusersitepackages(): Add USER_BASE/.../dist-packages to sys.path.
+  * Always use the `unix_prefix' scheme for setup.py install in a virtualenv
+    setup. LP: #339904.
+  * Don't make the setup.py install options --install-layout=deb and --prefix
+    conflict with each other.
+  * distutils: Always install into `/usr/local/lib/python2.6/dist-packages'
+    if an option `--prefix=/usr/local' is present (except for virtualenv
+    and PYTHONUSERBASE installations). LP: #362570.
+  * Always use `site-packages' as site directory name in virtualenv.
+
+  * Do not add /usr/lib/pythonXY.zip on sys.path.
+  * Add symbols files for libpython2.6 and python2.6-dbg, don't include symbols
+    from builtins, which can either be built as builtins or extensions.
+  * Keep an empty lib-dynload in python2.6-minimal to avoid a warning on
+    startup.
+  * Build a shared library configured --with-pydebug. LP: #322580.
+  * Fix some lintian warnings.
+  * Use the information in /etc/lsb-release for platform.dist(). LP: #196526.
+  * Move the bdist_wininst files into the -dev package (only needed to build
+    windows installers).
+  * Document changes to the site directory name in the installation manual.
+  * Fix issue #1113244: Py_XINCREF, Py_DECREF, Py_XDECREF: Add
+   `do { ... } while (0)' to avoid compiler warnings. Closes: #516956.
+  * debian/pyhtml2devhelp.py: update for python 2.6 (Marc Deslauriers).
+  * debian/rules: re-enable documentation files for devhelp. LP: #338791.
+  * python2.6-doc: Depend on libjs-jquery, use jquery.js from this package.
+    Closes: #523482.
+
+ -- Matthias Klose <doko@debian.org>  Sun, 21 Jun 2009 16:12:15 +0200
+
+python2.6 (2.6.1-3) experimental; urgency=low
+
+  * Update to 20090318, taken from the 2.6 release branch.
+  * Use the information in /etc/lsb-release for platform.dist().
+  * Update installation schemes: LP: #338395. Closes: #520278.
+    - When the --prefix option is used for setup.py install, Use the
+      `unix_prefix' scheme.
+    - Use the `deb_system' scheme if --install-layout=deb is specified.
+    - Use the the `unix_local' scheme if neither --install-layout=deb
+      nor --prefix is specified.
+    - The options --install-layout=deb and --prefix are exclusive.
+  * Don't fail installation/removal if directories in /usr/local cannot
+    be created. LP: #338227.
+  * Don't try to move away the site-packages directory. There never was a
+    python2.6 upload using site-packages. Closes: #518780.
+  * Fix build failure on mips/mipsel. Closes: #519386.
+
+ -- Matthias Klose <doko@debian.org>  Wed, 18 Mar 2009 22:17:20 +0100
+
+python2.6 (2.6.1-2) experimental; urgency=low
+
+  * Move libpython2.6.a into the python2.6-dev package.
+  * Move idlelib into the idle-python2.6 package.
+
+ -- Matthias Klose <doko@debian.org>  Wed, 25 Feb 2009 18:42:19 +0100
+
+python2.6 (2.6.1-1) experimental; urgency=low
+
+  * New upstream version, upload to experimental.
+  * Update to 20090225, taken from the 2.6 release branch.
+  * Don't build-depend on locales on armel, hppa, ia64 and mipsel; package is
+    currently not installable.
+
+ -- Matthias Klose <doko@debian.org>  Wed, 25 Feb 2009 18:42:19 +0100
+
+python2.6 (2.6.1-0ubuntu9) jaunty; urgency=low
+
+  * Don't build pyexpat, _elementtree and _ctypes as builtin extensions,
+    third party packages make too many assumptions about these not built
+    as builtins.
+
+ -- Matthias Klose <doko@ubuntu.com>  Tue, 24 Feb 2009 16:34:27 +0100
+
+python2.6 (2.6.1-0ubuntu8) jaunty; urgency=low
+
+  * Link the shared libpython with $(MODLIBS).
+
+ -- Matthias Klose <doko@ubuntu.com>  Sun, 22 Feb 2009 16:38:49 +0100
+
+python2.6 (2.6.1-0ubuntu7) jaunty; urgency=low
+
+  * Update to 20090222, taken from the 2.6 release branch.
+
+ -- Matthias Klose <doko@ubuntu.com>  Sun, 22 Feb 2009 10:35:29 +0100
+
+python2.6 (2.6.1-0ubuntu6) jaunty; urgency=low
+
+  * Don't build the gdbm extension from the python2.6 source.
+  * Build the dbm extension using libdb.
+  * Don't build-depend on locales on sparc (currently not installable), only
+    needed by the testsuite.
+  * Update to 20090219, taken from the 2.6 release branch.
+
+ -- Matthias Klose <doko@ubuntu.com>  Thu, 19 Feb 2009 12:43:20 +0100
+
+python2.6 (2.6.1-0ubuntu5) jaunty; urgency=low
+
+  * Add build dependency on libdb-dev.
+
+ -- Matthias Klose <doko@ubuntu.com>  Mon, 16 Feb 2009 13:34:41 +0100
+
+python2.6 (2.6.1-0ubuntu4) jaunty; urgency=low
+
+  * Disable the profiled build on all architectures.
+
+ -- Matthias Klose <doko@ubuntu.com>  Mon, 16 Feb 2009 11:18:51 +0100
+
+python2.6 (2.6.1-0ubuntu3) jaunty; urgency=low
+
+  * Disable the profiled build on armel as well.
+
+ -- Matthias Klose <doko@ubuntu.com>  Sun, 15 Feb 2009 10:38:02 +0100
+
+python2.6 (2.6.1-0ubuntu2) jaunty; urgency=low
+
+  * Don't use the profiled build on amd64, lpia and sparc (GCC
+    PR profile/38292).
+
+ -- Matthias Klose <doko@ubuntu.com>  Sat, 14 Feb 2009 14:09:34 +0100
+
+python2.6 (2.6.1-0ubuntu1) jaunty; urgency=low
+
+  * Update to 20090211, taken from the 2.6 release branch.
+
+ -- Matthias Klose <doko@ubuntu.com>  Fri, 13 Feb 2009 12:51:00 +0100
+
+python2.6 (2.6.1-0ubuntu1~ppa1) jaunty; urgency=low
+
+  * Python 2.6.1 release.
+  * Update to 20081206, taken from the 2.6 release branch.
+  * Ensure that all extensions from the -minimal package are statically
+    linked into the interpreter.
+  * Include expat, _elementtree, datetime, bisect, _bytesio, _locale,
+    _fileio in -minimal to link these extensions statically.
+
+ -- Matthias Klose <doko@ubuntu.com>  Fri, 05 Dec 2008 20:43:51 +0100
+
+python2.6 (2.6-0ubuntu1~ppa5) intrepid; urgency=low
+
+  * Test build
+
+ -- Matthias Klose <doko@ubuntu.com>  Fri, 14 Nov 2008 10:14:38 +0100
+
+python2.6 (2.6-0ubuntu1~ppa4) intrepid; urgency=low
+
+  * Do not build the bsddb3 module from this source, but recommend the
+    python-bsddb3 package (will be a dependency after python-bsddb3 is in
+    the archive).
+   * For locally installed packages, create a directory
+    /usr/local/lib/python2.6/dist-packages. This is the default for
+    installations done with distutils and setuptools. Third party stuff
+    packaged within the distribution goes to /usr/lib/python2.6/dist-packages.
+    There is no /usr/lib/python2.6/site-packages in the file system and
+    on sys.path. No package within the distribution must not install
+    anything in this location.
+  * Place the gdbm extension into the python2.6 package.
+  * distutils: Add an option --install-layout=deb, which
+    - installs into $prefix/dist-packages instead of $prefix/site-packages.
+    - doesn't encode the python version into the egg name.
+
+ -- Matthias Klose <doko@ubuntu.com>  Sat, 25 Oct 2008 11:12:24 +0000
+
+python2.6 (2.6-0ubuntu1~ppa3) intrepid; urgency=low
+
+  * Build-depend on libdb4.6-dev, instead of libdb-dev (4.7). Test suite
+    hangs in the bsddb tests.
+
+ -- Matthias Klose <doko@ubuntu.com>  Wed, 22 Oct 2008 11:05:13 +0200
+
+python2.6 (2.6-0ubuntu1~ppa2) intrepid; urgency=low
+
+  * Update to 20081021, taken from the 2.6 release branch.
+  * Fix typos and section names in doc-base files. LP: #273344.
+  * Build a new package libpython2.6.
+  * For locally installed packages, create a directory
+    /usr/local/lib/python2.6/system-site-packages, which is symlinked
+    from /usr/lib/python2.6/site-packages. Third party stuff packaged
+    within the distribution goes to /usr/lib/python2.6/dist-packages.
+
+ -- Matthias Klose <doko@ubuntu.com>  Tue, 21 Oct 2008 18:09:31 +0200
+
+python2.6 (2.6-0ubuntu1~ppa1) intrepid; urgency=low
+
+  * Python 2.6 release.
+  * Update to current branch 20081009.
+
+ -- Matthias Klose <doko@ubuntu.com>  Thu, 09 Oct 2008 14:28:26 +0200
+
+python2.6 (2.6~b3-0ubuntu1~ppa1) intrepid; urgency=low
+
+  * Python 2.6 beta3 release.
+
+ -- Matthias Klose <doko@ubuntu.com>  Sun, 24 Aug 2008 01:34:54 +0000
+
+python2.6 (2.6~b2-0ubuntu1~ppa1) intrepid; urgency=low
+
+  * Python 2.6 beta2 release.
+
+ -- Matthias Klose <doko@ubuntu.com>  Thu, 07 Aug 2008 16:45:56 +0200
+
+python2.6 (2.6~b1-0ubuntu1~ppa1) intrepid; urgency=low
+
+  * Python 2.6 beta1 release.
+
+ -- Matthias Klose <doko@ubuntu.com>  Tue, 15 Jul 2008 12:57:20 +0000
+
+python2.6 (2.6~a3-0ubuntu1~ppa2) hardy; urgency=low
+
+  * Test build
+
+ -- Matthias Klose <doko@ubuntu.com>  Thu, 29 May 2008 18:08:48 +0200
+
+python2.6 (2.6~a3-0ubuntu1~ppa1) hardy; urgency=low
+
+  * Python 2.6 alpha3 release.
+  * Update to current trunk 20080523.
+
+ -- Matthias Klose <doko@ubuntu.com>  Thu, 22 May 2008 17:37:46 +0200
+
+python2.5 (2.5.2-5) unstable; urgency=low
+
+  * Backport new function signal.set_wakeup_fd from the trunk.
+    Background: http://bugzilla.gnome.org/show_bug.cgi?id=481569
+
+ -- Matthias Klose <doko@debian.org>  Wed, 30 Apr 2008 12:05:10 +0000
+
+python2.5 (2.5.2-4) unstable; urgency=low
+
+  * Update to 20080427, taken from the 2.5 release branch.
+    - Fix issues #2670, #2682.
+  * Disable running pybench on the hppa buildd (ftbfs).
+  * Allow setting BASECFLAGS, OPT and EXTRA_LDFLAGS (like, CC, CXX, CPP,
+    CFLAGS, CPPFLAGS, CCSHARED, LDSHARED) from the environment.
+  * Support parallel=<n> in DEB_BUILD_OPTIONS (see #209008).
+
+ -- Matthias Klose <doko@debian.org>  Sun, 27 Apr 2008 10:40:51 +0200
+
+python2.5 (2.5.2-3) unstable; urgency=medium
+
+  * Update to 20080416, taken from the 2.5 release branch.
+    - Fix CVE-2008-1721, integer signedness error in the zlib extension module.
+    - Fix urllib2 file descriptor happens byte-at-a-time, reverting
+      a fix for excessively large memory allocations when calling .read()
+      on a socket object wrapped with makefile(). 
+  * Disable some regression tests on some architectures:
+    - arm: test_compiler, test_ctypes.
+    - armel: test_compiler.
+    - hppa: test_fork1, test_wait3.
+    - m68k: test_bsddb3, test_compiler.
+  * Build-depend on libffi-dev instead of libffi4-dev.
+  * Fix CVE-2008-1679, integer overflows in the imageop module.
+
+ -- Matthias Klose <doko@debian.org>  Wed, 16 Apr 2008 23:37:46 +0200
+
+python2.5 (2.5.2-2) unstable; urgency=low
+
+  * Use site.addsitedir() to add directories in /usr/local to sys.path.
+    Addresses: #469157, #469818.
+
+ -- Matthias Klose <doko@debian.org>  Sat, 08 Mar 2008 16:11:23 +0100
+
+python2.5 (2.5.2-1) unstable; urgency=low
+
+  * Python 2.5.2 release.
+  * Merge from Ubuntu:
+    - Move site customization into sitecustomize.py, don't make site.py
+      a config file. Addresses: #309719, #413172, #457361.
+    - Move site.py to python2.4-minimal, remove `addbuilddir' from site.py,
+      which is unnecessary for installed builds.
+    - python2.5-dev: Recommend libc-dev instead of suggesting it. LP: #164909.
+    - Fix issue 961805, Tk Text.edit_modified() fails. LP: #84720.
+
+ -- Matthias Klose <doko@debian.org>  Thu, 28 Feb 2008 23:18:52 +0100
+
+python2.5 (2.5.1-7) unstable; urgency=low
+
+  * Update to 20080209, taken from the 2.5 release branch.
+  * Build the _bsddb extension with db-4.5 again; 4.6 is seriously
+    broken when used with the _bsddb extension.
+  * Do not run pybench on arm and armel.
+  * python2.5: Provide python2.5-wsgiref.
+  * Fix a pseudo RC report with duplicated attributes in the control
+    file. Closes: #464307.
+
+ -- Matthias Klose <doko@debian.org>  Sun, 10 Feb 2008 00:22:57 +0100
+
+python2.5 (2.5.1-6) unstable; urgency=low
+
+  * Update to 20080102, taken from the 2.5 release branch.
+    - Only define _BSD_SOURCE on OpenBSD systems. Closes: #455400.
+  * Fix handling of packages in linecache.py (Kevin Goodsell). LP: #70902.
+  * Bump debhelper to v5.
+  * Register binfmt for .py[co] files.
+  * Use absolute paths when byte-compiling files. Addresses: #453346.
+    Closes: #413566, LP: #177722.
+  * CVE-2007-4965, http://bugs.python.org/issue1179:
+    Multiple integer overflows in the imageop module in Python 2.5.1 and
+    earlier allow context-dependent attackers to cause a denial of service
+    (application crash) and possibly obtain sensitive information (memory
+    contents) via crafted arguments to (1) the tovideo method, and unspecified
+    other vectors related to (2) imageop.c, (3) rbgimgmodule.c, and other
+    files, which trigger heap-based buffer overflows.
+    Patch prepared by Stephan Herrmann. Closes: #443333, LP: #163845.
+  * Register info docs when doing source only uploads. LP: #174786.
+  * Remove deprecated value from categories in desktop file. LP: #172874.
+  * python2.5-dbg: Don't include the gdbm and _tkinter extensions, now provided
+    in separate packages.
+  * Provide a symlink changelog -> NEWS. Closes: #439271.
+  * Fix build failure on hurd, working around poll() on systems on which it
+    returns an error on invalid FDs. Closes: #438914.
+  * Configure --with-system-ffi on all architectures. Closes: #448520.
+  * Fix version numbers in copyright and README files (Dan O'Huiginn).
+    Closes: #446682.
+  * Move some documents from python2.5 to python2.5-dev.
+
+ -- Matthias Klose <doko@debian.org>  Wed, 02 Jan 2008 22:22:19 +0100
+
+python2.5 (2.5.1-5) unstable; urgency=low
+
+  * Build the _bsddb extension with db-4.6.
+
+ -- Matthias Klose <doko@debian.org>  Fri, 17 Aug 2007 00:39:35 +0200
+
+python2.5 (2.5.1-4) unstable; urgency=low
+
+  * Update to 20070813, taken from the 2.5 release branch.
+  * Include plat-mac/plistlib.py (plat-mac is not in sys.path by default.
+    Closes: #435826.
+  * Use emacs22 to build the documentation in info format. Closes: #434969.
+  * Build-depend on db-dev (>= 4.6). Closes: #434965.
+
+ -- Matthias Klose <doko@debian.org>  Mon, 13 Aug 2007 22:22:44 +0200
+
+python2.5 (2.5.1-3) unstable; urgency=high
+
+  * Support mixed-endian IEEE floating point, as found in the ARM old-ABI
+    (Aurelien Jarno). Closes: #434905.
+
+ -- Matthias Klose <doko@debian.org>  Fri, 27 Jul 2007 20:01:35 +0200
+
+python2.5 (2.5.1-2) unstable; urgency=low
+
+  * Update to 20070717, taken from the 2.5 release branch.
+  * Fix reference count for sys.pydebug variable. Addresses: #431393.
+  * Build depend on libbluetooth-dev instead of libbluetooth2-dev.
+
+ -- Matthias Klose <doko@debian.org>  Tue, 17 Jul 2007 14:09:47 +0200
+
+python2.5 (2.5.1-1) unstable; urgency=low
+
+  * Python-2.5.1 release.
+  * Build-depend on gcc-4.1 (>= 4.1.2-4) on alpha, powerpc, s390, sparc.
+  * Merge from Ubuntu:
+    - Add debian/patches/subprocess-eintr-safety.dpatch (LP: #87292):
+      - Create and use wrappers around read(), write(), and os.waitpid() in the
+        subprocess module which retry the operation on an EINTR (which happens
+        if e. g. an alarm was raised while the system call was in progress).
+        It is incredibly hard and inconvenient to sensibly handle this in
+        applications, so let's fix this at the right level.
+      - Patch based on original proposal of Peter <C3><85>strand
+        in http://python.org/sf/1068268.
+      - Add two test cases.
+    - Change the interpreter to build and install python extensions
+      built with the python-dbg interpreter with a different name into
+      the same path (by appending `_d' to the extension name). The debug build
+      of the interpreter tries to first load a foo_d.so or foomodule_d.so
+      extension, then tries again with the normal name.
+    - When trying to import the profile and pstats modules, don't
+      exit, add a hint to the exception pointing to the python-profiler
+      package, don't exit.
+    - Keep the module version in the .egg-info name, only remove the
+      python version.
+    - python2.5-dbg: Install Misc/SpecialBuilds.txt, document the
+      debug changes in README.debug.
+  * Update to 20070425, taken from the 2.5 release branch.
+
+ -- Matthias Klose <doko@debian.org>  Wed, 25 Apr 2007 22:12:50 +0200
+
+python2.5 (2.5-6) unstable; urgency=medium
+
+  * webbrowser.py: Recognize other browsers: www-browser, x-www-browser,
+    iceweasel, iceape.
+  * Move pyconfig.h from the python2.5-dev into the python2.5 package;
+    required by builds for pure python modules without having python2.5-dev
+    installed (matching the functionality in python2.4).
+  * Move the unicodedata module into python2.5-minimal; allows byte compilation
+    of UTF8 encoded files.
+  * Do not install anymore outdated debhelper sample scripts.
+  * Install Misc/SpecialBuilds.txt as python2.5-dbg document.
+
+ -- Matthias Klose <doko@debian.org>  Wed, 21 Feb 2007 01:17:12 +0100
+
+python2.5 (2.5-5) unstable; urgency=high
+
+  * Do not run the python benchmark on m68k. Timer problems.
+    Fixes FTBFS on m68k.
+  * Update to 20061209, taken from the 2.5 release branch.
+    -  Fixes building the library reference in info format.
+
+ -- Matthias Klose <doko@debian.org>  Sat,  9 Dec 2006 13:40:48 +0100
+
+python2.5 (2.5-4) unstable; urgency=medium
+
+  * Update to 20061203, taken from the 2.5 release branch.
+    - Fixes build failures on knetfreebsd and the hurd. Closes: #397000.
+  * Clarify README about distutils. Closes: #396394.
+  * Move python2.5-config to python2.5-dev. Closes: #401451.
+  * Cleanup build-conflicts. Addresses: #394512.
+
+ -- Matthias Klose <doko@debian.org>  Sun,  3 Dec 2006 18:22:49 +0100
+
+python2.5 (2.5-3.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * python2.5-minimal depends on python-minimal (>= 2.4.4-1) because it's the
+    first version which lists python2.5 as an unsupported runtime (ie a
+    runtime that is available but for which modules are not auto-compiled).
+    And being listed there is required for python-central to accept the
+    installation of python2.5-minimal. Closes: #397006
+
+ -- Raphael Hertzog <hertzog@debian.org>  Wed, 22 Nov 2006 15:41:06 +0100
+
+python2.5 (2.5-3) unstable; urgency=medium
+
+  * Update to 20061029 (2.4.4 was released on 20061019), taken from
+    the 2.5 release branch. We do not want to have regressions in
+    2.5 compared to the 2.4.4 release.
+  * Don't run pybench on m68k, fails in the calibration loop. Closes: #391030.
+  * Run the installation/removal hooks. Closes: #383292, #391036.
+
+ -- Matthias Klose <doko@debian.org>  Sun, 29 Oct 2006 11:35:19 +0100
+
+python2.5 (2.5-2) unstable; urgency=medium
+
+  * Update to 20061003, taken from the 2.5 release branch.
+  * On arm and m68k, don't run the pybench in debug mode.
+  * Fix building the source within exec_prefix (Alexander Wirt).
+    Closes: #385336.
+
+ -- Matthias Klose <doko@debian.org>  Tue,  3 Oct 2006 10:08:36 +0200
+
+python2.5 (2.5-1) unstable; urgency=low
+
+  * Python 2.5 release.
+  * Update to 20060926, taken from the 2.5 release branch.
+  * Run the Python benchmark during the build, compare the results
+    of the static and shared builds.
+  * Fix invalid html in python2.5.devhelp.gz.
+  * Add a python2.5 console entry to the menu (hidden by default).
+  * python2.5: Suggest python-profiler.
+
+ -- Matthias Klose <doko@debian.org>  Tue, 26 Sep 2006 02:36:11 +0200
+
+python2.5 (2.5~c1-1) unstable; urgency=low
+
+  * Python 2.5 release candidate 1.
+  * Update to trunk 20060818.
+
+ -- Matthias Klose <doko@debian.org>  Sat, 19 Aug 2006 19:21:05 +0200
+
+python2.5 (2.5~b3-1) unstable; urgency=low
+
+  * Build the _ctypes module for m68k-linux.
+
+ -- Matthias Klose <doko@debian.org>  Fri, 11 Aug 2006 18:19:19 +0000
+
+python2.5 (2.5~b3-0ubuntu1) edgy; urgency=low
+
+  * Python 2.5 beta3 release.
+  * Update to trunk 20060811.
+  * Rebuild the documentation.
+  * Fix value of sys.exec_prefix in the debug build.
+  * Do not build the library reference in info format; fails to build.
+  * Link the interpreter against the shared runtime library. With
+    gcc-4.1 the difference in the pystones benchmark dropped from about
+    12% to about 6%.
+  * Install the statically linked version of the interpreter as
+    python2.5-static for now.
+  * Link the shared libpython with -O1.
+
+ -- Matthias Klose <doko@ubuntu.com>  Thu, 10 Aug 2006 14:04:48 +0000
+
+python2.5 (2.4.3+2.5b2-3) unstable; urgency=low
+
+  * Disable the testsuite on s390; don't care about "minimally configured"
+    buildd's.
+
+ -- Matthias Klose <doko@debian.org>  Sun, 23 Jul 2006 11:45:03 +0200
+
+python2.5 (2.4.3+2.5b2-2) unstable; urgency=low
+
+  * Update to trunk 20060722.
+  * Merge idle-lib from idle-python2.5 into python2.5.
+  * Merge lib-tk from python-tk into python2.5.
+  * Tkinter.py: Suggest installation of python-tk package on failed
+    import of the _tkinter extension.
+  * Don't run the testsuite for the debug build on alpha.
+  * Don't run the test_compiler test on m68k. Just takes too long.
+  * Disable building ctypes on m68k (requires support for closures).
+
+ -- Matthias Klose <doko@debian.org>  Sat, 22 Jul 2006 22:26:42 +0200
+
+python2.5 (2.4.3+2.5b2-1) unstable; urgency=low
+
+  * Python 2.5 beta2 release.
+  * Update to trunk 20060716.
+  * When built on a buildd, do not run the following test which try to
+    access the network: test_codecmaps_cn, test_codecmaps_hk, test_codecmaps_jp,
+    test_codecmaps_kr, test_codecmaps_tw, test_normalization.
+  * When built on a buildd, do not run tests requiring missing write permissions:
+    test_ossaudiodev.
+
+ -- Matthias Klose <doko@debian.org>  Sun, 16 Jul 2006 02:53:50 +0000
+
+python2.5 (2.4.3+2.5b2-0ubuntu1) edgy; urgency=low
+
+  * Python 2.5 beta2 release.
+
+ -- Matthias Klose <doko@ubuntu.com>  Thu, 13 Jul 2006 17:16:52 +0000
+
+python2.5 (2.4.3+2.5b1-1ubuntu2) edgy; urgency=low
+
+  * Fix python-dev dependencies.
+  * Update to trunk 20060709.
+
+ -- Matthias Klose <doko@ubuntu.com>  Sun,  9 Jul 2006 18:50:32 +0200
+
+python2.5 (2.4.3+2.5b1-1ubuntu1) edgy; urgency=low
+
+  * Python 2.5 beta1 release.
+  * Update to trunk 20060623.
+  * Merge changes from the python2.4 packages.
+  * python2.5-minimal: Add _struct.
+
+ -- Matthias Klose <doko@ubuntu.com>  Fri, 23 Jun 2006 16:04:46 +0200
+
+python2.5 (2.4.3+2.5a1-1) experimental; urgency=low
+
+  * Update to trunk 20060409.
+  * Run testsuite for debug build as well.
+  * Build-depend on gcc-4.1.
+
+ -- Matthias Klose <doko@debian.org>  Sun,  9 Apr 2006 22:27:05 +0200
+
+python2.5 (2.4.3+2.5a1-0ubuntu1) dapper; urgency=low
+
+  * Python 2.5 alpha1 release.
+  * Drop integrated patches.
+  * Add build dependencies on libsqlite3-dev and libffi4-dev.
+  * Add (build-)dependency on mime-support, libgpmg1 (test suite).
+  * Build using the system FFI.
+  * python2.5 provides python2.5-ctypes and python2.5-pysqlite2,
+    python2.5-elementtree.
+  * Move hashlib.py to python-minimal.
+  * Lib/hotshot/pstats.py: Error out on missing profile/pstats modules.
+
+ -- Matthias Klose <doko@ubuntu.com>  Wed,  5 Apr 2006 14:56:15 +0200
+
+python2.4 (2.4.3-8ubuntu1) edgy; urgency=low
+
+  * Resynchronize with Debian unstable. Remaining changes:
+    - Apply langpack-gettext patch.
+    - diff.gz contains pregenerated html and info docs.
+    - Build the -doc package from this source.
+
+ -- Matthias Klose <doko@ubuntu.com>  Thu, 22 Jun 2006 18:39:57 +0200
+
+python2.4 (2.4.3-8) unstable; urgency=low
+
+  * Remove python2.4's dependency on python-central. On installation of
+    the runtime, call hooks /usr/share/python/runtime.d/*.rtinstall.
+    On removal, call hooks /usr/share/python/runtime.d/*.rtremove.
+    Addresses: #372658.
+  * Call the rtinstall hooks only, if it's a new installation, or the first
+    installation using the hooks. Adresses: #373677.
+
+ -- Matthias Klose <doko@debian.org>  Sun, 18 Jun 2006 00:56:13 +0200
+
+python2.4 (2.4.3-7) unstable; urgency=medium
+
+  * Reupload, depend on python-central (>= 0.4.15).
+  * Add build-conflict on python-xml.
+
+ -- Matthias Klose <doko@debian.org>  Wed, 14 Jun 2006 18:56:57 +0200
+
+python2.4 (2.4.3-6) medium; urgency=low
+
+  * idle-python2.4: Remove the old postinst and prerm scripts.
+  * Name the runtime correctly in python2.4-minimal's installation
+    scripts.
+
+ -- Matthias Klose <doko@debian.org>  Mon, 12 Jun 2006 17:39:56 +0000
+
+python2.4 (2.4.3-5) unstable; urgency=low
+
+  * python2.4-prerm: Handle the case, when python-central is not installed.
+  * idle-python2.4: Depend on python-tk instead of python2.4-tk.
+
+ -- Matthias Klose <doko@debian.org>  Fri,  9 Jun 2006 05:17:17 +0200
+
+python2.4 (2.4.3-4) unstable; urgency=low
+
+  * SVN update up to 2006-06-07
+  * Use python-central.
+  * Don't build the -tk and -gdbm packages from this source; now built
+    from the python-stdlib-extensions source.
+  * Remove leftover build dependency on libgmp3-dev.
+  * Do not build-depend on libbluetooth1-dev and libgpmg1-dev on
+    hurd-i386, kfreebsd-i386, kfreebsd-amd64. Closes: #365830.
+  * Do not run the test_tcl test; hangs for unknown reasons on at least
+    the following buildds: vivaldi(m68k), goedel (alpha), mayer (mipsel).
+    And no virtual package to file bug reports for the buildds ...
+    Closes: #364419.
+  * Move the Makefile from python2.4-dev to python2.4. Closes: #366473.
+  * Fix typo in pdb(1). Closes: #365772.
+  * New autoconf likes the mandir in /usr/share instead of /usr; work
+    with both locations. Closes: #367618.
+	
+ -- Matthias Klose <doko@debian.org>  Wed,  7 Jun 2006 21:37:20 +0200
+
+python2.4 (2.4.3-3) unstable; urgency=low
+
+  * SVN update up to 2006-04-21
+  * Update locale aliases from /usr/share/X11/locale/locale.alias.
+  * Start idle with option -n from the desktop menu, so that the program
+    can be started in parallel.
+  * Testsuite related changes only:
+    - Add build dependencies mime-support, libgpmg1 (needed by test cases).
+    - Run the testsuite with bsddb, audio and curses resources enabled.
+    - Re-run the failed tests in verbose mode.
+    - Run the test suite for the debug build as well.
+    - Build depend on netbase, needed by test_socketmodule.
+    - Build depend on libgpmg1, needed by test_curses.
+    - On the buildds do not run the tests needing the network resource.
+  * Update python logo.
+  * Check for the availability of the profile and pstats modules when
+    importing hotshot.pstats. Closes: #334067.
+  * Don't build the -doc package from the python2.4 source.
+  * Set OPT in the installed Makefile to -O2.
+
+ -- Matthias Klose <doko@debian.org>  Fri, 21 Apr 2006 19:58:43 +0200
+
+python2.4 (2.4.3-2) unstable; urgency=low
+
+  * Add (build-)dependency on mime-support.
+
+ -- Matthias Klose <doko@ubuntu.com>  Tue,  4 Apr 2006 22:21:41 +0200
+
+python2.4 (2.4.3-1) unstable; urgency=low
+
+  * Python 2.4.3 release.
+
+ -- Matthias Klose <doko@debian.org>  Thu, 30 Mar 2006 23:42:37 +0200
+
+python2.4 (2.4.3-0ubuntu1) dapper; urgency=low
+
+  * Python 2.4.3 release.
+    - Fixed a bug that the gb18030 codec raises RuntimeError on encoding
+      surrogate pair area on UCS4 build. Ubuntu: #29289.
+
+ -- Matthias Klose <doko@ubuntu.com>  Thu, 30 Mar 2006 10:57:32 +0200
+
+python2.4 (2.4.2+2.4.3c1-0ubuntu1) dapper; urgency=low
+
+  * SVN update up to 2006-03-25 (2.4.3 candidate 1).
+    - Regenerate the documentation.
+
+ -- Matthias Klose <doko@ubuntu.com>  Mon, 27 Mar 2006 12:03:05 +0000
+
+python2.4 (2.4.2-1ubuntu3) dapper; urgency=low
+
+  * SVN update up to 2006-03-04
+    - Regenerate the documentation.
+    - map.mmap(-1, size, ...) can return anonymous memory again on Unix.
+      Ubuntu #26201.
+  * Build-depend on libncursesw5-dev, ncursesw5 is preferred for linking.
+    Provides UTF-8 compliant curses bindings.
+  * Fix difflib where certain patterns of differences were making difflib
+    touch the recursion limit.
+
+ -- Matthias Klose <doko@ubuntu.com>  Sat,  4 Mar 2006 21:38:24 +0000
+
+python2.4 (2.4.2-1ubuntu2) dapper; urgency=low
+
+  * SVN update up to 2006-01-17
+    - pwd is now a builtin module, remove it from python-minimal.
+    - Regenerate the documentation.
+  * python2.4-tk: Suggest tix instead of tix8.1.
+  * Move config/Makefile from the -dev package into the runtime package
+    to be able to use the bdist_wininst distutils command. Closes: #348335.
+
+ -- Matthias Klose <doko@ubuntu.com>  Tue, 17 Jan 2006 11:02:24 +0000
+
+python2.4 (2.4.2-1ubuntu1) dapper; urgency=low
+
+  * Temporarily remove build dependency on lsb-release.
+
+ -- Matthias Klose <doko@ubuntu.com>  Sun, 20 Nov 2005 17:40:18 +0100
+
+python2.4 (2.4.2-1build1) dapper; urgency=low
+
+  * Rebuild (openssl-0.9.8).
+
+ -- Matthias Klose <doko@ubuntu.com>  Sun, 20 Nov 2005 15:27:24 +0000
+
+python2.4 (2.4.2-1) unstable; urgency=low
+
+  * Python 2.4.2 release.
+
+ -- Matthias Klose <doko@debian.org>  Thu, 29 Sep 2005 01:49:28 +0200
+
+python2.4 (2.4.1+2.4.2rc1-1) unstable; urgency=low
+
+  * Python 2.4.2 release candidate 1.
+  * Fix "Fatal Python error" from cStringIO's writelines.
+    Patch by Andrew Bennetts.
+
+ -- Matthias Klose <doko@debian.org>  Thu, 22 Sep 2005 10:33:22 +0200
+
+python2.4 (2.4.1-5) unstable; urgency=low
+
+  * CVS update up to 2005-09-14
+    - Regenerate the html and info docs.
+  * Add some more locale aliases.
+  * Fix substitution pf python version in README.python2.4-minimal.
+    Closes: #327487.
+  * On m68k, build using -O2 (closes: #326903).
+  * On Debian, don't configure --with-fpectl, which stopped working with
+    glibc-2.3.5.
+
+ -- Matthias Klose <doko@debian.org>  Wed, 14 Sep 2005 17:32:56 +0200
+
+python2.4 (2.4.1-4) unstable; urgency=low
+
+  * CVS update up to 2005-09-04
+    - teTeX 3.0 related fixes (closes: #322407).
+    - Regenerate the html and info docs.
+  * Add entry for IDLE in the Gnome menus.
+  * Don't build-depend on libbluetooth-dev on the Hurd (closes: #307037).
+  * Reenable the cthreads patch for the Hurd (closes: #307052).
+
+ -- Matthias Klose <doko@debian.org>  Sun,  4 Sep 2005 18:31:42 +0200
+
+python2.4 (2.4.1-3) unstable; urgency=low
+
+  * Synchronise with Ubuntu:
+    - Build a python2.4-minimal package.
+
+ -- Matthias Klose <doko@debian.org>  Tue, 12 Jul 2005 00:23:10 +0000
+
+python2.4 (2.4.1-2ubuntu3) breezy; urgency=low
+
+  * CVS update up to 2005-07-07
+  * Regenerate the documentation.
+
+ -- Matthias Klose <doko@ubuntu.com>  Thu,  7 Jul 2005 09:21:28 +0200
+
+python2.4 (2.4.1-2ubuntu2) breezy; urgency=low
+
+  * CVS update up to 2005-06-15
+  * Regenerate the documentation.
+  * Synchronize with Debian. Ubuntu 10485.
+  * idle-python2.4 enhances python2.4. Ubuntu 11562.
+  * README.Debian: Fix reference to the doc directory (closes: #311677).
+
+ -- Matthias Klose <doko@debian.org>  Wed, 15 Jun 2005 08:56:57 +0200
+
+python2.4 (2.4.1-2ubuntu1) breezy; urgency=low
+
+  * Update build dependencies:
+      db4.2-dev -> db4.3-dev,
+      libreadline4-dev -> libreadline5-dev.
+  * python2.4-dev: Add missing templates to generate HTML docs. Ubuntu 11531.
+
+ -- Matthias Klose <doko@ubuntu.com>  Sun, 29 May 2005 00:01:05 +0200
+
+python2.4 (2.4.1-2) unstable; urgency=low
+
+  * Add the debug symbols for the python2.4, python2.4-gdbm
+    and python2.4-tk packages to the python2.4-dbg package.
+  * Add gdbinit example to doc directory.
+
+ -- Matthias Klose <doko@debian.org>  Thu,  5 May 2005 11:12:32 +0200
+
+python2.4 (2.4.1-1ubuntu2) breezy; urgency=low
+
+  * Add the debug symbols for the python2.4, python2.4-minimal, python2.4-gdbm
+    and python2.4-tk packages to the python2.4-dbg package. Ubuntu 10261, 
+  * Add gdbinit example to doc directory.
+  * For os.utime, use utimes(2), correctly working with glibc-2.3.5.
+    Ubuntu 10294.
+
+ -- Matthias Klose <doko@ubuntu.com>  Thu,  5 May 2005 09:06:07 +0200
+
+python2.4 (2.4.1-1ubuntu1) breezy; urgency=low
+
+  * Reupload as 2.4.1-1ubuntu1.
+
+ -- Matthias Klose <doko@ubuntu.com>  Thu, 14 Apr 2005 10:46:32 +0200
+
+python2.4 (2.4.1-1) unstable; urgency=low
+
+  * Python 2.4.1 release.
+  * Fix noise in python-doc installation/removal.
+  * New Python section for the info docs.
+
+ -- Matthias Klose <doko@debian.org>  Wed, 30 Mar 2005 19:42:03 +0200
+
+python2.4 (2.4.1-0) hoary; urgency=low
+
+  * Python 2.4.1 release.
+  * Fix noise in python-doc installation/removal.
+  * New Python section for the info docs.
+
+ -- Matthias Klose <doko@ubuntu.com>  Wed, 30 Mar 2005 16:35:34 +0200
+
+python2.4 (2.4+2.4.1rc2-2) unstable; urgency=low
+
+  * Add the valgrind support file to /etc/python2.4
+  * Build the -dbg package with -DPy_USING_MEMORY_DEBUGGER.
+  * Lib/locale.py:
+    - correctly parse LANGUAGE as a colon separated list of languages.
+    - prefer LC_ALL, LC_CTYPE and LANG over LANGUAGE to get the correct
+      encoding.
+    - Don't map 'utf8', 'utf-8' to 'utf', which is not a known encoding
+      for glibc.
+  * Fix two typos in python(1). Addresses: #300124.
+
+ -- Matthias Klose <doko@debian.org>  Sat, 19 Mar 2005 21:50:14 +0100
+
+python2.4 (2.4+2.4.1rc2-1) unstable; urgency=low
+
+  * Python 2.4.1 release candidate 2.
+  * Build-depend on libbluetooth1-dev.
+
+ -- Matthias Klose <doko@debian.org>  Sat, 19 Mar 2005 00:57:14 +0100
+
+python2.4 (2.4dfsg-2) unstable; urgency=low
+
+  * CVS update up to 2005-03-03
+
+ -- Matthias Klose <doko@debian.org>  Thu,  3 Mar 2005 22:22:16 +0100
+
+python2.4 (2.4dfsg-1ubuntu4) hoary; urgency=medium
+
+  * Move exception finalisation later in the shutdown process - this
+    fixes the crash seen in bug #1165761, taken from CVS.
+  * codecs.StreamReader: Reset codec when seeking. Ubuntu #6972.
+  * Apply fix for SF1124295, fixing an obscure bit of Zope's security machinery.
+  * distutils: Don't add standard library dirs to library_dirs
+    and runtime_library_dirs. On amd64, runtime paths pointing to /usr/lib64
+    aren't recognized by dpkg-shlibdeps, and the packages containing these
+    libraries aren't added to ${shlibs:Depends}.
+  * Lib/locale.py:
+    - correctly parse LANGUAGE as a colon separated list of languages.
+    - prefer LC_ALL, LC_CTYPE and LANG over LANGUAGE to get the correct
+      encoding.
+    - Don't map 'utf8', 'utf-8' to 'utf', which is not a known encoding
+      for glibc.
+  * os.py: Avoid using items() in environ.update(). Fixes #1124513.
+  * Python/pythonrun.c: 
+  * Build depend on locales, generate the locales needed for the
+    testsuite.
+  * Add build dependency on libbluetooth1-dev, adding some bluetooth
+    functionality to the socket module.
+  * Lib/test/test_sundry.py: Don't fail on import of profile & pstats,
+    which are separated out to the python-profiler package.
+  * Fix typos in manpage.
+
+ -- Matthias Klose <doko@ubuntu.com>  Tue, 29 Mar 2005 13:35:53 +0200
+
+
+python2.4 (2.4dfsg-1ubuntu3) hoary; urgency=low
+
+  * debian/patches/langpack-gettext.dpatch:
+    - langpack support for python-gettext added
+
+ -- Michael Vogt <michael.vogt@ubuntu.com>  Tue,  1 Mar 2005 13:13:36 +0100
+
+python2.4 (2.4dfsg-1ubuntu2) hoary; urgency=low
+
+  * Revert 'essential' status on python2.4-minimal. This status on
+    on python-minimal is sufficient (Ubuntu #6392).
+
+ -- Matthias Klose <doko@ubuntu.com>  Wed,  9 Feb 2005 23:09:42 +0100
+
+python2.4 (2.4dfsg-1ubuntu1) hoary; urgency=low
+
+  * Resyncronise with Debian.
+  * Mark the python2.4-minimal package as 'essential'.
+
+ -- Matthias Klose <doko@ubuntu.com>  Wed,  9 Feb 2005 13:31:09 +0100
+
+python2.4 (2.4dfsg-1) unstable; urgency=medium
+
+  * Add licenses and acknowledgements for incorporated software in the
+    debian/copyright file (addresses: #293932).
+  * Replace md5 implementation with one having a DFSG conforming license.
+  * Remove the profile.py and pstats.py modules from the source package,
+    not having a DFSG conforming license. The modules can be found in
+    the python2.x-profile package in the non-free section.
+    Addresses: #293932.
+  * Add missing norwegian locales (Tollef Fog Heen).
+  * CVS updates of the release24-maint branch upto 2005-02-08 (date of
+    the Python 2.3.5 release).
+
+ -- Matthias Klose <doko@debian.org>  Tue,  8 Feb 2005 19:13:10 +0100
+
+python2.4 (2.4-7ubuntu1) hoary; urgency=low
+
+  * Fix the name of the python-dbg man page.
+  * Resyncronise with Debian.
+  * Move more modules to -minimal (new code in copy.py requires these):
+    dis, inspect, opcode, token, tokenize.
+
+ -- Matthias Klose <doko@ubuntu.com>  Tue,  8 Feb 2005 19:13:10 +0100
+
+python2.4 (2.4-7) unstable; urgency=medium
+
+  * Add licenses and acknowledgements for incorporated software in the
+    debian/copyright file (addresses: #293932).
+  * Replace md5 implementation with one having a DFSG conforming license.
+  * Add missing norwegian locales (Tollef Fog Heen).
+  * CVS updates of the release24-maint branch upto 2005-02-08 (date of
+    the Python 2.3.5 release).
+
+ -- Matthias Klose <doko@debian.org>  Tue,  8 Feb 2005 19:13:10 +0100
+
+python2.4 (2.4-6) unstable; urgency=low
+
+  * Build a python2.4-dbg package using --with-pydebug. Add a debug
+    directory <prefix>/lib-dynload/debug to sys.path instead of
+    <prefix>/lib-dynload und install the extension modules of the
+    debug build in this directory.
+    Change the module load path to load extension modules from other
+    site-packages/debug directories (for further details see the
+    README in the python2.4-dbg package).  Closes: #5415.
+  * Apply the pydebug-path patch. The package was already built in -5.
+
+ -- Matthias Klose <doko@debian.org>  Fri,  4 Feb 2005 22:15:13 +0100
+
+python2.4 (2.4-5) unstable; urgency=high
+
+  * Fix a flaw in SimpleXMLRPCServerthat can affect any XML-RPC servers.  
+    This affects any programs have been written that allow remote 
+    untrusted users to do unrestricted traversal and can allow them to
+    access or change function internals using the im_* and func_* attributes.
+    References: CAN-2005-0089.
+  * CVS updates of the release24-maint branch upto 2005-02-04.
+
+ -- Matthias Klose <doko@debian.org>  Fri,  4 Feb 2005 08:12:10 +0100
+
+python2.4 (2.4-4) unstable; urgency=medium
+
+  * Update debian/copyright to the 2.4 license text (closes: #290898).
+  * Remove /usr/bin/smtpd.py (closes: #291049).
+
+ -- Matthias Klose <doko@debian.org>  Mon, 17 Jan 2005 23:54:37 +0100
+
+python2.4 (2.4-3ubuntu6) hoary; urgency=low
+
+  * Use old-style dpatches instead of dpatch-run.
+
+ -- Tollef Fog Heen <tfheen@canonical.com>  Mon,  7 Feb 2005 15:58:05 +0100
+
+python2.4 (2.4-3ubuntu5) hoary; urgency=low
+
+  * Actually apply the patch as well (add to list of patches in
+    debian/rules)
+
+ -- Tollef Fog Heen <tfheen@canonical.com>  Sun,  6 Feb 2005 15:12:58 +0100
+
+python2.4 (2.4-3ubuntu4) hoary; urgency=low
+
+  * Add nb_NO and nn_NO locales to Lib/locale.py
+
+ -- Tollef Fog Heen <tfheen@canonical.com>  Sun,  6 Feb 2005 14:33:05 +0100
+
+python2.4 (2.4-3ubuntu3) hoary; urgency=low
+
+  * Fix a flaw in SimpleXMLRPCServerthat can affect any XML-RPC servers.
+    This affects any programs have been written that allow remote
+    untrusted users to do unrestricted traversal and can allow them to
+    access or change function internals using the im_* and func_* attributes.
+    References: CAN-2005-0089.
+
+ -- Matthias Klose <doko@ubuntu.com>  Wed,  2 Feb 2005 09:08:20 +0000
+
+python2.4 (2.4-3ubuntu2) hoary; urgency=low
+
+  * Build a python2.4-dbg package using --with-pydebug. Add a debug
+    directory <prefix>/lib-dynload/debug to sys.path instead of
+    <prefix>/lib-dynload und install the extension modules of the
+    debug build in this directory.
+    Change the module load path to load extension modules from other
+    site-packages/debug directories (for further details see the
+    README in the python2.4-dbg package).  Closes: #5415.
+  * Update debian/copyright to the 2.4 license text (closes: #290898).
+  * Add operator and copy to the -minimal package.
+
+ -- Matthias Klose <m@klose.in-berlin.de>  Mon, 17 Jan 2005 23:19:47 +0100
+
+python2.4 (2.4-3ubuntu1) hoary; urgency=low
+
+  * Resynchronise with Debian.
+  * python2.4: Depend on the very same version of python2.4-minimal.
+  * Docment, that time.strptime currently cannot be used, if the
+    python-minimal package is installed without the python package.
+
+ -- Matthias Klose <m@klose.in-berlin.de>  Sun,  9 Jan 2005 19:35:48 +0100
+
+python2.4 (2.4-3) unstable; urgency=medium
+
+  * Build the fpectl module.
+  * Updated to CVS release24-maint 20050107.
+
+ -- Matthias Klose <doko@debian.org>  Sat,  8 Jan 2005 19:05:21 +0100
+
+python2.4 (2.4-2ubuntu5) hoary; urgency=low
+
+  * Updated to CVS release24-maint 20050102.
+  * python-minimal:
+    - os.py: Use dict instead of UserDict, remove UserDict from -minimal.
+    - add pickle, threading, needed for subprocess module.
+    - optparse.py: conditionally import gettext, if not available,
+      define _ as the identity function. Patch taken from the trunk.
+      Avoids import of _locale, locale, gettext, copy, repr, itertools,
+      collections, token, tokenize.
+    - Add a build check to make sure that the minimal module list is
+      closed under dependency.
+  * Fix lintian warnings.
+
+ -- Matthias Klose <m@klose.in-berlin.de>  Sun,  2 Jan 2005 22:00:14 +0100
+
+python2.4 (2.4-2ubuntu4) hoary; urgency=low
+
+  * Add UserDict.py to the -minimal package, since os.py needs it.
+
+ -- Colin Watson <cjwatson@canonical.com>  Thu, 30 Dec 2004 20:41:28 +0000
+
+python2.4 (2.4-2ubuntu3) hoary; urgency=low
+
+  * Add os.py and traceback.py to the -minimal package, get the list
+    of modules from the README.
+
+ -- Matthias Klose <m@klose.in-berlin.de>  Mon, 27 Dec 2004 08:20:45 +0100
+
+python2.4 (2.4-2ubuntu2) hoary; urgency=low
+
+  * Add compileall.py and py_compile.py to the -minimal package, not
+    just to the README ...
+
+ -- Matthias Klose <m@klose.in-berlin.de>  Sat, 25 Dec 2004 22:24:56 +0100
+
+python2.4 (2.4-2ubuntu1) hoary; urgency=low
+
+  * Separate the interpreter and a minimal subset of modules into
+    a python2.4-minimal package. See the README.Debian.gz in this
+    package.
+  * Move site.py to python2.4-minimal as well.
+  * Add documentation files for devhelp.
+
+ -- Matthias Klose <m@klose.in-berlin.de>  Sun, 19 Dec 2004 22:47:32 +0100
+
+python2.4 (2.4-2) unstable; urgency=medium
+
+  * Updated patch for #283108. Thanks to Jim Meyering.
+
+ -- Matthias Klose <doko@debian.org>  Fri,  3 Dec 2004 17:00:16 +0100
+
+python2.4 (2.4-1) unstable; urgency=low
+
+  * Final 2.4 release.
+  * Flush stdout/stderr if closed (SF #1074011).
+
+ -- Matthias Klose <doko@debian.org>  Wed,  1 Dec 2004 07:54:34 +0100
+
+python2.4 (2.3.97-2) unstable; urgency=low
+
+  * Don't run test_tcl, hanging on the buildds.
+
+ -- Matthias Klose <doko@debian.org>  Fri, 19 Nov 2004 23:48:42 +0100
+
+python2.4 (2.3.97-1) unstable; urgency=low
+
+  * Python 2.4 Release Candidate 1.
+
+ -- Matthias Klose <doko@debian.org>  Fri, 19 Nov 2004 21:27:02 +0100
+
+python2.4 (2.3.96-1) experimental; urgency=low
+
+  * Updated to CVS release24-maint 20041113.
+  * Build the docs in info format again.
+
+ -- Matthias Klose <doko@debian.org>  Sat, 13 Nov 2004 21:21:10 +0100
+
+python2.4 (2.3.95-2) experimental; urgency=low
+
+  * Move distutils package from the python2.4-dev into the python2.4
+    package.
+
+ -- Matthias Klose <doko@debian.org>  Thu, 11 Nov 2004 22:56:14 +0100
+
+python2.4 (2.3.95-1) experimental; urgency=low
+
+  * Python 2.4 beta2 release.
+
+ -- Matthias Klose <doko@debian.org>  Thu,  4 Nov 2004 23:43:47 +0100
+
+python2.4 (2.3.94-1) experimental; urgency=low
+
+  * Python 2.4 beta1 release.
+
+ -- Matthias Klose <doko@debian.org>  Sat, 16 Oct 2004 08:33:57 +0200
+
+python2.4 (2.3.93-1) experimental; urgency=low
+
+  * Python 2.4 alpha3 release.
+
+ -- Matthias Klose <doko@debian.org>  Fri,  3 Sep 2004 21:53:47 +0200
+
+python2.4 (2.3.92-1) experimental; urgency=low
+
+  * Python 2.4 alpha2 release.
+
+ -- Matthias Klose <doko@debian.org>  Thu,  5 Aug 2004 23:53:18 +0200
+
+python2.4 (2.3.91-1) experimental; urgency=low
+
+  * Python 2.4 alpha1 release.
+    Highlights: http://www.python.org/2.4/highlights.html
+
+ -- Matthias Klose <doko@debian.org>  Fri,  9 Jul 2004 17:38:54 +0200
+
+python2.4 (2.3.90-1) experimental; urgency=low
+
+  * Package HEAD branch (pre alpha ..).
+
+ -- Matthias Klose <doko@debian.org>  Mon, 14 Jun 2004 23:19:57 +0200
+
+python2.3 (2.3.4-1) unstable; urgency=medium
+
+  * Final Python 2.3.4 Release.
+  * In the API docs, fix signature of PyModule_AddIntConstant (closes: #250826).
+  * locale.getdefaultlocale: don't fail with empty environment variables.
+    Closes: #249816.
+  * Include distutils/command/wininst.exe in -dev package (closes: #249006).
+  * Disable cthreads on the Hurd (Michael Banck). Closes: #247211.
+  * Add a note to pygettext(1), that this program is deprecated in favour
+    of xgettext, which now includes support for Python as well.
+    Closes: #246332.
+
+ -- Matthias Klose <doko@debian.org>  Fri, 28 May 2004 22:59:42 +0200
+
+python2.3 (2.3.3.91-1) unstable; urgency=low
+
+  * Python 2.3.4 Release Candidate 1.
+  * Do not use the default namespace for attributes. Patch taken from the
+    2.3 maintenance branch.
+    The xmllib module is obsolete.  Use xml.sax instead.
+  * http://python.org/sf/945642 - fix nonblocking i/o with ssl socket.
+
+ -- Matthias Klose <doko@debian.org>  Thu, 13 May 2004 21:24:52 +0200
+
+python2.3 (2.3.3-7) unstable; urgency=low
+
+  * Add a workaround for GNU libc nl_langinfo()'s returning NULL.
+    Closes: #239237.
+    Patch taken from 2.3 maintenance branch.
+  * threading.py: Remove calls to currentThread() in _Condition methods that
+    were side-effect. Side-effects were deemed unnecessary and were causing
+    problems at shutdown time when threads were catching exceptions at start
+    time and then triggering exceptions trying to call currentThread() after
+    gc'ed.  Masked the initial exception which was deemed bad.
+    Closes: #195812.
+  * Properly support normalization of empty unicode strings. Closes: #239986.
+    Patch taken from 2.3 maintenance branch.
+  * README.maintainers: Add section where to find the documentation tools.
+  * Fix crash in pyexpat module (closes: #229281).
+  * For the Hurd, set the interpreters recursion limit to 930.
+  * Do not try to byte-compile the test files on installation; this
+    currently breaks the Hurd install.
+
+ -- Matthias Klose <doko@debian.org>  Sat,  1 May 2004 07:50:46 +0200
+
+python2.3 (2.3.3-6) unstable; urgency=low
+
+  * Don't build the unversioned python{,-*} packages anymore. Now
+    built from the python-defaults package.
+  * Update to the proposed python-policy: byte-compile using -E.
+  * Remove python-elisp's dependency on emacs20 (closes: #232785).
+  * Don't build python-elisp from the python2.3 source anymore,
+    get it from python-mode.sf.net as a separate source package.
+  * python2.3-dev suggests libc-dev (closes: #231091).
+  * get LDSHARED and CCSHARED (like, CC, CXX, CPP, CFLAGS) from 
+    the environment
+  * Set CXX in installed config/Makefile (closes: #230273).
+
+ -- Matthias Klose <doko@debian.org>  Tue, 24 Feb 2004 07:07:51 +0100
+
+python2.3 (2.3.3-5) unstable; urgency=low
+
+  * Build-depend on libdb4.2-dev, instead of libdb4.1-dev. According
+    to the docs the file format is compatible.
+
+ -- Matthias Klose <doko@debian.org>  Mon, 12 Jan 2004 10:37:45 +0100
+
+python2.3 (2.3.3-4) unstable; urgency=low
+
+  * Fix broken _bsddb module. setup.py picked up the wrong library.
+
+ -- Matthias Klose <doko@debian.org>  Sun,  4 Jan 2004 11:30:00 +0100
+
+python2.3 (2.3.3-3) unstable; urgency=low
+
+  * Fix typo in patch (closes: #224797, #226064).
+
+ -- Matthias Klose <doko@debian.org>  Sun,  4 Jan 2004 09:23:21 +0100
+
+python2.3 (2.3.3-2) unstable; urgency=medium
+
+  * Lib/email/Charset: use locale unaware function to lower case of locale
+    name (closes: #224797).
+  * Update python-mode to version from python-mode.sf.net. Fixes highlighting
+    problems (closes: #223520).
+  * Backport from mainline: Add IPV6_ socket options from RFCs 3493 and 3542.
+
+ -- Matthias Klose <doko@debian.org>  Fri,  2 Jan 2004 14:03:26 +0100
+
+python2.3 (2.3.3-1) unstable; urgency=low
+
+  * New upstream release.
+  * Copy the templates, tools and scripts from the Doc dir in the source
+    to /usr/share/lib/python2.3/doc in the python2.3-dev package. Needed
+    for packages building documentation like python does (closes: #207337).
+
+ -- Matthias Klose <doko@debian.org>  Fri, 19 Dec 2003 10:57:39 +0100
+
+python2.3 (2.3.2.91-1) unstable; urgency=low
+
+  * New upstream version (2.3.3 release candidate).
+  * Update python-mode.el (closes: #158811, #159630).
+    Closing unreproducible report (closes: #159628).
+
+ -- Matthias Klose <doko@debian.org>  Sat,  6 Dec 2003 14:41:14 +0100
+
+python2.3 (2.3.2-7) unstable; urgency=low
+
+  * Put the conflict in the correct direction. python2.3 (2.3.2-6) doesn't
+    conflict with python (<= 2.3.2-5) but python (2.3.2-6) conflicts with
+    python2.3 (<= 2.3.2-5) (thanks to Brian May). Really closes #221791.
+
+ -- Matthias Klose <doko@debian.org>  Fri, 21 Nov 2003 00:20:02 +0100
+
+python2.3 (2.3.2-6) unstable; urgency=low
+
+  * Add conflicts with older python{,2.3} packages to fix overwrite
+    errors (closes: #221791).
+
+ -- Matthias Klose <doko@debian.org>  Thu, 20 Nov 2003 07:24:36 +0100
+
+python2.3 (2.3.2-5) unstable; urgency=low
+
+  * Updated to CVS release23-maint 20031119.
+  * Re-upgrade the dependency of python2.3 on python (>= 2.3) to
+    a dependency (closes: #221523).
+
+ -- Matthias Klose <doko@debian.org>  Wed, 19 Nov 2003 00:30:27 +0100
+
+python2.3 (2.3.2-4) unstable; urgency=low
+
+  * Don't build-depend on latex2html (moved to non-free), but keep
+    the prebuilt docs in debian/patches (closes: #221347).
+  * Fix typos in the library reference (closes: #220510, #220954).
+  * Fix typo in python-elisp's autoloading code (closes: #220308).
+  * Update proposed python policy: private modules can be installed
+    into /usr/lib/<module> (arch dependent) and into /usr/share/<module>
+    (arch independent).
+
+ -- Matthias Klose <doko@debian.org>  Tue, 18 Nov 2003 00:41:39 +0100
+
+python2.3 (2.3.2-3) unstable; urgency=low
+
+  * Downgrade the dependency of python2.3 on python (>= 2.3) to
+    a recommendation.
+  * Fix path to interpreter in binfmt file.
+  * Fix segfault in unicodedata module (closes: #218697).
+  * Adjust python-elisp autoload code (closes: #219821).
+
+ -- Matthias Klose <doko@debian.org>  Sun,  9 Nov 2003 19:43:37 +0100
+
+python2.3 (2.3.2-2) unstable; urgency=medium
+
+  * Fix broken doc link (closes: #214217).
+  * Disable wrongly detected large file support for GNU/Hurd.
+  * Really fix the  FTBFS for the binary-indep target (closes: #214303).
+
+ -- Matthias Klose <doko@debian.org>  Mon,  6 Oct 2003 07:54:58 +0200
+
+python2.3 (2.3.2-1) unstable; urgency=low
+
+  * New upstream version.
+  * Fix a FTBFS for the binary-indep target.
+
+ -- Matthias Klose <doko@debian.org>  Sat,  4 Oct 2003 10:20:15 +0200
+
+python2.3 (2.3.1-3) unstable; urgency=low
+
+  * Fix names of codec packages in recommends.
+  * On alpha compile using -mieee (see #212912).
+
+ -- Matthias Klose <doko@debian.org>  Sun, 28 Sep 2003 10:48:12 +0200
+
+python2.3 (2.3.1-2) unstable; urgency=low
+
+  * Update python policy draft (closes: #128911, #163785).
+  * Re-add os.fsync function (closes: #212672).
+  * Let python2.3-doc conflict with older python2.3 versions (closes: #211882).
+  * Add recommends for pythonX.Y-japanese-codecs, pythonX.Y-iconvcodec,
+    pythonX.Y-cjkcodecs, pythonX.Y-korean-codecs (closes: #207161).
+  * Generate binfmt file (closes: #208005).
+  * Add IPPROTO_IPV6 option to the socketmodule (closes: #206569).
+  * Bugs reported against python2.2 and fixed in python2.3:
+    - Crashes in idle (closes: #186887, #200084).
+
+ -- Matthias Klose <doko@debian.org>  Sat, 27 Sep 2003 11:21:47 +0200
+
+python2.3 (2.3.1-1) unstable; urgency=low
+
+  * New upstream version (bug fix release).
+
+ -- Matthias Klose <doko@debian.org>  Wed, 24 Sep 2003 11:27:43 +0200
+
+python2.3 (2.3-4) unstable; urgency=high
+
+  * Disable check for utimes function, which is broken in glibc-2.3.2.
+    Packages using distutils had '1970/01/01-01:00:01' timestamps in files.
+  * Bugs fixed by making python2.3 the default python version:
+    - Canvas.scan_dragto() takes a 3rd optional parmeter "gain".
+      Closes: #158168.
+    - New command line parsing module (closes: #38628).
+    - compileall.py allows compiling single files (closes: #139971).
+  * Bugs reported for 2.2 and fixed in 2.3:
+    - Idle does save files with ASCII characters (closes: #179313).
+    - imaplib support for prefix-quoted strings (closes: #150485).
+    - posixpath includes getctime (closes: #173827).
+    - pydoc has support for keywords (closes: #186775).
+  * Bugs reported for 2.1 and fixed in 2.3:
+    - Fix handling of "#anchor" URLs in urlparse (closes: #147844).
+    - Fix readline if C stdin is not a tty, even if sys.stdin is.
+      Closes: #131810.
+  * Updated to CVS release23-maint 20030810 (fixing memory leaks in
+    array and socket modules).
+  * pydoc's usage output uses the basename of the script.
+  * Don't explicitely remove /etc/python2.3 on purge (closes: #202864).
+  * python conflicts with python-xmlbase (closes: #204773).
+  * Add dependency python (>= 2.3) to python2.3, so make sure the
+    unversioned names can be used.
+
+ -- Matthias Klose <doko@debian.org>  Sun, 10 Aug 2003 09:27:52 +0200
+
+python2.3 (2.3-3) unstable; urgency=medium
+
+  * Fix shlibs file.
+
+ -- Matthias Klose <doko@debian.org>  Fri,  8 Aug 2003 08:45:12 +0200
+
+python2.3 (2.3-2) unstable; urgency=medium
+
+  * Make python2.3 the default python version.
+
+ -- Matthias Klose <doko@debian.org>  Tue,  5 Aug 2003 22:13:22 +0200
+
+python2.3 (2.3-1) unstable; urgency=low
+
+  * Python 2.3 final release.
+
+ -- Matthias Klose <doko@debian.org>  Wed, 30 Jul 2003 08:12:28 +0200
+
+python2.3 (2.2.107-1rc2) unstable; urgency=medium
+
+  * Python 2.3 release candidate 2.
+  * Don't compress .txt files referenced by the html docs (closes: #200298).
+  * Include the email/_compat* files (closes: #200349).
+
+ -- Matthias Klose <doko@debian.org>  Fri, 25 Jul 2003 07:08:09 +0200
+
+python2.3 (2.2.106-2beta2) unstable; urgency=medium
+
+  * Python 2.3 beta2 release, updated to CVS 20030704.
+    - Fixes AssertionError in httplib (closed: #192452).
+    - Fixes uncaught division by zero in difflib.py (closed: #199287).
+  * Detect presence of setgroups(2) at configure time (closes: #199839).
+  * Use default gcc on arm as well.
+
+ -- Matthias Klose <doko@debian.org>  Sat,  5 Jul 2003 10:21:33 +0200
+
+python2.3 (2.2.105-1beta2) unstable; urgency=low
+
+  * Python 2.3 beta2 release.
+    - Includes merged idle fork.
+    - Fixed socket.setdefaulttimeout(). Closes: #189380.
+    - socket.ssl works with _socketobj. Closes: #196082.
+  * Do not link libtix to the _tkinter module. It's loaded via
+   'package require tix' at runtime. python2.3-tkinter now
+    suggests tix8.1 instead.
+  * On arm, use gcc-3.2 to build.
+  * Add -fno-strict-aliasing rules to OPT to avoid warnings
+    "dereferencing type-punned pointer will break strict-aliasing rules",
+    when building with gcc-3.3.
+
+ -- Matthias Klose <doko@debian.org>  Mon, 30 Jun 2003 00:19:32 +0200
+
+python2.3 (2.2.104-1beta1.1) unstable; urgency=low
+
+  * Non-maintainer upload with maintainer consent.
+  * debian/control (Build-Depends): s/libgdbmg1-dev/libgdbm-dev/.
+
+ -- James Troup <james@nocrew.org>  Wed,  4 Jun 2003 02:24:27 +0100
+
+python2.3 (2.2.104-1beta1) unstable; urgency=low
+
+  * Python 2.3 beta1 release, updated to CVS 20030514.
+    - build the current documentation.
+  * Reenable Tix support.
+
+ -- Matthias Klose <doko@debian.org>  Wed, 14 May 2003 07:38:57 +0200
+
+python2.3 (2.2.103-1beta1) unstable; urgency=low
+
+  * Python 2.3 beta1 release, updated to CVS 20030506.
+    - updated due to build problems on mips/mipsel.
+    - keep the 2.3b1 documentation (doc build problems with cvs).
+
+ -- Matthias Klose <doko@debian.org>  Wed,  7 May 2003 06:26:39 +0200
+
+python2.3 (2.2.102-1beta1) unstable; urgency=low
+
+  * Python 2.3 beta1 release.
+
+ -- Matthias Klose <doko@debian.org>  Sat,  3 May 2003 22:45:16 +0200
+
+python2.3 (2.2.101-1exp1) unstable; urgency=medium
+
+  * Python 2.3 alpha2 release, updated to CVS 20030321.
+  * Tkinter: Catch exceptions thrown for undefined substitutions in
+    events (needed for tk 8.4.2).
+
+ -- Matthias Klose <doko@debian.org>  Fri, 21 Mar 2003 21:32:14 +0100
+
+python2.3 (2.2.100-1exp1) unstable; urgency=low
+
+  * Python 2.3 alpha2 release, updated to CVS 20030221.
+
+ -- Matthias Klose <doko@debian.org>  Fri, 21 Feb 2003 19:37:17 +0100
+
+python2.3 (2.2.99-1exp1) unstable; urgency=low
+
+  * Python 2.3 alpha1 release updated to CVS 20030123.
+    - should fix the testsuite (and package build) failure on alpha.
+  * Remove build dependency on libexpat1-dev. Merge the python2.3-xmlbase
+    package into python2.3 (closes: #177739).
+
+ -- Matthias Klose <doko@debian.org>  Thu, 23 Jan 2003 22:48:12 +0100
+
+python2.3 (2.2.98-1exp1) unstable; urgency=low
+
+  * Python 2.3 alpha1 release updated to CVS 20030117.
+  * Build using libdb4.1.
+
+ -- Matthias Klose <doko@debian.org>  Sat, 18 Jan 2003 00:14:01 +0100
+
+python2.3 (2.2.97-1exp1) unstable; urgency=low
+
+  * Python 2.3 alpha1 release updated to CVS 20030109.
+  * Build-Depend on g++ (>= 3:3.2).
+  * Python package maintainers: please wait uploading python dependent
+    packages until python2.2 and python2.1 are compiled using gcc-3.2.
+
+ -- Matthias Klose <doko@debian.org>  Thu,  9 Jan 2003 23:56:42 +0100
+
+python2.3 (2.2.96-1exp1) unstable; urgency=low
+
+  * Python 2.3 alpha1 release (not exactly the tarball, but taken from
+    CVS 20030101).
+    - Includes support for linking with threaded tk8.4 (closes: #172714).
+  * Install and register whatsnew document (closes: #173859).
+  * Properly unregister info documentation.
+
+ -- Matthias Klose <doko@debian.org>  Wed,  1 Jan 2003 17:38:54 +0100
+
+python2.3 (2.2.95-1exp1) unstable; urgency=low
+
+  * Experimental packages from CVS 021212.
+    - data in unicodedate module is up to date (closes: #171061).
+  * Fix idle packaging (closes: #170394).
+  * Configure using unicode UCS-4 (closes: #171062).
+    This change breaks compatibility with binary modules, but what do you
+    expect from experimental packages ... Please recompile dependent packages.
+  * Don't strip binaries for now.
+
+ -- Matthias Klose <doko@debian.org>  Thu, 12 Dec 2002 21:42:27 +0100
+
+python2.3 (2.2.94-1exp1) unstable; urgency=low
+
+  * Experimental packages from CVS 021120.
+  * Remove outdated README.dbm.
+  * Depend on tk8.4.
+  * python-elisp: Install emacsen install file with mode 644 (closes: #167718).
+
+ -- Matthias Klose <doko@debian.org>  Thu, 21 Nov 2002 01:04:51 +0100
+
+python2.3 (2.2.93-1exp1) unstable; urgency=medium
+
+  * Experimental packages from CVS 021015.
+  * Build a static library libpython2.3-pic.a.
+  * Enable large file support for the Hurd (closes: #164602).
+
+ -- Matthias Klose <doko@debian.org>  Tue, 15 Oct 2002 21:06:27 +0200
+
+python2.3 (2.2.92-1exp1) unstable; urgency=low
+
+  * Experimental packages from CVS 020922.
+  * Fix build error on ia64 (closes: #161234).
+  * Build depend on gcc-3.2-3.2.1-0pre2 to fix build error on arm.
+
+ -- Matthias Klose <doko@debian.org>  Sun, 22 Sep 2002 18:30:28 +0200
+
+python2.3 (2.2.91-1exp1) unstable; urgency=low
+
+  * Experimental packages from CVS 020906.
+  * idle-python2.3: Fix conflict (closes: #159267).
+  * Fix location of python-mode.el (closes: #159564, #159619).
+  * Use tix8.1.
+  * Apply fix for distutils/ccompiler problem (closes: #159288).
+
+ -- Matthias Klose <doko@debian.org>  Sat,  7 Sep 2002 09:55:07 +0200
+
+python2.3 (2.2.90-1exp1) unstable; urgency=low
+
+  * Experimental packages from CVS 020820.
+  * Don't build python2.3-elisp, but put the latest version into
+    python-elisp.
+
+ -- Matthias Klose <doko@debian.org>  Thu, 22 Aug 2002 21:52:04 +0200
+
+python2.2 (2.2.1-6) unstable; urgency=low
+
+  * CVS updates of the release22-maint branch upto 2002-07-23.
+  * Enable IPv6 support (closes: #152543).
+  * Add python2.2-tk suggestion for python2.2 (pydoc -g).
+  * Fix from SF patch #527518: proxy config with user+pass authentication.
+  * Point pydoc to the correct location of the docs (closes: #147579).
+  * Remove '*.py[co]' files, when removing the python package,
+    not when purging (closes: #147130).
+  * Update to new py2texi.el version (Milan Zamazal).
+
+ -- Matthias Klose <doko@debian.org>  Mon, 29 Jul 2002 23:11:32 +0200
+
+python2.2 (2.2.1-5) unstable; urgency=low
+
+  * CVS updates of the release22-maint branch upto 2002-05-03.
+  * Build the info docs (closes: #145653).
+
+ -- Matthias Klose <doko@debian.org>  Fri,  3 May 2002 22:35:46 +0200
+
+python2.2 (2.2.1-4) unstable; urgency=high
+
+  * Fix indentation errors introduced in last upload (closes: #143809).
+
+ -- Matthias Klose <doko@debian.org>  Sun, 21 Apr 2002 01:00:14 +0200
+
+python2.2 (2.2.1-3) unstable; urgency=high
+
+  * Add Build-Conflicts: tcl8.0-dev, tk8.0-dev, tcl8.2-dev, tk8.2-dev.
+    Closes: #143534 (build a working _tkinter module, on machines, where
+    8.0's tk.h gets included).
+  * CVS updates of the release22-maint branch upto 2002-04-20.
+
+ -- Matthias Klose <doko@debian.org>  Sat, 20 Apr 2002 09:22:37 +0200
+
+python2.2 (2.2.1-2) unstable; urgency=low
+
+  * Forgot to copy the dlmodule patch from the 2.1.3 package. Really
+    closes: #141681.
+
+ -- Matthias Klose <doko@debian.org>  Sat, 13 Apr 2002 01:28:05 +0200
+
+python2.2 (2.2.1-1) unstable; urgency=high
+
+  * Final 2.2.1 release.
+  * According to report #131813, the python interpreter is much faster on some
+    architectures, when beeing linked statically with the python library (25%).
+    Gregor and me tested on i386, m68k and alpha, but we could not reproduce
+    such a speedup (generally between 5% and 10%). But we are linking the
+    python executable now statically ...
+  * Build info docs from the tex source, merge the python-doc-info
+    package into the python-doc package.
+  * Always build the dl module. Failure in case of
+        sizeof(int)!=sizeof(long)!=sizeof(void*)
+    is delayed until dl.open is called. Closes: #141681.
+
+ -- Matthias Klose <doko@debian.org>  Thu, 11 Apr 2002 00:19:19 +0200
+
+python2.2 (2.2.0.92-0) unstable; urgency=low
+
+  * Package CVS sources, omit cvs-updates.dpatch (closes: #140977).
+
+ -- Matthias Klose <doko@debian.org>  Wed,  3 Apr 2002 08:20:52 +0200
+
+python2.2 (2.2-6) unstable; urgency=medium
+
+  * Update to python-2.2.1 release candidate 2 (final release scheduled
+    for April 10).
+  * Enable dl module (closes: #138992).
+  * Build doc files with python binary from package (closes: #139657).
+  * Build _tkinter module with BLT and Tix support.
+  * python2.2-elisp: Conflict with python2-elisp (closes: #138970).
+  * string.split docs updated in python-2.2.1 (closes: #129272).
+
+ -- Matthias Klose <doko@debian.org>  Mon,  1 Apr 2002 13:52:36 +0200
+
+python2.2 (2.2-5) unstable; urgency=low
+
+  * CVS updates of the release22-maint branch upto 20020310 (aproaching
+    the first 2.2.1 release candidate).
+  * Stolen from HEAD: check argument of locale.nl_langinfo (closes: #137371).
+
+ -- Matthias Klose <doko@debian.org>  Fri, 15 Mar 2002 01:05:59 +0100
+
+python2.2 (2.2-4) unstable; urgency=medium
+
+  * Include test/{__init__.py,README,pystone.py} in package (closes: #129013).
+  * Fix python-elisp conflict (closes: #129046).
+  * Don't compress stylesheets (closes: #133179).
+  * CVS updates of the release22-maint branch upto 20020310.
+
+ -- Matthias Klose <doko@debian.org>  Sun, 10 Mar 2002 23:32:28 +0100
+
+python2.2 (2.2-3) unstable; urgency=medium
+
+  * Updates from the CVS python22-maint branch up to 20020107.
+    webbrowser.py: properly escape url's.
+  * The Hurd does not have large file support: disabled.
+
+ -- Matthias Klose <doko@debian.org>  Mon,  7 Jan 2002 21:55:57 +0100
+
+python2.2 (2.2-2) unstable; urgency=medium
+
+  * CVS updates of the release22-maint branch upto 20011229. Fixes:
+    - Include TCP_CORK flag in plat-linux2 headers (fixes: #84340).
+    - Update CDROM.py module (fixes: #125785).
+  * Add missing chunk of the GNU/Hurd patch (therefore urgency medium).
+  * Send anonymous password when using anonftp (closes: #126814).
+
+ -- Matthias Klose <doko@debian.org>  Sat, 29 Dec 2001 20:18:26 +0100
+
+python2.2 (2.2-1) unstable; urgency=low
+
+  * New upstream version: 2.2.
+  * Bugs fixed upstream:
+    - Docs for os.kill reference the signal module for constants.
+    - Documentation strings in the tutorial end with a period (closes: #94770).
+    - Tk: grid_location method moved from Grid to Misc (closes: #98338).
+    - mhlib.SubMessage.getbodytext takes decode parameter (closes: #31876).
+    - Strings in modules are locale aware (closes: #51444).
+    - Printable 8-bit characters in strings are correctly printed
+      (closes: #64354).
+    - Dictionary can be updated with abstract mapping object (closes: #46566).
+  * Make site.py a config files.
+
+ -- Matthias Klose <doko@debian.org>  Sat, 22 Dec 2001 00:51:46 +0100
+
+python2.2 (2.1.99c1-1) unstable; urgency=low
+
+  * New upstream version: 2.2c1 (release candidate).
+  * Do not provide python2.2-base anymore.
+  * Install correct README.Debian for python2.2 package. Include hint
+    where to find Makefile.pre.in.
+  * Suggest installation of python-ssl.
+  * Remove idle config files on purge.
+  * Remove empty /usr/lib/python2.2 directory on purge.
+
+ -- Matthias Klose <doko@debian.org>  Sat, 15 Dec 2001 17:56:27 +0100
+
+python2.2 (2.1.99beta2-1) unstable; urgency=high
+
+  * debian/rules: Reflect removal of regrtest package (closes: #122278).
+    Resulted in build failures on all architectures.
+  * Build -doc package from source.
+
+ -- Matthias Klose <doko@debian.org>  Sat,  8 Dec 2001 00:38:41 +0100
+
+python2.2 (2.1.99beta2-0.1) unstable; urgency=low
+
+  * Non maintainer upload.
+  * New upstream version (this is 2.2beta2).
+  * Do not build the python-regrtest package anymore; keep the test framework
+    components test/regrtest.py and test/test_support.py in the python
+    package (closes: #119408).
+
+ -- Gregor Hoffleit <flight@debian.org>  Tue, 27 Nov 2001 09:53:26 +0100
+
+python2.2 (2.1.99beta1-4) unstable; urgency=low
+
+  * Configure with --with-fpectl (closes: #118125).
+  * setup.py: Remove broken check for _curses_panel module (#116081).
+  * idle: Move config-* files to /etc and mark as conffiles (#106390).
+  * Move idle packages to section `devel'.
+
+ -- Matthias Klose <doko@debian.org>  Wed, 31 Oct 2001 10:56:45 +0100
+
+python2.2 (2.1.99beta1-3) unstable; urgency=low
+
+  * Fix shlibs file (was still referring to 2.1). Closes: #116810.
+  * README.Debian: point to draft of python-policy in the python package.
+
+ -- Matthias Klose <doko@debian.org>  Wed, 31 Oct 2001 10:56:45 +0100
+
+python2.2 (2.1.99beta1-2) unstable; urgency=medium
+
+  * Fix shlibs file (was still referring to 2.1). Closes: #116810.
+  * Rename package python2.2-base to python2.2.
+
+ -- Matthias Klose <doko@debian.org>  Wed, 24 Oct 2001 23:00:50 +0200
+
+python2.2 (2.1.99beta1-1) unstable; urgency=low
+
+  * New upstream version (beta). Call the package version 2.1.99beta1-1.
+  * New maintainer until the final 2.2 release.
+  * Updated the debian patches.
+
+ -- Matthias Klose <doko@debian.org>  Sat, 20 Oct 2001 18:56:26 +0200
+
+python2.1 (2.1.1-1.2) unstable; urgency=low
+
+  * Really remove the python alternative.
+
+ -- Matthias Klose <doko@debian.org>  Sat, 20 Oct 2001 15:16:56 +0200
+
+python2.1 (2.1.1-1.1) unstable; urgency=low
+
+  * README FOR PACKAGE MAINTAINERS: It is planned to remove the python2-XXX
+    packages from unstable and move on to python2.1.
+    If you repackage/adapt your modules for python2.1, don't build
+    python2-XXX and python2.1-XXX packages from the same source package,
+    so that the python2-XXX package can be removed without influencing the
+    python2.1-XXX package.
+
+    See the debian-python mailing list at http://lists.debian.org/devel.html
+    for details and the current discussion and a draft for a debian-python
+    policy (August to October 2001).
+
+  * Remove alternative for /usr/bin/python. The python-base package now
+    provides the default python version.
+
+  * Regenerate control file to fix build dependencies (closes: #116190).
+  * Remove alternative for /usr/bin/{python,pydoc}.
+  * Provide a libpython2.1.so symlink in /usr/lib/python2.1/config,
+    so that the shared library is found when -L/usr/lib/python2.1/config
+    is specified.
+  * Conflict with old package versions, where /usr/bin/python is a real
+    program (closes: #115943).
+  * python2.1-elisp conflicts with python-elisp (closes: #115895).
+  * We now have 2.1 (closes: #96851, #107849, #110243).
+
+ -- Matthias Klose <doko@debian.org>  Fri, 19 Oct 2001 17:34:41 +0200
+
+python2.1 (2.1.1-1) unstable; urgency=low
+
+  * Incorporated Matthias' modifications.
+
+ -- Gregor Hoffleit <flight@debian.org>  Thu, 11 Oct 2001 00:16:42 +0200
+
+python2.1 (2.1.1-0.2) unstable; urgency=low
+
+  * New upstream 2.1.1.
+  * GPL compatible licence (fixes #84080, #102949, #110643).
+  * Fixed upstream (closes: #99692, #111340).
+  * Build in separate build directory.
+  * Split Debian patches into debian/patches directory.
+  * Build dependencies: Add libgmp3-dev, libexpat1-dev, tighten
+    debhelper dependency.
+  * debian/rules: Updated a "bit".
+  * python-elisp: Remove custom dependency (closes: #87783),
+    fix emacs path (closes: #89712), remove emacs19 dependency (#82694).
+  * Mention distutils in python-dev package description (closes: #108170).
+  * Update README.Debian (closes: #85430).
+  * Run versioned python in postinsts (closes: #113349).
+  * debian/sample.{postinst,prerm}: Change to version independent scripts.
+  * Use '/usr/bin/env python2.1' as interpreter for all python scripts.
+  * Add libssl-dev to Build-Conflicts.
+  * python-elisp: Add support for emacs21 (closes: #98635).
+  * Do not compress .py files in doc directories.
+  * Don't link explicitely with libc.
+
+ -- Matthias Klose <doko@debian.org>  Wed,  3 Oct 2001 09:53:08 +0200
+
+python2.1 (2.1.1-0.1) unstable; urgency=low
+
+  * New upstream version (CVS branch release21-maint, will become 2.1.1):
+    This CVS branch will be released as 2.1.1 under a GPL compatible
+    license.
+
+ -- Gregor Hoffleit <flight@debian.org>  Wed, 27 Jun 2001 22:47:58 +0200
+
+python2 (2.1-0.1) unstable; urgency=low
+
+  * Fixed Makefile.pre.in.
+  * Fixed the postinst files in order to use 2.1 (instead of 2.0).
+  * Mention the immanent release of 2.0.1 and 2.1.1, with a GPL
+    compatible license.
+
+ -- Gregor Hoffleit <flight@debian.org>  Sun, 17 Jun 2001 21:05:25 +0200
+
+python2 (2.1-0) unstable; urgency=low
+
+  * New upstream version.
+  * Experimental packages.
+
+ -- Gregor Hoffleit <flight@debian.org>  Thu, 10 May 2001 00:20:04 +0200
+
+python2 (2.0-7) unstable; urgency=low
+
+  * Rebuilt with recent tcl8.3-dev/tk8.3-dev in order to fix a
+    dependency problem with python2-tk (closes: #87793, #92962).
+  * Change postinst to create and update /usr/local/lib/python2.0 and
+    site-python with permissions and owner as mandated by policy:
+    2775 and root:staff (closes: #89047).
+  * Fix to compileall.py: A superfluous argument made compileall without
+    options fail (cf. #92990 for python).
+  * Move the distutils module into python2-dev. It needs Makefile.pre.in
+    in order to work (closes: #89900).
+  * Remove build-dependency on libgdbm2-dev (which isn't built anyway).
+  * Add a build-dependency on libdb2-dev (cf. #90220 for python).
+
+ -- Gregor Hoffleit <flight@debian.org>  Sat, 14 Apr 2001 21:07:51 +0200
+
+python2 (2.0-6) unstable; urgency=low
+
+  * Remove python-zlib package; merge it into python-base.
+  * Mark that README.python2 is not yet updated.
+
+ -- Gregor Hoffleit <flight@debian.org>  Wed, 21 Feb 2001 12:34:18 +0100
+
+python2 (2.0-5) unstable; urgency=low
+
+  * Recompile with tcl/tk8.3 (closes: #82088).
+  * Modifications to README.why-python2 (closes: #82116).
+  * Add menu hint to idle2 menu entry.
+  * idle2 is renamed idle-python2 and now build correctly (closes: #82218).
+  * Add build-dependency on autoconf (closes: #85339).
+  * Build bsddbmodule as shared module (Modules/Setup.config.in),
+    and link libpython2.so with -lm in Makefile (closes: #86027).
+  * various cleanups in debian/rules, e.g. removing dh_suidregister.
+  * Make pdb available as /usr/bin/pdb-python2 in python2-dev
+    (cf. #79870 in python-base).
+  * Remove libgmp3 from build-dependencies, since we currently can't
+    build the mpzmodule for Python2 due to license problems.
+
+ -- Gregor Hoffleit <flight@debian.org>  Sun, 18 Feb 2001 00:12:17 +0100
+
+python2 (2.0-4) unstable; urgency=low
+
+  * control: make python2-elisp conflict with python-elisp (it doesn't
+    make sense to have both of them installed, does it ?)
+  * include build-depend on libxmltok1-dev.
+  * again, build with tcl/tk8.0.
+
+ -- Gregor Hoffleit <flight@debian.org>  Wed, 10 Jan 2001 23:37:01 +0100
+
+python2 (2.0-3) unstable; urgency=low
+
+  * Modules/Setup.in: Added a missing \ that made _tkinter be built
+    incorrectly.
+  * rules: on the fly, change all '#!' python scripts to use python2.
+
+ -- Gregor Hoffleit <flight@debian.org>  Wed, 13 Dec 2000 20:07:24 +0100
+
+python2 (2.0-2) unstable; urgency=low
+
+  * Aaargh. Remove conflicts/provides/replaces on python-base to make
+    parallel installation of python-base and python2-base possible.
+  * Install examples into /usr/share/doc/python2 (not python) and fix
+    symlink to python2.0 (thanks to Rick Younie <younie@home.com> for
+    pointing out this).
+  * Rename man page to python2.1.
+
+ -- Gregor Hoffleit <flight@debian.org>  Wed, 13 Dec 2000 09:31:05 +0100
+
+python2 (2.0-1) unstable; urgency=low
+
+  * New upstream version. Initial release for python2.
+
+ -- Gregor Hoffleit <flight@debian.org>  Mon, 11 Dec 2000 22:39:46 +0100
--- python2.7-2.7.3.orig/debian/compat
+++ python2.7-2.7.3/debian/compat
@@ -0,0 +1 @@
+5
--- python2.7-2.7.3.orig/debian/source/format
+++ python2.7-2.7.3/debian/source/format
@@ -0,0 +1 @@
+1.0
--- python2.7-2.7.3.orig/debian/patches/disable-sem-check.diff
+++ python2.7-2.7.3/debian/patches/disable-sem-check.diff
@@ -0,0 +1,28 @@
+# DP: Assume working semaphores on Linux, don't rely on running kernel for the check.
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -3645,6 +3645,11 @@
+ [ac_cv_posix_semaphores_enabled=no],
+ [ac_cv_posix_semaphores_enabled=yes])
+ )
++case $ac_sys_system in
++  Linux*)
++    # assume enabled, see https://launchpad.net/bugs/630511
++    ac_cv_posix_semaphores_enabled=yes
++esac
+ AC_MSG_RESULT($ac_cv_posix_semaphores_enabled)
+ if test $ac_cv_posix_semaphores_enabled = no
+ then
+@@ -3681,6 +3686,11 @@
+ [ac_cv_broken_sem_getvalue=yes],
+ [ac_cv_broken_sem_getvalue=yes])
+ )
++case $ac_sys_system in
++  Linux*)
++    # assume enabled, see https://launchpad.net/bugs/630511
++    ac_cv_broken_sem_getvalue=no
++esac
+ AC_MSG_RESULT($ac_cv_broken_sem_getvalue)
+ if test $ac_cv_broken_sem_getvalue = yes
+ then
--- python2.7-2.7.3.orig/debian/patches/apport-support.dpatch
+++ python2.7-2.7.3/debian/patches/apport-support.dpatch
@@ -0,0 +1,42 @@
+#! /bin/sh -e
+
+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/site.py	2004-07-20 12:28:28.000000000 +1000
++++ Lib/site.py	2006-11-09 09:28:32.000000000 +1100
+@@ -393,6 +393,14 @@
+     # this module is run as a script, because this code is executed twice.
+     if hasattr(sys, "setdefaultencoding"):
+         del sys.setdefaultencoding
++    # install the apport exception handler if available
++    try:
++        import apport_python_hook
++    except ImportError:
++        pass
++    else:
++        apport_python_hook.install()
++
+ 
+ main()
+ 
--- python2.7-2.7.3.orig/debian/patches/langpack-gettext.diff
+++ python2.7-2.7.3/debian/patches/langpack-gettext.diff
@@ -0,0 +1,34 @@
+# DP: Description: support alternative gettext tree in
+# DP: /usr/share/locale-langpack; if a file is present in both trees,
+# DP: prefer the newer one
+# DP: Upstream status: Ubuntu-Specific
+
+--- a/Lib/gettext.py
++++ b/Lib/gettext.py
+@@ -446,11 +446,26 @@
+         if lang == 'C':
+             break
+         mofile = os.path.join(localedir, lang, 'LC_MESSAGES', '%s.mo' % domain)
++        mofile_lp = os.path.join("/usr/share/locale-langpack", lang,
++                               'LC_MESSAGES', '%s.mo' % domain)
++
++	# first look into the standard locale dir, then into the 
++	# langpack locale dir
++
++	# standard mo file
+         if os.path.exists(mofile):
+             if all:
+                 result.append(mofile)
+             else:
+                 return mofile
++        
++	# langpack mofile -> use it
++        if os.path.exists(mofile_lp): 
++            if all:
++                result.append(mofile_lp)
++            else:
++                return mofile_lp
++
+     return result
+ 
+ 
--- python2.7-2.7.3.orig/debian/patches/libre.diff
+++ python2.7-2.7.3/debian/patches/libre.diff
@@ -0,0 +1,9 @@
+--- Doc/lib/libre.tex~	2003-07-25 09:29:22.000000000 +0200
++++ Doc/lib/libre.tex	2003-07-25 09:30:58.000000000 +0200
+@@ -919,5 +919,5 @@
+ Starting with Python 2.3, simple uses of the \regexp{*?} pattern are
+ special-cased to avoid recursion.  Thus, the above regular expression
+ can avoid recursion by being recast as
+-\regexp{Begin [a-zA-Z0-9_ ]*?end}.  As a further benefit, such regular
++`Begin [a-zA-Z0-9_ ]*?end'.  As a further benefit, such regular
+ expressions will run faster than their recursive equivalents.
--- python2.7-2.7.3.orig/debian/patches/distutils-link.diff
+++ python2.7-2.7.3/debian/patches/distutils-link.diff
@@ -0,0 +1,18 @@
+# DP: Don't add standard library dirs to library_dirs and runtime_library_dirs.
+
+--- a/Lib/distutils/unixccompiler.py
++++ b/Lib/distutils/unixccompiler.py
+@@ -213,7 +213,12 @@
+         objects, output_dir = self._fix_object_args(objects, output_dir)
+         libraries, library_dirs, runtime_library_dirs = \
+             self._fix_lib_args(libraries, library_dirs, runtime_library_dirs)
+-
++        # filter out standard library paths, which are not explicitely needed
++        # for linking
++        library_dirs = [dir for dir in library_dirs
++                        if not dir in ('/lib', '/lib64', '/usr/lib', '/usr/lib64')]
++        runtime_library_dirs = [dir for dir in runtime_library_dirs
++                                if not dir in ('/lib', '/lib64', '/usr/lib', '/usr/lib64')]
+         lib_opts = gen_lib_options(self, library_dirs, runtime_library_dirs,
+                                    libraries)
+         if type(output_dir) not in (StringType, NoneType):
--- python2.7-2.7.3.orig/debian/patches/linecache.diff
+++ python2.7-2.7.3/debian/patches/linecache.diff
@@ -0,0 +1,16 @@
+# DP: Proper handling of packages in linecache.py
+
+--- a/Lib/linecache.py
++++ b/Lib/linecache.py
+@@ -108,6 +108,11 @@
+         if os.path.isabs(filename):
+             return []
+ 
++        # Take care to handle packages
++        if basename == '__init__.py':
++            # filename referes to a package
++            basename = filename
++
+         for dirname in sys.path:
+             # When using imputil, sys.path may contain things other than
+             # strings; ignore them when it happens.
--- python2.7-2.7.3.orig/debian/patches/link-system-expat.diff
+++ python2.7-2.7.3/debian/patches/link-system-expat.diff
@@ -0,0 +1,22 @@
+# DP: Link with the system expat
+
+--- a/Modules/Setup.dist
++++ b/Modules/Setup.dist
+@@ -180,7 +180,7 @@
+ #itertools itertoolsmodule.c	# Functions creating iterators for efficient looping 
+ #strop stropmodule.c		# String manipulations
+ #_functools _functoolsmodule.c	# Tools for working with functions and callable objects
+-#_elementtree -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI _elementtree.c	# elementtree accelerator
++#_elementtree -DUSE_PYEXPAT_CAPI _elementtree.c	# elementtree accelerator
+ #_pickle _pickle.c	# pickle accelerator
+ #datetime datetimemodule.c	# date/time type
+ #_bisect _bisectmodule.c	# Bisection algorithms
+@@ -471,7 +471,7 @@
+ #
+ # More information on Expat can be found at www.libexpat.org.
+ #
+-#pyexpat expat/xmlparse.c expat/xmlrole.c expat/xmltok.c pyexpat.c -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI
++#pyexpat pyexpat.c -lexpat
+ 
+ 
+ # Hye-Shik Chang's CJKCodecs
--- python2.7-2.7.3.orig/debian/patches/issue670664.diff
+++ python2.7-2.7.3/debian/patches/issue670664.diff
@@ -0,0 +1,54 @@
+# DP: Proposed patch for issue #670664.
+
+--- a/Lib/HTMLParser.py
++++ b/Lib/HTMLParser.py
+@@ -96,6 +96,7 @@
+         self.rawdata = ''
+         self.lasttag = '???'
+         self.interesting = interesting_normal
++        self.cdata_tag = None
+         markupbase.ParserBase.reset(self)
+ 
+     def feed(self, data):
+@@ -120,11 +121,13 @@
+         """Return full source of start tag: '<...>'."""
+         return self.__starttag_text
+ 
+-    def set_cdata_mode(self):
++    def set_cdata_mode(self, tag):
+         self.interesting = interesting_cdata
++        self.cdata_tag = tag.lower()
+ 
+     def clear_cdata_mode(self):
+         self.interesting = interesting_normal
++        self.cdata_tag = None
+ 
+     # Internal -- handle data as far as reasonable.  May leave state
+     # and data to be processed by a subsequent call.  If 'end' is
+@@ -270,7 +273,7 @@
+         else:
+             self.handle_starttag(tag, attrs)
+             if tag in self.CDATA_CONTENT_ELEMENTS:
+-                self.set_cdata_mode()
++                self.set_cdata_mode(tag)
+         return endpos
+ 
+     # Internal -- check to see if we have a complete starttag; return end
+@@ -314,10 +317,16 @@
+         j = match.end()
+         match = endtagfind.match(rawdata, i) # </ + tag + >
+         if not match:
++            if self.cdata_tag is not None: return j
+             self.error("bad end tag: %r" % (rawdata[i:j],))
+-        tag = match.group(1)
++        tag = match.group(1).strip()
++	
++        if self.cdata_tag is not None:
++            if tag.lower() != self.cdata_tag: return j
++
+         self.handle_endtag(tag.lower())
+         self.clear_cdata_mode()
++
+         return j
+ 
+     # Overridable -- finish processing of start+end tag: <tag.../>
--- python2.7-2.7.3.orig/debian/patches/hurd-broken-poll.diff
+++ python2.7-2.7.3/debian/patches/hurd-broken-poll.diff
@@ -0,0 +1,23 @@
+# DP: Fix build failure on hurd, working around poll() on systems
+# DP: on which it returns an error on invalid FDs.
+
+--- a/Modules/selectmodule.c
++++ b/Modules/selectmodule.c
+@@ -1736,7 +1736,7 @@
+ 
+ static PyMethodDef select_methods[] = {
+     {"select",          select_select,  METH_VARARGS,   select_doc},
+-#ifdef HAVE_POLL
++#if defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)
+     {"poll",            select_poll,    METH_NOARGS,    poll_doc},
+ #endif /* HAVE_POLL */
+     {0,         0},     /* sentinel */
+@@ -1768,7 +1768,7 @@
+     PyModule_AddIntConstant(m, "PIPE_BUF", PIPE_BUF);
+ #endif
+ 
+-#if defined(HAVE_POLL)
++#if defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)
+ #ifdef __APPLE__
+     if (select_have_broken_poll()) {
+         if (PyObject_DelAttrString(m, "poll") == -1) {
--- python2.7-2.7.3.orig/debian/patches/site-locations.diff
+++ python2.7-2.7.3/debian/patches/site-locations.diff
@@ -0,0 +1,32 @@
+# DP: Set site-packages/dist-packages
+
+--- a/Lib/site.py
++++ b/Lib/site.py
+@@ -19,6 +19,12 @@
+ resulting directories, if they exist, are appended to sys.path, and
+ also inspected for path configuration files.
+ 
++For Debian and derivatives, this sys.path is augmented with directories
++for packages distributed within the distribution. Local addons go
++into /usr/local/lib/python<version>/dist-packages, Debian addons
++install into /usr/{lib,share}/python<version>/dist-packages.
++/usr/lib/python<version>/site-packages is not used.
++
+ 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
+@@ -300,10 +306,12 @@
+         if sys.platform in ('os2emx', 'riscos'):
+             sitepackages.append(os.path.join(prefix, "Lib", "site-packages"))
+         elif os.sep == '/':
++            sitepackages.append(os.path.join(prefix, "local/lib",
++                                        "python" + sys.version[:3],
++                                        "dist-packages"))
+             sitepackages.append(os.path.join(prefix, "lib",
+                                         "python" + sys.version[:3],
+-                                        "site-packages"))
+-            sitepackages.append(os.path.join(prefix, "lib", "site-python"))
++                                        "dist-packages"))
+         else:
+             sitepackages.append(prefix)
+             sitepackages.append(os.path.join(prefix, "lib", "site-packages"))
--- python2.7-2.7.3.orig/debian/patches/setup-modules-heapq.diff
+++ python2.7-2.7.3/debian/patches/setup-modules-heapq.diff
@@ -0,0 +1,12 @@
+Index: b/Modules/Setup.dist
+===================================================================
+--- a/Modules/Setup.dist
++++ b/Modules/Setup.dist
+@@ -177,6 +177,7 @@
+ #_testcapi _testcapimodule.c    # Python C API test module
+ #_random _randommodule.c	# Random number generator
+ #_collections _collectionsmodule.c # Container types
++#_heapq _heapqmodule.c # Heapq type
+ #itertools itertoolsmodule.c	# Functions creating iterators for efficient looping 
+ #strop stropmodule.c		# String manipulations
+ #_functools _functoolsmodule.c	# Tools for working with functions and callable objects
--- python2.7-2.7.3.orig/debian/patches/bdist-wininst-notfound.diff
+++ python2.7-2.7.3/debian/patches/bdist-wininst-notfound.diff
@@ -0,0 +1,17 @@
+# DP: the wininst-* files cannot be built within Debian, needing a
+# DP: zlib mingw build, which the zlib maintainer isn't going to provide.
+
+--- a/Lib/distutils/command/bdist_wininst.py
++++ b/Lib/distutils/command/bdist_wininst.py
+@@ -360,7 +360,10 @@
+             sfix = ''
+ 
+         filename = os.path.join(directory, "wininst-%.1f%s.exe" % (bv, sfix))
+-        f = open(filename, "rb")
++        try:
++            f = open(filename, "rb")
++        except IOError, msg:
++            raise DistutilsFileError, str(msg) + ', %s not included in the Debian packages.' % filename
+         try:
+             return f.read()
+         finally:
--- python2.7-2.7.3.orig/debian/patches/subprocess-eintr-safety.dpatch
+++ python2.7-2.7.3/debian/patches/subprocess-eintr-safety.dpatch
@@ -0,0 +1,81 @@
+#! /bin/sh -e
+
+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/test/test_subprocess.py	2007-03-14 19:16:36.000000000 +0100
++++ Lib/test/test_subprocess.py	2007-03-14 19:18:57.000000000 +0100
+@@ -580,6 +578,34 @@ class ProcessTestCase(unittest.TestCase)
+             os.remove(fname)
+             self.assertEqual(rc, 47)
+ 
++        def test_eintr(self):
++            # retries on EINTR for an argv
++
++            # send ourselves a signal that causes EINTR
++            prev_handler = signal.signal(signal.SIGALRM, lambda x,y: 1)
++            signal.alarm(1)
++            time.sleep(0.5)
++
++            rc = subprocess.Popen(['sleep', '1'])
++            self.assertEqual(rc.wait(), 0)
++
++            signal.signal(signal.SIGALRM, prev_handler)
++
++        def test_eintr_out(self):
++            # retries on EINTR for a shell call and pipelining
++
++            # send ourselves a signal that causes EINTR
++            prev_handler = signal.signal(signal.SIGALRM, lambda x,y: 1)
++            signal.alarm(1)
++            time.sleep(0.5)
++
++            rc = subprocess.Popen("sleep 1; echo hello",
++                shell=True, stdout=subprocess.PIPE)
++            out = rc.communicate()[0]
++            self.assertEqual(rc.returncode, 0)
++            self.assertEqual(out, "hello\n")
++
++            signal.signal(signal.SIGALRM, prev_handler)
+ 
+     #
+     # Windows tests
+--- Lib/subprocess.py~	2008-07-15 15:41:24.000000000 +0200
++++ Lib/subprocess.py	2008-07-15 15:42:49.000000000 +0200
+@@ -657,13 +657,13 @@
+             stderr = None
+             if self.stdin:
+                 if input:
+-                    self.stdin.write(input)
++                    self._fo_write_no_intr(self.stdin, input)
+                 self.stdin.close()
+             elif self.stdout:
+-                stdout = self.stdout.read()
++                stdout = self._fo_read_no_intr(self.stdout)
+                 self.stdout.close()
+             elif self.stderr:
+-                stderr = self.stderr.read()
++                stderr = self._fo_read_no_intr(self.stderr)
+                 self.stderr.close()
+             self.wait()
+             return (stdout, stderr)
--- python2.7-2.7.3.orig/debian/patches/multiprocessing-typos.diff
+++ python2.7-2.7.3/debian/patches/multiprocessing-typos.diff
@@ -0,0 +1,24 @@
+# DP: Fix typos in the multiprocessing module.
+
+--- a/Modules/_multiprocessing/multiprocessing.c
++++ b/Modules/_multiprocessing/multiprocessing.c
+@@ -63,7 +63,7 @@
+         break;
+     default:
+         PyErr_Format(PyExc_RuntimeError,
+-                     "unkown error number %d", num);
++                     "unknown error number %d", num);
+     }
+     return NULL;
+ }
+--- a/Lib/multiprocessing/synchronize.py
++++ b/Lib/multiprocessing/synchronize.py
+@@ -226,7 +226,7 @@
+             num_waiters = (self._sleeping_count._semlock._get_value() -
+                            self._woken_count._semlock._get_value())
+         except Exception:
+-            num_waiters = 'unkown'
++            num_waiters = 'unknown'
+         return '<Condition(%s, %s)>' % (self._lock, num_waiters)
+ 
+     def wait(self, timeout=None):
--- python2.7-2.7.3.orig/debian/patches/locale-module.diff
+++ python2.7-2.7.3/debian/patches/locale-module.diff
@@ -0,0 +1,17 @@
+# DP:   * Lib/locale.py:
+# DP:     - Don't map 'utf8', 'utf-8' to 'utf', which is not a known encoding
+# DP:       for glibc.
+
+--- a/Lib/locale.py
++++ b/Lib/locale.py
+@@ -1520,8 +1520,8 @@
+     'uk_ua.iso88595':                       'uk_UA.ISO8859-5',
+     'uk_ua.koi8u':                          'uk_UA.KOI8-U',
+     'uk_ua.microsoftcp1251':                'uk_UA.CP1251',
+-    'univ':                                 'en_US.utf',
+-    'universal':                            'en_US.utf',
++    'univ':                                 'en_US.UTF-8',
++    'universal':                            'en_US.UTF-8',
+     'universal.utf8@ucs4':                  'en_US.UTF-8',
+     'ur':                                   'ur_PK.CP1256',
+     'ur_pk':                                'ur_PK.CP1256',
--- python2.7-2.7.3.orig/debian/patches/doc-faq.dpatch
+++ python2.7-2.7.3/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.7-2.7.3.orig/debian/patches/distutils-install-layout.diff
+++ python2.7-2.7.3/debian/patches/distutils-install-layout.diff
@@ -0,0 +1,380 @@
+# DP: distutils: Add an option --install-layout=deb, which
+# DP: - installs into $prefix/dist-packages instead of $prefix/site-packages.
+# DP: - doesn't encode the python version into the egg name.
+
+Index: b/Doc/install/index.rst
+===================================================================
+--- a/Doc/install/index.rst
++++ b/Doc/install/index.rst
+@@ -240,6 +240,8 @@
+ +-----------------+-----------------------------------------------------+--------------------------------------------------+-------+
+ | Platform        | Standard installation location                      | Default value                                    | Notes |
+ +=================+=====================================================+==================================================+=======+
++| Debian/Ubuntu   | :file:`{prefix}/lib/python{X.Y}/dist-packages`      | :file:`/usr/local/lib/python{X.Y}/dist-packages` | \(0)  |
+++-----------------+-----------------------------------------------------+--------------------------------------------------+-------+
+ | Unix (pure)     | :file:`{prefix}/lib/python{X.Y}/site-packages`      | :file:`/usr/local/lib/python{X.Y}/site-packages` | \(1)  |
+ +-----------------+-----------------------------------------------------+--------------------------------------------------+-------+
+ | Unix (non-pure) | :file:`{exec-prefix}/lib/python{X.Y}/site-packages` | :file:`/usr/local/lib/python{X.Y}/site-packages` | \(1)  |
+@@ -249,6 +251,14 @@
+ 
+ Notes:
+ 
++(0)
++   Starting with Python-2.6 Debian/Ubuntu uses for the Python which comes within
++   the Linux distribution a non-default name for the installation directory. This
++   is to avoid overwriting of the python modules which come with the distribution,
++   which unfortunately is the upstream behaviour of the installation tools. The
++   non-default name in :file:`/usr/local` is used not to overwrite a local python
++   installation (defaulting to :file:`/usr/local`).
++
+ (1)
+    Most Linux distributions include Python as a standard part of the system, so
+    :file:`{prefix}` and :file:`{exec-prefix}` are usually both :file:`/usr` on
+@@ -433,6 +443,15 @@
+ 
+    /usr/bin/python setup.py install --prefix=/usr/local
+ 
++Starting with Python-2.6 Debian/Ubuntu does use
++:file:`/usr/lib/python{X.Y}/dist-packages` and
++:file:`/usr/local/lib/python{X.Y}/dist-packages` for the installation
++of python modules included in the Linux distribution.  To overwrite
++the name of the site directory, explicitely use the :option:`--prefix`
++option, however make sure that the installation path is included in
++``sys.path``.  For packaging of python modules for Debian/Ubuntu, use
++the new ``setup.py install`` option :option:`--install-layout=deb`.
++
+ Another possibility is a network filesystem where the name used to write to a
+ remote directory is different from the name used to read it: for example, the
+ Python interpreter accessed as :file:`/usr/local/bin/python` might search for
+@@ -684,6 +703,17 @@
+ import them, this directory must be added to ``sys.path``.  There are several
+ different ways to add the directory.
+ 
++On Debian/Ubuntu, starting with Python-2.6 the convention for system
++installed packages is to put then in the
++:file:`/usr/lib/python{X.Y}/dist-packages/` directory, and for locally
++installed packages is to put them in the
++:file:`/usr/lib/python{X.Y}/dist-packages/` directory.  To share the
++locally installed packages for the system provided Python with the
++locally installed packages of a local python installation, make
++:file:`/usr/lib/python{X.Y}/dist-packages/` a symbolic link to the
++:file:`{...}/site-packages/` directory of your local python
++installation.
++
+ The most convenient way is to add a path configuration file to a directory
+ that's already on Python's path, usually to the :file:`.../site-packages/`
+ directory.  Path configuration files have an extension of :file:`.pth`, and each
+Index: b/Lib/distutils/command/install.py
+===================================================================
+--- a/Lib/distutils/command/install.py
++++ b/Lib/distutils/command/install.py
+@@ -47,6 +47,20 @@
+         'scripts': '$base/bin',
+         'data'   : '$base',
+         },
++    'unix_local': {
++        'purelib': '$base/local/lib/python$py_version_short/dist-packages',
++        'platlib': '$platbase/local/lib/python$py_version_short/dist-packages',
++        'headers': '$base/local/include/python$py_version_short/$dist_name',
++        'scripts': '$base/local/bin',
++        'data'   : '$base/local',
++        },
++    'deb_system': {
++        'purelib': '$base/lib/python$py_version_short/dist-packages',
++        'platlib': '$platbase/lib/python$py_version_short/dist-packages',
++        'headers': '$base/include/python$py_version_short/$dist_name',
++        'scripts': '$base/bin',
++        'data'   : '$base',
++        },
+     'unix_home': {
+         'purelib': '$base/lib/python',
+         'platlib': '$base/lib/python',
+@@ -154,6 +168,9 @@
+ 
+         ('record=', None,
+          "filename in which to record list of installed files"),
++
++        ('install-layout=', None,
++         "installation layout to choose (known values: deb, unix)"),
+         ]
+ 
+     boolean_options = ['compile', 'force', 'skip-build', 'user']
+@@ -168,6 +185,7 @@
+         self.exec_prefix = None
+         self.home = None
+         self.user = 0
++        self.prefix_option = None
+ 
+         # These select only the installation base; it's up to the user to
+         # specify the installation scheme (currently, that means supplying
+@@ -189,6 +207,9 @@
+         self.install_userbase = USER_BASE
+         self.install_usersite = USER_SITE
+ 
++        # enable custom installation, known values: deb
++        self.install_layout = None
++
+         self.compile = None
+         self.optimize = None
+ 
+@@ -421,6 +442,7 @@
+             self.install_base = self.install_platbase = self.home
+             self.select_scheme("unix_home")
+         else:
++            self.prefix_option = self.prefix
+             if self.prefix is None:
+                 if self.exec_prefix is not None:
+                     raise DistutilsOptionError, \
+@@ -435,7 +457,23 @@
+ 
+             self.install_base = self.prefix
+             self.install_platbase = self.exec_prefix
+-            self.select_scheme("unix_prefix")
++            if self.install_layout:
++                if self.install_layout.lower() in ['deb']:
++                    self.select_scheme("deb_system")
++                elif self.install_layout.lower() in ['posix', 'unix']:
++                    self.select_scheme("unix_prefix")
++                else:
++                    raise DistutilsOptionError(
++                        "unknown value for --install-layout")
++            elif (self.prefix_option and os.path.normpath(self.prefix) != '/usr/local') \
++                    or 'PYTHONUSERBASE' in os.environ \
++                    or 'real_prefix' in sys.__dict__:
++                self.select_scheme("unix_prefix")
++            else:
++                if os.path.normpath(self.prefix) == '/usr/local':
++                    self.select_scheme("deb_system")
++                else:
++                    self.select_scheme("unix_local")
+ 
+     # finalize_unix ()
+ 
+Index: b/Lib/distutils/command/install_egg_info.py
+===================================================================
+--- a/Lib/distutils/command/install_egg_info.py
++++ b/Lib/distutils/command/install_egg_info.py
+@@ -14,18 +14,37 @@
+     description = "Install package's PKG-INFO metadata as an .egg-info file"
+     user_options = [
+         ('install-dir=', 'd', "directory to install to"),
++        ('install-layout', None, "custom installation layout"),
+     ]
+ 
+     def initialize_options(self):
+         self.install_dir = None
++        self.install_layout = None
++        self.prefix_option = None
+ 
+     def finalize_options(self):
+         self.set_undefined_options('install_lib',('install_dir','install_dir'))
+-        basename = "%s-%s-py%s.egg-info" % (
+-            to_filename(safe_name(self.distribution.get_name())),
+-            to_filename(safe_version(self.distribution.get_version())),
+-            sys.version[:3]
+-        )
++        self.set_undefined_options('install',('install_layout','install_layout'))
++        self.set_undefined_options('install',('prefix_option','prefix_option'))
++        if self.install_layout:
++            basename = "%s-%s.egg-info" % (
++                to_filename(safe_name(self.distribution.get_name())),
++                to_filename(safe_version(self.distribution.get_version()))
++                )
++            if not self.install_layout.lower() in ['deb']:
++                raise DistutilsOptionError(
++                    "unknown value for --install-layout")
++        elif self.prefix_option or 'real_prefix' in sys.__dict__:
++            basename = "%s-%s-py%s.egg-info" % (
++                to_filename(safe_name(self.distribution.get_name())),
++                to_filename(safe_version(self.distribution.get_version())),
++                sys.version[:3]
++                )
++        else:
++            basename = "%s-%s.egg-info" % (
++                to_filename(safe_name(self.distribution.get_name())),
++                to_filename(safe_version(self.distribution.get_version()))
++                )
+         self.target = os.path.join(self.install_dir, basename)
+         self.outputs = [self.target]
+ 
+Index: b/Lib/distutils/sysconfig.py
+===================================================================
+--- a/Lib/distutils/sysconfig.py
++++ b/Lib/distutils/sysconfig.py
+@@ -110,6 +110,7 @@
+     If 'prefix' is supplied, use it instead of sys.prefix or
+     sys.exec_prefix -- i.e., ignore 'plat_specific'.
+     """
++    is_default_prefix = not prefix or os.path.normpath(prefix) in ('/usr', '/usr/local')
+     if prefix is None:
+         prefix = plat_specific and EXEC_PREFIX or PREFIX
+ 
+@@ -118,6 +119,8 @@
+                                  "lib", "python" + get_python_version())
+         if standard_lib:
+             return libpython
++        elif is_default_prefix and 'PYTHONUSERBASE' not in os.environ and 'real_prefix' not in sys.__dict__:
++            return os.path.join(libpython, "dist-packages")
+         else:
+             return os.path.join(libpython, "site-packages")
+ 
+Index: b/Lib/site.py
+===================================================================
+--- a/Lib/site.py
++++ b/Lib/site.py
+@@ -285,6 +285,13 @@
+ 
+     if ENABLE_USER_SITE and os.path.isdir(user_site):
+         addsitedir(user_site, known_paths)
++    if ENABLE_USER_SITE:
++        for dist_libdir in ("local/lib", "lib"):
++            user_site = os.path.join(USER_BASE, dist_libdir,
++                                     "python" + sys.version[:3],
++                                     "dist-packages")
++            if os.path.isdir(user_site):
++                addsitedir(user_site, known_paths)
+     return known_paths
+ 
+ def getsitepackages():
+Index: b/Lib/sysconfig.py
+===================================================================
+--- a/Lib/sysconfig.py
++++ b/Lib/sysconfig.py
+@@ -16,6 +16,26 @@
+         'scripts': '{base}/bin',
+         'data': '{base}',
+         },
++    'posix_local': {
++        'stdlib': '{base}/lib/python{py_version_short}',
++        'platstdlib': '{platbase}/lib/python{py_version_short}',
++        'purelib': '{base}/local/lib/python{py_version_short}/dist-packages',
++        'platlib': '{platbase}/local/lib/python{py_version_short}/dist-packages',
++        'include': '{base}/local/include/python{py_version_short}',
++        'platinclude': '{platbase}/local/include/python{py_version_short}',
++        'scripts': '{base}/local/bin',
++        'data': '{base}/local',
++        },
++    'deb_system': {
++        'stdlib': '{base}/lib/python{py_version_short}',
++        'platstdlib': '{platbase}/lib/python{py_version_short}',
++        'purelib': '{base}/lib/python{py_version_short}/dist-packages',
++        'platlib': '{platbase}/lib/python{py_version_short}/dist-packages',
++        'include': '{base}/include/python{py_version_short}',
++        'platinclude': '{platbase}/include/python{py_version_short}',
++        'scripts': '{base}/bin',
++        'data': '{base}',
++        },
+     'posix_home': {
+         'stdlib': '{base}/lib/python',
+         'platstdlib': '{base}/lib/python',
+@@ -125,7 +145,7 @@
+ _PYTHON_BUILD = is_python_build()
+ 
+ if _PYTHON_BUILD:
+-    for scheme in ('posix_prefix', 'posix_home'):
++    for scheme in ('posix_prefix', 'posix_local', 'deb_system', 'posix_home'):
+         _INSTALL_SCHEMES[scheme]['include'] = '{projectbase}/Include'
+         _INSTALL_SCHEMES[scheme]['platinclude'] = '{srcdir}'
+ 
+@@ -159,8 +179,11 @@
+ 
+ def _get_default_scheme():
+     if os.name == 'posix':
+-        # the default scheme for posix is posix_prefix
+-        return 'posix_prefix'
++        # the default scheme for posix on Debian/Ubuntu is posix_local
++        # FIXME: return dist-packages/posix_prefix only for
++        #   is_default_prefix and 'PYTHONUSERBASE' not in os.environ and 'real_prefix' not in sys.__dict__
++        # is_default_prefix = not prefix or os.path.normpath(prefix) in ('/usr', '/usr/local')
++        return 'posix_local'
+     return os.name
+ 
+ def _getuserbase():
+@@ -305,7 +328,7 @@
+ def _get_makefile_filename():
+     if _PYTHON_BUILD:
+         return os.path.join(_PROJECT_BASE, "Makefile")
+-    return os.path.join(get_path('platstdlib'), "config", "Makefile")
++    return os.path.join(get_path('platstdlib').replace("/usr/local","/usr",1), "config", "Makefile")
+ 
+ 
+ def _init_posix(vars):
+@@ -390,7 +413,7 @@
+         else:
+             inc_dir = _PROJECT_BASE
+     else:
+-        inc_dir = get_path('platinclude')
++        inc_dir = get_path('platinclude').replace("/usr/local","/usr",1)
+     return os.path.join(inc_dir, 'pyconfig.h')
+ 
+ def get_scheme_names():
+Index: b/Lib/test/test_site.py
+===================================================================
+--- a/Lib/test/test_site.py
++++ b/Lib/test/test_site.py
+@@ -242,10 +242,13 @@
+         elif os.sep == '/':
+             # OS X non-framwework builds, Linux, FreeBSD, etc
+             self.assertEqual(len(dirs), 2)
+-            wanted = os.path.join('xoxo', 'lib', 'python' + sys.version[:3],
+-                                  'site-packages')
++            wanted = os.path.join('xoxo', 'local', 'lib',
++                                  'python' + sys.version[:3],
++                                  'dist-packages')
+             self.assertEqual(dirs[0], wanted)
+-            wanted = os.path.join('xoxo', 'lib', 'site-python')
++            wanted = os.path.join('xoxo', 'lib',
++                                  'python' + sys.version[:3],
++                                  'dist-packages')
+             self.assertEqual(dirs[1], wanted)
+         else:
+             # other platforms
+Index: b/Lib/test/test_sysconfig.py
+===================================================================
+--- a/Lib/test/test_sysconfig.py
++++ b/Lib/test/test_sysconfig.py
+@@ -230,8 +230,8 @@
+         self.assertTrue(os.path.isfile(config_h), config_h)
+ 
+     def test_get_scheme_names(self):
+-        wanted = ('nt', 'nt_user', 'os2', 'os2_home', 'osx_framework_user',
+-                  'posix_home', 'posix_prefix', 'posix_user')
++        wanted = ('deb_system', 'nt', 'nt_user', 'os2', 'os2_home', 'osx_framework_user',
++                  'posix_home', 'posix_local', 'posix_prefix', 'posix_user')
+         self.assertEqual(get_scheme_names(), wanted)
+ 
+     def test_symlink(self):
+Index: b/Lib/distutils/tests/test_install.py
+===================================================================
+--- a/Lib/distutils/tests/test_install.py
++++ b/Lib/distutils/tests/test_install.py
+@@ -195,7 +195,7 @@
+ 
+         found = [os.path.basename(line) for line in content.splitlines()]
+         expected = ['hello.py', 'hello.pyc', 'sayhi',
+-                    'UNKNOWN-0.0.0-py%s.%s.egg-info' % sys.version_info[:2]]
++                    'UNKNOWN-0.0.0.egg-info']
+         self.assertEqual(found, expected)
+ 
+     def test_record_extensions(self):
+@@ -225,7 +225,7 @@
+ 
+         found = [os.path.basename(line) for line in content.splitlines()]
+         expected = [_make_ext_name('xx'),
+-                    'UNKNOWN-0.0.0-py%s.%s.egg-info' % sys.version_info[:2]]
++                    'UNKNOWN-0.0.0.egg-info']
+         self.assertEqual(found, expected)
+ 
+     def test_debug_mode(self):
+Index: b/Lib/pydoc.py
+===================================================================
+--- a/Lib/pydoc.py
++++ b/Lib/pydoc.py
+@@ -359,6 +359,7 @@
+                                  'marshal', 'posix', 'signal', 'sys',
+                                  'thread', 'zipimport') or
+              (file.startswith(basedir) and
++              not file.startswith(os.path.join(basedir, 'dist-packages')) and
+               not file.startswith(os.path.join(basedir, 'site-packages')))) and
+             object.__name__ not in ('xml.etree', 'test.pydoc_mod')):
+             if docloc.startswith("http://"):
--- python2.7-2.7.3.orig/debian/patches/issue15340.diff
+++ python2.7-2.7.3/debian/patches/issue15340.diff
@@ -0,0 +1,16 @@
+# DP: - Issue #15340: Fix importing the random module when /dev/urandom cannot
+# DP:   be opened.  This was a regression caused by the hash randomization patch.
+
+diff -r 8cd6acffbcb9 -r edbf37ace03c Python/random.c
+--- a/Python/random.c	Fri Sep 07 00:55:33 2012 +0200
++++ b/Python/random.c	Fri Sep 07 23:49:07 2012 +0200
+@@ -165,7 +165,8 @@
+     Py_END_ALLOW_THREADS
+     if (fd < 0)
+     {
+-        PyErr_SetFromErrnoWithFilename(PyExc_OSError, "/dev/urandom");
++        PyErr_SetString(PyExc_NotImplementedError,
++                        "/dev/urandom (or equivalent) not found");
+         return -1;
+     }
+ 
--- python2.7-2.7.3.orig/debian/patches/hotshot-import.diff
+++ python2.7-2.7.3/debian/patches/hotshot-import.diff
@@ -0,0 +1,17 @@
+# DP: hotshot: Check for the availability of the profile and pstats modules.
+
+--- a/Lib/hotshot/stats.py
++++ b/Lib/hotshot/stats.py
+@@ -1,7 +1,10 @@
+ """Statistics analyzer for HotShot."""
+ 
+-import profile
+-import pstats
++try:
++    import profile
++    import pstats
++except ImportError, e:
++    raise ImportError, str(e) + '; please install the python-profiler package'
+ 
+ import hotshot.log
+ 
--- python2.7-2.7.3.orig/debian/patches/profiled-build.diff
+++ python2.7-2.7.3/debian/patches/profiled-build.diff
@@ -0,0 +1,27 @@
+# DP: Fix profiled build; don't use Python/thread.gc*, gcc complains
+
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -388,18 +388,18 @@
+ 	$(MAKE) build_all_use_profile
+ 
+ build_all_generate_profile:
+-	$(MAKE) all CFLAGS="$(CFLAGS) -fprofile-generate" LIBS="$(LIBS) -lgcov"
++	$(MAKE) all PY_CFLAGS="$(PY_CFLAGS) -fprofile-generate" LIBS="$(LIBS) -lgcov"
+ 
+ run_profile_task:
+-	./$(BUILDPYTHON) $(PROFILE_TASK)
++	-./$(BUILDPYTHON) $(PROFILE_TASK)
+ 
+ build_all_use_profile:
+-	$(MAKE) all CFLAGS="$(CFLAGS) -fprofile-use"
++	$(MAKE) all PY_CFLAGS="$(PY_CFLAGS) -fprofile-use -fprofile-correction"
+ 
+ coverage:
+ 	@echo "Building with support for coverage checking:"
+ 	$(MAKE) clean
+-	$(MAKE) all CFLAGS="$(CFLAGS) -O0 -pg -fprofile-arcs -ftest-coverage" LIBS="$(LIBS) -lgcov"
++	$(MAKE) all PY_CFLAGS="$(PY_CFLAGS) -O0 -pg -fprofile-arcs -ftest-coverage" LIBS="$(LIBS) -lgcov"
+ 
+ 
+ # Build the interpreter
--- python2.7-2.7.3.orig/debian/patches/test-sundry.diff
+++ python2.7-2.7.3/debian/patches/test-sundry.diff
@@ -0,0 +1,17 @@
+# DP: test_sundry: Don't fail on import of the profile and pstats module
+
+--- a/Lib/test/test_sundry.py
++++ b/Lib/test/test_sundry.py
+@@ -62,7 +62,11 @@
+             import os2emxpath
+             import pdb
+             import posixfile
+-            import pstats
++            try:
++                import pstats  # separated out into the python-profiler package
++            except ImportError:
++                if test_support.verbose:
++                    print "skipping profile and pstats"
+             import py_compile
+             import rexec
+             import sched
--- python2.7-2.7.3.orig/debian/patches/hg-updates.diff
+++ python2.7-2.7.3/debian/patches/hg-updates.diff
@@ -0,0 +1,27402 @@
+# DP: hg updates of the 2.7 release branch (until 2012-08-15).
+
+# hg diff -r v2.7.3 | filterdiff --exclude=.*ignore --exclude=.hg* --remove-timestamps
+
+diff -r 70274d53c1dd Doc/c-api/buffer.rst
+--- a/Doc/c-api/buffer.rst
++++ b/Doc/c-api/buffer.rst
+@@ -33,7 +33,7 @@
+ Starting from version 1.6, Python has been providing Python-level buffer
+ objects and a C-level buffer API so that any built-in or used-defined type can
+ expose its characteristics. Both, however, have been deprecated because of
+-various shortcomings, and have been officially removed in Python 3.0 in favour
++various shortcomings, and have been officially removed in Python 3 in favour
+ of a new C-level buffer API and a new Python-level object named
+ :class:`memoryview`.
+ 
+diff -r 70274d53c1dd Doc/c-api/memory.rst
+--- a/Doc/c-api/memory.rst
++++ b/Doc/c-api/memory.rst
+@@ -98,7 +98,7 @@
+ 
+    Allocates *n* bytes and returns a pointer of type :c:type:`void\*` to the
+    allocated memory, or *NULL* if the request fails. Requesting zero bytes returns
+-   a distinct non-*NULL* pointer if possible, as if :c:func:`PyMem_Malloc(1)` had
++   a distinct non-*NULL* pointer if possible, as if ``PyMem_Malloc(1)`` had
+    been called instead. The memory will not have been initialized in any way.
+ 
+ 
+@@ -106,7 +106,7 @@
+ 
+    Resizes the memory block pointed to by *p* to *n* bytes. The contents will be
+    unchanged to the minimum of the old and the new sizes. If *p* is *NULL*, the
+-   call is equivalent to :c:func:`PyMem_Malloc(n)`; else if *n* is equal to zero,
++   call is equivalent to ``PyMem_Malloc(n)``; else if *n* is equal to zero,
+    the memory block is resized but is not freed, and the returned pointer is
+    non-*NULL*.  Unless *p* is *NULL*, it must have been returned by a previous call
+    to :c:func:`PyMem_Malloc` or :c:func:`PyMem_Realloc`. If the request fails,
+@@ -118,7 +118,7 @@
+ 
+    Frees the memory block pointed to by *p*, which must have been returned by a
+    previous call to :c:func:`PyMem_Malloc` or :c:func:`PyMem_Realloc`.  Otherwise, or
+-   if :c:func:`PyMem_Free(p)` has been called before, undefined behavior occurs. If
++   if ``PyMem_Free(p)`` has been called before, undefined behavior occurs. If
+    *p* is *NULL*, no operation is performed.
+ 
+ The following type-oriented macros are provided for convenience.  Note  that
+diff -r 70274d53c1dd Doc/c-api/objbuffer.rst
+--- a/Doc/c-api/objbuffer.rst
++++ b/Doc/c-api/objbuffer.rst
+@@ -8,7 +8,7 @@
+ 
+ This section describes the legacy buffer protocol, which has been introduced
+ in Python 1.6. It is still supported but deprecated in the Python 2.x series.
+-Python 3.0 introduces a new buffer protocol which fixes weaknesses and
++Python 3 introduces a new buffer protocol which fixes weaknesses and
+ shortcomings of the protocol, and has been backported to Python 2.6.  See
+ :ref:`bufferobjects` for more information.
+ 
+diff -r 70274d53c1dd Doc/c-api/typeobj.rst
+--- a/Doc/c-api/typeobj.rst
++++ b/Doc/c-api/typeobj.rst
+@@ -1227,7 +1227,7 @@
+ - If the :const:`Py_TPFLAGS_CHECKTYPES` flag is set, binary and ternary
+   functions must check the type of all their operands, and implement the
+   necessary conversions (at least one of the operands is an instance of the
+-  defined type).  This is the recommended way; with Python 3.0 coercion will
++  defined type).  This is the recommended way; with Python 3 coercion will
+   disappear completely.
+ 
+ If the operation is not defined for the given operands, binary and ternary
+diff -r 70274d53c1dd Doc/distutils/apiref.rst
+--- a/Doc/distutils/apiref.rst
++++ b/Doc/distutils/apiref.rst
+@@ -444,7 +444,9 @@
+       Define a preprocessor macro for all compilations driven by this compiler object.
+       The optional parameter *value* should be a string; if it is not supplied, then
+       the macro will be defined without an explicit value and the exact outcome
+-      depends on the compiler used (XXX true? does ANSI say anything about this?)
++      depends on the compiler used.
++
++      .. XXX true? does ANSI say anything about this?
+ 
+ 
+    .. method:: CCompiler.undefine_macro(name)
+@@ -598,7 +600,9 @@
+ 
+       *output_libname* should be a library name, not a filename; the filename will be
+       inferred from the library name.  *output_dir* is the directory where the library
+-      file will be put. XXX defaults to what?
++      file will be put.
++
++      .. XXX defaults to what?
+ 
+       *debug* is a boolean; if true, debugging information will be included in the
+       library (note that on most platforms, it is the compile step where this matters:
+@@ -718,30 +722,29 @@
+ 
+       Invokes :func:`distutils.util.execute` This method invokes a  Python function
+       *func* with the given arguments *args*, after  logging and taking into account
+-      the *dry_run* flag. XXX see also.
++      the *dry_run* flag.
+ 
+ 
+    .. method:: CCompiler.spawn(cmd)
+ 
+       Invokes :func:`distutils.util.spawn`. This invokes an external  process to run
+-      the given command. XXX see also.
++      the given command.
+ 
+ 
+    .. method:: CCompiler.mkpath(name[, mode=511])
+ 
+       Invokes :func:`distutils.dir_util.mkpath`. This creates a directory  and any
+-      missing ancestor directories. XXX see also.
++      missing ancestor directories.
+ 
+ 
+    .. method:: CCompiler.move_file(src, dst)
+ 
+-      Invokes :meth:`distutils.file_util.move_file`. Renames *src* to  *dst*.  XXX see
+-      also.
++      Invokes :meth:`distutils.file_util.move_file`. Renames *src* to  *dst*.
+ 
+ 
+    .. method:: CCompiler.announce(msg[, level=1])
+ 
+-      Write a message using :func:`distutils.log.debug`. XXX see also.
++      Write a message using :func:`distutils.log.debug`.
+ 
+ 
+    .. method:: CCompiler.warn(msg)
+@@ -869,8 +872,6 @@
+    prefix of all files and directories in the archive.  *root_dir* and *base_dir*
+    both default to the current directory.  Returns the name of the archive file.
+ 
+-   .. XXX This should be changed to support bz2 files.
+-
+ 
+ .. function:: make_tarball(base_name, base_dir[, compress='gzip', verbose=0, dry_run=0])
+ 
+@@ -882,8 +883,6 @@
+    possibly plus the appropriate compression extension (:file:`.gz`, :file:`.bz2`
+    or :file:`.Z`).  Return the output filename.
+ 
+-   .. XXX This should be replaced with calls to the :mod:`tarfile` module.
+-
+ 
+ .. function:: make_zipfile(base_name, base_dir[, verbose=0, dry_run=0])
+ 
+@@ -974,8 +973,8 @@
+    Copy an entire directory tree *src* to a new location *dst*.  Both *src* and
+    *dst* must be directory names.  If *src* is not a directory, raise
+    :exc:`DistutilsFileError`.  If *dst* does  not exist, it is created with
+-   :func:`mkpath`.  The end result of the  copy is that every file in *src* is
+-   copied to *dst*, and  directories under *src* are recursively copied to *dst*.
++   :func:`mkpath`.  The end result of the copy is that every file in *src* is
++   copied to *dst*, and directories under *src* are recursively copied to *dst*.
+    Return the list of files that were copied or might have been copied, using their
+    output name. The return value is unaffected by *update* or *dry_run*: it is
+    simply the list of all files under *src*, with the names changed to be under
+@@ -988,6 +987,10 @@
+    destination of the symlink will be copied.  *update* and *verbose* are the same
+    as for :func:`copy_file`.
+ 
++   Files in *src* that begin with :file:`.nfs` are skipped (more information on
++   these files is available in answer D2 of the `NFS FAQ page
++   <http://nfs.sourceforge.net/#section_d>`_.
++
+ 
+ .. function:: remove_tree(directory[, verbose=0, dry_run=0])
+ 
+@@ -995,8 +998,6 @@
+    errors are ignored (apart from being reported to ``sys.stdout`` if *verbose* is
+    true).
+ 
+-.. XXX Some of this could be replaced with the shutil module?
+-
+ 
+ :mod:`distutils.file_util` --- Single file operations
+ =====================================================
+@@ -1110,8 +1111,6 @@
+ 
+    * ``macosx-10.6-intel``
+ 
+-   .. % XXX isn't this also provided by some other non-distutils module?
+-
+ 
+ .. function:: convert_path(pathname)
+ 
+@@ -1311,8 +1310,6 @@
+   the "negative alias" of :option:`--verbose`, then :option:`--quiet` on the
+   command line sets *verbose* to false.
+ 
+-.. XXX Should be replaced with :mod:`optparse`.
+-
+ 
+ .. function:: fancy_getopt(options, negative_opt, object, args)
+ 
+@@ -1329,8 +1326,6 @@
+ 
+    Wraps *text* to less than *width* wide.
+ 
+-   .. XXX Should be replaced with :mod:`textwrap` (which is available in Python
+-      2.3 and later).
+ 
+ 
+ .. class:: FancyGetopt([option_table=None])
+@@ -1394,10 +1389,6 @@
+    :synopsis: A simple logging mechanism, 282-style
+ 
+ 
+-.. XXX Should be replaced with standard :mod:`logging` module.
+-
+-
+-
+ :mod:`distutils.spawn` --- Spawn a sub-process
+ ==============================================
+ 
+@@ -1894,9 +1885,6 @@
+    :synopsis: Build the .py/.pyc files of a package
+ 
+ 
+-.. % todo
+-
+-
+ :mod:`distutils.command.build_scripts` --- Build the scripts of a package
+ =========================================================================
+ 
+diff -r 70274d53c1dd Doc/distutils/sourcedist.rst
+--- a/Doc/distutils/sourcedist.rst
++++ b/Doc/distutils/sourcedist.rst
+@@ -51,8 +51,7 @@
+    of the standard Python library since Python 1.6)
+ 
+ (4)
+-   requires the :program:`compress` program. Notice that this format is now
+-   pending for deprecation and will be removed in the future versions of Python.
++   requires the :program:`compress` program.
+ 
+ When using any ``tar`` format (``gztar``, ``bztar``, ``ztar`` or
+ ``tar``) under Unix, you can specify the ``owner`` and ``group`` names
+diff -r 70274d53c1dd Doc/distutils/uploading.rst
+--- a/Doc/distutils/uploading.rst
++++ b/Doc/distutils/uploading.rst
+@@ -74,4 +74,9 @@
+ 
+     $ python setup.py --long-description | rst2html.py > output.html
+ 
+-:mod:`docutils` will display a warning if there's something wrong with your syntax.
++:mod:`docutils` will display a warning if there's something wrong with your
++syntax.  Because PyPI applies additional checks (e.g. by passing ``--no-raw``
++to ``rst2html.py`` in the command above), being able to run the command above
++without warnings does not guarantee that PyPI will convert the content
++successfully.
++
+diff -r 70274d53c1dd Doc/extending/newtypes.rst
+--- a/Doc/extending/newtypes.rst
++++ b/Doc/extending/newtypes.rst
+@@ -1521,9 +1521,8 @@
+    }
+ 
+ The only further addition is that the destructor needs to call the weak
+-reference manager to clear any weak references.  This should be done before any
+-other parts of the destruction have occurred, but is only required if the weak
+-reference list is non-*NULL*::
++reference manager to clear any weak references.  This is only required if the
++weak reference list is non-*NULL*::
+ 
+    static void
+    instance_dealloc(PyInstanceObject *inst)
+diff -r 70274d53c1dd Doc/faq/design.rst
+--- a/Doc/faq/design.rst
++++ b/Doc/faq/design.rst
+@@ -297,8 +297,9 @@
+ How fast are exceptions?
+ ------------------------
+ 
+-A try/except block is extremely efficient.  Actually catching an exception is
+-expensive.  In versions of Python prior to 2.0 it was common to use this idiom::
++A try/except block is extremely efficient if no exceptions are raised.  Actually
++catching an exception is expensive.  In versions of Python prior to 2.0 it was
++common to use this idiom::
+ 
+    try:
+        value = mydict[key]
+@@ -309,11 +310,10 @@
+ This only made sense when you expected the dict to have the key almost all the
+ time.  If that wasn't the case, you coded it like this::
+ 
+-   if mydict.has_key(key):
++   if key in mydict:
+        value = mydict[key]
+    else:
+-       mydict[key] = getvalue(key)
+-       value = mydict[key]
++       value = mydict[key] = getvalue(key)
+ 
+ .. note::
+ 
+diff -r 70274d53c1dd Doc/faq/library.rst
+--- a/Doc/faq/library.rst
++++ b/Doc/faq/library.rst
+@@ -14,7 +14,7 @@
+ 
+ Check :ref:`the Library Reference <library-index>` to see if there's a relevant
+ standard library module.  (Eventually you'll learn what's in the standard
+-library and will able to skip this step.)
++library and will be able to skip this step.)
+ 
+ For third-party packages, search the `Python Package Index
+ <http://pypi.python.org/pypi>`_ or try `Google <http://www.google.com>`_ or
+@@ -28,7 +28,7 @@
+ If you can't find a source file for a module it may be a built-in or
+ dynamically loaded module implemented in C, C++ or other compiled language.
+ In this case you may not have the source file or it may be something like
+-mathmodule.c, somewhere in a C source directory (not on the Python Path).
++:file:`mathmodule.c`, somewhere in a C source directory (not on the Python Path).
+ 
+ There are (at least) three kinds of modules in Python:
+ 
+@@ -60,18 +60,18 @@
+ interpreter is installed on your platform.
+ 
+ If you would like the script to be independent of where the Python interpreter
+-lives, you can use the "env" program.  Almost all Unix variants support the
+-following, assuming the Python interpreter is in a directory on the user's
+-$PATH::
++lives, you can use the :program:`env` program.  Almost all Unix variants support
++the following, assuming the Python interpreter is in a directory on the user's
++:envvar:`PATH`::
+ 
+   #!/usr/bin/env python
+ 
+-*Don't* do this for CGI scripts.  The $PATH variable for CGI scripts is often
+-very minimal, so you need to use the actual absolute pathname of the
++*Don't* do this for CGI scripts.  The :envvar:`PATH` variable for CGI scripts is
++often very minimal, so you need to use the actual absolute pathname of the
+ interpreter.
+ 
+-Occasionally, a user's environment is so full that the /usr/bin/env program
+-fails; or there's no env program at all.  In that case, you can try the
++Occasionally, a user's environment is so full that the :program:`/usr/bin/env`
++program fails; or there's no env program at all.  In that case, you can try the
+ following hack (due to Alex Rezinsky)::
+ 
+    #! /bin/sh
+@@ -91,12 +91,12 @@
+ 
+ .. XXX curses *is* built by default, isn't it?
+ 
+-For Unix variants: The standard Python source distribution comes with a curses
+-module in the ``Modules/`` subdirectory, though it's not compiled by default
+-(note that this is not available in the Windows distribution -- there is no
+-curses module for Windows).
++For Unix variants the standard Python source distribution comes with a curses
++module in the :source:`Modules` subdirectory, though it's not compiled by default.
++(Note that this is not available in the Windows distribution -- there is no
++curses module for Windows.)
+ 
+-The curses module supports basic curses features as well as many additional
++The :mod:`curses` module supports basic curses features as well as many additional
+ functions from ncurses and SYSV curses such as colour, alternative character set
+ support, pads, and mouse support. This means the module isn't compatible with
+ operating systems that only have BSD curses, but there don't seem to be any
+@@ -110,7 +110,7 @@
+ -------------------------------------------------
+ 
+ The :mod:`atexit` module provides a register function that is similar to C's
+-onexit.
++:c:func:`onexit`.
+ 
+ 
+ Why don't my signal handlers work?
+@@ -140,8 +140,8 @@
+ The :mod:`unittest` module is a fancier testing framework modelled on Java and
+ Smalltalk testing frameworks.
+ 
+-For testing, it helps to write the program so that it may be easily tested by
+-using good modular design.  Your program should have almost all functionality
++To make testing easier, you should use good modular design in your program.
++Your program should have almost all functionality
+ encapsulated in either functions or class methods -- and this sometimes has the
+ surprising and delightful effect of making the program run faster (because local
+ variable accesses are faster than global accesses).  Furthermore the program
+@@ -157,7 +157,7 @@
+ 
+ Once your program is organized as a tractable collection of functions and class
+ behaviours you should write test functions that exercise the behaviours.  A test
+-suite can be associated with each module which automates a sequence of tests.
++suite that automates a sequence of tests can be associated with each module.
+ This sounds like a lot of work, but since Python is so terse and flexible it's
+ surprisingly easy.  You can make coding much more pleasant and fun by writing
+ your test functions in parallel with the "production code", since this makes it
+@@ -186,7 +186,7 @@
+ How do I get a single keypress at a time?
+ -----------------------------------------
+ 
+-For Unix variants: There are several solutions.  It's straightforward to do this
++For Unix variants there are several solutions.  It's straightforward to do this
+ using curses, but curses is a fairly large module to learn.  Here's a solution
+ without curses::
+ 
+@@ -273,7 +273,7 @@
+ 
+    time.sleep(10)
+ 
+-Instead of trying to guess how long a :func:`time.sleep` delay will be enough,
++Instead of trying to guess a good delay value for :func:`time.sleep`,
+ it's better to use some kind of semaphore mechanism.  One idea is to use the
+ :mod:`Queue` module to create a queue object, let each thread append a token to
+ the queue when it finishes, and let the main thread read as many tokens from the
+@@ -284,10 +284,10 @@
+ ---------------------------------------------------------
+ 
+ Use the :mod:`Queue` module to create a queue containing a list of jobs.  The
+-:class:`~Queue.Queue` class maintains a list of objects with ``.put(obj)`` to
+-add an item to the queue and ``.get()`` to return an item.  The class will take
+-care of the locking necessary to ensure that each job is handed out exactly
+-once.
++:class:`~Queue.Queue` class maintains a list of objects and has a ``.put(obj)``
++method that adds items to the queue and a ``.get()`` method to return them.
++The class will take care of the locking necessary to ensure that each job is
++handed out exactly once.
+ 
+ Here's a trivial example::
+ 
+@@ -296,7 +296,7 @@
+    # The worker thread gets jobs off the queue.  When the queue is empty, it
+    # assumes there will be no more work and exits.
+    # (Realistically workers will run until terminated.)
+-   def worker ():
++   def worker():
+        print 'Running worker'
+        time.sleep(0.1)
+        while True:
+@@ -329,6 +329,8 @@
+ 
+ When run, this will produce the following output:
+ 
++.. code-block:: none
++
+    Running worker
+    Running worker
+    Running worker
+@@ -343,15 +345,15 @@
+    Worker <Thread(worker 1, started)> running with argument 5
+    ...
+ 
+-Consult the module's documentation for more details; the ``Queue`` class
+-provides a featureful interface.
++Consult the module's documentation for more details; the :class:`~Queue.Queue`
++class provides a featureful interface.
+ 
+ 
+ What kinds of global value mutation are thread-safe?
+ ----------------------------------------------------
+ 
+-A global interpreter lock (GIL) is used internally to ensure that only one
+-thread runs in the Python VM at a time.  In general, Python offers to switch
++A :term:`global interpreter lock` (GIL) is used internally to ensure that only
++one thread runs in the Python VM at a time.  In general, Python offers to switch
+ among threads only between bytecode instructions; how frequently it switches can
+ be set via :func:`sys.setcheckinterval`.  Each bytecode instruction and
+ therefore all the C implementation code reached from each instruction is
+@@ -396,7 +398,7 @@
+ .. XXX mention multiprocessing
+ .. XXX link to dbeazley's talk about GIL?
+ 
+-The Global Interpreter Lock (GIL) is often seen as a hindrance to Python's
++The :term:`global interpreter lock` (GIL) is often seen as a hindrance to Python's
+ deployment on high-end multiprocessor server machines, because a multi-threaded
+ Python program effectively only uses one CPU, due to the insistence that
+ (almost) all Python code can only run while the GIL is held.
+@@ -459,7 +461,7 @@
+ To truncate a file, open it using ``f = open(filename, "r+")``, and use
+ ``f.truncate(offset)``; offset defaults to the current seek position.  There's
+ also ``os.ftruncate(fd, offset)`` for files opened with :func:`os.open`, where
+-``fd`` is the file descriptor (a small integer).
++*fd* is the file descriptor (a small integer).
+ 
+ The :mod:`shutil` module also contains a number of functions to work on files
+ including :func:`~shutil.copyfile`, :func:`~shutil.copytree`, and
+@@ -493,7 +495,7 @@
+ "short integer" (2 bytes), and 'l' reads one "long integer" (4 bytes) from the
+ string.
+ 
+-For data that is more regular (e.g. a homogeneous list of ints or thefloats),
++For data that is more regular (e.g. a homogeneous list of ints or floats),
+ you can also use the :mod:`array` module.
+ 
+ 
+@@ -503,7 +505,7 @@
+ :func:`os.read` is a low-level function which takes a file descriptor, a small
+ integer representing the opened file.  :func:`os.popen` creates a high-level
+ file object, the same type returned by the built-in :func:`open` function.
+-Thus, to read n bytes from a pipe p created with :func:`os.popen`, you need to
++Thus, to read *n* bytes from a pipe *p* created with :func:`os.popen`, you need to
+ use ``p.read(n)``.
+ 
+ 
+@@ -522,9 +524,9 @@
+ 
+ Warning: in general it is unwise to do this because you can easily cause a
+ deadlock where your process is blocked waiting for output from the child while
+-the child is blocked waiting for input from you.  This can be caused because the
+-parent expects the child to output more text than it does, or it can be caused
+-by data being stuck in stdio buffers due to lack of flushing.  The Python parent
++the child is blocked waiting for input from you.  This can be caused by the
++parent expecting the child to output more text than it does or by data being
++stuck in stdio buffers due to lack of flushing.  The Python parent
+ can of course explicitly flush the data it sends to the child before it reads
+ any output, but if the child is a naive C program it may have been written to
+ never explicitly flush its output, even if it is interactive, since flushing is
+@@ -544,8 +546,8 @@
+ In many cases, all you really need is to run some data through a command and get
+ the result back.  Unless the amount of data is very large, the easiest way to do
+ this is to write it to a temporary file and run the command with that temporary
+-file as input.  The standard module :mod:`tempfile` exports a ``mktemp()``
+-function to generate unique temporary file names. ::
++file as input.  The standard module :mod:`tempfile` exports a
++:func:`~tempfile.mktemp` function to generate unique temporary file names. ::
+ 
+    import tempfile
+    import os
+@@ -673,15 +675,12 @@
+        sys.stdout.write(httpobj.getfile().read())
+ 
+ Note that in general for percent-encoded POST operations, query strings must be
+-quoted using :func:`urllib.quote`.  For example to send name="Guy Steele, Jr."::
++quoted using :func:`urllib.urlencode`.  For example, to send
++``name=Guy Steele, Jr.``::
+ 
+-   >>> from urllib import quote
+-   >>> x = quote("Guy Steele, Jr.")
+-   >>> x
+-   'Guy%20Steele,%20Jr.'
+-   >>> query_string = "name="+x
+-   >>> query_string
+-   'name=Guy%20Steele,%20Jr.'
++   >>> import urllib
++   >>> urllib.urlencode({'name': 'Guy Steele, Jr.'})
++   'name=Guy+Steele%2C+Jr.'
+ 
+ 
+ What module should I use to help with generating HTML?
+@@ -689,19 +688,8 @@
+ 
+ .. XXX add modern template languages
+ 
+-There are many different modules available:
+-
+-* HTMLgen is a class library of objects corresponding to all the HTML 3.2 markup
+-  tags. It's used when you are writing in Python and wish to synthesize HTML
+-  pages for generating a web or for CGI forms, etc.
+-
+-* DocumentTemplate and Zope Page Templates are two different systems that are
+-  part of Zope.
+-
+-* Quixote's PTL uses Python syntax to assemble strings of text.
+-
+-Consult the `Web Programming wiki pages
+-<http://wiki.python.org/moin/WebProgramming>`_ for more links.
++You can find a collection of useful links on the `Web Programming wiki page
++<http://wiki.python.org/moin/WebProgramming>`_.
+ 
+ 
+ How do I send mail from a Python script?
+@@ -730,7 +718,7 @@
+    server.quit()
+ 
+ A Unix-only alternative uses sendmail.  The location of the sendmail program
+-varies between systems; sometimes it is ``/usr/lib/sendmail``, sometime
++varies between systems; sometimes it is ``/usr/lib/sendmail``, sometimes
+ ``/usr/sbin/sendmail``.  The sendmail manual page will help you out.  Here's
+ some sample code::
+ 
+@@ -797,7 +785,7 @@
+ The :mod:`marshal` module provides very fast ways to store noncircular basic
+ Python types to files and strings, and back again.  Although marshal does not do
+ fancy things like store instances or handle shared references properly, it does
+-run extremely fast.  For example loading a half megabyte of data may take less
++run extremely fast.  For example, loading a half megabyte of data may take less
+ than a third of a second.  This often beats doing something more complex and
+ general such as using gdbm with pickle/shelve.
+ 
+@@ -807,9 +795,9 @@
+ 
+ .. XXX update this, default protocol is 2/3
+ 
+-The default format used by the pickle module is a slow one that results in
+-readable pickles.  Making it the default, but it would break backward
+-compatibility::
++By default :mod:`pickle` uses a relatively old and slow format for backward
++compatibility.  You can however specify other protocol versions that are
++faster::
+ 
+     largeString = 'z' * (100 * 1024)
+     myPickle = cPickle.dumps(largeString, protocol=1)
+diff -r 70274d53c1dd Doc/glossary.rst
+--- a/Doc/glossary.rst
++++ b/Doc/glossary.rst
+@@ -80,7 +80,7 @@
+ 
+    classic class
+       Any class which does not inherit from :class:`object`.  See
+-      :term:`new-style class`.  Classic classes will be removed in Python 3.0.
++      :term:`new-style class`.  Classic classes have been removed in Python 3.
+ 
+    coercion
+       The implicit conversion of an instance of one type to another during an
+@@ -152,9 +152,9 @@
+       For more information about descriptors' methods, see :ref:`descriptors`.
+ 
+    dictionary
+-      An associative array, where arbitrary keys are mapped to values.  The keys
+-      can be any object with :meth:`__hash__` function and :meth:`__eq__`
+-      methods. Called a hash in Perl.
++      An associative array, where arbitrary keys are mapped to values.  The
++      keys can be any object with :meth:`__hash__`  and :meth:`__eq__` methods.
++      Called a hash in Perl.
+ 
+    docstring
+       A string literal which appears as the first expression in a class,
+@@ -200,7 +200,7 @@
+       An object exposing a file-oriented API (with methods such as
+       :meth:`read()` or :meth:`write()`) to an underlying resource.  Depending
+       on the way it was created, a file object can mediate access to a real
+-      on-disk file or to another other type of storage or communication device
++      on-disk file or to another type of storage or communication device
+       (for example standard input/output, in-memory buffers, sockets, pipes,
+       etc.).  File objects are also called :dfn:`file-like objects` or
+       :dfn:`streams`.
+@@ -406,7 +406,7 @@
+       :meth:`str.lower` method can serve as a key function for case insensitive
+       sorts.  Alternatively, an ad-hoc key function can be built from a
+       :keyword:`lambda` expression such as ``lambda r: (r[0], r[2])``.  Also,
+-      the :mod:`operator` module provides three key function constuctors:
++      the :mod:`operator` module provides three key function constructors:
+       :func:`~operator.attrgetter`, :func:`~operator.itemgetter`, and
+       :func:`~operator.methodcaller`.  See the :ref:`Sorting HOW TO
+       <sortinghowto>` for examples of how to create and use key functions.
+diff -r 70274d53c1dd Doc/howto/advocacy.rst
+--- a/Doc/howto/advocacy.rst
++++ b/Doc/howto/advocacy.rst
+@@ -264,8 +264,7 @@
+ 
+ **What are the restrictions on Python's use?**
+ 
+-They're practically nonexistent.  Consult the :file:`Misc/COPYRIGHT` file in the
+-source distribution, or the section :ref:`history-and-license` for the full
++They're practically nonexistent.  Consult :ref:`history-and-license` for the full
+ language, but it boils down to three conditions:
+ 
+ * You have to leave the copyright notice on the software; if you don't include
+diff -r 70274d53c1dd Doc/howto/argparse.rst
+--- /dev/null
++++ b/Doc/howto/argparse.rst
+@@ -0,0 +1,764 @@
++*****************
++Argparse Tutorial
++*****************
++
++:author: Tshepang Lekhonkhobe <tshepang@gmail.com>
++
++.. _argparse-tutorial:
++
++This tutorial is intended to be a gentle introduction to :mod:`argparse`, the
++recommended command-line parsing module in the Python standard library.
++
++.. note::
++
++   There's two other modules that fulfill the same task, namely
++   :mod:`getopt` (an equivalent for :c:func:`getopt` from the C
++   language) and the deprecated :mod:`optparse`.
++   Note also that :mod:`argparse` is based on :mod:`optparse`,
++   and therefore very similar in terms of usage.
++
++
++Concepts
++========
++
++Let's show the sort of functionality that we are going to explore in this
++introductory tutorial by making use of the :command:`ls` command:
++
++.. code-block:: sh
++
++   $ ls
++   cpython  devguide  prog.py  pypy  rm-unused-function.patch
++   $ ls pypy
++   ctypes_configure  demo  dotviewer  include  lib_pypy  lib-python ...
++   $ ls -l
++   total 20
++   drwxr-xr-x 19 wena wena 4096 Feb 18 18:51 cpython
++   drwxr-xr-x  4 wena wena 4096 Feb  8 12:04 devguide
++   -rwxr-xr-x  1 wena wena  535 Feb 19 00:05 prog.py
++   drwxr-xr-x 14 wena wena 4096 Feb  7 00:59 pypy
++   -rw-r--r--  1 wena wena  741 Feb 18 01:01 rm-unused-function.patch
++   $ ls --help
++   Usage: ls [OPTION]... [FILE]...
++   List information about the FILEs (the current directory by default).
++   Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.
++   ...
++
++A few concepts we can learn from the four commands:
++
++* The :command:`ls` command is useful when run without any options at all. It defaults
++  to displaying the contents of the current directory.
++
++* If we want beyond what it provides by default, we tell it a bit more. In
++  this case, we want it to display a different directory, ``pypy``.
++  What we did is specify what is known as a positional argument. It's named so
++  because the program should know what to do with the value, solely based on
++  where it appears on the command line. This concept is more relevant
++  to a command like :command:`cp`, whose most basic usage is ``cp SRC DEST``.
++  The first position is *what you want copied,* and the second
++  position is *where you want it copied to*.
++
++* Now, say we want to change behaviour of the program. In our example,
++  we display more info for each file instead of just showing the file names.
++  The ``-l`` in that case is known as an optional argument.
++
++* That's a snippet of the help text. It's very useful in that you can
++  come across a program you have never used before, and can figure out
++  how it works simply by reading it's help text.
++
++
++The basics
++==========
++
++Let us start with a very simple example which does (almost) nothing::
++
++   import argparse
++   parser = argparse.ArgumentParser()
++   parser.parse_args()
++
++Following is a result of running the code:
++
++.. code-block:: sh
++
++   $ python prog.py
++   $ python prog.py --help
++   usage: prog.py [-h]
++
++   optional arguments:
++     -h, --help  show this help message and exit
++   $ python prog.py --verbose
++   usage: prog.py [-h]
++   prog.py: error: unrecognized arguments: --verbose
++   $ python prog.py foo
++   usage: prog.py [-h]
++   prog.py: error: unrecognized arguments: foo
++
++Here is what is happening:
++
++* Running the script without any options results in nothing displayed to
++  stdout. Not so useful.
++
++* The second one starts to display the usefulness of the :mod:`argparse`
++  module. We have done almost nothing, but already we get a nice help message.
++
++* The ``--help`` option, which can also be shortened to ``-h``, is the only
++  option we get for free (i.e. no need to specify it). Specifying anything
++  else results in an error. But even then, we do get a useful usage message,
++  also for free.
++
++
++Introducing Positional arguments
++================================
++
++An example::
++
++   import argparse
++   parser = argparse.ArgumentParser()
++   parser.add_argument("echo")
++   args = parser.parse_args()
++   print args.echo
++
++And running the code:
++
++.. code-block:: sh
++
++   $ python prog.py
++   usage: prog.py [-h] echo
++   prog.py: error: the following arguments are required: echo
++   $ python prog.py --help
++   usage: prog.py [-h] echo
++
++   positional arguments:
++     echo
++
++   optional arguments:
++     -h, --help  show this help message and exit
++   $ python prog.py foo
++   foo
++
++Here is what's happening:
++
++* We've added the :meth:`add_argument` method, which is what we use to specify
++  which command-line options the program is willing to accept. In this case,
++  I've named it ``echo`` so that it's in line with its function.
++
++* Calling our program now requires us to specify an option.
++
++* The :meth:`parse_args` method actually returns some data from the
++  options specified, in this case, ``echo``.
++
++* The variable is some form of 'magic' that :mod:`argparse` performs for free
++  (i.e. no need to specify which variable that value is stored in).
++  You will also notice that its name matches the string argument given
++  to the method, ``echo``.
++
++Note however that, although the help display looks nice and all, it currently
++is not as helpful as it can be. For example we see that we got ``echo`` as a
++positional argument, but we don't know what it does, other than by guessing or
++by reading the source code. So, let's make it a bit more useful::
++
++   import argparse
++   parser = argparse.ArgumentParser()
++   parser.add_argument("echo", help="echo the string you use here")
++   args = parser.parse_args()
++   print args.echo
++
++And we get:
++
++.. code-block:: sh
++
++   $ python prog.py -h
++   usage: prog.py [-h] echo
++
++   positional arguments:
++     echo        echo the string you use here
++
++   optional arguments:
++     -h, --help  show this help message and exit
++
++Now, how about doing something even more useful::
++
++   import argparse
++   parser = argparse.ArgumentParser()
++   parser.add_argument("square", help="display a square of a given number")
++   args = parser.parse_args()
++   print args.square**2
++
++Following is a result of running the code:
++
++.. code-block:: sh
++
++   $ python prog.py 4
++   Traceback (most recent call last):
++     File "prog.py", line 5, in <module>
++       print args.square**2
++   TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
++
++That didn't go so well. That's because :mod:`argparse` treats the options we
++give it as strings, unless we tell it otherwise. So, let's tell
++:mod:`argparse` to treat that input as an integer::
++
++   import argparse
++   parser = argparse.ArgumentParser()
++   parser.add_argument("square", help="display a square of a given number",
++                       type=int)
++   args = parser.parse_args()
++   print args.square**2
++
++Following is a result of running the code:
++
++.. code-block:: sh
++
++   $ python prog.py 4
++   16
++   $ python prog.py four
++   usage: prog.py [-h] square
++   prog.py: error: argument square: invalid int value: 'four'
++
++That went well. The program now even helpfully quits on bad illegal input
++before proceeding.
++
++
++Introducing Optional arguments
++==============================
++
++So far we, have been playing with positional arguments. Let us
++have a look on how to add optional ones::
++
++   import argparse
++   parser = argparse.ArgumentParser()
++   parser.add_argument("--verbosity", help="increase output verbosity")
++   args = parser.parse_args()
++   if args.verbosity:
++       print "verbosity turned on"
++
++And the output:
++
++.. code-block:: sh
++
++   $ python prog.py --verbosity 1
++   verbosity turned on
++   $ python prog.py
++   $ python prog.py --help
++   usage: prog.py [-h] [--verbosity VERBOSITY]
++
++   optional arguments:
++     -h, --help            show this help message and exit
++     --verbosity VERBOSITY
++                           increase output verbosity
++   $ python prog.py --verbosity
++   usage: prog.py [-h] [--verbosity VERBOSITY]
++   prog.py: error: argument --verbosity: expected one argument
++
++Here is what is happening:
++
++* The program is written so as to display something when ``--verbosity`` is
++  specified and display nothing when not.
++
++* To show that the option is actually optional, there is no error when running
++  the program without it. Note that by default, if an optional argument isn't
++  used, the relevant variable, in this case :attr:`args.verbosity`, is
++  given ``None`` as a value, which is the reason it fails the truth
++  test of the :keyword:`if` statement.
++
++* The help message is a bit different.
++
++* When using the ``--verbosity`` option, one must also specify some value,
++  any value.
++
++The above example accepts arbitrary integer values for ``--verbosity``, but for
++our simple program, only two values are actually useful, ``True`` or ``False``.
++Let's modify the code accordingly::
++
++   import argparse
++   parser = argparse.ArgumentParser()
++   parser.add_argument("--verbose", help="increase output verbosity",
++                       action="store_true")
++   args = parser.parse_args()
++   if args.verbose:
++      print "verbosity turned on"
++
++And the output:
++
++.. code-block:: sh
++
++   $ python prog.py --verbose
++   verbosity turned on
++   $ python prog.py --verbose 1
++   usage: prog.py [-h] [--verbose]
++   prog.py: error: unrecognized arguments: 1
++   $ python prog.py --help
++   usage: prog.py [-h] [--verbose]
++
++   optional arguments:
++     -h, --help  show this help message and exit
++     --verbose   increase output verbosity
++
++Here is what is happening:
++
++* The option is now more of a flag than something that requires a value.
++  We even changed the name of the option to match that idea.
++  Note that we now specify a new keyword, ``action``, and give it the value
++  ``"store_true"``. This means that, if the option is specified,
++  assign the value ``True`` to :data:`args.verbose`.
++  Not specifying it implies ``False``.
++
++* It complains when you specify a value, in true spirit of what flags
++  actually are.
++
++* Notice the different help text.
++
++
++Short options
++-------------
++
++If you are familiar with command line usage,
++you will notice that I haven't yet touched on the topic of short
++versions of the options. It's quite simple::
++
++   import argparse
++   parser = argparse.ArgumentParser()
++   parser.add_argument("-v", "--verbose", help="increase output verbosity",
++                       action="store_true")
++   args = parser.parse_args()
++   if args.verbose:
++       print "verbosity turned on"
++
++And here goes:
++
++.. code-block:: sh
++
++   $ python prog.py -v
++   verbosity turned on
++   $ python prog.py --help
++   usage: prog.py [-h] [-v]
++
++   optional arguments:
++     -h, --help     show this help message and exit
++     -v, --verbose  increase output verbosity
++
++Note that the new ability is also reflected in the help text.
++
++
++Combining Positional and Optional arguments
++===========================================
++
++Our program keeps growing in complexity::
++
++   import argparse
++   parser = argparse.ArgumentParser()
++   parser.add_argument("square", type=int,
++                       help="display a square of a given number")
++   parser.add_argument("-v", "--verbose", action="store_true",
++                       help="increase output verbosity")
++   args = parser.parse_args()
++   answer = args.square**2
++   if args.verbose:
++       print "the square of {} equals {}".format(args.square, answer)
++   else:
++       print answer
++
++And now the output:
++
++.. code-block:: sh
++
++   $ python prog.py
++   usage: prog.py [-h] [-v] square
++   prog.py: error: the following arguments are required: square
++   $ python prog.py 4
++   16
++   $ python prog.py 4 --verbose
++   the square of 4 equals 16
++   $ python prog.py --verbose 4
++   the square of 4 equals 16
++
++* We've brought back a positional argument, hence the complaint.
++
++* Note that the order does not matter.
++
++How about we give this program of ours back the ability to have
++multiple verbosity values, and actually get to use them::
++
++   import argparse
++   parser = argparse.ArgumentParser()
++   parser.add_argument("square", type=int,
++                       help="display a square of a given number")
++   parser.add_argument("-v", "--verbosity", type=int,
++                       help="increase output verbosity")
++   args = parser.parse_args()
++   answer = args.square**2
++   if args.verbosity == 2:
++       print "the square of {} equals {}".format(args.square, answer)
++   elif args.verbosity == 1:
++       print "{}^2 == {}".format(args.square, answer)
++   else:
++       print answer
++
++And the output:
++
++.. code-block:: sh
++
++   $ python prog.py 4
++   16
++   $ python prog.py 4 -v
++   usage: prog.py [-h] [-v VERBOSITY] square
++   prog.py: error: argument -v/--verbosity: expected one argument
++   $ python prog.py 4 -v 1
++   4^2 == 16
++   $ python prog.py 4 -v 2
++   the square of 4 equals 16
++   $ python prog.py 4 -v 3
++   16
++
++These all look good except the last one, which exposes a bug in our program.
++Let's fix it by restricting the values the ``--verbosity`` option can accept::
++
++   import argparse
++   parser = argparse.ArgumentParser()
++   parser.add_argument("square", type=int,
++                       help="display a square of a given number")
++   parser.add_argument("-v", "--verbosity", type=int, choices=[0, 1, 2],
++                       help="increase output verbosity")
++   args = parser.parse_args()
++   answer = args.square**2
++   if args.verbosity == 2:
++       print "the square of {} equals {}".format(args.square, answer)
++   elif args.verbosity == 1:
++       print "{}^2 == {}".format(args.square, answer)
++   else:
++       print answer
++
++And the output:
++
++.. code-block:: sh
++
++   $ python prog.py 4 -v 3
++   usage: prog.py [-h] [-v {0,1,2}] square
++   prog.py: error: argument -v/--verbosity: invalid choice: 3 (choose from 0, 1, 2)
++   $ python prog.py 4 -h
++   usage: prog.py [-h] [-v {0,1,2}] square
++
++   positional arguments:
++     square                display a square of a given number
++
++   optional arguments:
++     -h, --help            show this help message and exit
++     -v {0,1,2}, --verbosity {0,1,2}
++                           increase output verbosity
++
++Note that the change also reflects both in the error message as well as the
++help string.
++
++Now, let's use a different approach of playing with verbosity, which is pretty
++common. It also matches the way the CPython executable handles its own
++verbosity argument (check the output of ``python --help``)::
++
++   import argparse
++   parser = argparse.ArgumentParser()
++   parser.add_argument("square", type=int,
++                       help="display the square of a given number")
++   parser.add_argument("-v", "--verbosity", action="count",
++                       help="increase output verbosity")
++   args = parser.parse_args()
++   answer = args.square**2
++   if args.verbosity == 2:
++       print "the square of {} equals {}".format(args.square, answer)
++   elif args.verbosity == 1:
++       print "{}^2 == {}".format(args.square, answer)
++   else:
++       print answer
++
++We have introduced another action, "count",
++to count the number of occurences of a specific optional arguments:
++
++.. code-block:: sh
++
++   $ python prog.py 4
++   16
++   $ python prog.py 4 -v
++   4^2 == 16
++   $ python prog.py 4 -vv
++   the square of 4 equals 16
++   $ python prog.py 4 --verbosity --verbosity
++   the square of 4 equals 16
++   $ python prog.py 4 -v 1
++   usage: prog.py [-h] [-v] square
++   prog.py: error: unrecognized arguments: 1
++   $ python prog.py 4 -h
++   usage: prog.py [-h] [-v] square
++
++   positional arguments:
++     square           display a square of a given number
++
++   optional arguments:
++     -h, --help       show this help message and exit
++     -v, --verbosity  increase output verbosity
++   $ python prog.py 4 -vvv
++   16
++
++* Yes, it's now more of a flag (similar to ``action="store_true"``) in the
++  previous version of our script. That should explain the complaint.
++
++* It also behaves similar to "store_true" action.
++
++* Now here's a demonstration of what the "count" action gives. You've probably
++  seen this sort of usage before.
++
++* And, just like the "store_true" action, if you don't specify the ``-v`` flag,
++  that flag is considered to have ``None`` value.
++
++* As should be expected, specifying the long form of the flag, we should get
++  the same output.
++
++* Sadly, our help output isn't very informative on the new ability our script
++  has acquired, but that can always be fixed by improving the documentation for
++  out script (e.g. via the ``help`` keyword argument).
++
++* That last output exposes a bug in our program.
++
++
++Let's fix::
++
++   import argparse
++   parser = argparse.ArgumentParser()
++   parser.add_argument("square", type=int,
++                       help="display a square of a given number")
++   parser.add_argument("-v", "--verbosity", action="count",
++                       help="increase output verbosity")
++   args = parser.parse_args()
++   answer = args.square**2
++
++   # bugfix: replace == with >=
++   if args.verbosity >= 2:
++       print "the square of {} equals {}".format(args.square, answer)
++   elif args.verbosity >= 1:
++       print "{}^2 == {}".format(args.square, answer)
++   else:
++       print answer
++
++And this is what it gives:
++
++.. code-block:: sh
++
++   $ python prog.py 4 -vvv
++   the square of 4 equals 16
++   $ python prog.py 4 -vvvv
++   the square of 4 equals 16
++   $ python prog.py 4
++   Traceback (most recent call last):
++     File "prog.py", line 11, in <module>
++       if args.verbosity >= 2:
++   TypeError: unorderable types: NoneType() >= int()
++
++* First output went well, and fixes the bug we had before.
++  That is, we want any value >= 2 to be as verbose as possible.
++
++* Third output not so good.
++
++Let's fix that bug::
++
++   import argparse
++   parser = argparse.ArgumentParser()
++   parser.add_argument("square", type=int,
++                       help="display a square of a given number")
++   parser.add_argument("-v", "--verbosity", action="count", default=0,
++                       help="increase output verbosity")
++   args = parser.parse_args()
++   answer = args.square**2
++   if args.verbosity >= 2:
++       print "the square of {} equals {}".format(args.square, answer)
++   elif args.verbosity >= 1:
++       print "{}^2 == {}".format(args.square, answer)
++   else:
++       print answer
++
++We've just introduced yet another keyword, ``default``.
++We've set it to ``0`` in order to make it comparable to the other int values.
++Remember that by default,
++if an optional argument isn't specified,
++it gets the ``None`` value, and that cannot be compared to an int value
++(hence the :exc:`TypeError` exception).
++
++And:
++
++.. code-block:: sh
++
++   $ python prog.py 4
++   16
++
++You can go quite far just with what we've learned so far,
++and we have only scratched the surface.
++The :mod:`argparse` module is very powerful,
++and we'll explore a bit more of it before we end this tutorial.
++
++
++Getting a little more advanced
++==============================
++
++What if we wanted to expand our tiny program to perform other powers,
++not just squares::
++
++   import argparse
++   parser = argparse.ArgumentParser()
++   parser.add_argument("x", type=int, help="the base")
++   parser.add_argument("y", type=int, help="the exponent")
++   parser.add_argument("-v", "--verbosity", action="count", default=0)
++   args = parser.parse_args()
++   answer = args.x**args.y
++   if args.verbosity >= 2:
++       print "{} to the power {} equals {}".format(args.x, args.y, answer)
++   elif args.verbosity >= 1:
++       print "{}^{} == {}".format(args.x, args.y, answer)
++   else:
++       print answer
++
++Output:
++
++.. code-block:: sh
++
++   $ python prog.py
++   usage: prog.py [-h] [-v] x y
++   prog.py: error: the following arguments are required: x, y
++   $ python prog.py -h
++   usage: prog.py [-h] [-v] x y
++
++   positional arguments:
++     x                the base
++     y                the exponent
++
++   optional arguments:
++     -h, --help       show this help message and exit
++     -v, --verbosity
++   $ python prog.py 4 2 -v
++   4^2 == 16
++
++
++Notice that so far we've been using verbosity level to *change* the text
++that gets displayed. The following example instead uses verbosity level
++to display *more* text instead::
++
++   import argparse
++   parser = argparse.ArgumentParser()
++   parser.add_argument("x", type=int, help="the base")
++   parser.add_argument("y", type=int, help="the exponent")
++   parser.add_argument("-v", "--verbosity", action="count", default=0)
++   args = parser.parse_args()
++   answer = args.x**args.y
++   if args.verbosity >= 2:
++       print "Running '{}'".format(__file__)
++   if args.verbosity >= 1:
++       print "{}^{} ==".format(args.x, args.y),
++   print answer
++
++Output:
++
++.. code-block:: sh
++
++   $ python prog.py 4 2
++   16
++   $ python prog.py 4 2 -v
++   4^2 == 16
++   $ python prog.py 4 2 -vv
++   Running 'prog.py'
++   4^2 == 16
++
++
++Conflicting options
++-------------------
++
++So far, we have been working with two methods of an
++:class:`argparse.ArgumentParser` instance. Let's introduce a third one,
++:meth:`add_mutually_exclusive_group`. It allows for us to specify options that
++conflict with each other. Let's also change the rest of the program make the
++new functionality makes more sense:
++we'll introduce the ``--quiet`` option,
++which will be the opposite of the ``--verbose`` one::
++
++   import argparse
++
++   parser = argparse.ArgumentParser()
++   group = parser.add_mutually_exclusive_group()
++   group.add_argument("-v", "--verbose", action="store_true")
++   group.add_argument("-q", "--quiet", action="store_true")
++   parser.add_argument("x", type=int, help="the base")
++   parser.add_argument("y", type=int, help="the exponent")
++   args = parser.parse_args()
++   answer = args.x**args.y
++
++   if args.quiet:
++       print answer
++   elif args.verbose:
++       print "{} to the power {} equals {}".format(args.x, args.y, answer)
++   else:
++       print "{}^{} == {}".format(args.x, args.y, answer)
++
++Our program is now simpler, and we've lost some functionality for the sake of
++demonstration. Anyways, here's the output:
++
++.. code-block:: sh
++
++   $ python prog.py 4 2
++   4^2 == 16
++   $ python prog.py 4 2 -q
++   16
++   $ python prog.py 4 2 -v
++   4 to the power 2 equals 16
++   $ python prog.py 4 2 -vq
++   usage: prog.py [-h] [-v | -q] x y
++   prog.py: error: argument -q/--quiet: not allowed with argument -v/--verbose
++   $ python prog.py 4 2 -v --quiet
++   usage: prog.py [-h] [-v | -q] x y
++   prog.py: error: argument -q/--quiet: not allowed with argument -v/--verbose
++
++That should be easy to follow. I've added that last output so you can see the
++sort of flexibility you get, i.e. mixing long form options with short form
++ones.
++
++Before we conclude, you probably want to tell your users the main purpose of
++your program, just in case they don't know::
++
++   import argparse
++
++   parser = argparse.ArgumentParser(description="calculate X to the power of Y")
++   group = parser.add_mutually_exclusive_group()
++   group.add_argument("-v", "--verbose", action="store_true")
++   group.add_argument("-q", "--quiet", action="store_true")
++   parser.add_argument("x", type=int, help="the base")
++   parser.add_argument("y", type=int, help="the exponent")
++   args = parser.parse_args()
++   answer = args.x**args.y
++
++   if args.quiet:
++       print answer
++   elif args.verbose:
++       print "{} to the power {} equals {}".format(args.x, args.y, answer)
++   else:
++       print "{}^{} == {}".format(args.x, args.y, answer)
++
++Note that slight difference in the usage text. Note the ``[-v | -q]``,
++which tells us that we can either use ``-v`` or ``-q``,
++but not both at the same time:
++
++.. code-block:: sh
++
++   $ python prog.py --help
++   usage: prog.py [-h] [-v | -q] x y
++
++   calculate X to the power of Y
++
++   positional arguments:
++     x              the base
++     y              the exponent
++
++   optional arguments:
++     -h, --help     show this help message and exit
++     -v, --verbose
++     -q, --quiet
++
++
++Conclusion
++==========
++
++The :mod:`argparse` module offers a lot more than shown here.
++Its docs are quite detailed and thorough, and full of examples.
++Having gone through this tutorial, you should easily digest them
++without feeling overwhelmed.
+diff -r 70274d53c1dd Doc/howto/cporting.rst
+--- a/Doc/howto/cporting.rst
++++ b/Doc/howto/cporting.rst
+@@ -2,27 +2,28 @@
+ 
+ .. _cporting-howto:
+ 
+-********************************
+-Porting Extension Modules to 3.0
+-********************************
++*************************************
++Porting Extension Modules to Python 3
++*************************************
+ 
+ :author: Benjamin Peterson
+ 
+ 
+ .. topic:: Abstract
+ 
+-   Although changing the C-API was not one of Python 3.0's objectives, the many
+-   Python level changes made leaving 2.x's API intact impossible.  In fact, some
+-   changes such as :func:`int` and :func:`long` unification are more obvious on
+-   the C level.  This document endeavors to document incompatibilities and how
+-   they can be worked around.
++   Although changing the C-API was not one of Python 3's objectives,
++   the many Python-level changes made leaving Python 2's API intact
++   impossible.  In fact, some changes such as :func:`int` and
++   :func:`long` unification are more obvious on the C level.  This
++   document endeavors to document incompatibilities and how they can
++   be worked around.
+ 
+ 
+ Conditional compilation
+ =======================
+ 
+-The easiest way to compile only some code for 3.0 is to check if
+-:c:macro:`PY_MAJOR_VERSION` is greater than or equal to 3. ::
++The easiest way to compile only some code for Python 3 is to check
++if :c:macro:`PY_MAJOR_VERSION` is greater than or equal to 3. ::
+ 
+    #if PY_MAJOR_VERSION >= 3
+    #define IS_PY3K
+@@ -35,7 +36,7 @@
+ Changes to Object APIs
+ ======================
+ 
+-Python 3.0 merged together some types with similar functions while cleanly
++Python 3 merged together some types with similar functions while cleanly
+ separating others.
+ 
+ 
+@@ -43,14 +44,14 @@
+ -----------------------
+ 
+ 
+-Python 3.0's :func:`str` (``PyString_*`` functions in C) type is equivalent to
+-2.x's :func:`unicode` (``PyUnicode_*``).  The old 8-bit string type has become
+-:func:`bytes`.  Python 2.6 and later provide a compatibility header,
++Python 3's :func:`str` (``PyString_*`` functions in C) type is equivalent to
++Python 2's :func:`unicode` (``PyUnicode_*``).  The old 8-bit string type has
++become :func:`bytes`.  Python 2.6 and later provide a compatibility header,
+ :file:`bytesobject.h`, mapping ``PyBytes`` names to ``PyString`` ones.  For best
+-compatibility with 3.0, :c:type:`PyUnicode` should be used for textual data and
++compatibility with Python 3, :c:type:`PyUnicode` should be used for textual data and
+ :c:type:`PyBytes` for binary data.  It's also important to remember that
+-:c:type:`PyBytes` and :c:type:`PyUnicode` in 3.0 are not interchangeable like
+-:c:type:`PyString` and :c:type:`PyUnicode` are in 2.x.  The following example
++:c:type:`PyBytes` and :c:type:`PyUnicode` in Python 3 are not interchangeable like
++:c:type:`PyString` and :c:type:`PyUnicode` are in Python 2.  The following example
+ shows best practices with regards to :c:type:`PyUnicode`, :c:type:`PyString`,
+ and :c:type:`PyBytes`. ::
+ 
+@@ -94,10 +95,12 @@
+ long/int Unification
+ --------------------
+ 
+-In Python 3.0, there is only one integer type.  It is called :func:`int` on the
+-Python level, but actually corresponds to 2.x's :func:`long` type.  In the
+-C-API, ``PyInt_*`` functions are replaced by their ``PyLong_*`` neighbors.  The
+-best course of action here is using the ``PyInt_*`` functions aliased to
++Python 3 has only one integer type, :func:`int`.  But it actually
++corresponds to Python 2's :func:`long` type--the :func:`int` type
++used in Python 2 was removed.  In the C-API, ``PyInt_*`` functions
++are replaced by their ``PyLong_*`` equivalents.
++
++The best course of action here is using the ``PyInt_*`` functions aliased to
+ ``PyLong_*`` found in :file:`intobject.h`.  The abstract ``PyNumber_*`` APIs
+ can also be used in some cases. ::
+ 
+@@ -120,10 +123,11 @@
+ Module initialization and state
+ ===============================
+ 
+-Python 3.0 has a revamped extension module initialization system.  (See
+-:pep:`3121`.)  Instead of storing module state in globals, they should be stored
+-in an interpreter specific structure.  Creating modules that act correctly in
+-both 2.x and 3.0 is tricky.  The following simple example demonstrates how. ::
++Python 3 has a revamped extension module initialization system.  (See
++:pep:`3121`.)  Instead of storing module state in globals, they should
++be stored in an interpreter specific structure.  Creating modules that
++act correctly in both Python 2 and Python 3 is tricky.  The following
++simple example demonstrates how. ::
+ 
+    #include "Python.h"
+ 
+@@ -223,15 +227,18 @@
+ you'll need to switch to Capsules.
+ :c:type:`CObject` was deprecated in 3.1 and 2.7 and completely removed in
+ Python 3.2.  If you only support 2.7, or 3.1 and above, you
+-can simply switch to :c:type:`Capsule`.  If you need to support 3.0 or
+-versions of Python earlier than 2.7 you'll have to support both CObjects
+-and Capsules.
++can simply switch to :c:type:`Capsule`.  If you need to support Python 3.0,
++or versions of Python earlier than 2.7,
++you'll have to support both CObjects and Capsules.
++(Note that Python 3.0 is no longer supported, and it is not recommended
++for production use.)
+ 
+ The following example header file :file:`capsulethunk.h` may
+-solve the problem for you;
+-simply write your code against the :c:type:`Capsule` API, include
+-this header file after ``"Python.h"``, and you'll automatically use CObjects
+-in Python 3.0 or versions earlier than 2.7.
++solve the problem for you.  Simply write your code against the
++:c:type:`Capsule` API and include this header file after
++:file:`Python.h`.  Your code will automatically use Capsules
++in versions of Python with Capsules, and switch to CObjects
++when Capsules are unavailable.
+ 
+ :file:`capsulethunk.h` simulates Capsules using CObjects.  However,
+ :c:type:`CObject` provides no place to store the capsule's "name".  As a
+@@ -250,12 +257,12 @@
+     returns failure.  (Since there's no way to store a name
+     in a CObject, noisy failure of :c:func:`PyCapsule_SetName`
+     was deemed preferable to silent failure here.  If this is
+-    inconveient, feel free to modify your local
++    inconvenient, feel free to modify your local
+     copy as you see fit.)
+ 
+ You can find :file:`capsulethunk.h` in the Python source distribution
+-in the :file:`Doc/includes` directory.  We also include it here for
+-your reference; here is :file:`capsulethunk.h`:
++as :source:`Doc/includes/capsulethunk.h`.  We also include it here for
++your convenience:
+ 
+ .. literalinclude:: ../includes/capsulethunk.h
+ 
+@@ -266,5 +273,5 @@
+ 
+ If you are writing a new extension module, you might consider `Cython
+ <http://www.cython.org>`_.  It translates a Python-like language to C.  The
+-extension modules it creates are compatible with Python 3.x and 2.x.
++extension modules it creates are compatible with Python 3 and Python 2.
+ 
+diff -r 70274d53c1dd Doc/howto/curses.rst
+--- a/Doc/howto/curses.rst
++++ b/Doc/howto/curses.rst
+@@ -118,7 +118,7 @@
+ A common problem when debugging a curses application is to get your terminal
+ messed up when the application dies without restoring the terminal to its
+ previous state.  In Python this commonly happens when your code is buggy and
+-raises an uncaught exception.  Keys are no longer be echoed to the screen when
++raises an uncaught exception.  Keys are no longer echoed to the screen when
+ you type them, for example, which makes using the shell difficult.
+ 
+ In Python you can avoid these complications and make debugging much easier by
+@@ -271,7 +271,7 @@
+ highlight certain words.  curses supports this by allowing you to specify an
+ attribute for each cell on the screen.
+ 
+-An attribute is a integer, each bit representing a different attribute.  You can
++An attribute is an integer, each bit representing a different attribute.  You can
+ try to display text with multiple attribute bits set, but curses doesn't
+ guarantee that all the possible combinations are available, or that they're all
+ visually distinct.  That depends on the ability of the terminal being used, so
+@@ -300,7 +300,7 @@
+                  curses.A_REVERSE)
+    stdscr.refresh()
+ 
+-The curses library also supports color on those terminals that provide it, The
++The curses library also supports color on those terminals that provide it. The
+ most common such terminal is probably the Linux console, followed by color
+ xterms.
+ 
+diff -r 70274d53c1dd Doc/howto/index.rst
+--- a/Doc/howto/index.rst
++++ b/Doc/howto/index.rst
+@@ -28,4 +28,5 @@
+    unicode.rst
+    urllib2.rst
+    webservers.rst
++   argparse.rst
+ 
+diff -r 70274d53c1dd Doc/howto/logging-cookbook.rst
+--- a/Doc/howto/logging-cookbook.rst
++++ b/Doc/howto/logging-cookbook.rst
+@@ -295,17 +295,17 @@
+    logger2.warning('Jail zesty vixen who grabbed pay from quack.')
+    logger2.error('The five boxing wizards jump quickly.')
+ 
+-At the receiving end, you can set up a receiver using the :mod:`socketserver`
++At the receiving end, you can set up a receiver using the :mod:`SocketServer`
+ module. Here is a basic working example::
+ 
+    import pickle
+    import logging
+    import logging.handlers
+-   import socketserver
++   import SocketServer
+    import struct
+ 
+ 
+-   class LogRecordStreamHandler(socketserver.StreamRequestHandler):
++   class LogRecordStreamHandler(SocketServer.StreamRequestHandler):
+        """Handler for a streaming logging request.
+ 
+        This basically logs the record using whatever logging policy is
+@@ -347,7 +347,7 @@
+            # cycles and network bandwidth!
+            logger.handle(record)
+ 
+-   class LogRecordSocketReceiver(socketserver.ThreadingTCPServer):
++   class LogRecordSocketReceiver(SocketServer.ThreadingTCPServer):
+        """
+        Simple TCP socket-based logging receiver suitable for testing.
+        """
+@@ -357,7 +357,7 @@
+        def __init__(self, host='localhost',
+                     port=logging.handlers.DEFAULT_TCP_LOGGING_PORT,
+                     handler=LogRecordStreamHandler):
+-           socketserver.ThreadingTCPServer.__init__(self, (host, port), handler)
++           SocketServer.ThreadingTCPServer.__init__(self, (host, port), handler)
+            self.abort = 0
+            self.timeout = 1
+            self.logname = None
+@@ -745,3 +745,48 @@
+ For more information about this configuration, you can see the `relevant
+ section <https://docs.djangoproject.com/en/1.3/topics/logging/#configuring-logging>`_
+ of the Django documentation.
++
++Inserting a BOM into messages sent to a SysLogHandler
++-----------------------------------------------------
++
++`RFC 5424 <http://tools.ietf.org/html/rfc5424>`_ requires that a
++Unicode message be sent to a syslog daemon as a set of bytes which have the
++following structure: an optional pure-ASCII component, followed by a UTF-8 Byte
++Order Mark (BOM), followed by Unicode encoded using UTF-8. (See the `relevant
++section of the specification <http://tools.ietf.org/html/rfc5424#section-6>`_.)
++
++In Python 2.6 and 2.7, code was added to
++:class:`~logging.handlers.SysLogHandler` to insert a BOM into the message, but
++unfortunately, it was implemented incorrectly, with the BOM appearing at the
++beginning of the message and hence not allowing any pure-ASCII component to
++appear before it.
++
++As this behaviour is broken, the incorrect BOM insertion code is being removed
++from Python 2.7.4 and later. However, it is not being replaced, and if you
++want to produce RFC 5424-compliant messages which include a BOM, an optional
++pure-ASCII sequence before it and arbitrary Unicode after it, encoded using
++UTF-8, then you need to do the following:
++
++#. Attach a :class:`~logging.Formatter` instance to your
++   :class:`~logging.handlers.SysLogHandler` instance, with a format string
++   such as::
++
++      u'ASCII section\ufeffUnicode section'
++
++   The Unicode code point ``u'\feff```, when encoded using UTF-8, will be
++   encoded as a UTF-8 BOM -- the byte-string ``'\xef\xbb\xbf'``.
++
++#. Replace the ASCII section with whatever placeholders you like, but make sure
++   that the data that appears in there after substitution is always ASCII (that
++   way, it will remain unchanged after UTF-8 encoding).
++
++#. Replace the Unicode section with whatever placeholders you like; if the data
++   which appears there after substitution contains characters outside the ASCII
++   range, that's fine -- it will be encoded using UTF-8.
++
++If the formatted message is Unicode, it *will* be encoded using UTF-8 encoding
++by ``SysLogHandler``. If you follow the above rules, you should be able to
++produce RFC 5424-compliant messages. If you don't, logging may not complain,
++but your messages will not be RFC 5424-compliant, and your syslog daemon may
++complain.
++
+diff -r 70274d53c1dd Doc/howto/logging.rst
+--- a/Doc/howto/logging.rst
++++ b/Doc/howto/logging.rst
+@@ -642,6 +642,21 @@
+ code approach, mainly separation of configuration and code and the ability of
+ noncoders to easily modify the logging properties.
+ 
++.. warning:: The :func:`fileConfig` function takes a default parameter,
++   ``disable_existing_loggers``, which defaults to ``True`` for reasons of
++   backward compatibility. This may or may not be what you want, since it
++   will cause any loggers existing before the :func:`fileConfig` call to
++   be disabled unless they (or an ancestor) are explicitly named in the
++   configuration.  Please refer to the reference documentation for more
++   information, and specify ``False`` for this parameter if you wish.
++
++   The dictionary passed to :func:`dictConfig` can also specify a Boolean
++   value with key ``disable_existing_loggers``, which if not specified
++   explicitly in the dictionary also defaults to being interpreted as
++   ``True``.  This leads to the logger-disabling behaviour described above,
++   which may not be what you want - in which case, provide the key
++   explicitly with a value of ``False``.
++
+ .. currentmodule:: logging
+ 
+ Note that the class names referenced in config files need to be either relative
+diff -r 70274d53c1dd Doc/howto/pyporting.rst
+--- a/Doc/howto/pyporting.rst
++++ b/Doc/howto/pyporting.rst
+@@ -39,7 +39,7 @@
+ Finally, you do have the option of :ref:`using 2to3 <use_2to3>` to translate
+ Python 2 code into Python 3 code (with some manual help). This can take the
+ form of branching your code and using 2to3 to start a Python 3 branch. You can
+-also have users perform the translation as installation time automatically so
++also have users perform the translation at installation time automatically so
+ that you only have to maintain a Python 2 codebase.
+ 
+ Regardless of which approach you choose, porting is not as hard or
+@@ -234,7 +234,7 @@
+ ``b'py'[1:2]`` is ``'y'`` in Python 2 and ``b'y'`` in Python 3 (i.e., close
+ enough).
+ 
+-You cannot concatenate bytes and strings in Python 3. But since in Python
++You cannot concatenate bytes and strings in Python 3. But since Python
+ 2 has bytes aliased to ``str``, it will succeed: ``b'a' + u'b'`` works in
+ Python 2, but ``b'a' + 'b'`` in Python 3 is a :exc:`TypeError`. A similar issue
+ also comes about when doing comparisons between bytes and strings.
+@@ -328,7 +328,7 @@
+ textual data, people have over the years been rather loose in their delineation
+ of what ``str`` instances held text compared to bytes. In Python 3 you cannot
+ be so care-free anymore and need to properly handle the difference. The key
+-handling this issue to make sure that **every** string literal in your
++handling this issue is to make sure that **every** string literal in your
+ Python 2 code is either syntactically of functionally marked as either bytes or
+ text data. After this is done you then need to make sure your APIs are designed
+ to either handle a specific type or made to be properly polymorphic.
+@@ -343,7 +343,7 @@
+ and then designating textual data with a ``u`` prefix or using the
+ ``unicode_literals`` future statement.
+ 
+-If your project supports versions of Python pre-dating 2.6, then you should use
++If your project supports versions of Python predating 2.6, then you should use
+ the six_ project and its ``b()`` function to denote bytes literals. For text
+ literals you can either use six's ``u()`` function or use a ``u`` prefix.
+ 
+@@ -439,7 +439,7 @@
+ There are two ways to solve this issue. One is to use a custom 2to3 fixer. The
+ blog post at http://lucumr.pocoo.org/2011/1/22/forwards-compatible-python/
+ specifies how to do this. That will allow 2to3 to change all instances of ``def
+-__unicode(self): ...`` to ``def __str__(self): ...``. This does require you
++__unicode(self): ...`` to ``def __str__(self): ...``. This does require that you
+ define your ``__str__()`` method in Python 2 before your ``__unicode__()``
+ method.
+ 
+diff -r 70274d53c1dd Doc/howto/regex.rst
+--- a/Doc/howto/regex.rst
++++ b/Doc/howto/regex.rst
+@@ -365,7 +365,7 @@
+ 
+ You can learn about this by interactively experimenting with the :mod:`re`
+ module.  If you have Tkinter available, you may also want to look at
+-:file:`Tools/scripts/redemo.py`, a demonstration program included with the
++:source:`Tools/scripts/redemo.py`, a demonstration program included with the
+ Python distribution.  It allows you to enter REs and strings, and displays
+ whether the RE matches or fails. :file:`redemo.py` can be quite useful when
+ trying to debug a complicated RE.  Phil Schwartz's `Kodos
+@@ -501,7 +501,7 @@
+ the same ones in several locations, then it might be worthwhile to collect all
+ the definitions in one place, in a section of code that compiles all the REs
+ ahead of time.  To take an example from the standard library, here's an extract
+-from :file:`xmllib.py`::
++from the deprecated :mod:`xmllib` module::
+ 
+    ref = re.compile( ... )
+    entityref = re.compile( ... )
+diff -r 70274d53c1dd Doc/howto/sockets.rst
+--- a/Doc/howto/sockets.rst
++++ b/Doc/howto/sockets.rst
+@@ -156,7 +156,7 @@
+ there, you may wait forever for the reply, because the request may still be in
+ your output buffer.
+ 
+-Now we come the major stumbling block of sockets - ``send`` and ``recv`` operate
++Now we come to the major stumbling block of sockets - ``send`` and ``recv`` operate
+ on the network buffers. They do not necessarily handle all the bytes you hand
+ them (or expect from them), because their major focus is handling the network
+ buffers. In general, they return when the associated network buffers have been
+@@ -167,7 +167,7 @@
+ When a ``recv`` returns 0 bytes, it means the other side has closed (or is in
+ the process of closing) the connection.  You will not receive any more data on
+ this connection. Ever.  You may be able to send data successfully; I'll talk
+-about that some on the next page.
++more about this later.
+ 
+ A protocol like HTTP uses a socket for only one transfer. The client sends a
+ request, then reads a reply.  That's it. The socket is discarded. This means that
+diff -r 70274d53c1dd Doc/howto/sorting.rst
+--- a/Doc/howto/sorting.rst
++++ b/Doc/howto/sorting.rst
+@@ -124,7 +124,7 @@
+ ========================
+ 
+ Both :meth:`list.sort` and :func:`sorted` accept a *reverse* parameter with a
+-boolean value. This is using to flag descending sorts. For example, to get the
++boolean value. This is used to flag descending sorts. For example, to get the
+ student data in reverse *age* order:
+ 
+     >>> sorted(student_tuples, key=itemgetter(2), reverse=True)
+@@ -210,11 +210,11 @@
+ arguments. Instead, all of the Py2.x versions supported a *cmp* parameter to
+ handle user specified comparison functions.
+ 
+-In Py3.0, the *cmp* parameter was removed entirely (as part of a larger effort to
++In Python 3, the *cmp* parameter was removed entirely (as part of a larger effort to
+ simplify and unify the language, eliminating the conflict between rich
+ comparisons and the :meth:`__cmp__` magic method).
+ 
+-In Py2.x, sort allowed an optional function which can be called for doing the
++In Python 2, :meth:`~list.sort` allowed an optional function which can be called for doing the
+ comparisons. That function should take two arguments to be compared and then
+ return a negative value for less-than, return zero if they are equal, or return
+ a positive value for greater-than. For example, we can do:
+diff -r 70274d53c1dd Doc/howto/urllib2.rst
+--- a/Doc/howto/urllib2.rst
++++ b/Doc/howto/urllib2.rst
+@@ -439,12 +439,12 @@
+ 
+ When authentication is required, the server sends a header (as well as the 401
+ error code) requesting authentication.  This specifies the authentication scheme
+-and a 'realm'. The header looks like : ``Www-authenticate: SCHEME
++and a 'realm'. The header looks like : ``WWW-Authenticate: SCHEME
+ realm="REALM"``.
+ 
+ e.g. ::
+ 
+-    Www-authenticate: Basic realm="cPanel Users"
++    WWW-Authenticate: Basic realm="cPanel Users"
+ 
+ 
+ The client should then retry the request with the appropriate name and password
+diff -r 70274d53c1dd Doc/includes/sqlite3/execute_1.py
+--- a/Doc/includes/sqlite3/execute_1.py
++++ b/Doc/includes/sqlite3/execute_1.py
+@@ -1,11 +1,16 @@
+ import sqlite3
+ 
+-con = sqlite3.connect("mydb")
+-
++con = sqlite3.connect(":memory:")
+ cur = con.cursor()
++cur.execute("create table people (name_last, age)")
+ 
+ who = "Yeltsin"
+ age = 72
+ 
+-cur.execute("select name_last, age from people where name_last=? and age=?", (who, age))
++# This is the qmark style:
++cur.execute("insert into people values (?, ?)", (who, age))
++
++# And this is the named style:
++cur.execute("select * from people where name_last=:who and age=:age", {"who": who, "age": age})
++
+ print cur.fetchone()
+diff -r 70274d53c1dd Doc/includes/sqlite3/execute_2.py
+--- a/Doc/includes/sqlite3/execute_2.py
++++ /dev/null
+@@ -1,12 +0,0 @@
+-import sqlite3
+-
+-con = sqlite3.connect("mydb")
+-
+-cur = con.cursor()
+-
+-who = "Yeltsin"
+-age = 72
+-
+-cur.execute("select name_last, age from people where name_last=:who and age=:age",
+-    {"who": who, "age": age})
+-print cur.fetchone()
+diff -r 70274d53c1dd Doc/includes/sqlite3/executemany_2.py
+--- a/Doc/includes/sqlite3/executemany_2.py
++++ b/Doc/includes/sqlite3/executemany_2.py
+@@ -1,8 +1,8 @@
+ import sqlite3
++import string
+ 
+ def char_generator():
+-    import string
+-    for c in string.letters[:26]:
++    for c in string.lowercase:
+         yield (c,)
+ 
+ con = sqlite3.connect(":memory:")
+diff -r 70274d53c1dd Doc/includes/sqlite3/rowclass.py
+--- a/Doc/includes/sqlite3/rowclass.py
++++ b/Doc/includes/sqlite3/rowclass.py
+@@ -1,12 +1,12 @@
+ import sqlite3
+ 
+-con = sqlite3.connect("mydb")
++con = sqlite3.connect(":memory:")
+ con.row_factory = sqlite3.Row
+ 
+ cur = con.cursor()
+-cur.execute("select name_last, age from people")
++cur.execute("select 'John' as name, 42 as age")
+ for row in cur:
+-    assert row[0] == row["name_last"]
+-    assert row["name_last"] == row["nAmE_lAsT"]
++    assert row[0] == row["name"]
++    assert row["name"] == row["nAmE"]
+     assert row[1] == row["age"]
+     assert row[1] == row["AgE"]
+diff -r 70274d53c1dd Doc/includes/sqlite3/text_factory.py
+--- a/Doc/includes/sqlite3/text_factory.py
++++ b/Doc/includes/sqlite3/text_factory.py
+@@ -3,9 +3,6 @@
+ con = sqlite3.connect(":memory:")
+ cur = con.cursor()
+ 
+-# Create the table
+-con.execute("create table person(lastname, firstname)")
+-
+ AUSTRIA = u"\xd6sterreich"
+ 
+ # by default, rows are returned as Unicode
+@@ -17,7 +14,7 @@
+ con.text_factory = str
+ cur.execute("select ?", (AUSTRIA,))
+ row = cur.fetchone()
+-assert type(row[0]) == str
++assert type(row[0]) is str
+ # the bytestrings will be encoded in UTF-8, unless you stored garbage in the
+ # database ...
+ assert row[0] == AUSTRIA.encode("utf-8")
+@@ -29,15 +26,15 @@
+ cur.execute("select ?", ("this is latin1 and would normally create errors" +
+                          u"\xe4\xf6\xfc".encode("latin1"),))
+ row = cur.fetchone()
+-assert type(row[0]) == unicode
++assert type(row[0]) is unicode
+ 
+ # sqlite3 offers a built-in optimized text_factory that will return bytestring
+ # objects, if the data is in ASCII only, and otherwise return unicode objects
+ con.text_factory = sqlite3.OptimizedUnicode
+ cur.execute("select ?", (AUSTRIA,))
+ row = cur.fetchone()
+-assert type(row[0]) == unicode
++assert type(row[0]) is unicode
+ 
+ cur.execute("select ?", ("Germany",))
+ row = cur.fetchone()
+-assert type(row[0]) == str
++assert type(row[0]) is str
+diff -r 70274d53c1dd Doc/library/2to3.rst
+--- a/Doc/library/2to3.rst
++++ b/Doc/library/2to3.rst
+@@ -314,7 +314,7 @@
+ 
+    Converts ``raise E, V`` to ``raise E(V)``, and ``raise E, V, T`` to ``raise
+    E(V).with_traceback(T)``.  If ``E`` is a tuple, the translation will be
+-   incorrect because substituting tuples for exceptions has been removed in 3.0.
++   incorrect because substituting tuples for exceptions has been removed in Python 3.
+ 
+ .. 2to3fixer:: raw_input
+ 
+diff -r 70274d53c1dd Doc/library/__future__.rst
+--- a/Doc/library/__future__.rst
++++ b/Doc/library/__future__.rst
+@@ -75,7 +75,7 @@
+ | division         | 2.2.0a2     | 3.0          | :pep:`238`:                                 |
+ |                  |             |              | *Changing the Division Operator*            |
+ +------------------+-------------+--------------+---------------------------------------------+
+-| absolute_import  | 2.5.0a1     | 2.7          | :pep:`328`:                                 |
++| absolute_import  | 2.5.0a1     | 3.0          | :pep:`328`:                                 |
+ |                  |             |              | *Imports: Multi-Line and Absolute/Relative* |
+ +------------------+-------------+--------------+---------------------------------------------+
+ | with_statement   | 2.5.0a1     | 2.6          | :pep:`343`:                                 |
+diff -r 70274d53c1dd Doc/library/_winreg.rst
+--- a/Doc/library/_winreg.rst
++++ b/Doc/library/_winreg.rst
+@@ -7,9 +7,9 @@
+ .. sectionauthor:: Mark Hammond <MarkH@ActiveState.com>
+ 
+ .. note::
+-   The :mod:`_winreg` module has been renamed to :mod:`winreg` in Python 3.0.
++   The :mod:`_winreg` module has been renamed to :mod:`winreg` in Python 3.
+    The :term:`2to3` tool will automatically adapt imports when converting your
+-   sources to 3.0.
++   sources to Python 3.
+ 
+ 
+ .. versionadded:: 2.0
+diff -r 70274d53c1dd Doc/library/al.rst
+--- a/Doc/library/al.rst
++++ b/Doc/library/al.rst
+@@ -8,7 +8,7 @@
+    :deprecated:
+ 
+ .. deprecated:: 2.6
+-    The :mod:`al` module has been deprecated for removal in Python 3.0.
++    The :mod:`al` module has been removed in Python 3.
+ 
+ 
+ This module provides access to the audio facilities of the SGI Indy and Indigo
+@@ -201,7 +201,7 @@
+    :deprecated:
+ 
+ .. deprecated:: 2.6
+-   The :mod:`AL` module has been deprecated for removal in Python 3.0.
++   The :mod:`AL` module has been removed in Python 3.
+ 
+ 
+ This module defines symbolic constants needed to use the built-in module
+diff -r 70274d53c1dd Doc/library/anydbm.rst
+--- a/Doc/library/anydbm.rst
++++ b/Doc/library/anydbm.rst
+@@ -6,9 +6,9 @@
+ 
+ 
+ .. note::
+-   The :mod:`anydbm` module has been renamed to :mod:`dbm` in Python 3.0.  The
++   The :mod:`anydbm` module has been renamed to :mod:`dbm` in Python 3.  The
+    :term:`2to3` tool will automatically adapt imports when converting your
+-   sources to 3.0.
++   sources to Python 3.
+ 
+ .. index::
+    module: dbhash
+diff -r 70274d53c1dd Doc/library/archiving.rst
+--- a/Doc/library/archiving.rst
++++ b/Doc/library/archiving.rst
+@@ -7,6 +7,7 @@
+ 
+ The modules described in this chapter support data compression with the zlib,
+ gzip, and bzip2 algorithms, and  the creation of ZIP- and tar-format archives.
++See also :ref:`archiving-operations` provided by the :mod:`shutil` module.
+ 
+ 
+ .. toctree::
+diff -r 70274d53c1dd Doc/library/argparse.rst
+--- a/Doc/library/argparse.rst
++++ b/Doc/library/argparse.rst
+@@ -12,6 +12,12 @@
+ 
+ --------------
+ 
++.. sidebar:: Tutorial
++
++   This page contains the API reference information. For a more gentle
++   introduction to Python command-line parsing, have a look at the
++   :ref:`argparse tutorial <argparse-tutorial>`.
++
+ The :mod:`argparse` module makes it easy to write user-friendly command-line
+ interfaces. The program defines what arguments it requires, and :mod:`argparse`
+ will figure out how to parse those out of :data:`sys.argv`.  The :mod:`argparse`
+@@ -743,7 +749,7 @@
+ 
+ * ``values`` - The associated command-line arguments, with any type conversions
+   applied.  (Type conversions are specified with the type_ keyword argument to
+-  :meth:`~ArgumentParser.add_argument`.
++  :meth:`~ArgumentParser.add_argument`.)
+ 
+ * ``option_string`` - The option string that was used to invoke this action.
+   The ``option_string`` argument is optional, and will be absent if the action
+@@ -1634,8 +1640,8 @@
+ 
+        --bar BAR  bar help
+ 
+-   Note that any arguments not your user defined groups will end up back in the
+-   usual "positional arguments" and "optional arguments" sections.
++   Note that any arguments not in your user-defined groups will end up back
++   in the usual "positional arguments" and "optional arguments" sections.
+ 
+ 
+ Mutual exclusion
+@@ -1826,9 +1832,10 @@
+ * Replace all :meth:`optparse.OptionParser.add_option` calls with
+   :meth:`ArgumentParser.add_argument` calls.
+ 
+-* Replace ``options, args = parser.parse_args()`` with ``args =
++* Replace ``(options, args) = parser.parse_args()`` with ``args =
+   parser.parse_args()`` and add additional :meth:`ArgumentParser.add_argument`
+-  calls for the positional arguments.
++  calls for the positional arguments. Keep in mind that what was previously
++  called ``options``, now in :mod:`argparse` context is called ``args``.
+ 
+ * Replace callback actions and the ``callback_*`` keyword arguments with
+   ``type`` or ``action`` arguments.
+diff -r 70274d53c1dd Doc/library/basehttpserver.rst
+--- a/Doc/library/basehttpserver.rst
++++ b/Doc/library/basehttpserver.rst
+@@ -6,8 +6,8 @@
+ 
+ .. note::
+    The :mod:`BaseHTTPServer` module has been merged into :mod:`http.server` in
+-   Python 3.0.  The :term:`2to3` tool will automatically adapt imports when
+-   converting your sources to 3.0.
++   Python 3.  The :term:`2to3` tool will automatically adapt imports when
++   converting your sources to Python 3.
+ 
+ 
+ .. index::
+@@ -240,7 +240,7 @@
+       to create custom error logging mechanisms. The *format* argument is a
+       standard printf-style format string, where the additional arguments to
+       :meth:`log_message` are applied as inputs to the formatting. The client
+-      address and current date and time are prefixed to every message logged.
++      ip address and current date and time are prefixed to every message logged.
+ 
+ 
+    .. method:: version_string()
+diff -r 70274d53c1dd Doc/library/bastion.rst
+--- a/Doc/library/bastion.rst
++++ b/Doc/library/bastion.rst
+@@ -7,7 +7,7 @@
+    :deprecated:
+ 
+ .. deprecated:: 2.6
+-   The :mod:`Bastion` module has been removed in Python 3.0.
++   The :mod:`Bastion` module has been removed in Python 3.
+ 
+ .. moduleauthor:: Barry Warsaw <bwarsaw@python.org>
+ 
+diff -r 70274d53c1dd Doc/library/bdb.rst
+--- a/Doc/library/bdb.rst
++++ b/Doc/library/bdb.rst
+@@ -20,7 +20,7 @@
+ 
+ The :mod:`bdb` module also defines two classes:
+ 
+-.. class:: Breakpoint(self, file, line[, temporary=0[, cond=None [, funcname=None]]])
++.. class:: Breakpoint(self, file, line, temporary=0, cond=None , funcname=None)
+ 
+    This class implements temporary breakpoints, ignore counts, disabling and
+    (re-)enabling, and conditionals.
+@@ -245,7 +245,7 @@
+    breakpoints.  These methods return a string containing an error message if
+    something went wrong, or ``None`` if all is well.
+ 
+-   .. method:: set_break(filename, lineno[, temporary=0[, cond[, funcname]]])
++   .. method:: set_break(filename, lineno, temporary=0, cond=None, funcname=None)
+ 
+       Set a new breakpoint.  If the *lineno* line doesn't exist for the
+       *filename* passed as argument, return an error message.  The *filename*
+diff -r 70274d53c1dd Doc/library/binascii.rst
+--- a/Doc/library/binascii.rst
++++ b/Doc/library/binascii.rst
+@@ -127,7 +127,7 @@
+    The return value is in the range [-2**31, 2**31-1]
+    regardless of platform.  In the past the value would be signed on
+    some platforms and unsigned on others.  Use & 0xffffffff on the
+-   value if you want it to match 3.0 behavior.
++   value if you want it to match Python 3 behavior.
+ 
+ .. versionchanged:: 3.0
+    The return value is unsigned and in the range [0, 2**32-1]
+diff -r 70274d53c1dd Doc/library/bisect.rst
+--- a/Doc/library/bisect.rst
++++ b/Doc/library/bisect.rst
+@@ -123,9 +123,9 @@
+ a 'B', and so on::
+ 
+    >>> def grade(score, breakpoints=[60, 70, 80, 90], grades='FDCBA'):
+-   ...     i = bisect(breakpoints, score)
+-   ...     return grades[i]
+-   ...
++           i = bisect(breakpoints, score)
++           return grades[i]
++
+    >>> [grade(score) for score in [33, 99, 77, 70, 89, 90, 100]]
+    ['F', 'A', 'C', 'C', 'B', 'A', 'A']
+ 
+diff -r 70274d53c1dd Doc/library/bsddb.rst
+--- a/Doc/library/bsddb.rst
++++ b/Doc/library/bsddb.rst
+@@ -7,7 +7,7 @@
+ .. sectionauthor:: Skip Montanaro <skip@pobox.com>
+ 
+ .. deprecated:: 2.6
+-    The :mod:`bsddb` module has been deprecated for removal in Python 3.0.
++    The :mod:`bsddb` module has been removed in Python 3.
+ 
+ 
+ The :mod:`bsddb` module provides an interface to the Berkeley DB library.  Users
+@@ -86,7 +86,7 @@
+    This is present *only* to allow backwards compatibility with systems which ship
+    with the old Berkeley DB 1.85 database library.  The :mod:`bsddb185` module
+    should never be used directly in new code. The module has been removed in
+-   Python 3.0.  If you find you still need it look in PyPI.
++   Python 3.  If you find you still need it look in PyPI.
+ 
+ 
+ .. seealso::
+diff -r 70274d53c1dd Doc/library/bz2.rst
+--- a/Doc/library/bz2.rst
++++ b/Doc/library/bz2.rst
+@@ -14,9 +14,6 @@
+ It implements a complete file interface, one-shot (de)compression functions, and
+ types for sequential (de)compression.
+ 
+-For other archive formats, see the :mod:`gzip`, :mod:`zipfile`, and
+-:mod:`tarfile` modules.
+-
+ Here is a summary of the features offered by the bz2 module:
+ 
+ * :class:`BZ2File` class implements a complete file interface, including
+diff -r 70274d53c1dd Doc/library/carbon.rst
+--- a/Doc/library/carbon.rst
++++ b/Doc/library/carbon.rst
+@@ -24,7 +24,7 @@
+ 
+ .. note::
+ 
+-   The Carbon modules have been removed in Python 3.0.
++   The Carbon modules have been removed in Python 3.
+ 
+ 
+ :mod:`Carbon.AE` --- Apple Events
+diff -r 70274d53c1dd Doc/library/cd.rst
+--- a/Doc/library/cd.rst
++++ b/Doc/library/cd.rst
+@@ -9,7 +9,7 @@
+ 
+ 
+ .. deprecated:: 2.6
+-    The :mod:`cd` module has been deprecated for removal in Python 3.0.
++    The :mod:`cd` module has been removed in Python 3.
+ 
+ 
+ This module provides an interface to the Silicon Graphics CD library. It is
+diff -r 70274d53c1dd Doc/library/cgi.rst
+--- a/Doc/library/cgi.rst
++++ b/Doc/library/cgi.rst
+@@ -284,10 +284,10 @@
+ algorithms implemented in this module in other circumstances.
+ 
+ 
+-.. function:: parse(fp[, keep_blank_values[, strict_parsing]])
++.. function:: parse(fp[, environ[, keep_blank_values[, strict_parsing]]])
+ 
+    Parse a query in the environment or from a file (the file defaults to
+-   ``sys.stdin``).  The *keep_blank_values* and *strict_parsing* parameters are
++   ``sys.stdin`` and environment defaults to ``os.environ``).  The *keep_blank_values* and *strict_parsing* parameters are
+    passed to :func:`urlparse.parse_qs` unchanged.
+ 
+ 
+diff -r 70274d53c1dd Doc/library/cgihttpserver.rst
+--- a/Doc/library/cgihttpserver.rst
++++ b/Doc/library/cgihttpserver.rst
+@@ -8,8 +8,8 @@
+ 
+ .. note::
+    The :mod:`CGIHTTPServer` module has been merged into :mod:`http.server` in
+-   Python 3.0.  The :term:`2to3` tool will automatically adapt imports when
+-   converting your sources to 3.0.
++   Python 3.  The :term:`2to3` tool will automatically adapt imports when
++   converting your sources to Python 3.
+ 
+ 
+ The :mod:`CGIHTTPServer` module defines a request-handler class, interface
+diff -r 70274d53c1dd Doc/library/collections.rst
+--- a/Doc/library/collections.rst
++++ b/Doc/library/collections.rst
+@@ -601,47 +601,49 @@
+ 
+    >>> Point = namedtuple('Point', ['x', 'y'], verbose=True)
+    class Point(tuple):
+-           'Point(x, y)'
++       'Point(x, y)'
+    <BLANKLINE>
+-           __slots__ = ()
++       __slots__ = ()
+    <BLANKLINE>
+-           _fields = ('x', 'y')
++       _fields = ('x', 'y')
+    <BLANKLINE>
+-           def __new__(_cls, x, y):
+-               'Create a new instance of Point(x, y)'
+-               return _tuple.__new__(_cls, (x, y))
++       def __new__(_cls, x, y):
++           'Create a new instance of Point(x, y)'
++           return _tuple.__new__(_cls, (x, y))
+    <BLANKLINE>
+-           @classmethod
+-           def _make(cls, iterable, new=tuple.__new__, len=len):
+-               'Make a new Point object from a sequence or iterable'
+-               result = new(cls, iterable)
+-               if len(result) != 2:
+-                   raise TypeError('Expected 2 arguments, got %d' % len(result))
+-               return result
++       @classmethod
++       def _make(cls, iterable, new=tuple.__new__, len=len):
++           'Make a new Point object from a sequence or iterable'
++           result = new(cls, iterable)
++           if len(result) != 2:
++               raise TypeError('Expected 2 arguments, got %d' % len(result))
++           return result
+    <BLANKLINE>
+-           def __repr__(self):
+-               'Return a nicely formatted representation string'
+-               return 'Point(x=%r, y=%r)' % self
++       def __repr__(self):
++           'Return a nicely formatted representation string'
++           return 'Point(x=%r, y=%r)' % self
+    <BLANKLINE>
+-           def _asdict(self):
+-               'Return a new OrderedDict which maps field names to their values'
+-               return OrderedDict(zip(self._fields, self))
++       def _asdict(self):
++           'Return a new OrderedDict which maps field names to their values'
++           return OrderedDict(zip(self._fields, self))
+    <BLANKLINE>
+-          __dict__ = property(_asdict)
++      __dict__ = property(_asdict)
+    <BLANKLINE>
+-          def _replace(_self, **kwds):
+-               'Return a new Point object replacing specified fields with new values'
+-               result = _self._make(map(kwds.pop, ('x', 'y'), _self))
+-               if kwds:
+-                   raise ValueError('Got unexpected field names: %r' % kwds.keys())
+-               return result
++      def _replace(_self, **kwds):
++           'Return a new Point object replacing specified fields with new values'
++           result = _self._make(map(kwds.pop, ('x', 'y'), _self))
++           if kwds:
++               raise ValueError('Got unexpected field names: %r' % kwds.keys())
++           return result
+    <BLANKLINE>
+-           def __getnewargs__(self):
+-               'Return self as a plain tuple.   Used by copy and pickle.'
+-               return tuple(self)
++       def __getnewargs__(self):
++           'Return self as a plain tuple.   Used by copy and pickle.'
++           return tuple(self)
+    <BLANKLINE>
+-           x = _property(_itemgetter(0), doc='Alias for field number 0')
+-           y = _property(_itemgetter(1), doc='Alias for field number 1')
++       x = _property(_itemgetter(0), doc='Alias for field number 0')
++   <BLANKLINE>
++       y = _property(_itemgetter(1), doc='Alias for field number 1')
++   <BLANKLINE>
+ 
+    >>> p = Point(11, y=22)     # instantiate with positional or keyword arguments
+    >>> p[0] + p[1]             # indexable like the plain tuple (11, 22)
+diff -r 70274d53c1dd Doc/library/commands.rst
+--- a/Doc/library/commands.rst
++++ b/Doc/library/commands.rst
+@@ -8,7 +8,7 @@
+    :deprecated:
+ 
+ .. deprecated:: 2.6
+-   The :mod:`commands` module has been removed in Python 3.0.  Use the
++   The :mod:`commands` module has been removed in Python 3.  Use the
+    :mod:`subprocess` module instead.
+ 
+ .. sectionauthor:: Sue Williams <sbw@provis.com>
+diff -r 70274d53c1dd Doc/library/compiler.rst
+--- a/Doc/library/compiler.rst
++++ b/Doc/library/compiler.rst
+@@ -6,7 +6,7 @@
+ ***********************
+ 
+ .. deprecated:: 2.6
+-   The :mod:`compiler` package has been removed in Python 3.0.
++   The :mod:`compiler` package has been removed in Python 3.
+ 
+ .. sectionauthor:: Jeremy Hylton <jeremy@zope.com>
+ 
+diff -r 70274d53c1dd Doc/library/configparser.rst
+--- a/Doc/library/configparser.rst
++++ b/Doc/library/configparser.rst
+@@ -12,8 +12,8 @@
+ .. note::
+ 
+    The :mod:`ConfigParser` module has been renamed to :mod:`configparser` in
+-   Python 3.0.  The :term:`2to3` tool will automatically adapt imports when
+-   converting your sources to 3.0.
++   Python 3.  The :term:`2to3` tool will automatically adapt imports when
++   converting your sources to Python 3.
+ 
+ .. index::
+    pair: .ini; file
+diff -r 70274d53c1dd Doc/library/cookie.rst
+--- a/Doc/library/cookie.rst
++++ b/Doc/library/cookie.rst
+@@ -8,8 +8,8 @@
+ 
+ .. note::
+    The :mod:`Cookie` module has been renamed to :mod:`http.cookies` in Python
+-   3.0.  The :term:`2to3` tool will automatically adapt imports when converting
+-   your sources to 3.0.
++   3.  The :term:`2to3` tool will automatically adapt imports when converting
++   your sources to Python 3.
+ 
+ **Source code:** :source:`Lib/Cookie.py`
+ 
+@@ -22,8 +22,14 @@
+ 
+ The module formerly strictly applied the parsing rules described in the
+ :rfc:`2109` and :rfc:`2068` specifications.  It has since been discovered that
+-MSIE 3.0x doesn't follow the character rules outlined in those specs.  As a
+-result, the parsing rules used are a bit less strict.
++MSIE 3.0x doesn't follow the character rules outlined in those specs and also
++many current day browsers and servers have relaxed parsing rules when comes to
++Cookie handling.  As a result, the parsing rules used are a bit less strict.
++
++The character set, :data:`string.ascii_letters`, :data:`string.digits` and
++``!#$%&'*+-.^_`|~`` denote the set of valid characters allowed by this module
++in Cookie name (as :attr:`~Morsel.key`).
++
+ 
+ .. note::
+ 
+diff -r 70274d53c1dd Doc/library/cookielib.rst
+--- a/Doc/library/cookielib.rst
++++ b/Doc/library/cookielib.rst
+@@ -8,8 +8,8 @@
+ 
+ .. note::
+    The :mod:`cookielib` module has been renamed to :mod:`http.cookiejar` in
+-   Python 3.0.  The :term:`2to3` tool will automatically adapt imports when
+-   converting your sources to 3.0.
++   Python 3.  The :term:`2to3` tool will automatically adapt imports when
++   converting your sources to Python 3.
+ 
+ .. versionadded:: 2.4
+ 
+diff -r 70274d53c1dd Doc/library/copy_reg.rst
+--- a/Doc/library/copy_reg.rst
++++ b/Doc/library/copy_reg.rst
+@@ -5,9 +5,9 @@
+    :synopsis: Register pickle support functions.
+ 
+ .. note::
+-   The :mod:`copy_reg` module has been renamed to :mod:`copyreg` in Python 3.0.
++   The :mod:`copy_reg` module has been renamed to :mod:`copyreg` in Python 3.
+    The :term:`2to3` tool will automatically adapt imports when converting your
+-   sources to 3.0.
++   sources to Python 3.
+ 
+ .. index::
+    module: pickle
+diff -r 70274d53c1dd Doc/library/csv.rst
+--- a/Doc/library/csv.rst
++++ b/Doc/library/csv.rst
+@@ -40,7 +40,7 @@
+    This version of the :mod:`csv` module doesn't support Unicode input.  Also,
+    there are currently some issues regarding ASCII NUL characters.  Accordingly,
+    all input should be UTF-8 or printable ASCII to be safe; see the examples in
+-   section :ref:`csv-examples`. These restrictions will be removed in the future.
++   section :ref:`csv-examples`.
+ 
+ 
+ .. seealso::
+@@ -162,7 +162,7 @@
+ The :mod:`csv` module defines the following classes:
+ 
+ 
+-.. class:: DictReader(csvfile[, fieldnames=None[, restkey=None[, restval=None[, dialect='excel'[, *args, **kwds]]]]])
++.. class:: DictReader(csvfile, fieldnames=None, restkey=None, restval=None, dialect='excel', *args, **kwds)
+ 
+    Create an object which operates like a regular reader but maps the information
+    read into a dict whose keys are given by the optional  *fieldnames* parameter.
+@@ -175,7 +175,7 @@
+    the underlying :class:`reader` instance.
+ 
+ 
+-.. class:: DictWriter(csvfile, fieldnames[, restval=''[, extrasaction='raise'[, dialect='excel'[, *args, **kwds]]]])
++.. class:: DictWriter(csvfile, fieldnames, restval='', extrasaction='raise', dialect='excel', *args, **kwds)
+ 
+    Create an object which operates like a regular writer but maps dictionaries onto
+    output rows.  The *fieldnames* parameter identifies the order in which values in
+@@ -219,7 +219,7 @@
+ 
+    The :class:`Sniffer` class provides two methods:
+ 
+-   .. method:: sniff(sample[, delimiters=None])
++   .. method:: sniff(sample, delimiters=None)
+ 
+       Analyze the given *sample* and return a :class:`Dialect` subclass
+       reflecting the parameters found.  If the optional *delimiters* parameter
+diff -r 70274d53c1dd Doc/library/datetime.rst
+--- a/Doc/library/datetime.rst
++++ b/Doc/library/datetime.rst
+@@ -14,27 +14,34 @@
+ The :mod:`datetime` module supplies classes for manipulating dates and times in
+ both simple and complex ways.  While date and time arithmetic is supported, the
+ focus of the implementation is on efficient attribute extraction for output
+-formatting and manipulation. For related
+-functionality, see also the :mod:`time` and :mod:`calendar` modules.
++formatting and manipulation. For related functionality, see also the
++:mod:`time` and :mod:`calendar` modules.
+ 
+-There are two kinds of date and time objects: "naive" and "aware". This
+-distinction refers to whether the object has any notion of time zone, daylight
+-saving time, or other kind of algorithmic or political time adjustment.  Whether
+-a naive :class:`.datetime` object represents Coordinated Universal Time (UTC),
+-local time, or time in some other timezone is purely up to the program, just
+-like it's up to the program whether a particular number represents metres,
+-miles, or mass.  Naive :class:`.datetime` objects are easy to understand and to
+-work with, at the cost of ignoring some aspects of reality.
++There are two kinds of date and time objects: "naive" and "aware".
+ 
+-For applications requiring more, :class:`.datetime` and :class:`.time` objects
+-have an optional time zone information attribute, :attr:`tzinfo`, that can be
+-set to an instance of a subclass of the abstract :class:`tzinfo` class.  These
+-:class:`tzinfo` objects capture information about the offset from UTC time, the
+-time zone name, and whether Daylight Saving Time is in effect.  Note that no
+-concrete :class:`tzinfo` classes are supplied by the :mod:`datetime` module.
+-Supporting timezones at whatever level of detail is required is up to the
+-application.  The rules for time adjustment across the world are more political
+-than rational, and there is no standard suitable for every application.
++An aware object has sufficient knowledge of applicable algorithmic and
++political time adjustments, such as time zone and daylight saving time
++information, to locate itself relative to other aware objects.  An aware object
++is used to represent a specific moment in time that is not open to
++interpretation [#]_.
++
+++A naive object does not contain enough information to unambiguously locate
+++itself relative to other date/time objects.  Whether a naive object represents
++Coordinated Universal Time (UTC), local time, or time in some other timezone is
++purely up to the program, just like it's up to the program whether a particular
++number represents metres, miles, or mass.  Naive objects are easy to understand
++and to work with, at the cost of ignoring some aspects of reality.
++
++For applications requiring aware objects, :class:`.datetime` and :class:`.time`
++objects have an optional time zone information attribute, :attr:`tzinfo`, that
++can be set to an instance of a subclass of the abstract :class:`tzinfo` class.
++These :class:`tzinfo` objects capture information about the offset from UTC
++time, the time zone name, and whether Daylight Saving Time is in effect.  Note
++that no concrete :class:`tzinfo` classes are supplied by the :mod:`datetime`
++module.  Supporting timezones at whatever level of detail is required is up to
++the application.  The rules for time adjustment across the world are more
++political than rational, and there is no standard suitable for every
++application.
+ 
+ The :mod:`datetime` module exports the following constants:
+ 
+@@ -105,10 +112,13 @@
+ 
+ Objects of the :class:`date` type are always naive.
+ 
+-An object *d* of type :class:`.time` or :class:`.datetime` may be naive or aware.
+-*d* is aware if ``d.tzinfo`` is not ``None`` and ``d.tzinfo.utcoffset(d)`` does
+-not return ``None``.  If ``d.tzinfo`` is ``None``, or if ``d.tzinfo`` is not
+-``None`` but ``d.tzinfo.utcoffset(d)`` returns ``None``, *d* is naive.
++An object of type :class:`.time` or :class:`.datetime` may be naive or aware.
++A :class:`.datetime` object *d* is aware if ``d.tzinfo`` is not ``None`` and
++``d.tzinfo.utcoffset(d)`` does not return ``None``.  If ``d.tzinfo`` is
++``None``, or if ``d.tzinfo`` is not ``None`` but ``d.tzinfo.utcoffset(d)``
++returns ``None``, *d* is naive.  A :class:`.time` object *t* is aware
++if ``t.tzinfo`` is not ``None`` and ``t.tzinfo.utcoffset(None)`` does not return
++``None``.  Otherwise, *t* is naive.
+ 
+ The distinction between naive and aware doesn't apply to :class:`timedelta`
+ objects.
+@@ -1083,14 +1093,14 @@
+ 
+     >>> from datetime import timedelta, datetime, tzinfo
+     >>> class GMT1(tzinfo):
+-    ...     def __init__(self):         # DST starts last Sunday in March
++    ...     def utcoffset(self, dt):
++    ...         return timedelta(hours=1) + self.dst(dt)
++    ...     def dst(self, dt):
++    ...         # DST starts last Sunday in March
+     ...         d = datetime(dt.year, 4, 1)   # ends last Sunday in October
+     ...         self.dston = d - timedelta(days=d.weekday() + 1)
+     ...         d = datetime(dt.year, 11, 1)
+     ...         self.dstoff = d - timedelta(days=d.weekday() + 1)
+-    ...     def utcoffset(self, dt):
+-    ...         return timedelta(hours=1) + self.dst(dt)
+-    ...     def dst(self, dt):
+     ...         if self.dston <=  dt.replace(tzinfo=None) < self.dstoff:
+     ...             return timedelta(hours=1)
+     ...         else:
+@@ -1099,16 +1109,15 @@
+     ...          return "GMT +1"
+     ...
+     >>> class GMT2(tzinfo):
+-    ...     def __init__(self):
++    ...     def utcoffset(self, dt):
++    ...         return timedelta(hours=2) + self.dst(dt)
++    ...     def dst(self, dt):
+     ...         d = datetime(dt.year, 4, 1)
+     ...         self.dston = d - timedelta(days=d.weekday() + 1)
+     ...         d = datetime(dt.year, 11, 1)
+     ...         self.dstoff = d - timedelta(days=d.weekday() + 1)
+-    ...     def utcoffset(self, dt):
+-    ...         return timedelta(hours=1) + self.dst(dt)
+-    ...     def dst(self, dt):
+     ...         if self.dston <=  dt.replace(tzinfo=None) < self.dstoff:
+-    ...             return timedelta(hours=2)
++    ...             return timedelta(hours=1)
+     ...         else:
+     ...             return timedelta(0)
+     ...     def tzname(self,dt):
+@@ -1521,6 +1530,21 @@
+ other fixed-offset :class:`tzinfo` subclass (such as a class representing only
+ EST (fixed offset -5 hours), or only EDT (fixed offset -4 hours)).
+ 
++.. seealso::
++
++   `pytz <http://pypi.python.org/pypi/pytz/>`_
++      The standard library has no :class:`tzinfo` instances except for UTC, but
++      there exists a third-party library which brings the *IANA timezone
++      database* (also known as the Olson database) to Python: *pytz*.
++
++      *pytz* contains up-to-date information and its usage is recommended.
++
++   `IANA timezone database <http://www.iana.org/time-zones>`_
++      The Time Zone Database (often called tz or zoneinfo) contains code and
++      data that represent the history of local time for many representative
++      locations around the globe. It is updated periodically to reflect changes
++      made by political bodies to time zone boundaries, UTC offsets, and
++      daylight-saving rules.
+ 
+ .. _strftime-strptime-behavior:
+ 
+@@ -1692,3 +1716,8 @@
+ (5)
+    For example, if :meth:`utcoffset` returns ``timedelta(hours=-3, minutes=-30)``,
+    ``%z`` is replaced with the string ``'-0330'``.
++
++
++.. rubric:: Footnotes
++
++.. [#] If, that is, we ignore the effects of Relativity
+diff -r 70274d53c1dd Doc/library/dbhash.rst
+--- a/Doc/library/dbhash.rst
++++ b/Doc/library/dbhash.rst
+@@ -6,7 +6,7 @@
+ .. sectionauthor:: Fred L. Drake, Jr. <fdrake@acm.org>
+ 
+ .. deprecated:: 2.6
+-    The :mod:`dbhash` module has been deprecated for removal in Python 3.0.
++   The :mod:`dbhash` module has been removed in Python 3.
+ 
+ .. index:: module: bsddb
+ 
+diff -r 70274d53c1dd Doc/library/dbm.rst
+--- a/Doc/library/dbm.rst
++++ b/Doc/library/dbm.rst
+@@ -6,9 +6,9 @@
+    :synopsis: The standard "database" interface, based on ndbm.
+ 
+ .. note::
+-   The :mod:`dbm` module has been renamed to :mod:`dbm.ndbm` in Python 3.0.  The
++   The :mod:`dbm` module has been renamed to :mod:`dbm.ndbm` in Python 3.  The
+    :term:`2to3` tool will automatically adapt imports when converting your
+-   sources to 3.0.
++   sources to Python 3.
+ 
+ 
+ The :mod:`dbm` module provides an interface to the Unix "(n)dbm" library.  Dbm
+diff -r 70274d53c1dd Doc/library/decimal.rst
+--- a/Doc/library/decimal.rst
++++ b/Doc/library/decimal.rst
+@@ -944,6 +944,10 @@
+           s = calculate_something()
+       s = +s  # Round the final result back to the default precision
+ 
++      with localcontext(BasicContext):      # temporarily use the BasicContext
++          print Decimal(1) / Decimal(7)
++          print Decimal(355) / Decimal(113)
++
+ New contexts can also be created using the :class:`Context` constructor
+ described below. In addition, the module provides three pre-made contexts:
+ 
+diff -r 70274d53c1dd Doc/library/difflib.rst
+--- a/Doc/library/difflib.rst
++++ b/Doc/library/difflib.rst
+@@ -84,7 +84,7 @@
+    The constructor for this class is:
+ 
+ 
+-   .. function:: __init__([tabsize][, wrapcolumn][, linejunk][, charjunk])
++   .. function:: __init__(tabsize=8, wrapcolumn=None, linejunk=None, charjunk=IS_CHARACTER_JUNK)
+ 
+       Initializes instance of :class:`HtmlDiff`.
+ 
+@@ -344,7 +344,7 @@
+ The :class:`SequenceMatcher` class has this constructor:
+ 
+ 
+-.. class:: SequenceMatcher([isjunk[, a[, b[, autojunk=True]]]])
++.. class:: SequenceMatcher(isjunk=None, a='', b='', autojunk=True)
+ 
+    Optional argument *isjunk* must be ``None`` (the default) or a one-argument
+    function that takes a sequence element and returns true if and only if the
+diff -r 70274d53c1dd Doc/library/dircache.rst
+--- a/Doc/library/dircache.rst
++++ b/Doc/library/dircache.rst
+@@ -7,7 +7,7 @@
+    :deprecated:
+ 
+ .. deprecated:: 2.6
+-   The :mod:`dircache` module has been removed in Python 3.0.
++   The :mod:`dircache` module has been removed in Python 3.
+ 
+ 
+ .. sectionauthor:: Moshe Zadka <moshez@zadka.site.co.il>
+diff -r 70274d53c1dd Doc/library/dl.rst
+--- a/Doc/library/dl.rst
++++ b/Doc/library/dl.rst
+@@ -8,7 +8,7 @@
+    :deprecated:
+ 
+ .. deprecated:: 2.6
+-    The :mod:`dl` module has been removed in Python 3.0. Use the :mod:`ctypes`
++    The :mod:`dl` module has been removed in Python 3. Use the :mod:`ctypes`
+     module instead.
+ 
+ .. sectionauthor:: Moshe Zadka <moshez@zadka.site.co.il>
+diff -r 70274d53c1dd Doc/library/docxmlrpcserver.rst
+--- a/Doc/library/docxmlrpcserver.rst
++++ b/Doc/library/docxmlrpcserver.rst
+@@ -8,8 +8,8 @@
+ 
+ .. note::
+    The :mod:`DocXMLRPCServer` module has been merged into :mod:`xmlrpc.server`
+-   in Python 3.0.  The :term:`2to3` tool will automatically adapt imports when
+-   converting your sources to 3.0.
++   in Python 3.  The :term:`2to3` tool will automatically adapt imports when
++   converting your sources to Python 3.
+ 
+ 
+ .. versionadded:: 2.3
+diff -r 70274d53c1dd Doc/library/dumbdbm.rst
+--- a/Doc/library/dumbdbm.rst
++++ b/Doc/library/dumbdbm.rst
+@@ -5,9 +5,9 @@
+    :synopsis: Portable implementation of the simple DBM interface.
+ 
+ .. note::
+-   The :mod:`dumbdbm` module has been renamed to :mod:`dbm.dumb` in Python 3.0.
++   The :mod:`dumbdbm` module has been renamed to :mod:`dbm.dumb` in Python 3.
+    The :term:`2to3` tool will automatically adapt imports when converting your
+-   sources to 3.0.
++   sources to Python 3.
+ 
+ .. index:: single: databases
+ 
+diff -r 70274d53c1dd Doc/library/dummy_thread.rst
+--- a/Doc/library/dummy_thread.rst
++++ b/Doc/library/dummy_thread.rst
+@@ -6,8 +6,8 @@
+ 
+ .. note::
+    The :mod:`dummy_thread` module has been renamed to :mod:`_dummy_thread` in
+-   Python 3.0.  The :term:`2to3` tool will automatically adapt imports when
+-   converting your sources to 3.0; however, you should consider using the
++   Python 3.  The :term:`2to3` tool will automatically adapt imports when
++   converting your sources to Python 3; however, you should consider using the
+    high-lever :mod:`dummy_threading` module instead.
+ 
+ **Source code:** :source:`Lib/dummy_thread.py`
+diff -r 70274d53c1dd Doc/library/email.charset.rst
+--- a/Doc/library/email.charset.rst
++++ b/Doc/library/email.charset.rst
+@@ -1,5 +1,5 @@
+-:mod:`email`: Representing character sets
+------------------------------------------
++:mod:`email.charset`: Representing character sets
++-------------------------------------------------
+ 
+ .. module:: email.charset
+    :synopsis: Character Sets
+diff -r 70274d53c1dd Doc/library/email.encoders.rst
+--- a/Doc/library/email.encoders.rst
++++ b/Doc/library/email.encoders.rst
+@@ -1,5 +1,5 @@
+-:mod:`email`: Encoders
+-----------------------
++:mod:`email.encoders`: Encoders
++-------------------------------
+ 
+ .. module:: email.encoders
+    :synopsis: Encoders for email message payloads.
+@@ -18,6 +18,10 @@
+ payload, encode it, and reset the payload to this newly encoded value.  They
+ should also set the :mailheader:`Content-Transfer-Encoding` header as appropriate.
+ 
++Note that these functions are not meaningful for a multipart message.  They
++must be applied to individual subparts instead, and will raise a
++:exc:`TypeError` if passed a message whose type is multipart.
++
+ Here are the encoding functions provided:
+ 
+ 
+diff -r 70274d53c1dd Doc/library/email.errors.rst
+--- a/Doc/library/email.errors.rst
++++ b/Doc/library/email.errors.rst
+@@ -1,5 +1,5 @@
+-:mod:`email`: Exception and Defect classes
+-------------------------------------------
++:mod:`email.errors`: Exception and Defect classes
++-------------------------------------------------
+ 
+ .. module:: email.errors
+    :synopsis: The exception classes used by the email package.
+diff -r 70274d53c1dd Doc/library/email.generator.rst
+--- a/Doc/library/email.generator.rst
++++ b/Doc/library/email.generator.rst
+@@ -1,5 +1,5 @@
+-:mod:`email`: Generating MIME documents
+----------------------------------------
++:mod:`email.generator`: Generating MIME documents
++-------------------------------------------------
+ 
+ .. module:: email.generator
+    :synopsis: Generate flat text email messages from a message structure.
+@@ -17,10 +17,10 @@
+ standards-compliant way, should handle MIME and non-MIME email messages just
+ fine, and is designed so that the transformation from flat text, to a message
+ structure via the :class:`~email.parser.Parser` class, and back to flat text,
+-is idempotent (the input is identical to the output).  On the other hand, using
+-the Generator on a :class:`~email.message.Message` constructed by program may
+-result in changes to the :class:`~email.message.Message` object as defaults are
+-filled in.
++is idempotent (the input is identical to the output) [#]_.  On the other hand,
++using the Generator on a :class:`~email.message.Message` constructed by program
++may result in changes to the :class:`~email.message.Message` object as defaults
++are filled in.
+ 
+ Here are the public methods of the :class:`Generator` class, imported from the
+ :mod:`email.generator` module:
+@@ -125,3 +125,11 @@
+ .. versionchanged:: 2.5
+    The previously deprecated method :meth:`__call__` was removed.
+ 
++
++.. rubric:: Footnotes
++
++.. [#] This statement assumes that you use the appropriate setting for the
++       ``unixfrom`` argument, and that you set maxheaderlen=0 (which will
++       preserve whatever the input line lengths were).  It is also not strictly
++       true, since in many cases runs of whitespace in headers are collapsed
++       into single blanks.  The latter is a bug that will eventually be fixed.
+diff -r 70274d53c1dd Doc/library/email.header.rst
+--- a/Doc/library/email.header.rst
++++ b/Doc/library/email.header.rst
+@@ -1,5 +1,5 @@
+-:mod:`email`: Internationalized headers
+----------------------------------------
++:mod:`email.header`: Internationalized headers
++----------------------------------------------
+ 
+ .. module:: email.header
+    :synopsis: Representing non-ASCII headers
+diff -r 70274d53c1dd Doc/library/email.iterators.rst
+--- a/Doc/library/email.iterators.rst
++++ b/Doc/library/email.iterators.rst
+@@ -1,5 +1,5 @@
+-:mod:`email`: Iterators
+------------------------
++:mod:`email.iterators`: Iterators
++---------------------------------
+ 
+ .. module:: email.iterators
+    :synopsis: Iterate over a  message object tree.
+diff -r 70274d53c1dd Doc/library/email.message.rst
+--- a/Doc/library/email.message.rst
++++ b/Doc/library/email.message.rst
+@@ -1,5 +1,5 @@
+-:mod:`email`: Representing an email message
+--------------------------------------------
++:mod:`email.message`: Representing an email message
++---------------------------------------------------
+ 
+ .. module:: email.message
+    :synopsis: The base class representing email messages.
+diff -r 70274d53c1dd Doc/library/email.mime.rst
+--- a/Doc/library/email.mime.rst
++++ b/Doc/library/email.mime.rst
+@@ -1,5 +1,5 @@
+-:mod:`email`: Creating email and MIME objects from scratch
+-----------------------------------------------------------
++:mod:`email.mime`: Creating email and MIME objects from scratch
++---------------------------------------------------------------
+ 
+ .. module:: email.mime
+    :synopsis: Build MIME messages.
+diff -r 70274d53c1dd Doc/library/email.parser.rst
+--- a/Doc/library/email.parser.rst
++++ b/Doc/library/email.parser.rst
+@@ -1,5 +1,5 @@
+-:mod:`email`: Parsing email messages
+-------------------------------------
++:mod:`email.parser`: Parsing email messages
++-------------------------------------------
+ 
+ .. module:: email.parser
+    :synopsis: Parse flat text email messages to produce a message object structure.
+diff -r 70274d53c1dd Doc/library/email.util.rst
+--- a/Doc/library/email.util.rst
++++ b/Doc/library/email.util.rst
+@@ -1,5 +1,5 @@
+-:mod:`email`: Miscellaneous utilities
+--------------------------------------
++:mod:`email.utils`: Miscellaneous utilities
++-------------------------------------------
+ 
+ .. module:: email.utils
+    :synopsis: Miscellaneous email package utilities.
+diff -r 70274d53c1dd Doc/library/filecmp.rst
+--- a/Doc/library/filecmp.rst
++++ b/Doc/library/filecmp.rst
+@@ -75,6 +75,9 @@
+    'tags']``. *hide* is a list of names to hide, and defaults to ``[os.curdir,
+    os.pardir]``.
+ 
++   The :class:`dircmp` class compares files by doing *shallow* comparisons
++   as described for :func:`filecmp.cmp`.
++
+    The :class:`dircmp` class provides the following methods:
+ 
+ 
+@@ -94,7 +97,7 @@
+       Print a comparison between *a* and *b* and common subdirectories
+       (recursively).
+ 
+-   The :class:`dircmp` offers a number of interesting attributes that may be
++   The :class:`dircmp` class offers a number of interesting attributes that may be
+    used to get various bits of information about the directory trees being
+    compared.
+ 
+@@ -103,6 +106,16 @@
+    to compute are used.
+ 
+ 
++   .. attribute:: left
++
++      The directory *a*.
++
++
++   .. attribute:: right
++
++      The directory *b*.
++
++
+    .. attribute:: left_list
+ 
+       Files and subdirectories in *a*, filtered by *hide* and *ignore*.
+@@ -146,12 +159,14 @@
+ 
+    .. attribute:: same_files
+ 
+-      Files which are identical in both *a* and *b*.
++      Files which are identical in both *a* and *b*, using the class's
++      file comparison operator.
+ 
+ 
+    .. attribute:: diff_files
+ 
+-      Files which are in both *a* and *b*, whose contents differ.
++      Files which are in both *a* and *b*, whose contents differ according
++      to the class's file comparison operator.
+ 
+ 
+    .. attribute:: funny_files
+@@ -163,3 +178,18 @@
+ 
+       A dictionary mapping names in :attr:`common_dirs` to :class:`dircmp` objects.
+ 
++
++Here is a simplified example of using the ``subdirs`` attribute to search
++recursively through two directories to show common different files::
++
++    >>> from filecmp import dircmp
++    >>> def print_diff_files(dcmp):
++    ...     for name in dcmp.diff_files:
++    ...         print "diff_file %s found in %s and %s" % (name, dcmp.left,
++    ...               dcmp.right)
++    ...     for sub_dcmp in dcmp.subdirs.values():
++    ...         print_diff_files(sub_dcmp)
++    ...
++    >>> dcmp = dircmp('dir1', 'dir2')
++    >>> print_diff_files(dcmp)
++
+diff -r 70274d53c1dd Doc/library/fl.rst
+--- a/Doc/library/fl.rst
++++ b/Doc/library/fl.rst
+@@ -9,7 +9,7 @@
+ 
+ 
+ .. deprecated:: 2.6
+-    The :mod:`fl` module has been deprecated for removal in Python 3.0.
++    The :mod:`fl` module has been removed in Python 3.
+ 
+ 
+ .. index::
+@@ -487,7 +487,7 @@
+ 
+ 
+ .. deprecated:: 2.6
+-    The :mod:`FL` module has been deprecated for removal in Python 3.0.
++    The :mod:`FL` module has been removed in Python 3.
+ 
+ 
+ This module defines symbolic constants needed to use the built-in module
+@@ -509,7 +509,7 @@
+ 
+ 
+ .. deprecated:: 2.6
+-    The :mod:`flp` module has been deprecated for removal in Python 3.0.
++    The :mod:`flp` module has been removed in Python 3.
+ 
+ 
+ This module defines functions that can read form definitions created by the
+diff -r 70274d53c1dd Doc/library/fm.rst
+--- a/Doc/library/fm.rst
++++ b/Doc/library/fm.rst
+@@ -8,7 +8,7 @@
+    :deprecated:
+ 
+ .. deprecated:: 2.6
+-   The :mod:`fm` module has been deprecated for removal in Python 3.0.
++   The :mod:`fm` module has been removed in Python 3.
+ 
+ 
+ 
+diff -r 70274d53c1dd Doc/library/formatter.rst
+--- a/Doc/library/formatter.rst
++++ b/Doc/library/formatter.rst
+@@ -341,10 +341,10 @@
+    output.
+ 
+ 
+-.. class:: DumbWriter([file[, maxcol=72]])
++.. class:: DumbWriter(file=None, maxcol=72)
+ 
+    Simple writer class which writes output on the file object passed in as *file*
+-   or, if *file* is omitted, on standard output.  The output is simply word-wrapped
++   or, if *file* is None, on standard output.  The output is simply word-wrapped
+    to the number of columns specified by *maxcol*.  This class is suitable for
+    reflowing a sequence of paragraphs.
+ 
+diff -r 70274d53c1dd Doc/library/fpectl.rst
+--- a/Doc/library/fpectl.rst
++++ b/Doc/library/fpectl.rst
+@@ -113,8 +113,8 @@
+ .. seealso::
+ 
+    Some files in the source distribution may be interesting in learning more about
+-   how this module operates. The include file :file:`Include/pyfpe.h` discusses the
+-   implementation of this module at some length. :file:`Modules/fpetestmodule.c`
++   how this module operates. The include file :source:`Include/pyfpe.h` discusses the
++   implementation of this module at some length. :source:`Modules/fpetestmodule.c`
+    gives several examples of use. Many additional examples can be found in
+-   :file:`Objects/floatobject.c`.
++   :source:`Objects/floatobject.c`.
+ 
+diff -r 70274d53c1dd Doc/library/fpformat.rst
+--- a/Doc/library/fpformat.rst
++++ b/Doc/library/fpformat.rst
+@@ -7,7 +7,7 @@
+    :deprecated:
+ 
+ .. deprecated:: 2.6
+-    The :mod:`fpformat` module has been removed in Python 3.0.
++    The :mod:`fpformat` module has been removed in Python 3.
+ 
+ .. sectionauthor:: Moshe Zadka <moshez@zadka.site.co.il>
+ 
+diff -r 70274d53c1dd Doc/library/functions.rst
+--- a/Doc/library/functions.rst
++++ b/Doc/library/functions.rst
+@@ -18,16 +18,25 @@
+ :func:`bool`         :func:`filter`     :func:`len`         :func:`range`      :func:`type`
+ :func:`bytearray`    :func:`float`      :func:`list`        :func:`raw_input`  :func:`unichr`
+ :func:`callable`     :func:`format`     :func:`locals`      :func:`reduce`     :func:`unicode`
+-:func:`chr`          :func:`frozenset`  :func:`long`        :func:`reload`     :func:`vars`
++:func:`chr`          |func-frozenset|_  :func:`long`        :func:`reload`     :func:`vars`
+ :func:`classmethod`  :func:`getattr`    :func:`map`         :func:`repr`       :func:`xrange`
+ :func:`cmp`          :func:`globals`    :func:`max`         :func:`reversed`   :func:`zip`
+-:func:`compile`      :func:`hasattr`    :func:`memoryview`  :func:`round`      :func:`__import__`
+-:func:`complex`      :func:`hash`       :func:`min`         :func:`set`        :func:`apply`
++:func:`compile`      :func:`hasattr`    |func-memoryview|_  :func:`round`      :func:`__import__`
++:func:`complex`      :func:`hash`       :func:`min`         |func-set|_        :func:`apply`
+ :func:`delattr`      :func:`help`       :func:`next`        :func:`setattr`    :func:`buffer`
+-:func:`dict`         :func:`hex`        :func:`object`      :func:`slice`      :func:`coerce`
++|func-dict|_         :func:`hex`        :func:`object`      :func:`slice`      :func:`coerce`
+ :func:`dir`          :func:`id`         :func:`oct`         :func:`sorted`     :func:`intern`
+ ===================  =================  ==================  =================  ====================
+ 
++.. using :func:`dict` would create a link to another page, so local targets are
++   used, with replacement texts to make the output in the table consistent
++
++.. |func-dict| replace:: ``dict()``
++.. |func-frozenset| replace:: ``frozenset()``
++.. |func-memoryview| replace:: ``memoryview()``
++.. |func-set| replace:: ``set()``
++
++
+ .. function:: abs(x)
+ 
+    Return the absolute value of a number.  The argument may be a plain or long
+@@ -247,6 +256,13 @@
+    the function serves as a numeric conversion function like :func:`int`,
+    :func:`long` and :func:`float`.  If both arguments are omitted, returns ``0j``.
+ 
++   .. note::
++
++      When converting from a string, the string must not contain whitespace
++      around the central ``+`` or ``-`` operator.  For example,
++      ``complex('1+2j')`` is fine, but ``complex('1 + 2j')`` raises
++      :exc:`ValueError`.
++
+    The complex type is described in :ref:`typesnumeric`.
+ 
+ 
+@@ -258,6 +274,7 @@
+    example, ``delattr(x, 'foobar')`` is equivalent to ``del x.foobar``.
+ 
+ 
++.. _func-dict:
+ .. function:: dict([arg])
+    :noindex:
+ 
+@@ -337,7 +354,7 @@
+       Using :func:`divmod` with complex numbers is deprecated.
+ 
+ 
+-.. function:: enumerate(sequence[, start=0])
++.. function:: enumerate(sequence, start=0)
+ 
+    Return an enumerate object. *sequence* must be a sequence, an
+    :term:`iterator`, or some other object which supports iteration.  The
+@@ -413,7 +430,10 @@
+    The arguments are a file name and two optional dictionaries.  The file is parsed
+    and evaluated as a sequence of Python statements (similarly to a module) using
+    the *globals* and *locals* dictionaries as global and local namespace. If
+-   provided, *locals* can be any mapping object.
++   provided, *locals* can be any mapping object.  Remember that at module level,
++   globals and locals are the same dictionary. If two separate objects are
++   passed as *globals* and *locals*, the code will be executed as if it were
++   embedded in a class definition.
+ 
+    .. versionchanged:: 2.4
+       formerly *locals* was required to be a dictionary.
+@@ -431,7 +451,7 @@
+       used reliably to modify a function's locals.
+ 
+ 
+-.. function:: file(filename[, mode[, bufsize]])
++.. function:: file(name[, mode[, buffering]])
+ 
+    Constructor function for the :class:`file` type, described further in section
+    :ref:`bltin-file-objects`.  The constructor's arguments are the same as those
+@@ -506,6 +526,7 @@
+    .. versionadded:: 2.6
+ 
+ 
++.. _func-frozenset:
+ .. function:: frozenset([iterable])
+    :noindex:
+ 
+@@ -745,7 +766,7 @@
+    .. versionchanged:: 2.5
+       Added support for the optional *key* argument.
+ 
+-
++.. _func-memoryview:
+ .. function:: memoryview(obj)
+    :noindex:
+ 
+@@ -894,7 +915,7 @@
+    accidents.)
+ 
+ 
+-.. function:: print([object, ...][, sep=' '][, end='\\n'][, file=sys.stdout])
++.. function:: print([object, ...], sep=' ', end='\\n', file=sys.stdout)
+ 
+    Print *object*\(s) to the stream *file*, separated by *sep* and followed by
+    *end*.  *sep*, *end* and *file*, if present, must be given as keyword
+@@ -1174,6 +1195,8 @@
+       can't be represented exactly as a float.  See :ref:`tut-fp-issues` for
+       more information.
+ 
++
++.. _func-set:
+ .. function:: set([iterable])
+    :noindex:
+ 
+@@ -1535,7 +1558,7 @@
+    .. note::
+ 
+       This is an advanced function that is not needed in everyday Python
+-      programming.
++      programming, unlike :func:`importlib.import_module`.
+ 
+    This function is invoked by the :keyword:`import` statement.  It can be
+    replaced (by importing the :mod:`__builtin__` module and assigning to
+@@ -1586,15 +1609,8 @@
+    names.
+ 
+    If you simply want to import a module (potentially within a package) by name,
+-   you can call :func:`__import__` and then look it up in :data:`sys.modules`::
++   use :func:`importlib.import_module`.
+ 
+-      >>> import sys
+-      >>> name = 'foo.bar.baz'
+-      >>> __import__(name)
+-      <module 'foo' from ...>
+-      >>> baz = sys.modules[name]
+-      >>> baz
+-      <module 'foo.bar.baz' from ...>
+ 
+    .. versionchanged:: 2.5
+       The level parameter was added.
+diff -r 70274d53c1dd Doc/library/gdbm.rst
+--- a/Doc/library/gdbm.rst
++++ b/Doc/library/gdbm.rst
+@@ -6,9 +6,9 @@
+    :synopsis: GNU's reinterpretation of dbm.
+ 
+ .. note::
+-   The :mod:`gdbm` module has been renamed to :mod:`dbm.gnu` in Python 3.0.  The
++   The :mod:`gdbm` module has been renamed to :mod:`dbm.gnu` in Python 3.  The
+    :term:`2to3` tool will automatically adapt imports when converting your
+-   sources to 3.0.
++   sources to Python 3.
+ 
+ 
+ .. index:: module: dbm
+diff -r 70274d53c1dd Doc/library/gl.rst
+--- a/Doc/library/gl.rst
++++ b/Doc/library/gl.rst
+@@ -8,7 +8,7 @@
+ 
+ 
+ .. deprecated:: 2.6
+-    The :mod:`gl` module has been deprecated for removal in Python 3.0.
++    The :mod:`gl` module has been removed in Python 3.
+ 
+ 
+ This module provides access to the Silicon Graphics *Graphics Library*. It is
+@@ -168,7 +168,7 @@
+ 
+ 
+ .. deprecated:: 2.6
+-    The :mod:`DEVICE` module has been deprecated for removal in Python 3.0.
++    The :mod:`DEVICE` module has been removed in Python 3.
+ 
+ 
+ This modules defines the constants used by the Silicon Graphics *Graphics
+@@ -186,7 +186,7 @@
+ 
+ 
+ .. deprecated:: 2.6
+-    The :mod:`GL` module has been deprecated for removal in Python 3.0.
++    The :mod:`GL` module has been removed in Python 3.
+ 
+ This module contains constants used by the Silicon Graphics *Graphics Library*
+ from the C header file ``<gl/gl.h>``. Read the module source file for details.
+diff -r 70274d53c1dd Doc/library/gzip.rst
+--- a/Doc/library/gzip.rst
++++ b/Doc/library/gzip.rst
+@@ -22,9 +22,6 @@
+ :program:`gzip` and :program:`gunzip` programs, such  as those produced by
+ :program:`compress` and :program:`pack`, are not supported by this module.
+ 
+-For other archive formats, see the :mod:`bz2`, :mod:`zipfile`, and
+-:mod:`tarfile` modules.
+-
+ The module defines the following items:
+ 
+ 
+diff -r 70274d53c1dd Doc/library/htmllib.rst
+--- a/Doc/library/htmllib.rst
++++ b/Doc/library/htmllib.rst
+@@ -6,7 +6,7 @@
+    :deprecated:
+ 
+ .. deprecated:: 2.6
+-    The :mod:`htmllib` module has been removed in Python 3.0.
++    The :mod:`htmllib` module has been removed in Python 3.
+ 
+ 
+ .. index::
+@@ -162,8 +162,8 @@
+ .. note::
+ 
+    The :mod:`htmlentitydefs` module has been renamed to :mod:`html.entities` in
+-   Python 3.0.  The :term:`2to3` tool will automatically adapt imports when
+-   converting your sources to 3.0.
++   Python 3.  The :term:`2to3` tool will automatically adapt imports when
++   converting your sources to Python 3.
+ 
+ **Source code:** :source:`Lib/htmlentitydefs.py`
+ 
+diff -r 70274d53c1dd Doc/library/httplib.rst
+--- a/Doc/library/httplib.rst
++++ b/Doc/library/httplib.rst
+@@ -6,8 +6,8 @@
+ 
+ .. note::
+    The :mod:`httplib` module has been renamed to :mod:`http.client` in Python
+-   3.0.  The :term:`2to3` tool will automatically adapt imports when converting
+-   your sources to 3.0.
++   3.  The :term:`2to3` tool will automatically adapt imports when converting
++   your sources to Python 3.
+ 
+ 
+ .. index::
+@@ -89,7 +89,7 @@
+       *source_address* was added.
+ 
+ 
+-.. class:: HTTPResponse(sock[, debuglevel=0][, strict=0])
++.. class:: HTTPResponse(sock, debuglevel=0, strict=0)
+ 
+    Class whose instances are returned upon successful connection.  Not instantiated
+    directly by user.
+diff -r 70274d53c1dd Doc/library/imageop.rst
+--- a/Doc/library/imageop.rst
++++ b/Doc/library/imageop.rst
+@@ -7,7 +7,7 @@
+    :deprecated:
+ 
+ .. deprecated:: 2.6
+-    The :mod:`imageop` module has been removed in Python 3.0.
++    The :mod:`imageop` module has been removed in Python 3.
+ 
+ The :mod:`imageop` module contains some useful operations on images. It operates
+ on images consisting of 8 or 32 bit pixels stored in Python strings.  This is
+diff -r 70274d53c1dd Doc/library/imgfile.rst
+--- a/Doc/library/imgfile.rst
++++ b/Doc/library/imgfile.rst
+@@ -8,7 +8,7 @@
+    :deprecated:
+ 
+ .. deprecated:: 2.6
+-   The :mod:`imgfile` module has been deprecated for removal in Python 3.0.
++   The :mod:`imgfile` module has been removed in Python 3.
+ 
+ 
+ 
+diff -r 70274d53c1dd Doc/library/imp.rst
+--- a/Doc/library/imp.rst
++++ b/Doc/library/imp.rst
+@@ -65,7 +65,7 @@
+    path and the last item in the *description* tuple is :const:`PKG_DIRECTORY`.
+ 
+    This function does not handle hierarchical module names (names containing
+-   dots).  In order to find *P*.*M*, that is, submodule *M* of package *P*, use
++   dots).  In order to find *P.M*, that is, submodule *M* of package *P*, use
+    :func:`find_module` and :func:`load_module` to find and load package *P*, and
+    then use :func:`find_module` with the *path* argument set to ``P.__path__``.
+    When *P* itself has a dotted name, apply this recipe recursively.
+diff -r 70274d53c1dd Doc/library/imputil.rst
+--- a/Doc/library/imputil.rst
++++ b/Doc/library/imputil.rst
+@@ -7,7 +7,7 @@
+    :deprecated:
+ 
+ .. deprecated:: 2.6
+-   The :mod:`imputil` module has been removed in Python 3.0.
++   The :mod:`imputil` module has been removed in Python 3.
+ 
+ 
+ .. index:: statement: import
+diff -r 70274d53c1dd Doc/library/io.rst
+--- a/Doc/library/io.rst
++++ b/Doc/library/io.rst
+@@ -696,11 +696,13 @@
+       Read and return at most *n* characters from the stream as a single
+       :class:`unicode`.  If *n* is negative or ``None``, reads until EOF.
+ 
+-   .. method:: readline()
++   .. method:: readline(limit=-1)
+ 
+       Read until newline or EOF and return a single ``unicode``.  If the
+       stream is already at EOF, an empty string is returned.
+ 
++      If *limit* is specified, at most *limit* characters will be read.
++
+    .. method:: seek(offset, whence=SEEK_SET)
+ 
+       Change the stream position to the given *offset*.  Behaviour depends
+@@ -752,14 +754,22 @@
+    sequences) can be used.  Any other error handling name that has been
+    registered with :func:`codecs.register_error` is also valid.
+ 
+-   *newline* can be ``None``, ``''``, ``'\n'``, ``'\r'``, or ``'\r\n'``.  It
+-   controls the handling of line endings.  If it is ``None``, universal newlines
+-   is enabled.  With this enabled, on input, the lines endings ``'\n'``,
+-   ``'\r'``, or ``'\r\n'`` are translated to ``'\n'`` before being returned to
+-   the caller.  Conversely, on output, ``'\n'`` is translated to the system
+-   default line separator, :data:`os.linesep`.  If *newline* is any other of its
+-   legal values, that newline becomes the newline when the file is read and it
+-   is returned untranslated.  On output, ``'\n'`` is converted to the *newline*.
++   *newline* controls how line endings are handled.  It can be ``None``,
++   ``''``, ``'\n'``, ``'\r'``, and ``'\r\n'``.  It works as follows:
++
++   * On input, if *newline* is ``None``, universal newlines mode is enabled.
++     Lines in the input can end in ``'\n'``, ``'\r'``, or ``'\r\n'``, and these
++     are translated into ``'\n'`` before being returned to the caller.  If it is
++     ``''``, universal newline mode is enabled, but line endings are returned to
++     the caller untranslated.  If it has any of the other legal values, input
++     lines are only terminated by the given string, and the line ending is
++     returned to the caller untranslated.
++
++   * On output, if *newline* is ``None``, any ``'\n'`` characters written are
++     translated to the system default line separator, :data:`os.linesep`.  If
++     *newline* is ``''``, no translation takes place.  If *newline* is any of
++     the other legal values, any ``'\n'`` characters written are translated to
++     the given string.
+ 
+    If *line_buffering* is ``True``, :meth:`flush` is implied when a call to
+    write contains a newline character.
+diff -r 70274d53c1dd Doc/library/itertools.rst
+--- a/Doc/library/itertools.rst
++++ b/Doc/library/itertools.rst
+@@ -733,7 +733,8 @@
+        return izip(a, b)
+ 
+    def grouper(n, iterable, fillvalue=None):
+-       "grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx"
++       "Collect data into fixed-length chunks or blocks"
++       # grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx
+        args = [iter(iterable)] * n
+        return izip_longest(fillvalue=fillvalue, *args)
+ 
+diff -r 70274d53c1dd Doc/library/jpeg.rst
+--- a/Doc/library/jpeg.rst
++++ b/Doc/library/jpeg.rst
+@@ -8,7 +8,7 @@
+    :deprecated:
+ 
+ .. deprecated:: 2.6
+-   The :mod:`jpeg` module has been deprecated for removal in Python 3.0.
++   The :mod:`jpeg` module has been removed in Python 3.
+ 
+ 
+ 
+diff -r 70274d53c1dd Doc/library/json.rst
+--- a/Doc/library/json.rst
++++ b/Doc/library/json.rst
+@@ -99,8 +99,8 @@
+     {
+         "json": "obj"
+     }
+-    $ echo '{ 1.2:3.4}' | python -mjson.tool
+-    Expecting property name: line 1 column 2 (char 2)
++    $ echo '{1.2:3.4}' | python -mjson.tool
++    Expecting property name enclosed in double quotes: line 1 column 1 (char 1)
+ 
+ .. highlight:: python
+ 
+@@ -170,6 +170,14 @@
+    :class:`unicode` instance.  The other arguments have the same meaning as in
+    :func:`dump`.
+ 
++   .. note::
++
++      Keys in key/value pairs of JSON are always of the type :class:`str`. When
++      a dictionary is converted into JSON, all the keys of the dictionary are
++      coerced to strings. As a result of this, if a dictionary is convered
++      into JSON and then back into a dictionary, the dictionary may not equal
++      the original one. That is, ``loads(dumps(x)) != x`` if x has non-string
++      keys.
+ 
+ .. function:: load(fp[, encoding[, cls[, object_hook[, parse_float[, parse_int[, parse_constant[, object_pairs_hook[, **kw]]]]]]]])
+ 
+@@ -209,10 +217,13 @@
+    (e.g. :class:`float`).
+ 
+    *parse_constant*, if specified, will be called with one of the following
+-   strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``, ``'null'``, ``'true'``,
+-   ``'false'``.  This can be used to raise an exception if invalid JSON numbers
++   strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``.
++   This can be used to raise an exception if invalid JSON numbers
+    are encountered.
+ 
++   .. versionchanged:: 2.7
++      *parse_constant* doesn't get called on 'null', 'true', 'false' anymore.
++
+    To use a custom :class:`JSONDecoder` subclass, specify it with the ``cls``
+    kwarg; otherwise :class:`JSONDecoder` is used.  Additional keyword arguments
+    will be passed to the constructor of the class.
+diff -r 70274d53c1dd Doc/library/locale.rst
+--- a/Doc/library/locale.rst
++++ b/Doc/library/locale.rst
+@@ -164,22 +164,22 @@
+ 
+    .. data:: D_T_FMT
+ 
+-      Get a string that can be used as a format string for :func:`strftime` to
++      Get a string that can be used as a format string for :func:`time.strftime` to
+       represent date and time in a locale-specific way.
+ 
+    .. data:: D_FMT
+ 
+-      Get a string that can be used as a format string for :func:`strftime` to
++      Get a string that can be used as a format string for :func:`time.strftime` to
+       represent a date in a locale-specific way.
+ 
+    .. data:: T_FMT
+ 
+-      Get a string that can be used as a format string for :func:`strftime` to
++      Get a string that can be used as a format string for :func:`time.strftime` to
+       represent a time in a locale-specific way.
+ 
+    .. data:: T_FMT_AMPM
+ 
+-      Get a format string for :func:`strftime` to represent time in the am/pm
++      Get a format string for :func:`time.strftime` to represent time in the am/pm
+       format.
+ 
+    .. data:: DAY_1 ... DAY_7
+@@ -243,24 +243,24 @@
+       then-emperor's reign.
+ 
+       Normally it should not be necessary to use this value directly. Specifying
+-      the ``E`` modifier in their format strings causes the :func:`strftime`
++      the ``E`` modifier in their format strings causes the :func:`time.strftime`
+       function to use this information.  The format of the returned string is not
+       specified, and therefore you should not assume knowledge of it on different
+       systems.
+ 
+    .. data:: ERA_D_T_FMT
+ 
+-      Get a format string for :func:`strftime` to represent date and time in a
++      Get a format string for :func:`time.strftime` to represent date and time in a
+       locale-specific era-based way.
+ 
+    .. data:: ERA_D_FMT
+ 
+-      Get a format string for :func:`strftime` to represent a date in a
++      Get a format string for :func:`time.strftime` to represent a date in a
+       locale-specific era-based way.
+ 
+    .. data:: ERA_T_FMT
+ 
+-      Get a format string for :func:`strftime` to represent a time in a
++      Get a format string for :func:`time.strftime` to represent a time in a
+       locale-specific era-based way.
+ 
+    .. data:: ALT_DIGITS
+diff -r 70274d53c1dd Doc/library/logging.config.rst
+--- a/Doc/library/logging.config.rst
++++ b/Doc/library/logging.config.rst
+@@ -112,6 +112,19 @@
+    send it to the socket as a string of bytes preceded by a four-byte length
+    string packed in binary using ``struct.pack('>L', n)``.
+ 
++   .. note:: Because portions of the configuration are passed through
++      :func:`eval`, use of this function may open its users to a security risk.
++      While the function only binds to a socket on ``localhost``, and so does
++      not accept connections from remote machines, there are scenarios where
++      untrusted code could be run under the account of the process which calls
++      :func:`listen`. Specifically, if the process calling :func:`listen` runs
++      on a multi-user machine where users cannot trust each other, then a
++      malicious user could arrange to run essentially arbitrary code in a
++      victim user's process, simply by connecting to the victim's
++      :func:`listen` socket and sending a configuration which runs whatever
++      code the attacker wants to have executed in the victim's process. This is
++      especially easy to do if the default port is used, but not hard even if a
++      different port is used).
+ 
+ .. function:: stopListening()
+ 
+@@ -701,6 +714,12 @@
+ :class:`Formatter` subclass.  Subclasses of :class:`Formatter` can present
+ exception tracebacks in an expanded or condensed format.
+ 
++.. note:: Due to the use of :func:`eval` as described above, there are
++   potential security risks which result from using the :func:`listen` to send
++   and receive configurations via sockets. The risks are limited to where
++   multiple users with no mutual trust run code on the same machine; see the
++   :func:`listen` documentation for more information.
++
+ .. seealso::
+ 
+    Module :mod:`logging`
+diff -r 70274d53c1dd Doc/library/logging.handlers.rst
+--- a/Doc/library/logging.handlers.rst
++++ b/Doc/library/logging.handlers.rst
+@@ -650,7 +650,7 @@
+ :class:`BufferingHandler`, which is an abstract class. This buffers logging
+ records in memory. Whenever each record is added to the buffer, a check is made
+ by calling :meth:`shouldFlush` to see if the buffer should be flushed.  If it
+-should, then :meth:`flush` is expected to do the needful.
++should, then :meth:`flush` is expected to do the flushing.
+ 
+ 
+ .. class:: BufferingHandler(capacity)
+diff -r 70274d53c1dd Doc/library/logging.rst
+--- a/Doc/library/logging.rst
++++ b/Doc/library/logging.rst
+@@ -51,9 +51,21 @@
+ Logger Objects
+ --------------
+ 
+-Loggers have the following attributes and methods. Note that Loggers are never
++Loggers have the following attributes and methods.  Note that Loggers are never
+ instantiated directly, but always through the module-level function
+-``logging.getLogger(name)``.
++``logging.getLogger(name)``.  Multiple calls to :func:`getLogger` with the same
++name will always return a reference to the same Logger object.
++
++The ``name`` is potentially a period-separated hierarchical value, like
++``foo.bar.baz`` (though it could also be just plain ``foo``, for example).
++Loggers that are further down in the hierarchical list are children of loggers
++higher up in the list.  For example, given a logger with a name of ``foo``,
++loggers with names of ``foo.bar``, ``foo.bar.baz``, and ``foo.bam`` are all
++descendants of ``foo``.  The logger name hierarchy is analogous to the Python
++package hierarchy, and identical to it if you organise your loggers on a
++per-module basis using the recommended construction
++``logging.getLogger(__name__)``.  That's because in a module, ``__name__``
++is the module's name in the Python package namespace.
+ 
+ .. class:: Logger
+ 
+@@ -138,7 +150,7 @@
+ 
+       FORMAT = '%(asctime)-15s %(clientip)s %(user)-8s %(message)s'
+       logging.basicConfig(format=FORMAT)
+-      d = { 'clientip' : '192.168.0.1', 'user' : 'fbloggs' }
++      d = {'clientip': '192.168.0.1', 'user': 'fbloggs'}
+       logger = logging.getLogger('tcpserver')
+       logger.warning('Protocol problem: %s', 'connection reset', extra=d)
+ 
+@@ -617,6 +629,9 @@
+ .. versionchanged:: 2.5
+    *funcName* was added.
+ 
++.. versionchanged:: 2.6
++   *processName* was added.
++
+ .. _logger-adapter:
+ 
+ LoggerAdapter Objects
+@@ -802,7 +817,8 @@
+    effect is to disable all logging calls of severity *lvl* and below, so that
+    if you call it with a value of INFO, then all INFO and DEBUG events would be
+    discarded, whereas those of severity WARNING and above would be processed
+-   according to the logger's effective level.
++   according to the logger's effective level. To undo the effect of a call to
++   ``logging.disable(lvl)``, call ``logging.disable(logging.NOTSET)``.
+ 
+ 
+ .. function:: addLevelName(lvl, levelName)
+@@ -915,12 +931,11 @@
+    If *capture* is ``True``, warnings issued by the :mod:`warnings` module will
+    be redirected to the logging system. Specifically, a warning will be
+    formatted using :func:`warnings.formatwarning` and the resulting string
+-   logged to a logger named 'py.warnings' with a severity of `WARNING`.
++   logged to a logger named ``'py.warnings'`` with a severity of :const:`WARNING`.
+ 
+    If *capture* is ``False``, the redirection of warnings to the logging system
+    will stop, and warnings will be redirected to their original destinations
+-   (i.e. those in effect before `captureWarnings(True)` was called).
+-
++   (i.e. those in effect before ``captureWarnings(True)`` was called).
+ 
+ 
+ .. seealso::
+diff -r 70274d53c1dd Doc/library/macostools.rst
+--- a/Doc/library/macostools.rst
++++ b/Doc/library/macostools.rst
+@@ -15,7 +15,7 @@
+ 
+ .. note::
+ 
+-   This module has been removed in Python 3.0.
++   This module has been removed in Python 3.
+ 
+ 
+ 
+diff -r 70274d53c1dd Doc/library/mailbox.rst
+--- a/Doc/library/mailbox.rst
++++ b/Doc/library/mailbox.rst
+@@ -154,7 +154,7 @@
+       when the :class:`Mailbox` instance was initialized.
+ 
+ 
+-   .. method:: get(key[, default=None])
++   .. method:: get(key, default=None)
+                __getitem__(key)
+ 
+       Return a representation of the message corresponding to *key*. If no such
+@@ -278,7 +278,7 @@
+ ^^^^^^^^^^^^^^^^
+ 
+ 
+-.. class:: Maildir(dirname[, factory=rfc822.Message[, create=True]])
++.. class:: Maildir(dirname, factory=rfc822.Message, create=True)
+ 
+    A subclass of :class:`Mailbox` for mailboxes in Maildir format. Parameter
+    *factory* is a callable object that accepts a file-like message representation
+@@ -423,7 +423,7 @@
+ ^^^^^^^^^^^^^
+ 
+ 
+-.. class:: mbox(path[, factory=None[, create=True]])
++.. class:: mbox(path, factory=None, create=True)
+ 
+    A subclass of :class:`Mailbox` for mailboxes in mbox format. Parameter *factory*
+    is a callable object that accepts a file-like message representation (which
+@@ -483,7 +483,7 @@
+ ^^^^^^^^^^^
+ 
+ 
+-.. class:: MH(path[, factory=None[, create=True]])
++.. class:: MH(path, factory=None, create=True)
+ 
+    A subclass of :class:`Mailbox` for mailboxes in MH format. Parameter *factory*
+    is a callable object that accepts a file-like message representation (which
+@@ -613,7 +613,7 @@
+ ^^^^^^^^^^^^^^
+ 
+ 
+-.. class:: Babyl(path[, factory=None[, create=True]])
++.. class:: Babyl(path, factory=None, create=True)
+ 
+    A subclass of :class:`Mailbox` for mailboxes in Babyl format. Parameter
+    *factory* is a callable object that accepts a file-like message representation
+@@ -689,7 +689,7 @@
+ ^^^^^^^^^^^^^
+ 
+ 
+-.. class:: MMDF(path[, factory=None[, create=True]])
++.. class:: MMDF(path, factory=None, create=True)
+ 
+    A subclass of :class:`Mailbox` for mailboxes in MMDF format. Parameter *factory*
+    is a callable object that accepts a file-like message representation (which
+@@ -987,7 +987,7 @@
+       are excluded.
+ 
+ 
+-   .. method:: set_from(from_[, time_=None])
++   .. method:: set_from(from_, time_=None)
+ 
+       Set the "From " line to *from_*, which should be specified without a
+       leading "From " or trailing newline. For convenience, *time_* may be
+@@ -1358,7 +1358,7 @@
+       are excluded.
+ 
+ 
+-   .. method:: set_from(from_[, time_=None])
++   .. method:: set_from(from_, time_=None)
+ 
+       Set the "From " line to *from_*, which should be specified without a
+       leading "From " or trailing newline. For convenience, *time_* may be
+@@ -1513,7 +1513,7 @@
+ mailboxes, such as adding or removing message, and do not provide classes to
+ represent format-specific message properties. For backward compatibility, the
+ older mailbox classes are still available, but the newer classes should be used
+-in preference to them.  The old classes will be removed in Python 3.0.
++in preference to them.  The old classes have been removed in Python 3.
+ 
+ Older mailbox objects support only iteration and provide a single public method:
+ 
+diff -r 70274d53c1dd Doc/library/markup.rst
+--- a/Doc/library/markup.rst
++++ b/Doc/library/markup.rst
+@@ -1,4 +1,3 @@
+-
+ .. _markup:
+ 
+ **********************************
+@@ -26,7 +25,7 @@
+    htmlparser.rst
+    sgmllib.rst
+    htmllib.rst
+-   pyexpat.rst
++   xml.etree.elementtree.rst
+    xml.dom.rst
+    xml.dom.minidom.rst
+    xml.dom.pulldom.rst
+@@ -34,4 +33,4 @@
+    xml.sax.handler.rst
+    xml.sax.utils.rst
+    xml.sax.reader.rst
+-   xml.etree.elementtree.rst
++   pyexpat.rst
+diff -r 70274d53c1dd Doc/library/mhlib.rst
+--- a/Doc/library/mhlib.rst
++++ b/Doc/library/mhlib.rst
+@@ -6,7 +6,7 @@
+    :deprecated:
+ 
+ .. deprecated:: 2.6
+-    The :mod:`mhlib` module has been removed in Python 3.0. Use the
++    The :mod:`mhlib` module has been removed in Python 3. Use the
+     :mod:`mailbox` instead.
+ 
+ .. sectionauthor:: Skip Montanaro <skip@pobox.com>
+diff -r 70274d53c1dd Doc/library/multiprocessing.rst
+--- a/Doc/library/multiprocessing.rst
++++ b/Doc/library/multiprocessing.rst
+@@ -81,7 +81,8 @@
+     def info(title):
+         print title
+         print 'module name:', __name__
+-        print 'parent process:', os.getppid()
++        if hasattr(os, 'getppid'):  # only available on Unix
++            print 'parent process:', os.getppid()
+         print 'process id:', os.getpid()
+ 
+     def f(name):
+@@ -107,7 +108,7 @@
+ 
+ **Queues**
+ 
+-   The :class:`Queue` class is a near clone of :class:`Queue.Queue`.  For
++   The :class:`~multiprocessing.Queue` class is a near clone of :class:`Queue.Queue`.  For
+    example::
+ 
+       from multiprocessing import Process, Queue
+@@ -231,7 +232,7 @@
+    A manager returned by :func:`Manager` will support types :class:`list`,
+    :class:`dict`, :class:`Namespace`, :class:`Lock`, :class:`RLock`,
+    :class:`Semaphore`, :class:`BoundedSemaphore`, :class:`Condition`,
+-   :class:`Event`, :class:`Queue`, :class:`Value` and :class:`Array`.  For
++   :class:`Event`, :class:`~multiprocessing.Queue`, :class:`Value` and :class:`Array`.  For
+    example, ::
+ 
+       from multiprocessing import Process, Manager
+@@ -464,9 +465,9 @@
+ For passing messages one can use :func:`Pipe` (for a connection between two
+ processes) or a queue (which allows multiple producers and consumers).
+ 
+-The :class:`Queue`, :class:`multiprocessing.queues.SimpleQueue` and :class:`JoinableQueue` types are multi-producer,
++The :class:`~multiprocessing.Queue`, :class:`multiprocessing.queues.SimpleQueue` and :class:`JoinableQueue` types are multi-producer,
+ multi-consumer FIFO queues modelled on the :class:`Queue.Queue` class in the
+-standard library.  They differ in that :class:`Queue` lacks the
++standard library.  They differ in that :class:`~multiprocessing.Queue` lacks the
+ :meth:`~Queue.Queue.task_done` and :meth:`~Queue.Queue.join` methods introduced
+ into Python 2.5's :class:`Queue.Queue` class.
+ 
+@@ -489,7 +490,7 @@
+ .. warning::
+ 
+    If a process is killed using :meth:`Process.terminate` or :func:`os.kill`
+-   while it is trying to use a :class:`Queue`, then the data in the queue is
++   while it is trying to use a :class:`~multiprocessing.Queue`, then the data in the queue is
+    likely to become corrupted.  This may cause any other process to get an
+    exception when it tries to use the queue later on.
+ 
+@@ -531,7 +532,7 @@
+    The usual :exc:`Queue.Empty` and :exc:`Queue.Full` exceptions from the
+    standard library's :mod:`Queue` module are raised to signal timeouts.
+ 
+-   :class:`Queue` implements all the methods of :class:`Queue.Queue` except for
++   :class:`~multiprocessing.Queue` implements all the methods of :class:`Queue.Queue` except for
+    :meth:`~Queue.Queue.task_done` and :meth:`~Queue.Queue.join`.
+ 
+    .. method:: qsize()
+@@ -582,7 +583,7 @@
+ 
+       Equivalent to ``get(False)``.
+ 
+-   :class:`multiprocessing.Queue` has a few additional methods not found in
++   :class:`~multiprocessing.Queue` has a few additional methods not found in
+    :class:`Queue.Queue`.  These methods are usually unnecessary for most
+    code:
+ 
+@@ -612,7 +613,7 @@
+ 
+ .. class:: multiprocessing.queues.SimpleQueue()
+ 
+-   It is a simplified :class:`Queue` type, very close to a locked :class:`Pipe`.
++   It is a simplified :class:`~multiprocessing.Queue` type, very close to a locked :class:`Pipe`.
+ 
+    .. method:: empty()
+ 
+@@ -629,7 +630,7 @@
+ 
+ .. class:: JoinableQueue([maxsize])
+ 
+-   :class:`JoinableQueue`, a :class:`Queue` subclass, is a queue which
++   :class:`JoinableQueue`, a :class:`~multiprocessing.Queue` subclass, is a queue which
+    additionally has :meth:`task_done` and :meth:`join` methods.
+ 
+    .. method:: task_done()
+@@ -2084,7 +2085,7 @@
+     Bear in mind that a process that has put items in a queue will wait before
+     terminating until all the buffered items are fed by the "feeder" thread to
+     the underlying pipe.  (The child process can call the
+-    :meth:`Queue.cancel_join_thread` method of the queue to avoid this behaviour.)
++    :meth:`~multiprocessing.Queue.cancel_join_thread` method of the queue to avoid this behaviour.)
+ 
+     This means that whenever you use a queue you need to make sure that all
+     items which have been put on the queue will eventually be removed before the
+diff -r 70274d53c1dd Doc/library/mutex.rst
+--- a/Doc/library/mutex.rst
++++ b/Doc/library/mutex.rst
+@@ -7,7 +7,7 @@
+    :deprecated:
+ 
+ .. deprecated:: 2.6
+-   The :mod:`mutex` module has been removed in Python 3.0.
++   The :mod:`mutex` module has been removed in Python 3.
+ 
+ .. sectionauthor:: Moshe Zadka <moshez@zadka.site.co.il>
+ 
+diff -r 70274d53c1dd Doc/library/new.rst
+--- a/Doc/library/new.rst
++++ b/Doc/library/new.rst
+@@ -6,7 +6,7 @@
+    :deprecated:
+ 
+ .. deprecated:: 2.6
+-   The :mod:`new` module has been removed in Python 3.0.  Use the :mod:`types`
++   The :mod:`new` module has been removed in Python 3.  Use the :mod:`types`
+    module's classes instead.
+ 
+ .. sectionauthor:: Moshe Zadka <moshez@zadka.site.co.il>
+diff -r 70274d53c1dd Doc/library/os.path.rst
+--- a/Doc/library/os.path.rst
++++ b/Doc/library/os.path.rst
+@@ -331,7 +331,7 @@
+ 
+    .. note::
+ 
+-      This function is deprecated and has been removed in 3.0 in favor of
++      This function is deprecated and has been removed in Python 3 in favor of
+       :func:`os.walk`.
+ 
+ 
+diff -r 70274d53c1dd Doc/library/os.rst
+--- a/Doc/library/os.rst
++++ b/Doc/library/os.rst
+@@ -157,6 +157,20 @@
+ 
+    Availability: Unix.
+ 
++   .. note:: On Mac OS X, :func:`getgroups` behavior differs somewhat from
++      other Unix platforms. If the Python interpreter was built with a
++      deployment target of :const:`10.5` or earlier, :func:`getgroups` returns
++      the list of effective group ids associated with the current user process;
++      this list is limited to a system-defined number of entries, typically 16,
++      and may be modified by calls to :func:`setgroups` if suitably privileged.
++      If built with a deployment target greater than :const:`10.5`,
++      :func:`getgroups` returns the current group access list for the user
++      associated with the effective user id of the process; the group access
++      list may change over the lifetime of the process, it is not affected by
++      calls to :func:`setgroups`, and its length is not limited to 16.  The
++      deployment target value, :const:`MACOSX_DEPLOYMENT_TARGET`, can be
++      obtained with :func:`sysconfig.get_config_var`.
++
+ 
+ .. function:: initgroups(username, gid)
+ 
+@@ -306,6 +320,10 @@
+ 
+    .. versionadded:: 2.2
+ 
++   .. note:: On Mac OS X, the length of *groups* may not exceed the
++      system-defined maximum number of effective group ids, typically 16.
++      See the documentation for :func:`getgroups` for cases where it may not
++      return the same group list set by calling setgroups().
+ 
+ .. function:: setpgrp()
+ 
+@@ -1163,7 +1181,7 @@
+    doesn't open the FIFO --- it just creates the rendezvous point.
+ 
+ 
+-.. function:: mknod(filename[, mode=0600, device])
++.. function:: mknod(filename[, mode=0600[, device=0]])
+ 
+    Create a filesystem node (file, device special file or named pipe) named
+    *filename*. *mode* specifies both the permissions to use and the type of node to
+@@ -1565,7 +1583,7 @@
+    Availability: Unix, Windows.
+ 
+ 
+-.. function:: walk(top[, topdown=True [, onerror=None[, followlinks=False]]])
++.. function:: walk(top, topdown=True, onerror=None, followlinks=False)
+ 
+    .. index::
+       single: directory; walking
+diff -r 70274d53c1dd Doc/library/ossaudiodev.rst
+--- a/Doc/library/ossaudiodev.rst
++++ b/Doc/library/ossaudiodev.rst
+@@ -275,7 +275,7 @@
+ simple calculations.
+ 
+ 
+-.. method:: oss_audio_device.setparameters(format, nchannels, samplerate [, strict=False])
++.. method:: oss_audio_device.setparameters(format, nchannels, samplerate[, strict=False])
+ 
+    Set the key audio sampling parameters---sample format, number of channels, and
+    sampling rate---in one method call.  *format*,  *nchannels*, and *samplerate*
+diff -r 70274d53c1dd Doc/library/parser.rst
+--- a/Doc/library/parser.rst
++++ b/Doc/library/parser.rst
+@@ -34,7 +34,7 @@
+    replaced by "ast"; this is a legacy from the time when there was no other
+    AST and has nothing to do with the AST found in Python 2.5.  This is also the
+    reason for the functions' keyword arguments being called *ast*, not *st*.
+-   The "ast" functions will be removed in Python 3.0.
++   The "ast" functions have been removed in Python 3.
+ 
+ There are a few things to note about this module which are important to making
+ use of the data structures created.  This is not a tutorial on editing the parse
+@@ -200,7 +200,7 @@
+    information is omitted if the flag is false or omitted.
+ 
+ 
+-.. function:: compilest(ast[, filename='<syntax-tree>'])
++.. function:: compilest(ast, filename='<syntax-tree>')
+ 
+    .. index:: builtin: eval
+ 
+diff -r 70274d53c1dd Doc/library/pickletools.rst
+--- a/Doc/library/pickletools.rst
++++ b/Doc/library/pickletools.rst
+@@ -20,7 +20,7 @@
+ probably won't find the :mod:`pickletools` module relevant.
+ 
+ 
+-.. function:: dis(pickle[, out=None, memo=None, indentlevel=4])
++.. function:: dis(pickle, out=None, memo=None, indentlevel=4)
+ 
+    Outputs a symbolic disassembly of the pickle to the file-like object *out*,
+    defaulting to ``sys.stdout``.  *pickle* can be a string or a file-like object.
+diff -r 70274d53c1dd Doc/library/plistlib.rst
+--- a/Doc/library/plistlib.rst
++++ b/Doc/library/plistlib.rst
+@@ -74,7 +74,7 @@
+ 
+ 
+ 
+-.. function:: readPlistFromResource(path[, restype='plst'[, resid=0]])
++.. function:: readPlistFromResource(path, restype='plst', resid=0)
+ 
+     Read a plist from the resource with type *restype* from the resource fork of
+     *path*.  Availability: Mac OS X.
+@@ -84,7 +84,7 @@
+        In Python 3.x, this function has been removed.
+ 
+ 
+-.. function:: writePlistToResource(rootObject, path[, restype='plst'[, resid=0]])
++.. function:: writePlistToResource(rootObject, path, restype='plst', resid=0)
+ 
+     Write *rootObject* as a resource with type *restype* to the resource fork of
+     *path*.  Availability: Mac OS X.
+diff -r 70274d53c1dd Doc/library/profile.rst
+--- a/Doc/library/profile.rst
++++ b/Doc/library/profile.rst
+@@ -298,7 +298,7 @@
+    :synopsis: Statistics object for use with the profiler.
+ 
+ 
+-.. class:: Stats(filename[, stream=sys.stdout[, ...]])
++.. class:: Stats(filename, stream=sys.stdout[, ...])
+ 
+    This class constructor creates an instance of a "statistics object" from a
+    *filename* (or set of filenames).  :class:`Stats` objects are manipulated by
+@@ -607,13 +607,10 @@
+    best results with a custom timer, it might be necessary to hard-code it in the C
+    source of the internal :mod:`_lsprof` module.
+ 
++
+ .. rubric:: Footnotes
+ 
+-.. [#] Updated and converted to LaTeX by Guido van Rossum. Further updated by Armin
+-   Rigo to integrate the documentation for the new :mod:`cProfile` module of Python
+-   2.5.
+-
+-.. [#] Prior to Python 2.2, it was necessary to edit the profiler source code to embed
+-   the bias as a literal number.  You still can, but that method is no longer
++.. [#] Prior to Python 2.2, it was necessary to edit the profiler source code to
++   embed the bias as a literal number.  You still can, but that method is no longer
+    described, because no longer needed.
+ 
+diff -r 70274d53c1dd Doc/library/pyclbr.rst
+--- a/Doc/library/pyclbr.rst
++++ b/Doc/library/pyclbr.rst
+@@ -19,7 +19,7 @@
+ modules.
+ 
+ 
+-.. function:: readmodule(module[, path=None])
++.. function:: readmodule(module, path=None)
+ 
+    Read a module and return a dictionary mapping class names to class
+    descriptor objects.  The parameter *module* should be the name of a
+@@ -28,7 +28,7 @@
+    of ``sys.path``, which is used to locate module source code.
+ 
+ 
+-.. function:: readmodule_ex(module[, path=None])
++.. function:: readmodule_ex(module, path=None)
+ 
+    Like :func:`readmodule`, but the returned dictionary, in addition to
+    mapping class names to class descriptor objects, also maps top-level
+diff -r 70274d53c1dd Doc/library/queue.rst
+--- a/Doc/library/queue.rst
++++ b/Doc/library/queue.rst
+@@ -5,9 +5,9 @@
+    :synopsis: A synchronized queue class.
+ 
+ .. note::
+-   The :mod:`Queue` module has been renamed to :mod:`queue` in Python 3.0.  The
++   The :mod:`Queue` module has been renamed to :mod:`queue` in Python 3.  The
+    :term:`2to3` tool will automatically adapt imports when converting your
+-   sources to 3.0.
++   sources to Python 3.
+ 
+ **Source code:** :source:`Lib/Queue.py`
+ 
+@@ -20,8 +20,8 @@
+ availability of thread support in Python; see the :mod:`threading`
+ module.
+ 
+-Implements three types of queue whose only difference is the order that
+-the entries are retrieved.  In a FIFO queue, the first tasks added are
++The module implements three types of queue, which differ only in the order in
++which the entries are retrieved.  In a FIFO queue, the first tasks added are
+ the first retrieved. In a LIFO queue, the most recently added entry is
+ the first retrieved (operating like a stack).  With a priority queue,
+ the entries are kept sorted (using the :mod:`heapq` module) and the
+diff -r 70274d53c1dd Doc/library/random.rst
+--- a/Doc/library/random.rst
++++ b/Doc/library/random.rst
+@@ -90,7 +90,7 @@
+ 
+    *state* should have been obtained from a previous call to :func:`getstate`, and
+    :func:`setstate` restores the internal state of the generator to what it was at
+-   the time :func:`setstate` was called.
++   the time :func:`getstate` was called.
+ 
+    .. versionadded:: 2.1
+ 
+diff -r 70274d53c1dd Doc/library/re.rst
+--- a/Doc/library/re.rst
++++ b/Doc/library/re.rst
+@@ -273,7 +273,7 @@
+    lookbehind will back up 3 characters and check if the contained pattern matches.
+    The contained pattern must only match strings of some fixed length, meaning that
+    ``abc`` or ``a|b`` are allowed, but ``a*`` and ``a{3,4}`` are not.  Note that
+-   patterns which start with positive lookbehind assertions will never match at the
++   patterns which start with positive lookbehind assertions will not match at the
+    beginning of the string being searched; you will most likely want to use the
+    :func:`search` function rather than the :func:`match` function:
+ 
+@@ -325,14 +325,19 @@
+    Matches the empty string, but only at the beginning or end of a word.  A word is
+    defined as a sequence of alphanumeric or underscore characters, so the end of a
+    word is indicated by whitespace or a non-alphanumeric, non-underscore character.
+-   Note that  ``\b`` is defined as the boundary between ``\w`` and ``\W``, so the
+-   precise set of characters deemed to be alphanumeric depends on the values of the
+-   ``UNICODE`` and ``LOCALE`` flags.  Inside a character range, ``\b`` represents
+-   the backspace character, for compatibility with Python's string literals.
++   Note that formally, ``\b`` is defined as the boundary between a ``\w`` and
++   a ``\W`` character (or vice versa), or between ``\w`` and the beginning/end
++   of the string, so the precise set of characters deemed to be alphanumeric
++   depends on the values of the ``UNICODE`` and ``LOCALE`` flags.
++   For example, ``r'\bfoo\b'`` matches ``'foo'``, ``'foo.'``, ``'(foo)'``,
++   ``'bar foo baz'`` but not ``'foobar'`` or ``'foo3'``.
++   Inside a character range, ``\b`` represents the backspace character, for compatibility with Python's string literals.
+ 
+ ``\B``
+    Matches the empty string, but only when it is *not* at the beginning or end of a
+-   word.  This is just the opposite of ``\b``, so is also subject to the settings
++   word.  This means that ``r'py\B'`` matches ``'python'``, ``'py3'``, ``'py2'``,
++   but not ``'py'``, ``'py.'``, or ``'py!'``.
++   ``\B`` is just the opposite of ``\b``, so is also subject to the settings
+    of ``LOCALE`` and ``UNICODE``.
+ 
+ ``\d``
+@@ -348,20 +353,20 @@
+    character  properties database.
+ 
+ ``\s``
+-   When the :const:`LOCALE` and :const:`UNICODE` flags are not specified, matches
+-   any whitespace character; this is equivalent to the set ``[ \t\n\r\f\v]``. With
+-   :const:`LOCALE`, it will match this set plus whatever characters are defined as
+-   space for the current locale. If :const:`UNICODE` is set, this will match the
+-   characters ``[ \t\n\r\f\v]`` plus whatever is classified as space in the Unicode
+-   character properties database.
++   When the :const:`UNICODE` flag is not specified, it matches any whitespace
++   character, this is equivalent to the set ``[ \t\n\r\f\v]``. The
++   :const:`LOCALE` flag has no extra effect on matching of the space.
++   If :const:`UNICODE` is set, this will match the characters ``[ \t\n\r\f\v]``
++   plus whatever is classified as space in the Unicode character properties
++   database.
+ 
+ ``\S``
+-   When the :const:`LOCALE` and :const:`UNICODE` flags are not specified, matches
+-   any non-whitespace character; this is equivalent to the set ``[^ \t\n\r\f\v]``
+-   With :const:`LOCALE`, it will match any character not in this set, and not
+-   defined as space in the current locale. If :const:`UNICODE` is set, this will
+-   match anything other than ``[ \t\n\r\f\v]`` and characters marked as space in
+-   the Unicode character properties database.
++   When the :const:`UNICODE` flags is not specified, matches any non-whitespace
++   character; this is equivalent to the set ``[^ \t\n\r\f\v]`` The
++   :const:`LOCALE` flag has no extra effect on non-whitespace match.  If
++   :const:`UNICODE` is set, then any character not marked as space in the
++   Unicode character properties database is matched.
++
+ 
+ ``\w``
+    When the :const:`LOCALE` and :const:`UNICODE` flags are not specified, matches
+@@ -376,12 +381,16 @@
+    any non-alphanumeric character; this is equivalent to the set ``[^a-zA-Z0-9_]``.
+    With :const:`LOCALE`, it will match any character not in the set ``[0-9_]``, and
+    not defined as alphanumeric for the current locale. If :const:`UNICODE` is set,
+-   this will match anything other than ``[0-9_]`` and characters marked as
+-   alphanumeric in the Unicode character properties database.
++   this will match anything other than ``[0-9_]`` plus characters classied as
++   not alphanumeric in the Unicode character properties database.
+ 
+ ``\Z``
+    Matches only at the end of the string.
+ 
++If both :const:`LOCALE` and :const:`UNICODE` flags are included for a
++particular sequence, then :const:`LOCALE` flag takes effect first followed by
++the :const:`UNICODE`.
++
+ Most of the standard escapes supported by Python string literals are also
+ accepted by the regular expression parser::
+ 
+@@ -389,37 +398,15 @@
+    \r      \t      \v      \x
+    \\
+ 
++(Note that ``\b`` is used to represent word boundaries, and means "backspace"
++only inside character classes.)
++
+ Octal escapes are included in a limited form: If the first digit is a 0, or if
+ there are three octal digits, it is considered an octal escape. Otherwise, it is
+ a group reference.  As for string literals, octal escapes are always at most
+ three digits in length.
+ 
+ 
+-.. _matching-searching:
+-
+-Matching vs Searching
+----------------------
+-
+-.. sectionauthor:: Fred L. Drake, Jr. <fdrake@acm.org>
+-
+-
+-Python offers two different primitive operations based on regular expressions:
+-**match** checks for a match only at the beginning of the string, while
+-**search** checks for a match anywhere in the string (this is what Perl does
+-by default).
+-
+-Note that match may differ from search even when using a regular expression
+-beginning with ``'^'``: ``'^'`` matches only at the start of the string, or in
+-:const:`MULTILINE` mode also immediately following a newline.  The "match"
+-operation succeeds only if the pattern matches at the start of the string
+-regardless of mode, or at the starting position given by the optional *pos*
+-argument regardless of whether a newline precedes it.
+-
+-   >>> re.match("c", "abcdef")  # No match
+-   >>> re.search("c", "abcdef") # Match
+-   <_sre.SRE_Match object at ...>
+-
+-
+ .. _contents-of-module-re:
+ 
+ Module Contents
+@@ -542,10 +529,11 @@
+    Return ``None`` if the string does not match the pattern; note that this is
+    different from a zero-length match.
+ 
+-   .. note::
++   Note that even in :const:`MULTILINE` mode, :func:`re.match` will only match
++   at the beginning of the string and not at the beginning of each line.
+ 
+-      If you want to locate a match anywhere in *string*, use :func:`search`
+-      instead.
++   If you want to locate a match anywhere in *string*, use :func:`search`
++   instead (see also :ref:`search-vs-match`).
+ 
+ 
+ .. function:: split(pattern, string, maxsplit=0, flags=0)
+@@ -741,16 +729,14 @@
+       The optional *pos* and *endpos* parameters have the same meaning as for the
+       :meth:`~RegexObject.search` method.
+ 
+-      .. note::
+-
+-         If you want to locate a match anywhere in *string*, use
+-         :meth:`~RegexObject.search` instead.
+-
+       >>> pattern = re.compile("o")
+       >>> pattern.match("dog")      # No match as "o" is not at the start of "dog".
+       >>> pattern.match("dog", 1)   # Match as "o" is the 2nd character of "dog".
+       <_sre.SRE_Match object at ...>
+ 
++      If you want to locate a match anywhere in *string*, use
++      :meth:`~RegexObject.search` instead (see also :ref:`search-vs-match`).
++
+ 
+    .. method:: RegexObject.split(string, maxsplit=0)
+ 
+@@ -783,8 +769,8 @@
+ 
+    .. attribute:: RegexObject.flags
+ 
+-      The flags argument used when the RE object was compiled, or ``0`` if no flags
+-      were provided.
++      The regex matching flags.  This is a combination of the flags given to
++      :func:`.compile` and any ``(?...)`` inline flags in the pattern.
+ 
+ 
+    .. attribute:: RegexObject.groups
+@@ -1072,13 +1058,13 @@
+ +--------------------------------+---------------------------------------------+
+ | ``%i``                         | ``[-+]?(0[xX][\dA-Fa-f]+|0[0-7]*|\d+)``     |
+ +--------------------------------+---------------------------------------------+
+-| ``%o``                         | ``0[0-7]*``                                 |
++| ``%o``                         | ``[-+]?[0-7]+``                             |
+ +--------------------------------+---------------------------------------------+
+ | ``%s``                         | ``\S+``                                     |
+ +--------------------------------+---------------------------------------------+
+ | ``%u``                         | ``\d+``                                     |
+ +--------------------------------+---------------------------------------------+
+-| ``%x``, ``%X``                 | ``0[xX][\dA-Fa-f]+``                        |
++| ``%x``, ``%X``                 | ``[-+]?(0[xX])?[\dA-Fa-f]+``                |
+ +--------------------------------+---------------------------------------------+
+ 
+ To extract the filename and numbers from a string like ::
+@@ -1094,59 +1080,39 @@
+    (\S+) - (\d+) errors, (\d+) warnings
+ 
+ 
+-Avoiding recursion
+-^^^^^^^^^^^^^^^^^^
+-
+-If you create regular expressions that require the engine to perform a lot of
+-recursion, you may encounter a :exc:`RuntimeError` exception with the message
+-``maximum recursion limit`` exceeded. For example, ::
+-
+-   >>> s = 'Begin ' + 1000*'a very long string ' + 'end'
+-   >>> re.match('Begin (\w| )*? end', s).end()
+-   Traceback (most recent call last):
+-     File "<stdin>", line 1, in ?
+-     File "/usr/local/lib/python2.5/re.py", line 132, in match
+-       return _compile(pattern, flags).match(string)
+-   RuntimeError: maximum recursion limit exceeded
+-
+-You can often restructure your regular expression to avoid recursion.
+-
+-Starting with Python 2.3, simple uses of the ``*?`` pattern are special-cased to
+-avoid recursion.  Thus, the above regular expression can avoid recursion by
+-being recast as ``Begin [a-zA-Z0-9_ ]*?end``.  As a further benefit, such
+-regular expressions will run faster than their recursive equivalents.
+-
++.. _search-vs-match:
+ 
+ search() vs. match()
+ ^^^^^^^^^^^^^^^^^^^^
+ 
+-In a nutshell, :func:`match` only attempts to match a pattern at the beginning
+-of a string where :func:`search` will match a pattern anywhere in a string.
+-For example:
++.. sectionauthor:: Fred L. Drake, Jr. <fdrake@acm.org>
+ 
+-   >>> re.match("o", "dog")  # No match as "o" is not the first letter of "dog".
+-   >>> re.search("o", "dog") # Match as search() looks everywhere in the string.
++Python offers two different primitive operations based on regular expressions:
++:func:`re.match` checks for a match only at the beginning of the string, while
++:func:`re.search` checks for a match anywhere in the string (this is what Perl
++does by default).
++
++For example::
++
++   >>> re.match("c", "abcdef")  # No match
++   >>> re.search("c", "abcdef") # Match
+    <_sre.SRE_Match object at ...>
+ 
+-.. note::
++Regular expressions beginning with ``'^'`` can be used with :func:`search` to
++restrict the match at the beginning of the string::
+ 
+-   The following applies only to regular expression objects like those created
+-   with ``re.compile("pattern")``, not the primitives ``re.match(pattern,
+-   string)`` or ``re.search(pattern, string)``.
++   >>> re.match("c", "abcdef")  # No match
++   >>> re.search("^c", "abcdef") # No match
++   >>> re.search("^a", "abcdef")  # Match
++   <_sre.SRE_Match object at ...>
+ 
+-:func:`match` has an optional second parameter that gives an index in the string
+-where the search is to start::
++Note however that in :const:`MULTILINE` mode :func:`match` only matches at the
++beginning of the string, whereas using :func:`search` with a regular expression
++beginning with ``'^'`` will match at the beginning of each line.
+ 
+-   >>> pattern = re.compile("o")
+-   >>> pattern.match("dog")      # No match as "o" is not at the start of "dog."
+-
+-   # Equivalent to the above expression as 0 is the default starting index:
+-   >>> pattern.match("dog", 0)
+-
+-   # Match as "o" is the 2nd character of "dog" (index 0 is the first):
+-   >>> pattern.match("dog", 1)
++   >>> re.match('X', 'A\nB\nX', re.MULTILINE)  # No match
++   >>> re.search('^X', 'A\nB\nX', re.MULTILINE)  # Match
+    <_sre.SRE_Match object at ...>
+-   >>> pattern.match("dog", 2)   # No match as "o" is not the 3rd character of "dog."
+ 
+ 
+ Making a Phonebook
+@@ -1160,7 +1126,7 @@
+ First, here is the input.  Normally it may come from a file, here we are using
+ triple-quoted string syntax:
+ 
+-   >>> input = """Ross McFluff: 834.345.1254 155 Elm Street
++   >>> text = """Ross McFluff: 834.345.1254 155 Elm Street
+    ...
+    ... Ronald Heathmore: 892.345.3428 436 Finley Avenue
+    ... Frank Burger: 925.541.7625 662 South Dogwood Way
+@@ -1174,7 +1140,7 @@
+ .. doctest::
+    :options: +NORMALIZE_WHITESPACE
+ 
+-   >>> entries = re.split("\n+", input)
++   >>> entries = re.split("\n+", text)
+    >>> entries
+    ['Ross McFluff: 834.345.1254 155 Elm Street',
+    'Ronald Heathmore: 892.345.3428 436 Finley Avenue',
+diff -r 70274d53c1dd Doc/library/repr.rst
+--- a/Doc/library/repr.rst
++++ b/Doc/library/repr.rst
+@@ -6,9 +6,9 @@
+ .. sectionauthor:: Fred L. Drake, Jr. <fdrake@acm.org>
+ 
+ .. note::
+-   The :mod:`repr` module has been renamed to :mod:`reprlib` in Python 3.0.  The
++   The :mod:`repr` module has been renamed to :mod:`reprlib` in Python 3.  The
+    :term:`2to3` tool will automatically adapt imports when converting your
+-   sources to 3.0.
++   sources to Python 3.
+ 
+ **Source code:** :source:`Lib/repr.py`
+ 
+diff -r 70274d53c1dd Doc/library/rexec.rst
+--- a/Doc/library/rexec.rst
++++ b/Doc/library/rexec.rst
+@@ -6,7 +6,7 @@
+    :deprecated:
+ 
+ .. deprecated:: 2.6
+-   The :mod:`rexec` module has been removed in Python 3.0.
++   The :mod:`rexec` module has been removed in Python 3.
+ 
+ .. versionchanged:: 2.3
+    Disabled module.
+diff -r 70274d53c1dd Doc/library/rfc822.rst
+--- a/Doc/library/rfc822.rst
++++ b/Doc/library/rfc822.rst
+@@ -10,7 +10,7 @@
+ .. deprecated:: 2.3
+    The :mod:`email` package should be used in preference to the :mod:`rfc822`
+    module.  This module is present only to maintain backward compatibility, and
+-   has been removed in 3.0.
++   has been removed in Python 3.
+ 
+ This module defines a class, :class:`Message`, which represents an "email
+ message" as defined by the Internet standard :rfc:`2822`. [#]_  Such messages
+diff -r 70274d53c1dd Doc/library/robotparser.rst
+--- a/Doc/library/robotparser.rst
++++ b/Doc/library/robotparser.rst
+@@ -16,9 +16,9 @@
+ 
+ .. note::
+    The :mod:`robotparser` module has been renamed :mod:`urllib.robotparser` in
+-   Python 3.0.
++   Python 3.
+    The :term:`2to3` tool will automatically adapt imports when converting
+-   your sources to 3.0.
++   your sources to Python 3.
+ 
+ This module provides a single class, :class:`RobotFileParser`, which answers
+ questions about whether or not a particular user agent can fetch a URL on the
+diff -r 70274d53c1dd Doc/library/scrolledtext.rst
+--- a/Doc/library/scrolledtext.rst
++++ b/Doc/library/scrolledtext.rst
+@@ -16,8 +16,8 @@
+ .. note::
+ 
+    :mod:`ScrolledText` has been renamed to :mod:`tkinter.scrolledtext` in Python
+-   3.0.  The :term:`2to3` tool will automatically adapt imports when converting
+-   your sources to 3.0.
++   3.  The :term:`2to3` tool will automatically adapt imports when converting
++   your sources to Python 3.
+ 
+ The text widget and scrollbar are packed together in a :class:`Frame`, and the
+ methods of the :class:`Grid` and :class:`Pack` geometry managers are acquired
+diff -r 70274d53c1dd Doc/library/sgmllib.rst
+--- a/Doc/library/sgmllib.rst
++++ b/Doc/library/sgmllib.rst
+@@ -6,7 +6,7 @@
+    :deprecated:
+ 
+ .. deprecated:: 2.6
+-    The :mod:`sgmllib` module has been removed in Python 3.0.
++    The :mod:`sgmllib` module has been removed in Python 3.
+ 
+ .. index:: single: SGML
+ 
+diff -r 70274d53c1dd Doc/library/shelve.rst
+--- a/Doc/library/shelve.rst
++++ b/Doc/library/shelve.rst
+@@ -18,7 +18,7 @@
+ lots of shared  sub-objects.  The keys are ordinary strings.
+ 
+ 
+-.. function:: open(filename[, flag='c'[, protocol=None[, writeback=False]]])
++.. function:: open(filename, flag='c', protocol=None, writeback=False)
+ 
+    Open a persistent dictionary.  The filename specified is the base filename for
+    the underlying database.  As a side-effect, an extension may be added to the
+@@ -100,7 +100,7 @@
+   implementation used.
+ 
+ 
+-.. class:: Shelf(dict[, protocol=None[, writeback=False]])
++.. class:: Shelf(dict, protocol=None, writeback=False)
+ 
+    A subclass of :class:`UserDict.DictMixin` which stores pickled values in the
+    *dict* object.
+@@ -118,7 +118,7 @@
+    memory and make sync and close take a long time.
+ 
+ 
+-.. class:: BsdDbShelf(dict[, protocol=None[, writeback=False]])
++.. class:: BsdDbShelf(dict, protocol=None, writeback=False)
+ 
+    A subclass of :class:`Shelf` which exposes :meth:`first`, :meth:`!next`,
+    :meth:`previous`, :meth:`last` and :meth:`set_location` which are available in
+@@ -129,7 +129,7 @@
+    the same interpretation as for the :class:`Shelf` class.
+ 
+ 
+-.. class:: DbfilenameShelf(filename[, flag='c'[, protocol=None[, writeback=False]]])
++.. class:: DbfilenameShelf(filename, flag='c', protocol=None, writeback=False)
+ 
+    A subclass of :class:`Shelf` which accepts a *filename* instead of a dict-like
+    object.  The underlying file will be opened using :func:`anydbm.open`.  By
+diff -r 70274d53c1dd Doc/library/shutil.rst
+--- a/Doc/library/shutil.rst
++++ b/Doc/library/shutil.rst
+@@ -31,6 +31,8 @@
+    are not copied.
+ 
+ 
++.. _file-operations:
++
+ Directory and files operations
+ ------------------------------
+ 
+@@ -94,7 +96,7 @@
+    .. versionadded:: 2.6
+ 
+ 
+-.. function:: copytree(src, dst[, symlinks=False[, ignore=None]])
++.. function:: copytree(src, dst, symlinks=False, ignore=None)
+ 
+    Recursively copy an entire directory tree rooted at *src*.  The destination
+    directory, named by *dst*, must not already exist; it will be created as
+@@ -185,7 +187,7 @@
+    .. versionadded:: 2.3
+ 
+ 
+-.. _shutil-example:
++.. _copytree-example:
+ 
+ copytree example
+ ::::::::::::::::
+@@ -254,8 +256,13 @@
+    copytree(source, destination, ignore=_logpath)
+ 
+ 
+-Archives operations
+--------------------
++.. _archiving-operations:
++
++Archiving operations
++--------------------
++
++High-level utilities to create and read compressed and archived files are also
++provided.  They rely on the :mod:`zipfile` and :mod:`tarfile` modules.
+ 
+ .. function:: make_archive(base_name, format, [root_dir, [base_dir, [verbose, [dry_run, [owner, [group, [logger]]]]]]])
+ 
+@@ -278,7 +285,8 @@
+    *owner* and *group* are used when creating a tar archive. By default,
+    uses the current owner and group.
+ 
+-   *logger* is an instance of :class:`logging.Logger`.
++   *logger* must be an object compatible with :pep:`282`, usually an instance of
++   :class:`logging.Logger`.
+ 
+    .. versionadded:: 2.7
+ 
+@@ -322,6 +330,8 @@
+    .. versionadded:: 2.7
+ 
+ 
++.. _archiving-example:
++
+ Archiving example
+ :::::::::::::::::
+ 
+@@ -346,5 +356,3 @@
+     -rw------- tarek/staff    1675 2008-06-09 13:26:54 ./id_rsa
+     -rw-r--r-- tarek/staff     397 2008-06-09 13:26:54 ./id_rsa.pub
+     -rw-r--r-- tarek/staff   37192 2010-02-06 18:23:10 ./known_hosts
+-
+-
+diff -r 70274d53c1dd Doc/library/simplehttpserver.rst
+--- a/Doc/library/simplehttpserver.rst
++++ b/Doc/library/simplehttpserver.rst
+@@ -8,8 +8,8 @@
+ 
+ .. note::
+    The :mod:`SimpleHTTPServer` module has been merged into :mod:`http.server` in
+-   Python 3.0.  The :term:`2to3` tool will automatically adapt imports when
+-   converting your sources to 3.0.
++   Python 3.  The :term:`2to3` tool will automatically adapt imports when
++   converting your sources to Python 3.
+ 
+ 
+ The :mod:`SimpleHTTPServer` module defines a single class,
+diff -r 70274d53c1dd Doc/library/simplexmlrpcserver.rst
+--- a/Doc/library/simplexmlrpcserver.rst
++++ b/Doc/library/simplexmlrpcserver.rst
+@@ -8,8 +8,8 @@
+ 
+ .. note::
+    The :mod:`SimpleXMLRPCServer` module has been merged into
+-   :mod:`xmlrpc.server` in Python 3.0.  The :term:`2to3` tool will automatically
+-   adapt imports when converting your sources to 3.0.
++   :mod:`xmlrpc.server` in Python 3.  The :term:`2to3` tool will automatically
++   adapt imports when converting your sources to Python 3.
+ 
+ 
+ .. versionadded:: 2.2
+diff -r 70274d53c1dd Doc/library/socket.rst
+--- a/Doc/library/socket.rst
++++ b/Doc/library/socket.rst
+@@ -38,7 +38,7 @@
+ :const:`AF_UNIX` address family. A pair ``(host, port)`` is used for the
+ :const:`AF_INET` address family, where *host* is a string representing either a
+ hostname in Internet domain notation like ``'daring.cwi.nl'`` or an IPv4 address
+-like ``'100.50.200.5'``, and *port* is an integral port number. For
++like ``'100.50.200.5'``, and *port* is an integer. For
+ :const:`AF_INET6` address family, a four-tuple ``(host, port, flowinfo,
+ scopeid)`` is used, where *flowinfo* and *scopeid* represents ``sin6_flowinfo``
+ and ``sin6_scope_id`` member in :const:`struct sockaddr_in6` in C. For
+@@ -72,17 +72,17 @@
+    tuple, and the fields depend on the address type. The general tuple form is
+    ``(addr_type, v1, v2, v3 [, scope])``, where:
+ 
+-   - *addr_type* is one of TIPC_ADDR_NAMESEQ, TIPC_ADDR_NAME, or
+-     TIPC_ADDR_ID.
+-   - *scope* is one of TIPC_ZONE_SCOPE, TIPC_CLUSTER_SCOPE, and
+-     TIPC_NODE_SCOPE.
+-   - If *addr_type* is TIPC_ADDR_NAME, then *v1* is the server type, *v2* is
++   - *addr_type* is one of :const;`TIPC_ADDR_NAMESEQ`, :const:`TIPC_ADDR_NAME`,
++     or :const:`TIPC_ADDR_ID`.
++   - *scope* is one of :const:`TIPC_ZONE_SCOPE`, :const:`TIPC_CLUSTER_SCOPE`,
++     and :const:`TIPC_NODE_SCOPE`.
++   - If *addr_type* is :const:`TIPC_ADDR_NAME`, then *v1* is the server type, *v2* is
+      the port identifier, and *v3* should be 0.
+ 
+-     If *addr_type* is TIPC_ADDR_NAMESEQ, then *v1* is the server type, *v2*
++     If *addr_type* is :const:`TIPC_ADDR_NAMESEQ`, then *v1* is the server type, *v2*
+      is the lower port number, and *v3* is the upper port number.
+ 
+-     If *addr_type* is TIPC_ADDR_ID, then *v1* is the node, *v2* is the
++     If *addr_type* is :const:`TIPC_ADDR_ID`, then *v1* is the node, *v2* is the
+      reference, and *v3* should be set to 0.
+ 
+ 
+diff -r 70274d53c1dd Doc/library/socketserver.rst
+--- a/Doc/library/socketserver.rst
++++ b/Doc/library/socketserver.rst
+@@ -7,8 +7,8 @@
+ .. note::
+ 
+    The :mod:`SocketServer` module has been renamed to :mod:`socketserver` in
+-   Python 3.0.  The :term:`2to3` tool will automatically adapt imports when
+-   converting your sources to 3.0.
++   Python 3.  The :term:`2to3` tool will automatically adapt imports when
++   converting your sources to Python 3.
+ 
+ **Source code:** :source:`Lib/SocketServer.py`
+ 
+diff -r 70274d53c1dd Doc/library/sqlite3.rst
+--- a/Doc/library/sqlite3.rst
++++ b/Doc/library/sqlite3.rst
+@@ -3,7 +3,7 @@
+ 
+ .. module:: sqlite3
+    :synopsis: A DB-API 2.0 implementation using SQLite 3.x.
+-.. sectionauthor:: Gerhard HÃƒÂ¤ring <gh@ghaering.de>
++.. sectionauthor:: Gerhard HÃ¤ring <gh@ghaering.de>
+ 
+ 
+ .. versionadded:: 2.5
+@@ -15,15 +15,15 @@
+ application using SQLite and then port the code to a larger database such as
+ PostgreSQL or Oracle.
+ 
+-sqlite3 was written by Gerhard HÃ¤ring and provides a SQL interface compliant
+-with the DB-API 2.0 specification described by :pep:`249`.
++The sqlite3 module was written by Gerhard HÃ¤ring.  It provides a SQL interface
++compliant with the DB-API 2.0 specification described by :pep:`249`.
+ 
+ To use the module, you must first create a :class:`Connection` object that
+ represents the database.  Here the data will be stored in the
+-:file:`/tmp/example` file::
++:file:`example.db` file::
+ 
+    import sqlite3
+-   conn = sqlite3.connect('/tmp/example')
++   conn = sqlite3.connect('example.db')
+ 
+ You can also supply the special name ``:memory:`` to create a database in RAM.
+ 
+@@ -33,13 +33,11 @@
+    c = conn.cursor()
+ 
+    # Create table
+-   c.execute('''create table stocks
+-   (date text, trans text, symbol text,
+-    qty real, price real)''')
++   c.execute('''CREATE TABLE stocks
++                (date text, trans text, symbol text, qty real, price real)''')
+ 
+    # Insert a row of data
+-   c.execute("""insert into stocks
+-             values ('2006-01-05','BUY','RHAT',100,35.14)""")
++   c.execute("INSERT INTO stocks VALUES ('2006-01-05','BUY','RHAT',100,35.14)")
+ 
+    # Save (commit) the changes
+    conn.commit()
+@@ -47,9 +45,16 @@
+    # We can also close the cursor if we are done with it
+    c.close()
+ 
++The data you've saved is persistent and is available in subsequent sessions::
++
++   import sqlite3
++   conn = sqlite3.connect('example.db')
++   c = conn.cursor()
++
+ Usually your SQL operations will need to use values from Python variables.  You
+ shouldn't assemble your query using Python's string operations because doing so
+-is insecure; it makes your program vulnerable to an SQL injection attack.
++is insecure; it makes your program vulnerable to an SQL injection attack
++(see http://xkcd.com/327/ for humorous example of what can go wrong).
+ 
+ Instead, use the DB-API's parameter substitution.  Put ``?`` as a placeholder
+ wherever you want to use a value, and then provide a tuple of values as the
+@@ -58,19 +63,20 @@
+ example::
+ 
+    # Never do this -- insecure!
+-   symbol = 'IBM'
+-   c.execute("select * from stocks where symbol = '%s'" % symbol)
++   symbol = 'RHAT'
++   c.execute("SELECT * FROM stocks WHERE symbol = '%s'" % symbol)
+ 
+    # Do this instead
+    t = (symbol,)
+-   c.execute('select * from stocks where symbol=?', t)
++   c.execute('SELECT * FROM stocks WHERE symbol=?', t)
++   print c.fetchone()
+ 
+-   # Larger example
+-   for t in [('2006-03-28', 'BUY', 'IBM', 1000, 45.00),
+-             ('2006-04-05', 'BUY', 'MSFT', 1000, 72.00),
+-             ('2006-04-06', 'SELL', 'IBM', 500, 53.00),
+-            ]:
+-       c.execute('insert into stocks values (?,?,?,?,?)', t)
++   # Larger example that inserts many records at a time
++   purchases = [('2006-03-28', 'BUY', 'IBM', 1000, 45.00),
++                ('2006-04-05', 'BUY', 'MSFT', 1000, 72.00),
++                ('2006-04-06', 'SELL', 'IBM', 500, 53.00),
++               ]
++   c.executemany('INSERT INTO stocks VALUES (?,?,?,?,?)', purchases)
+ 
+ To retrieve data after executing a SELECT statement, you can either treat the
+ cursor as an :term:`iterator`, call the cursor's :meth:`~Cursor.fetchone` method to
+@@ -79,16 +85,13 @@
+ 
+ This example uses the iterator form::
+ 
+-   >>> c = conn.cursor()
+-   >>> c.execute('select * from stocks order by price')
+-   >>> for row in c:
+-   ...    print row
+-   ...
++   >>> for row in c.execute('SELECT * FROM stocks ORDER BY price'):
++           print row
++
+    (u'2006-01-05', u'BUY', u'RHAT', 100, 35.14)
+    (u'2006-03-28', u'BUY', u'IBM', 1000, 45.0)
+    (u'2006-04-06', u'SELL', u'IBM', 500, 53.0)
+    (u'2006-04-05', u'BUY', u'MSFT', 1000, 72.0)
+-   >>>
+ 
+ 
+ .. seealso::
+@@ -101,6 +104,9 @@
+       The SQLite web page; the documentation describes the syntax and the
+       available data types for the supported SQL dialect.
+ 
++   http://www.w3schools.com/sql/
++      Tutorial, reference and examples for learning SQL syntax.
++
+    :pep:`249` - Database API Specification 2.0
+       PEP written by Marc-AndrÃ© Lemburg.
+ 
+@@ -237,7 +243,6 @@
+    supplied, this must be a custom cursor class that extends
+    :class:`sqlite3.Cursor`.
+ 
+-
+ .. method:: Connection.commit()
+ 
+    This method commits the current transaction. If you don't call this method,
+@@ -357,8 +362,6 @@
+ 
+ .. method:: Connection.set_progress_handler(handler, n)
+ 
+-   .. versionadded:: 2.6
+-
+    This routine registers a callback. The callback is invoked for every *n*
+    instructions of the SQLite virtual machine. This is useful if you want to
+    get called from SQLite during long-running operations, for example to update
+@@ -367,29 +370,31 @@
+    If you want to clear any previously installed progress handler, call the
+    method with :const:`None` for *handler*.
+ 
++   .. versionadded:: 2.6
++
+ 
+ .. method:: Connection.enable_load_extension(enabled)
+ 
+-   .. versionadded:: 2.7
+-
+    This routine allows/disallows the SQLite engine to load SQLite extensions
+    from shared libraries.  SQLite extensions can define new functions,
+    aggregates or whole new virtual table implementations.  One well-known
+    extension is the fulltext-search extension distributed with SQLite.
+ 
++   Loadable extensions are disabled by default. See [#f1]_.
++
++   .. versionadded:: 2.7
++
+    .. literalinclude:: ../includes/sqlite3/load_extension.py
+ 
+-   Loadable extensions are disabled by default. See [#f1]_
+-
+ .. method:: Connection.load_extension(path)
+ 
+-   .. versionadded:: 2.7
+-
+    This routine loads a SQLite extension from a shared library.  You have to
+    enable extension loading with :meth:`enable_load_extension` before you can
+    use this routine.
+ 
+-   Loadable extensions are disabled by default. See [#f1]_
++   Loadable extensions are disabled by default. See [#f1]_.
++
++   .. versionadded:: 2.7
+ 
+ .. attribute:: Connection.row_factory
+ 
+@@ -468,19 +473,15 @@
+ 
+ .. method:: Cursor.execute(sql, [parameters])
+ 
+-   Executes an SQL statement. The SQL statement may be parametrized (i. e.
++   Executes an SQL statement. The SQL statement may be parameterized (i. e.
+    placeholders instead of SQL literals). The :mod:`sqlite3` module supports two
+    kinds of placeholders: question marks (qmark style) and named placeholders
+    (named style).
+ 
+-   This example shows how to use parameters with qmark style:
++   Here's an example of both styles:
+ 
+    .. literalinclude:: ../includes/sqlite3/execute_1.py
+ 
+-   This example shows how to use the named style:
+-
+-   .. literalinclude:: ../includes/sqlite3/execute_2.py
+-
+    :meth:`execute` will only execute a single SQL statement. If you try to execute
+    more than one statement with it, it will raise a Warning. Use
+    :meth:`executescript` if you want to execute multiple SQL statements with one
+@@ -633,7 +634,8 @@
+    ['date', 'trans', 'symbol', 'qty', 'price']
+    >>> r['qty']
+    100.0
+-   >>> for member in r: print member
++   >>> for member in r:
++   ...     print member
+    ...
+    2006-01-05
+    BUY
+diff -r 70274d53c1dd Doc/library/statvfs.rst
+--- a/Doc/library/statvfs.rst
++++ b/Doc/library/statvfs.rst
+@@ -6,7 +6,7 @@
+    :deprecated:
+ 
+ .. deprecated:: 2.6
+-   The :mod:`statvfs` module has been deprecated for removal in Python 3.0.
++   The :mod:`statvfs` module has been removed in Python 3.
+ 
+ 
+ .. sectionauthor:: Moshe Zadka <moshez@zadka.site.co.il>
+diff -r 70274d53c1dd Doc/library/stdtypes.rst
+--- a/Doc/library/stdtypes.rst
++++ b/Doc/library/stdtypes.rst
+@@ -969,7 +969,7 @@
+    See :ref:`formatstrings` for a description of the various formatting options
+    that can be specified in format strings.
+ 
+-   This method of string formatting is the new standard in Python 3.0, and
++   This method of string formatting is the new standard in Python 3, and
+    should be preferred to the ``%`` formatting described in
+    :ref:`string-formatting` in new code.
+ 
+@@ -1161,8 +1161,8 @@
+    Return a list of the words in the string, using *sep* as the delimiter
+    string.  If *maxsplit* is given, at most *maxsplit* splits are done (thus,
+    the list will have at most ``maxsplit+1`` elements).  If *maxsplit* is not
+-   specified, then there is no limit on the number of splits (all possible
+-   splits are made).
++   specified or ``-1``, then there is no limit on the number of splits
++   (all possible splits are made).
+ 
+    If *sep* is given, consecutive delimiters are not grouped together and are
+    deemed to delimit empty strings (for example, ``'1,,2'.split(',')`` returns
+@@ -1183,9 +1183,18 @@
+ 
+ .. method:: str.splitlines([keepends])
+ 
+-   Return a list of the lines in the string, breaking at line boundaries.  Line
+-   breaks are not included in the resulting list unless *keepends* is given and
+-   true.
++   Return a list of the lines in the string, breaking at line boundaries.
++   This method uses the universal newlines approach to splitting lines.
++   Line breaks are not included in the resulting list unless *keepends* is
++   given and true.
++
++   For example, ``'ab c\n\nde fg\rkl\r\n'.splitlines()`` returns
++   ``['ab c', '', 'de fg', 'kl']``, while the same call with ``splitlines(True)``
++   returns ``['ab c\n', '\n', 'de fg\r', 'kl\r\n']``.
++
++   Unlike :meth:`~str.split` when a delimiter string *sep* is given, this
++   method returns an empty list for the empty string, and a terminal line
++   break does not result in an extra line.
+ 
+ 
+ .. method:: str.startswith(prefix[, start[, end]])
+@@ -2378,7 +2387,7 @@
+    make a :keyword:`for` loop the most efficient way of looping over the lines of a
+    file (a very common operation), the :meth:`~file.next` method uses a hidden read-ahead
+    buffer.  As a consequence of using a read-ahead buffer, combining :meth:`~file.next`
+-   with other file methods (like :meth:`readline`) does not work right.  However,
++   with other file methods (like :meth:`~file.readline`) does not work right.  However,
+    using :meth:`seek` to reposition the file to an absolute position will flush the
+    read-ahead buffer.
+ 
+@@ -2420,7 +2429,7 @@
+ 
+ .. method:: file.readlines([sizehint])
+ 
+-   Read until EOF using :meth:`readline` and return a list containing the lines
++   Read until EOF using :meth:`~file.readline` and return a list containing the lines
+    thus read.  If the optional *sizehint* argument is present, instead of
+    reading up to EOF, whole lines totalling approximately *sizehint* bytes
+    (possibly after rounding up to an internal buffer size) are read.  Objects
+@@ -2500,7 +2509,7 @@
+    add line separators.)
+ 
+ Files support the iterator protocol.  Each iteration returns the same result as
+-``file.readline()``, and iteration ends when the :meth:`readline` method returns
++:meth:`~file.readline`, and iteration ends when the :meth:`~file.readline` method returns
+ an empty string.
+ 
+ File objects also offer a number of other interesting attributes. These are not
+diff -r 70274d53c1dd Doc/library/string.rst
+--- a/Doc/library/string.rst
++++ b/Doc/library/string.rst
+@@ -322,7 +322,7 @@
+ 
+ .. productionlist:: sf
+    format_spec: [[`fill`]`align`][`sign`][#][0][`width`][,][.`precision`][`type`]
+-   fill: <a character other than '}'>
++   fill: <a character other than '{' or '}'>
+    align: "<" | ">" | "=" | "^"
+    sign: "+" | "-" | " "
+    width: `integer`
+@@ -793,7 +793,7 @@
+ The following list of functions are also defined as methods of string and
+ Unicode objects; see section :ref:`string-methods` for more information on
+ those.  You should consider these functions as deprecated, although they will
+-not be removed until Python 3.0.  The functions defined in this module are:
++not be removed until Python 3.  The functions defined in this module are:
+ 
+ 
+ .. function:: atof(s)
+@@ -905,14 +905,15 @@
+ 
+    Return a list of the words of the string *s*.  If the optional second argument
+    *sep* is absent or ``None``, the words are separated by arbitrary strings of
+-   whitespace characters (space, tab,  newline, return, formfeed).  If the second
++   whitespace characters (space, tab, newline, return, formfeed).  If the second
+    argument *sep* is present and not ``None``, it specifies a string to be used as
+    the  word separator.  The returned list will then have one more item than the
+-   number of non-overlapping occurrences of the separator in the string.  The
+-   optional third argument *maxsplit* defaults to 0.  If it is nonzero, at most
+-   *maxsplit* number of splits occur, and the remainder of the string is returned
+-   as the final element of the list (thus, the list will have at most
+-   ``maxsplit+1`` elements).
++   number of non-overlapping occurrences of the separator in the string.
++   If *maxsplit* is given, at most *maxsplit* number of splits occur, and the
++   remainder of the string is returned as the final element of the list (thus,
++   the list will have at most ``maxsplit+1`` elements).  If *maxsplit* is not
++   specified or ``-1``, then there is no limit on the number of splits (all
++   possible splits are made).
+ 
+    The behavior of split on an empty string depends on the value of *sep*. If *sep*
+    is not specified, or specified as ``None``, the result will be an empty list.
+@@ -925,7 +926,7 @@
+    Return a list of the words of the string *s*, scanning *s* from the end.  To all
+    intents and purposes, the resulting list of words is the same as returned by
+    :func:`split`, except when the optional third argument *maxsplit* is explicitly
+-   specified and nonzero.  When *maxsplit* is nonzero, at most *maxsplit* number of
++   specified and nonzero.  If *maxsplit* is given, at most *maxsplit* number of
+    splits -- the *rightmost* ones -- occur, and the remainder of the string is
+    returned as the first element of the list (thus, the list will have at most
+    ``maxsplit+1`` elements).
+diff -r 70274d53c1dd Doc/library/struct.rst
+--- a/Doc/library/struct.rst
++++ b/Doc/library/struct.rst
+@@ -386,7 +386,7 @@
+       (``len(string)`` must equal :attr:`self.size`).
+ 
+ 
+-   .. method:: unpack_from(buffer[, offset=0])
++   .. method:: unpack_from(buffer, offset=0)
+ 
+       Identical to the :func:`unpack_from` function, using the compiled format.
+       (``len(buffer[offset:])`` must be at least :attr:`self.size`).
+diff -r 70274d53c1dd Doc/library/subprocess.rst
+--- a/Doc/library/subprocess.rst
++++ b/Doc/library/subprocess.rst
+@@ -172,6 +172,26 @@
+    output.
+ 
+ 
++.. exception:: CalledProcessError
++
++    Exception raised when a process run by :func:`check_call` or
++    :func:`check_output` returns a non-zero exit status.
++
++    .. attribute:: returncode
++
++        Exit status of the child process.
++
++    .. attribute:: cmd
++
++        Command that was used to spawn the child process.
++
++    .. attribute:: output
++
++        Output of the child process if this exception is raised by
++        :func:`check_output`.  Otherwise, ``None``.
++
++
++
+ .. _frequently-used-arguments:
+ 
+ Frequently Used Arguments
+@@ -289,7 +309,7 @@
+ 
+       Popen(['/bin/sh', '-c', args[0], args[1], ...])
+ 
+-   On Windows: the :class:`Popen` class uses CreateProcess() to execute the child
++   On Windows: the :class:`Popen` class uses CreateProcess() to execute the
+    child program, which operates on strings.  If *args* is a sequence, it will
+    be converted to a string in a manner described in
+    :ref:`converting-argument-sequence`.
+@@ -685,7 +705,7 @@
+ to receive a SIGPIPE if p2 exits before p1.
+ 
+ Alternatively, for trusted input, the shell's own pipeline support may still
+-be used directly:
++be used directly::
+ 
+    output=`dmesg | grep hda`
+    # becomes
+diff -r 70274d53c1dd Doc/library/sunaudio.rst
+--- a/Doc/library/sunaudio.rst
++++ b/Doc/library/sunaudio.rst
+@@ -8,7 +8,7 @@
+    :deprecated:
+ 
+ .. deprecated:: 2.6
+-   The :mod:`sunaudiodev` module has been deprecated for removal in Python 3.0.
++   The :mod:`sunaudiodev` module has been removed in Python 3.
+ 
+ 
+ 
+@@ -153,7 +153,7 @@
+    :deprecated:
+ 
+ .. deprecated:: 2.6
+-   The :mod:`SUNAUDIODEV` module has been deprecated for removal in Python 3.0.
++   The :mod:`SUNAUDIODEV` module has been removed in Python 3.
+ 
+ 
+ 
+diff -r 70274d53c1dd Doc/library/sys.rst
+--- a/Doc/library/sys.rst
++++ b/Doc/library/sys.rst
+@@ -1,4 +1,3 @@
+-
+ :mod:`sys` --- System-specific parameters and functions
+ =======================================================
+ 
+@@ -208,7 +207,7 @@
+    be set at build time with the ``--exec-prefix`` argument to the
+    :program:`configure` script.  Specifically, all configuration files (e.g. the
+    :file:`pyconfig.h` header file) are installed in the directory
+-   :file:`{exec_prefix}/lib/python{X.Y}/config', and shared library modules are
++   :file:`{exec_prefix}/lib/python{X.Y}/config`, and shared library modules are
+    installed in :file:`{exec_prefix}/lib/python{X.Y}/lib-dynload`, where *X.Y*
+    is the version number of Python, for example ``2.7``.
+ 
+@@ -291,6 +290,8 @@
+ 
+    .. versionadded:: 2.6
+ 
++   .. versionadded:: 2.7.3
++      The ``hash_randomization`` attribute.
+ 
+ .. data:: float_info
+ 
+@@ -775,7 +776,7 @@
+    argument to the :program:`configure` script.  The main collection of Python
+    library modules is installed in the directory :file:`{prefix}/lib/python{X.Y}``
+    while the platform independent header files (all except :file:`pyconfig.h`) are
+-   stored in :file:`{prefix}/include/python{X.Y}``, where *X.Y* is the version
++   stored in :file:`{prefix}/include/python{X.Y}`, where *X.Y* is the version
+    number of Python, for example ``2.7``.
+ 
+ 
+@@ -796,10 +797,10 @@
+ 
+ .. data:: py3kwarning
+ 
+-   Bool containing the status of the Python 3.0 warning flag. It's ``True``
++   Bool containing the status of the Python 3 warning flag. It's ``True``
+    when Python is started with the -3 option.  (This should be considered
+    read-only; setting it to a different value doesn't have an effect on
+-   Python 3.0 warnings.)
++   Python 3 warnings.)
+ 
+    .. versionadded:: 2.6
+ 
+diff -r 70274d53c1dd Doc/library/sysconfig.rst
+--- a/Doc/library/sysconfig.rst
++++ b/Doc/library/sysconfig.rst
+@@ -129,7 +129,7 @@
+    one may call this function and get the default value.
+ 
+    If *scheme* is provided, it must be a value from the list returned by
+-   :func:`get_path_names`.  Otherwise, the default scheme for the current
++   :func:`get_scheme_names`.  Otherwise, the default scheme for the current
+    platform is used.
+ 
+    If *vars* is provided, it must be a dictionary of variables that will update
+diff -r 70274d53c1dd Doc/library/syslog.rst
+--- a/Doc/library/syslog.rst
++++ b/Doc/library/syslog.rst
+@@ -73,7 +73,8 @@
+ Facilities:
+    :const:`LOG_KERN`, :const:`LOG_USER`, :const:`LOG_MAIL`, :const:`LOG_DAEMON`,
+    :const:`LOG_AUTH`, :const:`LOG_LPR`, :const:`LOG_NEWS`, :const:`LOG_UUCP`,
+-   :const:`LOG_CRON` and :const:`LOG_LOCAL0` to :const:`LOG_LOCAL7`.
++   :const:`LOG_CRON`, :const:`LOG_SYSLOG` and :const:`LOG_LOCAL0` to
++   :const:`LOG_LOCAL7`.
+ 
+ Log options:
+    :const:`LOG_PID`, :const:`LOG_CONS`, :const:`LOG_NDELAY`, :const:`LOG_NOWAIT`
+diff -r 70274d53c1dd Doc/library/tarfile.rst
+--- a/Doc/library/tarfile.rst
++++ b/Doc/library/tarfile.rst
+@@ -16,7 +16,8 @@
+ 
+ The :mod:`tarfile` module makes it possible to read and write tar
+ archives, including those using gzip or bz2 compression.
+-(:file:`.zip` files can be read and written using the :mod:`zipfile` module.)
++Use the :mod:`zipfile` module to read or write :file:`.zip` files, or the
++higher-level functions in :ref:`shutil <archiving-operations>`.
+ 
+ Some facts and figures:
+ 
+@@ -142,7 +143,7 @@
+ 
+ 
+    .. deprecated:: 2.6
+-      The :class:`TarFileCompat` class has been deprecated for removal in Python 3.0.
++      The :class:`TarFileCompat` class has been removed in Python 3.
+ 
+ 
+ .. exception:: TarError
+diff -r 70274d53c1dd Doc/library/test.rst
+--- a/Doc/library/test.rst
++++ b/Doc/library/test.rst
+@@ -169,10 +169,10 @@
+ the test passed or failed and thus minimize output.
+ 
+ Running :mod:`test.regrtest` directly allows what resources are available for
+-tests to use to be set. You do this by using the :option:`-u` command-line
+-option. Run :program:`python -m test.regrtest -uall` to turn on all
+-resources; specifying ``all`` as an option for ``-u`` enables all
+-possible resources. If all but one resource is desired (a more common case), a
++tests to use to be set. You do this by using the ``-u`` command-line
++option. Specifying ``all`` as the value for the ``-u`` option enables all
++possible resources: :program:`python -m test -uall`.
++If all but one resource is desired (a more common case), a
+ comma-separated list of resources that are not desired may be listed after
+ ``all``. The command :program:`python -m test.regrtest -uall,-audio,-largefile`
+ will run :mod:`test.regrtest` with all resources except the ``audio`` and
+@@ -380,7 +380,7 @@
+ 
+       with captured_stdout() as s:
+           print "hello"
+-      assert s.getvalue() == "hello"
++      assert s.getvalue() == "hello\n"
+ 
+    .. versionadded:: 2.6
+ 
+diff -r 70274d53c1dd Doc/library/textwrap.rst
+--- a/Doc/library/textwrap.rst
++++ b/Doc/library/textwrap.rst
+@@ -112,9 +112,11 @@
+ 
+    .. attribute:: replace_whitespace
+ 
+-      (default: ``True``) If true, each whitespace character (as defined by
+-      ``string.whitespace``) remaining after tab expansion will be replaced by a
+-      single space.
++      (default: ``True``) If true, after tab expansion but before wrapping,
++      the :meth:`wrap` method will replace each whitespace character
++      with a single space.  The whitespace characters replaced are
++      as follows: tab, newline, vertical tab, formfeed, and carriage
++      return (``'\t\n\v\f\r'``).
+ 
+       .. note::
+ 
+diff -r 70274d53c1dd Doc/library/thread.rst
+--- a/Doc/library/thread.rst
++++ b/Doc/library/thread.rst
+@@ -5,9 +5,9 @@
+    :synopsis: Create multiple threads of control within one interpreter.
+ 
+ .. note::
+-   The :mod:`thread` module has been renamed to :mod:`_thread` in Python 3.0.
++   The :mod:`thread` module has been renamed to :mod:`_thread` in Python 3.
+    The :term:`2to3` tool will automatically adapt imports when converting your
+-   sources to 3.0; however, you should consider using the high-level
++   sources to Python 3; however, you should consider using the high-level
+    :mod:`threading` module instead.
+ 
+ 
+diff -r 70274d53c1dd Doc/library/threading.rst
+--- a/Doc/library/threading.rst
++++ b/Doc/library/threading.rst
+@@ -401,15 +401,12 @@
+ 
+    Acquire a lock, blocking or non-blocking.
+ 
+-   When invoked without arguments, block until the lock is unlocked, then set it to
+-   locked, and return true.
++   When invoked with the *blocking* argument set to ``True`` (the default),
++   block until the lock is unlocked, then set it to locked and return ``True``.
+ 
+-   When invoked with the *blocking* argument set to true, do the same thing as when
+-   called without arguments, and return true.
+-
+-   When invoked with the *blocking* argument set to false, do not block.  If a call
+-   without an argument would block, return false immediately; otherwise, do the
+-   same thing as when called without arguments, and return true.
++   When invoked with the *blocking* argument set to ``False``, do not block.
++   If a call with *blocking* set to ``True`` would block, return ``False``
++   immediately; otherwise, set the lock to locked and return ``True``.
+ 
+ 
+ .. method:: Lock.release()
+@@ -420,7 +417,7 @@
+    are blocked waiting for the lock to become unlocked, allow exactly one of them
+    to proceed.
+ 
+-   Do not call this method when the lock is unlocked.
++   When invoked on an unlocked lock, a :exc:`ThreadError` is raised.
+ 
+    There is no return value.
+ 
+diff -r 70274d53c1dd Doc/library/time.rst
+--- a/Doc/library/time.rst
++++ b/Doc/library/time.rst
+@@ -71,9 +71,9 @@
+   the units in which their value or argument is expressed. E.g. on most Unix
+   systems, the clock "ticks" only 50 or 100 times a second.
+ 
+-* On the other hand, the precision of :func:`time` and :func:`sleep` is better
++* On the other hand, the precision of :func:`.time` and :func:`sleep` is better
+   than their Unix equivalents: times are expressed as floating point numbers,
+-  :func:`time` returns the most accurate time available (using Unix
++  :func:`.time` returns the most accurate time available (using Unix
+   :c:func:`gettimeofday` where available), and :func:`sleep` will accept a time
+   with a nonzero fraction (Unix :c:func:`select` is used to implement this, where
+   available).
+@@ -164,7 +164,7 @@
+ 
+    Convert a time expressed in seconds since the epoch to a string representing
+    local time. If *secs* is not provided or :const:`None`, the current time as
+-   returned by :func:`time` is used.  ``ctime(secs)`` is equivalent to
++   returned by :func:`.time` is used.  ``ctime(secs)`` is equivalent to
+    ``asctime(localtime(secs))``. Locale information is not used by :func:`ctime`.
+ 
+    .. versionchanged:: 2.1
+@@ -183,7 +183,7 @@
+ 
+    Convert a time expressed in seconds since the epoch to a :class:`struct_time` in
+    UTC in which the dst flag is always zero.  If *secs* is not provided or
+-   :const:`None`, the current time as returned by :func:`time` is used.  Fractions
++   :const:`None`, the current time as returned by :func:`.time` is used.  Fractions
+    of a second are ignored.  See above for a description of the
+    :class:`struct_time` object. See :func:`calendar.timegm` for the inverse of this
+    function.
+@@ -198,7 +198,7 @@
+ .. function:: localtime([secs])
+ 
+    Like :func:`gmtime` but converts to local time.  If *secs* is not provided or
+-   :const:`None`, the current time as returned by :func:`time` is used.  The dst
++   :const:`None`, the current time as returned by :func:`.time` is used.  The dst
+    flag is set to ``1`` when DST applies to the given time.
+ 
+    .. versionchanged:: 2.1
+@@ -213,7 +213,7 @@
+    This is the inverse function of :func:`localtime`.  Its argument is the
+    :class:`struct_time` or full 9-tuple (since the dst flag is needed; use ``-1``
+    as the dst flag if it is unknown) which expresses the time in *local* time, not
+-   UTC.  It returns a floating point number, for compatibility with :func:`time`.
++   UTC.  It returns a floating point number, for compatibility with :func:`.time`.
+    If the input value cannot be represented as a valid time, either
+    :exc:`OverflowError` or :exc:`ValueError` will be raised (which depends on
+    whether the invalid value is caught by Python or the underlying C libraries).
+@@ -410,7 +410,7 @@
+    +-------+-------------------+---------------------------------+
+    | 4     | :attr:`tm_min`    | range [0, 59]                   |
+    +-------+-------------------+---------------------------------+
+-   | 5     | :attr:`tm_sec`    | range [0, 61]; see **(1)** in   |
++   | 5     | :attr:`tm_sec`    | range [0, 61]; see **(2)** in   |
+    |       |                   | :func:`strftime` description    |
+    +-------+-------------------+---------------------------------+
+    | 6     | :attr:`tm_wday`   | range [0, 6], Monday is 0       |
+@@ -435,8 +435,8 @@
+ 
+ .. function:: time()
+ 
+-   Return the time as a floating point number expressed in seconds since the epoch,
+-   in UTC.  Note that even though the time is always returned as a floating point
++   Return the time in seconds since the epoch as a floating point number.
++   Note that even though the time is always returned as a floating point
+    number, not all systems provide time with a better precision than 1 second.
+    While this function normally returns non-decreasing values, it can return a
+    lower value than a previous call if the system clock has been set back between
+diff -r 70274d53c1dd Doc/library/timeit.rst
+--- a/Doc/library/timeit.rst
++++ b/Doc/library/timeit.rst
+@@ -101,10 +101,20 @@
+ 
+          timeit.Timer('for i in xrange(10): oct(i)', 'gc.enable()').timeit()
+ 
+-Starting with version 2.6, the module also defines two convenience functions:
++The module also defines three convenience functions:
+ 
+ 
+-.. function:: repeat(stmt[, setup[, timer[, repeat=3 [, number=1000000]]]])
++.. function:: default_timer()
++
++   Define a default timer, in a platform specific manner. On Windows,
++   :func:`time.clock` has microsecond granularity but :func:`time.time`'s
++   granularity is 1/60th of a second; on Unix, :func:`time.clock` has 1/100th of
++   a second granularity and :func:`time.time` is much more precise.  On either
++   platform, :func:`default_timer` measures wall clock time, not the CPU
++   time.  This means that other processes running on the same computer may
++   interfere with the timing.
++
++.. function:: repeat(stmt, setup='pass', timer=default_timer, repeat=3 , number=1000000)
+ 
+    Create a :class:`Timer` instance with the given statement, setup code and timer
+    function and run its :meth:`repeat` method with the given repeat count and
+@@ -113,7 +123,7 @@
+    .. versionadded:: 2.6
+ 
+ 
+-.. function:: timeit(stmt[, setup[, timer[, number=1000000]]])
++.. function:: timeit(stmt, setup='pass', timer=default_timer, number=1000000)
+ 
+    Create a :class:`Timer` instance with the given statement, setup code and timer
+    function and run its :meth:`timeit` method with *number* executions.
+@@ -168,13 +178,9 @@
+ If :option:`-n` is not given, a suitable number of loops is calculated by trying
+ successive powers of 10 until the total time is at least 0.2 seconds.
+ 
+-The default timer function is platform dependent.  On Windows,
+-:func:`time.clock` has microsecond granularity but :func:`time.time`'s
+-granularity is 1/60th of a second; on Unix, :func:`time.clock` has 1/100th of a
+-second granularity and :func:`time.time` is much more precise.  On either
+-platform, the default timer functions measure wall clock time, not the CPU time.
+-This means that other processes running on the same computer may interfere with
+-the timing.  The best thing to do when accurate timing is necessary is to repeat
++:func:`default_timer` measurations can be affected by other programs running on
++the same machine, so
++the best thing to do when accurate timing is necessary is to repeat
+ the timing a few times and use the best time.  The :option:`-r` option is good
+ for this; the default of 3 repetitions is probably enough in most cases.  On
+ Unix, you can use :func:`time.clock` to measure CPU time.
+diff -r 70274d53c1dd Doc/library/tix.rst
+--- a/Doc/library/tix.rst
++++ b/Doc/library/tix.rst
+@@ -24,9 +24,9 @@
+ 
+ .. note::
+ 
+-   :mod:`Tix` has been renamed to :mod:`tkinter.tix` in Python 3.0.  The
++   :mod:`Tix` has been renamed to :mod:`tkinter.tix` in Python 3.  The
+    :term:`2to3` tool will automatically adapt imports when converting your
+-   sources to 3.0.
++   sources to Python 3.
+ 
+ .. seealso::
+ 
+diff -r 70274d53c1dd Doc/library/tkinter.rst
+--- a/Doc/library/tkinter.rst
++++ b/Doc/library/tkinter.rst
+@@ -13,9 +13,9 @@
+ 
+ .. note::
+ 
+-   :mod:`Tkinter` has been renamed to :mod:`tkinter` in Python 3.0.  The
++   :mod:`Tkinter` has been renamed to :mod:`tkinter` in Python 3.  The
+    :term:`2to3` tool will automatically adapt imports when converting your
+-   sources to 3.0.
++   sources to Python 3.
+ 
+ .. seealso::
+ 
+@@ -23,12 +23,27 @@
+       The Python Tkinter Topic Guide provides a great deal of information on using Tk
+       from Python and links to other sources of information on Tk.
+ 
++   `TKDocs <http://www.tkdocs.com/>`_
++      Extensive tutorial plus friendlier widget pages for some of the widgets.
++
++   `Tkinter reference: a GUI for Python <http://infohost.nmt.edu/tcc/help/pubs/tkinter/>`_
++      On-line reference material.
++
++   `Tkinter docs from effbot <http://effbot.org/tkinterbook/>`_
++      Online reference for tkinter supported by effbot.org.
++
++   `Tcl/Tk manual <http://www.tcl.tk/man/tcl8.5/>`_
++      Official manual for the latest tcl/tk version.
++
++   `Programming Python <http://www.amazon.com/Programming-Python-Mark-Lutz/dp/0596158106/>`_
++      Book by Mark Lutz, has excellent coverage of Tkinter.
++
++   `Modern Tkinter for Busy Python Developers <http://www.amazon.com/Modern-Tkinter-Python-Developers-ebook/dp/B0071QDNLO/>`_
++      Book by Mark Rozerman about building attractive and modern graphical user interfaces with Python and Tkinter.
++
+    `An Introduction to Tkinter <http://www.pythonware.com/library/an-introduction-to-tkinter.htm>`_
+       Fredrik Lundh's on-line reference material.
+ 
+-   `Tkinter reference: a GUI for Python <http://infohost.nmt.edu/tcc/help/pubs/lang.html>`_
+-      On-line reference material.
+-
+    `Python and Tkinter Programming <http://www.amazon.com/exec/obidos/ASIN/1884777813>`_
+       The book by John Grayson (ISBN 1-884777-81-3).
+ 
+@@ -109,7 +124,7 @@
+ :mod:`turtle`
+    Turtle graphics in a Tk window.
+ 
+-These have been renamed as well in Python 3.0; they were all made submodules of
++These have been renamed as well in Python 3; they were all made submodules of
+ the new ``tkinter`` package.
+ 
+ 
+diff -r 70274d53c1dd Doc/library/tokenize.rst
+--- a/Doc/library/tokenize.rst
++++ b/Doc/library/tokenize.rst
+@@ -29,7 +29,8 @@
+    which must be a callable object which provides the same interface as the
+    :meth:`readline` method of built-in file objects (see section
+    :ref:`bltin-file-objects`).  Each call to the function should return one line
+-   of input as a string.
++   of input as a string. Alternately, *readline* may be a callable object that
++   signals completion by raising :exc:`StopIteration`.
+ 
+    The generator produces 5-tuples with these members: the token type; the token
+    string; a 2-tuple ``(srow, scol)`` of ints specifying the row and column
+diff -r 70274d53c1dd Doc/library/trace.rst
+--- a/Doc/library/trace.rst
++++ b/Doc/library/trace.rst
+@@ -149,7 +149,7 @@
+        the current tracing parameters.  *cmd* must be a string or code object,
+        suitable for passing into :func:`exec`.
+ 
+-    .. method:: runctx(cmd[, globals=None[, locals=None]])
++    .. method:: runctx(cmd, globals=None, locals=None)
+ 
+        Execute the command and gather statistics from the execution with the
+        current tracing parameters, in the defined global and local
+diff -r 70274d53c1dd Doc/library/ttk.rst
+--- a/Doc/library/ttk.rst
++++ b/Doc/library/ttk.rst
+@@ -265,7 +265,7 @@
+       *x* and *y* are pixel coordinates relative to the widget.
+ 
+ 
+-   .. method:: instate(statespec[, callback=None[, *args[, **kw]]])
++   .. method:: instate(statespec, callback=None, *args, **kw)
+ 
+       Test the widget's state. If a callback is not specified, returns True
+       if the widget state matches *statespec* and False otherwise. If callback
+@@ -523,7 +523,7 @@
+       omitted, returns the widget name of the currently selected pane.
+ 
+ 
+-   .. method:: tab(tab_id[, option=None[, **kw]])
++   .. method:: tab(tab_id, option=None, **kw)
+ 
+       Query or modify the options of the specific *tab_id*.
+ 
+@@ -846,7 +846,7 @@
+ 
+ .. class:: Treeview
+ 
+-   .. method:: bbox(item[, column=None])
++   .. method:: bbox(item, column=None)
+ 
+       Returns the bounding box (relative to the treeview widget's window) of
+       the specified *item* in the form (x, y, width, height).
+@@ -873,7 +873,7 @@
+       *item*'s children.
+ 
+ 
+-   .. method:: column(column[, option=None[, **kw]])
++   .. method:: column(column, option=None, **kw)
+ 
+       Query or modify the options for the specified *column*.
+ 
+@@ -928,7 +928,7 @@
+       the current focus item, or '' if there is none.
+ 
+ 
+-   .. method:: heading(column[, option=None[, **kw]])
++   .. method:: heading(column, option=None, **kw)
+ 
+       Query or modify the heading options for the specified *column*.
+ 
+@@ -1001,7 +1001,7 @@
+       Returns the integer index of *item* within its parent's list of children.
+ 
+ 
+-   .. method:: insert(parent, index[, iid=None[, **kw]])
++   .. method:: insert(parent, index, iid=None, **kw)
+ 
+       Creates a new item and returns the item identifier of the newly created
+       item.
+@@ -1096,7 +1096,7 @@
+       Toggle the selection state of each item in *items*.
+ 
+ 
+-   .. method:: set(item[, column=None[, value=None]])
++   .. method:: set(item, column=None, value=None)
+ 
+       With one argument, returns a dictionary of column/value pairs for the
+       specified *item*. With two arguments, returns the current value of the
+@@ -1104,14 +1104,14 @@
+       *column* in given *item* to the specified *value*.
+ 
+ 
+-   .. method:: tag_bind(tagname[, sequence=None[, callback=None]])
++   .. method:: tag_bind(tagname, sequence=None, callback=None)
+ 
+       Bind a callback for the given event *sequence* to the tag *tagname*.
+       When an event is delivered to an item, the callbacks for each of the
+       item's tags option are called.
+ 
+ 
+-   .. method:: tag_configure(tagname[, option=None[, **kw]])
++   .. method:: tag_configure(tagname, option=None, **kw)
+ 
+       Query or modify the options for the specified *tagname*.
+ 
+@@ -1220,7 +1220,7 @@
+       foreground option, for example, you would get a blue foreground
+       when the widget is in the active or pressed states.
+ 
+-   .. method:: lookup(style, option[, state=None[, default=None]])
++   .. method:: lookup(style, option, state=None, default=None)
+ 
+       Returns the value specified for *option* in *style*.
+ 
+@@ -1235,7 +1235,7 @@
+          print ttk.Style().lookup("TButton", "font")
+ 
+ 
+-   .. method:: layout(style[, layoutspec=None])
++   .. method:: layout(style, layoutspec=None)
+ 
+       Define the widget layout for given *style*. If *layoutspec* is omitted,
+       return the layout specification for given style.
+@@ -1318,7 +1318,7 @@
+       Returns the list of *elementname*'s options.
+ 
+ 
+-   .. method:: theme_create(themename[, parent=None[, settings=None]])
++   .. method:: theme_create(themename, parent=None, settings=None)
+ 
+       Create a new theme.
+ 
+diff -r 70274d53c1dd Doc/library/unittest.rst
+--- a/Doc/library/unittest.rst
++++ b/Doc/library/unittest.rst
+@@ -616,7 +616,7 @@
+ 
+ Classes can be skipped just like methods: ::
+ 
+-   @skip("showing class skipping")
++   @unittest.skip("showing class skipping")
+    class MySkippedTestCase(unittest.TestCase):
+        def test_not_run(self):
+            pass
+@@ -1426,8 +1426,8 @@
+    The :class:`TestLoader` class is used to create test suites from classes and
+    modules.  Normally, there is no need to create an instance of this class; the
+    :mod:`unittest` module provides an instance that can be shared as
+-   ``unittest.defaultTestLoader``. Using a subclass or instance, however, allows
+-   customization of some configurable properties.
++   :data:`unittest.defaultTestLoader`.  Using a subclass or instance, however,
++   allows customization of some configurable properties.
+ 
+    :class:`TestLoader` objects have the following methods:
+ 
+@@ -1784,11 +1784,12 @@
+             stream, descriptions, verbosity
+ 
+ 
+-.. function:: main([module[, defaultTest[, argv[, testRunner[, testLoader[, exit[, verbosity[, failfast[, catchbreak[,buffer]]]]]]]]]])
+-
+-   A command-line program that runs a set of tests; this is primarily for making
+-   test modules conveniently executable.  The simplest use for this function is to
+-   include the following line at the end of a test script::
++.. function:: main([module[, defaultTest[, argv[, testRunner[, testLoader[, exit[, verbosity[, failfast[, catchbreak[, buffer]]]]]]]]]])
++
++   A command-line program that loads a set of tests from *module* and runs them;
++   this is primarily for making test modules conveniently executable.
++   The simplest use for this function is to include the following line at the
++   end of a test script::
+ 
+       if __name__ == '__main__':
+           unittest.main()
+@@ -1799,10 +1800,17 @@
+       if __name__ == '__main__':
+           unittest.main(verbosity=2)
+ 
++   The *argv* argument can be a list of options passed to the program, with the
++   first element being the program name.  If not specified or ``None``,
++   the values of :data:`sys.argv` are used.
++
+    The *testRunner* argument can either be a test runner class or an already
+    created instance of it. By default ``main`` calls :func:`sys.exit` with
+    an exit code indicating success or failure of the tests run.
+ 
++   The *testLoader* argument has to be a :class:`TestLoader` instance,
++   and defaults to :data:`defaultTestLoader`.
++
+    ``main`` supports being used from the interactive interpreter by passing in the
+    argument ``exit=False``. This displays the result on standard output without
+    calling :func:`sys.exit`::
+@@ -1810,14 +1818,14 @@
+       >>> from unittest import main
+       >>> main(module='test_module', exit=False)
+ 
+-   The ``failfast``, ``catchbreak`` and ``buffer`` parameters have the same
++   The *failfast*, *catchbreak* and *buffer* parameters have the same
+    effect as the same-name `command-line options`_.
+ 
+    Calling ``main`` actually returns an instance of the ``TestProgram`` class.
+    This stores the result of the tests run as the ``result`` attribute.
+ 
+    .. versionchanged:: 2.7
+-      The ``exit``, ``verbosity``, ``failfast``, ``catchbreak`` and ``buffer``
++      The *exit*, *verbosity*, *failfast*, *catchbreak* and *buffer*
+       parameters were added.
+ 
+ 
+diff -r 70274d53c1dd Doc/library/urllib.rst
+--- a/Doc/library/urllib.rst
++++ b/Doc/library/urllib.rst
+@@ -6,11 +6,11 @@
+ 
+ .. note::
+     The :mod:`urllib` module has been split into parts and renamed in
+-    Python 3.0 to :mod:`urllib.request`, :mod:`urllib.parse`,
++    Python 3 to :mod:`urllib.request`, :mod:`urllib.parse`,
+     and :mod:`urllib.error`. The :term:`2to3` tool will automatically adapt
+-    imports when converting your sources to 3.0.
++    imports when converting your sources to Python 3.
+     Also note that the :func:`urllib.urlopen` function has been removed in
+-    Python 3.0 in favor of :func:`urllib2.urlopen`.
++    Python 3 in favor of :func:`urllib2.urlopen`.
+ 
+ .. index::
+    single: WWW
+@@ -131,7 +131,7 @@
+       :envvar:`no_proxy` environment variable.
+ 
+    .. deprecated:: 2.6
+-      The :func:`urlopen` function has been removed in Python 3.0 in favor
++      The :func:`urlopen` function has been removed in Python 3 in favor
+       of :func:`urllib2.urlopen`.
+ 
+ 
+diff -r 70274d53c1dd Doc/library/urllib2.rst
+--- a/Doc/library/urllib2.rst
++++ b/Doc/library/urllib2.rst
+@@ -9,9 +9,9 @@
+ 
+ .. note::
+    The :mod:`urllib2` module has been split across several modules in
+-   Python 3.0 named :mod:`urllib.request` and :mod:`urllib.error`.
++   Python 3 named :mod:`urllib.request` and :mod:`urllib.error`.
+    The :term:`2to3` tool will automatically adapt imports when converting
+-   your sources to 3.0.
++   your sources to Python 3.
+ 
+ 
+ The :mod:`urllib2` module defines functions and classes which help in opening
+@@ -380,6 +380,17 @@
+    Return the selector --- the part of the URL that is sent to the server.
+ 
+ 
++.. method:: Request.get_header(header_name, default=None)
++
++   Return the value of the given header. If the header is not present, return
++   the default value.
++
++
++.. method:: Request.header_items()
++
++   Return a list of tuples (header_name, header_value) of the Request headers.
++
++
+ .. method:: Request.set_proxy(host, type)
+ 
+    Prepare the request by connecting to a proxy server. The *host* and *type* will
+diff -r 70274d53c1dd Doc/library/urlparse.rst
+--- a/Doc/library/urlparse.rst
++++ b/Doc/library/urlparse.rst
+@@ -13,9 +13,9 @@
+    pair: relative; URL
+ 
+ .. note::
+-   The :mod:`urlparse` module is renamed to :mod:`urllib.parse` in Python 3.0.
++   The :mod:`urlparse` module is renamed to :mod:`urllib.parse` in Python 3.
+    The :term:`2to3` tool will automatically adapt imports when converting
+-   your sources to 3.0.
++   your sources to Python 3.
+ 
+ **Source code:** :source:`Lib/urlparse.py`
+ 
+@@ -27,11 +27,11 @@
+ to an absolute URL given a "base URL."
+ 
+ The module has been designed to match the Internet RFC on Relative Uniform
+-Resource Locators (and discovered a bug in an earlier draft!). It supports the
+-following URL schemes: ``file``, ``ftp``, ``gopher``, ``hdl``, ``http``,
+-``https``, ``imap``, ``mailto``, ``mms``, ``news``,  ``nntp``, ``prospero``,
+-``rsync``, ``rtsp``, ``rtspu``,  ``sftp``, ``shttp``, ``sip``, ``sips``,
+-``snews``, ``svn``,  ``svn+ssh``, ``telnet``, ``wais``.
++Resource Locators. It supports the following URL schemes: ``file``, ``ftp``,
++``gopher``, ``hdl``, ``http``, ``https``, ``imap``, ``mailto``, ``mms``,
++``news``,  ``nntp``, ``prospero``, ``rsync``, ``rtsp``, ``rtspu``,  ``sftp``,
++``shttp``, ``sip``, ``sips``, ``snews``, ``svn``,  ``svn+ssh``, ``telnet``,
++``wais``.
+ 
+ .. versionadded:: 2.5
+    Support for the ``sftp`` and ``sips`` schemes.
+diff -r 70274d53c1dd Doc/library/user.rst
+--- a/Doc/library/user.rst
++++ b/Doc/library/user.rst
+@@ -7,7 +7,7 @@
+    :deprecated:
+ 
+ .. deprecated:: 2.6
+-   The :mod:`user` module has been removed in Python 3.0.
++   The :mod:`user` module has been removed in Python 3.
+ 
+ .. index::
+    pair: .pythonrc.py; file
+diff -r 70274d53c1dd Doc/library/userdict.rst
+--- a/Doc/library/userdict.rst
++++ b/Doc/library/userdict.rst
+@@ -114,8 +114,8 @@
+ 
+    .. note::
+       The :class:`UserList` class has been moved to the :mod:`collections`
+-      module in Python 3.0. The :term:`2to3` tool will automatically adapt
+-      imports when converting your sources to 3.0.
++      module in Python 3. The :term:`2to3` tool will automatically adapt
++      imports when converting your sources to Python 3.
+ 
+ 
+ In addition to supporting the methods and operations of mutable sequences (see
+@@ -187,8 +187,8 @@
+ 
+    .. note::
+       The :class:`UserString` class has been moved to the :mod:`collections`
+-      module in Python 3.0. The :term:`2to3` tool will automatically adapt
+-      imports when converting your sources to 3.0.
++      module in Python 3. The :term:`2to3` tool will automatically adapt
++      imports when converting your sources to Python 3.
+ 
+ 
+ 
+@@ -203,7 +203,7 @@
+    hard to track down.
+ 
+    .. deprecated:: 2.6
+-      The :class:`MutableString` class has been removed in Python 3.0.
++      The :class:`MutableString` class has been removed in Python 3.
+ 
+ In addition to supporting the methods and operations of string and Unicode
+ objects (see section :ref:`string-methods`), :class:`UserString` instances
+diff -r 70274d53c1dd Doc/library/warnings.rst
+--- a/Doc/library/warnings.rst
++++ b/Doc/library/warnings.rst
+@@ -167,7 +167,8 @@
+ the command-line options passed to :option:`-W` and calls to
+ :func:`filterwarnings`.
+ 
+-* :exc:`PendingDeprecationWarning`, and :exc:`ImportWarning` are ignored.
++* :exc:`DeprecationWarning` and :exc:`PendingDeprecationWarning`, and
++  :exc:`ImportWarning` are ignored.
+ 
+ * :exc:`BytesWarning` is ignored unless the :option:`-b` option is given once or
+   twice; in this case this warning is either printed (``-b``) or turned into an
+@@ -418,7 +419,7 @@
+ 
+     .. note::
+ 
+-        In Python 3.0, the arguments to the constructor for
++        In Python 3, the arguments to the constructor for
+         :class:`catch_warnings` are keyword-only arguments.
+ 
+     .. versionadded:: 2.6
+diff -r 70274d53c1dd Doc/library/webbrowser.rst
+--- a/Doc/library/webbrowser.rst
++++ b/Doc/library/webbrowser.rst
+@@ -36,7 +36,9 @@
+ module. It accepts an URL as the argument. It accepts the following optional
+ parameters: ``-n`` opens the URL in a new browser window, if possible;
+ ``-t`` opens the URL in a new browser page ("tab"). The options are,
+-naturally, mutually exclusive.
++naturally, mutually exclusive.  Usage example::
++
++   python -m webbrowser -t "http://www.python.org"
+ 
+ The following exception is defined:
+ 
+@@ -48,7 +50,7 @@
+ The following functions are defined:
+ 
+ 
+-.. function:: open(url[, new=0[, autoraise=True]])
++.. function:: open(url, new=0, autoraise=True)
+ 
+    Display *url* using the default browser. If *new* is 0, the *url* is opened
+    in the same browser window if possible.  If *new* is 1, a new browser window
+@@ -138,9 +140,9 @@
+ +-----------------------+-----------------------------------------+-------+
+ | ``'windows-default'`` | :class:`WindowsDefault`                 | \(2)  |
+ +-----------------------+-----------------------------------------+-------+
+-| ``'internet-config'`` | :class:`InternetConfig`                 | \(3)  |
++| ``'macosx'``          | :class:`MacOSX('default')`              | \(3)  |
+ +-----------------------+-----------------------------------------+-------+
+-| ``'macosx'``          | :class:`MacOSX('default')`              | \(4)  |
++| ``'safari'``          | :class:`MacOSX('safari')`               | \(3)  |
+ +-----------------------+-----------------------------------------+-------+
+ 
+ Notes:
+@@ -156,9 +158,6 @@
+    Only on Windows platforms.
+ 
+ (3)
+-   Only on Mac OS platforms; requires the standard MacPython :mod:`ic` module.
+-
+-(4)
+    Only on Mac OS X platform.
+ 
+ Here are some simple examples::
+@@ -181,7 +180,7 @@
+ module-level convenience functions:
+ 
+ 
+-.. method:: controller.open(url[, new=0[, autoraise=True]])
++.. method:: controller.open(url, new=0, autoraise=True)
+ 
+    Display *url* using the browser handled by this controller. If *new* is 1, a new
+    browser window is opened if possible. If *new* is 2, a new browser page ("tab")
+diff -r 70274d53c1dd Doc/library/whichdb.rst
+--- a/Doc/library/whichdb.rst
++++ b/Doc/library/whichdb.rst
+@@ -6,8 +6,8 @@
+ 
+ .. note::
+    The :mod:`whichdb` module's only function has been put into the :mod:`dbm`
+-   module in Python 3.0.  The :term:`2to3` tool will automatically adapt imports
+-   when converting your sources to 3.0.
++   module in Python 3.  The :term:`2to3` tool will automatically adapt imports
++   when converting your sources to Python 3.
+ 
+ 
+ The single function in this module attempts to guess which of the several simple
+diff -r 70274d53c1dd Doc/library/wsgiref.rst
+--- a/Doc/library/wsgiref.rst
++++ b/Doc/library/wsgiref.rst
+@@ -59,7 +59,7 @@
+    found, and "http" otherwise.
+ 
+ 
+-.. function:: request_uri(environ [, include_query=1])
++.. function:: request_uri(environ, include_query=1)
+ 
+    Return the full request URI, optionally including the query string, using the
+    algorithm found in the "URL Reconstruction" section of :pep:`333`.  If
+@@ -148,7 +148,7 @@
+    :rfc:`2616`.
+ 
+ 
+-.. class:: FileWrapper(filelike [, blksize=8192])
++.. class:: FileWrapper(filelike, blksize=8192)
+ 
+    A wrapper to convert a file-like object to an :term:`iterator`.  The resulting objects
+    support both :meth:`__getitem__` and :meth:`__iter__` iteration styles, for
+@@ -271,7 +271,7 @@
+ :mod:`wsgiref.util`.)
+ 
+ 
+-.. function:: make_server(host, port, app [, server_class=WSGIServer [, handler_class=WSGIRequestHandler]])
++.. function:: make_server(host, port, app, server_class=WSGIServer, handler_class=WSGIRequestHandler)
+ 
+    Create a new WSGI server listening on *host* and *port*, accepting connections
+    for *app*.  The return value is an instance of the supplied *server_class*, and
+@@ -460,7 +460,7 @@
+    environment.
+ 
+ 
+-.. class:: BaseCGIHandler(stdin, stdout, stderr, environ [, multithread=True [, multiprocess=False]])
++.. class:: BaseCGIHandler(stdin, stdout, stderr, environ, multithread=True, multiprocess=False)
+ 
+    Similar to :class:`CGIHandler`, but instead of using the :mod:`sys` and
+    :mod:`os` modules, the CGI environment and I/O streams are specified explicitly.
+@@ -475,7 +475,7 @@
+    instead of :class:`SimpleHandler`.
+ 
+ 
+-.. class:: SimpleHandler(stdin, stdout, stderr, environ [,multithread=True [, multiprocess=False]])
++.. class:: SimpleHandler(stdin, stdout, stderr, environ, multithread=True, multiprocess=False)
+ 
+    Similar to :class:`BaseCGIHandler`, but designed for use with HTTP origin
+    servers.  If you are writing an HTTP server implementation, you will probably
+diff -r 70274d53c1dd Doc/library/xml.dom.minidom.rst
+--- a/Doc/library/xml.dom.minidom.rst
++++ b/Doc/library/xml.dom.minidom.rst
+@@ -18,6 +18,14 @@
+ Model interface.  It is intended to be simpler than the full DOM and also
+ significantly smaller.
+ 
++.. note::
++
++   The :mod:`xml.dom.minidom` module provides an implementation of the W3C-DOM,
++   with an API similar to that in other programming languages.  Users who are
++   unfamiliar with the W3C-DOM interface or who would like to write less code
++   for processing XML files should consider using the
++   :mod:`xml.etree.ElementTree` module instead.
++
+ DOM applications typically start by parsing some XML into a DOM.  With
+ :mod:`xml.dom.minidom`, this is done through the parse functions::
+ 
+@@ -121,7 +129,7 @@
+    to discard children of that node.
+ 
+ 
+-.. method:: Node.writexml(writer[, indent=""[, addindent=""[, newl=""]]])
++.. method:: Node.writexml(writer, indent="", addindent="", newl="")
+ 
+    Write XML to the writer object.  The writer should have a :meth:`write` method
+    which matches that of the file object interface.  The *indent* parameter is the
+diff -r 70274d53c1dd Doc/library/xmlrpclib.rst
+--- a/Doc/library/xmlrpclib.rst
++++ b/Doc/library/xmlrpclib.rst
+@@ -8,8 +8,8 @@
+ 
+ .. note::
+    The :mod:`xmlrpclib` module has been renamed to :mod:`xmlrpc.client` in
+-   Python 3.0.  The :term:`2to3` tool will automatically adapt imports when
+-   converting your sources to 3.0.
++   Python 3.  The :term:`2to3` tool will automatically adapt imports when
++   converting your sources to Python 3.
+ 
+ 
+ .. XXX Not everything is documented yet.  It might be good to describe
+diff -r 70274d53c1dd Doc/library/zipfile.rst
+--- a/Doc/library/zipfile.rst
++++ b/Doc/library/zipfile.rst
+@@ -25,9 +25,6 @@
+ create an encrypted file.  Decryption is extremely slow as it is
+ implemented in native Python rather than C.
+ 
+-For other archive formats, see the :mod:`bz2`, :mod:`gzip`, and
+-:mod:`tarfile` modules.
+-
+ The module defines the following items:
+ 
+ .. exception:: BadZipfile
+diff -r 70274d53c1dd Doc/library/zlib.rst
+--- a/Doc/library/zlib.rst
++++ b/Doc/library/zlib.rst
+@@ -19,9 +19,7 @@
+ consult the zlib manual at http://www.zlib.net/manual.html for authoritative
+ information.
+ 
+-For reading and writing ``.gz`` files see the :mod:`gzip` module. For
+-other archive formats, see the :mod:`bz2`, :mod:`zipfile`, and
+-:mod:`tarfile` modules.
++For reading and writing ``.gz`` files see the :mod:`gzip` module.
+ 
+ The available exception and functions in this module are:
+ 
+diff -r 70274d53c1dd Doc/reference/compound_stmts.rst
+--- a/Doc/reference/compound_stmts.rst
++++ b/Doc/reference/compound_stmts.rst
+@@ -290,15 +290,28 @@
+ 
+ .. index:: keyword: finally
+ 
+-If :keyword:`finally` is present, it specifies a 'cleanup' handler.  The
+-:keyword:`try` clause is executed, including any :keyword:`except` and
+-:keyword:`else` clauses.  If an exception occurs in any of the clauses and is
+-not handled, the exception is temporarily saved. The :keyword:`finally` clause
+-is executed.  If there is a saved exception, it is re-raised at the end of the
+-:keyword:`finally` clause. If the :keyword:`finally` clause raises another
+-exception or executes a :keyword:`return` or :keyword:`break` statement, the
+-saved exception is lost.  The exception information is not available to the
+-program during execution of the :keyword:`finally` clause.
++If :keyword:`finally` is present, it specifies a 'cleanup' handler.
++The :keyword:`try` clause is executed, including any :keyword:`except`
++and :keyword:`else` clauses.  If an exception occurs in any of the
++clauses and is not handled, the exception is temporarily saved. The
++:keyword:`finally` clause is executed.  If there is a saved exception
++or :keyword:`break` statement, it is re-raised at the end of the
++:keyword:`finally` clause. If the :keyword:`finally` clause raises
++another exception the saved exception is set as the context of the new
++exception; if the :keyword:`finally` clause executes a
++:keyword:`return` statement, the saved exception is discarded::
++
++    def f():
++        try:
++            1/0
++        finally:
++            return 42
++
++    >>> f()
++    42
++
++The exception information is not available to the program during execution of
++the :keyword:`finally` clause.
+ 
+ .. index::
+    statement: return
+diff -r 70274d53c1dd Doc/reference/datamodel.rst
+--- a/Doc/reference/datamodel.rst
++++ b/Doc/reference/datamodel.rst
+@@ -573,7 +573,7 @@
+          :attr:`im_self` used to refer to the class that defined the method.
+ 
+       .. versionchanged:: 2.6
+-         For 3.0 forward-compatibility, :attr:`im_func` is also available as
++         For Python 3 forward-compatibility, :attr:`im_func` is also available as
+          :attr:`__func__`, and :attr:`im_self` as :attr:`__self__`.
+ 
+       .. index::
+@@ -1149,7 +1149,7 @@
+    single: class; classic
+    single: class; old-style
+ 
+-Old-style classes are removed in Python 3.0, leaving only the semantics of
++Old-style classes are removed in Python 3, leaving only the semantics of
+ new-style classes.
+ 
+ 
+@@ -2235,7 +2235,7 @@
+ This section used to document the rules for coercion.  As the language has
+ evolved, the coercion rules have become hard to document precisely; documenting
+ what one version of one particular implementation does is undesirable.  Instead,
+-here are some informal guidelines regarding coercion.  In Python 3.0, coercion
++here are some informal guidelines regarding coercion.  In Python 3, coercion
+ will not be supported.
+ 
+ *
+diff -r 70274d53c1dd Doc/reference/expressions.rst
+--- a/Doc/reference/expressions.rst
++++ b/Doc/reference/expressions.rst
+@@ -1392,7 +1392,7 @@
+ 
+ .. [#] In Python 2.3 and later releases, a list comprehension "leaks" the control
+    variables of each ``for`` it contains into the containing scope.  However, this
+-   behavior is deprecated, and relying on it will not work in Python 3.0
++   behavior is deprecated, and relying on it will not work in Python 3.
+ 
+ .. [#] While ``abs(x%y) < abs(y)`` is true mathematically, for floats it may not be
+    true numerically due to roundoff.  For example, and assuming a platform on which
+diff -r 70274d53c1dd Doc/reference/simple_stmts.rst
+--- a/Doc/reference/simple_stmts.rst
++++ b/Doc/reference/simple_stmts.rst
+@@ -993,6 +993,9 @@
+ it should be a dictionary, which will be used for both the global and the local
+ variables.  If two expressions are given, they are used for the global and local
+ variables, respectively. If provided, *locals* can be any mapping object.
++Remember that at module level, globals and locals are the same dictionary. If
++two separate objects are given as *globals* and *locals*, the code will be
++executed as if it were embedded in a class definition.
+ 
+ .. versionchanged:: 2.4
+    Formerly, *locals* was required to be a dictionary.
+diff -r 70274d53c1dd Doc/tools/sphinxext/download.html
+--- a/Doc/tools/sphinxext/download.html
++++ b/Doc/tools/sphinxext/download.html
+@@ -35,8 +35,12 @@
+   </tr>
+ </table>
+ 
++<p>These archives contain all the content in the documentation.</p>
+ 
+-<p>These archives contain all the content in the documentation.</p>
++<p>HTML Help (<tt>.chm</tt>) files are made available in the "Windows" section
++on the <a href="http://python.org/download/releases/{{ release[:5] }}/">Python
++download page</a>.</p>
++
+ 
+ <h2>Unpacking</h2>
+ 
+diff -r 70274d53c1dd Doc/tools/sphinxext/indexsidebar.html
+--- a/Doc/tools/sphinxext/indexsidebar.html
++++ b/Doc/tools/sphinxext/indexsidebar.html
+@@ -11,13 +11,8 @@
+             <h3>Other resources</h3>
+             <ul>
+               {# XXX: many of these should probably be merged in the main docs #}
+-              <li><a href="http://www.python.org/doc/faq/">FAQs</a></li>
+-              <li><a href="http://www.python.org/doc/essays/">Guido's Essays</a></li>
+-              <li><a href="http://www.python.org/doc/newstyle/">New-style Classes</a></li>
+               <li><a href="http://www.python.org/dev/peps/">PEP Index</a></li>
+               <li><a href="http://wiki.python.org/moin/BeginnersGuide">Beginner's Guide</a></li>
+               <li><a href="http://wiki.python.org/moin/PythonBooks">Book List</a></li>
+               <li><a href="http://www.python.org/doc/av/">Audio/Visual Talks</a></li>
+-              <li><a href="http://www.python.org/doc/other/">Other Doc Collections</a></li>
+-              <li><a href="{{ pathto('bugs') }}">Report a Bug</a></li>
+             </ul>
+diff -r 70274d53c1dd Doc/tutorial/classes.rst
+--- a/Doc/tutorial/classes.rst
++++ b/Doc/tutorial/classes.rst
+@@ -534,8 +534,8 @@
+ 
+ .. _tut-private:
+ 
+-Private Variables
+-=================
++Private Variables and Class-local References
++============================================
+ 
+ "Private" instance variables that cannot be accessed except from inside an
+ object don't exist in Python.  However, there is a convention that is followed
+diff -r 70274d53c1dd Doc/tutorial/controlflow.rst
+--- a/Doc/tutorial/controlflow.rst
++++ b/Doc/tutorial/controlflow.rst
+@@ -129,9 +129,6 @@
+ The :keyword:`break` statement, like in C, breaks out of the smallest enclosing
+ :keyword:`for` or :keyword:`while` loop.
+ 
+-The :keyword:`continue` statement, also borrowed from C, continues with the next
+-iteration of the loop.
+-
+ Loop statements may have an ``else`` clause; it is executed when the loop
+ terminates through exhaustion of the list (with :keyword:`for`) or when the
+ condition becomes false (with :keyword:`while`), but not when the loop is
+@@ -159,6 +156,29 @@
+ (Yes, this is the correct code.  Look closely: the ``else`` clause belongs to
+ the :keyword:`for` loop, **not** the :keyword:`if` statement.)
+ 
++When used with a loop, the ``else`` clause has more in common with the
++``else`` clause of a :keyword:`try` statement than it does that of
++:keyword:`if` statements: a :keyword:`try` statement's ``else`` clause runs
++when no exception occurs, and a loop's ``else`` clause runs when no ``break``
++occurs. For more on the :keyword:`try` statement and exceptions, see
++:ref:`tut-handling`.
++
++The :keyword:`continue` statement, also borrowed from C, continues with the next
++iteration of the loop::
++
++    >>> for num in range(2, 10):
++    ...     if x % 2 == 0:
++    ...         print("Found an even number", num)
++    ...         continue
++    ...     print("Found a number", num)
++    Found an even number 2
++    Found a number 3
++    Found an even number 4
++    Found a number 5
++    Found an even number 6
++    Found a number 7
++    Found an even number 8
++    Found a number 9
+ 
+ .. _tut-pass:
+ 
+diff -r 70274d53c1dd Doc/tutorial/datastructures.rst
+--- a/Doc/tutorial/datastructures.rst
++++ b/Doc/tutorial/datastructures.rst
+@@ -423,17 +423,31 @@
+    ... u = t, (1, 2, 3, 4, 5)
+    >>> u
+    ((12345, 54321, 'hello!'), (1, 2, 3, 4, 5))
++   >>> # Tuples are immutable:
++   ... t[0] = 88888
++   Traceback (most recent call last):
++     File "<stdin>", line 1, in <module>
++   TypeError: 'tuple' object does not support item assignment
++   >>> # but they can contain mutable objects:
++   ... v = ([1, 2, 3], [3, 2, 1])
++   >>> v
++   ([1, 2, 3], [3, 2, 1])
++
+ 
+ As you see, on output tuples are always enclosed in parentheses, so that nested
+ tuples are interpreted correctly; they may be input with or without surrounding
+ parentheses, although often parentheses are necessary anyway (if the tuple is
+-part of a larger expression).
++part of a larger expression).  It is not possible to assign to the individual
++items of a tuple, however it is possible to create tuples which contain mutable
++objects, such as lists.
+ 
+-Tuples have many uses.  For example: (x, y) coordinate pairs, employee records
+-from a database, etc.  Tuples, like strings, are immutable: it is not possible
+-to assign to the individual items of a tuple (you can simulate much of the same
+-effect with slicing and concatenation, though).  It is also possible to create
+-tuples which contain mutable objects, such as lists.
++Though tuples may seem similar to lists, they are often used in different
++situations and for different purposes.
++Tuples are :term:`immutable`, and usually contain an heterogeneous sequence of
++elements that are accessed via unpacking (see later in this section) or indexing
++(or even by attribute in the case of :func:`namedtuples <collections.namedtuple>`).
++Lists are :term:`mutable`, and their elements are usually homogeneous and are
++accessed by iterating over the list.
+ 
+ A special problem is the construction of tuples containing 0 or 1 items: the
+ syntax has some extra quirks to accommodate these.  Empty tuples are constructed
+@@ -462,8 +476,6 @@
+ sequence.  Note that multiple assignment is really just a combination of tuple
+ packing and sequence unpacking.
+ 
+-.. XXX Add a bit on the difference between tuples and lists.
+-
+ 
+ .. _tut-sets:
+ 
+@@ -577,16 +589,6 @@
+ Looping Techniques
+ ==================
+ 
+-When looping through dictionaries, the key and corresponding value can be
+-retrieved at the same time using the :meth:`iteritems` method. ::
+-
+-   >>> knights = {'gallahad': 'the pure', 'robin': 'the brave'}
+-   >>> for k, v in knights.iteritems():
+-   ...     print k, v
+-   ...
+-   gallahad the pure
+-   robin the brave
+-
+ When looping through a sequence, the position index and corresponding value can
+ be retrieved at the same time using the :func:`enumerate` function. ::
+ 
+@@ -633,6 +635,16 @@
+    orange
+    pear
+ 
++When looping through dictionaries, the key and corresponding value can be
++retrieved at the same time using the :meth:`iteritems` method. ::
++
++   >>> knights = {'gallahad': 'the pure', 'robin': 'the brave'}
++   >>> for k, v in knights.iteritems():
++   ...     print k, v
++   ...
++   gallahad the pure
++   robin the brave
++
+ 
+ .. _tut-conditions:
+ 
+diff -r 70274d53c1dd Doc/tutorial/errors.rst
+--- a/Doc/tutorial/errors.rst
++++ b/Doc/tutorial/errors.rst
+@@ -120,6 +120,14 @@
+    ... except (RuntimeError, TypeError, NameError):
+    ...     pass
+ 
++Note that the parentheses around this tuple are required, because
++``except ValueError, e:`` was the syntax used for what is normally
++written as ``except ValueError as e:`` in modern Python (described
++below). The old syntax is still supported for backwards compatibility.
++This means ``except RuntimeError, TypeError`` is not equivalent to
++``except (RuntimeError, TypeError):`` but to ``except RuntimeError as
++TypeError:`` which is not what you want.
++
+ The last except clause may omit the exception name(s), to serve as a wildcard.
+ Use this with extreme caution, since it is easy to mask a real programming error
+ in this way!  It can also be used to print an error message and then re-raise
+@@ -131,8 +139,8 @@
+        f = open('myfile.txt')
+        s = f.readline()
+        i = int(s.strip())
+-   except IOError as (errno, strerror):
+-       print "I/O error({0}): {1}".format(errno, strerror)
++   except IOError as e:
++       print "I/O error({0}): {1}".format(e.errno, e.strerror)
+    except ValueError:
+        print "Could not convert data to an integer."
+    except:
+@@ -177,7 +185,7 @@
+    ...    print type(inst)     # the exception instance
+    ...    print inst.args      # arguments stored in .args
+    ...    print inst           # __str__ allows args to printed directly
+-   ...    x, y = inst          # __getitem__ allows args to be unpacked directly
++   ...    x, y = inst.args
+    ...    print 'x =', x
+    ...    print 'y =', y
+    ...
+diff -r 70274d53c1dd Doc/tutorial/inputoutput.rst
+--- a/Doc/tutorial/inputoutput.rst
++++ b/Doc/tutorial/inputoutput.rst
+@@ -37,7 +37,7 @@
+ The :func:`str` function is meant to return representations of values which are
+ fairly human-readable, while :func:`repr` is meant to generate representations
+ which can be read by the interpreter (or will force a :exc:`SyntaxError` if
+-there is not equivalent syntax).  For objects which don't have a particular
++there is no equivalent syntax).  For objects which don't have a particular
+ representation for human consumption, :func:`str` will return the same value as
+ :func:`repr`.  Many values, such as numbers or structures like lists and
+ dictionaries, have the same representation using either function.  Strings and
+diff -r 70274d53c1dd Doc/tutorial/modules.rst
+--- a/Doc/tutorial/modules.rst
++++ b/Doc/tutorial/modules.rst
+@@ -242,7 +242,7 @@
+ are not part of the core of the language but are nevertheless built in, either
+ for efficiency or to provide access to operating system primitives such as
+ system calls.  The set of such modules is a configuration option which also
+-depends on the underlying platform For example, the :mod:`winreg` module is only
++depends on the underlying platform.  For example, the :mod:`winreg` module is only
+ provided on Windows systems. One particular module deserves some attention:
+ :mod:`sys`, which is built into every Python interpreter.  The variables
+ ``sys.ps1`` and ``sys.ps2`` define the strings used as primary and secondary
+diff -r 70274d53c1dd Doc/using/cmdline.rst
+--- a/Doc/using/cmdline.rst
++++ b/Doc/using/cmdline.rst
+@@ -541,7 +541,8 @@
+ .. envvar:: PYTHONDONTWRITEBYTECODE
+ 
+    If this is set, Python won't try to write ``.pyc`` or ``.pyo`` files on the
+-   import of source modules.
++   import of source modules.  This is equivalent to specifying the :option:`-B`
++   option.
+ 
+    .. versionadded:: 2.6
+ 
+diff -r 70274d53c1dd Doc/using/unix.rst
+--- a/Doc/using/unix.rst
++++ b/Doc/using/unix.rst
+@@ -145,7 +145,7 @@
+ * http://sourceforge.net/projects/python-mode
+ 
+ Geany is an excellent IDE with support for a lot of languages. For more
+-information, read: http://geany.uvena.de/
++information, read: http://www.geany.org/
+ 
+ Komodo edit is another extremely good IDE.  It also has support for a lot of
+ languages. For more information, read:
+diff -r 70274d53c1dd Include/node.h
+--- a/Include/node.h
++++ b/Include/node.h
+@@ -20,6 +20,9 @@
+ PyAPI_FUNC(int) PyNode_AddChild(node *n, int type,
+                                       char *str, int lineno, int col_offset);
+ PyAPI_FUNC(void) PyNode_Free(node *n);
++#ifndef Py_LIMITED_API
++Py_ssize_t _PyNode_SizeOf(node *n);
++#endif
+ 
+ /* Node access functions */
+ #define NCH(n)		((n)->n_nchildren)
+diff -r 70274d53c1dd Include/patchlevel.h
+--- a/Include/patchlevel.h
++++ b/Include/patchlevel.h
+@@ -6,7 +6,7 @@
+    defined(PY_MAJOR_VERSION).
+ 
+    When the major or minor version changes, the VERSION variable in
+-   configure.in must also be changed.
++   configure.ac must also be changed.
+ 
+    There is also (independent) API version information in modsupport.h.
+ */
+diff -r 70274d53c1dd Include/pyport.h
+--- a/Include/pyport.h
++++ b/Include/pyport.h
+@@ -549,6 +549,30 @@
+         _Py_set_387controlword(old_387controlword)
+ #endif
+ 
++/* get and set x87 control word for VisualStudio/x86 */
++#if defined(_MSC_VER) && !defined(_WIN64) /* x87 not supported in 64-bit */
++#define HAVE_PY_SET_53BIT_PRECISION 1
++#define _Py_SET_53BIT_PRECISION_HEADER \
++    unsigned int old_387controlword, new_387controlword, out_387controlword
++/* We use the __control87_2 function to set only the x87 control word.
++   The SSE control word is unaffected. */
++#define _Py_SET_53BIT_PRECISION_START                                   \
++    do {                                                                \
++        __control87_2(0, 0, &old_387controlword, NULL);                 \
++        new_387controlword =                                            \
++          (old_387controlword & ~(_MCW_PC | _MCW_RC)) | (_PC_53 | _RC_NEAR); \
++        if (new_387controlword != old_387controlword)                   \
++            __control87_2(new_387controlword, _MCW_PC | _MCW_RC,        \
++                          &out_387controlword, NULL);                   \
++    } while (0)
++#define _Py_SET_53BIT_PRECISION_END                                     \
++    do {                                                                \
++        if (new_387controlword != old_387controlword)                   \
++            __control87_2(old_387controlword, _MCW_PC | _MCW_RC,        \
++                          &out_387controlword, NULL);                   \
++    } while (0)
++#endif
++
+ /* default definitions are empty */
+ #ifndef HAVE_PY_SET_53BIT_PRECISION
+ #define _Py_SET_53BIT_PRECISION_HEADER
+diff -r 70274d53c1dd Lib/BaseHTTPServer.py
+--- a/Lib/BaseHTTPServer.py
++++ b/Lib/BaseHTTPServer.py
+@@ -447,13 +447,13 @@
+         specified as subsequent arguments (it's just like
+         printf!).
+ 
+-        The client host and current date/time are prefixed to
+-        every message.
++        The client ip address and current date/time are prefixed to every
++        message.
+ 
+         """
+ 
+         sys.stderr.write("%s - - [%s] %s\n" %
+-                         (self.address_string(),
++                         (self.client_address[0],
+                           self.log_date_time_string(),
+                           format%args))
+ 
+diff -r 70274d53c1dd Lib/CGIHTTPServer.py
+--- a/Lib/CGIHTTPServer.py
++++ b/Lib/CGIHTTPServer.py
+@@ -84,9 +84,11 @@
+         path begins with one of the strings in self.cgi_directories
+         (and the next character is a '/' or the end of the string).
+         """
+-        splitpath = _url_collapse_path_split(self.path)
+-        if splitpath[0] in self.cgi_directories:
+-            self.cgi_info = splitpath
++        collapsed_path = _url_collapse_path(self.path)
++        dir_sep = collapsed_path.find('/', 1)
++        head, tail = collapsed_path[:dir_sep], collapsed_path[dir_sep+1:]
++        if head in self.cgi_directories:
++            self.cgi_info = head, tail
+             return True
+         return False
+ 
+@@ -298,44 +300,46 @@
+                 self.log_message("CGI script exited OK")
+ 
+ 
+-# TODO(gregory.p.smith): Move this into an appropriate library.
+-def _url_collapse_path_split(path):
++def _url_collapse_path(path):
+     """
+     Given a URL path, remove extra '/'s and '.' path elements and collapse
+-    any '..' references.
++    any '..' references and returns a colllapsed path.
+ 
+     Implements something akin to RFC-2396 5.2 step 6 to parse relative paths.
++    The utility of this function is limited to is_cgi method and helps
++    preventing some security attacks.
+ 
+     Returns: A tuple of (head, tail) where tail is everything after the final /
+     and head is everything before it.  Head will always start with a '/' and,
+     if it contains anything else, never have a trailing '/'.
+ 
+     Raises: IndexError if too many '..' occur within the path.
++
+     """
+     # Similar to os.path.split(os.path.normpath(path)) but specific to URL
+     # path semantics rather than local operating system semantics.
+-    path_parts = []
+-    for part in path.split('/'):
+-        if part == '.':
+-            path_parts.append('')
+-        else:
+-            path_parts.append(part)
+-    # Filter out blank non trailing parts before consuming the '..'.
+-    path_parts = [part for part in path_parts[:-1] if part] + path_parts[-1:]
++    path_parts = path.split('/')
++    head_parts = []
++    for part in path_parts[:-1]:
++        if part == '..':
++            head_parts.pop() # IndexError if more '..' than prior parts
++        elif part and part != '.':
++            head_parts.append( part )
+     if path_parts:
+         tail_part = path_parts.pop()
++        if tail_part:
++            if tail_part == '..':
++                head_parts.pop()
++                tail_part = ''
++            elif tail_part == '.':
++                tail_part = ''
+     else:
+         tail_part = ''
+-    head_parts = []
+-    for part in path_parts:
+-        if part == '..':
+-            head_parts.pop()
+-        else:
+-            head_parts.append(part)
+-    if tail_part and tail_part == '..':
+-        head_parts.pop()
+-        tail_part = ''
+-    return ('/' + '/'.join(head_parts), tail_part)
++
++    splitpath = ('/' + '/'.join(head_parts), tail_part)
++    collapsed_path = "/".join(splitpath)
++
++    return collapsed_path
+ 
+ 
+ nobody = None
+diff -r 70274d53c1dd Lib/Cookie.py
+--- a/Lib/Cookie.py
++++ b/Lib/Cookie.py
+@@ -390,7 +390,7 @@
+     from time import gmtime, time
+     now = time()
+     year, month, day, hh, mm, ss, wd, y, z = gmtime(now + future)
+-    return "%s, %02d-%3s-%4d %02d:%02d:%02d GMT" % \
++    return "%s, %02d %3s %4d %02d:%02d:%02d GMT" % \
+            (weekdayname[wd], day, monthname[month], year, hh, mm, ss)
+ 
+ 
+@@ -539,7 +539,7 @@
+     r"(?P<val>"                   # Start of group 'val'
+     r'"(?:[^\\"]|\\.)*"'            # Any doublequoted string
+     r"|"                            # or
+-    r"\w{3},\s[\w\d-]{9,11}\s[\d:]{8}\sGMT" # Special case for "expires" attr
++    r"\w{3},\s[\s\w\d-]{9,11}\s[\d:]{8}\sGMT" # Special case for "expires" attr
+     r"|"                            # or
+     ""+ _LegalCharsPatt +"*"        # Any word or empty string
+     r")"                          # End of group 'val'
+diff -r 70274d53c1dd Lib/HTMLParser.py
+--- a/Lib/HTMLParser.py
++++ b/Lib/HTMLParser.py
+@@ -22,13 +22,13 @@
+ starttagopen = re.compile('<[a-zA-Z]')
+ piclose = re.compile('>')
+ commentclose = re.compile(r'--\s*>')
+-tagfind = re.compile('[a-zA-Z][-.a-zA-Z0-9:_]*')
++tagfind = re.compile('([a-zA-Z][-.a-zA-Z0-9:_]*)(?:\s|/(?!>))*')
+ # see http://www.w3.org/TR/html5/tokenization.html#tag-open-state
+ # and http://www.w3.org/TR/html5/tokenization.html#tag-name-state
+ tagfind_tolerant = re.compile('[a-zA-Z][^\t\n\r\f />\x00]*')
+ 
+ attrfind = re.compile(
+-    r'[\s/]*((?<=[\'"\s/])[^\s/>][^\s/=>]*)(\s*=+\s*'
++    r'((?<=[\'"\s/])[^\s/>][^\s/=>]*)(\s*=+\s*'
+     r'(\'[^\']*\'|"[^"]*"|(?![\'"])[^>\s]*))?(?:\s|/(?!>))*')
+ 
+ locatestarttagend = re.compile(r"""
+@@ -289,7 +289,7 @@
+         match = tagfind.match(rawdata, i+1)
+         assert match, 'unexpected call to parse_starttag()'
+         k = match.end()
+-        self.lasttag = tag = rawdata[i+1:k].lower()
++        self.lasttag = tag = match.group(1).lower()
+ 
+         while k < endpos:
+             m = attrfind.match(rawdata, k)
+diff -r 70274d53c1dd Lib/SimpleXMLRPCServer.py
+--- a/Lib/SimpleXMLRPCServer.py
++++ b/Lib/SimpleXMLRPCServer.py
+@@ -1,4 +1,4 @@
+-"""Simple XML-RPC Server.
++r"""Simple XML-RPC Server.
+ 
+ This module can be used to create simple XML-RPC servers
+ by creating a server and either installing functions, a
+diff -r 70274d53c1dd Lib/SocketServer.py
+--- a/Lib/SocketServer.py
++++ b/Lib/SocketServer.py
+@@ -133,6 +133,7 @@
+ import select
+ import sys
+ import os
++import errno
+ try:
+     import threading
+ except ImportError:
+@@ -147,6 +148,15 @@
+                     "ThreadingUnixStreamServer",
+                     "ThreadingUnixDatagramServer"])
+ 
++def _eintr_retry(func, *args):
++    """restart a system call interrupted by EINTR"""
++    while True:
++        try:
++            return func(*args)
++        except (OSError, select.error) as e:
++            if e.args[0] != errno.EINTR:
++                raise
++
+ class BaseServer:
+ 
+     """Base class for server classes.
+@@ -222,7 +232,8 @@
+                 # connecting to the socket to wake this up instead of
+                 # polling. Polling reduces our responsiveness to a
+                 # shutdown request and wastes cpu at all other times.
+-                r, w, e = select.select([self], [], [], poll_interval)
++                r, w, e = _eintr_retry(select.select, [self], [], [],
++                                       poll_interval)
+                 if self in r:
+                     self._handle_request_noblock()
+         finally:
+@@ -262,7 +273,7 @@
+             timeout = self.timeout
+         elif self.timeout is not None:
+             timeout = min(timeout, self.timeout)
+-        fd_sets = select.select([self], [], [], timeout)
++        fd_sets = _eintr_retry(select.select, [self], [], [], timeout)
+         if not fd_sets[0]:
+             self.handle_timeout()
+             return
+diff -r 70274d53c1dd Lib/__future__.py
+--- a/Lib/__future__.py
++++ b/Lib/__future__.py
+@@ -112,7 +112,7 @@
+                     CO_FUTURE_DIVISION)
+ 
+ absolute_import = _Feature((2, 5, 0, "alpha", 1),
+-                           (2, 7, 0, "alpha", 0),
++                           (3, 0, 0, "alpha", 0),
+                            CO_FUTURE_ABSOLUTE_IMPORT)
+ 
+ with_statement = _Feature((2, 5, 0, "alpha", 1),
+diff -r 70274d53c1dd Lib/_pyio.py
+--- a/Lib/_pyio.py
++++ b/Lib/_pyio.py
+@@ -1451,7 +1451,7 @@
+     enabled.  With this enabled, on input, the lines endings '\n', '\r',
+     or '\r\n' are translated to '\n' before being returned to the
+     caller. Conversely, on output, '\n' is translated to the system
+-    default line seperator, os.linesep. If newline is any other of its
++    default line separator, os.linesep. If newline is any other of its
+     legal values, that newline becomes the newline when the file is read
+     and it is returned untranslated. On output, '\n' is converted to the
+     newline.
+diff -r 70274d53c1dd Lib/_strptime.py
+--- a/Lib/_strptime.py
++++ b/Lib/_strptime.py
+@@ -326,7 +326,8 @@
+     if len(data_string) != found.end():
+         raise ValueError("unconverted data remains: %s" %
+                           data_string[found.end():])
+-    year = 1900
++
++    year = None
+     month = day = 1
+     hour = minute = second = fraction = 0
+     tz = -1
+@@ -425,6 +426,12 @@
+                     else:
+                         tz = value
+                         break
++    leap_year_fix = False
++    if year is None and month == 2 and day == 29:
++        year = 1904  # 1904 is first leap year of 20th century
++        leap_year_fix = True
++    elif year is None:
++        year = 1900
+     # If we know the week of the year and what day of that week, we can figure
+     # out the Julian day of the year.
+     if julian == -1 and week_of_year != -1 and weekday != -1:
+@@ -446,6 +453,12 @@
+         day = datetime_result.day
+     if weekday == -1:
+         weekday = datetime_date(year, month, day).weekday()
++    if leap_year_fix:
++        # the caller didn't supply a year but asked for Feb 29th. We couldn't
++        # use the default of 1900 for computations. We set it back to ensure
++        # that February 29th is smaller than March 1st.
++        year = 1900
++
+     return (time.struct_time((year, month, day,
+                               hour, minute, second,
+                               weekday, julian, tz)), fraction)
+diff -r 70274d53c1dd Lib/_weakrefset.py
+--- a/Lib/_weakrefset.py
++++ b/Lib/_weakrefset.py
+@@ -63,7 +63,7 @@
+                     yield item
+ 
+     def __len__(self):
+-        return sum(x() is not None for x in self.data)
++        return len(self.data) - len(self._pending_removals)
+ 
+     def __contains__(self, item):
+         try:
+@@ -116,36 +116,21 @@
+     def update(self, other):
+         if self._pending_removals:
+             self._commit_removals()
+-        if isinstance(other, self.__class__):
+-            self.data.update(other.data)
+-        else:
+-            for element in other:
+-                self.add(element)
++        for element in other:
++            self.add(element)
+ 
+     def __ior__(self, other):
+         self.update(other)
+         return self
+ 
+-    # Helper functions for simple delegating methods.
+-    def _apply(self, other, method):
+-        if not isinstance(other, self.__class__):
+-            other = self.__class__(other)
+-        newdata = method(other.data)
+-        newset = self.__class__()
+-        newset.data = newdata
++    def difference(self, other):
++        newset = self.copy()
++        newset.difference_update(other)
+         return newset
+-
+-    def difference(self, other):
+-        return self._apply(other, self.data.difference)
+     __sub__ = difference
+ 
+     def difference_update(self, other):
+-        if self._pending_removals:
+-            self._commit_removals()
+-        if self is other:
+-            self.data.clear()
+-        else:
+-            self.data.difference_update(ref(item) for item in other)
++        self.__isub__(other)
+     def __isub__(self, other):
+         if self._pending_removals:
+             self._commit_removals()
+@@ -156,13 +141,11 @@
+         return self
+ 
+     def intersection(self, other):
+-        return self._apply(other, self.data.intersection)
++        return self.__class__(item for item in other if item in self)
+     __and__ = intersection
+ 
+     def intersection_update(self, other):
+-        if self._pending_removals:
+-            self._commit_removals()
+-        self.data.intersection_update(ref(item) for item in other)
++        self.__iand__(other)
+     def __iand__(self, other):
+         if self._pending_removals:
+             self._commit_removals()
+@@ -171,17 +154,17 @@
+ 
+     def issubset(self, other):
+         return self.data.issubset(ref(item) for item in other)
+-    __lt__ = issubset
++    __le__ = issubset
+ 
+-    def __le__(self, other):
+-        return self.data <= set(ref(item) for item in other)
++    def __lt__(self, other):
++        return self.data < set(ref(item) for item in other)
+ 
+     def issuperset(self, other):
+         return self.data.issuperset(ref(item) for item in other)
+-    __gt__ = issuperset
++    __ge__ = issuperset
+ 
+-    def __ge__(self, other):
+-        return self.data >= set(ref(item) for item in other)
++    def __gt__(self, other):
++        return self.data > set(ref(item) for item in other)
+ 
+     def __eq__(self, other):
+         if not isinstance(other, self.__class__):
+@@ -189,27 +172,24 @@
+         return self.data == set(ref(item) for item in other)
+ 
+     def symmetric_difference(self, other):
+-        return self._apply(other, self.data.symmetric_difference)
++        newset = self.copy()
++        newset.symmetric_difference_update(other)
++        return newset
+     __xor__ = symmetric_difference
+ 
+     def symmetric_difference_update(self, other):
+-        if self._pending_removals:
+-            self._commit_removals()
+-        if self is other:
+-            self.data.clear()
+-        else:
+-            self.data.symmetric_difference_update(ref(item) for item in other)
++        self.__ixor__(other)
+     def __ixor__(self, other):
+         if self._pending_removals:
+             self._commit_removals()
+         if self is other:
+             self.data.clear()
+         else:
+-            self.data.symmetric_difference_update(ref(item) for item in other)
++            self.data.symmetric_difference_update(ref(item, self._remove) for item in other)
+         return self
+ 
+     def union(self, other):
+-        return self._apply(other, self.data.union)
++        return self.__class__(e for s in (self, other) for e in s)
+     __or__ = union
+ 
+     def isdisjoint(self, other):
+diff -r 70274d53c1dd Lib/argparse.py
+--- a/Lib/argparse.py
++++ b/Lib/argparse.py
+@@ -740,10 +740,10 @@
+ 
+         - default -- The value to be produced if the option is not specified.
+ 
+-        - type -- The type which the command-line arguments should be converted
+-            to, should be one of 'string', 'int', 'float', 'complex' or a
+-            callable object that accepts a single string argument. If None,
+-            'string' is assumed.
++        - type -- A callable that accepts a single string argument, and
++            returns the converted value.  The standard Python types str, int,
++            float, and complex are useful examples of such callables.  If None,
++            str is used.
+ 
+         - choices -- A container of values that should be allowed. If not None,
+             after a command-line argument has been converted to the appropriate
+@@ -1967,7 +1967,7 @@
+         for arg_string in arg_strings:
+ 
+             # for regular arguments, just add them back into the list
+-            if arg_string[0] not in self.fromfile_prefix_chars:
++            if not arg_string or arg_string[0] not in self.fromfile_prefix_chars:
+                 new_arg_strings.append(arg_string)
+ 
+             # replace arguments referencing files with the file content
+@@ -2174,9 +2174,12 @@
+     # Value conversion methods
+     # ========================
+     def _get_values(self, action, arg_strings):
+-        # for everything but PARSER args, strip out '--'
++        # for everything but PARSER, REMAINDER args, strip out first '--'
+         if action.nargs not in [PARSER, REMAINDER]:
+-            arg_strings = [s for s in arg_strings if s != '--']
++            try:
++                arg_strings.remove('--')
++            except ValueError:
++                pass
+ 
+         # optional argument produces a default when not present
+         if not arg_strings and action.nargs == OPTIONAL:
+diff -r 70274d53c1dd Lib/asyncore.py
+--- a/Lib/asyncore.py
++++ b/Lib/asyncore.py
+@@ -225,6 +225,7 @@
+     debug = False
+     connected = False
+     accepting = False
++    connecting = False
+     closing = False
+     addr = None
+     ignore_log_types = frozenset(['warning'])
+@@ -248,7 +249,7 @@
+             try:
+                 self.addr = sock.getpeername()
+             except socket.error, err:
+-                if err.args[0] == ENOTCONN:
++                if err.args[0] in (ENOTCONN, EINVAL):
+                     # To handle the case where we got an unconnected
+                     # socket.
+                     self.connected = False
+@@ -342,9 +343,11 @@
+ 
+     def connect(self, address):
+         self.connected = False
++        self.connecting = True
+         err = self.socket.connect_ex(address)
+         if err in (EINPROGRESS, EALREADY, EWOULDBLOCK) \
+         or err == EINVAL and os.name in ('nt', 'ce'):
++            self.addr = address
+             return
+         if err in (0, EISCONN):
+             self.addr = address
+@@ -400,6 +403,7 @@
+     def close(self):
+         self.connected = False
+         self.accepting = False
++        self.connecting = False
+         self.del_channel()
+         try:
+             self.socket.close()
+@@ -438,7 +442,8 @@
+             # sockets that are connected
+             self.handle_accept()
+         elif not self.connected:
+-            self.handle_connect_event()
++            if self.connecting:
++                self.handle_connect_event()
+             self.handle_read()
+         else:
+             self.handle_read()
+@@ -449,6 +454,7 @@
+             raise socket.error(err, _strerror(err))
+         self.handle_connect()
+         self.connected = True
++        self.connecting = False
+ 
+     def handle_write_event(self):
+         if self.accepting:
+@@ -457,12 +463,8 @@
+             return
+ 
+         if not self.connected:
+-            #check for errors
+-            err = self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)
+-            if err != 0:
+-                raise socket.error(err, _strerror(err))
+-
+-            self.handle_connect_event()
++            if self.connecting:
++                self.handle_connect_event()
+         self.handle_write()
+ 
+     def handle_expt_event(self):
+diff -r 70274d53c1dd Lib/bdb.py
+--- a/Lib/bdb.py
++++ b/Lib/bdb.py
+@@ -24,6 +24,7 @@
+         self.skip = set(skip) if skip else None
+         self.breaks = {}
+         self.fncache = {}
++        self.frame_returning = None
+ 
+     def canonic(self, filename):
+         if filename == "<" + filename[1:-1] + ">":
+@@ -82,7 +83,11 @@
+ 
+     def dispatch_return(self, frame, arg):
+         if self.stop_here(frame) or frame == self.returnframe:
+-            self.user_return(frame, arg)
++            try:
++                self.frame_returning = frame
++                self.user_return(frame, arg)
++            finally:
++                self.frame_returning = None
+             if self.quitting: raise BdbQuit
+         return self.trace_dispatch
+ 
+@@ -186,6 +191,14 @@
+ 
+     def set_step(self):
+         """Stop after one line of code."""
++        # Issue #13183: pdb skips frames after hitting a breakpoint and running
++        # step commands.
++        # Restore the trace function in the caller (that may not have been set
++        # for performance reasons) when returning from the current frame.
++        if self.frame_returning:
++            caller_frame = self.frame_returning.f_back
++            if caller_frame and not caller_frame.f_trace:
++                caller_frame.f_trace = self.trace_dispatch
+         self._set_stopinfo(None, None)
+ 
+     def set_next(self, frame):
+diff -r 70274d53c1dd Lib/cmd.py
+--- a/Lib/cmd.py
++++ b/Lib/cmd.py
+@@ -294,6 +294,7 @@
+         return list(commands | topics)
+ 
+     def do_help(self, arg):
++        'List available commands with "help" or detailed help with "help cmd".'
+         if arg:
+             # XXX check arg syntax
+             try:
+diff -r 70274d53c1dd Lib/collections.py
+--- a/Lib/collections.py
++++ b/Lib/collections.py
+@@ -234,10 +234,60 @@
+ ### namedtuple
+ ################################################################################
+ 
++_class_template = '''\
++class {typename}(tuple):
++    '{typename}({arg_list})'
++
++    __slots__ = ()
++
++    _fields = {field_names!r}
++
++    def __new__(_cls, {arg_list}):
++        'Create new instance of {typename}({arg_list})'
++        return _tuple.__new__(_cls, ({arg_list}))
++
++    @classmethod
++    def _make(cls, iterable, new=tuple.__new__, len=len):
++        'Make a new {typename} object from a sequence or iterable'
++        result = new(cls, iterable)
++        if len(result) != {num_fields:d}:
++            raise TypeError('Expected {num_fields:d} arguments, got %d' % len(result))
++        return result
++
++    def __repr__(self):
++        'Return a nicely formatted representation string'
++        return '{typename}({repr_fmt})' % self
++
++    def _asdict(self):
++        'Return a new OrderedDict which maps field names to their values'
++        return OrderedDict(zip(self._fields, self))
++
++    __dict__ = property(_asdict)
++
++    def _replace(_self, **kwds):
++        'Return a new {typename} object replacing specified fields with new values'
++        result = _self._make(map(kwds.pop, {field_names!r}, _self))
++        if kwds:
++            raise ValueError('Got unexpected field names: %r' % kwds.keys())
++        return result
++
++    def __getnewargs__(self):
++        'Return self as a plain tuple.  Used by copy and pickle.'
++        return tuple(self)
++
++{field_defs}
++'''
++
++_repr_template = '{name}=%r'
++
++_field_template = '''\
++    {name} = _property(_itemgetter({index:d}), doc='Alias for field number {index:d}')
++'''
++
+ def namedtuple(typename, field_names, verbose=False, rename=False):
+     """Returns a new subclass of tuple with named fields.
+ 
+-    >>> Point = namedtuple('Point', 'x y')
++    >>> Point = namedtuple('Point', ['x', 'y'])
+     >>> Point.__doc__                   # docstring for the new class
+     'Point(x, y)'
+     >>> p = Point(11, y=22)             # instantiate with positional args or keywords
+@@ -258,83 +308,63 @@
+ 
+     """
+ 
+-    # Parse and validate the field names.  Validation serves two purposes,
+-    # generating informative error messages and preventing template injection attacks.
++    # Validate the field names.  At the user's option, either generate an error
++    # message or automatically replace the field name with a valid name.
+     if isinstance(field_names, basestring):
+-        field_names = field_names.replace(',', ' ').split() # names separated by whitespace and/or commas
+-    field_names = tuple(map(str, field_names))
++        field_names = field_names.replace(',', ' ').split()
++    field_names = map(str, field_names)
+     if rename:
+-        names = list(field_names)
+         seen = set()
+-        for i, name in enumerate(names):
+-            if (not all(c.isalnum() or c=='_' for c in name) or _iskeyword(name)
+-                or not name or name[0].isdigit() or name.startswith('_')
++        for index, name in enumerate(field_names):
++            if (not all(c.isalnum() or c=='_' for c in name)
++                or _iskeyword(name)
++                or not name
++                or name[0].isdigit()
++                or name.startswith('_')
+                 or name in seen):
+-                names[i] = '_%d' % i
++                field_names[index] = '_%d' % index
+             seen.add(name)
+-        field_names = tuple(names)
+-    for name in (typename,) + field_names:
++    for name in [typename] + field_names:
+         if not all(c.isalnum() or c=='_' for c in name):
+-            raise ValueError('Type names and field names can only contain alphanumeric characters and underscores: %r' % name)
++            raise ValueError('Type names and field names can only contain '
++                             'alphanumeric characters and underscores: %r' % name)
+         if _iskeyword(name):
+-            raise ValueError('Type names and field names cannot be a keyword: %r' % name)
++            raise ValueError('Type names and field names cannot be a '
++                             'keyword: %r' % name)
+         if name[0].isdigit():
+-            raise ValueError('Type names and field names cannot start with a number: %r' % name)
+-    seen_names = set()
++            raise ValueError('Type names and field names cannot start with '
++                             'a number: %r' % name)
++    seen = set()
+     for name in field_names:
+         if name.startswith('_') and not rename:
+-            raise ValueError('Field names cannot start with an underscore: %r' % name)
+-        if name in seen_names:
++            raise ValueError('Field names cannot start with an underscore: '
++                             '%r' % name)
++        if name in seen:
+             raise ValueError('Encountered duplicate field name: %r' % name)
+-        seen_names.add(name)
++        seen.add(name)
+ 
+-    # Create and fill-in the class template
+-    numfields = len(field_names)
+-    argtxt = repr(field_names).replace("'", "")[1:-1]   # tuple repr without parens or quotes
+-    reprtxt = ', '.join('%s=%%r' % name for name in field_names)
+-    template = '''class %(typename)s(tuple):
+-        '%(typename)s(%(argtxt)s)' \n
+-        __slots__ = () \n
+-        _fields = %(field_names)r \n
+-        def __new__(_cls, %(argtxt)s):
+-            'Create new instance of %(typename)s(%(argtxt)s)'
+-            return _tuple.__new__(_cls, (%(argtxt)s)) \n
+-        @classmethod
+-        def _make(cls, iterable, new=tuple.__new__, len=len):
+-            'Make a new %(typename)s object from a sequence or iterable'
+-            result = new(cls, iterable)
+-            if len(result) != %(numfields)d:
+-                raise TypeError('Expected %(numfields)d arguments, got %%d' %% len(result))
+-            return result \n
+-        def __repr__(self):
+-            'Return a nicely formatted representation string'
+-            return '%(typename)s(%(reprtxt)s)' %% self \n
+-        def _asdict(self):
+-            'Return a new OrderedDict which maps field names to their values'
+-            return OrderedDict(zip(self._fields, self)) \n
+-        __dict__ = property(_asdict) \n
+-        def _replace(_self, **kwds):
+-            'Return a new %(typename)s object replacing specified fields with new values'
+-            result = _self._make(map(kwds.pop, %(field_names)r, _self))
+-            if kwds:
+-                raise ValueError('Got unexpected field names: %%r' %% kwds.keys())
+-            return result \n
+-        def __getnewargs__(self):
+-            'Return self as a plain tuple.  Used by copy and pickle.'
+-            return tuple(self) \n\n''' % locals()
+-    for i, name in enumerate(field_names):
+-        template += "        %s = _property(_itemgetter(%d), doc='Alias for field number %d')\n" % (name, i, i)
++    # Fill-in the class template
++    class_definition = _class_template.format(
++        typename = typename,
++        field_names = tuple(field_names),
++        num_fields = len(field_names),
++        arg_list = repr(tuple(field_names)).replace("'", "")[1:-1],
++        repr_fmt = ', '.join(_repr_template.format(name=name)
++                             for name in field_names),
++        field_defs = '\n'.join(_field_template.format(index=index, name=name)
++                               for index, name in enumerate(field_names))
++    )
+     if verbose:
+-        print template
++        print class_definition
+ 
+-    # Execute the template string in a temporary namespace and
+-    # support tracing utilities by setting a value for frame.f_globals['__name__']
++    # Execute the template string in a temporary namespace and support
++    # tracing utilities by setting a value for frame.f_globals['__name__']
+     namespace = dict(_itemgetter=_itemgetter, __name__='namedtuple_%s' % typename,
+                      OrderedDict=OrderedDict, _property=property, _tuple=tuple)
+     try:
+-        exec template in namespace
+-    except SyntaxError, e:
+-        raise SyntaxError(e.message + ':\n' + template)
++        exec class_definition in namespace
++    except SyntaxError as e:
++        raise SyntaxError(e.message + ':\n' + class_definition)
+     result = namespace[typename]
+ 
+     # For pickling to work, the __module__ variable needs to be set to the frame
+diff -r 70274d53c1dd Lib/compiler/consts.py
+--- a/Lib/compiler/consts.py
++++ b/Lib/compiler/consts.py
+@@ -5,7 +5,7 @@
+ 
+ SC_LOCAL = 1
+ SC_GLOBAL_IMPLICIT = 2
+-SC_GLOBAL_EXPLICT = 3
++SC_GLOBAL_EXPLICIT = 3
+ SC_FREE = 4
+ SC_CELL = 5
+ SC_UNKNOWN = 6
+diff -r 70274d53c1dd Lib/compiler/pycodegen.py
+--- a/Lib/compiler/pycodegen.py
++++ b/Lib/compiler/pycodegen.py
+@@ -7,7 +7,7 @@
+ 
+ from compiler import ast, parse, walk, syntax
+ from compiler import pyassem, misc, future, symbols
+-from compiler.consts import SC_LOCAL, SC_GLOBAL_IMPLICIT, SC_GLOBAL_EXPLICT, \
++from compiler.consts import SC_LOCAL, SC_GLOBAL_IMPLICIT, SC_GLOBAL_EXPLICIT, \
+      SC_FREE, SC_CELL
+ from compiler.consts import (CO_VARARGS, CO_VARKEYWORDS, CO_NEWLOCALS,
+      CO_NESTED, CO_GENERATOR, CO_FUTURE_DIVISION,
+@@ -283,7 +283,7 @@
+                 self.emit(prefix + '_NAME', name)
+             else:
+                 self.emit(prefix + '_FAST', name)
+-        elif scope == SC_GLOBAL_EXPLICT:
++        elif scope == SC_GLOBAL_EXPLICIT:
+             self.emit(prefix + '_GLOBAL', name)
+         elif scope == SC_GLOBAL_IMPLICIT:
+             if not self.optimized:
+diff -r 70274d53c1dd Lib/compiler/symbols.py
+--- a/Lib/compiler/symbols.py
++++ b/Lib/compiler/symbols.py
+@@ -1,7 +1,7 @@
+ """Module symbol-table generator"""
+ 
+ from compiler import ast
+-from compiler.consts import SC_LOCAL, SC_GLOBAL_IMPLICIT, SC_GLOBAL_EXPLICT, \
++from compiler.consts import SC_LOCAL, SC_GLOBAL_IMPLICIT, SC_GLOBAL_EXPLICIT, \
+     SC_FREE, SC_CELL, SC_UNKNOWN
+ from compiler.misc import mangle
+ import types
+@@ -90,7 +90,7 @@
+         The scope of a name could be LOCAL, GLOBAL, FREE, or CELL.
+         """
+         if name in self.globals:
+-            return SC_GLOBAL_EXPLICT
++            return SC_GLOBAL_EXPLICIT
+         if name in self.cells:
+             return SC_CELL
+         if name in self.defs:
+diff -r 70274d53c1dd Lib/cookielib.py
+--- a/Lib/cookielib.py
++++ b/Lib/cookielib.py
+@@ -1,4 +1,4 @@
+-"""HTTP cookie handling for web clients.
++r"""HTTP cookie handling for web clients.
+ 
+ This module has (now fairly distant) origins in Gisle Aas' Perl module
+ HTTP::Cookies, from the libwww-perl library.
+diff -r 70274d53c1dd Lib/ctypes/test/test_bitfields.py
+--- a/Lib/ctypes/test/test_bitfields.py
++++ b/Lib/ctypes/test/test_bitfields.py
+@@ -240,5 +240,25 @@
+             _anonymous_ = ["_"]
+             _fields_ = [("_", X)]
+ 
++    @unittest.skipUnless(hasattr(ctypes, "c_uint32"), "c_int32 is required")
++    def test_uint32(self):
++        class X(Structure):
++            _fields_ = [("a", c_uint32, 32)]
++        x = X()
++        x.a = 10
++        self.assertEquals(x.a, 10)
++        x.a = 0xFDCBA987
++        self.assertEquals(x.a, 0xFDCBA987)
++
++    @unittest.skipUnless(hasattr(ctypes, "c_uint64"), "c_int64 is required")
++    def test_uint64(self):
++        class X(Structure):
++            _fields_ = [("a", c_uint64, 64)]
++        x = X()
++        x.a = 10
++        self.assertEquals(x.a, 10)
++        x.a = 0xFEDCBA9876543211
++        self.assertEquals(x.a, 0xFEDCBA9876543211)
++
+ if __name__ == "__main__":
+     unittest.main()
+diff -r 70274d53c1dd Lib/ctypes/test/test_numbers.py
+--- a/Lib/ctypes/test/test_numbers.py
++++ b/Lib/ctypes/test/test_numbers.py
+@@ -216,6 +216,16 @@
+         # probably be changed:
+         self.assertRaises(TypeError, c_int, c_long(42))
+ 
++    def test_float_overflow(self):
++        import sys
++        big_int = int(sys.float_info.max) * 2
++        for t in float_types + [c_longdouble]:
++            self.assertRaises(OverflowError, t, big_int)
++            if (hasattr(t, "__ctype_be__")):
++                self.assertRaises(OverflowError, t.__ctype_be__, big_int)
++            if (hasattr(t, "__ctype_le__")):
++                self.assertRaises(OverflowError, t.__ctype_le__, big_int)
++
+ ##    def test_perf(self):
+ ##        check_perf()
+ 
+diff -r 70274d53c1dd Lib/distutils/command/bdist_rpm.py
+--- a/Lib/distutils/command/bdist_rpm.py
++++ b/Lib/distutils/command/bdist_rpm.py
+@@ -379,16 +379,28 @@
+         self.spawn(rpm_cmd)
+ 
+         if not self.dry_run:
++            if self.distribution.has_ext_modules():
++                pyversion = get_python_version()
++            else:
++                pyversion = 'any'
++
+             if not self.binary_only:
+                 srpm = os.path.join(rpm_dir['SRPMS'], source_rpm)
+                 assert(os.path.exists(srpm))
+                 self.move_file(srpm, self.dist_dir)
++                filename = os.path.join(self.dist_dir, source_rpm)
++                self.distribution.dist_files.append(
++                    ('bdist_rpm', pyversion, filename))
+ 
+             if not self.source_only:
+                 for rpm in binary_rpms:
+                     rpm = os.path.join(rpm_dir['RPMS'], rpm)
+                     if os.path.exists(rpm):
+                         self.move_file(rpm, self.dist_dir)
++                        filename = os.path.join(self.dist_dir,
++                                                os.path.basename(rpm))
++                        self.distribution.dist_files.append(
++                            ('bdist_rpm', pyversion, filename))
+     # run()
+ 
+     def _dist_path(self, path):
+diff -r 70274d53c1dd Lib/distutils/config.py
+--- a/Lib/distutils/config.py
++++ b/Lib/distutils/config.py
+@@ -42,7 +42,7 @@
+     def _store_pypirc(self, username, password):
+         """Creates a default .pypirc file."""
+         rc = self._get_rc_file()
+-        f = open(rc, 'w')
++        f = os.fdopen(os.open(rc, os.O_CREAT | os.O_WRONLY, 0600), 'w')
+         try:
+             f.write(DEFAULT_PYPIRC % (username, password))
+         finally:
+diff -r 70274d53c1dd Lib/distutils/dir_util.py
+--- a/Lib/distutils/dir_util.py
++++ b/Lib/distutils/dir_util.py
+@@ -144,6 +144,10 @@
+         src_name = os.path.join(src, n)
+         dst_name = os.path.join(dst, n)
+ 
++        if n.startswith('.nfs'):
++            # skip NFS rename files
++            continue
++
+         if preserve_symlinks and os.path.islink(src_name):
+             link_dest = os.readlink(src_name)
+             if verbose >= 1:
+diff -r 70274d53c1dd Lib/distutils/tests/test_bdist_dumb.py
+--- a/Lib/distutils/tests/test_bdist_dumb.py
++++ b/Lib/distutils/tests/test_bdist_dumb.py
+@@ -1,8 +1,10 @@
+ """Tests for distutils.command.bdist_dumb."""
+ 
++import os
++import sys
++import zipfile
+ import unittest
+-import sys
+-import os
++from test.test_support import run_unittest
+ 
+ # zlib is not used here, but if it's not available
+ # test_simple_built will fail
+@@ -11,8 +13,6 @@
+ except ImportError:
+     zlib = None
+ 
+-from test.test_support import run_unittest
+-
+ from distutils.core import Distribution
+ from distutils.command.bdist_dumb import bdist_dumb
+ from distutils.tests import support
+@@ -73,15 +73,23 @@
+ 
+         # see what we have
+         dist_created = os.listdir(os.path.join(pkg_dir, 'dist'))
+-        base = "%s.%s" % (dist.get_fullname(), cmd.plat_name)
++        base = "%s.%s.zip" % (dist.get_fullname(), cmd.plat_name)
+         if os.name == 'os2':
+             base = base.replace(':', '-')
+ 
+-        wanted = ['%s.zip' % base]
+-        self.assertEqual(dist_created, wanted)
++        self.assertEqual(dist_created, [base])
+ 
+         # now let's check what we have in the zip file
+-        # XXX to be done
++        fp = zipfile.ZipFile(os.path.join('dist', base))
++        try:
++            contents = fp.namelist()
++        finally:
++            fp.close()
++
++        contents = sorted(os.path.basename(fn) for fn in contents)
++        wanted = ['foo-0.1-py%s.%s.egg-info' % sys.version_info[:2],
++                  'foo.py', 'foo.pyc']
++        self.assertEqual(contents, sorted(wanted))
+ 
+     def test_finalize_options(self):
+         pkg_dir, dist = self.create_dist()
+diff -r 70274d53c1dd Lib/distutils/tests/test_bdist_msi.py
+--- a/Lib/distutils/tests/test_bdist_msi.py
++++ b/Lib/distutils/tests/test_bdist_msi.py
+@@ -1,12 +1,11 @@
+ """Tests for distutils.command.bdist_msi."""
++import sys
+ import unittest
+-import sys
+-
+ from test.test_support import run_unittest
+-
+ from distutils.tests import support
+ 
+-@unittest.skipUnless(sys.platform=="win32", "These tests are only for win32")
++
++@unittest.skipUnless(sys.platform == 'win32', 'these tests require Windows')
+ class BDistMSITestCase(support.TempdirManager,
+                        support.LoggingSilencer,
+                        unittest.TestCase):
+@@ -14,10 +13,11 @@
+     def test_minimal(self):
+         # minimal test XXX need more tests
+         from distutils.command.bdist_msi import bdist_msi
+-        pkg_pth, dist = self.create_dist()
++        project_dir, dist = self.create_dist()
+         cmd = bdist_msi(dist)
+         cmd.ensure_finalized()
+ 
++
+ def test_suite():
+     return unittest.makeSuite(BDistMSITestCase)
+ 
+diff -r 70274d53c1dd Lib/distutils/tests/test_bdist_rpm.py
+--- a/Lib/distutils/tests/test_bdist_rpm.py
++++ b/Lib/distutils/tests/test_bdist_rpm.py
+@@ -79,6 +79,10 @@
+         dist_created = os.listdir(os.path.join(pkg_dir, 'dist'))
+         self.assertTrue('foo-0.1-1.noarch.rpm' in dist_created)
+ 
++        # bug #2945: upload ignores bdist_rpm files
++        self.assertIn(('bdist_rpm', 'any', 'dist/foo-0.1-1.src.rpm'), dist.dist_files)
++        self.assertIn(('bdist_rpm', 'any', 'dist/foo-0.1-1.noarch.rpm'), dist.dist_files)
++
+     def test_no_optimize_flag(self):
+ 
+         # XXX I am unable yet to make this test work without
+@@ -118,6 +122,11 @@
+ 
+         dist_created = os.listdir(os.path.join(pkg_dir, 'dist'))
+         self.assertTrue('foo-0.1-1.noarch.rpm' in dist_created)
++
++        # bug #2945: upload ignores bdist_rpm files
++        self.assertIn(('bdist_rpm', 'any', 'dist/foo-0.1-1.src.rpm'), dist.dist_files)
++        self.assertIn(('bdist_rpm', 'any', 'dist/foo-0.1-1.noarch.rpm'), dist.dist_files)
++
+         os.remove(os.path.join(pkg_dir, 'dist', 'foo-0.1-1.noarch.rpm'))
+ 
+ def test_suite():
+diff -r 70274d53c1dd Lib/distutils/tests/test_dir_util.py
+--- a/Lib/distutils/tests/test_dir_util.py
++++ b/Lib/distutils/tests/test_dir_util.py
+@@ -101,6 +101,24 @@
+         remove_tree(self.root_target, verbose=0)
+         remove_tree(self.target2, verbose=0)
+ 
++    def test_copy_tree_skips_nfs_temp_files(self):
++        mkpath(self.target, verbose=0)
++
++        a_file = os.path.join(self.target, 'ok.txt')
++        nfs_file = os.path.join(self.target, '.nfs123abc')
++        for f in a_file, nfs_file:
++            fh = open(f, 'w')
++            try:
++                fh.write('some content')
++            finally:
++                fh.close()
++
++        copy_tree(self.target, self.target2)
++        self.assertEqual(os.listdir(self.target2), ['ok.txt'])
++
++        remove_tree(self.root_target, verbose=0)
++        remove_tree(self.target2, verbose=0)
++
+     def test_ensure_relative(self):
+         if os.sep == '/':
+             self.assertEqual(ensure_relative('/home/foo'), 'home/foo')
+diff -r 70274d53c1dd Lib/distutils/tests/test_install.py
+--- a/Lib/distutils/tests/test_install.py
++++ b/Lib/distutils/tests/test_install.py
+@@ -86,19 +86,17 @@
+         self.old_expand = os.path.expanduser
+         os.path.expanduser = _expanduser
+ 
+-        try:
+-            # this is the actual test
+-            self._test_user_site()
+-        finally:
++        def cleanup():
+             site.USER_BASE = self.old_user_base
+             site.USER_SITE = self.old_user_site
+             install_module.USER_BASE = self.old_user_base
+             install_module.USER_SITE = self.old_user_site
+             os.path.expanduser = self.old_expand
+ 
+-    def _test_user_site(self):
++        self.addCleanup(cleanup)
++
+         for key in ('nt_user', 'unix_user', 'os2_home'):
+-            self.assertTrue(key in INSTALL_SCHEMES)
++            self.assertIn(key, INSTALL_SCHEMES)
+ 
+         dist = Distribution({'name': 'xx'})
+         cmd = install(dist)
+@@ -106,14 +104,14 @@
+         # making sure the user option is there
+         options = [name for name, short, lable in
+                    cmd.user_options]
+-        self.assertTrue('user' in options)
++        self.assertIn('user', options)
+ 
+         # setting a value
+         cmd.user = 1
+ 
+         # user base and site shouldn't be created yet
+-        self.assertTrue(not os.path.exists(self.user_base))
+-        self.assertTrue(not os.path.exists(self.user_site))
++        self.assertFalse(os.path.exists(self.user_base))
++        self.assertFalse(os.path.exists(self.user_site))
+ 
+         # let's run finalize
+         cmd.ensure_finalized()
+@@ -122,8 +120,8 @@
+         self.assertTrue(os.path.exists(self.user_base))
+         self.assertTrue(os.path.exists(self.user_site))
+ 
+-        self.assertTrue('userbase' in cmd.config_vars)
+-        self.assertTrue('usersite' in cmd.config_vars)
++        self.assertIn('userbase', cmd.config_vars)
++        self.assertIn('usersite', cmd.config_vars)
+ 
+     def test_handle_extra_path(self):
+         dist = Distribution({'name': 'xx', 'extra_path': 'path,dirs'})
+@@ -176,15 +174,16 @@
+ 
+     def test_record(self):
+         install_dir = self.mkdtemp()
+-        project_dir, dist = self.create_dist(scripts=['hello'])
+-        self.addCleanup(os.chdir, os.getcwd())
++        project_dir, dist = self.create_dist(py_modules=['hello'],
++                                             scripts=['sayhi'])
+         os.chdir(project_dir)
+-        self.write_file('hello', "print('o hai')")
++        self.write_file('hello.py', "def main(): print 'o hai'")
++        self.write_file('sayhi', 'from hello import main; main()')
+ 
+         cmd = install(dist)
+         dist.command_obj['install'] = cmd
+         cmd.root = install_dir
+-        cmd.record = os.path.join(project_dir, 'RECORD')
++        cmd.record = os.path.join(project_dir, 'filelist')
+         cmd.ensure_finalized()
+         cmd.run()
+ 
+@@ -195,7 +194,7 @@
+             f.close()
+ 
+         found = [os.path.basename(line) for line in content.splitlines()]
+-        expected = ['hello',
++        expected = ['hello.py', 'hello.pyc', 'sayhi',
+                     'UNKNOWN-0.0.0-py%s.%s.egg-info' % sys.version_info[:2]]
+         self.assertEqual(found, expected)
+ 
+@@ -203,7 +202,6 @@
+         install_dir = self.mkdtemp()
+         project_dir, dist = self.create_dist(ext_modules=[
+             Extension('xx', ['xxmodule.c'])])
+-        self.addCleanup(os.chdir, os.getcwd())
+         os.chdir(project_dir)
+         support.copy_xxmodule_c(project_dir)
+ 
+@@ -215,7 +213,7 @@
+         dist.command_obj['install'] = cmd
+         dist.command_obj['build_ext'] = buildextcmd
+         cmd.root = install_dir
+-        cmd.record = os.path.join(project_dir, 'RECORD')
++        cmd.record = os.path.join(project_dir, 'filelist')
+         cmd.ensure_finalized()
+         cmd.run()
+ 
+@@ -241,6 +239,7 @@
+             install_module.DEBUG = False
+         self.assertTrue(len(self.logs) > old_logs_len)
+ 
++
+ def test_suite():
+     return unittest.makeSuite(InstallTestCase)
+ 
+diff -r 70274d53c1dd Lib/distutils/tests/test_sdist.py
+--- a/Lib/distutils/tests/test_sdist.py
++++ b/Lib/distutils/tests/test_sdist.py
+@@ -6,6 +6,7 @@
+ import zipfile
+ from os.path import join
+ from textwrap import dedent
++from test.test_support import captured_stdout, check_warnings, run_unittest
+ 
+ # zlib is not used here, but if it's not available
+ # the tests that use zipfile may fail
+@@ -21,7 +22,6 @@
+ except ImportError:
+     UID_GID_SUPPORT = False
+ 
+-from test.test_support import captured_stdout, check_warnings, run_unittest
+ 
+ from distutils.command.sdist import sdist, show_formats
+ from distutils.core import Distribution
+@@ -91,9 +91,8 @@
+ 
+     @unittest.skipUnless(zlib, "requires zlib")
+     def test_prune_file_list(self):
+-        # this test creates a package with some vcs dirs in it
+-        # and launch sdist to make sure they get pruned
+-        # on all systems
++        # this test creates a project with some VCS dirs and an NFS rename
++        # file, then launches sdist to check they get pruned on all systems
+ 
+         # creating VCS directories with some files in them
+         os.mkdir(join(self.tmp_dir, 'somecode', '.svn'))
+@@ -107,6 +106,8 @@
+         self.write_file((self.tmp_dir, 'somecode', '.git',
+                          'ok'), 'xxx')
+ 
++        self.write_file((self.tmp_dir, 'somecode', '.nfs0001'), 'xxx')
++
+         # now building a sdist
+         dist, cmd = self.get_cmd()
+ 
+@@ -375,7 +376,7 @@
+     # the following tests make sure there is a nice error message instead
+     # of a traceback when parsing an invalid manifest template
+ 
+-    def _test_template(self, content):
++    def _check_template(self, content):
+         dist, cmd = self.get_cmd()
+         os.chdir(self.tmp_dir)
+         self.write_file('MANIFEST.in', content)
+@@ -386,17 +387,17 @@
+         self.assertEqual(len(warnings), 1)
+ 
+     def test_invalid_template_unknown_command(self):
+-        self._test_template('taunt knights *')
++        self._check_template('taunt knights *')
+ 
+     def test_invalid_template_wrong_arguments(self):
+         # this manifest command takes one argument
+-        self._test_template('prune')
++        self._check_template('prune')
+ 
+     @unittest.skipIf(os.name != 'nt', 'test relevant for Windows only')
+     def test_invalid_template_wrong_path(self):
+         # on Windows, trailing slashes are not allowed
+         # this used to crash instead of raising a warning: #8286
+-        self._test_template('include examples/')
++        self._check_template('include examples/')
+ 
+     @unittest.skipUnless(zlib, "requires zlib")
+     def test_get_file_list(self):
+diff -r 70274d53c1dd Lib/doctest.py
+--- a/Lib/doctest.py
++++ b/Lib/doctest.py
+@@ -2314,7 +2314,8 @@
+         return "Doctest: " + self._dt_test.name
+ 
+ class SkipDocTestCase(DocTestCase):
+-    def __init__(self):
++    def __init__(self, module):
++        self.module = module
+         DocTestCase.__init__(self, None)
+ 
+     def setUp(self):
+@@ -2324,7 +2325,10 @@
+         pass
+ 
+     def shortDescription(self):
+-        return "Skipping tests from %s" % module.__name__
++        return "Skipping tests from %s" % self.module.__name__
++
++    __str__ = shortDescription
++
+ 
+ def DocTestSuite(module=None, globs=None, extraglobs=None, test_finder=None,
+                  **options):
+@@ -2372,7 +2376,7 @@
+     if not tests and sys.flags.optimize >=2:
+         # Skip doctests when running with -O2
+         suite = unittest.TestSuite()
+-        suite.addTest(SkipDocTestCase())
++        suite.addTest(SkipDocTestCase(module))
+         return suite
+     elif not tests:
+         # Why do we want to do this? Because it reveals a bug that might
+diff -r 70274d53c1dd Lib/email/_parseaddr.py
+--- a/Lib/email/_parseaddr.py
++++ b/Lib/email/_parseaddr.py
+@@ -13,7 +13,7 @@
+     'quote',
+     ]
+ 
+-import time
++import time, calendar
+ 
+ SPACE = ' '
+ EMPTYSTRING = ''
+@@ -150,13 +150,13 @@
+ 
+ 
+ def mktime_tz(data):
+-    """Turn a 10-tuple as returned by parsedate_tz() into a UTC timestamp."""
++    """Turn a 10-tuple as returned by parsedate_tz() into a POSIX timestamp."""
+     if data[9] is None:
+         # No zone info, so localtime is better assumption than GMT
+         return time.mktime(data[:8] + (-1,))
+     else:
+-        t = time.mktime(data[:8] + (0,))
+-        return t - data[9] - time.timezone
++        t = calendar.timegm(data)
++        return t - data[9]
+ 
+ 
+ def quote(str):
+diff -r 70274d53c1dd Lib/email/generator.py
+--- a/Lib/email/generator.py
++++ b/Lib/email/generator.py
+@@ -212,7 +212,11 @@
+             msg.set_boundary(boundary)
+         # If there's a preamble, write it out, with a trailing CRLF
+         if msg.preamble is not None:
+-            print >> self._fp, msg.preamble
++            if self._mangle_from_:
++                preamble = fcre.sub('>From ', msg.preamble)
++            else:
++                preamble = msg.preamble
++            print >> self._fp, preamble
+         # dash-boundary transport-padding CRLF
+         print >> self._fp, '--' + boundary
+         # body-part
+@@ -230,7 +234,11 @@
+         self._fp.write('\n--' + boundary + '--')
+         if msg.epilogue is not None:
+             print >> self._fp
+-            self._fp.write(msg.epilogue)
++            if self._mangle_from_:
++                epilogue = fcre.sub('>From ', msg.epilogue)
++            else:
++                epilogue = msg.epilogue
++            self._fp.write(epilogue)
+ 
+     def _handle_multipart_signed(self, msg):
+         # The contents of signed parts has to stay unmodified in order to keep
+diff -r 70274d53c1dd Lib/email/test/test_email.py
+--- a/Lib/email/test/test_email.py
++++ b/Lib/email/test/test_email.py
+@@ -9,6 +9,7 @@
+ import difflib
+ import unittest
+ import warnings
++import textwrap
+ from cStringIO import StringIO
+ 
+ import email
+@@ -948,6 +949,28 @@
+ Blah blah blah
+ """)
+ 
++    def test_mangle_from_in_preamble_and_epilog(self):
++        s = StringIO()
++        g = Generator(s, mangle_from_=True)
++        msg = email.message_from_string(textwrap.dedent("""\
++            From: foo@bar.com
++            Mime-Version: 1.0
++            Content-Type: multipart/mixed; boundary=XXX
++
++            From somewhere unknown
++
++            --XXX
++            Content-Type: text/plain
++
++            foo
++
++            --XXX--
++
++            From somewhere unknowable
++            """))
++        g.flatten(msg)
++        self.assertEqual(len([1 for x in s.getvalue().split('\n')
++                                  if x.startswith('>From ')]), 2)
+ 
+ 
+ # Test the basic MIMEAudio class
+@@ -2262,6 +2285,12 @@
+         eq(time.localtime(t)[:6], timetup[:6])
+         eq(int(time.strftime('%Y', timetup[:9])), 2003)
+ 
++    def test_mktime_tz(self):
++        self.assertEqual(Utils.mktime_tz((1970, 1, 1, 0, 0, 0,
++                                          -1, -1, -1, 0)), 0)
++        self.assertEqual(Utils.mktime_tz((1970, 1, 1, 0, 0, 0,
++                                          -1, -1, -1, 1234)), -1234)
++
+     def test_parsedate_y2k(self):
+         """Test for parsing a date with a two-digit year.
+ 
+diff -r 70274d53c1dd Lib/glob.py
+--- a/Lib/glob.py
++++ b/Lib/glob.py
+@@ -5,6 +5,14 @@
+ import re
+ import fnmatch
+ 
++try:
++    _unicode = unicode
++except NameError:
++    # If Python is built without Unicode support, the unicode type
++    # will not exist. Fake one.
++    class _unicode(object):
++        pass
++
+ __all__ = ["glob", "iglob"]
+ 
+ def glob(pathname):
+@@ -49,7 +57,7 @@
+ def glob1(dirname, pattern):
+     if not dirname:
+         dirname = os.curdir
+-    if isinstance(pattern, unicode) and not isinstance(dirname, unicode):
++    if isinstance(pattern, _unicode) and not isinstance(dirname, unicode):
+         dirname = unicode(dirname, sys.getfilesystemencoding() or
+                                    sys.getdefaultencoding())
+     try:
+diff -r 70274d53c1dd Lib/hashlib.py
+--- a/Lib/hashlib.py
++++ b/Lib/hashlib.py
+@@ -88,7 +88,7 @@
+     except ImportError:
+         pass  # no extension module, this hash is unsupported.
+ 
+-    raise ValueError('unsupported hash type %s' % name)
++    raise ValueError('unsupported hash type ' + name)
+ 
+ 
+ def __get_openssl_constructor(name):
+diff -r 70274d53c1dd Lib/httplib.py
+--- a/Lib/httplib.py
++++ b/Lib/httplib.py
+@@ -1,4 +1,4 @@
+-"""HTTP/1.1 client library
++r"""HTTP/1.1 client library
+ 
+ <intro stuff goes here>
+ <other stuff, too>
+@@ -748,7 +748,11 @@
+             line = response.fp.readline(_MAXLINE + 1)
+             if len(line) > _MAXLINE:
+                 raise LineTooLong("header line")
+-            if line == '\r\n': break
++            if not line:
++                # for sites which EOF without sending trailer
++                break
++            if line == '\r\n':
++                break
+ 
+ 
+     def connect(self):
+@@ -985,7 +989,7 @@
+ 
+         self.putrequest(method, url, **skips)
+ 
+-        if body and ('content-length' not in header_names):
++        if body is not None and 'content-length' not in header_names:
+             self._set_content_length(body)
+         for hdr, value in headers.iteritems():
+             self.putheader(hdr, value)
+diff -r 70274d53c1dd Lib/idlelib/CallTipWindow.py
+--- a/Lib/idlelib/CallTipWindow.py
++++ b/Lib/idlelib/CallTipWindow.py
+@@ -22,6 +22,7 @@
+         self.parenline = self.parencol = None
+         self.lastline = None
+         self.hideid = self.checkhideid = None
++        self.checkhide_after_id = None
+ 
+     def position_window(self):
+         """Check if needs to reposition the window, and if so - do it."""
+@@ -102,7 +103,10 @@
+             self.hidetip()
+         else:
+             self.position_window()
+-            self.widget.after(CHECKHIDE_TIME, self.checkhide_event)
++            if self.checkhide_after_id is not None:
++                self.widget.after_cancel(self.checkhide_after_id)
++            self.checkhide_after_id = \
++                self.widget.after(CHECKHIDE_TIME, self.checkhide_event)
+ 
+     def hide_event(self, event):
+         if not self.tipwindow:
+diff -r 70274d53c1dd Lib/idlelib/CallTips.py
+--- a/Lib/idlelib/CallTips.py
++++ b/Lib/idlelib/CallTips.py
+@@ -71,16 +71,16 @@
+         if not sur_paren:
+             return
+         hp.set_index(sur_paren[0])
+-        name = hp.get_expression()
+-        if not name or (not evalfuncs and name.find('(') != -1):
++        expression = hp.get_expression()
++        if not expression or (not evalfuncs and expression.find('(') != -1):
+             return
+-        arg_text = self.fetch_tip(name)
++        arg_text = self.fetch_tip(expression)
+         if not arg_text:
+             return
+         self.calltip = self._make_calltip_window()
+         self.calltip.showtip(arg_text, sur_paren[0], sur_paren[1])
+ 
+-    def fetch_tip(self, name):
++    def fetch_tip(self, expression):
+         """Return the argument list and docstring of a function or class
+ 
+         If there is a Python subprocess, get the calltip there.  Otherwise,
+@@ -96,23 +96,27 @@
+         """
+         try:
+             rpcclt = self.editwin.flist.pyshell.interp.rpcclt
+-        except:
++        except AttributeError:
+             rpcclt = None
+         if rpcclt:
+             return rpcclt.remotecall("exec", "get_the_calltip",
+-                                     (name,), {})
++                                     (expression,), {})
+         else:
+-            entity = self.get_entity(name)
++            entity = self.get_entity(expression)
+             return get_arg_text(entity)
+ 
+-    def get_entity(self, name):
+-        "Lookup name in a namespace spanning sys.modules and __main.dict__"
+-        if name:
++    def get_entity(self, expression):
++        """Return the object corresponding to expression evaluated
++        in a namespace spanning sys.modules and __main.dict__.
++        """
++        if expression:
+             namespace = sys.modules.copy()
+             namespace.update(__main__.__dict__)
+             try:
+-                return eval(name, namespace)
+-            except (NameError, AttributeError):
++                return eval(expression, namespace)
++            except BaseException:
++                # An uncaught exception closes idle, and eval can raise any
++                # exception, especially if user classes are involved.
+                 return None
+ 
+ def _find_constructor(class_ob):
+@@ -127,9 +131,10 @@
+     return None
+ 
+ def get_arg_text(ob):
+-    """Get a string describing the arguments for the given object"""
++    """Get a string describing the arguments for the given object,
++       only if it is callable."""
+     arg_text = ""
+-    if ob is not None:
++    if ob is not None and hasattr(ob, '__call__'):
+         arg_offset = 0
+         if type(ob) in (types.ClassType, types.TypeType):
+             # Look for the highest __init__ in the class chain.
+diff -r 70274d53c1dd Lib/idlelib/EditorWindow.py
+--- a/Lib/idlelib/EditorWindow.py
++++ b/Lib/idlelib/EditorWindow.py
+@@ -856,7 +856,7 @@
+         # for each edit window instance, construct the recent files menu
+         for instance in self.top.instance_dict.keys():
+             menu = instance.recent_files_menu
+-            menu.delete(1, END)  # clear, and rebuild:
++            menu.delete(0, END)  # clear, and rebuild:
+             for i, file_name in enumerate(rf_list):
+                 file_name = file_name.rstrip()  # zap \n
+                 # make unicode string to display non-ASCII chars correctly
+diff -r 70274d53c1dd Lib/idlelib/IOBinding.py
+--- a/Lib/idlelib/IOBinding.py
++++ b/Lib/idlelib/IOBinding.py
+@@ -196,29 +196,33 @@
+                 self.filename_change_hook()
+ 
+     def open(self, event=None, editFile=None):
+-        if self.editwin.flist:
++        flist = self.editwin.flist
++        # Save in case parent window is closed (ie, during askopenfile()).
++        if flist:
+             if not editFile:
+                 filename = self.askopenfile()
+             else:
+                 filename=editFile
+             if filename:
+-                # If the current window has no filename and hasn't been
+-                # modified, we replace its contents (no loss).  Otherwise
+-                # we open a new window.  But we won't replace the
+-                # shell window (which has an interp(reter) attribute), which
+-                # gets set to "not modified" at every new prompt.
+-                try:
+-                    interp = self.editwin.interp
+-                except AttributeError:
+-                    interp = None
+-                if not self.filename and self.get_saved() and not interp:
+-                    self.editwin.flist.open(filename, self.loadfile)
++                # If editFile is valid and already open, flist.open will
++                # shift focus to its existing window.
++                # If the current window exists and is a fresh unnamed,
++                # unmodified editor window (not an interpreter shell),
++                # pass self.loadfile to flist.open so it will load the file
++                # in the current window (if the file is not already open)
++                # instead of a new window.
++                if (self.editwin and
++                        not getattr(self.editwin, 'interp', None) and
++                        not self.filename and
++                        self.get_saved()):
++                    flist.open(filename, self.loadfile)
+                 else:
+-                    self.editwin.flist.open(filename)
++                    flist.open(filename)
+             else:
+-                self.text.focus_set()
++                if self.text:
++                    self.text.focus_set()
+             return "break"
+-        #
++
+         # Code for use outside IDLE:
+         if self.get_saved():
+             reply = self.maybesave()
+diff -r 70274d53c1dd Lib/idlelib/NEWS.txt
+--- a/Lib/idlelib/NEWS.txt
++++ b/Lib/idlelib/NEWS.txt
+@@ -1,5 +1,35 @@
++What's New in IDLE 2.7.4?
++=========================
++
++- Issue #15318: Prevent writing to sys.stdin.
++
++- Issue #13532, #15319: Check that arguments to sys.stdout.write are strings.
++
++- Issue # 12510: Attempt to get certain tool tips no longer crashes IDLE.
++
++- Issue10365: File open dialog now works instead of crashing even when
++  parent window is closed while dialog is open.
++
++- Issue 14876: use user-selected font for highlight configuration.
++
++- Issue #14018: Update checks for unstable system Tcl/Tk versions on OS X
++  to include versions shipped with OS X 10.7 and 10.8 in addition to 10.6.
++
++
++What's New in IDLE 2.7.3?
++=========================
++
++- Issue #14409: IDLE now properly executes commands in the Shell window
++  when it cannot read the normal config files on startup and
++  has to use the built-in default key bindings.
++  There was previously a bug in one of the defaults.
++
++- Issue #3573: IDLE hangs when passing invalid command line args
++  (directory(ies) instead of file(s)).
++
++
+ What's New in IDLE 2.7.2?
+-=======================
++=========================
+ 
+ *Release date: 29-May-2011*
+ 
+diff -r 70274d53c1dd Lib/idlelib/PyShell.py
+--- a/Lib/idlelib/PyShell.py
++++ b/Lib/idlelib/PyShell.py
+@@ -11,6 +11,7 @@
+ import threading
+ import traceback
+ import types
++import io
+ 
+ import linecache
+ from code import InteractiveInterpreter
+@@ -251,8 +252,8 @@
+     def ranges_to_linenumbers(self, ranges):
+         lines = []
+         for index in range(0, len(ranges), 2):
+-            lineno = int(float(ranges[index]))
+-            end = int(float(ranges[index+1]))
++            lineno = int(float(ranges[index].string))
++            end = int(float(ranges[index+1].string))
+             while lineno < end:
+                 lines.append(lineno)
+                 lineno += 1
+@@ -313,6 +314,11 @@
+             "console": idleConf.GetHighlight(theme, "console"),
+         })
+ 
++    def removecolors(self):
++        # Don't remove shell color tags before "iomark"
++        for tag in self.tagdefs:
++            self.tag_remove(tag, "iomark", "end")
++
+ class ModifiedUndoDelegator(UndoDelegator):
+     "Extend base class: forbid insert/delete before the I/O mark"
+ 
+@@ -417,6 +423,9 @@
+         except socket.timeout, err:
+             self.display_no_subprocess_error()
+             return None
++        # Can't regiter self.tkconsole.stdin, since run.py wants to
++        # call non-TextIO methods on it (such as getvar)
++        # XXX should be renamed to "console"
+         self.rpcclt.register("stdin", self.tkconsole)
+         self.rpcclt.register("stdout", self.tkconsole.stdout)
+         self.rpcclt.register("stderr", self.tkconsole.stderr)
+@@ -870,13 +879,14 @@
+         self.save_stderr = sys.stderr
+         self.save_stdin = sys.stdin
+         from idlelib import IOBinding
++        self.stdin = PseudoInputFile(self)
+         self.stdout = PseudoFile(self, "stdout", IOBinding.encoding)
+         self.stderr = PseudoFile(self, "stderr", IOBinding.encoding)
+         self.console = PseudoFile(self, "console", IOBinding.encoding)
+         if not use_subprocess:
+             sys.stdout = self.stdout
+             sys.stderr = self.stderr
+-            sys.stdin = self
++            sys.stdin = self.stdin
+         #
+         self.history = self.History(self.text)
+         #
+@@ -1260,6 +1270,8 @@
+         self.encoding = encoding
+ 
+     def write(self, s):
++        if not isinstance(s, (basestring, bytearray)):
++            raise TypeError('must be string, not ' + type(s).__name__)
+         self.shell.write(s, self.tags)
+ 
+     def writelines(self, lines):
+@@ -1272,6 +1284,15 @@
+     def isatty(self):
+         return True
+ 
++class PseudoInputFile(object):
++    def __init__(self, shell):
++        self.readline = shell.readline
++        self.isatty = shell.isatty
++
++    def write(self, s):
++        raise io.UnsupportedOperation("not writable")
++    writelines = write
++
+ 
+ usage_msg = """\
+ 
+@@ -1412,8 +1433,10 @@
+ 
+     if enable_edit:
+         if not (cmd or script):
+-            for filename in args:
+-                flist.open(filename)
++            for filename in args[:]:
++                if flist.open(filename) is None:
++                    # filename is a directory actually, disconsider it
++                    args.remove(filename)
+             if not args:
+                 flist.new()
+     if enable_shell:
+@@ -1456,7 +1479,8 @@
+     if tkversionwarning:
+         shell.interp.runcommand(''.join(("print('", tkversionwarning, "')")))
+ 
+-    root.mainloop()
++    while flist.inversedict:  # keep IDLE running while files are open.
++        root.mainloop()
+     root.destroy()
+ 
+ if __name__ == "__main__":
+diff -r 70274d53c1dd Lib/idlelib/ReplaceDialog.py
+--- a/Lib/idlelib/ReplaceDialog.py
++++ b/Lib/idlelib/ReplaceDialog.py
+@@ -2,6 +2,8 @@
+ 
+ from idlelib import SearchEngine
+ from idlelib.SearchDialogBase import SearchDialogBase
++import re
++
+ 
+ def replace(text):
+     root = text._root()
+@@ -11,6 +13,7 @@
+     dialog = engine._replacedialog
+     dialog.open(text)
+ 
++
+ class ReplaceDialog(SearchDialogBase):
+ 
+     title = "Replace Dialog"
+@@ -55,8 +58,22 @@
+ 
+     def default_command(self, event=None):
+         if self.do_find(self.ok):
+-            self.do_replace()
+-            self.do_find(0)
++            if self.do_replace():   # Only find next match if replace succeeded.
++                                    # A bad re can cause a it to fail.
++                self.do_find(0)
++
++    def _replace_expand(self, m, repl):
++        """ Helper function for expanding a regular expression
++            in the replace field, if needed. """
++        if self.engine.isre():
++            try:
++                new = m.expand(repl)
++            except re.error:
++                self.engine.report_error(repl, 'Invalid Replace Expression')
++                new = None
++        else:
++            new = repl
++        return new
+ 
+     def replace_all(self, event=None):
+         prog = self.engine.getprog()
+@@ -86,7 +103,9 @@
+             line, m = res
+             chars = text.get("%d.0" % line, "%d.0" % (line+1))
+             orig = m.group()
+-            new = m.expand(repl)
++            new = self._replace_expand(m, repl)
++            if new is None:
++                break
+             i, j = m.span()
+             first = "%d.%d" % (line, i)
+             last = "%d.%d" % (line, j)
+@@ -103,7 +122,6 @@
+         text.undo_block_stop()
+         if first and last:
+             self.show_hit(first, last)
+-        self.close()
+ 
+     def do_find(self, ok=0):
+         if not self.engine.getprog():
+@@ -138,7 +156,9 @@
+         m = prog.match(chars, col)
+         if not prog:
+             return False
+-        new = m.expand(self.replvar.get())
++        new = self._replace_expand(m, self.replvar.get())
++        if new is None:
++            return False
+         text.mark_set("insert", first)
+         text.undo_block_start()
+         if m.group():
+diff -r 70274d53c1dd Lib/idlelib/configDialog.py
+--- a/Lib/idlelib/configDialog.py
++++ b/Lib/idlelib/configDialog.py
+@@ -183,7 +183,7 @@
+                               text=' Highlighting Theme ')
+         #frameCustom
+         self.textHighlightSample=Text(frameCustom,relief=SOLID,borderwidth=1,
+-            font=('courier',12,''),cursor='hand2',width=21,height=10,
++            font=('courier',12,''),cursor='hand2',width=21,height=11,
+             takefocus=FALSE,highlightthickness=0,wrap=NONE)
+         text=self.textHighlightSample
+         text.bind('<Double-Button-1>',lambda e: 'break')
+@@ -832,8 +832,10 @@
+             fontWeight=tkFont.BOLD
+         else:
+             fontWeight=tkFont.NORMAL
+-        self.editFont.config(size=self.fontSize.get(),
++        size=self.fontSize.get()
++        self.editFont.config(size=size,
+                 weight=fontWeight,family=fontName)
++        self.textHighlightSample.configure(font=(fontName, size, fontWeight))
+ 
+     def SetHighlightTarget(self):
+         if self.highlightTarget.get()=='Cursor': #bg not possible
+diff -r 70274d53c1dd Lib/idlelib/configHandler.py
+--- a/Lib/idlelib/configHandler.py
++++ b/Lib/idlelib/configHandler.py
+@@ -595,7 +595,7 @@
+             '<<replace>>': ['<Control-h>'],
+             '<<goto-line>>': ['<Alt-g>'],
+             '<<smart-backspace>>': ['<Key-BackSpace>'],
+-            '<<newline-and-indent>>': ['<Key-Return> <Key-KP_Enter>'],
++            '<<newline-and-indent>>': ['<Key-Return>', '<Key-KP_Enter>'],
+             '<<smart-indent>>': ['<Key-Tab>'],
+             '<<indent-region>>': ['<Control-Key-bracketright>'],
+             '<<dedent-region>>': ['<Control-Key-bracketleft>'],
+diff -r 70274d53c1dd Lib/idlelib/macosxSupport.py
+--- a/Lib/idlelib/macosxSupport.py
++++ b/Lib/idlelib/macosxSupport.py
+@@ -37,17 +37,21 @@
+ def tkVersionWarning(root):
+     """
+     Returns a string warning message if the Tk version in use appears to
+-    be one known to cause problems with IDLE.  The Apple Cocoa-based Tk 8.5
+-    that was shipped with Mac OS X 10.6.
++    be one known to cause problems with IDLE.
++    1. Apple Cocoa-based Tk 8.5.7 shipped with Mac OS X 10.6 is unusable.
++    2. Apple Cocoa-based Tk 8.5.9 in OS X 10.7 and 10.8 is better but
++        can still crash unexpectedly.
+     """
+ 
+     if (runningAsOSXApp() and
+-            ('AppKit' in root.tk.call('winfo', 'server', '.')) and
+-            (root.tk.call('info', 'patchlevel') == '8.5.7') ):
+-        return (r"WARNING: The version of Tcl/Tk (8.5.7) in use may"
++            ('AppKit' in root.tk.call('winfo', 'server', '.')) ):
++        patchlevel = root.tk.call('info', 'patchlevel')
++        if patchlevel not in ('8.5.7', '8.5.9'):
++            return False
++        return (r"WARNING: The version of Tcl/Tk ({0}) in use may"
+                 r" be unstable.\n"
+                 r"Visit http://www.python.org/download/mac/tcltk/"
+-                r" for current information.")
++                r" for current information.".format(patchlevel))
+     else:
+         return False
+ 
+diff -r 70274d53c1dd Lib/idlelib/run.py
+--- a/Lib/idlelib/run.py
++++ b/Lib/idlelib/run.py
+@@ -1,4 +1,5 @@
+ import sys
++import io
+ import linecache
+ import time
+ import socket
+@@ -248,6 +249,43 @@
+             quitting = True
+             thread.interrupt_main()
+ 
++class _RPCFile(io.TextIOBase):
++    """Wrapper class for the RPC proxy to typecheck arguments
++    that may not support pickling. The base class is there only
++    to support type tests; all implementations come from the remote
++    object."""
++
++    def __init__(self, rpc):
++        super.__setattr__(self, 'rpc', rpc)
++
++    def __getattribute__(self, name):
++        # When accessing the 'rpc' attribute, or 'write', use ours
++        if name in ('rpc', 'write', 'writelines'):
++            return io.TextIOBase.__getattribute__(self, name)
++        # Else only look into the remote object only
++        return getattr(self.rpc, name)
++
++    def __setattr__(self, name, value):
++        return setattr(self.rpc, name, value)
++
++    @staticmethod
++    def _ensure_string(func):
++        def f(self, s):
++            if not isinstance(s, basestring):
++                raise TypeError('must be str, not ' + type(s).__name__)
++            return func(self, s)
++        return f
++
++class _RPCOutputFile(_RPCFile):
++    @_RPCFile._ensure_string
++    def write(self, s):
++        return self.rpc.write(s)
++
++class _RPCInputFile(_RPCFile):
++    @_RPCFile._ensure_string
++    def write(self, s):
++        raise io.UnsupportedOperation("not writable")
++    writelines = write
+ 
+ class MyHandler(rpc.RPCHandler):
+ 
+@@ -255,9 +293,10 @@
+         """Override base method"""
+         executive = Executive(self)
+         self.register("exec", executive)
+-        sys.stdin = self.console = self.get_remote_proxy("stdin")
+-        sys.stdout = self.get_remote_proxy("stdout")
+-        sys.stderr = self.get_remote_proxy("stderr")
++        self.console = self.get_remote_proxy("stdin")
++        sys.stdin = _RPCInputFile(self.console)
++        sys.stdout = _RPCOutputFile(self.get_remote_proxy("stdout"))
++        sys.stderr = _RPCOutputFile(self.get_remote_proxy("stderr"))
+         from idlelib import IOBinding
+         sys.stdin.encoding = sys.stdout.encoding = \
+                              sys.stderr.encoding = IOBinding.encoding
+diff -r 70274d53c1dd Lib/io.py
+--- a/Lib/io.py
++++ b/Lib/io.py
+@@ -34,15 +34,6 @@
+ """
+ # New I/O library conforming to PEP 3116.
+ 
+-# XXX edge cases when switching between reading/writing
+-# XXX need to support 1 meaning line-buffered
+-# XXX whenever an argument is None, use the default value
+-# XXX read/write ops should check readable/writable
+-# XXX buffered readinto should work with arbitrary buffer objects
+-# XXX use incremental encoder for text output, at least for UTF-16 and UTF-8-SIG
+-# XXX check writable, readable and seekable in appropriate places
+-
+-
+ __author__ = ("Guido van Rossum <guido@python.org>, "
+               "Mike Verdone <mike.verdone@gmail.com>, "
+               "Mark Russell <mark.russell@zen.co.uk>, "
+diff -r 70274d53c1dd Lib/json/__init__.py
+--- a/Lib/json/__init__.py
++++ b/Lib/json/__init__.py
+@@ -95,7 +95,7 @@
+         "json": "obj"
+     }
+     $ echo '{ 1.2:3.4}' | python -m json.tool
+-    Expecting property name: line 1 column 2 (char 2)
++    Expecting property name enclosed in double quotes: line 1 column 2 (char 2)
+ """
+ __version__ = '2.0.9'
+ __all__ = [
+diff -r 70274d53c1dd Lib/json/decoder.py
+--- a/Lib/json/decoder.py
++++ b/Lib/json/decoder.py
+@@ -169,7 +169,8 @@
+                 pairs = object_hook(pairs)
+             return pairs, end + 1
+         elif nextchar != '"':
+-            raise ValueError(errmsg("Expecting property name", s, end))
++            raise ValueError(errmsg(
++                "Expecting property name enclosed in double quotes", s, end))
+     end += 1
+     while True:
+         key, end = scanstring(s, end, encoding, strict)
+@@ -179,8 +180,7 @@
+         if s[end:end + 1] != ':':
+             end = _w(s, end).end()
+             if s[end:end + 1] != ':':
+-                raise ValueError(errmsg("Expecting : delimiter", s, end))
+-
++                raise ValueError(errmsg("Expecting ':' delimiter", s, end))
+         end += 1
+ 
+         try:
+@@ -209,7 +209,7 @@
+         if nextchar == '}':
+             break
+         elif nextchar != ',':
+-            raise ValueError(errmsg("Expecting , delimiter", s, end - 1))
++            raise ValueError(errmsg("Expecting ',' delimiter", s, end - 1))
+ 
+         try:
+             nextchar = s[end]
+@@ -224,8 +224,8 @@
+ 
+         end += 1
+         if nextchar != '"':
+-            raise ValueError(errmsg("Expecting property name", s, end - 1))
+-
++            raise ValueError(errmsg(
++                "Expecting property name enclosed in double quotes", s, end - 1))
+     if object_pairs_hook is not None:
+         result = object_pairs_hook(pairs)
+         return result, end
+@@ -259,8 +259,7 @@
+         if nextchar == ']':
+             break
+         elif nextchar != ',':
+-            raise ValueError(errmsg("Expecting , delimiter", s, end))
+-
++            raise ValueError(errmsg("Expecting ',' delimiter", s, end))
+         try:
+             if s[end] in _ws:
+                 end += 1
+diff -r 70274d53c1dd Lib/json/encoder.py
+--- a/Lib/json/encoder.py
++++ b/Lib/json/encoder.py
+@@ -27,8 +27,7 @@
+     ESCAPE_DCT.setdefault(chr(i), '\\u{0:04x}'.format(i))
+     #ESCAPE_DCT.setdefault(chr(i), '\\u%04x' % (i,))
+ 
+-# Assume this produces an infinity on all machines (probably not guaranteed)
+-INFINITY = float('1e66666')
++INFINITY = float('inf')
+ FLOAT_REPR = repr
+ 
+ def encode_basestring(s):
+diff -r 70274d53c1dd Lib/json/tool.py
+--- a/Lib/json/tool.py
++++ b/Lib/json/tool.py
+@@ -7,7 +7,7 @@
+         "json": "obj"
+     }
+     $ echo '{ 1.2:3.4}' | python -m json.tool
+-    Expecting property name: line 1 column 2 (char 2)
++    Expecting property name enclosed in double quotes: line 1 column 2 (char 2)
+ 
+ """
+ import sys
+diff -r 70274d53c1dd Lib/keyword.py
+--- a/Lib/keyword.py
++++ b/Lib/keyword.py
+@@ -7,7 +7,7 @@
+ To update the symbols in this file, 'cd' to the top directory of
+ the python source tree after building the interpreter and run:
+ 
+-    python Lib/keyword.py
++    ./python Lib/keyword.py
+ """
+ 
+ __all__ = ["iskeyword", "kwlist"]
+diff -r 70274d53c1dd Lib/lib-tk/Tkinter.py
+--- a/Lib/lib-tk/Tkinter.py
++++ b/Lib/lib-tk/Tkinter.py
+@@ -534,12 +534,19 @@
+ 
+         The type keyword specifies the form in which the data is
+         to be returned and should be an atom name such as STRING
+-        or FILE_NAME.  Type defaults to STRING.
++        or FILE_NAME.  Type defaults to STRING, except on X11, where the default
++        is to try UTF8_STRING and fall back to STRING.
+ 
+         This command is equivalent to:
+ 
+         selection_get(CLIPBOARD)
+         """
++        if 'type' not in kw and self._windowingsystem == 'x11':
++            try:
++                kw['type'] = 'UTF8_STRING'
++                return self.tk.call(('clipboard', 'get') + self._options(kw))
++            except TclError:
++                del kw['type']
+         return self.tk.call(('clipboard', 'get') + self._options(kw))
+ 
+     def clipboard_clear(self, **kw):
+@@ -621,8 +628,16 @@
+         A keyword parameter selection specifies the name of
+         the selection and defaults to PRIMARY.  A keyword
+         parameter displayof specifies a widget on the display
+-        to use."""
++        to use. A keyword parameter type specifies the form of data to be
++        fetched, defaulting to STRING except on X11, where UTF8_STRING is tried
++        before STRING."""
+         if 'displayof' not in kw: kw['displayof'] = self._w
++        if 'type' not in kw and self._windowingsystem == 'x11':
++            try:
++                kw['type'] = 'UTF8_STRING'
++                return self.tk.call(('selection', 'get') + self._options(kw))
++            except TclError:
++                del kw['type']
+         return self.tk.call(('selection', 'get') + self._options(kw))
+     def selection_handle(self, command, **kw):
+         """Specify a function COMMAND to call if the X
+@@ -1037,6 +1052,15 @@
+         if displayof is None:
+             return ('-displayof', self._w)
+         return ()
++    @property
++    def _windowingsystem(self):
++        """Internal function."""
++        try:
++            return self._root()._windowingsystem_cached
++        except AttributeError:
++            ws = self._root()._windowingsystem_cached = \
++                        self.tk.call('tk', 'windowingsystem')
++            return ws
+     def _options(self, cnf, kw = None):
+         """Internal function."""
+         if kw:
+diff -r 70274d53c1dd Lib/lib-tk/tkSimpleDialog.py
+--- a/Lib/lib-tk/tkSimpleDialog.py
++++ b/Lib/lib-tk/tkSimpleDialog.py
+@@ -200,7 +200,7 @@
+         self.entry = Entry(master, name="entry")
+         self.entry.grid(row=1, padx=5, sticky=W+E)
+ 
+-        if self.initialvalue:
++        if self.initialvalue is not None:
+             self.entry.insert(0, self.initialvalue)
+             self.entry.select_range(0, END)
+ 
+diff -r 70274d53c1dd Lib/lib-tk/ttk.py
+--- a/Lib/lib-tk/ttk.py
++++ b/Lib/lib-tk/ttk.py
+@@ -1253,7 +1253,7 @@
+ 
+ 
+     def exists(self, item):
+-        """Returns True if the specified item is present in the three,
++        """Returns True if the specified item is present in the tree,
+         False otherwise."""
+         return bool(self.tk.call(self._w, "exists", item))
+ 
+diff -r 70274d53c1dd Lib/locale.py
+--- a/Lib/locale.py
++++ b/Lib/locale.py
+@@ -18,6 +18,14 @@
+ import operator
+ import functools
+ 
++try:
++    _unicode = unicode
++except NameError:
++    # If Python is built without Unicode support, the unicode type
++    # will not exist. Fake one.
++    class _unicode(object):
++        pass
++
+ # Try importing the _locale module.
+ #
+ # If this fails, fall back on a basic 'C' locale emulation.
+@@ -353,7 +361,7 @@
+ 
+     """
+     # Normalize the locale name and extract the encoding
+-    if isinstance(localename, unicode):
++    if isinstance(localename, _unicode):
+         localename = localename.encode('ascii')
+     fullname = localename.translate(_ascii_lower_map)
+     if ':' in fullname:
+@@ -1581,8 +1589,7 @@
+ # to include every locale up to Windows Vista.
+ #
+ # NOTE: this mapping is incomplete.  If your language is missing, please
+-# submit a bug report to Python bug manager, which you can find via:
+-#     http://www.python.org/dev/
++# submit a bug report to the Python bug tracker at http://bugs.python.org/
+ # Make sure you include the missing language identifier and the suggested
+ # locale code.
+ #
+diff -r 70274d53c1dd Lib/logging/__init__.py
+--- a/Lib/logging/__init__.py
++++ b/Lib/logging/__init__.py
+@@ -1,4 +1,4 @@
+-# Copyright 2001-2010 by Vinay Sajip. All Rights Reserved.
++# Copyright 2001-2012 by Vinay Sajip. All Rights Reserved.
+ #
+ # Permission to use, copy, modify, and distribute this software and its
+ # documentation for any purpose and without fee is hereby granted,
+@@ -16,9 +16,9 @@
+ 
+ """
+ Logging package for Python. Based on PEP 282 and comments thereto in
+-comp.lang.python, and influenced by Apache's log4j system.
++comp.lang.python.
+ 
+-Copyright (C) 2001-2010 Vinay Sajip. All Rights Reserved.
++Copyright (C) 2001-2012 Vinay Sajip. All Rights Reserved.
+ 
+ To use, simply 'import logging' and log away!
+ """
+@@ -828,8 +828,12 @@
+         """
+         Flushes the stream.
+         """
+-        if self.stream and hasattr(self.stream, "flush"):
+-            self.stream.flush()
++        self.acquire()
++        try:
++            if self.stream and hasattr(self.stream, "flush"):
++                self.stream.flush()
++        finally:
++            self.release()
+ 
+     def emit(self, record):
+         """
+@@ -900,12 +904,16 @@
+         """
+         Closes the stream.
+         """
+-        if self.stream:
+-            self.flush()
+-            if hasattr(self.stream, "close"):
+-                self.stream.close()
+-            StreamHandler.close(self)
+-            self.stream = None
++        self.acquire()
++        try:
++            if self.stream:
++                self.flush()
++                if hasattr(self.stream, "close"):
++                    self.stream.close()
++                StreamHandler.close(self)
++                self.stream = None
++        finally:
++            self.release()
+ 
+     def _open(self):
+         """
+@@ -1165,11 +1173,12 @@
+         if self.isEnabledFor(ERROR):
+             self._log(ERROR, msg, args, **kwargs)
+ 
+-    def exception(self, msg, *args):
++    def exception(self, msg, *args, **kwargs):
+         """
+         Convenience method for logging an ERROR with exception information.
+         """
+-        self.error(msg, exc_info=1, *args)
++        kwargs['exc_info'] = 1
++        self.error(msg, *args, **kwargs)
+ 
+     def critical(self, msg, *args, **kwargs):
+         """
+@@ -1574,12 +1583,13 @@
+         basicConfig()
+     root.error(msg, *args, **kwargs)
+ 
+-def exception(msg, *args):
++def exception(msg, *args, **kwargs):
+     """
+     Log a message with severity 'ERROR' on the root logger,
+     with exception information.
+     """
+-    error(msg, exc_info=1, *args)
++    kwargs['exc_info'] = 1
++    error(msg, *args, **kwargs)
+ 
+ def warning(msg, *args, **kwargs):
+     """
+diff -r 70274d53c1dd Lib/logging/handlers.py
+--- a/Lib/logging/handlers.py
++++ b/Lib/logging/handlers.py
+@@ -1,4 +1,4 @@
+-# Copyright 2001-2010 by Vinay Sajip. All Rights Reserved.
++# Copyright 2001-2012 by Vinay Sajip. All Rights Reserved.
+ #
+ # Permission to use, copy, modify, and distribute this software and its
+ # documentation for any purpose and without fee is hereby granted,
+@@ -16,15 +16,14 @@
+ 
+ """
+ Additional handlers for the logging package for Python. The core package is
+-based on PEP 282 and comments thereto in comp.lang.python, and influenced by
+-Apache's log4j system.
++based on PEP 282 and comments thereto in comp.lang.python.
+ 
+-Copyright (C) 2001-2010 Vinay Sajip. All Rights Reserved.
++Copyright (C) 2001-2012 Vinay Sajip. All Rights Reserved.
+ 
+ To use, simply 'import logging.handlers' and log away!
+ """
+ 
+-import logging, socket, os, cPickle, struct, time, re
++import errno, logging, socket, os, cPickle, struct, time, re
+ from stat import ST_DEV, ST_INO, ST_MTIME
+ 
+ try:
+@@ -273,9 +272,10 @@
+                         dstAtRollover = time.localtime(newRolloverAt)[-1]
+                         if dstNow != dstAtRollover:
+                             if not dstNow:  # DST kicks in before next rollover, so we need to deduct an hour
+-                                newRolloverAt = newRolloverAt - 3600
++                                addend = -3600
+                             else:           # DST bows out before next rollover, so we need to add an hour
+-                                newRolloverAt = newRolloverAt + 3600
++                                addend = 3600
++                            newRolloverAt += addend
+                     result = newRolloverAt
+         return result
+ 
+@@ -327,11 +327,20 @@
+             self.stream.close()
+             self.stream = None
+         # get the time that this sequence started at and make it a TimeTuple
++        currentTime = int(time.time())
++        dstNow = time.localtime(currentTime)[-1]
+         t = self.rolloverAt - self.interval
+         if self.utc:
+             timeTuple = time.gmtime(t)
+         else:
+             timeTuple = time.localtime(t)
++            dstThen = timeTuple[-1]
++            if dstNow != dstThen:
++                if dstNow:
++                    addend = 3600
++                else:
++                    addend = -3600
++                timeTuple = time.localtime(t + addend)
+         dfn = self.baseFilename + "." + time.strftime(self.suffix, timeTuple)
+         if os.path.exists(dfn):
+             os.remove(dfn)
+@@ -347,19 +356,18 @@
+         #print "%s -> %s" % (self.baseFilename, dfn)
+         self.mode = 'w'
+         self.stream = self._open()
+-        currentTime = int(time.time())
+         newRolloverAt = self.computeRollover(currentTime)
+         while newRolloverAt <= currentTime:
+             newRolloverAt = newRolloverAt + self.interval
+         #If DST changes and midnight or weekly rollover, adjust for this.
+         if (self.when == 'MIDNIGHT' or self.when.startswith('W')) and not self.utc:
+-            dstNow = time.localtime(currentTime)[-1]
+             dstAtRollover = time.localtime(newRolloverAt)[-1]
+             if dstNow != dstAtRollover:
+                 if not dstNow:  # DST kicks in before next rollover, so we need to deduct an hour
+-                    newRolloverAt = newRolloverAt - 3600
++                    addend = -3600
+                 else:           # DST bows out before next rollover, so we need to add an hour
+-                    newRolloverAt = newRolloverAt + 3600
++                    addend = 3600
++                newRolloverAt += addend
+         self.rolloverAt = newRolloverAt
+ 
+ class WatchedFileHandler(logging.FileHandler):
+@@ -384,11 +392,13 @@
+     """
+     def __init__(self, filename, mode='a', encoding=None, delay=0):
+         logging.FileHandler.__init__(self, filename, mode, encoding, delay)
+-        if not os.path.exists(self.baseFilename):
+-            self.dev, self.ino = -1, -1
+-        else:
+-            stat = os.stat(self.baseFilename)
+-            self.dev, self.ino = stat[ST_DEV], stat[ST_INO]
++        self.dev, self.ino = -1, -1
++        self._statstream()
++
++    def _statstream(self):
++        if self.stream:
++            sres = os.fstat(self.stream.fileno())
++            self.dev, self.ino = sres[ST_DEV], sres[ST_INO]
+ 
+     def emit(self, record):
+         """
+@@ -398,19 +408,27 @@
+         has, close the old stream and reopen the file to get the
+         current stream.
+         """
+-        if not os.path.exists(self.baseFilename):
+-            stat = None
+-            changed = 1
+-        else:
+-            stat = os.stat(self.baseFilename)
+-            changed = (stat[ST_DEV] != self.dev) or (stat[ST_INO] != self.ino)
+-        if changed and self.stream is not None:
+-            self.stream.flush()
+-            self.stream.close()
+-            self.stream = self._open()
+-            if stat is None:
+-                stat = os.stat(self.baseFilename)
+-            self.dev, self.ino = stat[ST_DEV], stat[ST_INO]
++        # Reduce the chance of race conditions by stat'ing by path only
++        # once and then fstat'ing our new fd if we opened a new log stream.
++        # See issue #14632: Thanks to John Mulligan for the problem report
++        # and patch.
++        try:
++            # stat the file by path, checking for existence
++            sres = os.stat(self.baseFilename)
++        except OSError as err:
++            if err.errno == errno.ENOENT:
++                sres = None
++            else:
++                raise
++        # compare file system stat with that of our stream file handle
++        if not sres or sres[ST_DEV] != self.dev or sres[ST_INO] != self.ino:
++            if self.stream is not None:
++                # we have an open file handle, clean it up
++                self.stream.flush()
++                self.stream.close()
++                # open a new file handle and get new stat info from that fd
++                self.stream = self._open()
++                self._statstream()
+         logging.FileHandler.emit(self, record)
+ 
+ class SocketHandler(logging.Handler):
+@@ -520,9 +538,16 @@
+         """
+         ei = record.exc_info
+         if ei:
+-            dummy = self.format(record) # just to get traceback text into record.exc_text
++            # just to get traceback text into record.exc_text ...
++            dummy = self.format(record)
+             record.exc_info = None  # to avoid Unpickleable error
+-        s = cPickle.dumps(record.__dict__, 1)
++        # See issue #14436: If msg or args are objects, they may not be
++        # available on the receiving end. So we convert the msg % args
++        # to a string, save it as msg and zap the args.
++        d = dict(record.__dict__)
++        d['msg'] = record.getMessage()
++        d['args'] = None
++        s = cPickle.dumps(d, 1)
+         if ei:
+             record.exc_info = ei  # for next handler
+         slen = struct.pack(">L", len(s))
+@@ -563,9 +588,13 @@
+         """
+         Closes the socket.
+         """
+-        if self.sock:
+-            self.sock.close()
+-            self.sock = None
++        self.acquire()
++        try:
++            if self.sock:
++                self.sock.close()
++                self.sock = None
++        finally:
++            self.release()
+         logging.Handler.close(self)
+ 
+ class DatagramHandler(SocketHandler):
+@@ -742,7 +771,11 @@
+         except socket.error:
+             self.socket.close()
+             self.socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
+-            self.socket.connect(address)
++            try:
++                self.socket.connect(address)
++            except socket.error:
++                self.socket.close()
++                raise
+ 
+     # curious: when talking to the unix-domain '/dev/log' socket, a
+     #   zero-terminator seems to be required.  this string is placed
+@@ -767,8 +800,12 @@
+         """
+         Closes the socket.
+         """
+-        if self.unixsocket:
+-            self.socket.close()
++        self.acquire()
++        try:
++            if self.unixsocket:
++                self.socket.close()
++        finally:
++            self.release()
+         logging.Handler.close(self)
+ 
+     def mapPriority(self, levelName):
+@@ -798,8 +835,6 @@
+         # Message is a string. Convert to bytes as required by RFC 5424
+         if type(msg) is unicode:
+             msg = msg.encode('utf-8')
+-            if codecs:
+-                msg = codecs.BOM_UTF8 + msg
+         msg = prio + msg
+         try:
+             if self.unixsocket:
+@@ -852,6 +887,7 @@
+         self.toaddrs = toaddrs
+         self.subject = subject
+         self.secure = secure
++        self._timeout = 5.0
+ 
+     def getSubject(self, record):
+         """
+@@ -874,7 +910,7 @@
+             port = self.mailport
+             if not port:
+                 port = smtplib.SMTP_PORT
+-            smtp = smtplib.SMTP(self.mailhost, port)
++            smtp = smtplib.SMTP(self.mailhost, port, timeout=self._timeout)
+             msg = self.format(record)
+             msg = "From: %s\r\nTo: %s\r\nSubject: %s\r\nDate: %s\r\n\r\n%s" % (
+                             self.fromaddr,
+@@ -1096,7 +1132,11 @@
+ 
+         This version just zaps the buffer to empty.
+         """
+-        self.buffer = []
++        self.acquire()
++        try:
++            self.buffer = []
++        finally:
++            self.release()
+ 
+     def close(self):
+         """
+@@ -1144,15 +1184,23 @@
+         records to the target, if there is one. Override if you want
+         different behaviour.
+         """
+-        if self.target:
+-            for record in self.buffer:
+-                self.target.handle(record)
+-            self.buffer = []
++        self.acquire()
++        try:
++            if self.target:
++                for record in self.buffer:
++                    self.target.handle(record)
++                self.buffer = []
++        finally:
++            self.release()
+ 
+     def close(self):
+         """
+         Flush, set the target to None and lose the buffer.
+         """
+         self.flush()
+-        self.target = None
+-        BufferingHandler.close(self)
++        self.acquire()
++        try:
++            self.target = None
++            BufferingHandler.close(self)
++        finally:
++            self.release()
+diff -r 70274d53c1dd Lib/mailbox.py
+--- a/Lib/mailbox.py
++++ b/Lib/mailbox.py
+@@ -561,16 +561,19 @@
+         self._file = f
+         self._toc = None
+         self._next_key = 0
+-        self._pending = False   # No changes require rewriting the file.
++        self._pending = False       # No changes require rewriting the file.
++        self._pending_sync = False  # No need to sync the file
+         self._locked = False
+-        self._file_length = None        # Used to record mailbox size
++        self._file_length = None    # Used to record mailbox size
+ 
+     def add(self, message):
+         """Add message and return assigned key."""
+         self._lookup()
+         self._toc[self._next_key] = self._append_message(message)
+         self._next_key += 1
+-        self._pending = True
++        # _append_message appends the message to the mailbox file. We
++        # don't need a full rewrite + rename, sync is enough.
++        self._pending_sync = True
+         return self._next_key - 1
+ 
+     def remove(self, key):
+@@ -616,6 +619,11 @@
+     def flush(self):
+         """Write any pending changes to disk."""
+         if not self._pending:
++            if self._pending_sync:
++                # Messages have only been added, so syncing the file
++                # is enough.
++                _sync_flush(self._file)
++                self._pending_sync = False
+             return
+ 
+         # In order to be writing anything out at all, self._toc must
+@@ -649,6 +657,7 @@
+                     new_file.write(buffer)
+                 new_toc[key] = (new_start, new_file.tell())
+                 self._post_message_hook(new_file)
++            self._file_length = new_file.tell()
+         except:
+             new_file.close()
+             os.remove(new_file.name)
+@@ -656,6 +665,9 @@
+         _sync_close(new_file)
+         # self._file is about to get replaced, so no need to sync.
+         self._file.close()
++        # Make sure the new file's mode is the same as the old file's
++        mode = os.stat(self._path).st_mode
++        os.chmod(new_file.name, mode)
+         try:
+             os.rename(new_file.name, self._path)
+         except OSError, e:
+@@ -668,6 +680,7 @@
+         self._file = open(self._path, 'rb+')
+         self._toc = new_toc
+         self._pending = False
++        self._pending_sync = False
+         if self._locked:
+             _lock_file(self._file, dotlock=False)
+ 
+@@ -704,6 +717,12 @@
+         """Append message to mailbox and return (start, stop) offsets."""
+         self._file.seek(0, 2)
+         before = self._file.tell()
++        if len(self._toc) == 0 and not self._pending:
++            # This is the first message, and the _pre_mailbox_hook
++            # hasn't yet been called. If self._pending is True,
++            # messages have been removed, so _pre_mailbox_hook must
++            # have been called already.
++            self._pre_mailbox_hook(self._file)
+         try:
+             self._pre_message_hook(self._file)
+             offsets = self._install_message(message)
+@@ -1367,9 +1386,9 @@
+                 line = message.readline()
+                 self._file.write(line.replace('\n', os.linesep))
+                 if line == '\n' or line == '':
+-                    self._file.write('*** EOOH ***' + os.linesep)
+                     if first_pass:
+                         first_pass = False
++                        self._file.write('*** EOOH ***' + os.linesep)
+                         message.seek(original_pos)
+                     else:
+                         break
+diff -r 70274d53c1dd Lib/mimetypes.py
+--- a/Lib/mimetypes.py
++++ b/Lib/mimetypes.py
+@@ -432,6 +432,7 @@
+         '.hdf'    : 'application/x-hdf',
+         '.htm'    : 'text/html',
+         '.html'   : 'text/html',
++        '.ico'    : 'image/vnd.microsoft.icon',
+         '.ief'    : 'image/ief',
+         '.jpe'    : 'image/jpeg',
+         '.jpeg'   : 'image/jpeg',
+diff -r 70274d53c1dd Lib/multiprocessing/connection.py
+--- a/Lib/multiprocessing/connection.py
++++ b/Lib/multiprocessing/connection.py
+@@ -186,6 +186,8 @@
+         '''
+         if duplex:
+             s1, s2 = socket.socketpair()
++            s1.setblocking(True)
++            s2.setblocking(True)
+             c1 = _multiprocessing.Connection(os.dup(s1.fileno()))
+             c2 = _multiprocessing.Connection(os.dup(s2.fileno()))
+             s1.close()
+@@ -251,6 +253,7 @@
+         self._socket = socket.socket(getattr(socket, family))
+         try:
+             self._socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
++            self._socket.setblocking(True)
+             self._socket.bind(address)
+             self._socket.listen(backlog)
+             self._address = self._socket.getsockname()
+@@ -269,6 +272,7 @@
+ 
+     def accept(self):
+         s, self._last_accepted = self._socket.accept()
++        s.setblocking(True)
+         fd = duplicate(s.fileno())
+         conn = _multiprocessing.Connection(fd)
+         s.close()
+@@ -286,6 +290,7 @@
+     '''
+     family = address_type(address)
+     s = socket.socket( getattr(socket, family) )
++    s.setblocking(True)
+     t = _init_timeout()
+ 
+     while 1:
+@@ -348,7 +353,10 @@
+             try:
+                 win32.ConnectNamedPipe(handle, win32.NULL)
+             except WindowsError, e:
+-                if e.args[0] != win32.ERROR_PIPE_CONNECTED:
++                # ERROR_NO_DATA can occur if a client has already connected,
++                # written data and then disconnected -- see Issue 14725.
++                if e.args[0] not in (win32.ERROR_PIPE_CONNECTED,
++                                     win32.ERROR_NO_DATA):
+                     raise
+             return _multiprocessing.PipeConnection(handle)
+ 
+diff -r 70274d53c1dd Lib/multiprocessing/dummy/__init__.py
+--- a/Lib/multiprocessing/dummy/__init__.py
++++ b/Lib/multiprocessing/dummy/__init__.py
+@@ -70,7 +70,8 @@
+     def start(self):
+         assert self._parent is current_process()
+         self._start_called = True
+-        self._parent._children[self] = None
++        if hasattr(self._parent, '_children'):
++            self._parent._children[self] = None
+         threading.Thread.start(self)
+ 
+     @property
+diff -r 70274d53c1dd Lib/multiprocessing/forking.py
+--- a/Lib/multiprocessing/forking.py
++++ b/Lib/multiprocessing/forking.py
+@@ -336,7 +336,7 @@
+         '''
+         Returns prefix of command line used for spawning a child process
+         '''
+-        if process.current_process()._identity==() and is_forking(sys.argv):
++        if getattr(process.current_process(), '_inheriting', False):
+             raise RuntimeError('''
+             Attempt to start a new process before the current process
+             has finished its bootstrapping phase.
+diff -r 70274d53c1dd Lib/multiprocessing/pool.py
+--- a/Lib/multiprocessing/pool.py
++++ b/Lib/multiprocessing/pool.py
+@@ -68,6 +68,23 @@
+ # Code run by worker processes
+ #
+ 
++class MaybeEncodingError(Exception):
++    """Wraps possible unpickleable errors, so they can be
++    safely sent through the socket."""
++
++    def __init__(self, exc, value):
++        self.exc = repr(exc)
++        self.value = repr(value)
++        super(MaybeEncodingError, self).__init__(self.exc, self.value)
++
++    def __str__(self):
++        return "Error sending result: '%s'. Reason: '%s'" % (self.value,
++                                                             self.exc)
++
++    def __repr__(self):
++        return "<MaybeEncodingError: %s>" % str(self)
++
++
+ def worker(inqueue, outqueue, initializer=None, initargs=(), maxtasks=None):
+     assert maxtasks is None or (type(maxtasks) == int and maxtasks > 0)
+     put = outqueue.put
+@@ -96,7 +113,13 @@
+             result = (True, func(*args, **kwds))
+         except Exception, e:
+             result = (False, e)
+-        put((job, i, result))
++        try:
++            put((job, i, result))
++        except Exception as e:
++            wrapped = MaybeEncodingError(e, result[1])
++            debug("Possible encoding error while sending result: %s" % (
++                wrapped))
++            put((job, i, (False, wrapped)))
+         completed += 1
+     debug('worker exiting after %d tasks' % completed)
+ 
+@@ -466,7 +489,8 @@
+         # We must wait for the worker handler to exit before terminating
+         # workers because we don't want workers to be restarted behind our back.
+         debug('joining worker handler')
+-        worker_handler.join()
++        if threading.current_thread() is not worker_handler:
++            worker_handler.join(1e100)
+ 
+         # Terminate workers which haven't already finished.
+         if pool and hasattr(pool[0], 'terminate'):
+@@ -476,10 +500,12 @@
+                     p.terminate()
+ 
+         debug('joining task handler')
+-        task_handler.join(1e100)
++        if threading.current_thread() is not task_handler:
++            task_handler.join(1e100)
+ 
+         debug('joining result handler')
+-        result_handler.join(1e100)
++        if threading.current_thread() is not result_handler:
++            result_handler.join(1e100)
+ 
+         if pool and hasattr(pool[0], 'terminate'):
+             debug('joining pool workers')
+@@ -553,6 +579,7 @@
+         if chunksize <= 0:
+             self._number_left = 0
+             self._ready = True
++            del cache[self._job]
+         else:
+             self._number_left = length//chunksize + bool(length % chunksize)
+ 
+diff -r 70274d53c1dd Lib/multiprocessing/process.py
+--- a/Lib/multiprocessing/process.py
++++ b/Lib/multiprocessing/process.py
+@@ -262,12 +262,12 @@
+         except SystemExit, e:
+             if not e.args:
+                 exitcode = 1
+-            elif type(e.args[0]) is int:
++            elif isinstance(e.args[0], int):
+                 exitcode = e.args[0]
+             else:
+-                sys.stderr.write(e.args[0] + '\n')
++                sys.stderr.write(str(e.args[0]) + '\n')
+                 sys.stderr.flush()
+-                exitcode = 1
++                exitcode = 0 if isinstance(e.args[0], str) else 1
+         except:
+             exitcode = 1
+             import traceback
+diff -r 70274d53c1dd Lib/numbers.py
+--- a/Lib/numbers.py
++++ b/Lib/numbers.py
+@@ -303,7 +303,7 @@
+         raise NotImplementedError
+ 
+     def __index__(self):
+-        """index(self)"""
++        """Called whenever an index is needed, such as in slicing"""
+         return long(self)
+ 
+     @abstractmethod
+diff -r 70274d53c1dd Lib/posixpath.py
+--- a/Lib/posixpath.py
++++ b/Lib/posixpath.py
+@@ -17,6 +17,14 @@
+ import warnings
+ from genericpath import *
+ 
++try:
++    _unicode = unicode
++except NameError:
++    # If Python is built without Unicode support, the unicode type
++    # will not exist. Fake one.
++    class _unicode(object):
++        pass
++
+ __all__ = ["normcase","isabs","join","splitdrive","split","splitext",
+            "basename","dirname","commonprefix","getsize","getmtime",
+            "getatime","getctime","islink","exists","lexists","isdir","isfile",
+@@ -60,7 +68,8 @@
+ def join(a, *p):
+     """Join two or more pathname components, inserting '/' as needed.
+     If any component is an absolute path, all previous path components
+-    will be discarded."""
++    will be discarded.  An empty last part will result in a path that
++    ends with a separator."""
+     path = a
+     for b in p:
+         if b.startswith('/'):
+@@ -267,8 +276,8 @@
+         except KeyError:
+             return path
+         userhome = pwent.pw_dir
+-    userhome = userhome.rstrip('/') or userhome
+-    return userhome + path[i:]
++    userhome = userhome.rstrip('/')
++    return (userhome + path[i:]) or '/'
+ 
+ 
+ # Expand paths containing shell variable substitutions.
+@@ -312,7 +321,7 @@
+ def normpath(path):
+     """Normalize path, eliminating double slashes, etc."""
+     # Preserve unicode (if path is unicode)
+-    slash, dot = (u'/', u'.') if isinstance(path, unicode) else ('/', '.')
++    slash, dot = (u'/', u'.') if isinstance(path, _unicode) else ('/', '.')
+     if path == '':
+         return dot
+     initial_slashes = path.startswith('/')
+@@ -341,7 +350,7 @@
+ def abspath(path):
+     """Return an absolute path."""
+     if not isabs(path):
+-        if isinstance(path, unicode):
++        if isinstance(path, _unicode):
+             cwd = os.getcwdu()
+         else:
+             cwd = os.getcwd()
+diff -r 70274d53c1dd Lib/pyclbr.py
+--- a/Lib/pyclbr.py
++++ b/Lib/pyclbr.py
+@@ -128,6 +128,8 @@
+         parent = _readmodule(package, path, inpackage)
+         if inpackage is not None:
+             package = "%s.%s" % (inpackage, package)
++        if not '__path__' in parent:
++            raise ImportError('No package named {}'.format(package))
+         return _readmodule(submodule, parent['__path__'], package)
+ 
+     # Search the path for the module
+diff -r 70274d53c1dd Lib/pydoc.py
+--- a/Lib/pydoc.py
++++ b/Lib/pydoc.py
+@@ -1498,7 +1498,8 @@
+             raise ImportError, 'no Python documentation found for %r' % thing
+         return object, thing
+     else:
+-        return thing, getattr(thing, '__name__', None)
++        name = getattr(thing, '__name__', None)
++        return thing, name if isinstance(name, str) else None
+ 
+ def render_doc(thing, title='Python Library Documentation: %s', forceload=0):
+     """Render text documentation, given an object or a path to an object."""
+@@ -1799,7 +1800,7 @@
+ Welcome to Python %s!  This is the online help utility.
+ 
+ If this is your first time using Python, you should definitely check out
+-the tutorial on the Internet at http://docs.python.org/tutorial/.
++the tutorial on the Internet at http://docs.python.org/%s/tutorial/.
+ 
+ Enter the name of any module, keyword, or topic to get help on writing
+ Python programs and using Python modules.  To quit this help utility and
+@@ -1809,7 +1810,7 @@
+ "keywords", or "topics".  Each module also comes with a one-line summary
+ of what it does; to list the modules whose summaries contain a given word
+ such as "spam", type "modules spam".
+-''' % sys.version[:3])
++''' % tuple([sys.version[:3]]*2))
+ 
+     def list(self, items, columns=4, width=80):
+         items = items[:]
+diff -r 70274d53c1dd Lib/rlcompleter.py
+--- a/Lib/rlcompleter.py
++++ b/Lib/rlcompleter.py
+@@ -1,13 +1,11 @@
+-"""Word completion for GNU readline 2.0.
++"""Word completion for GNU readline.
+ 
+-This requires the latest extension to the readline module. The completer
+-completes keywords, built-ins and globals in a selectable namespace (which
+-defaults to __main__); when completing NAME.NAME..., it evaluates (!) the
+-expression up to the last dot and completes its attributes.
++The completer completes keywords, built-ins and globals in a selectable
++namespace (which defaults to __main__); when completing NAME.NAME..., it
++evaluates (!) the expression up to the last dot and completes its attributes.
+ 
+-It's very cool to do "import sys" type "sys.", hit the
+-completion key (twice), and see the list of names defined by the
+-sys module!
++It's very cool to do "import sys" type "sys.", hit the completion key (twice),
++and see the list of names defined by the sys module!
+ 
+ Tip: to use the tab key as the completion key, call
+ 
+@@ -15,18 +13,16 @@
+ 
+ Notes:
+ 
+-- Exceptions raised by the completer function are *ignored* (and
+-generally cause the completion to fail).  This is a feature -- since
+-readline sets the tty device in raw (or cbreak) mode, printing a
+-traceback wouldn't work well without some complicated hoopla to save,
+-reset and restore the tty state.
++- Exceptions raised by the completer function are *ignored* (and generally cause
++  the completion to fail).  This is a feature -- since readline sets the tty
++  device in raw (or cbreak) mode, printing a traceback wouldn't work well
++  without some complicated hoopla to save, reset and restore the tty state.
+ 
+-- The evaluation of the NAME.NAME... form may cause arbitrary
+-application defined code to be executed if an object with a
+-__getattr__ hook is found.  Since it is the responsibility of the
+-application (or the user) to enable this feature, I consider this an
+-acceptable risk.  More complicated expressions (e.g. function calls or
+-indexing operations) are *not* evaluated.
++- The evaluation of the NAME.NAME... form may cause arbitrary application
++  defined code to be executed if an object with a __getattr__ hook is found.
++  Since it is the responsibility of the application (or the user) to enable this
++  feature, I consider this an acceptable risk.  More complicated expressions
++  (e.g. function calls or indexing operations) are *not* evaluated.
+ 
+ - GNU readline is also used by the built-in functions input() and
+ raw_input(), and thus these also benefit/suffer from the completer
+@@ -35,7 +31,7 @@
+ its input.
+ 
+ - When the original stdin is not a tty device, GNU readline is never
+-used, and this module (and the readline module) are silently inactive.
++  used, and this module (and the readline module) are silently inactive.
+ 
+ """
+ 
+diff -r 70274d53c1dd Lib/shutil.py
+--- a/Lib/shutil.py
++++ b/Lib/shutil.py
+@@ -102,8 +102,10 @@
+         try:
+             os.chflags(dst, st.st_flags)
+         except OSError, why:
+-            if (not hasattr(errno, 'EOPNOTSUPP') or
+-                why.errno != errno.EOPNOTSUPP):
++            for err in 'EOPNOTSUPP', 'ENOTSUP':
++                if hasattr(errno, err) and why.errno == getattr(errno, err):
++                    break
++            else:
+                 raise
+ 
+ def copy(src, dst):
+diff -r 70274d53c1dd Lib/subprocess.py
+--- a/Lib/subprocess.py
++++ b/Lib/subprocess.py
+@@ -1016,7 +1016,17 @@
+         def terminate(self):
+             """Terminates the process
+             """
+-            _subprocess.TerminateProcess(self._handle, 1)
++            try:
++                _subprocess.TerminateProcess(self._handle, 1)
++            except OSError as e:
++                # ERROR_ACCESS_DENIED (winerror 5) is received when the
++                # process already died.
++                if e.winerror != 5:
++                    raise
++                rc = _subprocess.GetExitCodeProcess(self._handle)
++                if rc == _subprocess.STILL_ACTIVE:
++                    raise
++                self.returncode = rc
+ 
+         kill = terminate
+ 
+diff -r 70274d53c1dd Lib/symbol.py
+--- a/Lib/symbol.py
++++ b/Lib/symbol.py
+@@ -7,7 +7,7 @@
+ #  To update the symbols in this file, 'cd' to the top directory of
+ #  the python source tree after building the interpreter and run:
+ #
+-#    python Lib/symbol.py
++#    ./python Lib/symbol.py
+ 
+ #--start constants--
+ single_input = 256
+diff -r 70274d53c1dd Lib/tarfile.py
+--- a/Lib/tarfile.py
++++ b/Lib/tarfile.py
+@@ -2397,7 +2397,7 @@
+         """
+         if tarinfo.issym():
+             # Always search the entire archive.
+-            linkname = os.path.dirname(tarinfo.name) + "/" + tarinfo.linkname
++            linkname = "/".join(filter(None, (os.path.dirname(tarinfo.name), tarinfo.linkname)))
+             limit = None
+         else:
+             # Search the archive before the link, because a hard link is
+diff -r 70274d53c1dd Lib/telnetlib.py
+--- a/Lib/telnetlib.py
++++ b/Lib/telnetlib.py
+@@ -34,6 +34,7 @@
+ 
+ 
+ # Imported modules
++import errno
+ import sys
+ import socket
+ import select
+@@ -205,6 +206,7 @@
+         self.sb = 0 # flag for SB and SE sequence.
+         self.sbdataq = ''
+         self.option_callback = None
++        self._has_poll = hasattr(select, 'poll')
+         if host is not None:
+             self.open(host, port, timeout)
+ 
+@@ -287,6 +289,61 @@
+         is closed and no cooked data is available.
+ 
+         """
++        if self._has_poll:
++            return self._read_until_with_poll(match, timeout)
++        else:
++            return self._read_until_with_select(match, timeout)
++
++    def _read_until_with_poll(self, match, timeout):
++        """Read until a given string is encountered or until timeout.
++
++        This method uses select.poll() to implement the timeout.
++        """
++        n = len(match)
++        call_timeout = timeout
++        if timeout is not None:
++            from time import time
++            time_start = time()
++        self.process_rawq()
++        i = self.cookedq.find(match)
++        if i < 0:
++            poller = select.poll()
++            poll_in_or_priority_flags = select.POLLIN | select.POLLPRI
++            poller.register(self, poll_in_or_priority_flags)
++            while i < 0 and not self.eof:
++                try:
++                    ready = poller.poll(call_timeout)
++                except select.error as e:
++                    if e.errno == errno.EINTR:
++                        if timeout is not None:
++                            elapsed = time() - time_start
++                            call_timeout = timeout-elapsed
++                        continue
++                    raise
++                for fd, mode in ready:
++                    if mode & poll_in_or_priority_flags:
++                        i = max(0, len(self.cookedq)-n)
++                        self.fill_rawq()
++                        self.process_rawq()
++                        i = self.cookedq.find(match, i)
++                if timeout is not None:
++                    elapsed = time() - time_start
++                    if elapsed >= timeout:
++                        break
++                    call_timeout = timeout-elapsed
++            poller.unregister(self)
++        if i >= 0:
++            i = i + n
++            buf = self.cookedq[:i]
++            self.cookedq = self.cookedq[i:]
++            return buf
++        return self.read_very_lazy()
++
++    def _read_until_with_select(self, match, timeout=None):
++        """Read until a given string is encountered or until timeout.
++
++        The timeout is implemented using select.select().
++        """
+         n = len(match)
+         self.process_rawq()
+         i = self.cookedq.find(match)
+@@ -589,6 +646,79 @@
+         results are undeterministic, and may depend on the I/O timing.
+ 
+         """
++        if self._has_poll:
++            return self._expect_with_poll(list, timeout)
++        else:
++            return self._expect_with_select(list, timeout)
++
++    def _expect_with_poll(self, expect_list, timeout=None):
++        """Read until one from a list of a regular expressions matches.
++
++        This method uses select.poll() to implement the timeout.
++        """
++        re = None
++        expect_list = expect_list[:]
++        indices = range(len(expect_list))
++        for i in indices:
++            if not hasattr(expect_list[i], "search"):
++                if not re: import re
++                expect_list[i] = re.compile(expect_list[i])
++        call_timeout = timeout
++        if timeout is not None:
++            from time import time
++            time_start = time()
++        self.process_rawq()
++        m = None
++        for i in indices:
++            m = expect_list[i].search(self.cookedq)
++            if m:
++                e = m.end()
++                text = self.cookedq[:e]
++                self.cookedq = self.cookedq[e:]
++                break
++        if not m:
++            poller = select.poll()
++            poll_in_or_priority_flags = select.POLLIN | select.POLLPRI
++            poller.register(self, poll_in_or_priority_flags)
++            while not m and not self.eof:
++                try:
++                    ready = poller.poll(call_timeout)
++                except select.error as e:
++                    if e.errno == errno.EINTR:
++                        if timeout is not None:
++                            elapsed = time() - time_start
++                            call_timeout = timeout-elapsed
++                        continue
++                    raise
++                for fd, mode in ready:
++                    if mode & poll_in_or_priority_flags:
++                        self.fill_rawq()
++                        self.process_rawq()
++                        for i in indices:
++                            m = expect_list[i].search(self.cookedq)
++                            if m:
++                                e = m.end()
++                                text = self.cookedq[:e]
++                                self.cookedq = self.cookedq[e:]
++                                break
++                if timeout is not None:
++                    elapsed = time() - time_start
++                    if elapsed >= timeout:
++                        break
++                    call_timeout = timeout-elapsed
++            poller.unregister(self)
++        if m:
++            return (i, m, text)
++        text = self.read_very_lazy()
++        if not text and self.eof:
++            raise EOFError
++        return (-1, None, text)
++
++    def _expect_with_select(self, list, timeout=None):
++        """Read until one from a list of a regular expressions matches.
++
++        The timeout is implemented using select.select().
++        """
+         re = None
+         list = list[:]
+         indices = range(len(list))
+diff -r 70274d53c1dd Lib/test/crashers/buffer_mutate.py
+--- /dev/null
++++ b/Lib/test/crashers/buffer_mutate.py
+@@ -0,0 +1,30 @@
++#
++# The various methods of bufferobject.c (here buffer_subscript()) call
++# get_buf() before calling potentially more Python code (here via
++# PySlice_GetIndicesEx()).  But get_buf() already returned a void*
++# pointer.  This void* pointer can become invalid if the object
++# underlying the buffer is mutated (here a bytearray object).
++#
++# As usual, please keep in mind that the three "here" in the sentence
++# above are only examples.  Each can be changed easily and lead to
++# another crasher.
++#
++# This crashes for me on Linux 32-bits with CPython 2.6 and 2.7
++# with a segmentation fault.
++#
++
++
++class PseudoIndex(object):
++    def __index__(self):
++        for c in "foobar"*n:
++            a.append(c)
++        return n * 4
++
++
++for n in range(1, 100000, 100):
++    a = bytearray("test"*n)
++    buf = buffer(a)
++
++    s = buf[:PseudoIndex():1]
++    #print repr(s)
++    #assert s == "test"*n
+diff -r 70274d53c1dd Lib/test/crashers/decref_before_assignment.py
+--- /dev/null
++++ b/Lib/test/crashers/decref_before_assignment.py
+@@ -0,0 +1,44 @@
++"""
++General example for an attack against code like this:
++
++    Py_DECREF(obj->attr); obj->attr = ...;
++
++here in Module/_json.c:scanner_init().
++
++Explanation: if the first Py_DECREF() calls either a __del__ or a
++weakref callback, it will run while the 'obj' appears to have in
++'obj->attr' still the old reference to the object, but not holding
++the reference count any more.
++
++Status: progress has been made replacing these cases, but there is an
++infinite number of such cases.
++"""
++
++import _json, weakref
++
++class Ctx1(object):
++    encoding = "utf8"
++    strict = None
++    object_hook = None
++    object_pairs_hook = None
++    parse_float = None
++    parse_int = None
++    parse_constant = None
++
++class Foo(unicode):
++    pass
++
++def delete_me(*args):
++    print scanner.encoding.__dict__
++
++class Ctx2(Ctx1):
++    @property
++    def encoding(self):
++        global wref
++        f = Foo("utf8")
++        f.abc = globals()
++        wref = weakref.ref(f, delete_me)
++        return f
++
++scanner = _json.make_scanner(Ctx1())
++scanner.__init__(Ctx2())
+diff -r 70274d53c1dd Lib/test/mp_fork_bomb.py
+--- /dev/null
++++ b/Lib/test/mp_fork_bomb.py
+@@ -0,0 +1,16 @@
++import multiprocessing
++
++def foo(conn):
++    conn.send("123")
++
++# Because "if __name__ == '__main__'" is missing this will not work
++# correctly on Windows.  However, we should get a RuntimeError rather
++# than the Windows equivalent of a fork bomb.
++
++r, w = multiprocessing.Pipe(False)
++p = multiprocessing.Process(target=foo, args=(w,))
++p.start()
++w.close()
++print(r.recv())
++r.close()
++p.join()
+diff -r 70274d53c1dd Lib/test/regrtest.py
+--- a/Lib/test/regrtest.py
++++ b/Lib/test/regrtest.py
+@@ -540,6 +540,8 @@
+                     print stdout
+                 if stderr:
+                     print >>sys.stderr, stderr
++                sys.stdout.flush()
++                sys.stderr.flush()
+                 if result[0] == INTERRUPTED:
+                     assert result[1] == 'KeyboardInterrupt'
+                     raise KeyboardInterrupt   # What else?
+@@ -758,7 +760,9 @@
+     # the corresponding method names.
+ 
+     resources = ('sys.argv', 'cwd', 'sys.stdin', 'sys.stdout', 'sys.stderr',
+-                 'os.environ', 'sys.path', 'asyncore.socket_map')
++                 'os.environ', 'sys.path', 'asyncore.socket_map',
++                 'test_support.TESTFN',
++                )
+ 
+     def get_sys_argv(self):
+         return id(sys.argv), sys.argv, sys.argv[:]
+@@ -809,6 +813,21 @@
+             asyncore.close_all(ignore_all=True)
+             asyncore.socket_map.update(saved_map)
+ 
++    def get_test_support_TESTFN(self):
++        if os.path.isfile(test_support.TESTFN):
++            result = 'f'
++        elif os.path.isdir(test_support.TESTFN):
++            result = 'd'
++        else:
++            result = None
++        return result
++    def restore_test_support_TESTFN(self, saved_value):
++        if saved_value is None:
++            if os.path.isfile(test_support.TESTFN):
++                os.unlink(test_support.TESTFN)
++            elif os.path.isdir(test_support.TESTFN):
++                shutil.rmtree(test_support.TESTFN)
++
+     def resource_info(self):
+         for name in self.resources:
+             method_suffix = name.replace('.', '_')
+diff -r 70274d53c1dd Lib/test/script_helper.py
+--- a/Lib/test/script_helper.py
++++ b/Lib/test/script_helper.py
+@@ -10,7 +10,13 @@
+ import py_compile
+ import contextlib
+ import shutil
+-import zipfile
++try:
++    import zipfile
++except ImportError:
++    # If Python is build without Unicode support, importing _io will
++    # fail, which, in turn, means that zipfile cannot be imported
++    # Most of this module can then still be used.
++    pass
+ 
+ from test.test_support import strip_python_stderr
+ 
+diff -r 70274d53c1dd Lib/test/sha256.pem
+--- a/Lib/test/sha256.pem
++++ b/Lib/test/sha256.pem
+@@ -1,129 +1,128 @@
+ # Certificate chain for https://sha256.tbs-internet.com
+- 0 s:/C=FR/postalCode=14000/ST=Calvados/L=CAEN/street=22 rue de Bretagne/O=TBS INTERNET/OU=0002 440443810/OU=sha-256 production/CN=sha256.tbs-internet.com
+-   i:/C=FR/ST=Calvados/L=Caen/O=TBS INTERNET/OU=Terms and Conditions: http://www.tbs-internet.com/CA/repository/OU=TBS INTERNET CA/CN=TBS X509 CA SGC
++ 0 s:/C=FR/postalCode=14000/ST=Calvados/L=CAEN/street=22 rue de Bretagne/O=TBS INTERNET/OU=0002 440443810/OU=Certificats TBS X509/CN=ecom.tbs-x509.com
++   i:/C=FR/ST=Calvados/L=Caen/O=TBS INTERNET/OU=Terms and Conditions: http://www.tbs-internet.com/CA/repository/OU=TBS INTERNET CA/CN=TBS X509 CA business
+ -----BEGIN CERTIFICATE-----
+-MIIGXTCCBUWgAwIBAgIRAMmag+ygSAdxZsbyzYjhuW0wDQYJKoZIhvcNAQELBQAw
+-gcQxCzAJBgNVBAYTAkZSMREwDwYDVQQIEwhDYWx2YWRvczENMAsGA1UEBxMEQ2Fl
++MIIGTjCCBTagAwIBAgIQOh3d9dNDPq1cSdJmEiMpqDANBgkqhkiG9w0BAQUFADCB
++yTELMAkGA1UEBhMCRlIxETAPBgNVBAgTCENhbHZhZG9zMQ0wCwYDVQQHEwRDYWVu
++MRUwEwYDVQQKEwxUQlMgSU5URVJORVQxSDBGBgNVBAsTP1Rlcm1zIGFuZCBDb25k
++aXRpb25zOiBodHRwOi8vd3d3LnRicy1pbnRlcm5ldC5jb20vQ0EvcmVwb3NpdG9y
++eTEYMBYGA1UECxMPVEJTIElOVEVSTkVUIENBMR0wGwYDVQQDExRUQlMgWDUwOSBD
++QSBidXNpbmVzczAeFw0xMTAxMjUwMDAwMDBaFw0xMzAyMDUyMzU5NTlaMIHHMQsw
++CQYDVQQGEwJGUjEOMAwGA1UEERMFMTQwMDAxETAPBgNVBAgTCENhbHZhZG9zMQ0w
++CwYDVQQHEwRDQUVOMRswGQYDVQQJExIyMiBydWUgZGUgQnJldGFnbmUxFTATBgNV
++BAoTDFRCUyBJTlRFUk5FVDEXMBUGA1UECxMOMDAwMiA0NDA0NDM4MTAxHTAbBgNV
++BAsTFENlcnRpZmljYXRzIFRCUyBYNTA5MRowGAYDVQQDExFlY29tLnRicy14NTA5
++LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKRrlHUnJ++1lpcg
++jtYco7cdmRe+EEfTmwPfCdfV3G1QfsTSvY6FfMpm/83pqHfT+4ANwr18wD9ZrAEN
++G16mf9VdCGK12+TP7DmqeZyGIqlFFoahQnmb8EarvE43/1UeQ2CV9XmzwZvpqeli
++LfXsFonawrY3H6ZnMwS64St61Z+9gdyuZ/RbsoZBbT5KUjDEG844QRU4OT1IGeEI
++eY5NM5RNIh6ZNhVtqeeCxMS7afONkHQrOco73RdSTRck/Hj96Ofl3MHNHryr+AMK
++DGFk1kLCZGpPdXtkxXvaDeQoiYDlil26CWc+YK6xyDPMdsWvoG14ZLyCpzMXA7/7
++4YAQRH0CAwEAAaOCAjAwggIsMB8GA1UdIwQYMBaAFBoJBMz5CY+7HqDO1KQUf0vV
++I1jNMB0GA1UdDgQWBBQgOU8HsWzbmD4WZP5Wtdw7jca2WDAOBgNVHQ8BAf8EBAMC
++BaAwDAYDVR0TAQH/BAIwADAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIw
++TAYDVR0gBEUwQzBBBgsrBgEEAYDlNwIBATAyMDAGCCsGAQUFBwIBFiRodHRwczov
++L3d3dy50YnMtaW50ZXJuZXQuY29tL0NBL0NQUzEwdwYDVR0fBHAwbjA3oDWgM4Yx
++aHR0cDovL2NybC50YnMtaW50ZXJuZXQuY29tL1RCU1g1MDlDQWJ1c2luZXNzLmNy
++bDAzoDGgL4YtaHR0cDovL2NybC50YnMteDUwOS5jb20vVEJTWDUwOUNBYnVzaW5l
++c3MuY3JsMIGwBggrBgEFBQcBAQSBozCBoDA9BggrBgEFBQcwAoYxaHR0cDovL2Ny
++dC50YnMtaW50ZXJuZXQuY29tL1RCU1g1MDlDQWJ1c2luZXNzLmNydDA5BggrBgEF
++BQcwAoYtaHR0cDovL2NydC50YnMteDUwOS5jb20vVEJTWDUwOUNBYnVzaW5lc3Mu
++Y3J0MCQGCCsGAQUFBzABhhhodHRwOi8vb2NzcC50YnMteDUwOS5jb20wMwYDVR0R
++BCwwKoIRZWNvbS50YnMteDUwOS5jb22CFXd3dy5lY29tLnRicy14NTA5LmNvbTAN
++BgkqhkiG9w0BAQUFAAOCAQEArT4NHfbY87bGAw8lPV4DmHlmuDuVp/y7ltO3Ynse
++3Rz8RxW2AzuO0Oy2F0Cu4yWKtMyEyMXyHqWtae7ElRbdTu5w5GwVBLJHClCzC8S9
++SpgMMQTx3Rgn8vjkHuU9VZQlulZyiPK7yunjc7c310S9FRZ7XxOwf8Nnx4WnB+No
++WrfApzhhQl31w+RyrNxZe58hCfDDHmevRvwLjQ785ZoQXJDj2j3qAD4aI2yB8lB5
++oaE1jlCJzC7Kmz/Y9jzfmv/zAs1LQTm9ktevv4BTUFaGjv9jxnQ1xnS862ZiouLW
++zZYIlYPf4F6JjXGiIQgQRglILUfq3ftJd9/ok9W9ZF8h8w==
++-----END CERTIFICATE-----
++ 1 s:/C=FR/ST=Calvados/L=Caen/O=TBS INTERNET/OU=Terms and Conditions: http://www.tbs-internet.com/CA/repository/OU=TBS INTERNET CA/CN=TBS X509 CA business
++   i:/C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root
++-----BEGIN CERTIFICATE-----
++MIIFPzCCBCegAwIBAgIQDlBz/++iRSmLDeVRHT/hADANBgkqhkiG9w0BAQUFADBv
++MQswCQYDVQQGEwJTRTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFk
++ZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBF
++eHRlcm5hbCBDQSBSb290MB4XDTA1MTIwMTAwMDAwMFoXDTE5MDcwOTE4MTkyMlow
++gckxCzAJBgNVBAYTAkZSMREwDwYDVQQIEwhDYWx2YWRvczENMAsGA1UEBxMEQ2Fl
+ bjEVMBMGA1UEChMMVEJTIElOVEVSTkVUMUgwRgYDVQQLEz9UZXJtcyBhbmQgQ29u
+ ZGl0aW9uczogaHR0cDovL3d3dy50YnMtaW50ZXJuZXQuY29tL0NBL3JlcG9zaXRv
+-cnkxGDAWBgNVBAsTD1RCUyBJTlRFUk5FVCBDQTEYMBYGA1UEAxMPVEJTIFg1MDkg
+-Q0EgU0dDMB4XDTEwMDIxODAwMDAwMFoXDTEyMDIxOTIzNTk1OVowgcsxCzAJBgNV
+-BAYTAkZSMQ4wDAYDVQQREwUxNDAwMDERMA8GA1UECBMIQ2FsdmFkb3MxDTALBgNV
+-BAcTBENBRU4xGzAZBgNVBAkTEjIyIHJ1ZSBkZSBCcmV0YWduZTEVMBMGA1UEChMM
+-VEJTIElOVEVSTkVUMRcwFQYDVQQLEw4wMDAyIDQ0MDQ0MzgxMDEbMBkGA1UECxMS
+-c2hhLTI1NiBwcm9kdWN0aW9uMSAwHgYDVQQDExdzaGEyNTYudGJzLWludGVybmV0
+-LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKbuM8VT7f0nntwu
+-N3F7v9KIBlhKNAxqCrziOXU5iqUt8HrQB3DtHbdmII+CpVUlwlmepsx6G+srEZ9a
+-MIGAy0nxi5aLb7watkyIdPjJTMvTUBQ/+RPWzt5JtYbbY9BlJ+yci0dctP74f4NU
+-ISLtlrEjUbf2gTohLrcE01TfmOF6PDEbB5PKDi38cB3NzKfizWfrOaJW6Q1C1qOJ
+-y4/4jkUREX1UFUIxzx7v62VfjXSGlcjGpBX1fvtABQOSLeE0a6gciDZs1REqroFf
+-5eXtqYphpTa14Z83ITXMfgg5Nze1VtMnzI9Qx4blYBw4dgQVEuIsYr7FDBOITDzc
+-VEVXZx0CAwEAAaOCAj8wggI7MB8GA1UdIwQYMBaAFAdEdoWTKLx/bXjSCuv6TEvf
+-2YIfMB0GA1UdDgQWBBSJKI/AYVI9RQNY0QPIqc8ej2QivTAOBgNVHQ8BAf8EBAMC
+-BaAwDAYDVR0TAQH/BAIwADA0BgNVHSUELTArBggrBgEFBQcDAQYIKwYBBQUHAwIG
+-CisGAQQBgjcKAwMGCWCGSAGG+EIEATBMBgNVHSAERTBDMEEGCysGAQQBgOU3AgQB
+-MDIwMAYIKwYBBQUHAgEWJGh0dHBzOi8vd3d3LnRicy1pbnRlcm5ldC5jb20vQ0Ev
+-Q1BTNDBtBgNVHR8EZjBkMDKgMKAuhixodHRwOi8vY3JsLnRicy1pbnRlcm5ldC5j
+-b20vVEJTWDUwOUNBU0dDLmNybDAuoCygKoYoaHR0cDovL2NybC50YnMteDUwOS5j
+-b20vVEJTWDUwOUNBU0dDLmNybDCBpgYIKwYBBQUHAQEEgZkwgZYwOAYIKwYBBQUH
+-MAKGLGh0dHA6Ly9jcnQudGJzLWludGVybmV0LmNvbS9UQlNYNTA5Q0FTR0MuY3J0
+-MDQGCCsGAQUFBzAChihodHRwOi8vY3J0LnRicy14NTA5LmNvbS9UQlNYNTA5Q0FT
+-R0MuY3J0MCQGCCsGAQUFBzABhhhodHRwOi8vb2NzcC50YnMteDUwOS5jb20wPwYD
+-VR0RBDgwNoIXc2hhMjU2LnRicy1pbnRlcm5ldC5jb22CG3d3dy5zaGEyNTYudGJz
+-LWludGVybmV0LmNvbTANBgkqhkiG9w0BAQsFAAOCAQEAA5NL0D4QSqhErhlkdPmz
+-XtiMvdGL+ZehM4coTRIpasM/Agt36Rc0NzCvnQwKE+wkngg1Gy2qe7Q0E/ziqBtB
+-fZYzdVgu1zdiL4kTaf+wFKYAFGsFbyeEmXysy+CMwaNoF2vpSjCU1UD56bEnTX/W
+-fxVZYxtBQUpnu2wOsm8cDZuZRv9XrYgAhGj9Tt6F0aVHSDGn59uwShG1+BVF/uju
+-SCyPTTjL1oc7YElJUzR/x4mQJYvtQI8gDIDAGEOs7v3R/gKa5EMfbUQUI4C84UbI
+-Yz09Jdnws/MkC/Hm1BZEqk89u7Hvfv+oHqEb0XaUo0TDfsxE0M1sMdnLb91QNQBm
+-UQ==
+------END CERTIFICATE-----
+- 1 s:/C=FR/ST=Calvados/L=Caen/O=TBS INTERNET/OU=Terms and Conditions: http://www.tbs-internet.com/CA/repository/OU=TBS INTERNET CA/CN=TBS X509 CA SGC
+-   i:/C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root
+------BEGIN CERTIFICATE-----
+-MIIFVjCCBD6gAwIBAgIQXpDZ0ETJMV02WTx3GTnhhTANBgkqhkiG9w0BAQUFADBv
+-MQswCQYDVQQGEwJTRTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFk
+-ZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBF
+-eHRlcm5hbCBDQSBSb290MB4XDTA1MTIwMTAwMDAwMFoXDTE5MDYyNDE5MDYzMFow
+-gcQxCzAJBgNVBAYTAkZSMREwDwYDVQQIEwhDYWx2YWRvczENMAsGA1UEBxMEQ2Fl
+-bjEVMBMGA1UEChMMVEJTIElOVEVSTkVUMUgwRgYDVQQLEz9UZXJtcyBhbmQgQ29u
+-ZGl0aW9uczogaHR0cDovL3d3dy50YnMtaW50ZXJuZXQuY29tL0NBL3JlcG9zaXRv
+-cnkxGDAWBgNVBAsTD1RCUyBJTlRFUk5FVCBDQTEYMBYGA1UEAxMPVEJTIFg1MDkg
+-Q0EgU0dDMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsgOkO3f7wzN6
+-rOjg45tR5vjBfzK7qmV9IBxb/QW9EEXxG+E7FNhZqQLtwGBKoSsHTnQqV75wWMk0
+-9tinWvftBkSpj5sTi/8cbzJfUvTSVYh3Qxv6AVVjMMH/ruLjE6y+4PoaPs8WoYAQ
+-ts5R4Z1g8c/WnTepLst2x0/Wv7GmuoQi+gXvHU6YrBiu7XkeYhzc95QdviWSJRDk
+-owhb5K43qhcvjRmBfO/paGlCliDGZp8mHwrI21mwobWpVjTxZRwYO3bd4+TGcI4G
+-Ie5wmHwE8F7SK1tgSqbBacKjDa93j7txKkfz/Yd2n7TGqOXiHPsJpG655vrKtnXk
+-9vs1zoDeJQIDAQABo4IBljCCAZIwHQYDVR0OBBYEFAdEdoWTKLx/bXjSCuv6TEvf
+-2YIfMA4GA1UdDwEB/wQEAwIBBjASBgNVHRMBAf8ECDAGAQH/AgEAMCAGA1UdJQQZ
+-MBcGCisGAQQBgjcKAwMGCWCGSAGG+EIEATAYBgNVHSAEETAPMA0GCysGAQQBgOU3
+-AgQBMHsGA1UdHwR0MHIwOKA2oDSGMmh0dHA6Ly9jcmwuY29tb2RvY2EuY29tL0Fk
+-ZFRydXN0RXh0ZXJuYWxDQVJvb3QuY3JsMDagNKAyhjBodHRwOi8vY3JsLmNvbW9k
+-by5uZXQvQWRkVHJ1c3RFeHRlcm5hbENBUm9vdC5jcmwwgYAGCCsGAQUFBwEBBHQw
+-cjA4BggrBgEFBQcwAoYsaHR0cDovL2NydC5jb21vZG9jYS5jb20vQWRkVHJ1c3RV
+-VE5TR0NDQS5jcnQwNgYIKwYBBQUHMAKGKmh0dHA6Ly9jcnQuY29tb2RvLm5ldC9B
+-ZGRUcnVzdFVUTlNHQ0NBLmNydDARBglghkgBhvhCAQEEBAMCAgQwDQYJKoZIhvcN
+-AQEFBQADggEBAK2zEzs+jcIrVK9oDkdDZNvhuBYTdCfpxfFs+OAujW0bIfJAy232
+-euVsnJm6u/+OrqKudD2tad2BbejLLXhMZViaCmK7D9nrXHx4te5EP8rL19SUVqLY
+-1pTnv5dhNgEgvA7n5lIzDSYs7yRLsr7HJsYPr6SeYSuZizyX1SNz7ooJ32/F3X98
+-RB0Mlc/E0OyOrkQ9/y5IrnpnaSora8CnUrV5XNOg+kyCz9edCyx4D5wXYcwZPVWz
+-8aDqquESrezPyjtfi4WRO4s/VD3HLZvOxzMrWAVYCDG9FxaOhF0QGuuG1F7F3GKV
+-v6prNyCl016kRl2j1UT+a7gLd8fA25A4C9E=
++cnkxGDAWBgNVBAsTD1RCUyBJTlRFUk5FVCBDQTEdMBsGA1UEAxMUVEJTIFg1MDkg
++Q0EgYnVzaW5lc3MwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDB1PAU
++qudCcz3tmyGcf+u6EkZqonKKHrV4gZYbvVkIRojmmlhfi/jwvpHvo8bqSt/9Rj5S
++jhCDW0pcbI+IPPtD1Jy+CHNSfnMqVDy6CKQ3p5maTzCMG6ZT+XjnvcND5v+FtaiB
++xk1iCX6uvt0jeUtdZvYbyytsSDE6c3Y5//wRxOF8tM1JxibwO3pyER26jbbN2gQz
++m/EkdGjLdJ4svPk23WDAvQ6G0/z2LcAaJB+XLfqRwfQpHQvfKa1uTi8PivC8qtip
++rmNQMMPMjxSK2azX8cKjjTDJiUKaCb4VHlJDWKEsCFRpgJAoAuX8f7Yfs1M4esGo
++sWb3PGspK3O22uIlAgMBAAGjggF6MIIBdjAdBgNVHQ4EFgQUGgkEzPkJj7seoM7U
++pBR/S9UjWM0wDgYDVR0PAQH/BAQDAgEGMBIGA1UdEwEB/wQIMAYBAf8CAQAwGAYD
++VR0gBBEwDzANBgsrBgEEAYDlNwIBATB7BgNVHR8EdDByMDigNqA0hjJodHRwOi8v
++Y3JsLmNvbW9kb2NhLmNvbS9BZGRUcnVzdEV4dGVybmFsQ0FSb290LmNybDA2oDSg
++MoYwaHR0cDovL2NybC5jb21vZG8ubmV0L0FkZFRydXN0RXh0ZXJuYWxDQVJvb3Qu
++Y3JsMIGGBggrBgEFBQcBAQR6MHgwOwYIKwYBBQUHMAKGL2h0dHA6Ly9jcnQuY29t
++b2RvY2EuY29tL0FkZFRydXN0VVROU2VydmVyQ0EuY3J0MDkGCCsGAQUFBzAChi1o
++dHRwOi8vY3J0LmNvbW9kby5uZXQvQWRkVHJ1c3RVVE5TZXJ2ZXJDQS5jcnQwEQYJ
++YIZIAYb4QgEBBAQDAgIEMA0GCSqGSIb3DQEBBQUAA4IBAQA7mqrMgk/MrE6QnbNA
++h4nRCn2ti4bg4w2C3lB6bSvRPnYwuNw9Jb8vuKkNFzRDxNJXqVDZdfFW5CVQJuyd
++nfAx83+wk+spzvFaE1KhFYfN9G9pQfXUfvDRoIcJgPEKUXL1wRiOG+IjU3VVI8pg
++IgqHkr7ylln5i5zCiFAPuIJmYUSFg/gxH5xkCNcjJqqrHrHatJr6Qrrke93joupw
++oU1njfAcZtYp6fbiK6u2b1pJqwkVBE8RsfLnPhRj+SFbpvjv8Od7o/ieJhFIYQNU
++k2jX2u8qZnAiNw93LZW9lpYjtuvMXq8QQppENNja5b53q7UwI+lU7ZGjZ7quuESp
++J6/5
+ -----END CERTIFICATE-----
+  2 s:/C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root
+-   i:/C=US/ST=UT/L=Salt Lake City/O=The USERTRUST Network/OU=http://www.usertrust.com/CN=UTN - DATACorp SGC
++   i:/C=US/ST=UT/L=Salt Lake City/O=The USERTRUST Network/OU=http://www.usertrust.com/CN=UTN-USERFirst-Hardware
+ -----BEGIN CERTIFICATE-----
+-MIIEZjCCA06gAwIBAgIQUSYKkxzif5zDpV954HKugjANBgkqhkiG9w0BAQUFADCB
+-kzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug
++MIIETzCCAzegAwIBAgIQHM5EYpUZep1jUvnyI6m2mDANBgkqhkiG9w0BAQUFADCB
++lzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug
+ Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho
+-dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xGzAZBgNVBAMTElVUTiAtIERBVEFDb3Jw
+-IFNHQzAeFw0wNTA2MDcwODA5MTBaFw0xOTA2MjQxOTA2MzBaMG8xCzAJBgNVBAYT
+-AlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEmMCQGA1UECxMdQWRkVHJ1c3QgRXh0
+-ZXJuYWwgVFRQIE5ldHdvcmsxIjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENB
+-IFJvb3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC39xoz5vIABC05
+-4E5b7R+8bA/Ntfojts7emxEzl6QpTH2Tn71KvJPtAxrjj8/lbVBa1pcplFqAsEl6
+-2y6V/bjKvzc4LR4+kUGtcFbH8E8/6DKedMrIkFTpxl8PeJ2aQDwOrGGqXhSPnoeh
+-alDc15pOrwWzpnGUnHGzUGAKxxOdOAeGAqjpqGkmGJCrTLBPI6s6T4TY386f4Wlv
+-u9dC12tE5Met7m1BX3JacQg3s3llpFmglDf3AC8NwpJy2tA4ctsUqEXEXSp9t7TW
+-xO6szRNEt8kr3UMAJfphuWlqWCMRt6czj1Z1WfXNKddGtworZbbTQm8Vsrh7++/p
+-XVPVNFonAgMBAAGjgdgwgdUwHwYDVR0jBBgwFoAUUzLRs89/+uDxoF2FTpLSnkUd
+-tE8wHQYDVR0OBBYEFK29mHo0tCb3+sQmVO8DveAky1QaMA4GA1UdDwEB/wQEAwIB
+-BjAPBgNVHRMBAf8EBTADAQH/MBEGCWCGSAGG+EIBAQQEAwIBAjAgBgNVHSUEGTAX
+-BgorBgEEAYI3CgMDBglghkgBhvhCBAEwPQYDVR0fBDYwNDAyoDCgLoYsaHR0cDov
+-L2NybC51c2VydHJ1c3QuY29tL1VUTi1EQVRBQ29ycFNHQy5jcmwwDQYJKoZIhvcN
+-AQEFBQADggEBAMbuUxdoFLJRIh6QWA2U/b3xcOWGLcM2MY9USEbnLQg3vGwKYOEO
+-rVE04BKT6b64q7gmtOmWPSiPrmQH/uAB7MXjkesYoPF1ftsK5p+R26+udd8jkWjd
+-FwBaS/9kbHDrARrQkNnHptZt9hPk/7XJ0h4qy7ElQyZ42TCbTg0evmnv3+r+LbPM
+-+bDdtRTKkdSytaX7ARmjR3mfnYyVhzT4HziS2jamEfpr62vp3EV4FTkG101B5CHI
+-3C+H0be/SGB1pWLLJN47YaApIKa+xWycxOkKaSLvkTr6Jq/RW0GnOuL4OAdCq8Fb
+-+M5tug8EPzI0rNwEKNdwMBQmBsTkm5jVz3g=
++dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xHzAdBgNVBAMTFlVUTi1VU0VSRmlyc3Qt
++SGFyZHdhcmUwHhcNMDUwNjA3MDgwOTEwWhcNMTkwNzA5MTgxOTIyWjBvMQswCQYD
++VQQGEwJTRTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0
++IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBFeHRlcm5h
++bCBDQSBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAt/caM+by
++AAQtOeBOW+0fvGwPzbX6I7bO3psRM5ekKUx9k5+9SryT7QMa44/P5W1QWtaXKZRa
++gLBJetsulf24yr83OC0ePpFBrXBWx/BPP+gynnTKyJBU6cZfD3idmkA8Dqxhql4U
++j56HoWpQ3NeaTq8Fs6ZxlJxxs1BgCscTnTgHhgKo6ahpJhiQq0ywTyOrOk+E2N/O
++n+Fpb7vXQtdrROTHre5tQV9yWnEIN7N5ZaRZoJQ39wAvDcKSctrQOHLbFKhFxF0q
++fbe01sTurM0TRLfJK91DACX6YblpalgjEbenM49WdVn1zSnXRrcKK2W200JvFbK4
++e/vv6V1T1TRaJwIDAQABo4G9MIG6MB8GA1UdIwQYMBaAFKFyXyYbKJhDlV0HN9WF
++lp1L0sNFMB0GA1UdDgQWBBStvZh6NLQm9/rEJlTvA73gJMtUGjAOBgNVHQ8BAf8E
++BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zARBglghkgBhvhCAQEEBAMCAQIwRAYDVR0f
++BD0wOzA5oDegNYYzaHR0cDovL2NybC51c2VydHJ1c3QuY29tL1VUTi1VU0VSRmly
++c3QtSGFyZHdhcmUuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQByQhANOs4kClrwF8BW
++onvUOGCSjRK52zYZgDXYNjDtmr5rJ6NyPFDNn+JxkLpjYetIFMTbSRe679Bt8m7a
++gIAoQYFQtxMuyLnJegB2aEbQiIxh/tC21UcFF7ktdnDoTlA6w3pLuvunaI84Of3o
++2YBrhzkTbCfaYk5JRlTpudW9DkUkHBsyx3nknPKnplkIGaK0jgn8E0n+SFabYaHk
++I9LroYT/+JtLefh9lgBdAgVv0UPbzoGfuDsrk/Zh+UrgbLFpHoVnElhzbkh64Z0X
++OGaJunQc68cCZu5HTn/aK7fBGMcVflRCXLVEQpU9PIAdGA8Ynvg684t8GMaKsRl1
++jIGZ
+ -----END CERTIFICATE-----
+- 3 s:/C=US/ST=UT/L=Salt Lake City/O=The USERTRUST Network/OU=http://www.usertrust.com/CN=UTN - DATACorp SGC
+-   i:/C=US/ST=UT/L=Salt Lake City/O=The USERTRUST Network/OU=http://www.usertrust.com/CN=UTN - DATACorp SGC
++ 3 s:/C=US/ST=UT/L=Salt Lake City/O=The USERTRUST Network/OU=http://www.usertrust.com/CN=UTN-USERFirst-Hardware
++   i:/C=US/ST=UT/L=Salt Lake City/O=The USERTRUST Network/OU=http://www.usertrust.com/CN=UTN-USERFirst-Hardware
+ -----BEGIN CERTIFICATE-----
+-MIIEXjCCA0agAwIBAgIQRL4Mi1AAIbQR0ypoBqmtaTANBgkqhkiG9w0BAQUFADCB
+-kzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug
++MIIEdDCCA1ygAwIBAgIQRL4Mi1AAJLQR0zYq/mUK/TANBgkqhkiG9w0BAQUFADCB
++lzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug
+ Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho
+-dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xGzAZBgNVBAMTElVUTiAtIERBVEFDb3Jw
+-IFNHQzAeFw05OTA2MjQxODU3MjFaFw0xOTA2MjQxOTA2MzBaMIGTMQswCQYDVQQG
+-EwJVUzELMAkGA1UECBMCVVQxFzAVBgNVBAcTDlNhbHQgTGFrZSBDaXR5MR4wHAYD
+-VQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxITAfBgNVBAsTGGh0dHA6Ly93d3cu
+-dXNlcnRydXN0LmNvbTEbMBkGA1UEAxMSVVROIC0gREFUQUNvcnAgU0dDMIIBIjAN
+-BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3+5YEKIrblXEjr8uRgnn4AgPLit6
+-E5Qbvfa2gI5lBZMAHryv4g+OGQ0SR+ysraP6LnD43m77VkIVni5c7yPeIbkFdicZ
+-D0/Ww5y0vpQZY/KmEQrrU0icvvIpOxboGqBMpsn0GFlowHDyUwDAXlCCpVZvNvlK
+-4ESGoE1O1kduSUrLZ9emxAW5jh70/P/N5zbgnAVssjMiFdC04MwXwLLA9P4yPykq
+-lXvY8qdOD1R8oQ2AswkDwf9c3V6aPryuvEeKaq5xyh+xKrhfQgUL7EYw0XILyulW
+-bfXv33i+Ybqypa4ETLyorGkVl73v67SMvzX41MPRKA5cOp9wGDMgd8SirwIDAQAB
+-o4GrMIGoMAsGA1UdDwQEAwIBxjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRT
+-MtGzz3/64PGgXYVOktKeRR20TzA9BgNVHR8ENjA0MDKgMKAuhixodHRwOi8vY3Js
+-LnVzZXJ0cnVzdC5jb20vVVROLURBVEFDb3JwU0dDLmNybDAqBgNVHSUEIzAhBggr
+-BgEFBQcDAQYKKwYBBAGCNwoDAwYJYIZIAYb4QgQBMA0GCSqGSIb3DQEBBQUAA4IB
+-AQAnNZcAiosovcYzMB4p/OL31ZjUQLtgyr+rFywJNn9Q+kHcrpY6CiM+iVnJowft
+-Gzet/Hy+UUla3joKVAgWRcKZsYfNjGjgaQPpxE6YsjuMFrMOoAyYUJuTqXAJyCyj
+-j98C5OBxOvG0I3KgqgHf35g+FFCgMSa9KOlaMCZ1+XtgHI3zzVAmbQQnmt/VDUVH
+-KWss5nbZqSl9Mt3JNjy9rjXxEZ4du5A/EkdOjtd+D2JzHVImOBwYSf0wdJrE5SIv
+-2MCN7ZF6TACPcn9d2t0bi0Vr591pl6jFVkwPDPafepE39peC4N1xaf92P2BNPM/3
+-mfnGV/TJVTl4uix5yaaIK/QI
++dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xHzAdBgNVBAMTFlVUTi1VU0VSRmlyc3Qt
++SGFyZHdhcmUwHhcNOTkwNzA5MTgxMDQyWhcNMTkwNzA5MTgxOTIyWjCBlzELMAkG
++A1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2UgQ2l0eTEe
++MBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExhodHRwOi8v
++d3d3LnVzZXJ0cnVzdC5jb20xHzAdBgNVBAMTFlVUTi1VU0VSRmlyc3QtSGFyZHdh
++cmUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCx98M4P7Sof885glFn
++0G2f0v9Y8+efK+wNiVSZuTiZFvfgIXlIwrthdBKWHTxqctU8EGc6Oe0rE81m65UJ
++M6Rsl7HoxuzBdXmcRl6Nq9Bq/bkqVRcQVLMZ8Jr28bFdtqdt++BxF2uiiPsA3/4a
++MXcMmgF6sTLjKwEHOG7DpV4jvEWbe1DByTCP2+UretNb+zNAHqDVmBe8i4fDidNd
++oI6yqqr2jmmIBsX6iSHzCJ1pLgkzmykNRg+MzEk0sGlRvfkGzWitZky8PqxhvQqI
++DsjfPe58BEydCl5rkdbux+0ojatNh4lz0G6k0B4WixThdkQDf2Os5M1JnMWS9Ksy
++oUhbAgMBAAGjgbkwgbYwCwYDVR0PBAQDAgHGMA8GA1UdEwEB/wQFMAMBAf8wHQYD
++VR0OBBYEFKFyXyYbKJhDlV0HN9WFlp1L0sNFMEQGA1UdHwQ9MDswOaA3oDWGM2h0
++dHA6Ly9jcmwudXNlcnRydXN0LmNvbS9VVE4tVVNFUkZpcnN0LUhhcmR3YXJlLmNy
++bDAxBgNVHSUEKjAoBggrBgEFBQcDAQYIKwYBBQUHAwUGCCsGAQUFBwMGBggrBgEF
++BQcDBzANBgkqhkiG9w0BAQUFAAOCAQEARxkP3nTGmZev/K0oXnWO6y1n7k57K9cM
++//bey1WiCuFMVGWTYGufEpytXoMs61quwOQt9ABjHbjAbPLPSbtNk28Gpgoiskli
++CE7/yMgUsogWXecB5BKV5UU0s4tpvc+0hY91UZ59Ojg6FEgSxvunOxqNDYJAB+gE
++CJChicsZUN/KHAG8HQQZexB2lzvukJDKxA4fFm517zP4029bHpbj4HR3dHuKom4t
++3XbWOTCC8KucUvIqx69JXn7HaOWCgchqJ/kniCrVWFCVH/A7HFe7fRQ5YiuayZSS
++KqMiDP+JJn1fIytH1xUdqWqeUQ0qUZ6B+dQ7XnASfxAynB67nfhmqA==
+ -----END CERTIFICATE-----
+diff -r 70274d53c1dd Lib/test/symlink_support.py
+--- /dev/null
++++ b/Lib/test/symlink_support.py
+@@ -0,0 +1,100 @@
++import os
++import unittest
++import platform
++
++from test.test_support import TESTFN
++
++def can_symlink():
++    # cache the result in can_symlink.prev_val
++    prev_val = getattr(can_symlink, 'prev_val', None)
++    if prev_val is not None:
++        return prev_val
++    symlink_path = TESTFN + "can_symlink"
++    try:
++        symlink(TESTFN, symlink_path)
++        can = True
++    except (OSError, NotImplementedError, AttributeError):
++        can = False
++    else:
++        os.remove(symlink_path)
++    can_symlink.prev_val = can
++    return can
++
++def skip_unless_symlink(test):
++    """Skip decorator for tests that require functional symlink"""
++    ok = can_symlink()
++    msg = "Requires functional symlink implementation"
++    return test if ok else unittest.skip(msg)(test)
++
++def _symlink_win32(target, link, target_is_directory=False):
++    """
++    Ctypes symlink implementation since Python doesn't support
++    symlinks in windows yet. Borrowed from jaraco.windows project.
++    """
++    import ctypes.wintypes
++    CreateSymbolicLink = ctypes.windll.kernel32.CreateSymbolicLinkW
++    CreateSymbolicLink.argtypes = (
++        ctypes.wintypes.LPWSTR,
++        ctypes.wintypes.LPWSTR,
++        ctypes.wintypes.DWORD,
++        )
++    CreateSymbolicLink.restype = ctypes.wintypes.BOOLEAN
++
++    def format_system_message(errno):
++        """
++        Call FormatMessage with a system error number to retrieve
++        the descriptive error message.
++        """
++        # first some flags used by FormatMessageW
++        ALLOCATE_BUFFER = 0x100
++        ARGUMENT_ARRAY = 0x2000
++        FROM_HMODULE = 0x800
++        FROM_STRING = 0x400
++        FROM_SYSTEM = 0x1000
++        IGNORE_INSERTS = 0x200
++
++        # Let FormatMessageW allocate the buffer (we'll free it below)
++        # Also, let it know we want a system error message.
++        flags = ALLOCATE_BUFFER | FROM_SYSTEM
++        source = None
++        message_id = errno
++        language_id = 0
++        result_buffer = ctypes.wintypes.LPWSTR()
++        buffer_size = 0
++        arguments = None
++        bytes = ctypes.windll.kernel32.FormatMessageW(
++            flags,
++            source,
++            message_id,
++            language_id,
++            ctypes.byref(result_buffer),
++            buffer_size,
++            arguments,
++            )
++        # note the following will cause an infinite loop if GetLastError
++        #  repeatedly returns an error that cannot be formatted, although
++        #  this should not happen.
++        handle_nonzero_success(bytes)
++        message = result_buffer.value
++        ctypes.windll.kernel32.LocalFree(result_buffer)
++        return message
++
++    def handle_nonzero_success(result):
++        if result == 0:
++            value = ctypes.windll.kernel32.GetLastError()
++            strerror = format_system_message(value)
++            raise WindowsError(value, strerror)
++
++    target_is_directory = target_is_directory or os.path.isdir(target)
++    handle_nonzero_success(CreateSymbolicLink(link, target, target_is_directory))
++
++symlink = os.symlink if hasattr(os, 'symlink') else (
++    _symlink_win32 if platform.system() == 'Windows' else None
++)
++
++def remove_symlink(name):
++    # On Windows, to remove a directory symlink, one must use rmdir
++    try:
++        os.rmdir(name)
++    except OSError:
++        os.remove(name)
+diff -r 70274d53c1dd Lib/test/test_argparse.py
+--- a/Lib/test/test_argparse.py
++++ b/Lib/test/test_argparse.py
+@@ -1374,6 +1374,7 @@
+         ('X @hello', NS(a=None, x='X', y=['hello world!'])),
+         ('-a B @recursive Y Z', NS(a='A', x='hello world!', y=['Y', 'Z'])),
+         ('X @recursive Z -a B', NS(a='B', x='X', y=['hello world!', 'Z'])),
++        (["-a", "", "X", "Y"], NS(a='', x='X', y=['Y'])),
+     ]
+ 
+ 
+@@ -1763,6 +1764,14 @@
+         parser2.add_argument('-y', choices='123', help='y help')
+         parser2.add_argument('z', type=complex, nargs='*', help='z help')
+ 
++        # add third sub-parser
++        parser3_kwargs = dict(description='3 description')
++        if subparser_help:
++            parser3_kwargs['help'] = '3 help'
++        parser3 = subparsers.add_parser('3', **parser3_kwargs)
++        parser3.add_argument('t', type=int, help='t help')
++        parser3.add_argument('u', nargs='...', help='u help')
++
+         # return the main parser
+         return parser
+ 
+@@ -1792,6 +1801,10 @@
+             self.parser.parse_args('--foo 0.125 1 c'.split()),
+             NS(foo=True, bar=0.125, w=None, x='c'),
+         )
++        self.assertEqual(
++            self.parser.parse_args('-1.5 3 11 -- a --foo 7 -- b'.split()),
++            NS(foo=False, bar=-1.5, t=11, u=['a', '--foo', '7', '--', 'b']),
++        )
+ 
+     def test_parse_known_args(self):
+         self.assertEqual(
+@@ -1826,15 +1839,15 @@
+ 
+     def test_help(self):
+         self.assertEqual(self.parser.format_usage(),
+-                         'usage: PROG [-h] [--foo] bar {1,2} ...\n')
++                         'usage: PROG [-h] [--foo] bar {1,2,3} ...\n')
+         self.assertEqual(self.parser.format_help(), textwrap.dedent('''\
+-            usage: PROG [-h] [--foo] bar {1,2} ...
++            usage: PROG [-h] [--foo] bar {1,2,3} ...
+ 
+             main description
+ 
+             positional arguments:
+               bar         bar help
+-              {1,2}       command help
++              {1,2,3}     command help
+ 
+             optional arguments:
+               -h, --help  show this help message and exit
+@@ -1845,15 +1858,15 @@
+         # Make sure - is still used for help if it is a non-first prefix char
+         parser = self._get_parser(prefix_chars='+:-')
+         self.assertEqual(parser.format_usage(),
+-                         'usage: PROG [-h] [++foo] bar {1,2} ...\n')
++                         'usage: PROG [-h] [++foo] bar {1,2,3} ...\n')
+         self.assertEqual(parser.format_help(), textwrap.dedent('''\
+-            usage: PROG [-h] [++foo] bar {1,2} ...
++            usage: PROG [-h] [++foo] bar {1,2,3} ...
+ 
+             main description
+ 
+             positional arguments:
+               bar         bar help
+-              {1,2}       command help
++              {1,2,3}     command help
+ 
+             optional arguments:
+               -h, --help  show this help message and exit
+@@ -1864,15 +1877,15 @@
+     def test_help_alternate_prefix_chars(self):
+         parser = self._get_parser(prefix_chars='+:/')
+         self.assertEqual(parser.format_usage(),
+-                         'usage: PROG [+h] [++foo] bar {1,2} ...\n')
++                         'usage: PROG [+h] [++foo] bar {1,2,3} ...\n')
+         self.assertEqual(parser.format_help(), textwrap.dedent('''\
+-            usage: PROG [+h] [++foo] bar {1,2} ...
++            usage: PROG [+h] [++foo] bar {1,2,3} ...
+ 
+             main description
+ 
+             positional arguments:
+               bar         bar help
+-              {1,2}       command help
++              {1,2,3}     command help
+ 
+             optional arguments:
+               +h, ++help  show this help message and exit
+@@ -1881,18 +1894,19 @@
+ 
+     def test_parser_command_help(self):
+         self.assertEqual(self.command_help_parser.format_usage(),
+-                         'usage: PROG [-h] [--foo] bar {1,2} ...\n')
++                         'usage: PROG [-h] [--foo] bar {1,2,3} ...\n')
+         self.assertEqual(self.command_help_parser.format_help(),
+                          textwrap.dedent('''\
+-            usage: PROG [-h] [--foo] bar {1,2} ...
++            usage: PROG [-h] [--foo] bar {1,2,3} ...
+ 
+             main description
+ 
+             positional arguments:
+               bar         bar help
+-              {1,2}       command help
++              {1,2,3}     command help
+                 1         1 help
+                 2         2 help
++                3         3 help
+ 
+             optional arguments:
+               -h, --help  show this help message and exit
+diff -r 70274d53c1dd Lib/test/test_array.py
+--- a/Lib/test/test_array.py
++++ b/Lib/test/test_array.py
+@@ -985,6 +985,19 @@
+         upper = long(pow(2, a.itemsize * 8)) - 1L
+         self.check_overflow(lower, upper)
+ 
++    @test_support.cpython_only
++    def test_sizeof_with_buffer(self):
++        a = array.array(self.typecode, self.example)
++        basesize = test_support.calcvobjsize('4P')
++        buffer_size = a.buffer_info()[1] * a.itemsize
++        test_support.check_sizeof(self, a, basesize + buffer_size)
++
++    @test_support.cpython_only
++    def test_sizeof_without_buffer(self):
++        a = array.array(self.typecode)
++        basesize = test_support.calcvobjsize('4P')
++        test_support.check_sizeof(self, a, basesize)
++
+ 
+ class ByteTest(SignedNumberTest):
+     typecode = 'b'
+diff -r 70274d53c1dd Lib/test/test_ast.py
+--- a/Lib/test/test_ast.py
++++ b/Lib/test/test_ast.py
+@@ -231,6 +231,12 @@
+         im = ast.parse("from . import y").body[0]
+         self.assertIsNone(im.module)
+ 
++    def test_non_interned_future_from_ast(self):
++        mod = ast.parse("from __future__ import division")
++        self.assertIsInstance(mod.body[0], ast.ImportFrom)
++        mod.body[0].module = " __future__ ".strip()
++        compile(mod, "<test>", "exec")
++
+     def test_base_classes(self):
+         self.assertTrue(issubclass(ast.For, ast.stmt))
+         self.assertTrue(issubclass(ast.Name, ast.expr))
+diff -r 70274d53c1dd Lib/test/test_asyncore.py
+--- a/Lib/test/test_asyncore.py
++++ b/Lib/test/test_asyncore.py
+@@ -7,6 +7,7 @@
+ import time
+ import warnings
+ import errno
++import struct
+ 
+ from test import test_support
+ from test.test_support import TESTFN, run_unittest, unlink
+@@ -703,6 +704,26 @@
+         finally:
+             sock.close()
+ 
++    @unittest.skipUnless(threading, 'Threading required for this test.')
++    @test_support.reap_threads
++    def test_quick_connect(self):
++        # see: http://bugs.python.org/issue10340
++        server = TCPServer()
++        t = threading.Thread(target=lambda: asyncore.loop(timeout=0.1, count=500))
++        t.start()
++
++        for x in xrange(20):
++            s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
++            s.settimeout(.2)
++            s.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER,
++                         struct.pack('ii', 1, 0))
++            try:
++                s.connect(server.address)
++            except socket.error:
++                pass
++            finally:
++                s.close()
++
+ 
+ class TestAPI_UseSelect(BaseTestAPI):
+     use_poll = False
+diff -r 70274d53c1dd Lib/test/test_bigmem.py
+--- a/Lib/test/test_bigmem.py
++++ b/Lib/test/test_bigmem.py
+@@ -118,12 +118,13 @@
+         except MemoryError:
+             pass # acceptable on 32-bit
+ 
+-    @precisionbigmemtest(size=_2G-1, memuse=2)
++    @precisionbigmemtest(size=_2G-1, memuse=4)
+     def test_decodeascii(self, size):
+         return self.basic_encode_test(size, 'ascii', c='A')
+ 
+     @precisionbigmemtest(size=_4G // 5, memuse=6+2)
+     def test_unicode_repr_oflw(self, size):
++        self.skipTest("test crashes - see issue #14904")
+         try:
+             s = u"\uAAAA"*size
+             r = repr(s)
+@@ -485,7 +486,7 @@
+         self.assertEqual(s.count('.'), 3)
+         self.assertEqual(s.count('-'), size * 2)
+ 
+-    @bigmemtest(minsize=_2G + 10, memuse=2)
++    @bigmemtest(minsize=_2G + 10, memuse=5)
+     def test_repr_small(self, size):
+         s = '-' * size
+         s = repr(s)
+@@ -497,7 +498,6 @@
+         # repr() will create a string four times as large as this 'binary
+         # string', but we don't want to allocate much more than twice
+         # size in total.  (We do extra testing in test_repr_large())
+-        size = size // 5 * 2
+         s = '\x00' * size
+         s = repr(s)
+         self.assertEqual(len(s), size * 4 + 2)
+@@ -541,7 +541,7 @@
+         self.assertEqual(len(s), size * 2)
+         self.assertEqual(s.count('.'), size * 2)
+ 
+-    @bigmemtest(minsize=_2G + 20, memuse=1)
++    @bigmemtest(minsize=_2G + 20, memuse=2)
+     def test_slice_and_getitem(self, size):
+         SUBSTR = '0123456789'
+         sublen = len(SUBSTR)
+diff -r 70274d53c1dd Lib/test/test_bisect.py
+--- a/Lib/test/test_bisect.py
++++ b/Lib/test/test_bisect.py
+@@ -23,6 +23,28 @@
+ import bisect as c_bisect
+ 
+ 
++class Range(object):
++    """A trivial xrange()-like object without any integer width limitations."""
++    def __init__(self, start, stop):
++        self.start = start
++        self.stop = stop
++        self.last_insert = None
++
++    def __len__(self):
++        return self.stop - self.start
++
++    def __getitem__(self, idx):
++        n = self.stop - self.start
++        if idx < 0:
++            idx += n
++        if idx >= n:
++            raise IndexError(idx)
++        return self.start + idx
++
++    def insert(self, idx, item):
++        self.last_insert = idx, item
++
++
+ class TestBisect(unittest.TestCase):
+     module = None
+ 
+@@ -122,6 +144,35 @@
+         self.assertRaises(ValueError, mod.insort_left, [1, 2, 3], 5, -1, 3),
+         self.assertRaises(ValueError, mod.insort_right, [1, 2, 3], 5, -1, 3),
+ 
++    def test_large_range(self):
++        # Issue 13496
++        mod = self.module
++        n = sys.maxsize
++        try:
++            data = xrange(n-1)
++        except OverflowError:
++            self.skipTest("can't create a xrange() object of size `sys.maxsize`")
++        self.assertEqual(mod.bisect_left(data, n-3), n-3)
++        self.assertEqual(mod.bisect_right(data, n-3), n-2)
++        self.assertEqual(mod.bisect_left(data, n-3, n-10, n), n-3)
++        self.assertEqual(mod.bisect_right(data, n-3, n-10, n), n-2)
++
++    def test_large_pyrange(self):
++        # Same as above, but without C-imposed limits on range() parameters
++        mod = self.module
++        n = sys.maxsize
++        data = Range(0, n-1)
++        self.assertEqual(mod.bisect_left(data, n-3), n-3)
++        self.assertEqual(mod.bisect_right(data, n-3), n-2)
++        self.assertEqual(mod.bisect_left(data, n-3, n-10, n), n-3)
++        self.assertEqual(mod.bisect_right(data, n-3, n-10, n), n-2)
++        x = n - 100
++        mod.insort_left(data, x, x - 50, x + 50)
++        self.assertEqual(data.last_insert, (x, x))
++        x = n - 200
++        mod.insort_right(data, x, x - 50, x + 50)
++        self.assertEqual(data.last_insert, (x + 1, x))
++
+     def test_random(self, n=25):
+         from random import randrange
+         for i in xrange(n):
+diff -r 70274d53c1dd Lib/test/test_cgi.py
+--- a/Lib/test/test_cgi.py
++++ b/Lib/test/test_cgi.py
+@@ -120,6 +120,11 @@
+ 
+ class CgiTests(unittest.TestCase):
+ 
++    def test_escape(self):
++        self.assertEqual("test &amp; string", cgi.escape("test & string"))
++        self.assertEqual("&lt;test string&gt;", cgi.escape("<test string>"))
++        self.assertEqual("&quot;test string&quot;", cgi.escape('"test string"', True))
++
+     def test_strict(self):
+         for orig, expect in parse_strict_test_cases:
+             # Test basic parsing
+diff -r 70274d53c1dd Lib/test/test_class.py
+--- a/Lib/test/test_class.py
++++ b/Lib/test/test_class.py
+@@ -628,6 +628,13 @@
+         a = A(hash(A.f.im_func)^(-1))
+         hash(a.f)
+ 
++    def testAttrSlots(self):
++        class C:
++            pass
++        for c in C, C():
++            self.assertRaises(TypeError, type(c).__getattribute__, c, [])
++            self.assertRaises(TypeError, type(c).__setattr__, c, [], [])
++
+ def test_main():
+     with test_support.check_py3k_warnings(
+             (".+__(get|set|del)slice__ has been removed", DeprecationWarning),
+diff -r 70274d53c1dd Lib/test/test_cmd.py
+--- a/Lib/test/test_cmd.py
++++ b/Lib/test/test_cmd.py
+@@ -84,11 +84,11 @@
+     <BLANKLINE>
+     Documented commands (type help <topic>):
+     ========================================
+-    add
++    add  help
+     <BLANKLINE>
+     Undocumented commands:
+     ======================
+-    exit  help  shell
++    exit  shell
+     <BLANKLINE>
+ 
+     Test for the function print_topics():
+@@ -125,11 +125,11 @@
+     <BLANKLINE>
+     Documented commands (type help <topic>):
+     ========================================
+-    add
++    add  help
+     <BLANKLINE>
+     Undocumented commands:
+     ======================
+-    exit  help  shell
++    exit  shell
+     <BLANKLINE>
+     help text for add
+     Hello from postloop
+diff -r 70274d53c1dd Lib/test/test_cmd_line_script.py
+--- a/Lib/test/test_cmd_line_script.py
++++ b/Lib/test/test_cmd_line_script.py
+@@ -6,11 +6,14 @@
+ import test.test_support
+ from test.script_helper import (run_python,
+                                 temp_dir, make_script, compile_script,
+-                                make_pkg, make_zip_script, make_zip_pkg)
++                                assert_python_failure, make_pkg,
++                                make_zip_script, make_zip_pkg)
+ 
+ verbose = test.test_support.verbose
+ 
+ 
++example_args = ['test1', 'test2', 'test3']
++
+ test_source = """\
+ # Script may be run with optimisation enabled, so don't rely on assert
+ # statements being executed
+@@ -204,6 +207,19 @@
+             launch_name = _make_launch_script(script_dir, 'launch', 'test_pkg')
+             self._check_import_error(launch_name, msg)
+ 
++    def test_dash_m_error_code_is_one(self):
++        # If a module is invoked with the -m command line flag
++        # and results in an error that the return code to the
++        # shell is '1'
++        with temp_dir() as script_dir:
++            pkg_dir = os.path.join(script_dir, 'test_pkg')
++            make_pkg(pkg_dir)
++            script_name = _make_test_script(pkg_dir, 'other', "if __name__ == '__main__': raise ValueError")
++            rc, out, err = assert_python_failure('-m', 'test_pkg.other', *example_args)
++            if verbose > 1:
++                print(out)
++            self.assertEqual(rc, 1)
++
+ 
+ def test_main():
+     test.test_support.run_unittest(CmdLineTest)
+diff -r 70274d53c1dd Lib/test/test_codecs.py
+--- a/Lib/test/test_codecs.py
++++ b/Lib/test/test_codecs.py
+@@ -495,7 +495,19 @@
+         )
+ 
+     def test_errors(self):
+-        self.assertRaises(UnicodeDecodeError, codecs.utf_16_le_decode, "\xff", "strict", True)
++        tests = [
++            (b'\xff', u'\ufffd'),
++            (b'A\x00Z', u'A\ufffd'),
++            (b'A\x00B\x00C\x00D\x00Z', u'ABCD\ufffd'),
++            (b'\x00\xd8', u'\ufffd'),
++            (b'\x00\xd8A', u'\ufffd'),
++            (b'\x00\xd8A\x00', u'\ufffdA'),
++            (b'\x00\xdcA\x00', u'\ufffdA'),
++        ]
++        for raw, expected in tests:
++            self.assertRaises(UnicodeDecodeError, codecs.utf_16_le_decode,
++                              raw, 'strict', True)
++            self.assertEqual(raw.decode('utf-16le', 'replace'), expected)
+ 
+ class UTF16BETest(ReadTest):
+     encoding = "utf-16-be"
+@@ -516,7 +528,19 @@
+         )
+ 
+     def test_errors(self):
+-        self.assertRaises(UnicodeDecodeError, codecs.utf_16_be_decode, "\xff", "strict", True)
++        tests = [
++            (b'\xff', u'\ufffd'),
++            (b'\x00A\xff', u'A\ufffd'),
++            (b'\x00A\x00B\x00C\x00DZ', u'ABCD\ufffd'),
++            (b'\xd8\x00', u'\ufffd'),
++            (b'\xd8\x00\xdc', u'\ufffd'),
++            (b'\xd8\x00\x00A', u'\ufffdA'),
++            (b'\xdc\x00\x00A', u'\ufffdA'),
++        ]
++        for raw, expected in tests:
++            self.assertRaises(UnicodeDecodeError, codecs.utf_16_be_decode,
++                              raw, 'strict', True)
++            self.assertEqual(raw.decode('utf-16be', 'replace'), expected)
+ 
+ class UTF8Test(ReadTest):
+     encoding = "utf-8"
+diff -r 70274d53c1dd Lib/test/test_cookie.py
+--- a/Lib/test/test_cookie.py
++++ b/Lib/test/test_cookie.py
+@@ -64,13 +64,13 @@
+ 
+         # loading 'expires'
+         C = Cookie.SimpleCookie()
+-        C.load('Customer="W"; expires=Wed, 01-Jan-2010 00:00:00 GMT')
++        C.load('Customer="W"; expires=Wed, 01 Jan 2010 00:00:00 GMT')
+         self.assertEqual(C['Customer']['expires'],
+-                         'Wed, 01-Jan-2010 00:00:00 GMT')
++                         'Wed, 01 Jan 2010 00:00:00 GMT')
+         C = Cookie.SimpleCookie()
+-        C.load('Customer="W"; expires=Wed, 01-Jan-98 00:00:00 GMT')
++        C.load('Customer="W"; expires=Wed, 01 Jan 98 00:00:00 GMT')
+         self.assertEqual(C['Customer']['expires'],
+-                         'Wed, 01-Jan-98 00:00:00 GMT')
++                         'Wed, 01 Jan 98 00:00:00 GMT')
+ 
+     def test_extended_encode(self):
+         # Issue 9824: some browsers don't follow the standard; we now
+diff -r 70274d53c1dd Lib/test/test_deque.py
+--- a/Lib/test/test_deque.py
++++ b/Lib/test/test_deque.py
+@@ -6,6 +6,7 @@
+ import copy
+ import cPickle as pickle
+ import random
++import struct
+ 
+ BIG = 100000
+ 
+@@ -517,6 +518,21 @@
+             gc.collect()
+             self.assertTrue(ref() is None, "Cycle was not collected")
+ 
++    check_sizeof = test_support.check_sizeof
++
++    @test_support.cpython_only
++    def test_sizeof(self):
++        BLOCKLEN = 62
++        basesize = test_support.calcobjsize('2P4PlP')
++        blocksize = struct.calcsize('2P%dP' % BLOCKLEN)
++        self.assertEqual(object.__sizeof__(deque()), basesize)
++        check = self.check_sizeof
++        check(deque(), basesize + blocksize)
++        check(deque('a'), basesize + blocksize)
++        check(deque('a' * (BLOCKLEN // 2)), basesize + blocksize)
++        check(deque('a' * (BLOCKLEN // 2 + 1)), basesize + 2 * blocksize)
++        check(deque('a' * (42 * BLOCKLEN)), basesize + 43 * blocksize)
++
+ class TestVariousIteratorArgs(unittest.TestCase):
+ 
+     def test_constructor(self):
+diff -r 70274d53c1dd Lib/test/test_descr.py
+--- a/Lib/test/test_descr.py
++++ b/Lib/test/test_descr.py
+@@ -1,7 +1,9 @@
+ import __builtin__
++import gc
+ import sys
+ import types
+ import unittest
++import weakref
+ 
+ from copy import deepcopy
+ from test import test_support
+@@ -1127,7 +1129,6 @@
+         self.assertEqual(Counted.counter, 0)
+ 
+         # Test lookup leaks [SF bug 572567]
+-        import gc
+         if hasattr(gc, 'get_objects'):
+             class G(object):
+                 def __cmp__(self, other):
+@@ -1418,6 +1419,22 @@
+         self.assertEqual(x, spam.spamlist)
+         self.assertEqual(a, a1)
+         self.assertEqual(d, d1)
++        spam_cm = spam.spamlist.__dict__['classmeth']
++        x2, a2, d2 = spam_cm(spam.spamlist, *a, **d)
++        self.assertEqual(x2, spam.spamlist)
++        self.assertEqual(a2, a1)
++        self.assertEqual(d2, d1)
++        class SubSpam(spam.spamlist): pass
++        x2, a2, d2 = spam_cm(SubSpam, *a, **d)
++        self.assertEqual(x2, SubSpam)
++        self.assertEqual(a2, a1)
++        self.assertEqual(d2, d1)
++        with self.assertRaises(TypeError):
++            spam_cm()
++        with self.assertRaises(TypeError):
++            spam_cm(spam.spamlist())
++        with self.assertRaises(TypeError):
++            spam_cm(list)
+ 
+     def test_staticmethods(self):
+         # Testing static methods...
+@@ -4541,7 +4558,6 @@
+         self.assertRaises(AttributeError, getattr, C(), "attr")
+         self.assertEqual(descr.counter, 4)
+ 
+-        import gc
+         class EvilGetattribute(object):
+             # This used to segfault
+             def __getattr__(self, name):
+@@ -4554,6 +4570,9 @@
+ 
+         self.assertRaises(AttributeError, getattr, EvilGetattribute(), "attr")
+ 
++    def test_type___getattribute__(self):
++        self.assertRaises(TypeError, type.__getattribute__, list, type)
++
+     def test_abstractmethods(self):
+         # type pretends not to have __abstractmethods__.
+         self.assertRaises(AttributeError, getattr, type, "__abstractmethods__")
+@@ -4588,7 +4607,30 @@
+             pass
+         Foo.__repr__ = Foo.__str__
+         foo = Foo()
+-        str(foo)
++        self.assertRaises(RuntimeError, str, foo)
++        self.assertRaises(RuntimeError, repr, foo)
++
++    def test_mixing_slot_wrappers(self):
++        class X(dict):
++            __setattr__ = dict.__setitem__
++        x = X()
++        x.y = 42
++        self.assertEqual(x["y"], 42)
++
++    def test_cycle_through_dict(self):
++        # See bug #1469629
++        class X(dict):
++            def __init__(self):
++                dict.__init__(self)
++                self.__dict__ = self
++        x = X()
++        x.attr = 42
++        wr = weakref.ref(x)
++        del x
++        test_support.gc_collect()
++        self.assertIsNone(wr())
++        for o in gc.get_objects():
++            self.assertIsNot(type(o), X)
+ 
+ class DictProxyTests(unittest.TestCase):
+     def setUp(self):
+diff -r 70274d53c1dd Lib/test/test_dict.py
+--- a/Lib/test/test_dict.py
++++ b/Lib/test/test_dict.py
+@@ -299,6 +299,26 @@
+         x.fail = True
+         self.assertRaises(Exc, d.setdefault, x, [])
+ 
++    def test_setdefault_atomic(self):
++        # Issue #13521: setdefault() calls __hash__ and __eq__ only once.
++        class Hashed(object):
++            def __init__(self):
++                self.hash_count = 0
++                self.eq_count = 0
++            def __hash__(self):
++                self.hash_count += 1
++                return 42
++            def __eq__(self, other):
++                self.eq_count += 1
++                return id(self) == id(other)
++        hashed1 = Hashed()
++        y = {hashed1: 5}
++        hashed2 = Hashed()
++        y.setdefault(hashed2, [])
++        self.assertEqual(hashed1.hash_count, 1)
++        self.assertEqual(hashed2.hash_count, 1)
++        self.assertEqual(hashed1.eq_count + hashed2.eq_count, 1)
++
+     def test_popitem(self):
+         # dict.popitem()
+         for copymode in -1, +1:
+diff -r 70274d53c1dd Lib/test/test_file2k.py
+--- a/Lib/test/test_file2k.py
++++ b/Lib/test/test_file2k.py
+@@ -2,6 +2,9 @@
+ import os
+ import unittest
+ import itertools
++import select
++import signal
++import subprocess
+ import time
+ from array import array
+ from weakref import proxy
+@@ -89,6 +92,13 @@
+     def testRepr(self):
+         # verify repr works
+         self.assertTrue(repr(self.f).startswith("<open file '" + TESTFN))
++        # see issue #14161
++        # Windows doesn't like \r\n\t" in the file name, but ' is ok
++        fname = 'xx\rxx\nxx\'xx"xx' if sys.platform != "win32" else "xx'xx"
++        with open(fname, 'w') as f:
++            self.addCleanup(os.remove, fname)
++            self.assertTrue(repr(f).startswith(
++                    "<open file %r, mode 'w' at" % fname))
+ 
+     def testErrors(self):
+         self.f.close()
+@@ -595,6 +605,148 @@
+         self._test_close_open_io(io_func)
+ 
+ 
++@unittest.skipUnless(os.name == 'posix', 'test requires a posix system.')
++class TestFileSignalEINTR(unittest.TestCase):
++    def _test_reading(self, data_to_write, read_and_verify_code, method_name,
++                      universal_newlines=False):
++        """Generic buffered read method test harness to verify EINTR behavior.
++
++        Also validates that Python signal handlers are run during the read.
++
++        Args:
++            data_to_write: String to write to the child process for reading
++                before sending it a signal, confirming the signal was handled,
++                writing a final newline char and closing the infile pipe.
++            read_and_verify_code: Single "line" of code to read from a file
++                object named 'infile' and validate the result.  This will be
++                executed as part of a python subprocess fed data_to_write.
++            method_name: The name of the read method being tested, for use in
++                an error message on failure.
++            universal_newlines: If True, infile will be opened in universal
++                newline mode in the child process.
++        """
++        if universal_newlines:
++            # Test the \r\n -> \n conversion while we're at it.
++            data_to_write = data_to_write.replace('\n', '\r\n')
++            infile_setup_code = 'infile = os.fdopen(sys.stdin.fileno(), "rU")'
++        else:
++            infile_setup_code = 'infile = sys.stdin'
++        # Total pipe IO in this function is smaller than the minimum posix OS
++        # pipe buffer size of 512 bytes.  No writer should block.
++        assert len(data_to_write) < 512, 'data_to_write must fit in pipe buf.'
++
++        child_code = (
++             'import os, signal, sys ;'
++             'signal.signal('
++                     'signal.SIGINT, lambda s, f: sys.stderr.write("$\\n")) ;'
++             + infile_setup_code + ' ;' +
++             'assert isinstance(infile, file) ;'
++             'sys.stderr.write("Go.\\n") ;'
++             + read_and_verify_code)
++        reader_process = subprocess.Popen(
++                [sys.executable, '-c', child_code],
++                stdin=subprocess.PIPE, stdout=subprocess.PIPE,
++                stderr=subprocess.PIPE)
++        # Wait for the signal handler to be installed.
++        go = reader_process.stderr.read(4)
++        if go != 'Go.\n':
++            reader_process.kill()
++            self.fail('Error from %s process while awaiting "Go":\n%s' % (
++                    method_name, go+reader_process.stderr.read()))
++        reader_process.stdin.write(data_to_write)
++        signals_sent = 0
++        rlist = []
++        # We don't know when the read_and_verify_code in our child is actually
++        # executing within the read system call we want to interrupt.  This
++        # loop waits for a bit before sending the first signal to increase
++        # the likelihood of that.  Implementations without correct EINTR
++        # and signal handling usually fail this test.
++        while not rlist:
++            rlist, _, _ = select.select([reader_process.stderr], (), (), 0.05)
++            reader_process.send_signal(signal.SIGINT)
++            # Give the subprocess time to handle it before we loop around and
++            # send another one.  On OSX the second signal happening close to
++            # immediately after the first was causing the subprocess to crash
++            # via the OS's default SIGINT handler.
++            time.sleep(0.1)
++            signals_sent += 1
++            if signals_sent > 200:
++                reader_process.kill()
++                self.fail("failed to handle signal during %s." % method_name)
++        # This assumes anything unexpected that writes to stderr will also
++        # write a newline.  That is true of the traceback printing code.
++        signal_line = reader_process.stderr.readline()
++        if signal_line != '$\n':
++            reader_process.kill()
++            self.fail('Error from %s process while awaiting signal:\n%s' % (
++                    method_name, signal_line+reader_process.stderr.read()))
++        # We append a newline to our input so that a readline call can
++        # end on its own before the EOF is seen.
++        stdout, stderr = reader_process.communicate(input='\n')
++        if reader_process.returncode != 0:
++            self.fail('%s() process exited rc=%d.\nSTDOUT:\n%s\nSTDERR:\n%s' % (
++                    method_name, reader_process.returncode, stdout, stderr))
++
++    def test_readline(self, universal_newlines=False):
++        """file.readline must handle signals and not lose data."""
++        self._test_reading(
++                data_to_write='hello, world!',
++                read_and_verify_code=(
++                        'line = infile.readline() ;'
++                        'expected_line = "hello, world!\\n" ;'
++                        'assert line == expected_line, ('
++                        '"read %r expected %r" % (line, expected_line))'
++                ),
++                method_name='readline',
++                universal_newlines=universal_newlines)
++
++    def test_readline_with_universal_newlines(self):
++        self.test_readline(universal_newlines=True)
++
++    def test_readlines(self, universal_newlines=False):
++        """file.readlines must handle signals and not lose data."""
++        self._test_reading(
++                data_to_write='hello\nworld!',
++                read_and_verify_code=(
++                        'lines = infile.readlines() ;'
++                        'expected_lines = ["hello\\n", "world!\\n"] ;'
++                        'assert lines == expected_lines, ('
++                        '"readlines returned wrong data.\\n" '
++                        '"got lines %r\\nexpected  %r" '
++                        '% (lines, expected_lines))'
++                ),
++                method_name='readlines',
++                universal_newlines=universal_newlines)
++
++    def test_readlines_with_universal_newlines(self):
++        self.test_readlines(universal_newlines=True)
++
++    def test_readall(self):
++        """Unbounded file.read() must handle signals and not lose data."""
++        self._test_reading(
++                data_to_write='hello, world!abcdefghijklm',
++                read_and_verify_code=(
++                        'data = infile.read() ;'
++                        'expected_data = "hello, world!abcdefghijklm\\n";'
++                        'assert data == expected_data, ('
++                        '"read %r expected %r" % (data, expected_data))'
++                ),
++                method_name='unbounded read')
++
++    def test_readinto(self):
++        """file.readinto must handle signals and not lose data."""
++        self._test_reading(
++                data_to_write='hello, world!',
++                read_and_verify_code=(
++                        'data = bytearray(50) ;'
++                        'num_read = infile.readinto(data) ;'
++                        'expected_data = "hello, world!\\n";'
++                        'assert data[:num_read] == expected_data, ('
++                        '"read %r expected %r" % (data, expected_data))'
++                ),
++                method_name='readinto')
++
++
+ class StdoutTests(unittest.TestCase):
+ 
+     def test_move_stdout_on_write(self):
+@@ -671,7 +823,7 @@
+     # So get rid of it no matter what.
+     try:
+         run_unittest(AutoFileTests, OtherFileTests, FileSubclassTests,
+-            FileThreadingTests, StdoutTests)
++            FileThreadingTests, TestFileSignalEINTR, StdoutTests)
+     finally:
+         if os.path.exists(TESTFN):
+             os.unlink(TESTFN)
+diff -r 70274d53c1dd Lib/test/test_fileio.py
+--- a/Lib/test/test_fileio.py
++++ b/Lib/test/test_fileio.py
+@@ -130,6 +130,14 @@
+         else:
+             self.fail("Should have raised IOError")
+ 
++    @unittest.skipIf(os.name == 'nt', "test only works on a POSIX-like system")
++    def testOpenDirFD(self):
++        fd = os.open('.', os.O_RDONLY)
++        with self.assertRaises(IOError) as cm:
++            _FileIO(fd, 'r')
++        os.close(fd)
++        self.assertEqual(cm.exception.errno, errno.EISDIR)
++
+     #A set of functions testing that we get expected behaviour if someone has
+     #manually closed the internal file descriptor.  First, a decorator:
+     def ClosedFD(func):
+@@ -421,6 +429,17 @@
+             'IOError: [Errno 2] No such file or directory' not in out):
+             self.fail('Bad output: %r' % out)
+ 
++    def testUnclosedFDOnException(self):
++        class MyException(Exception): pass
++        class MyFileIO(_FileIO):
++            def __setattr__(self, name, value):
++                if name == "name":
++                    raise MyException("blocked setting name")
++                return super(MyFileIO, self).__setattr__(name, value)
++        fd = os.open(__file__, os.O_RDONLY)
++        self.assertRaises(MyException, MyFileIO, fd)
++        os.close(fd)  # should not raise OSError(EBADF)
++
+ def test_main():
+     # Historically, these tests have been sloppy about removing TESTFN.
+     # So get rid of it no matter what.
+diff -r 70274d53c1dd Lib/test/test_fractions.py
+--- a/Lib/test/test_fractions.py
++++ b/Lib/test/test_fractions.py
+@@ -6,6 +6,7 @@
+ import numbers
+ import operator
+ import fractions
++import sys
+ import unittest
+ from copy import copy, deepcopy
+ from cPickle import dumps, loads
+@@ -88,6 +89,9 @@
+     __hash__ = None
+ 
+ 
++class DummyFraction(fractions.Fraction):
++    """Dummy Fraction subclass for copy and deepcopy testing."""
++
+ class GcdTest(unittest.TestCase):
+ 
+     def testMisc(self):
+@@ -301,11 +305,15 @@
+         self.assertEqual(F(201, 200).limit_denominator(100), F(1))
+         self.assertEqual(F(201, 200).limit_denominator(101), F(102, 101))
+         self.assertEqual(F(0).limit_denominator(10000), F(0))
++        for i in (0, -1):
++            self.assertRaisesMessage(
++                ValueError, "max_denominator should be at least 1",
++                F(1).limit_denominator, i)
+ 
+     def testConversions(self):
+         self.assertTypedEquals(-1, math.trunc(F(-11, 10)))
+         self.assertTypedEquals(-1, int(F(-11, 10)))
+-
++        self.assertTypedEquals(1, math.trunc(F(11, 10)))
+         self.assertEqual(False, bool(F(0, 1)))
+         self.assertEqual(True, bool(F(3, 2)))
+         self.assertTypedEquals(0.1, float(F(1, 10)))
+@@ -330,6 +338,7 @@
+         self.assertEqual(F(8, 27), F(2, 3) ** F(3))
+         self.assertEqual(F(27, 8), F(2, 3) ** F(-3))
+         self.assertTypedEquals(2.0, F(4) ** F(1, 2))
++        self.assertEqual(F(1, 1), +F(1, 1))
+         # Will return 1j in 3.0:
+         self.assertRaises(ValueError, pow, F(-1), F(1, 2))
+ 
+@@ -394,6 +403,10 @@
+             TypeError,
+             "unsupported operand type(s) for +: 'Fraction' and 'Decimal'",
+             operator.add, F(3,11), Decimal('3.1415926'))
++        self.assertRaisesMessage(
++            TypeError,
++            "unsupported operand type(s) for +: 'Decimal' and 'Fraction'",
++            operator.add, Decimal('3.1415926'), F(3,11))
+         self.assertNotEqual(F(5, 2), Decimal('2.5'))
+ 
+     def testComparisons(self):
+@@ -571,9 +584,14 @@
+ 
+     def test_copy_deepcopy_pickle(self):
+         r = F(13, 7)
++        dr = DummyFraction(13, 7)
+         self.assertEqual(r, loads(dumps(r)))
+         self.assertEqual(id(r), id(copy(r)))
+         self.assertEqual(id(r), id(deepcopy(r)))
++        self.assertNotEqual(id(dr), id(copy(dr)))
++        self.assertNotEqual(id(dr), id(deepcopy(dr)))
++        self.assertTypedEquals(dr, copy(dr))
++        self.assertTypedEquals(dr, deepcopy(dr))
+ 
+     def test_slots(self):
+         # Issue 4998
+diff -r 70274d53c1dd Lib/test/test_gdb.py
+--- a/Lib/test/test_gdb.py
++++ b/Lib/test/test_gdb.py
+@@ -32,6 +32,15 @@
+ if gdbpy_version == '':
+     raise unittest.SkipTest("gdb not built with embedded python support")
+ 
++# Verify that "gdb" can load our custom hooks
++p = subprocess.Popen(["gdb", "--batch", cmd,
++                      "--args", sys.executable],
++                     stdout=subprocess.PIPE, stderr=subprocess.PIPE)
++__, gdbpy_errors = p.communicate()
++if b"auto-loading has been declined" in gdbpy_errors:
++    msg = "gdb security settings prevent use of custom hooks: %s"
++    raise unittest.SkipTest(msg % gdbpy_errors)
++
+ def python_is_optimized():
+     cflags = sysconfig.get_config_vars()['PY_CFLAGS']
+     final_opt = ""
+diff -r 70274d53c1dd Lib/test/test_hashlib.py
+--- a/Lib/test/test_hashlib.py
++++ b/Lib/test/test_hashlib.py
+@@ -108,12 +108,8 @@
+                                                 _algo.islower()]))
+ 
+     def test_unknown_hash(self):
+-        try:
+-            hashlib.new('spam spam spam spam spam')
+-        except ValueError:
+-            pass
+-        else:
+-            self.assertTrue(0 == "hashlib didn't reject bogus hash name")
++        self.assertRaises(ValueError, hashlib.new, 'spam spam spam spam spam')
++        self.assertRaises(TypeError, hashlib.new, 1)
+ 
+     def test_get_builtin_constructor(self):
+         get_builtin_constructor = hashlib.__dict__[
+@@ -132,6 +128,7 @@
+                 sys.modules['_md5'] = _md5
+             else:
+                 del sys.modules['_md5']
++        self.assertRaises(TypeError, get_builtin_constructor, 3)
+ 
+     def test_hexdigest(self):
+         for name in self.supported_hash_names:
+diff -r 70274d53c1dd Lib/test/test_htmlparser.py
+--- a/Lib/test/test_htmlparser.py
++++ b/Lib/test/test_htmlparser.py
+@@ -260,6 +260,16 @@
+             ('starttag', 'a', [('foo', None), ('=', None), ('bar', None)])
+         ]
+         self._run_check(html, expected)
++        #see issue #14538
++        html = ('<meta><meta / ><meta // ><meta / / >'
++                '<meta/><meta /><meta //><meta//>')
++        expected = [
++            ('starttag', 'meta', []), ('starttag', 'meta', []),
++            ('starttag', 'meta', []), ('starttag', 'meta', []),
++            ('startendtag', 'meta', []), ('startendtag', 'meta', []),
++            ('startendtag', 'meta', []), ('startendtag', 'meta', []),
++        ]
++        self._run_check(html, expected)
+ 
+     def test_declaration_junk_chars(self):
+         self._run_check("<!DOCTYPE foo $ >", [('decl', 'DOCTYPE foo $ ')])
+diff -r 70274d53c1dd Lib/test/test_httplib.py
+--- a/Lib/test/test_httplib.py
++++ b/Lib/test/test_httplib.py
+@@ -90,6 +90,34 @@
+                 conn.request('POST', '/', body, headers)
+                 self.assertEqual(conn._buffer.count[header.lower()], 1)
+ 
++    def test_content_length_0(self):
++
++        class ContentLengthChecker(list):
++            def __init__(self):
++                list.__init__(self)
++                self.content_length = None
++            def append(self, item):
++                kv = item.split(':', 1)
++                if len(kv) > 1 and kv[0].lower() == 'content-length':
++                    self.content_length = kv[1].strip()
++                list.append(self, item)
++
++        # POST with empty body
++        conn = httplib.HTTPConnection('example.com')
++        conn.sock = FakeSocket(None)
++        conn._buffer = ContentLengthChecker()
++        conn.request('POST', '/', '')
++        self.assertEqual(conn._buffer.content_length, '0',
++                        'Header Content-Length not set')
++
++        # PUT request with empty body
++        conn = httplib.HTTPConnection('example.com')
++        conn.sock = FakeSocket(None)
++        conn._buffer = ContentLengthChecker()
++        conn.request('PUT', '/', '')
++        self.assertEqual(conn._buffer.content_length, '0',
++                        'Header Content-Length not set')
++
+     def test_putheader(self):
+         conn = httplib.HTTPConnection('example.com')
+         conn.sock = FakeSocket(None)
+@@ -349,6 +377,14 @@
+         resp.begin()
+         self.assertRaises(httplib.LineTooLong, resp.read)
+ 
++    def test_early_eof(self):
++        # Test httpresponse with no \r\n termination,
++        body = "HTTP/1.1 200 Ok"
++        sock = FakeSocket(body)
++        resp = httplib.HTTPResponse(sock)
++        resp.begin()
++        self.assertEqual(resp.read(), '')
++        self.assertTrue(resp.isclosed())
+ 
+ class OfflineTest(TestCase):
+     def test_responses(self):
+diff -r 70274d53c1dd Lib/test/test_httpservers.py
+--- a/Lib/test/test_httpservers.py
++++ b/Lib/test/test_httpservers.py
+@@ -4,11 +4,6 @@
+ Josip Dzolonga, and Michael Otteneder for the 2007/08 GHOP contest.
+ """
+ 
+-from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
+-from SimpleHTTPServer import SimpleHTTPRequestHandler
+-from CGIHTTPServer import CGIHTTPRequestHandler
+-import CGIHTTPServer
+-
+ import os
+ import sys
+ import re
+@@ -17,12 +12,17 @@
+ import urllib
+ import httplib
+ import tempfile
++import unittest
++import CGIHTTPServer
+ 
+-import unittest
+ 
++from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
++from SimpleHTTPServer import SimpleHTTPRequestHandler
++from CGIHTTPServer import CGIHTTPRequestHandler
+ from StringIO import StringIO
++from test import test_support
+ 
+-from test import test_support
++
+ threading = test_support.import_module('threading')
+ 
+ 
+@@ -43,7 +43,7 @@
+         self.end_headers()
+         self.wfile.write(b'<html><body>Data</body></html>\r\n')
+ 
+-    def log_message(self, format, *args):
++    def log_message(self, fmt, *args):
+         pass
+ 
+ 
+@@ -97,9 +97,9 @@
+         self.handler = SocketlessRequestHandler()
+ 
+     def send_typical_request(self, message):
+-        input = StringIO(message)
++        input_msg = StringIO(message)
+         output = StringIO()
+-        self.handler.rfile = input
++        self.handler.rfile = input_msg
+         self.handler.wfile = output
+         self.handler.handle_one_request()
+         output.seek(0)
+@@ -296,7 +296,7 @@
+             os.chdir(self.cwd)
+             try:
+                 shutil.rmtree(self.tempdir)
+-            except:
++            except OSError:
+                 pass
+         finally:
+             BaseTestCase.tearDown(self)
+@@ -418,41 +418,44 @@
+         finally:
+             BaseTestCase.tearDown(self)
+ 
+-    def test_url_collapse_path_split(self):
++    def test_url_collapse_path(self):
++        # verify tail is the last portion and head is the rest on proper urls
+         test_vectors = {
+-            '': ('/', ''),
++            '': '//',
+             '..': IndexError,
+             '/.//..': IndexError,
+-            '/': ('/', ''),
+-            '//': ('/', ''),
+-            '/\\': ('/', '\\'),
+-            '/.//': ('/', ''),
+-            'cgi-bin/file1.py': ('/cgi-bin', 'file1.py'),
+-            '/cgi-bin/file1.py': ('/cgi-bin', 'file1.py'),
+-            'a': ('/', 'a'),
+-            '/a': ('/', 'a'),
+-            '//a': ('/', 'a'),
+-            './a': ('/', 'a'),
+-            './C:/': ('/C:', ''),
+-            '/a/b': ('/a', 'b'),
+-            '/a/b/': ('/a/b', ''),
+-            '/a/b/c/..': ('/a/b', ''),
+-            '/a/b/c/../d': ('/a/b', 'd'),
+-            '/a/b/c/../d/e/../f': ('/a/b/d', 'f'),
+-            '/a/b/c/../d/e/../../f': ('/a/b', 'f'),
+-            '/a/b/c/../d/e/.././././..//f': ('/a/b', 'f'),
++            '/': '//',
++            '//': '//',
++            '/\\': '//\\',
++            '/.//': '//',
++            'cgi-bin/file1.py': '/cgi-bin/file1.py',
++            '/cgi-bin/file1.py': '/cgi-bin/file1.py',
++            'a': '//a',
++            '/a': '//a',
++            '//a': '//a',
++            './a': '//a',
++            './C:/': '/C:/',
++            '/a/b': '/a/b',
++            '/a/b/': '/a/b/',
++            '/a/b/.': '/a/b/',
++            '/a/b/c/..': '/a/b/',
++            '/a/b/c/../d': '/a/b/d',
++            '/a/b/c/../d/e/../f': '/a/b/d/f',
++            '/a/b/c/../d/e/../../f': '/a/b/f',
++            '/a/b/c/../d/e/.././././..//f': '/a/b/f',
+             '../a/b/c/../d/e/.././././..//f': IndexError,
+-            '/a/b/c/../d/e/../../../f': ('/a', 'f'),
+-            '/a/b/c/../d/e/../../../../f': ('/', 'f'),
++            '/a/b/c/../d/e/../../../f': '/a/f',
++            '/a/b/c/../d/e/../../../../f': '//f',
+             '/a/b/c/../d/e/../../../../../f': IndexError,
+-            '/a/b/c/../d/e/../../../../f/..': ('/', ''),
++            '/a/b/c/../d/e/../../../../f/..': '//',
++            '/a/b/c/../d/e/../../../../f/../.': '//',
+         }
+         for path, expected in test_vectors.iteritems():
+             if isinstance(expected, type) and issubclass(expected, Exception):
+                 self.assertRaises(expected,
+-                                  CGIHTTPServer._url_collapse_path_split, path)
++                                  CGIHTTPServer._url_collapse_path, path)
+             else:
+-                actual = CGIHTTPServer._url_collapse_path_split(path)
++                actual = CGIHTTPServer._url_collapse_path(path)
+                 self.assertEqual(expected, actual,
+                                  msg='path = %r\nGot:    %r\nWanted: %r' %
+                                  (path, actual, expected))
+diff -r 70274d53c1dd Lib/test/test_import.py
+--- a/Lib/test/test_import.py
++++ b/Lib/test/test_import.py
+@@ -7,9 +7,12 @@
+ import stat
+ import sys
+ import unittest
++import textwrap
++import shutil
++
+ from test.test_support import (unlink, TESTFN, unload, run_unittest, rmtree,
+                                is_jython, check_warnings, EnvironmentVarGuard)
+-import textwrap
++from test import symlink_support
+ from test import script_helper
+ 
+ def remove_files(name):
+@@ -424,6 +427,13 @@
+         drive = path[0]
+         unc = "\\\\%s\\%s$"%(hn, drive)
+         unc += path[2:]
++        try:
++            os.listdir(unc)
++        except OSError as e:
++            if e.errno in (errno.EPERM, errno.EACCES):
++                # See issue #15338
++                self.skipTest("cannot access administrative share %r" % (unc,))
++            raise
+         sys.path.append(path)
+         mod = __import__("test_trailing_slash")
+         self.assertEqual(mod.testdata, 'test_trailing_slash')
+@@ -488,8 +498,58 @@
+                       "implicit absolute import")
+ 
+ 
++class TestSymbolicallyLinkedPackage(unittest.TestCase):
++    package_name = 'sample'
++
++    def setUp(self):
++        if os.path.exists(self.tagged):
++            shutil.rmtree(self.tagged)
++        if os.path.exists(self.package_name):
++            symlink_support.remove_symlink(self.package_name)
++        self.orig_sys_path = sys.path[:]
++
++        # create a sample package; imagine you have a package with a tag and
++        #  you want to symbolically link it from its untagged name.
++        os.mkdir(self.tagged)
++        init_file = os.path.join(self.tagged, '__init__.py')
++        open(init_file, 'w').close()
++        assert os.path.exists(init_file)
++
++        # now create a symlink to the tagged package
++        # sample -> sample-tagged
++        symlink_support.symlink(self.tagged, self.package_name)
++
++        assert os.path.isdir(self.package_name)
++        assert os.path.isfile(os.path.join(self.package_name, '__init__.py'))
++
++    @property
++    def tagged(self):
++        return self.package_name + '-tagged'
++
++    # regression test for issue6727
++    @unittest.skipUnless(
++        not hasattr(sys, 'getwindowsversion')
++        or sys.getwindowsversion() >= (6, 0),
++        "Windows Vista or later required")
++    @symlink_support.skip_unless_symlink
++    def test_symlinked_dir_importable(self):
++        # make sure sample can only be imported from the current directory.
++        sys.path[:] = ['.']
++
++        # and try to import the package
++        __import__(self.package_name)
++
++    def tearDown(self):
++        # now cleanup
++        if os.path.exists(self.package_name):
++            symlink_support.remove_symlink(self.package_name)
++        if os.path.exists(self.tagged):
++            shutil.rmtree(self.tagged)
++        sys.path[:] = self.orig_sys_path
++
+ def test_main(verbose=None):
+-    run_unittest(ImportTests, PycRewritingTests, PathsTests, RelativeImportTests)
++    run_unittest(ImportTests, PycRewritingTests, PathsTests,
++        RelativeImportTests, TestSymbolicallyLinkedPackage)
+ 
+ if __name__ == '__main__':
+     # Test needs to be a package, so we can do relative imports.
+diff -r 70274d53c1dd Lib/test/test_io.py
+--- a/Lib/test/test_io.py
++++ b/Lib/test/test_io.py
+@@ -593,6 +593,19 @@
+         self.assertEqual(rawio.read(2), None)
+         self.assertEqual(rawio.read(2), b"")
+ 
++    def test_fileio_closefd(self):
++        # Issue #4841
++        with self.open(__file__, 'rb') as f1, \
++             self.open(__file__, 'rb') as f2:
++            fileio = self.FileIO(f1.fileno(), closefd=False)
++            # .__init__() must not close f1
++            fileio.__init__(f2.fileno(), closefd=False)
++            f1.readline()
++            # .close() must not close f2
++            fileio.close()
++            f2.readline()
++
++
+ class CIOTest(IOTest):
+ 
+     def test_IOBase_finalize(self):
+@@ -735,6 +748,20 @@
+             buf.raw = x
+ 
+ 
++class SizeofTest:
++
++    @support.cpython_only
++    def test_sizeof(self):
++        bufsize1 = 4096
++        bufsize2 = 8192
++        rawio = self.MockRawIO()
++        bufio = self.tp(rawio, buffer_size=bufsize1)
++        size = sys.getsizeof(bufio) - bufsize1
++        rawio = self.MockRawIO()
++        bufio = self.tp(rawio, buffer_size=bufsize2)
++        self.assertEqual(sys.getsizeof(bufio), size + bufsize2)
++
++
+ class BufferedReaderTest(unittest.TestCase, CommonBufferedTests):
+     read_mode = "rb"
+ 
+@@ -918,7 +945,7 @@
+                              "failed for {}: {} != 0".format(n, rawio._extraneous_reads))
+ 
+ 
+-class CBufferedReaderTest(BufferedReaderTest):
++class CBufferedReaderTest(BufferedReaderTest, SizeofTest):
+     tp = io.BufferedReader
+ 
+     def test_constructor(self):
+@@ -1181,7 +1208,7 @@
+             self.tp(self.MockRawIO(), 8, 12)
+ 
+ 
+-class CBufferedWriterTest(BufferedWriterTest):
++class CBufferedWriterTest(BufferedWriterTest, SizeofTest):
+     tp = io.BufferedWriter
+ 
+     def test_constructor(self):
+@@ -1569,8 +1596,8 @@
+                 f.flush()
+                 self.assertEqual(raw.getvalue(), b'1b\n2def\n3\n')
+ 
+-
+-class CBufferedRandomTest(CBufferedReaderTest, CBufferedWriterTest, BufferedRandomTest):
++class CBufferedRandomTest(CBufferedReaderTest, CBufferedWriterTest,
++                          BufferedRandomTest, SizeofTest):
+     tp = io.BufferedRandom
+ 
+     def test_constructor(self):
+diff -r 70274d53c1dd Lib/test/test_logging.py
+--- a/Lib/test/test_logging.py
++++ b/Lib/test/test_logging.py
+@@ -1,6 +1,6 @@
+ #!/usr/bin/env python
+ #
+-# Copyright 2001-2010 by Vinay Sajip. All Rights Reserved.
++# Copyright 2001-2012 by Vinay Sajip. All Rights Reserved.
+ #
+ # Permission to use, copy, modify, and distribute this software and its
+ # documentation for any purpose and without fee is hereby granted,
+@@ -18,7 +18,7 @@
+ 
+ """Test harness for the logging module. Run all tests.
+ 
+-Copyright (C) 2001-2010 Vinay Sajip. All Rights Reserved.
++Copyright (C) 2001-2012 Vinay Sajip. All Rights Reserved.
+ """
+ 
+ import logging
+@@ -31,6 +31,7 @@
+ import gc
+ import json
+ import os
++import random
+ import re
+ import select
+ import socket
+@@ -40,6 +41,7 @@
+ import tempfile
+ from test.test_support import captured_stdout, run_with_locale, run_unittest
+ import textwrap
++import time
+ import unittest
+ import warnings
+ import weakref
+@@ -1873,6 +1875,47 @@
+         self.assertTrue(c2 is c3)
+ 
+ 
++class HandlerTest(BaseTest):
++
++    @unittest.skipIf(os.name == 'nt', 'WatchedFileHandler not appropriate for Windows.')
++    @unittest.skipUnless(threading, 'Threading required for this test.')
++    def test_race(self):
++        # Issue #14632 refers.
++        def remove_loop(fname, tries):
++            for _ in range(tries):
++                try:
++                    os.unlink(fname)
++                except OSError:
++                    pass
++                time.sleep(0.004 * random.randint(0, 4))
++
++        del_count = 500
++        log_count = 500
++
++        for delay in (False, True):
++            fd, fn = tempfile.mkstemp('.log', 'test_logging-3-')
++            os.close(fd)
++            remover = threading.Thread(target=remove_loop, args=(fn, del_count))
++            remover.daemon = True
++            remover.start()
++            h = logging.handlers.WatchedFileHandler(fn, delay=delay)
++            f = logging.Formatter('%(asctime)s: %(levelname)s: %(message)s')
++            h.setFormatter(f)
++            try:
++                for _ in range(log_count):
++                    time.sleep(0.005)
++                    r = logging.makeLogRecord({'msg': 'testing' })
++                    h.handle(r)
++            finally:
++                remover.join()
++                try:
++                    h.close()
++                except ValueError:
++                    pass
++                if os.path.exists(fn):
++                    os.unlink(fn)
++
++
+ # Set the locale to the platform-dependent default.  I have no idea
+ # why the test does this, but in any case we save the current locale
+ # first and restore it at the end.
+@@ -1882,7 +1925,7 @@
+                  CustomLevelsAndFiltersTest, MemoryHandlerTest,
+                  ConfigFileTest, SocketHandlerTest, MemoryTest,
+                  EncodingTest, WarningsTest, ConfigDictTest, ManagerTest,
+-                 ChildLoggerTest)
++                 ChildLoggerTest, HandlerTest)
+ 
+ if __name__ == "__main__":
+     test_main()
+diff -r 70274d53c1dd Lib/test/test_mailbox.py
+--- a/Lib/test/test_mailbox.py
++++ b/Lib/test/test_mailbox.py
+@@ -6,7 +6,9 @@
+ import email
+ import email.message
+ import re
++import shutil
+ import StringIO
++import tempfile
+ from test import test_support
+ import unittest
+ import mailbox
+@@ -19,7 +21,7 @@
+ # Silence Py3k warning
+ rfc822 = test_support.import_module('rfc822', deprecated=True)
+ 
+-class TestBase(unittest.TestCase):
++class TestBase:
+ 
+     def _check_sample(self, msg):
+         # Inspect a mailbox.Message representation of the sample message
+@@ -38,12 +40,7 @@
+     def _delete_recursively(self, target):
+         # Delete a file or delete a directory recursively
+         if os.path.isdir(target):
+-            for path, dirs, files in os.walk(target, topdown=False):
+-                for name in files:
+-                    os.remove(os.path.join(path, name))
+-                for name in dirs:
+-                    os.rmdir(os.path.join(path, name))
+-            os.rmdir(target)
++            shutil.rmtree(target)
+         elif os.path.exists(target):
+             os.remove(target)
+ 
+@@ -79,6 +76,18 @@
+         for i in (1, 2, 3, 4):
+             self._check_sample(self._box[keys[i]])
+ 
++    def test_add_file(self):
++        with tempfile.TemporaryFile('w+') as f:
++            f.write(_sample_message)
++            f.seek(0)
++            key = self._box.add(f)
++        self.assertEqual(self._box.get_string(key).split('\n'),
++            _sample_message.split('\n'))
++
++    def test_add_StringIO(self):
++        key = self._box.add(StringIO.StringIO(self._template % "0"))
++        self.assertEqual(self._box.get_string(key), self._template % "0")
++
+     def test_remove(self):
+         # Remove messages using remove()
+         self._test_remove_or_delitem(self._box.remove)
+@@ -390,6 +399,17 @@
+         # Write changes to disk
+         self._test_flush_or_close(self._box.flush, True)
+ 
++    def test_popitem_and_flush_twice(self):
++        # See #15036.
++        self._box.add(self._template % 0)
++        self._box.add(self._template % 1)
++        self._box.flush()
++
++        self._box.popitem()
++        self._box.flush()
++        self._box.popitem()
++        self._box.flush()
++
+     def test_lock_unlock(self):
+         # Lock and unlock the mailbox
+         self.assertFalse(os.path.exists(self._get_lock_path()))
+@@ -433,7 +453,7 @@
+         return self._path + '.lock'
+ 
+ 
+-class TestMailboxSuperclass(TestBase):
++class TestMailboxSuperclass(TestBase, unittest.TestCase):
+ 
+     def test_notimplemented(self):
+         # Test that all Mailbox methods raise NotImplementedException.
+@@ -468,7 +488,7 @@
+         self.assertRaises(NotImplementedError, lambda: box.close())
+ 
+ 
+-class TestMaildir(TestMailbox):
++class TestMaildir(TestMailbox, unittest.TestCase):
+ 
+     _factory = lambda self, path, factory=None: mailbox.Maildir(path, factory)
+ 
+@@ -817,7 +837,49 @@
+         self._box._refresh()
+         self.assertTrue(refreshed())
+ 
+-class _TestMboxMMDF(TestMailbox):
++
++class _TestSingleFile(TestMailbox):
++    '''Common tests for single-file mailboxes'''
++
++    def test_add_doesnt_rewrite(self):
++        # When only adding messages, flush() should not rewrite the
++        # mailbox file. See issue #9559.
++
++        # Inode number changes if the contents are written to another
++        # file which is then renamed over the original file. So we
++        # must check that the inode number doesn't change.
++        inode_before = os.stat(self._path).st_ino
++
++        self._box.add(self._template % 0)
++        self._box.flush()
++
++        inode_after = os.stat(self._path).st_ino
++        self.assertEqual(inode_before, inode_after)
++
++        # Make sure the message was really added
++        self._box.close()
++        self._box = self._factory(self._path)
++        self.assertEqual(len(self._box), 1)
++
++    def test_permissions_after_flush(self):
++        # See issue #5346
++
++        # Make the mailbox world writable. It's unlikely that the new
++        # mailbox file would have these permissions after flush(),
++        # because umask usually prevents it.
++        mode = os.stat(self._path).st_mode | 0o666
++        os.chmod(self._path, mode)
++
++        self._box.add(self._template % 0)
++        i = self._box.add(self._template % 1)
++        # Need to remove one message to make flush() create a new file
++        self._box.remove(i)
++        self._box.flush()
++
++        self.assertEqual(os.stat(self._path).st_mode, mode)
++
++
++class _TestMboxMMDF(_TestSingleFile):
+ 
+     def tearDown(self):
+         self._box.close()
+@@ -918,7 +980,7 @@
+         self._box.close()
+ 
+ 
+-class TestMbox(_TestMboxMMDF):
++class TestMbox(_TestMboxMMDF, unittest.TestCase):
+ 
+     _factory = lambda self, path, factory=None: mailbox.mbox(path, factory)
+ 
+@@ -941,12 +1003,12 @@
+             perms = st.st_mode
+             self.assertFalse((perms & 0111)) # Execute bits should all be off.
+ 
+-class TestMMDF(_TestMboxMMDF):
++class TestMMDF(_TestMboxMMDF, unittest.TestCase):
+ 
+     _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory)
+ 
+ 
+-class TestMH(TestMailbox):
++class TestMH(TestMailbox, unittest.TestCase):
+ 
+     _factory = lambda self, path, factory=None: mailbox.MH(path, factory)
+ 
+@@ -1078,7 +1140,7 @@
+         return os.path.join(self._path, '.mh_sequences.lock')
+ 
+ 
+-class TestBabyl(TestMailbox):
++class TestBabyl(_TestSingleFile, unittest.TestCase):
+ 
+     _factory = lambda self, path, factory=None: mailbox.Babyl(path, factory)
+ 
+@@ -1107,7 +1169,7 @@
+         self.assertEqual(set(self._box.get_labels()), set(['blah']))
+ 
+ 
+-class TestMessage(TestBase):
++class TestMessage(TestBase, unittest.TestCase):
+ 
+     _factory = mailbox.Message      # Overridden by subclasses to reuse tests
+ 
+@@ -1178,7 +1240,7 @@
+         pass
+ 
+ 
+-class TestMaildirMessage(TestMessage):
++class TestMaildirMessage(TestMessage, unittest.TestCase):
+ 
+     _factory = mailbox.MaildirMessage
+ 
+@@ -1253,7 +1315,7 @@
+         self._check_sample(msg)
+ 
+ 
+-class _TestMboxMMDFMessage(TestMessage):
++class _TestMboxMMDFMessage:
+ 
+     _factory = mailbox._mboxMMDFMessage
+ 
+@@ -1300,12 +1362,12 @@
+                                  r"\d{2} \d{4}", msg.get_from()))
+ 
+ 
+-class TestMboxMessage(_TestMboxMMDFMessage):
++class TestMboxMessage(_TestMboxMMDFMessage, TestMessage):
+ 
+     _factory = mailbox.mboxMessage
+ 
+ 
+-class TestMHMessage(TestMessage):
++class TestMHMessage(TestMessage, unittest.TestCase):
+ 
+     _factory = mailbox.MHMessage
+ 
+@@ -1336,7 +1398,7 @@
+         self.assertEqual(msg.get_sequences(), ['foobar', 'replied'])
+ 
+ 
+-class TestBabylMessage(TestMessage):
++class TestBabylMessage(TestMessage, unittest.TestCase):
+ 
+     _factory = mailbox.BabylMessage
+ 
+@@ -1391,12 +1453,12 @@
+             self.assertEqual(visible[header], msg[header])
+ 
+ 
+-class TestMMDFMessage(_TestMboxMMDFMessage):
++class TestMMDFMessage(_TestMboxMMDFMessage, TestMessage):
+ 
+     _factory = mailbox.MMDFMessage
+ 
+ 
+-class TestMessageConversion(TestBase):
++class TestMessageConversion(TestBase, unittest.TestCase):
+ 
+     def test_plain_to_x(self):
+         # Convert Message to all formats
+@@ -1719,7 +1781,7 @@
+         proxy.close()
+ 
+ 
+-class TestProxyFile(TestProxyFileBase):
++class TestProxyFile(TestProxyFileBase, unittest.TestCase):
+ 
+     def setUp(self):
+         self._path = test_support.TESTFN
+@@ -1768,7 +1830,7 @@
+         self._test_close(mailbox._ProxyFile(self._file))
+ 
+ 
+-class TestPartialFile(TestProxyFileBase):
++class TestPartialFile(TestProxyFileBase, unittest.TestCase):
+ 
+     def setUp(self):
+         self._path = test_support.TESTFN
+diff -r 70274d53c1dd Lib/test/test_memoryio.py
+--- a/Lib/test/test_memoryio.py
++++ b/Lib/test/test_memoryio.py
+@@ -638,6 +638,17 @@
+         memio.close()
+         self.assertRaises(ValueError, memio.__setstate__, (b"closed", 0, None))
+ 
++    check_sizeof = support.check_sizeof
++
++    @support.cpython_only
++    def test_sizeof(self):
++        basesize = support.calcobjsize(b'P2PP2P')
++        check = self.check_sizeof
++        self.assertEqual(object.__sizeof__(io.BytesIO()), basesize)
++        check(io.BytesIO(), basesize )
++        check(io.BytesIO(b'a'), basesize + 1 + 1 )
++        check(io.BytesIO(b'a' * 1000), basesize + 1000 + 1 )
++
+ 
+ class CStringIOTest(PyStringIOTest):
+     ioclass = io.StringIO
+diff -r 70274d53c1dd Lib/test/test_multiprocessing.py
+--- a/Lib/test/test_multiprocessing.py
++++ b/Lib/test/test_multiprocessing.py
+@@ -16,6 +16,7 @@
+ import random
+ import logging
+ import errno
++import test.script_helper
+ from test import test_support
+ from StringIO import StringIO
+ _multiprocessing = test_support.import_module('_multiprocessing')
+@@ -325,6 +326,36 @@
+             ]
+         self.assertEqual(result, expected)
+ 
++    @classmethod
++    def _test_sys_exit(cls, reason, testfn):
++        sys.stderr = open(testfn, 'w')
++        sys.exit(reason)
++
++    def test_sys_exit(self):
++        # See Issue 13854
++        if self.TYPE == 'threads':
++            return
++
++        testfn = test_support.TESTFN
++        self.addCleanup(test_support.unlink, testfn)
++
++        for reason, code in (([1, 2, 3], 1), ('ignore this', 0)):
++            p = self.Process(target=self._test_sys_exit, args=(reason, testfn))
++            p.daemon = True
++            p.start()
++            p.join(5)
++            self.assertEqual(p.exitcode, code)
++
++            with open(testfn, 'r') as f:
++                self.assertEqual(f.read().rstrip(), str(reason))
++
++        for reason in (True, False, 8):
++            p = self.Process(target=sys.exit, args=(reason,))
++            p.daemon = True
++            p.start()
++            p.join(5)
++            self.assertEqual(p.exitcode, reason)
++
+ #
+ #
+ #
+@@ -1152,6 +1183,36 @@
+         join()
+         self.assertTrue(join.elapsed < 0.2)
+ 
++    def test_empty_iterable(self):
++        # See Issue 12157
++        p = self.Pool(1)
++
++        self.assertEqual(p.map(sqr, []), [])
++        self.assertEqual(list(p.imap(sqr, [])), [])
++        self.assertEqual(list(p.imap_unordered(sqr, [])), [])
++        self.assertEqual(p.map_async(sqr, []).get(), [])
++
++        p.close()
++        p.join()
++
++def unpickleable_result():
++    return lambda: 42
++
++class _TestPoolWorkerErrors(BaseTestCase):
++    ALLOWED_TYPES = ('processes', )
++
++    def test_unpickleable_result(self):
++        from multiprocessing.pool import MaybeEncodingError
++        p = multiprocessing.Pool(2)
++
++        # Make sure we don't lose pool processes because of encoding errors.
++        for iteration in range(20):
++            res = p.apply_async(unpickleable_result)
++            self.assertRaises(MaybeEncodingError, res.get)
++
++        p.close()
++        p.join()
++
+ class _TestPoolWorkerLifetime(BaseTestCase):
+ 
+     ALLOWED_TYPES = ('processes', )
+@@ -1651,6 +1712,23 @@
+             self.assertEqual(conn.recv(), 'hello')
+             p.join()
+             l.close()
++
++    def test_issue14725(self):
++        l = self.connection.Listener()
++        p = self.Process(target=self._test, args=(l.address,))
++        p.daemon = True
++        p.start()
++        time.sleep(1)
++        # On Windows the client process should by now have connected,
++        # written data and closed the pipe handle by now.  This causes
++        # ConnectNamdedPipe() to fail with ERROR_NO_DATA.  See Issue
++        # 14725.
++        conn = l.accept()
++        self.assertEqual(conn.recv(), 'hello')
++        conn.close()
++        p.join()
++        l.close()
++
+ #
+ # Test of sending connection and socket objects between processes
+ #
+@@ -2078,7 +2156,7 @@
+         'Queue', 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore',
+         'Condition', 'Event', 'Value', 'Array', 'RawValue',
+         'RawArray', 'current_process', 'active_children', 'Pipe',
+-        'connection', 'JoinableQueue'
++        'connection', 'JoinableQueue', 'Pool'
+         )))
+ 
+ testcases_processes = create_test_cases(ProcessesMixin, type='processes')
+@@ -2092,7 +2170,7 @@
+     locals().update(get_attributes(manager, (
+         'Queue', 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore',
+        'Condition', 'Event', 'Value', 'Array', 'list', 'dict',
+-        'Namespace', 'JoinableQueue'
++        'Namespace', 'JoinableQueue', 'Pool'
+         )))
+ 
+ testcases_manager = create_test_cases(ManagerMixin, type='manager')
+@@ -2106,7 +2184,7 @@
+         'Queue', 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore',
+         'Condition', 'Event', 'Value', 'Array', 'current_process',
+         'active_children', 'Pipe', 'connection', 'dict', 'list',
+-        'Namespace', 'JoinableQueue'
++        'Namespace', 'JoinableQueue', 'Pool'
+         )))
+ 
+ testcases_threads = create_test_cases(ThreadsMixin, type='threads')
+@@ -2238,8 +2316,62 @@
+         flike.flush()
+         assert sio.getvalue() == 'foo'
+ 
++#
++# Test interaction with socket timeouts - see Issue #6056
++#
++
++class TestTimeouts(unittest.TestCase):
++    @classmethod
++    def _test_timeout(cls, child, address):
++        time.sleep(1)
++        child.send(123)
++        child.close()
++        conn = multiprocessing.connection.Client(address)
++        conn.send(456)
++        conn.close()
++
++    def test_timeout(self):
++        old_timeout = socket.getdefaulttimeout()
++        try:
++            socket.setdefaulttimeout(0.1)
++            parent, child = multiprocessing.Pipe(duplex=True)
++            l = multiprocessing.connection.Listener(family='AF_INET')
++            p = multiprocessing.Process(target=self._test_timeout,
++                                        args=(child, l.address))
++            p.start()
++            child.close()
++            self.assertEqual(parent.recv(), 123)
++            parent.close()
++            conn = l.accept()
++            self.assertEqual(conn.recv(), 456)
++            conn.close()
++            l.close()
++            p.join(10)
++        finally:
++            socket.setdefaulttimeout(old_timeout)
++
++#
++# Test what happens with no "if __name__ == '__main__'"
++#
++
++class TestNoForkBomb(unittest.TestCase):
++    def test_noforkbomb(self):
++        name = os.path.join(os.path.dirname(__file__), 'mp_fork_bomb.py')
++        if WIN32:
++            rc, out, err = test.script_helper.assert_python_failure(name)
++            self.assertEqual('', out.decode('ascii'))
++            self.assertIn('RuntimeError', err.decode('ascii'))
++        else:
++            rc, out, err = test.script_helper.assert_python_ok(name)
++            self.assertEqual('123', out.decode('ascii').rstrip())
++            self.assertEqual('', err.decode('ascii'))
++
++#
++#
++#
++
+ testcases_other = [OtherTest, TestInvalidHandle, TestInitializers,
+-                   TestStdinBadfiledescriptor]
++                   TestStdinBadfiledescriptor, TestTimeouts, TestNoForkBomb]
+ 
+ #
+ #
+diff -r 70274d53c1dd Lib/test/test_optparse.py
+--- a/Lib/test/test_optparse.py
++++ b/Lib/test/test_optparse.py
+@@ -769,6 +769,13 @@
+         self.assertParseFail(["-test"],
+                              "no such option: -e")
+ 
++    def test_add_option_accepts_unicode(self):
++        self.parser.add_option(u"-u", u"--unicode", action="store_true")
++        self.assertParseOK(["-u"],
++                           {'a': None, 'boo': None, 'foo': None, 'unicode': True},
++                           [])
++
++
+ class TestBool(BaseTest):
+     def setUp(self):
+         options = [make_option("-v",
+diff -r 70274d53c1dd Lib/test/test_parser.py
+--- a/Lib/test/test_parser.py
++++ b/Lib/test/test_parser.py
+@@ -1,7 +1,8 @@
+ import parser
+ import unittest
+ import sys
+-from test import test_support
++import struct
++from test import test_support as support
+ 
+ #
+ #  First, we test that we can generate trees from valid source fragments,
+@@ -583,12 +584,57 @@
+         print >>sys.stderr, "Expecting 's_push: parser stack overflow' in next line"
+         self.assertRaises(MemoryError, parser.expr, e)
+ 
++class STObjectTestCase(unittest.TestCase):
++    """Test operations on ST objects themselves"""
++
++    check_sizeof = support.check_sizeof
++
++    @support.cpython_only
++    def test_sizeof(self):
++        def XXXROUNDUP(n):
++            if n <= 1:
++                return n
++            if n <= 128:
++                return (n + 3) & ~3
++            return 1 << (n - 1).bit_length()
++
++        basesize = support.calcobjsize('Pii')
++        nodesize = struct.calcsize('hP3iP0h')
++        def sizeofchildren(node):
++            if node is None:
++                return 0
++            res = 0
++            hasstr = len(node) > 1 and isinstance(node[-1], str)
++            if hasstr:
++                res += len(node[-1]) + 1
++            children = node[1:-1] if hasstr else node[1:]
++            if children:
++                res += XXXROUNDUP(len(children)) * nodesize
++                for child in children:
++                    res += sizeofchildren(child)
++            return res
++
++        def check_st_sizeof(st):
++            self.check_sizeof(st, basesize + nodesize +
++                                  sizeofchildren(st.totuple()))
++
++        check_st_sizeof(parser.expr('2 + 3'))
++        check_st_sizeof(parser.expr('2 + 3 + 4'))
++        check_st_sizeof(parser.suite('x = 2 + 3'))
++        check_st_sizeof(parser.suite(''))
++        check_st_sizeof(parser.suite('# -*- coding: utf-8 -*-'))
++        check_st_sizeof(parser.expr('[' + '2,' * 1000 + ']'))
++
++
++    # XXX tests for pickling and unpickling of ST objects should go here
++
+ def test_main():
+-    test_support.run_unittest(
++    support.run_unittest(
+         RoundtripLegalSyntaxTestCase,
+         IllegalSyntaxTestCase,
+         CompileTestCase,
+         ParserStackLimitTestCase,
++        STObjectTestCase,
+     )
+ 
+ 
+diff -r 70274d53c1dd Lib/test/test_pdb.py
+--- a/Lib/test/test_pdb.py
++++ b/Lib/test/test_pdb.py
+@@ -6,12 +6,69 @@
+ import os
+ import unittest
+ import subprocess
++import textwrap
+ 
+ from test import test_support
+ # This little helper class is essential for testing pdb under doctest.
+ from test_doctest import _FakeInput
+ 
+ 
++class PdbTestCase(unittest.TestCase):
++
++    def run_pdb(self, script, commands):
++        """Run 'script' lines with pdb and the pdb 'commands'."""
++        filename = 'main.py'
++        with open(filename, 'w') as f:
++            f.write(textwrap.dedent(script))
++        self.addCleanup(test_support.unlink, filename)
++        cmd = [sys.executable, '-m', 'pdb', filename]
++        stdout = stderr = None
++        proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
++                                   stdin=subprocess.PIPE,
++                                   stderr=subprocess.STDOUT,
++                                   )
++        stdout, stderr = proc.communicate(commands)
++        proc.stdout.close()
++        proc.stdin.close()
++        return stdout, stderr
++
++    def test_issue13183(self):
++        script = """
++            from bar import bar
++
++            def foo():
++                bar()
++
++            def nope():
++                pass
++
++            def foobar():
++                foo()
++                nope()
++
++            foobar()
++        """
++        commands = """
++            from bar import bar
++            break bar
++            continue
++            step
++            step
++            quit
++        """
++        bar = """
++            def bar():
++                pass
++        """
++        with open('bar.py', 'w') as f:
++            f.write(textwrap.dedent(bar))
++        self.addCleanup(test_support.unlink, 'bar.py')
++        stdout, stderr = self.run_pdb(script, commands)
++        self.assertTrue(
++            any('main.py(5)foo()->None' in l for l in stdout.splitlines()),
++            'Fail to step into the caller after a return')
++
++
+ class PdbTestInput(object):
+     """Context manager that makes testing Pdb in doctests easier."""
+ 
+@@ -309,7 +366,9 @@
+ def test_main():
+     from test import test_pdb
+     test_support.run_doctest(test_pdb, verbosity=True)
+-    test_support.run_unittest(ModuleInitTester)
++    test_support.run_unittest(
++        PdbTestCase,
++        ModuleInitTester)
+ 
+ if __name__ == '__main__':
+     test_main()
+diff -r 70274d53c1dd Lib/test/test_posix.py
+--- a/Lib/test/test_posix.py
++++ b/Lib/test/test_posix.py
+@@ -9,6 +9,7 @@
+ import sys
+ import time
+ import os
++import platform
+ import pwd
+ import shutil
+ import stat
+@@ -107,7 +108,11 @@
+         # If a non-privileged user invokes it, it should fail with OSError
+         # EPERM.
+         if os.getuid() != 0:
+-            name = pwd.getpwuid(posix.getuid()).pw_name
++            try:
++                name = pwd.getpwuid(posix.getuid()).pw_name
++            except KeyError:
++                # the current UID may not have a pwd entry
++                raise unittest.SkipTest("need a pwd entry")
+             try:
+                 posix.initgroups(name, 13)
+             except OSError as e:
+@@ -219,6 +224,9 @@
+ 
+     def _test_all_chown_common(self, chown_func, first_param):
+         """Common code for chown, fchown and lchown tests."""
++        # test a successful chown call
++        chown_func(first_param, os.getuid(), os.getgid())
++
+         if os.getuid() == 0:
+             try:
+                 # Many linux distros have a nfsnobody user as MAX_UID-2
+@@ -230,14 +238,16 @@
+                 chown_func(first_param, ent.pw_uid, ent.pw_gid)
+             except KeyError:
+                 pass
++        elif platform.system() in ('HP-UX', 'SunOS'):
++            # HP-UX and Solaris can allow a non-root user to chown() to root
++            # (issue #5113)
++            raise unittest.SkipTest("Skipping because of non-standard chown() "
++                                    "behavior")
+         else:
+             # non-root cannot chown to root, raises OSError
+             self.assertRaises(OSError, chown_func,
+                               first_param, 0, 0)
+ 
+-        # test a successful chown call
+-        chown_func(first_param, os.getuid(), os.getgid())
+-
+     @unittest.skipUnless(hasattr(posix, 'chown'), "test needs os.chown()")
+     def test_chown(self):
+         # raise an OSError if the file does not exist
+@@ -412,8 +422,9 @@
+     def test_getgroups(self):
+         with os.popen('id -G') as idg:
+             groups = idg.read().strip()
++            ret = idg.close()
+ 
+-        if not groups:
++        if ret != None or not groups:
+             raise unittest.SkipTest("need working 'id -G'")
+ 
+         # 'id -G' and 'os.getgroups()' should return the same
+diff -r 70274d53c1dd Lib/test/test_posixpath.py
+--- a/Lib/test/test_posixpath.py
++++ b/Lib/test/test_posixpath.py
+@@ -201,6 +201,7 @@
+             with test_support.EnvironmentVarGuard() as env:
+                 env['HOME'] = '/'
+                 self.assertEqual(posixpath.expanduser("~"), "/")
++                self.assertEqual(posixpath.expanduser("~/foo"), "/foo")
+ 
+     def test_normpath(self):
+         self.assertEqual(posixpath.normpath(""), ".")
+diff -r 70274d53c1dd Lib/test/test_pyclbr.py
+--- a/Lib/test/test_pyclbr.py
++++ b/Lib/test/test_pyclbr.py
+@@ -188,6 +188,11 @@
+         cm('email.parser')
+         cm('test.test_pyclbr')
+ 
++    def test_issue_14798(self):
++        # test ImportError is raised when the first part of a dotted name is
++        # not a package
++        self.assertRaises(ImportError, pyclbr.readmodule_ex, 'asyncore.foo')
++
+ 
+ def test_main():
+     run_unittest(PyclbrTest)
+diff -r 70274d53c1dd Lib/test/test_pydoc.py
+--- a/Lib/test/test_pydoc.py
++++ b/Lib/test/test_pydoc.py
+@@ -249,6 +249,17 @@
+         result, doc_loc = get_pydoc_text(xml.etree)
+         self.assertEqual(doc_loc, "", "MODULE DOCS incorrectly includes a link")
+ 
++    def test_non_str_name(self):
++        # issue14638
++        # Treat illegal (non-str) name like no name
++        class A:
++            __name__ = 42
++        class B:
++            pass
++        adoc = pydoc.render_doc(A())
++        bdoc = pydoc.render_doc(B())
++        self.assertEqual(adoc.replace("A", "B"), bdoc)
++
+     def test_not_here(self):
+         missing_module = "test.i_am_not_here"
+         result = run_pydoc(missing_module)
+diff -r 70274d53c1dd Lib/test/test_queue.py
+--- a/Lib/test/test_queue.py
++++ b/Lib/test/test_queue.py
+@@ -79,7 +79,7 @@
+                 self.fail("trigger thread ended but event never set")
+ 
+ 
+-class BaseQueueTest(unittest.TestCase, BlockingTestMixin):
++class BaseQueueTest(BlockingTestMixin):
+     def setUp(self):
+         self.cum = 0
+         self.cumlock = threading.Lock()
+@@ -191,13 +191,13 @@
+         self.simple_queue_test(q)
+ 
+ 
+-class QueueTest(BaseQueueTest):
++class QueueTest(BaseQueueTest, unittest.TestCase):
+     type2test = Queue.Queue
+ 
+-class LifoQueueTest(BaseQueueTest):
++class LifoQueueTest(BaseQueueTest, unittest.TestCase):
+     type2test = Queue.LifoQueue
+ 
+-class PriorityQueueTest(BaseQueueTest):
++class PriorityQueueTest(BaseQueueTest, unittest.TestCase):
+     type2test = Queue.PriorityQueue
+ 
+ 
+diff -r 70274d53c1dd Lib/test/test_random.py
+--- a/Lib/test/test_random.py
++++ b/Lib/test/test_random.py
+@@ -57,6 +57,14 @@
+             self.assertRaises(TypeError, self.gen.jumpahead)  # needs an arg
+             self.assertRaises(TypeError, self.gen.jumpahead, 2, 3)  # too many
+ 
++    def test_jumpahead_produces_valid_state(self):
++        # From http://bugs.python.org/issue14591.
++        self.gen.seed(199210368)
++        self.gen.jumpahead(13550674232554645900)
++        for i in range(500):
++            val = self.gen.random()
++            self.assertLess(val, 1.0)
++
+     def test_sample(self):
+         # For the entire allowable range of 0 <= k <= N, validate that
+         # the sample is of the correct length and contains only unique items
+diff -r 70274d53c1dd Lib/test/test_re.py
+--- a/Lib/test/test_re.py
++++ b/Lib/test/test_re.py
+@@ -373,6 +373,32 @@
+         self.assertEqual(re.search(r"\d\D\w\W\s\S",
+                                    "1aa! a", re.UNICODE).group(0), "1aa! a")
+ 
++    def test_string_boundaries(self):
++        # See http://bugs.python.org/issue10713
++        self.assertEqual(re.search(r"\b(abc)\b", "abc").group(1),
++                         "abc")
++        # There's a word boundary at the start of a string.
++        self.assertTrue(re.match(r"\b", "abc"))
++        # A non-empty string includes a non-boundary zero-length match.
++        self.assertTrue(re.search(r"\B", "abc"))
++        # There is no non-boundary match at the start of a string.
++        self.assertFalse(re.match(r"\B", "abc"))
++        # However, an empty string contains no word boundaries, and also no
++        # non-boundaries.
++        self.assertEqual(re.search(r"\B", ""), None)
++        # This one is questionable and different from the perlre behaviour,
++        # but describes current behavior.
++        self.assertEqual(re.search(r"\b", ""), None)
++        # A single word-character string has two boundaries, but no
++        # non-boundary gaps.
++        self.assertEqual(len(re.findall(r"\b", "a")), 2)
++        self.assertEqual(len(re.findall(r"\B", "a")), 0)
++        # If there are no words, there are no boundaries
++        self.assertEqual(len(re.findall(r"\b", " ")), 0)
++        self.assertEqual(len(re.findall(r"\b", "   ")), 0)
++        # Can match around the whitespace.
++        self.assertEqual(len(re.findall(r"\B", " ")), 2)
++
+     def test_bigcharset(self):
+         self.assertEqual(re.match(u"([\u2222\u2223])",
+                                   u"\u2222").group(1), u"\u2222")
+@@ -757,6 +783,16 @@
+         self.assertRaises(TypeError, re.finditer, "a", {})
+         self.assertRaises(OverflowError, _sre.compile, "abc", 0, [long_overflow])
+ 
++    def test_compile(self):
++        # Test return value when given string and pattern as parameter
++        pattern = re.compile('random pattern')
++        self.assertIsInstance(pattern, re._pattern_type)
++        same_pattern = re.compile(pattern)
++        self.assertIsInstance(same_pattern, re._pattern_type)
++        self.assertIs(same_pattern, pattern)
++        # Test behaviour when not given a string or pattern as parameter
++        self.assertRaises(TypeError, re.compile, 0)
++
+ def run_re_tests():
+     from test.re_tests import tests, SUCCEED, FAIL, SYNTAX_ERROR
+     if verbose:
+diff -r 70274d53c1dd Lib/test/test_readline.py
+--- a/Lib/test/test_readline.py
++++ b/Lib/test/test_readline.py
+@@ -12,6 +12,10 @@
+ readline = import_module('readline')
+ 
+ class TestHistoryManipulation (unittest.TestCase):
++
++    @unittest.skipIf(not hasattr(readline, 'clear_history'),
++                     "The history update test cannot be run because the "
++                     "clear_history method is not available.")
+     def testHistoryUpdates(self):
+         readline.clear_history()
+ 
+diff -r 70274d53c1dd Lib/test/test_repr.py
+--- a/Lib/test/test_repr.py
++++ b/Lib/test/test_repr.py
+@@ -130,10 +130,10 @@
+     def test_file(self):
+         fp = open(unittest.__file__)
+         self.assertTrue(repr(fp).startswith(
+-            "<open file '%s', mode 'r' at 0x" % unittest.__file__))
++            "<open file %r, mode 'r' at 0x" % unittest.__file__))
+         fp.close()
+         self.assertTrue(repr(fp).startswith(
+-            "<closed file '%s', mode 'r' at 0x" % unittest.__file__))
++            "<closed file %r, mode 'r' at 0x" % unittest.__file__))
+ 
+     def test_lambda(self):
+         self.assertTrue(repr(lambda x: x).startswith(
+diff -r 70274d53c1dd Lib/test/test_shutil.py
+--- a/Lib/test/test_shutil.py
++++ b/Lib/test/test_shutil.py
+@@ -7,6 +7,7 @@
+ import stat
+ import os
+ import os.path
++import errno
+ from os.path import splitdrive
+ from distutils.spawn import find_executable, spawn
+ from shutil import (_make_tarball, _make_zipfile, make_archive,
+@@ -339,6 +340,35 @@
+                 shutil.rmtree(TESTFN, ignore_errors=True)
+                 shutil.rmtree(TESTFN2, ignore_errors=True)
+ 
++    @unittest.skipUnless(hasattr(os, 'chflags') and
++                         hasattr(errno, 'EOPNOTSUPP') and
++                         hasattr(errno, 'ENOTSUP'),
++                         "requires os.chflags, EOPNOTSUPP & ENOTSUP")
++    def test_copystat_handles_harmless_chflags_errors(self):
++        tmpdir = self.mkdtemp()
++        file1 = os.path.join(tmpdir, 'file1')
++        file2 = os.path.join(tmpdir, 'file2')
++        self.write_file(file1, 'xxx')
++        self.write_file(file2, 'xxx')
++
++        def make_chflags_raiser(err):
++            ex = OSError()
++
++            def _chflags_raiser(path, flags):
++                ex.errno = err
++                raise ex
++            return _chflags_raiser
++        old_chflags = os.chflags
++        try:
++            for err in errno.EOPNOTSUPP, errno.ENOTSUP:
++                os.chflags = make_chflags_raiser(err)
++                shutil.copystat(file1, file2)
++            # assert others errors break it
++            os.chflags = make_chflags_raiser(errno.EOPNOTSUPP + errno.ENOTSUP)
++            self.assertRaises(OSError, shutil.copystat, file1, file2)
++        finally:
++            os.chflags = old_chflags
++
+     @unittest.skipUnless(zlib, "requires zlib")
+     def test_make_tarball(self):
+         # creating something to tar
+diff -r 70274d53c1dd Lib/test/test_socketserver.py
+--- a/Lib/test/test_socketserver.py
++++ b/Lib/test/test_socketserver.py
+@@ -8,6 +8,8 @@
+ import select
+ import signal
+ import socket
++import select
++import errno
+ import tempfile
+ import unittest
+ import SocketServer
+@@ -32,8 +34,11 @@
+     if hasattr(signal, 'alarm'):
+         signal.alarm(n)
+ 
++# Remember real select() to avoid interferences with mocking
++_real_select = select.select
++
+ def receive(sock, n, timeout=20):
+-    r, w, x = select.select([sock], [], [], timeout)
++    r, w, x = _real_select([sock], [], [], timeout)
+     if sock in r:
+         return sock.recv(n)
+     else:
+@@ -225,6 +230,38 @@
+                                 SocketServer.DatagramRequestHandler,
+                                 self.dgram_examine)
+ 
++    @contextlib.contextmanager
++    def mocked_select_module(self):
++        """Mocks the select.select() call to raise EINTR for first call"""
++        old_select = select.select
++
++        class MockSelect:
++            def __init__(self):
++                self.called = 0
++
++            def __call__(self, *args):
++                self.called += 1
++                if self.called == 1:
++                    # raise the exception on first call
++                    raise select.error(errno.EINTR, os.strerror(errno.EINTR))
++                else:
++                    # Return real select value for consecutive calls
++                    return old_select(*args)
++
++        select.select = MockSelect()
++        try:
++            yield select.select
++        finally:
++            select.select = old_select
++
++    def test_InterruptServerSelectCall(self):
++        with self.mocked_select_module() as mock_select:
++            pid = self.run_server(SocketServer.TCPServer,
++                                  SocketServer.StreamRequestHandler,
++                                  self.stream_examine)
++            # Make sure select was called again:
++            self.assertGreater(mock_select.called, 1)
++
+     # Alas, on Linux (at least) recvfrom() doesn't return a meaningful
+     # client address so this cannot work:
+ 
+diff -r 70274d53c1dd Lib/test/test_ssl.py
+--- a/Lib/test/test_ssl.py
++++ b/Lib/test/test_ssl.py
+@@ -355,7 +355,8 @@
+         # SHA256 was added in OpenSSL 0.9.8
+         if ssl.OPENSSL_VERSION_INFO < (0, 9, 8, 0, 15):
+             self.skipTest("SHA256 not available on %r" % ssl.OPENSSL_VERSION)
+-        # NOTE: https://sha256.tbs-internet.com is another possible test host
++        self.skipTest("remote host needs SNI, only available on Python 3.2+")
++        # NOTE: https://sha2.hboeck.de is another possible test host
+         remote = ("sha256.tbs-internet.com", 443)
+         sha256_cert = os.path.join(os.path.dirname(__file__), "sha256.pem")
+         with test_support.transient_internet("sha256.tbs-internet.com"):
+diff -r 70274d53c1dd Lib/test/test_strptime.py
+--- a/Lib/test/test_strptime.py
++++ b/Lib/test/test_strptime.py
+@@ -38,9 +38,9 @@
+         comparison = testing[self.time_tuple[tuple_position]]
+         self.assertIn(strftime_output, testing,
+                       "%s: not found in tuple" % error_msg)
+-        self.assertTrue(comparison == strftime_output,
+-                        "%s: position within tuple incorrect; %s != %s" %
+-                        (error_msg, comparison, strftime_output))
++        self.assertEqual(comparison, strftime_output,
++                         "%s: position within tuple incorrect; %s != %s" %
++                         (error_msg, comparison, strftime_output))
+ 
+     def test_weekday(self):
+         # Make sure that full and abbreviated weekday names are correct in
+@@ -65,8 +65,8 @@
+                       "AM/PM representation not in tuple")
+         if self.time_tuple[3] < 12: position = 0
+         else: position = 1
+-        self.assertTrue(strftime_output == self.LT_ins.am_pm[position],
+-                        "AM/PM representation in the wrong position within the tuple")
++        self.assertEqual(self.LT_ins.am_pm[position], strftime_output,
++                         "AM/PM representation in the wrong position within the tuple")
+ 
+     def test_timezone(self):
+         # Make sure timezone is correct
+@@ -86,17 +86,14 @@
+         #  output.
+         magic_date = (1999, 3, 17, 22, 44, 55, 2, 76, 0)
+         strftime_output = time.strftime("%c", magic_date)
+-        self.assertTrue(strftime_output == time.strftime(self.LT_ins.LC_date_time,
+-                                                         magic_date),
+-                        "LC_date_time incorrect")
++        self.assertEqual(time.strftime(self.LT_ins.LC_date_time, magic_date),
++                         strftime_output, "LC_date_time incorrect")
+         strftime_output = time.strftime("%x", magic_date)
+-        self.assertTrue(strftime_output == time.strftime(self.LT_ins.LC_date,
+-                                                         magic_date),
+-                        "LC_date incorrect")
++        self.assertEqual(time.strftime(self.LT_ins.LC_date, magic_date),
++                         strftime_output, "LC_date incorrect")
+         strftime_output = time.strftime("%X", magic_date)
+-        self.assertTrue(strftime_output == time.strftime(self.LT_ins.LC_time,
+-                                                         magic_date),
+-                        "LC_time incorrect")
++        self.assertEqual(time.strftime(self.LT_ins.LC_time, magic_date),
++                         strftime_output, "LC_time incorrect")
+         LT = _strptime.LocaleTime()
+         LT.am_pm = ('', '')
+         self.assertTrue(LT.LC_time, "LocaleTime's LC directives cannot handle "
+@@ -168,8 +165,8 @@
+         # Fixes bug #661354
+         test_locale = _strptime.LocaleTime()
+         test_locale.timezone = (frozenset(), frozenset())
+-        self.assertTrue(_strptime.TimeRE(test_locale).pattern("%Z") == '',
+-                        "with timezone == ('',''), TimeRE().pattern('%Z') != ''")
++        self.assertEqual(_strptime.TimeRE(test_locale).pattern("%Z"), '',
++                         "with timezone == ('',''), TimeRE().pattern('%Z') != ''")
+ 
+     def test_matching_with_escapes(self):
+         # Make sure a format that requires escaping of characters works
+@@ -195,7 +192,7 @@
+         # so as to not allow to subpatterns to end up next to each other and
+         # "steal" characters from each other.
+         pattern = self.time_re.pattern('%j %H')
+-        self.assertTrue(not re.match(pattern, "180"))
++        self.assertFalse(re.match(pattern, "180"))
+         self.assertTrue(re.match(pattern, "18 0"))
+ 
+ 
+@@ -381,6 +378,14 @@
+         need_escaping = ".^$*+?{}\[]|)("
+         self.assertTrue(_strptime._strptime_time(need_escaping, need_escaping))
+ 
++    def test_feb29_on_leap_year_without_year(self):
++        time.strptime("Feb 29", "%b %d")
++
++    def test_mar1_comes_after_feb29_even_when_omitting_the_year(self):
++        self.assertLess(
++                time.strptime("Feb 29", "%b %d"),
++                time.strptime("Mar 1", "%b %d"))
++
+ class Strptime12AMPMTests(unittest.TestCase):
+     """Test a _strptime regression in '%I %p' at 12 noon (12 PM)"""
+ 
+diff -r 70274d53c1dd Lib/test/test_struct.py
+--- a/Lib/test/test_struct.py
++++ b/Lib/test/test_struct.py
+@@ -3,7 +3,8 @@
+ import unittest
+ import struct
+ import inspect
+-from test.test_support import run_unittest, check_warnings, check_py3k_warnings
++from test import test_support as support
++from test.test_support import (check_warnings, check_py3k_warnings)
+ 
+ import sys
+ ISBIGENDIAN = sys.byteorder == "big"
+@@ -544,8 +545,29 @@
+         hugecount2 = '{}b{}H'.format(sys.maxsize//2, sys.maxsize//2)
+         self.assertRaises(struct.error, struct.calcsize, hugecount2)
+ 
++    def check_sizeof(self, format_str, number_of_codes):
++        # The size of 'PyStructObject'
++        totalsize = support.calcobjsize('5P')
++        # The size taken up by the 'formatcode' dynamic array
++        totalsize += struct.calcsize('3P') * (number_of_codes + 1)
++        support.check_sizeof(self, struct.Struct(format_str), totalsize)
++
++    @support.cpython_only
++    def test__sizeof__(self):
++        for code in integer_codes:
++            self.check_sizeof(code, 1)
++        self.check_sizeof('BHILfdspP', 9)
++        self.check_sizeof('B' * 1234, 1234)
++        self.check_sizeof('fd', 2)
++        self.check_sizeof('xxxxxxxxxxxxxx', 0)
++        self.check_sizeof('100H', 100)
++        self.check_sizeof('187s', 1)
++        self.check_sizeof('20p', 1)
++        self.check_sizeof('0s', 1)
++        self.check_sizeof('0c', 0)
++
+ def test_main():
+-    run_unittest(StructTest)
++    support.run_unittest(StructTest)
+ 
+ if __name__ == '__main__':
+     test_main()
+diff -r 70274d53c1dd Lib/test/test_subprocess.py
+--- a/Lib/test/test_subprocess.py
++++ b/Lib/test/test_subprocess.py
+@@ -812,6 +812,27 @@
+         getattr(p, method)(*args)
+         return p
+ 
++    def _kill_dead_process(self, method, *args):
++        # Do not inherit file handles from the parent.
++        # It should fix failures on some platforms.
++        p = subprocess.Popen([sys.executable, "-c", """if 1:
++                             import sys, time
++                             sys.stdout.write('x\\n')
++                             sys.stdout.flush()
++                             """],
++                             close_fds=True,
++                             stdin=subprocess.PIPE,
++                             stdout=subprocess.PIPE,
++                             stderr=subprocess.PIPE)
++        # Wait for the interpreter to be completely initialized before
++        # sending any signal.
++        p.stdout.read(1)
++        # The process should end after this
++        time.sleep(1)
++        # This shouldn't raise even though the child is now dead
++        getattr(p, method)(*args)
++        p.communicate()
++
+     def test_send_signal(self):
+         p = self._kill_process('send_signal', signal.SIGINT)
+         _, stderr = p.communicate()
+@@ -830,6 +851,18 @@
+         self.assertStderrEqual(stderr, '')
+         self.assertEqual(p.wait(), -signal.SIGTERM)
+ 
++    def test_send_signal_dead(self):
++        # Sending a signal to a dead process
++        self._kill_dead_process('send_signal', signal.SIGINT)
++
++    def test_kill_dead(self):
++        # Killing a dead process
++        self._kill_dead_process('kill')
++
++    def test_terminate_dead(self):
++        # Terminating a dead process
++        self._kill_dead_process('terminate')
++
+     def check_close_std_fds(self, fds):
+         # Issue #9905: test that subprocess pipes still work properly with
+         # some standard fds closed
+@@ -1126,6 +1159,31 @@
+         returncode = p.wait()
+         self.assertNotEqual(returncode, 0)
+ 
++    def _kill_dead_process(self, method, *args):
++        p = subprocess.Popen([sys.executable, "-c", """if 1:
++                             import sys, time
++                             sys.stdout.write('x\\n')
++                             sys.stdout.flush()
++                             sys.exit(42)
++                             """],
++                             stdin=subprocess.PIPE,
++                             stdout=subprocess.PIPE,
++                             stderr=subprocess.PIPE)
++        self.addCleanup(p.stdout.close)
++        self.addCleanup(p.stderr.close)
++        self.addCleanup(p.stdin.close)
++        # Wait for the interpreter to be completely initialized before
++        # sending any signal.
++        p.stdout.read(1)
++        # The process should end after this
++        time.sleep(1)
++        # This shouldn't raise even though the child is now dead
++        getattr(p, method)(*args)
++        _, stderr = p.communicate()
++        self.assertStderrEqual(stderr, b'')
++        rc = p.wait()
++        self.assertEqual(rc, 42)
++
+     def test_send_signal(self):
+         self._kill_process('send_signal', signal.SIGTERM)
+ 
+@@ -1135,6 +1193,15 @@
+     def test_terminate(self):
+         self._kill_process('terminate')
+ 
++    def test_send_signal_dead(self):
++        self._kill_dead_process('send_signal', signal.SIGTERM)
++
++    def test_kill_dead(self):
++        self._kill_dead_process('kill')
++
++    def test_terminate_dead(self):
++        self._kill_dead_process('terminate')
++
+ 
+ @unittest.skipUnless(getattr(subprocess, '_has_poll', False),
+                      "poll system call not supported")
+diff -r 70274d53c1dd Lib/test/test_support.py
+--- a/Lib/test/test_support.py
++++ b/Lib/test/test_support.py
+@@ -18,6 +18,8 @@
+ import UserDict
+ import re
+ import time
++import struct
++import _testcapi
+ try:
+     import thread
+ except ImportError:
+@@ -179,15 +181,79 @@
+     except KeyError:
+         pass
+ 
++if sys.platform.startswith("win"):
++    def _waitfor(func, pathname, waitall=False):
++        # Peform the operation
++        func(pathname)
++        # Now setup the wait loop
++        if waitall:
++            dirname = pathname
++        else:
++            dirname, name = os.path.split(pathname)
++            dirname = dirname or '.'
++        # Check for `pathname` to be removed from the filesystem.
++        # The exponential backoff of the timeout amounts to a total
++        # of ~1 second after which the deletion is probably an error
++        # anyway.
++        # Testing on a i7@4.3GHz shows that usually only 1 iteration is
++        # required when contention occurs.
++        timeout = 0.001
++        while timeout < 1.0:
++            # Note we are only testing for the existance of the file(s) in
++            # the contents of the directory regardless of any security or
++            # access rights.  If we have made it this far, we have sufficient
++            # permissions to do that much using Python's equivalent of the
++            # Windows API FindFirstFile.
++            # Other Windows APIs can fail or give incorrect results when
++            # dealing with files that are pending deletion.
++            L = os.listdir(dirname)
++            if not (L if waitall else name in L):
++                return
++            # Increase the timeout and try again
++            time.sleep(timeout)
++            timeout *= 2
++        warnings.warn('tests may fail, delete still pending for ' + pathname,
++                      RuntimeWarning, stacklevel=4)
++
++    def _unlink(filename):
++        _waitfor(os.unlink, filename)
++
++    def _rmdir(dirname):
++        _waitfor(os.rmdir, dirname)
++
++    def _rmtree(path):
++        def _rmtree_inner(path):
++            for name in os.listdir(path):
++                fullname = os.path.join(path, name)
++                if os.path.isdir(fullname):
++                    _waitfor(_rmtree_inner, fullname, waitall=True)
++                    os.rmdir(fullname)
++                else:
++                    os.unlink(fullname)
++        _waitfor(_rmtree_inner, path, waitall=True)
++        _waitfor(os.rmdir, path)
++else:
++    _unlink = os.unlink
++    _rmdir = os.rmdir
++    _rmtree = shutil.rmtree
++
+ def unlink(filename):
+     try:
+-        os.unlink(filename)
++        _unlink(filename)
+     except OSError:
+         pass
+ 
++def rmdir(dirname):
++    try:
++        _rmdir(dirname)
++    except OSError as error:
++        # The directory need not exist.
++        if error.errno != errno.ENOENT:
++            raise
++
+ def rmtree(path):
+     try:
+-        shutil.rmtree(path)
++        _rmtree(path)
+     except OSError, e:
+         # Unix returns ENOENT, Windows returns ESRCH.
+         if e.errno not in (errno.ENOENT, errno.ESRCH):
+@@ -405,7 +471,7 @@
+     the CWD, an error is raised.  If it's True, only a warning is raised
+     and the original CWD is used.
+     """
+-    if isinstance(name, unicode):
++    if have_unicode and isinstance(name, unicode):
+         try:
+             name = name.encode(sys.getfilesystemencoding() or 'ascii')
+         except UnicodeEncodeError:
+@@ -767,6 +833,9 @@
+         ('EAI_FAIL', -4),
+         ('EAI_NONAME', -2),
+         ('EAI_NODATA', -5),
++        # Windows defines EAI_NODATA as 11001 but idiotic getaddrinfo()
++        # implementation actually returns WSANO_DATA i.e. 11004.
++        ('WSANO_DATA', 11004),
+     ]
+ 
+     denied = ResourceDenied("Resource '%s' is not available" % resource_name)
+@@ -858,6 +927,32 @@
+     gc.collect()
+ 
+ 
++_header = '2P'
++if hasattr(sys, "gettotalrefcount"):
++    _header = '2P' + _header
++_vheader = _header + 'P'
++
++def calcobjsize(fmt):
++    return struct.calcsize(_header + fmt + '0P')
++
++def calcvobjsize(fmt):
++    return struct.calcsize(_vheader + fmt + '0P')
++
++
++_TPFLAGS_HAVE_GC = 1<<14
++_TPFLAGS_HEAPTYPE = 1<<9
++
++def check_sizeof(test, o, size):
++    result = sys.getsizeof(o)
++    # add GC header size
++    if ((type(o) == type) and (o.__flags__ & _TPFLAGS_HEAPTYPE) or\
++        ((type(o) != type) and (type(o).__flags__ & _TPFLAGS_HAVE_GC))):
++        size += _testcapi.SIZEOF_PYGC_HEAD
++    msg = 'wrong size for %s: got %d, expected %d' \
++            % (type(o), result, size)
++    test.assertEqual(result, size, msg)
++
++
+ #=======================================================================
+ # Decorator for running a function in a different locale, correctly resetting
+ # it afterwards.
+diff -r 70274d53c1dd Lib/test/test_sys.py
+--- a/Lib/test/test_sys.py
++++ b/Lib/test/test_sys.py
+@@ -490,22 +490,8 @@
+ 
+ class SizeofTest(unittest.TestCase):
+ 
+-    TPFLAGS_HAVE_GC = 1<<14
+-    TPFLAGS_HEAPTYPE = 1L<<9
+-
+     def setUp(self):
+-        self.c = len(struct.pack('c', ' '))
+-        self.H = len(struct.pack('H', 0))
+-        self.i = len(struct.pack('i', 0))
+-        self.l = len(struct.pack('l', 0))
+-        self.P = len(struct.pack('P', 0))
+-        # due to missing size_t information from struct, it is assumed that
+-        # sizeof(Py_ssize_t) = sizeof(void*)
+-        self.header = 'PP'
+-        self.vheader = self.header + 'P'
+-        if hasattr(sys, "gettotalrefcount"):
+-            self.header += '2P'
+-            self.vheader += '2P'
++        self.P = struct.calcsize('P')
+         self.longdigit = sys.long_info.sizeof_digit
+         import _testcapi
+         self.gc_headsize = _testcapi.SIZEOF_PYGC_HEAD
+@@ -515,128 +501,109 @@
+         self.file.close()
+         test.test_support.unlink(test.test_support.TESTFN)
+ 
+-    def check_sizeof(self, o, size):
+-        result = sys.getsizeof(o)
+-        if ((type(o) == type) and (o.__flags__ & self.TPFLAGS_HEAPTYPE) or\
+-           ((type(o) != type) and (type(o).__flags__ & self.TPFLAGS_HAVE_GC))):
+-            size += self.gc_headsize
+-        msg = 'wrong size for %s: got %d, expected %d' \
+-                % (type(o), result, size)
+-        self.assertEqual(result, size, msg)
+-
+-    def calcsize(self, fmt):
+-        """Wrapper around struct.calcsize which enforces the alignment of the
+-        end of a structure to the alignment requirement of pointer.
+-
+-        Note: This wrapper should only be used if a pointer member is included
+-        and no member with a size larger than a pointer exists.
+-        """
+-        return struct.calcsize(fmt + '0P')
++    check_sizeof = test.test_support.check_sizeof
+ 
+     def test_gc_head_size(self):
+         # Check that the gc header size is added to objects tracked by the gc.
+-        h = self.header
+-        size = self.calcsize
++        size = test.test_support.calcobjsize
+         gc_header_size = self.gc_headsize
+         # bool objects are not gc tracked
+-        self.assertEqual(sys.getsizeof(True), size(h + 'l'))
++        self.assertEqual(sys.getsizeof(True), size('l'))
+         # but lists are
+-        self.assertEqual(sys.getsizeof([]), size(h + 'P PP') + gc_header_size)
++        self.assertEqual(sys.getsizeof([]), size('P PP') + gc_header_size)
+ 
+     def test_default(self):
+-        h = self.header
+-        size = self.calcsize
+-        self.assertEqual(sys.getsizeof(True, -1), size(h + 'l'))
++        size = test.test_support.calcobjsize
++        self.assertEqual(sys.getsizeof(True, -1), size('l'))
+ 
+     def test_objecttypes(self):
+         # check all types defined in Objects/
+-        h = self.header
+-        vh = self.vheader
+-        size = self.calcsize
++        size = test.test_support.calcobjsize
++        vsize = test.test_support.calcvobjsize
+         check = self.check_sizeof
+         # bool
+-        check(True, size(h + 'l'))
++        check(True, size('l'))
+         # buffer
+         with test.test_support.check_py3k_warnings():
+-            check(buffer(''), size(h + '2P2Pil'))
++            check(buffer(''), size('2P2Pil'))
+         # builtin_function_or_method
+-        check(len, size(h + '3P'))
++        check(len, size('3P'))
+         # bytearray
+         samples = ['', 'u'*100000]
+         for sample in samples:
+             x = bytearray(sample)
+-            check(x, size(vh + 'iPP') + x.__alloc__() * self.c)
++            check(x, vsize('iPP') + x.__alloc__())
+         # bytearray_iterator
+-        check(iter(bytearray()), size(h + 'PP'))
++        check(iter(bytearray()), size('PP'))
+         # cell
+         def get_cell():
+             x = 42
+             def inner():
+                 return x
+             return inner
+-        check(get_cell().func_closure[0], size(h + 'P'))
++        check(get_cell().func_closure[0], size('P'))
+         # classobj (old-style class)
+         class class_oldstyle():
+             def method():
+                 pass
+-        check(class_oldstyle, size(h + '7P'))
++        check(class_oldstyle, size('7P'))
+         # instance (old-style class)
+-        check(class_oldstyle(), size(h + '3P'))
++        check(class_oldstyle(), size('3P'))
+         # instancemethod (old-style class)
+-        check(class_oldstyle().method, size(h + '4P'))
++        check(class_oldstyle().method, size('4P'))
+         # complex
+-        check(complex(0,1), size(h + '2d'))
++        check(complex(0,1), size('2d'))
+         # code
+-        check(get_cell().func_code, size(h + '4i8Pi3P'))
++        check(get_cell().func_code, size('4i8Pi3P'))
+         # BaseException
+-        check(BaseException(), size(h + '3P'))
++        check(BaseException(), size('3P'))
+         # UnicodeEncodeError
+-        check(UnicodeEncodeError("", u"", 0, 0, ""), size(h + '5P2PP'))
++        check(UnicodeEncodeError("", u"", 0, 0, ""), size('5P2PP'))
+         # UnicodeDecodeError
+-        check(UnicodeDecodeError("", "", 0, 0, ""), size(h + '5P2PP'))
++        check(UnicodeDecodeError("", "", 0, 0, ""), size('5P2PP'))
+         # UnicodeTranslateError
+-        check(UnicodeTranslateError(u"", 0, 1, ""), size(h + '5P2PP'))
++        check(UnicodeTranslateError(u"", 0, 1, ""), size('5P2PP'))
+         # method_descriptor (descriptor object)
+-        check(str.lower, size(h + '2PP'))
++        check(str.lower, size('2PP'))
+         # classmethod_descriptor (descriptor object)
+         # XXX
+         # member_descriptor (descriptor object)
+         import datetime
+-        check(datetime.timedelta.days, size(h + '2PP'))
++        check(datetime.timedelta.days, size('2PP'))
+         # getset_descriptor (descriptor object)
+         import __builtin__
+-        check(__builtin__.file.closed, size(h + '2PP'))
++        check(__builtin__.file.closed, size('2PP'))
+         # wrapper_descriptor (descriptor object)
+-        check(int.__add__, size(h + '2P2P'))
++        check(int.__add__, size('2P2P'))
+         # dictproxy
+         class C(object): pass
+-        check(C.__dict__, size(h + 'P'))
++        check(C.__dict__, size('P'))
+         # method-wrapper (descriptor object)
+-        check({}.__iter__, size(h + '2P'))
++        check({}.__iter__, size('2P'))
+         # dict
+-        check({}, size(h + '3P2P' + 8*'P2P'))
++        check({}, size('3P2P' + 8*'P2P'))
+         x = {1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7, 8:8}
+-        check(x, size(h + '3P2P' + 8*'P2P') + 16*size('P2P'))
++        check(x, size('3P2P' + 8*'P2P') + 16*struct.calcsize('P2P'))
+         # dictionary-keyiterator
+-        check({}.iterkeys(), size(h + 'P2PPP'))
++        check({}.iterkeys(), size('P2PPP'))
+         # dictionary-valueiterator
+-        check({}.itervalues(), size(h + 'P2PPP'))
++        check({}.itervalues(), size('P2PPP'))
+         # dictionary-itemiterator
+-        check({}.iteritems(), size(h + 'P2PPP'))
++        check({}.iteritems(), size('P2PPP'))
+         # ellipses
+-        check(Ellipsis, size(h + ''))
++        check(Ellipsis, size(''))
+         # EncodingMap
+         import codecs, encodings.iso8859_3
+         x = codecs.charmap_build(encodings.iso8859_3.decoding_table)
+-        check(x, size(h + '32B2iB'))
++        check(x, size('32B2iB'))
+         # enumerate
+-        check(enumerate([]), size(h + 'l3P'))
++        check(enumerate([]), size('l3P'))
+         # file
+-        check(self.file, size(h + '4P2i4P3i3P3i'))
++        check(self.file, size('4P2i4P3i3P3i'))
+         # float
+-        check(float(0), size(h + 'd'))
++        check(float(0), size('d'))
+         # sys.floatinfo
+-        check(sys.float_info, size(vh) + self.P * len(sys.float_info))
++        check(sys.float_info, vsize('') + self.P * len(sys.float_info))
+         # frame
+         import inspect
+         CO_MAXBLOCKS = 20
+@@ -645,10 +612,10 @@
+         nfrees = len(x.f_code.co_freevars)
+         extras = x.f_code.co_stacksize + x.f_code.co_nlocals +\
+                  ncells + nfrees - 1
+-        check(x, size(vh + '12P3i' + CO_MAXBLOCKS*'3i' + 'P' + extras*'P'))
++        check(x, vsize('12P3i' + CO_MAXBLOCKS*'3i' + 'P' + extras*'P'))
+         # function
+         def func(): pass
+-        check(func, size(h + '9P'))
++        check(func, size('9P'))
+         class c():
+             @staticmethod
+             def foo():
+@@ -657,65 +624,65 @@
+             def bar(cls):
+                 pass
+             # staticmethod
+-            check(foo, size(h + 'P'))
++            check(foo, size('P'))
+             # classmethod
+-            check(bar, size(h + 'P'))
++            check(bar, size('P'))
+         # generator
+         def get_gen(): yield 1
+-        check(get_gen(), size(h + 'Pi2P'))
++        check(get_gen(), size('Pi2P'))
+         # integer
+-        check(1, size(h + 'l'))
+-        check(100, size(h + 'l'))
++        check(1, size('l'))
++        check(100, size('l'))
+         # iterator
+-        check(iter('abc'), size(h + 'lP'))
++        check(iter('abc'), size('lP'))
+         # callable-iterator
+         import re
+-        check(re.finditer('',''), size(h + '2P'))
++        check(re.finditer('',''), size('2P'))
+         # list
+         samples = [[], [1,2,3], ['1', '2', '3']]
+         for sample in samples:
+-            check(sample, size(vh + 'PP') + len(sample)*self.P)
++            check(sample, vsize('PP') + len(sample)*self.P)
+         # sortwrapper (list)
+         # XXX
+         # cmpwrapper (list)
+         # XXX
+         # listiterator (list)
+-        check(iter([]), size(h + 'lP'))
++        check(iter([]), size('lP'))
+         # listreverseiterator (list)
+-        check(reversed([]), size(h + 'lP'))
++        check(reversed([]), size('lP'))
+         # long
+-        check(0L, size(vh))
+-        check(1L, size(vh) + self.longdigit)
+-        check(-1L, size(vh) + self.longdigit)
++        check(0L, vsize(''))
++        check(1L, vsize('') + self.longdigit)
++        check(-1L, vsize('') + self.longdigit)
+         PyLong_BASE = 2**sys.long_info.bits_per_digit
+-        check(long(PyLong_BASE), size(vh) + 2*self.longdigit)
+-        check(long(PyLong_BASE**2-1), size(vh) + 2*self.longdigit)
+-        check(long(PyLong_BASE**2), size(vh) + 3*self.longdigit)
++        check(long(PyLong_BASE), vsize('') + 2*self.longdigit)
++        check(long(PyLong_BASE**2-1), vsize('') + 2*self.longdigit)
++        check(long(PyLong_BASE**2), vsize('') + 3*self.longdigit)
+         # module
+-        check(unittest, size(h + 'P'))
++        check(unittest, size('P'))
+         # None
+-        check(None, size(h + ''))
++        check(None, size(''))
+         # object
+-        check(object(), size(h + ''))
++        check(object(), size(''))
+         # property (descriptor object)
+         class C(object):
+             def getx(self): return self.__x
+             def setx(self, value): self.__x = value
+             def delx(self): del self.__x
+             x = property(getx, setx, delx, "")
+-            check(x, size(h + '4Pi'))
++            check(x, size('4Pi'))
+         # PyCObject
+         # PyCapsule
+         # XXX
+         # rangeiterator
+-        check(iter(xrange(1)), size(h + '4l'))
++        check(iter(xrange(1)), size('4l'))
+         # reverse
+-        check(reversed(''), size(h + 'PP'))
++        check(reversed(''), size('PP'))
+         # set
+         # frozenset
+         PySet_MINSIZE = 8
+         samples = [[], range(10), range(50)]
+-        s = size(h + '3P2P' + PySet_MINSIZE*'lP' + 'lP')
++        s = size('3P2P' + PySet_MINSIZE*'lP' + 'lP')
+         for sample in samples:
+             minused = len(sample)
+             if minused == 0: tmp = 1
+@@ -732,23 +699,24 @@
+                 check(set(sample), s + newsize*struct.calcsize('lP'))
+                 check(frozenset(sample), s + newsize*struct.calcsize('lP'))
+         # setiterator
+-        check(iter(set()), size(h + 'P3P'))
++        check(iter(set()), size('P3P'))
+         # slice
+-        check(slice(1), size(h + '3P'))
++        check(slice(1), size('3P'))
+         # str
+-        check('', struct.calcsize(vh + 'li') + 1)
+-        check('abc', struct.calcsize(vh + 'li') + 1 + 3*self.c)
++        vh = test.test_support._vheader
++        check('', struct.calcsize(vh + 'lic'))
++        check('abc', struct.calcsize(vh + 'lic') + 3)
+         # super
+-        check(super(int), size(h + '3P'))
++        check(super(int), size('3P'))
+         # tuple
+-        check((), size(vh))
+-        check((1,2,3), size(vh) + 3*self.P)
++        check((), vsize(''))
++        check((1,2,3), vsize('') + 3*self.P)
+         # tupleiterator
+-        check(iter(()), size(h + 'lP'))
++        check(iter(()), size('lP'))
+         # type
+         # (PyTypeObject + PyNumberMethods +  PyMappingMethods +
+         #  PySequenceMethods + PyBufferProcs)
+-        s = size(vh + 'P2P15Pl4PP9PP11PI') + size('41P 10P 3P 6P')
++        s = vsize('P2P15Pl4PP9PP11PI') + struct.calcsize('41P 10P 3P 6P')
+         class newstyleclass(object):
+             pass
+         check(newstyleclass, s)
+@@ -763,41 +731,40 @@
+         # we need to test for both sizes, because we don't know if the string
+         # has been cached
+         for s in samples:
+-            check(s, size(h + 'PPlP') + usize * (len(s) + 1))
++            check(s, size('PPlP') + usize * (len(s) + 1))
+         # weakref
+         import weakref
+-        check(weakref.ref(int), size(h + '2Pl2P'))
++        check(weakref.ref(int), size('2Pl2P'))
+         # weakproxy
+         # XXX
+         # weakcallableproxy
+-        check(weakref.proxy(int), size(h + '2Pl2P'))
++        check(weakref.proxy(int), size('2Pl2P'))
+         # xrange
+-        check(xrange(1), size(h + '3l'))
+-        check(xrange(66000), size(h + '3l'))
++        check(xrange(1), size('3l'))
++        check(xrange(66000), size('3l'))
+ 
+     def test_pythontypes(self):
+         # check all types defined in Python/
+-        h = self.header
+-        vh = self.vheader
+-        size = self.calcsize
++        size = test.test_support.calcobjsize
++        vsize = test.test_support.calcvobjsize
+         check = self.check_sizeof
+         # _ast.AST
+         import _ast
+-        check(_ast.AST(), size(h + ''))
++        check(_ast.AST(), size(''))
+         # imp.NullImporter
+         import imp
+-        check(imp.NullImporter(self.file.name), size(h + ''))
++        check(imp.NullImporter(self.file.name), size(''))
+         try:
+             raise TypeError
+         except TypeError:
+             tb = sys.exc_info()[2]
+             # traceback
+             if tb != None:
+-                check(tb, size(h + '2P2i'))
++                check(tb, size('2P2i'))
+         # symtable entry
+         # XXX
+         # sys.flags
+-        check(sys.flags, size(vh) + self.P * len(sys.flags))
++        check(sys.flags, vsize('') + self.P * len(sys.flags))
+ 
+ 
+ def test_main():
+diff -r 70274d53c1dd Lib/test/test_sys_settrace.py
+--- a/Lib/test/test_sys_settrace.py
++++ b/Lib/test/test_sys_settrace.py
+@@ -670,6 +670,14 @@
+ no_jump_to_non_integers.jump = (2, "Spam")
+ no_jump_to_non_integers.output = [True]
+ 
++def jump_across_with(output):
++    with open(test_support.TESTFN, "wb") as fp:
++        pass
++    with open(test_support.TESTFN, "wb") as fp:
++        pass
++jump_across_with.jump = (1, 3)
++jump_across_with.output = []
++
+ # This verifies that you can't set f_lineno via _getframe or similar
+ # trickery.
+ def no_jump_without_trace_function():
+@@ -739,6 +747,9 @@
+         self.run_test(no_jump_to_non_integers)
+     def test_19_no_jump_without_trace_function(self):
+         no_jump_without_trace_function()
++    def test_jump_across_with(self):
++        self.addCleanup(test_support.unlink, test_support.TESTFN)
++        self.run_test(jump_across_with)
+ 
+     def test_20_large_function(self):
+         d = {}
+diff -r 70274d53c1dd Lib/test/test_tarfile.py
+--- a/Lib/test/test_tarfile.py
++++ b/Lib/test/test_tarfile.py
+@@ -154,6 +154,9 @@
+     def test_fileobj_symlink2(self):
+         self._test_fileobj_link("./ustar/linktest2/symtype", "ustar/linktest1/regtype")
+ 
++    def test_issue14160(self):
++        self._test_fileobj_link("symtype2", "ustar/regtype")
++
+ 
+ class CommonReadTest(ReadTest):
+ 
+diff -r 70274d53c1dd Lib/test/test_telnetlib.py
+--- a/Lib/test/test_telnetlib.py
++++ b/Lib/test/test_telnetlib.py
+@@ -3,6 +3,7 @@
+ import time
+ import Queue
+ 
++import unittest
+ from unittest import TestCase
+ from test import test_support
+ threading = test_support.import_module('threading')
+@@ -135,6 +136,28 @@
+         self.assertEqual(data, want[0])
+         self.assertEqual(telnet.read_all(), 'not seen')
+ 
++    def test_read_until_with_poll(self):
++        """Use select.poll() to implement telnet.read_until()."""
++        want = ['x' * 10, 'match', 'y' * 10, EOF_sigil]
++        self.dataq.put(want)
++        telnet = telnetlib.Telnet(HOST, self.port)
++        if not telnet._has_poll:
++            raise unittest.SkipTest('select.poll() is required')
++        telnet._has_poll = True
++        self.dataq.join()
++        data = telnet.read_until('match')
++        self.assertEqual(data, ''.join(want[:-2]))
++
++    def test_read_until_with_select(self):
++        """Use select.select() to implement telnet.read_until()."""
++        want = ['x' * 10, 'match', 'y' * 10, EOF_sigil]
++        self.dataq.put(want)
++        telnet = telnetlib.Telnet(HOST, self.port)
++        telnet._has_poll = False
++        self.dataq.join()
++        data = telnet.read_until('match')
++        self.assertEqual(data, ''.join(want[:-2]))
++
+     def test_read_all_A(self):
+         """
+         read_all()
+@@ -357,8 +380,75 @@
+         self.assertEqual('', telnet.read_sb_data())
+         nego.sb_getter = None # break the nego => telnet cycle
+ 
++
++class ExpectTests(TestCase):
++    def setUp(self):
++        self.evt = threading.Event()
++        self.dataq = Queue.Queue()
++        self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
++        self.sock.settimeout(10)
++        self.port = test_support.bind_port(self.sock)
++        self.thread = threading.Thread(target=server, args=(self.evt,self.sock,
++                                                            self.dataq))
++        self.thread.start()
++        self.evt.wait()
++
++    def tearDown(self):
++        self.thread.join()
++
++    # use a similar approach to testing timeouts as test_timeout.py
++    # these will never pass 100% but make the fuzz big enough that it is rare
++    block_long = 0.6
++    block_short = 0.3
++    def test_expect_A(self):
++        """
++        expect(expected, [timeout])
++          Read until the expected string has been seen, or a timeout is
++          hit (default is no timeout); may block.
++        """
++        want = ['x' * 10, 'match', 'y' * 10, EOF_sigil]
++        self.dataq.put(want)
++        telnet = telnetlib.Telnet(HOST, self.port)
++        self.dataq.join()
++        (_,_,data) = telnet.expect(['match'])
++        self.assertEqual(data, ''.join(want[:-2]))
++
++    def test_expect_B(self):
++        # test the timeout - it does NOT raise socket.timeout
++        want = ['hello', self.block_long, 'not seen', EOF_sigil]
++        self.dataq.put(want)
++        telnet = telnetlib.Telnet(HOST, self.port)
++        self.dataq.join()
++        (_,_,data) = telnet.expect(['not seen'], self.block_short)
++        self.assertEqual(data, want[0])
++        self.assertEqual(telnet.read_all(), 'not seen')
++
++    def test_expect_with_poll(self):
++        """Use select.poll() to implement telnet.expect()."""
++        want = ['x' * 10, 'match', 'y' * 10, EOF_sigil]
++        self.dataq.put(want)
++        telnet = telnetlib.Telnet(HOST, self.port)
++        if not telnet._has_poll:
++            raise unittest.SkipTest('select.poll() is required')
++        telnet._has_poll = True
++        self.dataq.join()
++        (_,_,data) = telnet.expect(['match'])
++        self.assertEqual(data, ''.join(want[:-2]))
++
++    def test_expect_with_select(self):
++        """Use select.select() to implement telnet.expect()."""
++        want = ['x' * 10, 'match', 'y' * 10, EOF_sigil]
++        self.dataq.put(want)
++        telnet = telnetlib.Telnet(HOST, self.port)
++        telnet._has_poll = False
++        self.dataq.join()
++        (_,_,data) = telnet.expect(['match'])
++        self.assertEqual(data, ''.join(want[:-2]))
++
++
+ def test_main(verbose=None):
+-    test_support.run_unittest(GeneralTests, ReadTests, OptionTests)
++    test_support.run_unittest(GeneralTests, ReadTests, OptionTests,
++                              ExpectTests)
+ 
+ if __name__ == '__main__':
+     test_main()
+diff -r 70274d53c1dd Lib/test/test_thread.py
+--- a/Lib/test/test_thread.py
++++ b/Lib/test/test_thread.py
+@@ -130,6 +130,29 @@
+             time.sleep(0.01)
+         self.assertEqual(thread._count(), orig)
+ 
++    def test_save_exception_state_on_error(self):
++        # See issue #14474
++        def task():
++            started.release()
++            raise SyntaxError
++        def mywrite(self, *args):
++            try:
++                raise ValueError
++            except ValueError:
++                pass
++            real_write(self, *args)
++        c = thread._count()
++        started = thread.allocate_lock()
++        with test_support.captured_output("stderr") as stderr:
++            real_write = stderr.write
++            stderr.write = mywrite
++            started.acquire()
++            thread.start_new_thread(task, ())
++            started.acquire()
++            while thread._count() > c:
++                time.sleep(0.01)
++        self.assertIn("Traceback", stderr.getvalue())
++
+ 
+ class Barrier:
+     def __init__(self, num_threads):
+diff -r 70274d53c1dd Lib/test/test_threading.py
+--- a/Lib/test/test_threading.py
++++ b/Lib/test/test_threading.py
+@@ -2,6 +2,8 @@
+ 
+ import test.test_support
+ from test.test_support import verbose
++from test.script_helper import assert_python_ok
++
+ import random
+ import re
+ import sys
+@@ -414,6 +416,33 @@
+                          msg=('%d references still around' %
+                               sys.getrefcount(weak_raising_cyclic_object())))
+ 
++    @unittest.skipUnless(hasattr(os, 'fork'), 'test needs fork()')
++    def test_dummy_thread_after_fork(self):
++        # Issue #14308: a dummy thread in the active list doesn't mess up
++        # the after-fork mechanism.
++        code = """if 1:
++            import thread, threading, os, time
++
++            def background_thread(evt):
++                # Creates and registers the _DummyThread instance
++                threading.current_thread()
++                evt.set()
++                time.sleep(10)
++
++            evt = threading.Event()
++            thread.start_new_thread(background_thread, (evt,))
++            evt.wait()
++            assert threading.active_count() == 2, threading.active_count()
++            if os.fork() == 0:
++                assert threading.active_count() == 1, threading.active_count()
++                os._exit(0)
++            else:
++                os.wait()
++        """
++        _, out, err = assert_python_ok("-c", code)
++        self.assertEqual(out, '')
++        self.assertEqual(err, '')
++
+ 
+ class ThreadJoinOnShutdown(BaseTestCase):
+ 
+diff -r 70274d53c1dd Lib/test/test_tokenize.py
+--- a/Lib/test/test_tokenize.py
++++ b/Lib/test/test_tokenize.py
+@@ -278,6 +278,31 @@
+     OP         '+'           (1, 32) (1, 33)
+     STRING     'UR"ABC"'     (1, 34) (1, 41)
+ 
++    >>> dump_tokens("b'abc' + B'abc'")
++    STRING     "b'abc'"      (1, 0) (1, 6)
++    OP         '+'           (1, 7) (1, 8)
++    STRING     "B'abc'"      (1, 9) (1, 15)
++    >>> dump_tokens('b"abc" + B"abc"')
++    STRING     'b"abc"'      (1, 0) (1, 6)
++    OP         '+'           (1, 7) (1, 8)
++    STRING     'B"abc"'      (1, 9) (1, 15)
++    >>> dump_tokens("br'abc' + bR'abc' + Br'abc' + BR'abc'")
++    STRING     "br'abc'"     (1, 0) (1, 7)
++    OP         '+'           (1, 8) (1, 9)
++    STRING     "bR'abc'"     (1, 10) (1, 17)
++    OP         '+'           (1, 18) (1, 19)
++    STRING     "Br'abc'"     (1, 20) (1, 27)
++    OP         '+'           (1, 28) (1, 29)
++    STRING     "BR'abc'"     (1, 30) (1, 37)
++    >>> dump_tokens('br"abc" + bR"abc" + Br"abc" + BR"abc"')
++    STRING     'br"abc"'     (1, 0) (1, 7)
++    OP         '+'           (1, 8) (1, 9)
++    STRING     'bR"abc"'     (1, 10) (1, 17)
++    OP         '+'           (1, 18) (1, 19)
++    STRING     'Br"abc"'     (1, 20) (1, 27)
++    OP         '+'           (1, 28) (1, 29)
++    STRING     'BR"abc"'     (1, 30) (1, 37)
++
+ Operators
+ 
+     >>> dump_tokens("def d22(a, b, c=2, d=2, *k): pass")
+diff -r 70274d53c1dd Lib/test/test_tools.py
+--- /dev/null
++++ b/Lib/test/test_tools.py
+@@ -0,0 +1,39 @@
++"""Tests for scripts in the Tools directory.
++
++This file contains regression tests for some of the scripts found in the
++Tools directory of a Python checkout or tarball, such as reindent.py.
++"""
++
++import os
++import unittest
++import sysconfig
++from test import test_support
++from test.script_helper import assert_python_ok
++
++if not sysconfig.is_python_build():
++    # XXX some installers do contain the tools, should we detect that
++    # and run the tests in that case too?
++    raise unittest.SkipTest('test irrelevant for an installed Python')
++
++srcdir = sysconfig.get_config_var('projectbase')
++basepath = os.path.join(os.getcwd(), srcdir, 'Tools')
++
++
++class ReindentTests(unittest.TestCase):
++    script = os.path.join(basepath, 'scripts', 'reindent.py')
++
++    def test_noargs(self):
++        assert_python_ok(self.script)
++
++    def test_help(self):
++        rc, out, err = assert_python_ok(self.script, '-h')
++        self.assertEqual(out, b'')
++        self.assertGreater(err, b'')
++
++
++def test_main():
++    test_support.run_unittest(ReindentTests)
++
++
++if __name__ == '__main__':
++    unittest.main()
+diff -r 70274d53c1dd Lib/test/test_urllib2.py
+--- a/Lib/test/test_urllib2.py
++++ b/Lib/test/test_urllib2.py
+@@ -1106,12 +1106,30 @@
+         self._test_basic_auth(opener, auth_handler, "Authorization",
+                               realm, http_handler, password_manager,
+                               "http://acme.example.com/protected",
+-                              "http://acme.example.com/protected",
+-                              )
++                              "http://acme.example.com/protected"
++                             )
+ 
+     def test_basic_auth_with_single_quoted_realm(self):
+         self.test_basic_auth(quote_char="'")
+ 
++    def test_basic_auth_with_unquoted_realm(self):
++        opener = OpenerDirector()
++        password_manager = MockPasswordManager()
++        auth_handler = urllib2.HTTPBasicAuthHandler(password_manager)
++        realm = "ACME Widget Store"
++        http_handler = MockHTTPHandler(
++            401, 'WWW-Authenticate: Basic realm=%s\r\n\r\n' % realm)
++        opener.add_handler(auth_handler)
++        opener.add_handler(http_handler)
++        msg = "Basic Auth Realm was unquoted"
++        with test_support.check_warnings((msg, UserWarning)):
++            self._test_basic_auth(opener, auth_handler, "Authorization",
++                                  realm, http_handler, password_manager,
++                                  "http://acme.example.com/protected",
++                                  "http://acme.example.com/protected"
++                                 )
++
++
+     def test_proxy_basic_auth(self):
+         opener = OpenerDirector()
+         ph = urllib2.ProxyHandler(dict(http="proxy.example.com:3128"))
+diff -r 70274d53c1dd Lib/test/test_urlparse.py
+--- a/Lib/test/test_urlparse.py
++++ b/Lib/test/test_urlparse.py
+@@ -437,6 +437,18 @@
+         self.assertEqual(p.port, 80)
+         self.assertEqual(p.geturl(), url)
+ 
++        # Verify an illegal port of value greater than 65535 is set as None
++        url = "http://www.python.org:65536"
++        p = urlparse.urlsplit(url)
++        self.assertEqual(p.port, None)
++
++    def test_issue14072(self):
++        p1 = urlparse.urlsplit('tel:+31-641044153')
++        self.assertEqual(p1.scheme, 'tel')
++        self.assertEqual(p1.path, '+31-641044153')
++        p2 = urlparse.urlsplit('tel:+31641044153')
++        self.assertEqual(p2.scheme, 'tel')
++        self.assertEqual(p2.path, '+31641044153')
+ 
+     def test_attributes_bad_port(self):
+         """Check handling of non-integer ports."""
+@@ -493,6 +505,10 @@
+                          ('s3','foo.com','/stuff','','',''))
+         self.assertEqual(urlparse.urlparse("x-newscheme://foo.com/stuff"),
+                          ('x-newscheme','foo.com','/stuff','','',''))
++        self.assertEqual(urlparse.urlparse("x-newscheme://foo.com/stuff?query#fragment"),
++                         ('x-newscheme','foo.com','/stuff','','query','fragment'))
++        self.assertEqual(urlparse.urlparse("x-newscheme://foo.com/stuff?query"),
++                         ('x-newscheme','foo.com','/stuff','','query',''))
+ 
+     def test_withoutscheme(self):
+         # Test urlparse without scheme
+diff -r 70274d53c1dd Lib/test/test_weakref.py
+--- a/Lib/test/test_weakref.py
++++ b/Lib/test/test_weakref.py
+@@ -815,11 +815,71 @@
+     def __repr__(self):
+         return "<Object %r>" % self.arg
+ 
++class RefCycle:
++    def __init__(self):
++        self.cycle = self
++
+ 
+ class MappingTestCase(TestBase):
+ 
+     COUNT = 10
+ 
++    def check_len_cycles(self, dict_type, cons):
++        N = 20
++        items = [RefCycle() for i in range(N)]
++        dct = dict_type(cons(o) for o in items)
++        # Keep an iterator alive
++        it = dct.iteritems()
++        try:
++            next(it)
++        except StopIteration:
++            pass
++        del items
++        gc.collect()
++        n1 = len(dct)
++        del it
++        gc.collect()
++        n2 = len(dct)
++        # one item may be kept alive inside the iterator
++        self.assertIn(n1, (0, 1))
++        self.assertEqual(n2, 0)
++
++    def test_weak_keyed_len_cycles(self):
++        self.check_len_cycles(weakref.WeakKeyDictionary, lambda k: (k, 1))
++
++    def test_weak_valued_len_cycles(self):
++        self.check_len_cycles(weakref.WeakValueDictionary, lambda k: (1, k))
++
++    def check_len_race(self, dict_type, cons):
++        # Extended sanity checks for len() in the face of cyclic collection
++        self.addCleanup(gc.set_threshold, *gc.get_threshold())
++        for th in range(1, 100):
++            N = 20
++            gc.collect(0)
++            gc.set_threshold(th, th, th)
++            items = [RefCycle() for i in range(N)]
++            dct = dict_type(cons(o) for o in items)
++            del items
++            # All items will be collected at next garbage collection pass
++            it = dct.iteritems()
++            try:
++                next(it)
++            except StopIteration:
++                pass
++            n1 = len(dct)
++            del it
++            n2 = len(dct)
++            self.assertGreaterEqual(n1, 0)
++            self.assertLessEqual(n1, N)
++            self.assertGreaterEqual(n2, 0)
++            self.assertLessEqual(n2, n1)
++
++    def test_weak_keyed_len_race(self):
++        self.check_len_race(weakref.WeakKeyDictionary, lambda k: (k, 1))
++
++    def test_weak_valued_len_race(self):
++        self.check_len_race(weakref.WeakValueDictionary, lambda k: (1, k))
++
+     def test_weak_values(self):
+         #
+         #  This exercises d.copy(), d.items(), d[], del d[], len(d).
+diff -r 70274d53c1dd Lib/test/test_weakset.py
+--- a/Lib/test/test_weakset.py
++++ b/Lib/test/test_weakset.py
+@@ -30,6 +30,10 @@
+     def __hash__(self):
+         return hash((SomeClass, self.value))
+ 
++class RefCycle(object):
++    def __init__(self):
++        self.cycle = self
++
+ class TestWeakSet(unittest.TestCase):
+ 
+     def setUp(self):
+@@ -37,6 +41,12 @@
+         self.items = [SomeClass(c) for c in ('a', 'b', 'c')]
+         self.items2 = [SomeClass(c) for c in ('x', 'y', 'z')]
+         self.letters = [SomeClass(c) for c in string.ascii_letters]
++        self.ab_items = [SomeClass(c) for c in 'ab']
++        self.abcde_items = [SomeClass(c) for c in 'abcde']
++        self.def_items = [SomeClass(c) for c in 'def']
++        self.ab_weakset = WeakSet(self.ab_items)
++        self.abcde_weakset = WeakSet(self.abcde_items)
++        self.def_weakset = WeakSet(self.def_items)
+         self.s = WeakSet(self.items)
+         self.d = dict.fromkeys(self.items)
+         self.obj = SomeClass('F')
+@@ -79,6 +89,11 @@
+             x = WeakSet(self.items + self.items2)
+             c = C(self.items2)
+             self.assertEqual(self.s.union(c), x)
++            del c
++        self.assertEqual(len(u), len(self.items) + len(self.items2))
++        self.items2.pop()
++        gc.collect()
++        self.assertEqual(len(u), len(self.items) + len(self.items2))
+ 
+     def test_or(self):
+         i = self.s.union(self.items2)
+@@ -86,14 +101,19 @@
+         self.assertEqual(self.s | frozenset(self.items2), i)
+ 
+     def test_intersection(self):
+-        i = self.s.intersection(self.items2)
++        s = WeakSet(self.letters)
++        i = s.intersection(self.items2)
+         for c in self.letters:
+-            self.assertEqual(c in i, c in self.d and c in self.items2)
+-        self.assertEqual(self.s, WeakSet(self.items))
++            self.assertEqual(c in i, c in self.items2 and c in self.letters)
++        self.assertEqual(s, WeakSet(self.letters))
+         self.assertEqual(type(i), WeakSet)
+         for C in set, frozenset, dict.fromkeys, list, tuple:
+             x = WeakSet([])
+-            self.assertEqual(self.s.intersection(C(self.items2)), x)
++            self.assertEqual(i.intersection(C(self.items)), x)
++        self.assertEqual(len(i), len(self.items2))
++        self.items2.pop()
++        gc.collect()
++        self.assertEqual(len(i), len(self.items2))
+ 
+     def test_isdisjoint(self):
+         self.assertTrue(self.s.isdisjoint(WeakSet(self.items2)))
+@@ -124,6 +144,10 @@
+         self.assertEqual(self.s, WeakSet(self.items))
+         self.assertEqual(type(i), WeakSet)
+         self.assertRaises(TypeError, self.s.symmetric_difference, [[]])
++        self.assertEqual(len(i), len(self.items) + len(self.items2))
++        self.items2.pop()
++        gc.collect()
++        self.assertEqual(len(i), len(self.items) + len(self.items2))
+ 
+     def test_xor(self):
+         i = self.s.symmetric_difference(self.items2)
+@@ -131,22 +155,28 @@
+         self.assertEqual(self.s ^ frozenset(self.items2), i)
+ 
+     def test_sub_and_super(self):
+-        pl, ql, rl = map(lambda s: [SomeClass(c) for c in s], ['ab', 'abcde', 'def'])
+-        p, q, r = map(WeakSet, (pl, ql, rl))
+-        self.assertTrue(p < q)
+-        self.assertTrue(p <= q)
+-        self.assertTrue(q <= q)
+-        self.assertTrue(q > p)
+-        self.assertTrue(q >= p)
+-        self.assertFalse(q < r)
+-        self.assertFalse(q <= r)
+-        self.assertFalse(q > r)
+-        self.assertFalse(q >= r)
++        self.assertTrue(self.ab_weakset <= self.abcde_weakset)
++        self.assertTrue(self.abcde_weakset <= self.abcde_weakset)
++        self.assertTrue(self.abcde_weakset >= self.ab_weakset)
++        self.assertFalse(self.abcde_weakset <= self.def_weakset)
++        self.assertFalse(self.abcde_weakset >= self.def_weakset)
+         self.assertTrue(set('a').issubset('abc'))
+         self.assertTrue(set('abc').issuperset('a'))
+         self.assertFalse(set('a').issubset('cbs'))
+         self.assertFalse(set('cbs').issuperset('a'))
+ 
++    def test_lt(self):
++        self.assertTrue(self.ab_weakset < self.abcde_weakset)
++        self.assertFalse(self.abcde_weakset < self.def_weakset)
++        self.assertFalse(self.ab_weakset < self.ab_weakset)
++        self.assertFalse(WeakSet() < WeakSet())
++
++    def test_gt(self):
++        self.assertTrue(self.abcde_weakset > self.ab_weakset)
++        self.assertFalse(self.abcde_weakset > self.def_weakset)
++        self.assertFalse(self.ab_weakset > self.ab_weakset)
++        self.assertFalse(WeakSet() > WeakSet())
++
+     def test_gc(self):
+         # Create a nest of cycles to exercise overall ref count check
+         s = WeakSet(Foo() for i in range(1000))
+@@ -369,6 +399,49 @@
+             s.clear()
+         self.assertEqual(len(s), 0)
+ 
++    def test_len_cycles(self):
++        N = 20
++        items = [RefCycle() for i in range(N)]
++        s = WeakSet(items)
++        del items
++        it = iter(s)
++        try:
++            next(it)
++        except StopIteration:
++            pass
++        gc.collect()
++        n1 = len(s)
++        del it
++        gc.collect()
++        n2 = len(s)
++        # one item may be kept alive inside the iterator
++        self.assertIn(n1, (0, 1))
++        self.assertEqual(n2, 0)
++
++    def test_len_race(self):
++        # Extended sanity checks for len() in the face of cyclic collection
++        self.addCleanup(gc.set_threshold, *gc.get_threshold())
++        for th in range(1, 100):
++            N = 20
++            gc.collect(0)
++            gc.set_threshold(th, th, th)
++            items = [RefCycle() for i in range(N)]
++            s = WeakSet(items)
++            del items
++            # All items will be collected at next garbage collection pass
++            it = iter(s)
++            try:
++                next(it)
++            except StopIteration:
++                pass
++            n1 = len(s)
++            del it
++            n2 = len(s)
++            self.assertGreaterEqual(n1, 0)
++            self.assertLessEqual(n1, N)
++            self.assertGreaterEqual(n2, 0)
++            self.assertLessEqual(n2, n1)
++
+ 
+ def test_main(verbose=None):
+     test_support.run_unittest(TestWeakSet)
+diff -r 70274d53c1dd Lib/test/test_winreg.py
+--- a/Lib/test/test_winreg.py
++++ b/Lib/test/test_winreg.py
+@@ -1,7 +1,7 @@
+ # Test the windows specific win32reg module.
+ # Only win32reg functions not hit here: FlushKey, LoadKey and SaveKey
+ 
+-import os, sys
++import os, sys, errno
+ import unittest
+ from test import test_support
+ threading = test_support.import_module("threading")
+@@ -283,7 +283,13 @@
+     def test_dynamic_key(self):
+         # Issue2810, when the value is dynamically generated, these
+         # throw "WindowsError: More data is available" in 2.6 and 3.1
+-        EnumValue(HKEY_PERFORMANCE_DATA, 0)
++        try:
++            EnumValue(HKEY_PERFORMANCE_DATA, 0)
++        except OSError as e:
++            if e.errno in (errno.EPERM, errno.EACCES):
++                self.skipTest("access denied to registry key "
++                              "(are you running in a non-interactive session?)")
++            raise
+         QueryValueEx(HKEY_PERFORMANCE_DATA, None)
+ 
+     # Reflection requires XP x64/Vista at a minimum. XP doesn't have this stuff
+diff -r 70274d53c1dd Lib/test/test_zipfile.py
+--- a/Lib/test/test_zipfile.py
++++ b/Lib/test/test_zipfile.py
+@@ -908,6 +908,22 @@
+         with zipfile.ZipFile(TESTFN, mode="r") as zipf:
+             self.assertEqual(zipf.comment, comment2)
+ 
++    def test_change_comment_in_empty_archive(self):
++        with zipfile.ZipFile(TESTFN, "a", zipfile.ZIP_STORED) as zipf:
++            self.assertFalse(zipf.filelist)
++            zipf.comment = b"this is a comment"
++        with zipfile.ZipFile(TESTFN, "r") as zipf:
++            self.assertEqual(zipf.comment, b"this is a comment")
++
++    def test_change_comment_in_nonempty_archive(self):
++        with zipfile.ZipFile(TESTFN, "w", zipfile.ZIP_STORED) as zipf:
++            zipf.writestr("foo.txt", "O, for a Muse of Fire!")
++        with zipfile.ZipFile(TESTFN, "a", zipfile.ZIP_STORED) as zipf:
++            self.assertTrue(zipf.filelist)
++            zipf.comment = b"this is a comment"
++        with zipfile.ZipFile(TESTFN, "r") as zipf:
++            self.assertEqual(zipf.comment, b"this is a comment")
++
+     def check_testzip_with_bad_crc(self, compression):
+         """Tests that files with bad CRCs return their name from testzip."""
+         zipdata = self.zips_with_bad_crc[compression]
+diff -r 70274d53c1dd Lib/test/testtar.tar
+Binary file Lib/test/testtar.tar has changed
+diff -r 70274d53c1dd Lib/textwrap.py
+--- a/Lib/textwrap.py
++++ b/Lib/textwrap.py
+@@ -9,6 +9,14 @@
+ 
+ import string, re
+ 
++try:
++    _unicode = unicode
++except NameError:
++    # If Python is built without Unicode support, the unicode type
++    # will not exist. Fake one.
++    class _unicode(object):
++        pass
++
+ # Do the right thing with boolean values for all known Python versions
+ # (so this module can be copied to projects that don't depend on Python
+ # 2.3, e.g. Optik and Docutils) by uncommenting the block of code below.
+@@ -147,7 +155,7 @@
+         if self.replace_whitespace:
+             if isinstance(text, str):
+                 text = text.translate(self.whitespace_trans)
+-            elif isinstance(text, unicode):
++            elif isinstance(text, _unicode):
+                 text = text.translate(self.unicode_whitespace_trans)
+         return text
+ 
+@@ -167,7 +175,7 @@
+           'use', ' ', 'the', ' ', '-b', ' ', option!'
+         otherwise.
+         """
+-        if isinstance(text, unicode):
++        if isinstance(text, _unicode):
+             if self.break_on_hyphens:
+                 pat = self.wordsep_re_uni
+             else:
+diff -r 70274d53c1dd Lib/threading.py
+--- a/Lib/threading.py
++++ b/Lib/threading.py
+@@ -10,6 +10,7 @@
+ 
+ import warnings
+ 
++from collections import deque as _deque
+ from time import time as _time, sleep as _sleep
+ from traceback import format_exc as _format_exc
+ 
+@@ -605,6 +606,10 @@
+                     pass
+ 
+     def __stop(self):
++        # DummyThreads delete self.__block, but they have no waiters to
++        # notify anyway (join() is forbidden on them).
++        if not hasattr(self, '_Thread__block'):
++            return
+         self.__block.acquire()
+         self.__stopped = True
+         self.__block.notify_all()
+@@ -909,7 +914,7 @@
+             self.rc = Condition(self.mon)
+             self.wc = Condition(self.mon)
+             self.limit = limit
+-            self.queue = deque()
++            self.queue = _deque()
+ 
+         def put(self, item):
+             self.mon.acquire()
+diff -r 70274d53c1dd Lib/token.py
+--- a/Lib/token.py
++++ b/Lib/token.py
+@@ -7,7 +7,7 @@
+ #  To update the symbols in this file, 'cd' to the top directory of
+ #  the python source tree after building the interpreter and run:
+ #
+-#    python Lib/token.py
++#    ./python Lib/token.py
+ 
+ #--start constants--
+ ENDMARKER = 0
+diff -r 70274d53c1dd Lib/tokenize.py
+--- a/Lib/tokenize.py
++++ b/Lib/tokenize.py
+@@ -70,10 +70,10 @@
+ Single3 = r"[^'\\]*(?:(?:\\.|'(?!''))[^'\\]*)*'''"
+ # Tail end of """ string.
+ Double3 = r'[^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*"""'
+-Triple = group("[uU]?[rR]?'''", '[uU]?[rR]?"""')
++Triple = group("[uUbB]?[rR]?'''", '[uUbB]?[rR]?"""')
+ # Single-line ' or " string.
+-String = group(r"[uU]?[rR]?'[^\n'\\]*(?:\\.[^\n'\\]*)*'",
+-               r'[uU]?[rR]?"[^\n"\\]*(?:\\.[^\n"\\]*)*"')
++String = group(r"[uUbB]?[rR]?'[^\n'\\]*(?:\\.[^\n'\\]*)*'",
++               r'[uUbB]?[rR]?"[^\n"\\]*(?:\\.[^\n"\\]*)*"')
+ 
+ # Because of leftmost-then-longest match semantics, be sure to put the
+ # longest operators first (e.g., if = came before ==, == would get
+@@ -91,9 +91,9 @@
+ Token = Ignore + PlainToken
+ 
+ # First (or only) line of ' or " string.
+-ContStr = group(r"[uU]?[rR]?'[^\n'\\]*(?:\\.[^\n'\\]*)*" +
++ContStr = group(r"[uUbB]?[rR]?'[^\n'\\]*(?:\\.[^\n'\\]*)*" +
+                 group("'", r'\\\r?\n'),
+-                r'[uU]?[rR]?"[^\n"\\]*(?:\\.[^\n"\\]*)*' +
++                r'[uUbB]?[rR]?"[^\n"\\]*(?:\\.[^\n"\\]*)*' +
+                 group('"', r'\\\r?\n'))
+ PseudoExtras = group(r'\\\r?\n', Comment, Triple)
+ PseudoToken = Whitespace + group(PseudoExtras, Number, Funny, ContStr, Name)
+diff -r 70274d53c1dd Lib/unittest/case.py
+--- a/Lib/unittest/case.py
++++ b/Lib/unittest/case.py
+@@ -6,6 +6,7 @@
+ import difflib
+ import pprint
+ import re
++import types
+ import warnings
+ 
+ from . import result
+@@ -55,7 +56,7 @@
+     Unconditionally skip a test.
+     """
+     def decorator(test_item):
+-        if not (isinstance(test_item, type) and issubclass(test_item, TestCase)):
++        if not isinstance(test_item, (type, types.ClassType)):
+             @functools.wraps(test_item)
+             def skip_wrapper(*args, **kwargs):
+                 raise SkipTest(reason)
+@@ -201,7 +202,11 @@
+         self.addTypeEqualityFunc(tuple, 'assertTupleEqual')
+         self.addTypeEqualityFunc(set, 'assertSetEqual')
+         self.addTypeEqualityFunc(frozenset, 'assertSetEqual')
+-        self.addTypeEqualityFunc(unicode, 'assertMultiLineEqual')
++        try:
++            self.addTypeEqualityFunc(unicode, 'assertMultiLineEqual')
++        except NameError:
++            # No unicode support in this build
++            pass
+ 
+     def addTypeEqualityFunc(self, typeobj, function):
+         """Add a type specific assertEqual style function to compare a type.
+@@ -871,7 +876,7 @@
+             - [0, 1, 1] and [1, 0, 1] compare equal.
+             - [0, 0, 1] and [0, 1] compare unequal.
+         """
+-        first_seq, second_seq = list(actual_seq), list(expected_seq)
++        first_seq, second_seq = list(expected_seq), list(actual_seq)
+         with warnings.catch_warnings():
+             if sys.py3kwarning:
+                 # Silence Py3k warning raised during the sorting
+diff -r 70274d53c1dd Lib/unittest/test/test_skipping.py
+--- a/Lib/unittest/test/test_skipping.py
++++ b/Lib/unittest/test/test_skipping.py
+@@ -66,6 +66,36 @@
+         self.assertEqual(result.skipped, [(test, "testing")])
+         self.assertEqual(record, [])
+ 
++    def test_skip_non_unittest_class_old_style(self):
++        @unittest.skip("testing")
++        class Mixin:
++            def test_1(self):
++                record.append(1)
++        class Foo(Mixin, unittest.TestCase):
++            pass
++        record = []
++        result = unittest.TestResult()
++        test = Foo("test_1")
++        suite = unittest.TestSuite([test])
++        suite.run(result)
++        self.assertEqual(result.skipped, [(test, "testing")])
++        self.assertEqual(record, [])
++
++    def test_skip_non_unittest_class_new_style(self):
++        @unittest.skip("testing")
++        class Mixin(object):
++            def test_1(self):
++                record.append(1)
++        class Foo(Mixin, unittest.TestCase):
++            pass
++        record = []
++        result = unittest.TestResult()
++        test = Foo("test_1")
++        suite = unittest.TestSuite([test])
++        suite.run(result)
++        self.assertEqual(result.skipped, [(test, "testing")])
++        self.assertEqual(record, [])
++
+     def test_expected_failure(self):
+         class Foo(unittest.TestCase):
+             @unittest.expectedFailure
+diff -r 70274d53c1dd Lib/urllib.py
+--- a/Lib/urllib.py
++++ b/Lib/urllib.py
+@@ -980,11 +980,11 @@
+         self.hookargs = hookargs
+ 
+     def close(self):
+-        addbase.close(self)
+         if self.closehook:
+             self.closehook(*self.hookargs)
+             self.closehook = None
+             self.hookargs = None
++        addbase.close(self)
+ 
+ class addinfo(addbase):
+     """class to add an info() method to an open file."""
+diff -r 70274d53c1dd Lib/urllib2.py
+--- a/Lib/urllib2.py
++++ b/Lib/urllib2.py
+@@ -102,6 +102,7 @@
+ import time
+ import urlparse
+ import bisect
++import warnings
+ 
+ try:
+     from cStringIO import StringIO
+@@ -109,7 +110,7 @@
+     from StringIO import StringIO
+ 
+ from urllib import (unwrap, unquote, splittype, splithost, quote,
+-     addinfourl, splitport, splittag,
++     addinfourl, splitport, splittag, toBytes,
+      splitattr, ftpwrapper, splituser, splitpasswd, splitvalue)
+ 
+ # support for FileHandler, proxies via environment variables
+@@ -828,7 +829,7 @@
+     # allow for double- and single-quoted realm values
+     # (single quotes are a violation of the RFC, but appear in the wild)
+     rx = re.compile('(?:.*,)*[ \t]*([^ \t]+)[ \t]+'
+-                    'realm=(["\'])(.*?)\\2', re.I)
++                    'realm=(["\']?)([^"\']*)\\2', re.I)
+ 
+     # XXX could pre-emptively send auth info already accepted (RFC 2617,
+     # end of section 2, and section 1.2 immediately after "credentials"
+@@ -861,6 +862,9 @@
+             mo = AbstractBasicAuthHandler.rx.search(authreq)
+             if mo:
+                 scheme, quote, realm = mo.groups()
++                if quote not in ['"', "'"]:
++                    warnings.warn("Basic Auth Realm was unquoted",
++                                  UserWarning, 2)
+                 if scheme.lower() == 'basic':
+                     response = self.retry_http_basic_auth(host, req, realm)
+                     if response and response.code != 401:
+diff -r 70274d53c1dd Lib/urlparse.py
+--- a/Lib/urlparse.py
++++ b/Lib/urlparse.py
+@@ -40,16 +40,9 @@
+                'imap', 'wais', 'file', 'mms', 'https', 'shttp',
+                'snews', 'prospero', 'rtsp', 'rtspu', 'rsync', '',
+                'svn', 'svn+ssh', 'sftp','nfs','git', 'git+ssh']
+-non_hierarchical = ['gopher', 'hdl', 'mailto', 'news',
+-                    'telnet', 'wais', 'imap', 'snews', 'sip', 'sips']
+ uses_params = ['ftp', 'hdl', 'prospero', 'http', 'imap',
+                'https', 'shttp', 'rtsp', 'rtspu', 'sip', 'sips',
+                'mms', '', 'sftp']
+-uses_query = ['http', 'wais', 'imap', 'https', 'shttp', 'mms',
+-              'gopher', 'rtsp', 'rtspu', 'sip', 'sips', '']
+-uses_fragment = ['ftp', 'hdl', 'http', 'gopher', 'news',
+-                 'nntp', 'wais', 'https', 'shttp', 'snews',
+-                 'file', 'prospero', '']
+ 
+ # Characters valid in scheme names
+ scheme_chars = ('abcdefghijklmnopqrstuvwxyz'
+@@ -104,9 +97,11 @@
+         netloc = self.netloc.split('@')[-1].split(']')[-1]
+         if ':' in netloc:
+             port = netloc.split(':')[1]
+-            return int(port, 10)
+-        else:
+-            return None
++            port = int(port, 10)
++            # verify legal port
++            if (0 <= port <= 65535):
++                return port
++        return None
+ 
+ from collections import namedtuple
+ 
+@@ -192,21 +187,21 @@
+             if c not in scheme_chars:
+                 break
+         else:
+-            try:
+-                # make sure "url" is not actually a port number (in which case
+-                # "scheme" is really part of the path
+-                _testportnum = int(url[i+1:])
+-            except ValueError:
+-                scheme, url = url[:i].lower(), url[i+1:]
++            # make sure "url" is not actually a port number (in which case
++            # "scheme" is really part of the path)
++            rest = url[i+1:]
++            if not rest or any(c not in '0123456789' for c in rest):
++                # not a port number
++                scheme, url = url[:i].lower(), rest
+ 
+     if url[:2] == '//':
+         netloc, url = _splitnetloc(url, 2)
+         if (('[' in netloc and ']' not in netloc) or
+                 (']' in netloc and '[' not in netloc)):
+             raise ValueError("Invalid IPv6 URL")
+-    if allow_fragments and scheme in uses_fragment and '#' in url:
++    if allow_fragments and '#' in url:
+         url, fragment = url.split('#', 1)
+-    if scheme in uses_query and '?' in url:
++    if '?' in url:
+         url, query = url.split('?', 1)
+     v = SplitResult(scheme, netloc, url, query, fragment)
+     _parse_cache[key] = v
+diff -r 70274d53c1dd Lib/zipfile.py
+--- a/Lib/zipfile.py
++++ b/Lib/zipfile.py
+@@ -651,7 +651,7 @@
+ 
+ 
+ 
+-class ZipFile:
++class ZipFile(object):
+     """ Class with methods to open, read, write, close, list zip files.
+ 
+     z = ZipFile(file, mode="r", compression=ZIP_STORED, allowZip64=False)
+@@ -690,7 +690,7 @@
+         self.compression = compression  # Method of compression
+         self.mode = key = mode.replace('b', '')[0]
+         self.pwd = None
+-        self.comment = ''
++        self._comment = ''
+ 
+         # Check if we were passed a file-like object
+         if isinstance(file, basestring):
+@@ -765,7 +765,7 @@
+             print endrec
+         size_cd = endrec[_ECD_SIZE]             # bytes in central directory
+         offset_cd = endrec[_ECD_OFFSET]         # offset of central directory
+-        self.comment = endrec[_ECD_COMMENT]     # archive comment
++        self._comment = endrec[_ECD_COMMENT]    # archive comment
+ 
+         # "concat" is zero, unless zip was concatenated to another file
+         concat = endrec[_ECD_LOCATION] - size_cd - offset_cd
+@@ -864,6 +864,22 @@
+         """Set default password for encrypted files."""
+         self.pwd = pwd
+ 
++    @property
++    def comment(self):
++        """The comment text associated with the ZIP file."""
++        return self._comment
++
++    @comment.setter
++    def comment(self, comment):
++        # check for valid comment length
++        if len(comment) >= ZIP_MAX_COMMENT:
++            if self.debug:
++                print('Archive comment is too long; truncating to %d bytes'
++                        % ZIP_MAX_COMMENT)
++            comment = comment[:ZIP_MAX_COMMENT]
++        self._comment = comment
++        self._didModify = True
++
+     def read(self, name, pwd=None):
+         """Return file bytes (as a string) for name."""
+         return self.open(name, "r", pwd).read()
+@@ -1243,18 +1259,11 @@
+                 centDirSize = min(centDirSize, 0xFFFFFFFF)
+                 centDirOffset = min(centDirOffset, 0xFFFFFFFF)
+ 
+-            # check for valid comment length
+-            if len(self.comment) >= ZIP_MAX_COMMENT:
+-                if self.debug > 0:
+-                    msg = 'Archive comment is too long; truncating to %d bytes' \
+-                          % ZIP_MAX_COMMENT
+-                self.comment = self.comment[:ZIP_MAX_COMMENT]
+-
+             endrec = struct.pack(structEndArchive, stringEndArchive,
+                                  0, 0, centDirCount, centDirCount,
+-                                 centDirSize, centDirOffset, len(self.comment))
++                                 centDirSize, centDirOffset, len(self._comment))
+             self.fp.write(endrec)
+-            self.fp.write(self.comment)
++            self.fp.write(self._comment)
+             self.fp.flush()
+ 
+         if not self._filePassed:
+diff -r 70274d53c1dd Mac/README
+--- a/Mac/README
++++ b/Mac/README
+@@ -70,7 +70,7 @@
+   $ make
+   $ make install
+ 
+-This flag can be used a framework build of python, but also with a classic
++This flag can be used with a framework build of python, but also with a classic
+ unix build. Either way you will have to build python on Mac OS X 10.4 (or later)
+ with Xcode 2.1 (or later). You also have to install the 10.4u SDK when 
+ installing Xcode.
+@@ -221,8 +221,8 @@
+ 
+ Go to the directory "Mac/OSX/BuildScript". There you'll find a script 
+ "build-installer.py" that does all the work. This will download and build
+-a number of 3th-party libaries, configures and builds a framework Python,
+-installs it, creates the installer pacakge files and then packs this in a 
++a number of 3rd-party libaries, configures and builds a framework Python,
++installs it, creates the installer package files and then packs this in a
+ DMG image.
+ 
+ The script will build a universal binary, you'll therefore have to run this
+@@ -258,8 +258,8 @@
+ Uninstalling a framework install, including the binary installer
+ ================================================================
+ 
+-Uninstalling a framework can be done by manually removing all bits that got installed,
+-that's true for both installations from source and installations using the binary installer.
++Uninstalling a framework can be done by manually removing all bits that got installed.
++That's true for both installations from source and installations using the binary installer.
+ Sadly enough OSX does not have a central uninstaller.
+ 
+ The main bit of a framework install is the framework itself, installed in
+diff -r 70274d53c1dd Makefile.pre.in
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -152,7 +152,7 @@
+ SUBDIRSTOO=	Include Lib Misc Demo
+ 
+ # Files and directories to be distributed
+-CONFIGFILES=	configure configure.in acconfig.h pyconfig.h.in Makefile.pre.in
++CONFIGFILES=	configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in
+ DISTFILES=	README ChangeLog $(CONFIGFILES)
+ DISTDIRS=	$(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
+ DIST=		$(DISTFILES) $(DISTDIRS)
+@@ -1165,7 +1165,7 @@
+ 	$(SHELL) config.status --recheck
+ 	$(SHELL) config.status
+ 
+-# Rebuild the configure script from configure.in; also rebuild pyconfig.h.in
++# Rebuild the configure script from configure.ac; also rebuild pyconfig.h.in
+ autoconf:
+ 	(cd $(srcdir); autoconf)
+ 	(cd $(srcdir); autoheader)
+diff -r 70274d53c1dd Misc/ACKS
+--- a/Misc/ACKS
++++ b/Misc/ACKS
+@@ -44,6 +44,7 @@
+ Matt Bandy
+ Michael J. Barber
+ Chris Barker
++Anton Barkovsky
+ Nick Barnes
+ Quentin Barnes
+ Richard Barran
+@@ -73,6 +74,7 @@
+ Steven Bethard
+ Stephen Bevan
+ Ron Bickers
++Natalia B. Bidart
+ David Binger
+ Dominic Binks
+ Philippe Biondi
+@@ -127,6 +129,7 @@
+ Brett Cannon
+ Mike Carlton
+ Terry Carroll
++Damien Cassou
+ Lorenzo M. Catucci
+ Donn Cave
+ Charles Cazabon
+@@ -273,6 +276,7 @@
+ John Fouhy
+ Martin Franklin
+ Robin Friedrich
++Bradley Froehle
+ Ivan Frohne
+ Jim Fulton
+ Tadayoshi Funaba
+@@ -295,6 +299,7 @@
+ Dan Gass
+ Andrew Gaul
+ Stephen M. Gava
++Xavier de Gaye
+ Harry Henry Gebel
+ Marius Gedminas
+ Thomas Gellekum
+@@ -320,6 +325,7 @@
+ Lars GustÃ¤bel
+ Thomas GÃ¼ttler
+ Barry Haddow
++Philipp Hagemeister
+ Paul ten Hagen
+ Rasmus Hahn
+ Peter Haight
+@@ -366,6 +372,7 @@
+ Albert Hofkamp
+ Tomas Hoger
+ Jonathan Hogg
++Akintayo Holder
+ Gerrit Holl
+ Shane Holloway
+ Rune Holm
+@@ -387,6 +394,7 @@
+ Greg Humphreys
+ Eric Huss
+ Jeremy Hylton
++Ludwig HÃ¤hne
+ Gerhard HÃ¤ring
+ Fredrik HÃ¥Ã¥rd
+ Catalin Iacob
+@@ -409,6 +417,7 @@
+ Thomas Jarosch
+ Drew Jenkins
+ Flemming KjÃ¦r Jensen
++Philip Jenvey
+ Jiba
+ Orjan Johansen
+ Fredrik Johansson
+@@ -457,10 +466,12 @@
+ Kim Knapp
+ Lenny Kneler
+ Pat Knight
++Jeff Knupp
+ Greg Kochanski
+ Damon Kohler
+ Marko Kohtala
+ Joseph Koshy
++Jerzy Kozera
+ Maksim Kozyarchuk
+ Stefan Krah
+ Bob Kras
+@@ -499,6 +510,7 @@
+ Robert Lehmann
+ Petri Lehtinen
+ Luke Kenneth Casson Leighton
++Tshepang Lekhonkhobe
+ Marc-Andre Lemburg
+ John Lenton
+ Christopher Tur Lesniewski-Laas
+@@ -539,6 +551,7 @@
+ Vladimir Marangozov
+ David Marek
+ Doug Marien
++Sven Marnach
+ Alex Martelli
+ Anthony Martin
+ SÃ©bastien Martini
+@@ -567,6 +580,7 @@
+ Mike Meyer
+ Steven Miale
+ Trent Mick
++Tom Middleton
+ Stan Mihai
+ Aristotelis Mikropoulos
+ Damien Miller
+@@ -577,6 +591,7 @@
+ Andrii V. Mishkovskyi
+ Dustin J. Mitchell
+ Dom Mitchell
++Florian Mladitsch
+ Doug Moen
+ The Dragon De Monsyne
+ Skip Montanaro
+@@ -681,6 +696,7 @@
+ Brian Quinlan
+ Anders Qvist
+ Burton Radons
++Jeff Ramnani
+ Brodie Rao
+ Antti Rasinen
+ Sridhar Ratnakumar
+@@ -709,11 +725,13 @@
+ Juan M. Bello Rivas
+ Davide Rizzo
+ Anthony Roach
++Carl Robben
+ Mark Roberts
+ Jim Robinson
+ Andy Robinson
+ Kevin Rodgers
+ Giampaolo Rodola
++Adi Roiban
+ Mike Romberg
+ Armin Ronacher
+ Case Roole
+@@ -749,6 +767,7 @@
+ Michael Scharf
+ Neil Schemenauer
+ David Scherer
++Hynek Schlawack
+ Gregor Schmid
+ Ralf Schmitt
+ Michael Schneider
+@@ -770,6 +789,7 @@
+ Denis Severson
+ Ian Seyer
+ Ha Shao
++Mark Shannon
+ Richard Shapiro
+ Bruce Sherwood
+ Alexander Shigin
+@@ -780,6 +800,7 @@
+ Itamar Shtull-Trauring
+ Eric Siegerman
+ Paul Sijben
++Tim Silk
+ Kirill Simonov
+ Nathan Paul Simons
+ Janne Sinkkonen
+@@ -810,6 +831,7 @@
+ Peter Stoehr
+ Casper Stoel
+ Michael Stone
++Serhiy Storchaka
+ Ken Stox
+ Patrick Strawderman
+ Dan Stromberg
+@@ -827,6 +849,7 @@
+ Geoff Talvola
+ William Tanksley
+ Christian Tanzer
++Stefano Taschini
+ Steven Taschuk
+ Monty Taylor
+ Amy Taylor
+@@ -878,6 +901,7 @@
+ Kurt Vile
+ Norman Vine
+ Frank Visser
++Johannes Vogel
+ Niki W. Waibel
+ Wojtek Walczak
+ Charles Waldman
+@@ -885,6 +909,7 @@
+ Larry Wall
+ Kevin Walzer
+ Greg Ward
++Zachary Ware
+ Barry Warsaw
+ Steve Waterbury
+ Bob Watson
+@@ -911,6 +936,7 @@
+ Gerald S. Williams
+ Frank Willison
+ Greg V. Wilson
++J Derek Wilson
+ Jody Winston
+ Collin Winter
+ Dik Winter
+diff -r 70274d53c1dd Misc/NEWS
+--- a/Misc/NEWS
++++ b/Misc/NEWS
+@@ -1,17 +1,375 @@
+ Python News
+ +++++++++++
+ 
+-What's New in Python 2.7.3 final?
+-=================================
+-
+-*Release date: 2012-04-09*
++What's New in Python 2.7.4
++==========================
++
++*Release date: XXXX-XX-XX*
++
++Core and Builtins
++-----------------
++
++- Issue #15041: Update "see also" list in tkinter documentation.
++
++- Issue #14579: Fix error handling bug in the utf-16 decoder.  Patch by
++  Serhiy Storchaka.
++
++- Issue #15368: An issue that caused bytecode generation to be
++  non-deterministic when using randomized hashing (-R) has been fixed.
++
++- Issue #15033: Fix the exit status bug when modules invoked using -m swith,
++  return the proper failure return value (1). Patch contributed by Jeff Knupp.
++
++- Issue #12268: File readline, readlines and read() methods no longer lose
++  data when an underlying read system call is interrupted.  IOError is no
++  longer raised due to a read system call returning EINTR from within these
++  methods.
++
++- Issue #13512: Create ~/.pypirc securely (CVE-2011-4944).  Initial patch by
++  Philip Jenvey, tested by Mageia and Debian.
++
++- Issue #7719: Make distutils ignore ``.nfs*`` files instead of choking later
++  on.  Initial patch by SilentGhost and Jeff Ramnani.
++
++- Issue #10053: Don't close FDs when FileIO.__init__ fails. Loosely based on
++  the work by Hirokazu Yamamoto.
++
++- Issue #14775: Fix a potential quadratic dict build-up due to the garbage
++  collector repeatedly trying to untrack dicts.
++
++- Issue #14494: Fix __future__.py and its documentation to note that
++  absolute imports are the default behavior in 3.0 instead of 2.7.
++  Patch by Sven Marnach.
++
++- Issue #14761: Fix potential leak on an error case in the import machinery.
++
++- Issue #14699: Fix calling the classmethod descriptor directly.
++
++- Issue #11603 (again): Setting __repr__ to __str__ now raises a RuntimeError
++  when repr() or str() is called on such an object.
++
++- Issue #14658: Fix binding a special method to a builtin implementation of a
++  special method with a different name.
++
++- Issue #14612: Fix jumping around with blocks by setting f_lineno.
++
++- Issue #13889: Check and (if necessary) set FPU control word before calling
++  any of the dtoa.c string <-> float conversion functions, on MSVC builds of
++  Python.  This fixes issues when embedding Python in a Delphi app.
++
++- Issue #14505: Fix file descriptor leak when deallocating file objects
++  created with PyFile_FromString().
++
++- Issue #14474: Save and restore exception state in thread.start_new_thread()
++  while writing error message if the thread leaves a unhandled exception.
++
++- Issue #13019: Fix potential reference leaks in bytearray.extend().  Patch
++  by Suman Saha.
++
++- Issue #14378: Fix compiling ast.ImportFrom nodes with a "__future__" string as
++  the module name that was not interned.
++
++- Issue #14331: Use significantly less stack space when importing modules by
++  allocating path buffers on the heap instead of the stack.
++
++- Issue #14334: Prevent in a segfault in type.__getattribute__ when it was not
++  passed strings. Also fix segfaults in the __getattribute__ and __setattr__
++  methods of old-style classes.
++
++- Issue #14161: fix the __repr__ of file objects to escape the file name.
++
++- Issue #1469629: Allow cycles through an object's __dict__ slot to be
++  collected. (For example if ``x.__dict__ is x``).
++
++- Issue #13521: dict.setdefault() now does only one lookup for the given key,
++  making it "atomic" for many purposes.  Patch by Filip GruszczyÅ„ski.
++
++- Issue #10538: When using the "s*" code with PyArg_ParseTuple() to fill a
++  Py_buffer structure with data from an object supporting only the old
++  PyBuffer interface, a reference to the source objects is now properly added
++  to the Py_buffer.obj member.
+ 
+ Library
+ -------
+ 
++- Issue #11062: Fix adding a message from file to Babyl mailbox.
++
++- Issue #15646: Prevent equivalent of a fork bomb when using
++  multiprocessing on Windows without the "if __name__ == '__main__'"
++  idiom.
++
++- Issue #15567: Fix NameError when running threading._test
++
++- Issue #15424: Add a __sizeof__ implementation for array objects.
++  Patch by Ludwig HÃ¤hne.
++
++- Issue #13052: Fix IDLE crashing when replace string in Search/Replace dialog
++  ended with '\'. Patch by Roger Serwy.
++
++- Issue #15538: Fix compilation of the getnameinfo() / getaddrinfo()
++  emulation code.  Patch by Philipp Hagemeister.
++
++- Issue #9803: Don't close IDLE on saving if breakpoint is open.
++  Patch by Roger Serwy.
++
++- Issue #12288: Consider '0' and '0.0' as valid initialvalue
++  for tkinter SimpleDialog.
++
++- Issue #15489: Add a __sizeof__ implementation for BytesIO objects.
++  Patch by Serhiy Storchaka.
++
++- Issue #15469: Add a __sizeof__ implementation for deque objects.
++  Patch by Serhiy Storchaka.
++
++- Issue #15487: Add a __sizeof__ implementation for buffered I/O objects.
++  Patch by Serhiy Storchaka.
++
++- Issue #15512: Add a __sizeof__ implementation for parser.
++  Patch by Serhiy Storchaka.
++
++- Issue #15402: An issue in the struct module that caused sys.getsizeof to
++  return incorrect results for struct.Struct instances has been fixed.
++  Initial patch by Serhiy Storchaka.
++
++- Issue #15232: when mangle_from is True, email.Generator now correctly mangles
++  lines that start with 'From ' that occur in a MIME preamble or epilog.
++
++- Issue #13922: argparse no longer incorrectly strips '--'s that appear
++  after the first one.
++
++- Issue #12353: argparse now correctly handles null argument values.
++
++- Issue #6493: An issue in ctypes on Windows that caused structure bitfields
++  of type ctypes.c_uint32 and width 32 to incorrectly be set has been fixed.
++
++- Issue #14635: telnetlib will use poll() rather than select() when possible
++  to avoid failing due to the select() file descriptor limit.
++
++- Issue #15247: FileIO now raises an error when given a file descriptor
++  pointing to a directory.
++
++- Issue #14591: Fix bug in Random.jumpahead that could produce an invalid
++  Mersenne Twister state on 64-bit machines.
++
++- Issue #5346: Preserve permissions of mbox, MMDF and Babyl mailbox
++  files on flush().
++
++- Issue #15219: Fix a reference leak when hashlib.new() is called with
++  invalid parameters.
++
++- Issue #9559: If messages were only added, a new file is no longer
++  created and renamed over the old file when flush() is called on an
++  mbox, MMDF or Babyl mailbox.
++
++- Issue #14653: email.utils.mktime_tz() no longer relies on system
++  mktime() when timezone offest is supplied.
++
++- Issue #6056: Make multiprocessing use setblocking(True) on the
++  sockets it uses.  Original patch by J Derek Wilson.
++
++- Issue #15101: Make pool finalizer avoid joining current thread.
++
++- Issue #15054: A bug in tokenize.tokenize that caused string literals
++  with 'b' and 'br' prefixes to be incorrectly tokenized has been fixed.
++  Patch by Serhiy Storchaka.
++
++- Issue #15036: Mailbox no longer throws an error if a flush is done
++  between operations when removing or changing multiple items in mbox,
++  MMDF, or Babyl mailboxes.
++
++- Issue #10133: Make multiprocessing deallocate buffer if socket read
++  fails.  Patch by Hallvard B Furuseth.
++
++- Issue #13854: Make multiprocessing properly handle non-integer
++  non-string argument to SystemExit.
++
++- Issue #12157: Make pool.map() empty iterables correctly.  Initial
++  patch by mouad.
++
++- Issue #14962: Update text coloring in IDLE shell window after changing
++  options.  Patch by Roger Serwy.
++
++- Issue #10997: Prevent a duplicate entry in IDLE's "Recent Files" menu.
++
++- Issue #12510: Attempting to get invalid tooltip no longer closes Idle.
++  Original patch by Roger Serwy.
++
++- Issue #10365: File open dialog now works instead of crashing
++  even when parent window is closed. Patch by Roger Serwy.
++
++- Issue #14876: Use user-selected font for highlight configuration.
++  Patch by Roger Serwy.
++
++- Issue #14036: Add an additional check to validate that port in urlparse does
++  not go in illegal range and returns None.
++
++- Issue #14888: Fix misbehaviour of the _md5 module when called on data
++  larger than 2**32 bytes.
++
++- Issue #14875: Use float('inf') instead of float('1e66666') in the json module.
++
++- Issue #14572: Prevent build failures with pre-3.5.0 versions of
++  sqlite3, such as was shipped with Centos 5 and Mac OS X 10.4.
++
++- Issue #14426: Correct the Date format in Expires attribute of Set-Cookie
++  Header in Cookie.py.
++
++- Issue #14721: Send proper header, Content-length: 0 when the body is an empty
++  string ''. Initial Patch contributed by Arve Knudsen.
++
++- Issue #14072: Fix parsing of 'tel' URIs in urlparse by making the check for
++  ports stricter.
++
++- Issue #9374: Generic parsing of query and fragment portions of url for any
++  scheme. Supported both by RFC3986 and RFC2396.
++
++- Issue #14798: Fix the functions in pyclbr to raise an ImportError
++  when the first part of a dotted name is not a package. Patch by
++  Xavier de Gaye.
++
++- Issue #14832: fixed the order of the argument references in the error
++  message produced by unittest's assertItemsEqual.
++
++- Issue #14829: Fix bisect issues under 64-bit Windows.
++
++- Issue #14777: tkinter may return undecoded UTF-8 bytes as a string when
++  accessing the Tk clipboard.  Modify clipboad_get() to first request type
++  UTF8_STRING when no specific type is requested in an X11 windowing
++  environment, falling back to the current default type STRING if that fails.
++  Original patch by Thomas Kluyver.
++
++- Issue #12541: Be lenient with quotes around Realm field with HTTP Basic
++  Authentation in urllib2.
++
++- Issue #14662: Prevent shutil failures on OS X when destination does not
++  support chflag operations.  Patch by Hynek Schlawack.
++
++- Issue #14157: Fix time.strptime failing without a year on February 29th.
++  Patch by Hynek Schlawack.
++
++- Issue #14768: os.path.expanduser('~/a') doesn't works correctly when HOME is '/'.
++
++- Issue #13183: Fix pdb skipping frames after hitting a breakpoint and running
++  step.  Patch by Xavier de Gaye.
++
++- Issue #14664: It is now possible to use @unittest.skip{If,Unless} on a
++  test class that doesn't inherit from TestCase (i.e. a mixin).
++
++- Issue #14160: TarFile.extractfile() failed to resolve symbolic links when
++  the links were not located in an archive subdirectory.
++
++- Issue #14638: pydoc now treats non-string __name__ values as if they
++  were missing, instead of raising an error.
++
++- Issue #13684: Fix httplib tunnel issue of infinite loops for certain sites
++  which send EOF without trailing \r\n.
++
++- Issue #14308: Fix an exception when a "dummy" thread is in the threading
++  module's active list after a fork().
++
++- Issue #14538: HTMLParser can now parse correctly start tags that contain
++  a bare '/'.
++
++- Issue #14452: SysLogHandler no longer inserts a UTF-8 BOM into the message.
++
++- Issue #13496: Fix potential overflow in bisect.bisect algorithm when applied
++  to a collection of size > sys.maxsize / 2.
++
++- Issue #14399: zipfile now recognizes that the archive has been modified even
++  if only the comment is changed.  As a consequence of this fix, ZipFile is now
++  a new style class.
++
++- Issue #7978: SocketServer now restarts the select() call when EINTR is
++  returned.  This avoids crashing the server loop when a signal is received.
++  Patch by Jerzy Kozera.
++
++- Issue #14409: IDLE now properly executes commands in the Shell window
++  when it cannot read the normal config files on startup and
++  has to use the built-in default key bindings.
++  There was previously a bug in one of the defaults.
++
++- Issue #10340: asyncore - properly handle EINVAL in dispatcher constructor on
++  OSX; avoid to call handle_connect in case of a disconnected socket which
++  was not meant to connect.
++
++- Issue #12757: Fix the skipping of doctests when python is run with -OO so
++  that it works in unittest's verbose mode as well as non-verbose mode.
++
++- Issue #3573: IDLE hangs when passing invalid command line args
++  (directory(ies) instead of file(s)) (Patch by Guilherme Polo)
++
++- Issue #13694: asynchronous connect in asyncore.dispatcher does not set addr
++  attribute.
++
++- Issue #10484: Fix the CGIHTTPServer's PATH_INFO handling problem.
++
++- Issue #11199: Fix the with urllib which hangs on particular ftp urls.
++
++- Issue #5219: Prevent event handler cascade in IDLE.
++
++- Issue #14252: Fix subprocess.Popen.terminate() to not raise an error under
++  Windows when the child process has already exited.
++
++- Issue #14195: An issue that caused weakref.WeakSet instances to incorrectly
++  return True for a WeakSet instance 'a' in both 'a < a' and 'a > a' has been
++  fixed.
++
++- Issue #14159: Fix the len() of weak sets to return a better approximation
++  when some objects are dead or dying.  Moreover, the implementation is now
++  O(1) rather than O(n).
++
++- Issue #2945: Make the distutils upload command aware of bdist_rpm products.
++
++- Issue #13447: Add a test file to host regression tests for bugs in the
++  scripts found in the Tools directory.
++
+ - Issue #6884: Fix long-standing bugs with MANIFEST.in parsing in distutils
+   on Windows.
+ 
++Tests
++-----
++
++- Issue #15496: Add directory removal helpers for tests on Windows.
++  Patch by Jeremy Kloth.
++
++- Issue #15043: test_gdb is now skipped entirely if gdb security settings
++  block loading of the gdb hooks
++
++- Issue #14589: Update certificate chain for sha256.tbs-internet.com, fixing
++  a test failure in test_ssl.
++
++Build
++-----
++
++- Issue #15560: Fix building _sqlite3 extension on OS X with an SDK.
++
++- Issue #8847: Disable COMDAT folding in Windows PGO builds.
++
++- Issue #14018: Fix OS X Tcl/Tk framework checking when using OS X SDKs.
++
++- Issue #8767: Restore building with --disable-unicode.
++  Patch by Stefano Taschini.
++
++- Build against bzip2 1.0.6 and openssl 0.9.8x on Windows.
++
++- Issue #14557: Fix extensions build on HP-UX. Patch by Adi Roiban.
++
++- Issue #14437: Fix building the _io module under Cygwin.
++
++Documentation
++-------------
++
++- Issue #15630: Add an example for "continue" stmt in the tutorial. Patch by
++  Daniel Ellis.
++
++- Issue #13557: Clarify effect of giving two different namespaces to exec or
++  execfile().
++
++- Issue #14034: added the argparse tutorial.
++
++- Issue #15250: Document that filecmp.dircmp compares files shallowly. Patch
++  contributed by Chris Jerdonek.
++
+ 
+ What's New in Python 2.7.3 release candidate 2?
+ ===============================================
+@@ -498,6 +856,10 @@
+ Extension Modules
+ -----------------
+ 
++- Issue #9041: An issue in ctypes.c_longdouble, ctypes.c_double, and
++  ctypes.c_float that caused an incorrect exception to be returned in the
++  case of overflow has been fixed.
++
+ - bsddb module: Erratic behaviour of "DBEnv->rep_elect()" because a typo.
+   Possible crash.
+ 
+@@ -572,6 +934,9 @@
+ Tests
+ -----
+ 
++- Issue #15467: Move helpers for __sizeof__ tests into test_support.
++  Patch by Serhiy Storchaka.
++
+ - Issue #11689: Fix a variable scoping error in an sqlite3 test.
+   Initial patch by Torsten Landschoff.
+ 
+@@ -624,7 +989,8 @@
+ Documentation
+ -------------
+ 
+-- Issue #13995: Fix errors in sqlite3's Cursor.rowcount documentation
++- Issues #13491 and #13995: Fix many errors in sqlite3 documentation.
++  Initial patch for #13491 by Johannes Vogel.
+ 
+ - Issue #13402: Document absoluteness of sys.executable.
+ 
+diff -r 70274d53c1dd Misc/README.OpenBSD
+--- a/Misc/README.OpenBSD
++++ b/Misc/README.OpenBSD
+@@ -29,7 +29,7 @@
+ 
+ If your version is not in that list, e.g., 3.9, add the version
+ number.  In this case, you would just need to add a 9 after the 8.
+-If you modify configure.in, you will need to regenerate configure
++If you modify configure.ac, you will need to regenerate configure
+ with autoconf.
+ 
+ If your version is already in the list, this is not a known problem.
+diff -r 70274d53c1dd Misc/python.man
+--- a/Misc/python.man
++++ b/Misc/python.man
+@@ -459,7 +459,7 @@
+ .br
+ Documentation:  http://docs.python.org/
+ .br
+-Developer resources:  http://www.python.org/dev/
++Developer resources:  http://docs.python.org/devguide/
+ .br
+ Downloads:  http://python.org/download/
+ .br
+diff -r 70274d53c1dd Modules/_bisectmodule.c
+--- a/Modules/_bisectmodule.c
++++ b/Modules/_bisectmodule.c
+@@ -21,7 +21,10 @@
+             return -1;
+     }
+     while (lo < hi) {
+-        mid = (lo + hi) / 2;
++        /* The (size_t)cast ensures that the addition and subsequent division
++           are performed as unsigned operations, avoiding difficulties from
++           signed overflow.  (See issue 13496.) */
++        mid = ((size_t)lo + hi) / 2;
+         litem = PySequence_GetItem(list, mid);
+         if (litem == NULL)
+             return -1;
+@@ -56,7 +59,8 @@
+ }
+ 
+ PyDoc_STRVAR(bisect_right_doc,
+-"bisect_right(a, x[, lo[, hi]]) -> index\n\
++"bisect(a, x[, lo[, hi]]) -> index\n\
++bisect_right(a, x[, lo[, hi]]) -> index\n\
+ \n\
+ Return the index where to insert item x in list a, assuming a is sorted.\n\
+ \n\
+@@ -97,7 +101,8 @@
+ }
+ 
+ PyDoc_STRVAR(insort_right_doc,
+-"insort_right(a, x[, lo[, hi]])\n\
++"insort(a, x[, lo[, hi]])\n\
++insort_right(a, x[, lo[, hi]])\n\
+ \n\
+ Insert item x in list a, and keep it sorted assuming a is sorted.\n\
+ \n\
+@@ -122,7 +127,10 @@
+             return -1;
+     }
+     while (lo < hi) {
+-        mid = (lo + hi) / 2;
++        /* The (size_t)cast ensures that the addition and subsequent division
++           are performed as unsigned operations, avoiding difficulties from
++           signed overflow.  (See issue 13496.) */
++        mid = ((size_t)lo + hi) / 2;
+         litem = PySequence_GetItem(list, mid);
+         if (litem == NULL)
+             return -1;
+@@ -187,7 +195,7 @@
+         if (PyList_Insert(list, index, item) < 0)
+             return NULL;
+     } else {
+-        result = PyObject_CallMethod(list, "insert", "iO",
++        result = PyObject_CallMethod(list, "insert", "nO",
+                                      index, item);
+         if (result == NULL)
+             return NULL;
+@@ -207,18 +215,15 @@
+ Optional args lo (default 0) and hi (default len(a)) bound the\n\
+ slice of a to be searched.\n");
+ 
+-PyDoc_STRVAR(bisect_doc, "Alias for bisect_right().\n");
+-PyDoc_STRVAR(insort_doc, "Alias for insort_right().\n");
+-
+ static PyMethodDef bisect_methods[] = {
+     {"bisect_right", (PyCFunction)bisect_right,
+         METH_VARARGS|METH_KEYWORDS, bisect_right_doc},
+     {"bisect", (PyCFunction)bisect_right,
+-        METH_VARARGS|METH_KEYWORDS, bisect_doc},
++        METH_VARARGS|METH_KEYWORDS, bisect_right_doc},
+     {"insort_right", (PyCFunction)insort_right,
+         METH_VARARGS|METH_KEYWORDS, insort_right_doc},
+     {"insort", (PyCFunction)insort_right,
+-        METH_VARARGS|METH_KEYWORDS, insort_doc},
++        METH_VARARGS|METH_KEYWORDS, insort_right_doc},
+     {"bisect_left", (PyCFunction)bisect_left,
+         METH_VARARGS|METH_KEYWORDS, bisect_left_doc},
+     {"insort_left", (PyCFunction)insort_left,
+diff -r 70274d53c1dd Modules/_collectionsmodule.c
+--- a/Modules/_collectionsmodule.c
++++ b/Modules/_collectionsmodule.c
+@@ -991,6 +991,23 @@
+ }
+ 
+ static PyObject *
++deque_sizeof(dequeobject *deque, void *unused)
++{
++    Py_ssize_t res;
++    Py_ssize_t blocks;
++
++    res = sizeof(dequeobject);
++    blocks = (deque->leftindex + deque->len + BLOCKLEN - 1) / BLOCKLEN;
++    assert(deque->leftindex + deque->len - 1 ==
++           (blocks - 1) * BLOCKLEN + deque->rightindex);
++    res += blocks * sizeof(block);
++    return PyLong_FromSsize_t(res);
++}
++
++PyDoc_STRVAR(sizeof_doc,
++"D.__sizeof__() -- size of D in memory, in bytes");
++
++static PyObject *
+ deque_get_maxlen(dequeobject *deque)
+ {
+     if (deque->maxlen == -1)
+@@ -1053,7 +1070,9 @@
+     {"reverse",                 (PyCFunction)deque_reverse,
+         METH_NOARGS,             reverse_doc},
+     {"rotate",                  (PyCFunction)deque_rotate,
+-        METH_VARARGS,           rotate_doc},
++        METH_VARARGS,            rotate_doc},
++    {"__sizeof__",              (PyCFunction)deque_sizeof,
++        METH_NOARGS,             sizeof_doc},
+     {NULL,              NULL}   /* sentinel */
+ };
+ 
+diff -r 70274d53c1dd Modules/_ctypes/cfield.c
+--- a/Modules/_ctypes/cfield.c
++++ b/Modules/_ctypes/cfield.c
+@@ -431,12 +431,8 @@
+ #define LOW_BIT(x)  ((x) & 0xFFFF)
+ #define NUM_BITS(x) ((x) >> 16)
+ 
+-/* This seems nore a compiler issue than a Windows/non-Windows one */
+-#ifdef MS_WIN32
+-#  define BIT_MASK(size) ((1 << NUM_BITS(size))-1)
+-#else
+-#  define BIT_MASK(size) ((1LL << NUM_BITS(size))-1)
+-#endif
++/* Doesn't work if NUM_BITS(size) == 0, but it never happens in SET() call. */
++#define BIT_MASK(type, size) (((((type)1 << (NUM_BITS(size) - 1)) - 1) << 1) + 1)
+ 
+ /* This macro CHANGES the first parameter IN PLACE. For proper sign handling,
+    we must first shift left, then right.
+@@ -448,10 +444,10 @@
+     }
+ 
+ /* This macro RETURNS the first parameter with the bit field CHANGED. */
+-#define SET(x, v, size)                                                 \
++#define SET(type, x, v, size)                                                 \
+     (NUM_BITS(size) ?                                                   \
+-     ( ( x & ~(BIT_MASK(size) << LOW_BIT(size)) ) | ( (v & BIT_MASK(size)) << LOW_BIT(size) ) ) \
+-     : v)
++     ( ( (type)x & ~(BIT_MASK(type, size) << LOW_BIT(size)) ) | ( ((type)v & BIT_MASK(type, size)) << LOW_BIT(size) ) ) \
++     : (type)v)
+ 
+ /* byte swapping macros */
+ #define SWAP_2(v)                               \
+@@ -523,7 +519,7 @@
+     long val;
+     if (get_long(value, &val) < 0)
+         return NULL;
+-    *(signed char *)ptr = (signed char)SET(*(signed char *)ptr, (signed char)val, size);
++    *(signed char *)ptr = SET(signed char, *(signed char *)ptr, val, size);
+     _RET(value);
+ }
+ 
+@@ -542,8 +538,7 @@
+     unsigned long val;
+     if (get_ulong(value, &val) < 0)
+         return NULL;
+-    *(unsigned char *)ptr = (unsigned char)SET(*(unsigned char*)ptr,
+-                                               (unsigned short)val, size);
++    *(unsigned char *)ptr = SET(unsigned char, *(unsigned char*)ptr, val, size);
+     _RET(value);
+ }
+ 
+@@ -564,7 +559,7 @@
+     if (get_long(value, &val) < 0)
+         return NULL;
+     memcpy(&x, ptr, sizeof(x));
+-    x = SET(x, (short)val, size);
++    x = SET(short, x, val, size);
+     memcpy(ptr, &x, sizeof(x));
+     _RET(value);
+ }
+@@ -579,7 +574,7 @@
+         return NULL;
+     memcpy(&field, ptr, sizeof(field));
+     field = SWAP_2(field);
+-    field = SET(field, (short)val, size);
++    field = SET(short, field, val, size);
+     field = SWAP_2(field);
+     memcpy(ptr, &field, sizeof(field));
+     _RET(value);
+@@ -612,7 +607,7 @@
+     if (get_ulong(value, &val) < 0)
+         return NULL;
+     memcpy(&x, ptr, sizeof(x));
+-    x = SET(x, (unsigned short)val, size);
++    x = SET(unsigned short, x, val, size);
+     memcpy(ptr, &x, sizeof(x));
+     _RET(value);
+ }
+@@ -626,7 +621,7 @@
+         return NULL;
+     memcpy(&field, ptr, sizeof(field));
+     field = SWAP_2(field);
+-    field = SET(field, (unsigned short)val, size);
++    field = SET(unsigned short, field, val, size);
+     field = SWAP_2(field);
+     memcpy(ptr, &field, sizeof(field));
+     _RET(value);
+@@ -660,7 +655,7 @@
+     if (get_long(value, &val) < 0)
+         return NULL;
+     memcpy(&x, ptr, sizeof(x));
+-    x = SET(x, (int)val, size);
++    x = SET(int, x, val, size);
+     memcpy(ptr, &x, sizeof(x));
+     _RET(value);
+ }
+@@ -674,7 +669,7 @@
+         return NULL;
+     memcpy(&field, ptr, sizeof(field));
+     field = SWAP_INT(field);
+-    field = SET(field, (int)val, size);
++    field = SET(int, field, val, size);
+     field = SWAP_INT(field);
+     memcpy(ptr, &field, sizeof(field));
+     _RET(value);
+@@ -761,7 +756,7 @@
+     if (get_ulong(value, &val) < 0)
+         return  NULL;
+     memcpy(&x, ptr, sizeof(x));
+-    x = SET(x, (unsigned int)val, size);
++    x = SET(unsigned int, x, val, size);
+     memcpy(ptr, &x, sizeof(x));
+     _RET(value);
+ }
+@@ -774,7 +769,7 @@
+     if (get_ulong(value, &val) < 0)
+         return  NULL;
+     memcpy(&field, ptr, sizeof(field));
+-    field = (unsigned int)SET(field, (unsigned int)val, size);
++    field = SET(unsigned int, field, (unsigned int)val, size);
+     field = SWAP_INT(field);
+     memcpy(ptr, &field, sizeof(field));
+     _RET(value);
+@@ -808,7 +803,7 @@
+     if (get_long(value, &val) < 0)
+         return NULL;
+     memcpy(&x, ptr, sizeof(x));
+-    x = SET(x, val, size);
++    x = SET(long, x, val, size);
+     memcpy(ptr, &x, sizeof(x));
+     _RET(value);
+ }
+@@ -822,7 +817,7 @@
+         return NULL;
+     memcpy(&field, ptr, sizeof(field));
+     field = SWAP_LONG(field);
+-    field = (long)SET(field, val, size);
++    field = SET(long, field, val, size);
+     field = SWAP_LONG(field);
+     memcpy(ptr, &field, sizeof(field));
+     _RET(value);
+@@ -856,7 +851,7 @@
+     if (get_ulong(value, &val) < 0)
+         return  NULL;
+     memcpy(&x, ptr, sizeof(x));
+-    x = SET(x, val, size);
++    x = SET(unsigned long, x, val, size);
+     memcpy(ptr, &x, sizeof(x));
+     _RET(value);
+ }
+@@ -870,7 +865,7 @@
+         return  NULL;
+     memcpy(&field, ptr, sizeof(field));
+     field = SWAP_LONG(field);
+-    field = (unsigned long)SET(field, val, size);
++    field = SET(unsigned long, field, val, size);
+     field = SWAP_LONG(field);
+     memcpy(ptr, &field, sizeof(field));
+     _RET(value);
+@@ -905,7 +900,7 @@
+     if (get_longlong(value, &val) < 0)
+         return NULL;
+     memcpy(&x, ptr, sizeof(x));
+-    x = SET(x, val, size);
++    x = SET(PY_LONG_LONG, x, val, size);
+     memcpy(ptr, &x, sizeof(x));
+     _RET(value);
+ }
+@@ -919,7 +914,7 @@
+         return NULL;
+     memcpy(&field, ptr, sizeof(field));
+     field = SWAP_8(field);
+-    field = (PY_LONG_LONG)SET(field, val, size);
++    field = SET(PY_LONG_LONG, field, val, size);
+     field = SWAP_8(field);
+     memcpy(ptr, &field, sizeof(field));
+     _RET(value);
+@@ -952,7 +947,7 @@
+     if (get_ulonglong(value, &val) < 0)
+         return NULL;
+     memcpy(&x, ptr, sizeof(x));
+-    x = SET(x, val, size);
++    x = SET(PY_LONG_LONG, x, val, size);
+     memcpy(ptr, &x, sizeof(x));
+     _RET(value);
+ }
+@@ -966,7 +961,7 @@
+         return NULL;
+     memcpy(&field, ptr, sizeof(field));
+     field = SWAP_8(field);
+-    field = (unsigned PY_LONG_LONG)SET(field, val, size);
++    field = SET(unsigned PY_LONG_LONG, field, val, size);
+     field = SWAP_8(field);
+     memcpy(ptr, &field, sizeof(field));
+     _RET(value);
+@@ -1003,12 +998,8 @@
+     long double x;
+ 
+     x = PyFloat_AsDouble(value);
+-    if (x == -1 && PyErr_Occurred()) {
+-        PyErr_Format(PyExc_TypeError,
+-                     " float expected instead of %s instance",
+-                     value->ob_type->tp_name);
++    if (x == -1 && PyErr_Occurred())
+         return NULL;
+-    }
+     memcpy(ptr, &x, sizeof(long double));
+     _RET(value);
+ }
+@@ -1027,12 +1018,8 @@
+     double x;
+ 
+     x = PyFloat_AsDouble(value);
+-    if (x == -1 && PyErr_Occurred()) {
+-        PyErr_Format(PyExc_TypeError,
+-                     " float expected instead of %s instance",
+-                     value->ob_type->tp_name);
++    if (x == -1 && PyErr_Occurred())
+         return NULL;
+-    }
+     memcpy(ptr, &x, sizeof(double));
+     _RET(value);
+ }
+@@ -1051,12 +1038,8 @@
+     double x;
+ 
+     x = PyFloat_AsDouble(value);
+-    if (x == -1 && PyErr_Occurred()) {
+-        PyErr_Format(PyExc_TypeError,
+-                     " float expected instead of %s instance",
+-                     value->ob_type->tp_name);
++    if (x == -1 && PyErr_Occurred())
+         return NULL;
+-    }
+ #ifdef WORDS_BIGENDIAN
+     if (_PyFloat_Pack8(x, (unsigned char *)ptr, 1))
+         return NULL;
+@@ -1083,12 +1066,8 @@
+     float x;
+ 
+     x = (float)PyFloat_AsDouble(value);
+-    if (x == -1 && PyErr_Occurred()) {
+-        PyErr_Format(PyExc_TypeError,
+-                     " float expected instead of %s instance",
+-                     value->ob_type->tp_name);
++    if (x == -1 && PyErr_Occurred())
+         return NULL;
+-    }
+     memcpy(ptr, &x, sizeof(x));
+     _RET(value);
+ }
+@@ -1107,12 +1086,8 @@
+     float x;
+ 
+     x = (float)PyFloat_AsDouble(value);
+-    if (x == -1 && PyErr_Occurred()) {
+-        PyErr_Format(PyExc_TypeError,
+-                     " float expected instead of %s instance",
+-                     value->ob_type->tp_name);
++    if (x == -1 && PyErr_Occurred())
+         return NULL;
+-    }
+ #ifdef WORDS_BIGENDIAN
+     if (_PyFloat_Pack4(x, (unsigned char *)ptr, 1))
+         return NULL;
+diff -r 70274d53c1dd Modules/_hashopenssl.c
+--- a/Modules/_hashopenssl.c
++++ b/Modules/_hashopenssl.c
+@@ -477,6 +477,7 @@
+     }
+ 
+     if (!PyArg_Parse(name_obj, "s", &name)) {
++        PyBuffer_Release(&view);
+         PyErr_SetString(PyExc_TypeError, "name must be a string");
+         return NULL;
+     }
+diff -r 70274d53c1dd Modules/_io/_iomodule.c
+--- a/Modules/_io/_iomodule.c
++++ b/Modules/_io/_iomodule.c
+@@ -58,7 +58,7 @@
+ "\n"
+ "At the top of the I/O hierarchy is the abstract base class IOBase. It\n"
+ "defines the basic interface to a stream. Note, however, that there is no\n"
+-"seperation between reading and writing to streams; implementations are\n"
++"separation between reading and writing to streams; implementations are\n"
+ "allowed to throw an IOError if they do not support a given operation.\n"
+ "\n"
+ "Extending IOBase is RawIOBase which deals simply with the reading and\n"
+diff -r 70274d53c1dd Modules/_io/_iomodule.h
+--- a/Modules/_io/_iomodule.h
++++ b/Modules/_io/_iomodule.h
+@@ -72,7 +72,7 @@
+     PyObject *filename; /* Not used, but part of the IOError object */
+     Py_ssize_t written;
+ } PyBlockingIOErrorObject;
+-PyAPI_DATA(PyObject *) PyExc_BlockingIOError;
++extern PyObject *PyExc_BlockingIOError;
+ 
+ /*
+  * Offset type for positioning.
+diff -r 70274d53c1dd Modules/_io/bufferedio.c
+--- a/Modules/_io/bufferedio.c
++++ b/Modules/_io/bufferedio.c
+@@ -386,6 +386,17 @@
+     Py_TYPE(self)->tp_free((PyObject *)self);
+ }
+ 
++static PyObject *
++buffered_sizeof(buffered *self, void *unused)
++{
++    Py_ssize_t res;
++
++    res = sizeof(buffered);
++    if (self->buffer)
++        res += self->buffer_size;
++    return PyLong_FromSsize_t(res);
++}
++
+ static int
+ buffered_traverse(buffered *self, visitproc visit, void *arg)
+ {
+@@ -1560,6 +1571,7 @@
+     {"seek", (PyCFunction)buffered_seek, METH_VARARGS},
+     {"tell", (PyCFunction)buffered_tell, METH_NOARGS},
+     {"truncate", (PyCFunction)buffered_truncate, METH_VARARGS},
++    {"__sizeof__", (PyCFunction)buffered_sizeof, METH_NOARGS},
+     {NULL, NULL}
+ };
+ 
+@@ -1952,6 +1964,7 @@
+     {"flush", (PyCFunction)buffered_flush, METH_NOARGS},
+     {"seek", (PyCFunction)buffered_seek, METH_VARARGS},
+     {"tell", (PyCFunction)buffered_tell, METH_NOARGS},
++    {"__sizeof__", (PyCFunction)buffered_sizeof, METH_NOARGS},
+     {NULL, NULL}
+ };
+ 
+@@ -2347,6 +2360,7 @@
+     {"readline", (PyCFunction)buffered_readline, METH_VARARGS},
+     {"peek", (PyCFunction)buffered_peek, METH_VARARGS},
+     {"write", (PyCFunction)bufferedwriter_write, METH_VARARGS},
++    {"__sizeof__", (PyCFunction)buffered_sizeof, METH_NOARGS},
+     {NULL, NULL}
+ };
+ 
+diff -r 70274d53c1dd Modules/_io/bytesio.c
+--- a/Modules/_io/bytesio.c
++++ b/Modules/_io/bytesio.c
+@@ -794,6 +794,17 @@
+     return 0;
+ }
+ 
++static PyObject *
++bytesio_sizeof(bytesio *self, void *unused)
++{
++    Py_ssize_t res;
++
++    res = sizeof(bytesio);
++    if (self->buf)
++        res += self->buf_size;
++    return PyLong_FromSsize_t(res);
++}
++
+ static int
+ bytesio_traverse(bytesio *self, visitproc visit, void *arg)
+ {
+@@ -835,6 +846,7 @@
+     {"truncate",   (PyCFunction)bytesio_truncate,   METH_VARARGS, truncate_doc},
+     {"__getstate__",  (PyCFunction)bytesio_getstate,  METH_NOARGS, NULL},
+     {"__setstate__",  (PyCFunction)bytesio_setstate,  METH_O, NULL},
++    {"__sizeof__", (PyCFunction)bytesio_sizeof,     METH_NOARGS, NULL},
+     {NULL, NULL}        /* sentinel */
+ };
+ 
+diff -r 70274d53c1dd Modules/_io/fileio.c
+--- a/Modules/_io/fileio.c
++++ b/Modules/_io/fileio.c
+@@ -137,22 +137,15 @@
+    directories, so we need a check.  */
+ 
+ static int
+-dircheck(fileio* self, const char *name)
++dircheck(fileio* self, PyObject *nameobj)
+ {
+ #if defined(HAVE_FSTAT) && defined(S_IFDIR) && defined(EISDIR)
+     struct stat buf;
+     if (self->fd < 0)
+         return 0;
+     if (fstat(self->fd, &buf) == 0 && S_ISDIR(buf.st_mode)) {
+-        char *msg = strerror(EISDIR);
+-        PyObject *exc;
+-        if (internal_close(self))
+-            return -1;
+-
+-        exc = PyObject_CallFunction(PyExc_IOError, "(iss)",
+-                                    EISDIR, msg, name);
+-        PyErr_SetObject(PyExc_IOError, exc);
+-        Py_XDECREF(exc);
++        errno = EISDIR;
++        PyErr_SetFromErrnoWithFilenameObject(PyExc_IOError, nameobj);
+         return -1;
+     }
+ #endif
+@@ -195,12 +188,17 @@
+     int flags = 0;
+     int fd = -1;
+     int closefd = 1;
++    int fd_is_own = 0;
+ 
+     assert(PyFileIO_Check(oself));
+     if (self->fd >= 0) {
+-        /* Have to close the existing file first. */
+-        if (internal_close(self) < 0)
+-            return -1;
++        if (self->closefd) {
++            /* Have to close the existing file first. */
++            if (internal_close(self) < 0)
++                return -1;
++        }
++        else
++            self->fd = -1;
+     }
+ 
+     if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|si:fileio",
+@@ -341,6 +339,7 @@
+ #endif
+             self->fd = open(name, flags, 0666);
+         Py_END_ALLOW_THREADS
++        fd_is_own = 1;
+         if (self->fd < 0) {
+ #ifdef MS_WINDOWS
+             if (widename != NULL)
+@@ -350,9 +349,9 @@
+                 PyErr_SetFromErrnoWithFilename(PyExc_IOError, name);
+             goto error;
+         }
+-        if(dircheck(self, name) < 0)
+-            goto error;
+     }
++    if (dircheck(self, nameobj) < 0)
++        goto error;
+ 
+     if (PyObject_SetAttrString((PyObject *)self, "name", nameobj) < 0)
+         goto error;
+@@ -362,19 +361,17 @@
+            end of file (otherwise, it might be done only on the
+            first write()). */
+         PyObject *pos = portable_lseek(self->fd, NULL, 2);
+-        if (pos == NULL) {
+-            if (closefd) {
+-                close(self->fd);
+-                self->fd = -1;
+-            }
++        if (pos == NULL)
+             goto error;
+-        }
+         Py_DECREF(pos);
+     }
+ 
+     goto done;
+ 
+  error:
++    if (!fd_is_own)
++        self->fd = -1;
++
+     ret = -1;
+ 
+  done:
+diff -r 70274d53c1dd Modules/_io/textio.c
+--- a/Modules/_io/textio.c
++++ b/Modules/_io/textio.c
+@@ -622,15 +622,22 @@
+     "errors determines the strictness of encoding and decoding (see the\n"
+     "codecs.register) and defaults to \"strict\".\n"
+     "\n"
+-    "newline can be None, '', '\\n', '\\r', or '\\r\\n'.  It controls the\n"
+-    "handling of line endings. If it is None, universal newlines is\n"
+-    "enabled.  With this enabled, on input, the lines endings '\\n', '\\r',\n"
+-    "or '\\r\\n' are translated to '\\n' before being returned to the\n"
+-    "caller. Conversely, on output, '\\n' is translated to the system\n"
+-    "default line seperator, os.linesep. If newline is any other of its\n"
+-    "legal values, that newline becomes the newline when the file is read\n"
+-    "and it is returned untranslated. On output, '\\n' is converted to the\n"
+-    "newline.\n"
++    "newline controls how line endings are handled. It can be None, '',\n"
++    "'\\n', '\\r', and '\\r\\n'.  It works as follows:\n"
++    "\n"
++    "* On input, if newline is None, universal newlines mode is\n"
++    "  enabled. Lines in the input can end in '\\n', '\\r', or '\\r\\n', and\n"
++    "  these are translated into '\\n' before being returned to the\n"
++    "  caller. If it is '', universal newline mode is enabled, but line\n"
++    "  endings are returned to the caller untranslated. If it has any of\n"
++    "  the other legal values, input lines are only terminated by the given\n"
++    "  string, and the line ending is returned to the caller untranslated.\n"
++    "\n"
++    "* On output, if newline is None, any '\\n' characters written are\n"
++    "  translated to the system default line separator, os.linesep. If\n"
++    "  newline is '', no translation takes place. If newline is any of the\n"
++    "  other legal values, any '\\n' characters written are translated to\n"
++    "  the given string.\n"
+     "\n"
+     "If line_buffering is True, a call to flush is implied when a call to\n"
+     "write contains a newline character."
+diff -r 70274d53c1dd Modules/_json.c
+--- a/Modules/_json.c
++++ b/Modules/_json.c
+@@ -1032,7 +1032,7 @@
+         while (idx <= end_idx) {
+             /* read key */
+             if (str[idx] != '"') {
+-                raise_errmsg("Expecting property name", pystr, idx);
++                raise_errmsg("Expecting property name enclosed in double quotes", pystr, idx);
+                 goto bail;
+             }
+             key = scanstring_unicode(pystr, idx + 1, strict, &next_idx);
+@@ -1043,7 +1043,7 @@
+             /* skip whitespace between key and : delimiter, read :, skip whitespace */
+             while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++;
+             if (idx > end_idx || str[idx] != ':') {
+-                raise_errmsg("Expecting : delimiter", pystr, idx);
++                raise_errmsg("Expecting ':' delimiter", pystr, idx);
+                 goto bail;
+             }
+             idx++;
+@@ -1075,7 +1075,7 @@
+                 break;
+             }
+             else if (str[idx] != ',') {
+-                raise_errmsg("Expecting , delimiter", pystr, idx);
++                raise_errmsg("Expecting ',' delimiter", pystr, idx);
+                 goto bail;
+             }
+             idx++;
+@@ -1236,7 +1236,7 @@
+                 break;
+             }
+             else if (str[idx] != ',') {
+-                raise_errmsg("Expecting , delimiter", pystr, idx);
++                raise_errmsg("Expecting ',' delimiter", pystr, idx);
+                 goto bail;
+             }
+             idx++;
+diff -r 70274d53c1dd Modules/_multiprocessing/socket_connection.c
+--- a/Modules/_multiprocessing/socket_connection.c
++++ b/Modules/_multiprocessing/socket_connection.c
+@@ -117,7 +117,7 @@
+ conn_recv_string(ConnectionObject *conn, char *buffer,
+                  size_t buflength, char **newbuffer, size_t maxlength)
+ {
+-    int res;
++    Py_ssize_t res;
+     UINT32 ulength;
+ 
+     *newbuffer = NULL;
+@@ -132,20 +132,23 @@
+     if (ulength > maxlength)
+         return MP_BAD_MESSAGE_LENGTH;
+ 
+-    if (ulength <= buflength) {
+-        Py_BEGIN_ALLOW_THREADS
+-        res = _conn_recvall(conn->handle, buffer, (size_t)ulength);
+-        Py_END_ALLOW_THREADS
+-        return res < 0 ? res : ulength;
+-    } else {
+-        *newbuffer = PyMem_Malloc((size_t)ulength);
+-        if (*newbuffer == NULL)
++    if (ulength > buflength) {
++        *newbuffer = buffer = PyMem_Malloc((size_t)ulength);
++        if (buffer == NULL)
+             return MP_MEMORY_ERROR;
+-        Py_BEGIN_ALLOW_THREADS
+-        res = _conn_recvall(conn->handle, *newbuffer, (size_t)ulength);
+-        Py_END_ALLOW_THREADS
+-        return res < 0 ? (Py_ssize_t)res : (Py_ssize_t)ulength;
+     }
++
++    Py_BEGIN_ALLOW_THREADS
++    res = _conn_recvall(conn->handle, buffer, (size_t)ulength);
++    Py_END_ALLOW_THREADS
++
++    if (res >= 0) {
++        res = (Py_ssize_t)ulength;
++    } else if (*newbuffer != NULL) {
++        PyMem_Free(*newbuffer);
++        *newbuffer = NULL;
++    }
++    return res;
+ }
+ 
+ /*
+diff -r 70274d53c1dd Modules/_multiprocessing/win32_functions.c
+--- a/Modules/_multiprocessing/win32_functions.c
++++ b/Modules/_multiprocessing/win32_functions.c
+@@ -244,6 +244,7 @@
+     Py_INCREF(&Win32Type);
+ 
+     WIN32_CONSTANT(F_DWORD, ERROR_ALREADY_EXISTS);
++    WIN32_CONSTANT(F_DWORD, ERROR_NO_DATA);
+     WIN32_CONSTANT(F_DWORD, ERROR_PIPE_BUSY);
+     WIN32_CONSTANT(F_DWORD, ERROR_PIPE_CONNECTED);
+     WIN32_CONSTANT(F_DWORD, ERROR_SEM_TIMEOUT);
+diff -r 70274d53c1dd Modules/_randommodule.c
+--- a/Modules/_randommodule.c
++++ b/Modules/_randommodule.c
+@@ -400,7 +400,7 @@
+     long i, j;
+     PyObject *iobj;
+     PyObject *remobj;
+-    unsigned long *mt, tmp;
++    unsigned long *mt, tmp, nonzero;
+ 
+     if (!PyInt_Check(n) && !PyLong_Check(n)) {
+         PyErr_Format(PyExc_TypeError, "jumpahead requires an "
+@@ -427,8 +427,23 @@
+         mt[j] = tmp;
+     }
+ 
+-    for (i = 0; i < N; i++)
++    nonzero = 0;
++    for (i = 1; i < N; i++) {
+         mt[i] += i+1;
++        mt[i] &= 0xffffffffUL; /* for WORDSIZE > 32 machines */
++        nonzero |= mt[i];
++    }
++
++    /* Ensure the state is nonzero: in the unlikely event that mt[1] through
++       mt[N-1] are all zero, set the MSB of mt[0] (see issue #14591). In the
++       normal case, we fall back to the pre-issue 14591 behaviour for mt[0]. */
++    if (nonzero) {
++        mt[0] += 1;
++        mt[0] &= 0xffffffffUL; /* for WORDSIZE > 32 machines */
++    }
++    else {
++        mt[0] = 0x80000000UL;
++    }
+ 
+     self->index = N;
+     Py_INCREF(Py_None);
+diff -r 70274d53c1dd Modules/_sqlite/connection.c
+--- a/Modules/_sqlite/connection.c
++++ b/Modules/_sqlite/connection.c
+@@ -549,7 +549,7 @@
+     } else if (py_val == Py_None) {
+         sqlite3_result_null(context);
+     } else if (PyInt_Check(py_val)) {
+-        sqlite3_result_int64(context, (sqlite3_int64)PyInt_AsLong(py_val));
++        sqlite3_result_int64(context, (sqlite_int64)PyInt_AsLong(py_val));
+     } else if (PyLong_Check(py_val)) {
+         sqlite3_result_int64(context, PyLong_AsLongLong(py_val));
+     } else if (PyFloat_Check(py_val)) {
+@@ -580,7 +580,7 @@
+     sqlite3_value* cur_value;
+     PyObject* cur_py_value;
+     const char* val_str;
+-    sqlite3_int64 val_int;
++    sqlite_int64 val_int;
+     Py_ssize_t buflen;
+     void* raw_buffer;
+ 
+diff -r 70274d53c1dd Modules/_struct.c
+--- a/Modules/_struct.c
++++ b/Modules/_struct.c
+@@ -1693,6 +1693,18 @@
+     return PyInt_FromSsize_t(self->s_size);
+ }
+ 
++PyDoc_STRVAR(s_sizeof__doc__,
++"S.__sizeof__() -> size of S in memory, in bytes");
++
++static PyObject *
++s_sizeof(PyStructObject *self, void *unused)
++{
++    Py_ssize_t size;
++
++    size = sizeof(PyStructObject) + sizeof(formatcode) * (self->s_len + 1);
++    return PyLong_FromSsize_t(size);
++}
++
+ /* List of functions */
+ 
+ static struct PyMethodDef s_methods[] = {
+@@ -1701,6 +1713,7 @@
+     {"unpack",          s_unpack,       METH_O, s_unpack__doc__},
+     {"unpack_from",     (PyCFunction)s_unpack_from, METH_VARARGS|METH_KEYWORDS,
+                     s_unpack_from__doc__},
++    {"__sizeof__",      (PyCFunction)s_sizeof, METH_NOARGS, s_sizeof__doc__},
+     {NULL,       NULL}          /* sentinel */
+ };
+ 
+diff -r 70274d53c1dd Modules/arraymodule.c
+--- a/Modules/arraymodule.c
++++ b/Modules/arraymodule.c
+@@ -1533,6 +1533,19 @@
+ PyDoc_STRVAR(reduce_doc, "Return state information for pickling.");
+ 
+ static PyObject *
++array_sizeof(arrayobject *self, PyObject *unused)
++{
++    Py_ssize_t res;
++    res = sizeof(arrayobject) + self->allocated * self->ob_descr->itemsize;
++    return PyLong_FromSsize_t(res);
++}
++
++PyDoc_STRVAR(sizeof_doc,
++"__sizeof__() -> int\n\
++\n\
++Size of the array in memory, in bytes.");
++
++static PyObject *
+ array_get_typecode(arrayobject *a, void *closure)
+ {
+     char tc = a->ob_descr->typecode;
+@@ -1606,6 +1619,8 @@
+ #endif
+     {"write",           (PyCFunction)array_tofile_as_write,     METH_O,
+      tofile_doc},
++    {"__sizeof__",      (PyCFunction)array_sizeof,      METH_NOARGS,
++     sizeof_doc},
+     {NULL,              NULL}           /* sentinel */
+ };
+ 
+diff -r 70274d53c1dd Modules/errnomodule.c
+--- a/Modules/errnomodule.c
++++ b/Modules/errnomodule.c
+@@ -783,6 +783,9 @@
+ #ifdef WSAN
+     inscode(d, ds, de, "WSAN", WSAN, "Error WSAN");
+ #endif
++#ifdef ENOTSUP
++    inscode(d, ds, de, "ENOTSUP", ENOTSUP, "Operation not supported");
++#endif
+ 
+     Py_DECREF(de);
+ }
+diff -r 70274d53c1dd Modules/gcmodule.c
+--- a/Modules/gcmodule.c
++++ b/Modules/gcmodule.c
+@@ -111,6 +111,46 @@
+     http://mail.python.org/pipermail/python-dev/2008-June/080579.html
+ */
+ 
++/*
++   NOTE: about untracking of mutable objects.
++   
++   Certain types of container cannot participate in a reference cycle, and
++   so do not need to be tracked by the garbage collector. Untracking these
++   objects reduces the cost of garbage collections. However, determining
++   which objects may be untracked is not free, and the costs must be
++   weighed against the benefits for garbage collection.
++
++   There are two possible strategies for when to untrack a container:
++
++   i) When the container is created.
++   ii) When the container is examined by the garbage collector.
++
++   Tuples containing only immutable objects (integers, strings etc, and
++   recursively, tuples of immutable objects) do not need to be tracked.
++   The interpreter creates a large number of tuples, many of which will
++   not survive until garbage collection. It is therefore not worthwhile
++   to untrack eligible tuples at creation time.
++
++   Instead, all tuples except the empty tuple are tracked when created. 
++   During garbage collection it is determined whether any surviving tuples 
++   can be untracked. A tuple can be untracked if all of its contents are 
++   already not tracked. Tuples are examined for untracking in all garbage 
++   collection cycles. It may take more than one cycle to untrack a tuple.
++
++   Dictionaries containing only immutable objects also do not need to be
++   tracked. Dictionaries are untracked when created. If a tracked item is
++   inserted into a dictionary (either as a key or value), the dictionary
++   becomes tracked. During a full garbage collection (all generations),
++   the collector will untrack any dictionaries whose contents are not
++   tracked.
++
++   The module provides the python function is_tracked(obj), which returns
++   the CURRENT tracking status of the object. Subsequent garbage
++   collections may change the tracking status of the object.
++   
++   Untracking of certain containers was introduced in issue #4688, and 
++   the algorithm was refined in response to issue #14775.
++*/
+ 
+ /* set for debugging information */
+ #define DEBUG_STATS             (1<<0) /* print collection statistics */
+@@ -436,9 +476,6 @@
+             if (PyTuple_CheckExact(op)) {
+                 _PyTuple_MaybeUntrack(op);
+             }
+-            else if (PyDict_CheckExact(op)) {
+-                _PyDict_MaybeUntrack(op);
+-            }
+         }
+         else {
+             /* This *may* be unreachable.  To make progress,
+@@ -478,6 +515,20 @@
+         return 0;
+ }
+ 
++/* Try to untrack all currently tracked dictionaries */
++static void
++untrack_dicts(PyGC_Head *head)
++{
++    PyGC_Head *next, *gc = head->gc.gc_next;
++    while (gc != head) {
++        PyObject *op = FROM_GC(gc);
++        next = gc->gc.gc_next;
++        if (PyDict_CheckExact(op))
++            _PyDict_MaybeUntrack(op);
++        gc = next;
++    }
++}
++
+ /* Move the objects in unreachable with __del__ methods into `finalizers`.
+  * Objects moved into `finalizers` have gc_refs set to GC_REACHABLE; the
+  * objects remaining in unreachable are left at GC_TENTATIVELY_UNREACHABLE.
+@@ -890,6 +941,9 @@
+         gc_list_merge(young, old);
+     }
+     else {
++        /* We only untrack dicts in full collections, to avoid quadratic
++           dict build-up. See issue #14775. */
++        untrack_dicts(young);
+         long_lived_pending = 0;
+         long_lived_total = gc_list_size(young);
+     }
+diff -r 70274d53c1dd Modules/getaddrinfo.c
+--- a/Modules/getaddrinfo.c
++++ b/Modules/getaddrinfo.c
+@@ -430,7 +430,7 @@
+                 break;
+ #ifdef ENABLE_IPV6
+             case AF_INET6:
+-                pfx = ((struct in6_addr *)pton)->s6_addr8[0];
++                pfx = ((struct in6_addr *)pton)->s6_addr[0];
+                 if (pfx == 0 || pfx == 0xfe || pfx == 0xff)
+                     pai->ai_flags &= ~AI_CANONNAME;
+                 break;
+diff -r 70274d53c1dd Modules/getnameinfo.c
+--- a/Modules/getnameinfo.c
++++ b/Modules/getnameinfo.c
+@@ -161,7 +161,7 @@
+         break;
+ #ifdef ENABLE_IPV6
+     case AF_INET6:
+-        pfx = ((struct sockaddr_in6 *)sa)->sin6_addr.s6_addr8[0];
++        pfx = ((struct sockaddr_in6 *)sa)->sin6_addr.s6_addr[0];
+         if (pfx == 0 || pfx == 0xfe || pfx == 0xff)
+             flags |= NI_NUMERICHOST;
+         break;
+diff -r 70274d53c1dd Modules/main.c
+--- a/Modules/main.c
++++ b/Modules/main.c
+@@ -583,7 +583,7 @@
+         sts = PyRun_SimpleStringFlags(command, &cf) != 0;
+         free(command);
+     } else if (module) {
+-        sts = RunModule(module, 1);
++        sts = (RunModule(module, 1) != 0);
+         free(module);
+     }
+     else {
+diff -r 70274d53c1dd Modules/md5module.c
+--- a/Modules/md5module.c
++++ b/Modules/md5module.c
+@@ -262,6 +262,8 @@
+ {
+     md5object *md5p;
+     Py_buffer view = { 0 };
++    Py_ssize_t n;
++    unsigned char *buf;
+ 
+     if (!PyArg_ParseTuple(args, "|s*:new", &view))
+         return NULL;
+@@ -271,9 +273,18 @@
+         return NULL;
+     }
+ 
+-    if (view.len > 0) {
+-        md5_append(&md5p->md5, (unsigned char*)view.buf,
+-               Py_SAFE_DOWNCAST(view.len, Py_ssize_t, unsigned int));
++    n = view.len;
++    buf = (unsigned char *) view.buf;
++    while (n > 0) {
++        Py_ssize_t nbytes;
++        if (n > INT_MAX)
++            nbytes = INT_MAX;
++        else
++            nbytes = n;
++        md5_append(&md5p->md5, buf,
++                   Py_SAFE_DOWNCAST(nbytes, Py_ssize_t, unsigned int));
++        buf += nbytes;
++        n -= nbytes;
+     }
+     PyBuffer_Release(&view);
+ 
+diff -r 70274d53c1dd Modules/parsermodule.c
+--- a/Modules/parsermodule.c
++++ b/Modules/parsermodule.c
+@@ -169,9 +169,33 @@
+ 
+ 
+ static void parser_free(PyST_Object *st);
++static PyObject* parser_sizeof(PyST_Object *, void *);
+ static int parser_compare(PyST_Object *left, PyST_Object *right);
+ static PyObject *parser_getattr(PyObject *self, char *name);
+-
++static PyObject* parser_compilest(PyST_Object *, PyObject *, PyObject *);
++static PyObject* parser_isexpr(PyST_Object *, PyObject *, PyObject *);
++static PyObject* parser_issuite(PyST_Object *, PyObject *, PyObject *);
++static PyObject* parser_st2list(PyST_Object *, PyObject *, PyObject *);
++static PyObject* parser_st2tuple(PyST_Object *, PyObject *, PyObject *);
++
++#define PUBLIC_METHOD_TYPE (METH_VARARGS|METH_KEYWORDS)
++
++static PyMethodDef
++parser_methods[] = {
++    {"compile",         (PyCFunction)parser_compilest,  PUBLIC_METHOD_TYPE,
++        PyDoc_STR("Compile this ST object into a code object.")},
++    {"isexpr",          (PyCFunction)parser_isexpr,     PUBLIC_METHOD_TYPE,
++        PyDoc_STR("Determines if this ST object was created from an expression.")},
++    {"issuite",         (PyCFunction)parser_issuite,    PUBLIC_METHOD_TYPE,
++        PyDoc_STR("Determines if this ST object was created from a suite.")},
++    {"tolist",          (PyCFunction)parser_st2list,    PUBLIC_METHOD_TYPE,
++        PyDoc_STR("Creates a list-tree representation of this ST.")},
++    {"totuple",         (PyCFunction)parser_st2tuple,   PUBLIC_METHOD_TYPE,
++        PyDoc_STR("Creates a tuple-tree representation of this ST.")},
++    {"__sizeof__",      (PyCFunction)parser_sizeof,     METH_NOARGS,
++        PyDoc_STR("Returns size in memory, in bytes.")},
++    {NULL, NULL, 0, NULL}
++};
+ 
+ static
+ PyTypeObject PyST_Type = {
+@@ -200,7 +224,14 @@
+     Py_TPFLAGS_DEFAULT,                 /* tp_flags             */
+ 
+     /* __doc__ */
+-    "Intermediate representation of a Python parse tree."
++    "Intermediate representation of a Python parse tree.",
++    0,                                  /* tp_traverse */
++    0,                                  /* tp_clear */
++    0,                                  /* tp_richcompare */
++    0,                                  /* tp_weaklistoffset */
++    0,                                  /* tp_iter */
++    0,                                  /* tp_iternext */
++    parser_methods,                     /* tp_methods */
+ };  /* PyST_Type */
+ 
+ 
+@@ -494,25 +525,6 @@
+ }
+ 
+ 
+-#define PUBLIC_METHOD_TYPE (METH_VARARGS|METH_KEYWORDS)
+-
+-static PyMethodDef
+-parser_methods[] = {
+-    {"compile",         (PyCFunction)parser_compilest,  PUBLIC_METHOD_TYPE,
+-        PyDoc_STR("Compile this ST object into a code object.")},
+-    {"isexpr",          (PyCFunction)parser_isexpr,     PUBLIC_METHOD_TYPE,
+-        PyDoc_STR("Determines if this ST object was created from an expression.")},
+-    {"issuite",         (PyCFunction)parser_issuite,    PUBLIC_METHOD_TYPE,
+-        PyDoc_STR("Determines if this ST object was created from a suite.")},
+-    {"tolist",          (PyCFunction)parser_st2list,    PUBLIC_METHOD_TYPE,
+-        PyDoc_STR("Creates a list-tree representation of this ST.")},
+-    {"totuple",         (PyCFunction)parser_st2tuple,   PUBLIC_METHOD_TYPE,
+-        PyDoc_STR("Creates a tuple-tree representation of this ST.")},
+-
+-    {NULL, NULL, 0, NULL}
+-};
+-
+-
+ static PyObject*
+ parser_getattr(PyObject *self, char *name)
+ {
+@@ -695,6 +707,15 @@
+     return parser_tuple2st(self, args, kw);
+ }
+ 
++static PyObject *
++parser_sizeof(PyST_Object *st, void *unused)
++{
++    Py_ssize_t res;
++
++    res = sizeof(PyST_Object) + _PyNode_SizeOf(st->st_node);
++    return PyLong_FromSsize_t(res);
++}
++
+ 
+ /*  node* build_node_children()
+  *
+diff -r 70274d53c1dd Modules/socketmodule.c
+--- a/Modules/socketmodule.c
++++ b/Modules/socketmodule.c
+@@ -761,7 +761,7 @@
+ /* Lock to allow python interpreter to continue, but only allow one
+    thread to be in gethostbyname or getaddrinfo */
+ #if defined(USE_GETHOSTBYNAME_LOCK) || defined(USE_GETADDRINFO_LOCK)
+-PyThread_type_lock netdb_lock;
++static PyThread_type_lock netdb_lock;
+ #endif
+ 
+ 
+@@ -1310,7 +1310,7 @@
+                 "getsockaddrarg: port must be 0-65535.");
+             return 0;
+         }
+-        if (flowinfo < 0 || flowinfo > 0xfffff) {
++        if (flowinfo > 0xfffff) {
+             PyErr_SetString(
+                 PyExc_OverflowError,
+                 "getsockaddrarg: flowinfo must be 0-1048575.");
+@@ -4181,7 +4181,7 @@
+     if (!PyArg_ParseTuple(sa, "si|II",
+                           &hostp, &port, &flowinfo, &scope_id))
+         return NULL;
+-    if (flowinfo < 0 || flowinfo > 0xfffff) {
++    if (flowinfo > 0xfffff) {
+         PyErr_SetString(PyExc_OverflowError,
+                         "getsockaddrarg: flowinfo must be 0-1048575.");
+         return NULL;
+diff -r 70274d53c1dd Modules/threadmodule.c
+--- a/Modules/threadmodule.c
++++ b/Modules/threadmodule.c
+@@ -618,6 +618,8 @@
+             PyErr_Clear();
+         else {
+             PyObject *file;
++            PyObject *exc, *value, *tb;
++            PyErr_Fetch(&exc, &value, &tb);
+             PySys_WriteStderr(
+                 "Unhandled exception in thread started by ");
+             file = PySys_GetObject("stderr");
+@@ -626,6 +628,7 @@
+             else
+                 PyObject_Print(boot->func, stderr, 0);
+             PySys_WriteStderr("\n");
++            PyErr_Restore(exc, value, tb);
+             PyErr_PrintEx(0);
+         }
+     }
+diff -r 70274d53c1dd Objects/abstract.c
+--- a/Objects/abstract.c
++++ b/Objects/abstract.c
+@@ -126,7 +126,7 @@
+         PyErr_Clear();
+         return defaultvalue;
+     }
+-    rv = PyLong_Check(ro) ? PyLong_AsSsize_t(ro) : defaultvalue;
++    rv = PyNumber_Check(ro) ? PyInt_AsSsize_t(ro) : defaultvalue;
+     Py_DECREF(ro);
+     return rv;
+ }
+diff -r 70274d53c1dd Objects/bytearrayobject.c
+--- a/Objects/bytearrayobject.c
++++ b/Objects/bytearrayobject.c
+@@ -2296,8 +2296,10 @@
+     }
+ 
+     bytearray_obj = PyByteArray_FromStringAndSize(NULL, buf_size);
+-    if (bytearray_obj == NULL)
++    if (bytearray_obj == NULL) {
++        Py_DECREF(it);
+         return NULL;
++    }
+     buf = PyByteArray_AS_STRING(bytearray_obj);
+ 
+     while ((item = PyIter_Next(it)) != NULL) {
+@@ -2330,8 +2332,10 @@
+         return NULL;
+     }
+ 
+-    if (bytearray_setslice(self, Py_SIZE(self), Py_SIZE(self), bytearray_obj) == -1)
++    if (bytearray_setslice(self, Py_SIZE(self), Py_SIZE(self), bytearray_obj) == -1) {
++        Py_DECREF(bytearray_obj);
+         return NULL;
++    }
+     Py_DECREF(bytearray_obj);
+ 
+     Py_RETURN_NONE;
+@@ -2645,7 +2649,7 @@
+ }
+ 
+ PyDoc_STRVAR(splitlines__doc__,
+-"B.splitlines([keepends]) -> list of lines\n\
++"B.splitlines(keepends=False) -> list of lines\n\
+ \n\
+ Return a list of the lines in B, breaking at line boundaries.\n\
+ Line breaks are not included in the resulting list unless keepends\n\
+diff -r 70274d53c1dd Objects/classobject.c
+--- a/Objects/classobject.c
++++ b/Objects/classobject.c
+@@ -225,10 +225,16 @@
+ class_getattr(register PyClassObject *op, PyObject *name)
+ {
+     register PyObject *v;
+-    register char *sname = PyString_AsString(name);
++    register char *sname;
+     PyClassObject *klass;
+     descrgetfunc f;
+ 
++    if (!PyString_Check(name)) {
++        PyErr_SetString(PyExc_TypeError, "attribute name must be a string");
++        return NULL;
++    }
++
++    sname = PyString_AsString(name);
+     if (sname[0] == '_' && sname[1] == '_') {
+         if (strcmp(sname, "__dict__") == 0) {
+             if (PyEval_GetRestricted()) {
+@@ -336,6 +342,10 @@
+                    "classes are read-only in restricted mode");
+         return -1;
+     }
++    if (!PyString_Check(name)) {
++        PyErr_SetString(PyExc_TypeError, "attribute name must be a string");
++        return -1;
++    }
+     sname = PyString_AsString(name);
+     if (sname[0] == '_' && sname[1] == '_') {
+         Py_ssize_t n = PyString_Size(name);
+@@ -699,7 +709,14 @@
+ instance_getattr1(register PyInstanceObject *inst, PyObject *name)
+ {
+     register PyObject *v;
+-    register char *sname = PyString_AsString(name);
++    register char *sname;
++
++    if (!PyString_Check(name)) {
++        PyErr_SetString(PyExc_TypeError, "attribute name must be a string");
++        return NULL;
++    }
++
++    sname = PyString_AsString(name);
+     if (sname[0] == '_' && sname[1] == '_') {
+         if (strcmp(sname, "__dict__") == 0) {
+             if (PyEval_GetRestricted()) {
+@@ -810,7 +827,14 @@
+ instance_setattr(PyInstanceObject *inst, PyObject *name, PyObject *v)
+ {
+     PyObject *func, *args, *res, *tmp;
+-    char *sname = PyString_AsString(name);
++    char *sname;
++
++    if (!PyString_Check(name)) {
++        PyErr_SetString(PyExc_TypeError, "attribute name must be a string");
++        return -1;
++    }
++
++    sname = PyString_AsString(name);
+     if (sname[0] == '_' && sname[1] == '_') {
+         Py_ssize_t n = PyString_Size(name);
+         if (sname[n-1] == '_' && sname[n-2] == '_') {
+diff -r 70274d53c1dd Objects/descrobject.c
+--- a/Objects/descrobject.c
++++ b/Objects/descrobject.c
+@@ -254,14 +254,51 @@
+ classmethoddescr_call(PyMethodDescrObject *descr, PyObject *args,
+                       PyObject *kwds)
+ {
+-    PyObject *func, *result;
++    Py_ssize_t argc;
++    PyObject *self, *func, *result;
+ 
+-    func = PyCFunction_New(descr->d_method, (PyObject *)descr->d_type);
++    /* Make sure that the first argument is acceptable as 'self' */
++    assert(PyTuple_Check(args));
++    argc = PyTuple_GET_SIZE(args);
++    if (argc < 1) {
++        PyErr_Format(PyExc_TypeError,
++                     "descriptor '%s' of '%.100s' "
++                     "object needs an argument",
++                     descr_name((PyDescrObject *)descr),
++                     descr->d_type->tp_name);
++        return NULL;
++    }
++    self = PyTuple_GET_ITEM(args, 0);
++    if (!PyType_Check(self)) {
++        PyErr_Format(PyExc_TypeError,
++                     "descriptor '%s' requires a type "
++                     "but received a '%.100s'",
++                     descr_name((PyDescrObject *)descr),
++                     self->ob_type->tp_name);
++        return NULL;
++    }
++    if (!PyType_IsSubtype((PyTypeObject *)self, descr->d_type)) {
++        PyErr_Format(PyExc_TypeError,
++                     "descriptor '%s' "
++                     "requires a subtype of '%.100s' "
++                     "but received '%.100s",
++                     descr_name((PyDescrObject *)descr),
++                     descr->d_type->tp_name,
++                     self->ob_type->tp_name);
++        return NULL;
++    }
++
++    func = PyCFunction_New(descr->d_method, self);
+     if (func == NULL)
+         return NULL;
+-
++    args = PyTuple_GetSlice(args, 1, argc);
++    if (args == NULL) {
++        Py_DECREF(func);
++        return NULL;
++    }
+     result = PyEval_CallObjectWithKeywords(func, args, kwds);
+     Py_DECREF(func);
++    Py_DECREF(args);
+     return result;
+ }
+ 
+diff -r 70274d53c1dd Objects/dictobject.c
+--- a/Objects/dictobject.c
++++ b/Objects/dictobject.c
+@@ -502,27 +502,16 @@
+     _PyObject_GC_UNTRACK(op);
+ }
+ 
+-
+ /*
+-Internal routine to insert a new item into the table.
+-Used both by the internal resize routine and by the public insert routine.
+-Eats a reference to key and one to value.
+-Returns -1 if an error occurred, or 0 on success.
++Internal routine to insert a new item into the table when you have entry object.
++Used by insertdict.
+ */
+ static int
+-insertdict(register PyDictObject *mp, PyObject *key, long hash, PyObject *value)
++insertdict_by_entry(register PyDictObject *mp, PyObject *key, long hash,
++                    PyDictEntry *ep, PyObject *value)
+ {
+     PyObject *old_value;
+-    register PyDictEntry *ep;
+-    typedef PyDictEntry *(*lookupfunc)(PyDictObject *, PyObject *, long);
+-
+-    assert(mp->ma_lookup != NULL);
+-    ep = mp->ma_lookup(mp, key, hash);
+-    if (ep == NULL) {
+-        Py_DECREF(key);
+-        Py_DECREF(value);
+-        return -1;
+-    }
++
+     MAINTAIN_TRACKING(mp, key, value);
+     if (ep->me_value != NULL) {
+         old_value = ep->me_value;
+@@ -545,6 +534,28 @@
+     return 0;
+ }
+ 
++
++/*
++Internal routine to insert a new item into the table.
++Used both by the internal resize routine and by the public insert routine.
++Eats a reference to key and one to value.
++Returns -1 if an error occurred, or 0 on success.
++*/
++static int
++insertdict(register PyDictObject *mp, PyObject *key, long hash, PyObject *value)
++{
++    register PyDictEntry *ep;
++
++    assert(mp->ma_lookup != NULL);
++    ep = mp->ma_lookup(mp, key, hash);
++    if (ep == NULL) {
++        Py_DECREF(key);
++        Py_DECREF(value);
++        return -1;
++    }
++    return insertdict_by_entry(mp, key, hash, ep, value);
++}
++
+ /*
+ Internal routine used by dictresize() to insert an item which is
+ known to be absent from the dict.  This routine also assumes that
+@@ -738,42 +749,26 @@
+     return ep->me_value;
+ }
+ 
+-/* CAUTION: PyDict_SetItem() must guarantee that it won't resize the
+- * dictionary if it's merely replacing the value for an existing key.
+- * This means that it's safe to loop over a dictionary with PyDict_Next()
+- * and occasionally replace a value -- but you can't insert new keys or
+- * remove them.
+- */
+-int
+-PyDict_SetItem(register PyObject *op, PyObject *key, PyObject *value)
++static int
++dict_set_item_by_hash_or_entry(register PyObject *op, PyObject *key,
++                               long hash, PyDictEntry *ep, PyObject *value)
+ {
+     register PyDictObject *mp;
+-    register long hash;
+     register Py_ssize_t n_used;
+ 
+-    if (!PyDict_Check(op)) {
+-        PyErr_BadInternalCall();
+-        return -1;
+-    }
+-    assert(key);
+-    assert(value);
+     mp = (PyDictObject *)op;
+-    if (PyString_CheckExact(key)) {
+-        hash = ((PyStringObject *)key)->ob_shash;
+-        if (hash == -1)
+-            hash = PyObject_Hash(key);
+-    }
+-    else {
+-        hash = PyObject_Hash(key);
+-        if (hash == -1)
+-            return -1;
+-    }
+     assert(mp->ma_fill <= mp->ma_mask);  /* at least one empty slot */
+     n_used = mp->ma_used;
+     Py_INCREF(value);
+     Py_INCREF(key);
+-    if (insertdict(mp, key, hash, value) != 0)
+-        return -1;
++    if (ep == NULL) {
++        if (insertdict(mp, key, hash, value) != 0)
++            return -1;
++    }
++    else {
++        if (insertdict_by_entry(mp, key, hash, ep, value) != 0)
++            return -1;
++    }
+     /* If we added a key, we can safely resize.  Otherwise just return!
+      * If fill >= 2/3 size, adjust size.  Normally, this doubles or
+      * quaduples the size, but it's also possible for the dict to shrink
+@@ -793,6 +788,36 @@
+     return dictresize(mp, (mp->ma_used > 50000 ? 2 : 4) * mp->ma_used);
+ }
+ 
++/* CAUTION: PyDict_SetItem() must guarantee that it won't resize the
++ * dictionary if it's merely replacing the value for an existing key.
++ * This means that it's safe to loop over a dictionary with PyDict_Next()
++ * and occasionally replace a value -- but you can't insert new keys or
++ * remove them.
++ */
++int
++PyDict_SetItem(register PyObject *op, PyObject *key, PyObject *value)
++{
++    register long hash;
++
++    if (!PyDict_Check(op)) {
++        PyErr_BadInternalCall();
++        return -1;
++    }
++    assert(key);
++    assert(value);
++    if (PyString_CheckExact(key)) {
++        hash = ((PyStringObject *)key)->ob_shash;
++        if (hash == -1)
++            hash = PyObject_Hash(key);
++    }
++    else {
++        hash = PyObject_Hash(key);
++        if (hash == -1)
++            return -1;
++    }
++    return dict_set_item_by_hash_or_entry(op, key, hash, NULL, value);
++}
++
+ int
+ PyDict_DelItem(PyObject *op, PyObject *key)
+ {
+@@ -1957,9 +1982,9 @@
+         return NULL;
+     val = ep->me_value;
+     if (val == NULL) {
+-        val = failobj;
+-        if (PyDict_SetItem((PyObject*)mp, key, failobj))
+-            val = NULL;
++        if (dict_set_item_by_hash_or_entry((PyObject*)mp, key, hash, ep,
++                                           failobj) == 0)
++            val = failobj;
+     }
+     Py_XINCREF(val);
+     return val;
+diff -r 70274d53c1dd Objects/fileobject.c
+--- a/Objects/fileobject.c
++++ b/Objects/fileobject.c
+@@ -493,9 +493,10 @@
+ PyObject *
+ PyFile_FromString(char *name, char *mode)
+ {
++    extern int fclose(FILE *);
+     PyFileObject *f;
+ 
+-    f = (PyFileObject *)PyFile_FromFile((FILE *)NULL, name, mode, NULL);
++    f = (PyFileObject *)PyFile_FromFile((FILE *)NULL, name, mode, fclose);
+     if (f != NULL) {
+         if (open_the_file(f, name, mode) == NULL) {
+             Py_DECREF(f);
+@@ -635,11 +636,13 @@
+ static PyObject *
+ file_repr(PyFileObject *f)
+ {
++    PyObject *ret = NULL;
++    PyObject *name = NULL;
+     if (PyUnicode_Check(f->f_name)) {
+ #ifdef Py_USING_UNICODE
+-        PyObject *ret = NULL;
+-        PyObject *name = PyUnicode_AsUnicodeEscapeString(f->f_name);
+-        const char *name_str = name ? PyString_AsString(name) : "?";
++        const char *name_str;
++        name = PyUnicode_AsUnicodeEscapeString(f->f_name);
++        name_str = name ? PyString_AsString(name) : "?";
+         ret = PyString_FromFormat("<%s file u'%s', mode '%s' at %p>",
+                            f->f_fp == NULL ? "closed" : "open",
+                            name_str,
+@@ -649,11 +652,16 @@
+         return ret;
+ #endif
+     } else {
+-        return PyString_FromFormat("<%s file '%s', mode '%s' at %p>",
++        name = PyObject_Repr(f->f_name);
++        if (name == NULL)
++            return NULL;
++        ret = PyString_FromFormat("<%s file %s, mode '%s' at %p>",
+                            f->f_fp == NULL ? "closed" : "open",
+-                           PyString_AsString(f->f_name),
++                           PyString_AsString(name),
+                            PyString_AsString(f->f_mode),
+                            f);
++        Py_XDECREF(name);
++        return ret;
+     }
+ }
+ 
+@@ -1072,12 +1080,23 @@
+         return NULL;
+     bytesread = 0;
+     for (;;) {
++        int interrupted;
+         FILE_BEGIN_ALLOW_THREADS(f)
+         errno = 0;
+         chunksize = Py_UniversalNewlineFread(BUF(v) + bytesread,
+                   buffersize - bytesread, f->f_fp, (PyObject *)f);
++        interrupted = ferror(f->f_fp) && errno == EINTR;
+         FILE_END_ALLOW_THREADS(f)
++        if (interrupted) {
++            clearerr(f->f_fp);
++            if (PyErr_CheckSignals()) {
++                Py_DECREF(v);
++                return NULL;
++            }
++        }
+         if (chunksize == 0) {
++            if (interrupted)
++                continue;
+             if (!ferror(f->f_fp))
+                 break;
+             clearerr(f->f_fp);
+@@ -1092,7 +1111,7 @@
+             return NULL;
+         }
+         bytesread += chunksize;
+-        if (bytesread < buffersize) {
++        if (bytesread < buffersize && !interrupted) {
+             clearerr(f->f_fp);
+             break;
+         }
+@@ -1133,12 +1152,23 @@
+     ntodo = pbuf.len;
+     ndone = 0;
+     while (ntodo > 0) {
++        int interrupted;
+         FILE_BEGIN_ALLOW_THREADS(f)
+         errno = 0;
+         nnow = Py_UniversalNewlineFread(ptr+ndone, ntodo, f->f_fp,
+                                         (PyObject *)f);
++        interrupted = ferror(f->f_fp) && errno == EINTR;
+         FILE_END_ALLOW_THREADS(f)
++        if (interrupted) {
++            clearerr(f->f_fp);
++            if (PyErr_CheckSignals()) {
++                PyBuffer_Release(&pbuf);
++                return NULL;
++            }
++        }
+         if (nnow == 0) {
++            if (interrupted)
++                continue;
+             if (!ferror(f->f_fp))
+                 break;
+             PyErr_SetFromErrno(PyExc_IOError);
+@@ -1426,8 +1456,25 @@
+                 *buf++ = c;
+                 if (c == '\n') break;
+             }
+-            if ( c == EOF && skipnextlf )
+-                newlinetypes |= NEWLINE_CR;
++            if (c == EOF) {
++                if (ferror(fp) && errno == EINTR) {
++                    FUNLOCKFILE(fp);
++                    FILE_ABORT_ALLOW_THREADS(f)
++                    f->f_newlinetypes = newlinetypes;
++                    f->f_skipnextlf = skipnextlf;
++
++                    if (PyErr_CheckSignals()) {
++                        Py_DECREF(v);
++                        return NULL;
++                    }
++                    /* We executed Python signal handlers and got no exception.
++                     * Now back to reading the line where we left off. */
++                    clearerr(fp);
++                    continue;
++                }
++                if (skipnextlf)
++                    newlinetypes |= NEWLINE_CR;
++            }
+         } else /* If not universal newlines use the normal loop */
+         while ((c = GETC(fp)) != EOF &&
+                (*buf++ = c) != '\n' &&
+@@ -1441,6 +1488,16 @@
+             break;
+         if (c == EOF) {
+             if (ferror(fp)) {
++                if (errno == EINTR) {
++                    if (PyErr_CheckSignals()) {
++                        Py_DECREF(v);
++                        return NULL;
++                    }
++                    /* We executed Python signal handlers and got no exception.
++                     * Now back to reading the line where we left off. */
++                    clearerr(fp);
++                    continue;
++                }
+                 PyErr_SetFromErrno(PyExc_IOError);
+                 clearerr(fp);
+                 Py_DECREF(v);
+@@ -1616,7 +1673,7 @@
+     size_t totalread = 0;
+     char *p, *q, *end;
+     int err;
+-    int shortread = 0;
++    int shortread = 0;  /* bool, did the previous read come up short? */
+ 
+     if (f->f_fp == NULL)
+         return err_closed();
+@@ -1646,6 +1703,14 @@
+             sizehint = 0;
+             if (!ferror(f->f_fp))
+                 break;
++            if (errno == EINTR) {
++                if (PyErr_CheckSignals()) {
++                    goto error;
++                }
++                clearerr(f->f_fp);
++                shortread = 0;
++                continue;
++            }
+             PyErr_SetFromErrno(PyExc_IOError);
+             clearerr(f->f_fp);
+             goto error;
+diff -r 70274d53c1dd Objects/frameobject.c
+--- a/Objects/frameobject.c
++++ b/Objects/frameobject.c
+@@ -214,6 +214,7 @@
+         case SETUP_LOOP:
+         case SETUP_EXCEPT:
+         case SETUP_FINALLY:
++        case SETUP_WITH:
+             blockstack[blockstack_top++] = addr;
+             in_finally[blockstack_top-1] = 0;
+             break;
+@@ -221,7 +222,7 @@
+         case POP_BLOCK:
+             assert(blockstack_top > 0);
+             setup_op = code[blockstack[blockstack_top-1]];
+-            if (setup_op == SETUP_FINALLY) {
++            if (setup_op == SETUP_FINALLY || setup_op == SETUP_WITH) {
+                 in_finally[blockstack_top-1] = 1;
+             }
+             else {
+@@ -236,7 +237,7 @@
+              * be seeing such an END_FINALLY.) */
+             if (blockstack_top > 0) {
+                 setup_op = code[blockstack[blockstack_top-1]];
+-                if (setup_op == SETUP_FINALLY) {
++                if (setup_op == SETUP_FINALLY || setup_op == SETUP_WITH) {
+                     blockstack_top--;
+                 }
+             }
+@@ -298,6 +299,7 @@
+         case SETUP_LOOP:
+         case SETUP_EXCEPT:
+         case SETUP_FINALLY:
++        case SETUP_WITH:
+             delta_iblock++;
+             break;
+ 
+diff -r 70274d53c1dd Objects/genobject.c
+--- a/Objects/genobject.c
++++ b/Objects/genobject.c
+@@ -120,7 +120,7 @@
+ }
+ 
+ PyDoc_STRVAR(close_doc,
+-"close(arg) -> raise GeneratorExit inside generator.");
++"close() -> raise GeneratorExit inside generator.");
+ 
+ static PyObject *
+ gen_close(PyGenObject *gen, PyObject *args)
+diff -r 70274d53c1dd Objects/object.c
+--- a/Objects/object.c
++++ b/Objects/object.c
+@@ -2111,8 +2111,10 @@
+     if (PyType_Ready(&PySet_Type) < 0)
+         Py_FatalError("Can't initialize set type");
+ 
++#ifdef Py_USING_UNICODE
+     if (PyType_Ready(&PyUnicode_Type) < 0)
+         Py_FatalError("Can't initialize unicode type");
++#endif
+ 
+     if (PyType_Ready(&PySlice_Type) < 0)
+         Py_FatalError("Can't initialize slice type");
+diff -r 70274d53c1dd Objects/stringobject.c
+--- a/Objects/stringobject.c
++++ b/Objects/stringobject.c
+@@ -3545,7 +3545,7 @@
+ 
+ 
+ PyDoc_STRVAR(splitlines__doc__,
+-"S.splitlines([keepends]) -> list of strings\n\
++"S.splitlines(keepends=False) -> list of strings\n\
+ \n\
+ Return a list of the lines in S, breaking at line boundaries.\n\
+ Line breaks are not included in the resulting list unless keepends\n\
+diff -r 70274d53c1dd Objects/typeobject.c
+--- a/Objects/typeobject.c
++++ b/Objects/typeobject.c
+@@ -876,8 +876,13 @@
+         assert(base);
+     }
+ 
+-    /* There's no need to clear the instance dict (if any);
+-       the collector will call its tp_clear handler. */
++    /* Clear the instance dict (if any), to break cycles involving only
++       __dict__ slots (as in the case 'self.__dict__ is self'). */
++    if (type->tp_dictoffset != base->tp_dictoffset) {
++        PyObject **dictptr = _PyObject_GetDictPtr(self);
++        if (dictptr && *dictptr)
++            Py_CLEAR(*dictptr);
++    }
+ 
+     if (baseclear)
+         return baseclear(self);
+@@ -2525,6 +2530,13 @@
+     PyObject *meta_attribute, *attribute;
+     descrgetfunc meta_get;
+ 
++    if (!PyString_Check(name)) {
++        PyErr_Format(PyExc_TypeError,
++                     "attribute name must be string, not '%.200s'",
++                     name->ob_type->tp_name);
++        return NULL;
++    }
++
+     /* Initialize this type (we'll assume the metatype is initialized) */
+     if (type->tp_dict == NULL) {
+         if (PyType_Ready(type) < 0)
+@@ -2984,7 +2996,7 @@
+     unaryfunc f;
+ 
+     f = Py_TYPE(self)->tp_repr;
+-    if (f == NULL || f == object_str)
++    if (f == NULL)
+         f = object_repr;
+     return f(self);
+ }
+@@ -3553,6 +3565,7 @@
+ 
+     for (; meth->ml_name != NULL; meth++) {
+         PyObject *descr;
++        int err;
+         if (PyDict_GetItemString(dict, meth->ml_name) &&
+             !(meth->ml_flags & METH_COEXIST))
+                 continue;
+@@ -3576,9 +3589,10 @@
+         }
+         if (descr == NULL)
+             return -1;
+-        if (PyDict_SetItemString(dict, meth->ml_name, descr) < 0)
++        err = PyDict_SetItemString(dict, meth->ml_name, descr);
++        Py_DECREF(descr);
++        if (err < 0)
+             return -1;
+-        Py_DECREF(descr);
+     }
+     return 0;
+ }
+@@ -6131,7 +6145,8 @@
+             }
+             continue;
+         }
+-        if (Py_TYPE(descr) == &PyWrapperDescr_Type) {
++        if (Py_TYPE(descr) == &PyWrapperDescr_Type &&
++            ((PyWrapperDescrObject *)descr)->d_base->name_strobj == p->name_strobj) {
+             void **tptr = resolve_slotdups(type, p->name_strobj);
+             if (tptr == NULL || tptr == ptr)
+                 generic = p->function;
+diff -r 70274d53c1dd Objects/unicodeobject.c
+--- a/Objects/unicodeobject.c
++++ b/Objects/unicodeobject.c
+@@ -2564,7 +2564,7 @@
+         }
+ 
+         /* UTF-16 code pair: */
+-        if (q >= e) {
++        if (e - q < 2) {
+             errmsg = "unexpected end of data";
+             startinpos = (((const char *)q)-2)-starts;
+             endinpos = ((const char *)e)-starts;
+@@ -7521,7 +7521,7 @@
+ }
+ 
+ PyDoc_STRVAR(splitlines__doc__,
+-             "S.splitlines([keepends]) -> list of strings\n\
++             "S.splitlines(keepends=False) -> list of strings\n\
+ \n\
+ Return a list of the lines in S, breaking at line boundaries.\n\
+ Line breaks are not included in the resulting list unless keepends\n\
+@@ -7797,10 +7797,6 @@
+ 
+ 
+ static PyMethodDef unicode_methods[] = {
+-
+-    /* Order is according to common usage: often used methods should
+-       appear first, since lookup is done sequentially. */
+-
+     {"encode", (PyCFunction) unicode_encode, METH_VARARGS | METH_KEYWORDS, encode__doc__},
+     {"replace", (PyCFunction) unicode_replace, METH_VARARGS, replace__doc__},
+     {"split", (PyCFunction) unicode_split, METH_VARARGS, split__doc__},
+diff -r 70274d53c1dd PC/VC6/bz2.dsp
+--- a/PC/VC6/bz2.dsp
++++ b/PC/VC6/bz2.dsp
+@@ -44,7 +44,7 @@
+ # PROP Target_Dir ""
+ F90=df.exe
+ # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "Py_BUILD_CORE_MODULE" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+-# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I ".." /I "..\..\..\bzip2-1.0.5" /D "Py_BUILD_CORE_MODULE" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c
++# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I ".." /I "..\..\..\bzip2-1.0.6" /D "Py_BUILD_CORE_MODULE" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c
+ # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
+ # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
+ # ADD BASE RSC /l 0x409 /d "NDEBUG"
+@@ -54,7 +54,7 @@
+ # ADD BSC32 /nologo
+ LINK32=link.exe
+ # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
+-# ADD LINK32 ..\..\..\bzip2-1.0.5\libbz2.lib /nologo /base:"0x1D170000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./bz2.pyd"
++# ADD LINK32 ..\..\..\bzip2-1.0.6\libbz2.lib /nologo /base:"0x1D170000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./bz2.pyd"
+ # SUBTRACT LINK32 /pdb:none /nodefaultlib
+ 
+ !ELSEIF  "$(CFG)" == "bz2 - Win32 Debug"
+@@ -72,7 +72,7 @@
+ # PROP Target_Dir ""
+ F90=df.exe
+ # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "Py_BUILD_CORE_MODULE" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
+-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I ".." /I "..\..\..\bzip2-1.0.5" /D "Py_BUILD_CORE_MODULE" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c
++# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I ".." /I "..\..\..\bzip2-1.0.6" /D "Py_BUILD_CORE_MODULE" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c
+ # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
+ # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
+ # ADD BASE RSC /l 0x409 /d "_DEBUG"
+@@ -82,7 +82,7 @@
+ # ADD BSC32 /nologo
+ LINK32=link.exe
+ # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
+-# ADD LINK32 ..\..\..\bzip2-1.0.5\libbz2.lib /nologo /base:"0x1D170000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"msvcrt" /nodefaultlib:"libc" /out:"./bz2_d.pyd" /pdbtype:sept
++# ADD LINK32 ..\..\..\bzip2-1.0.6\libbz2.lib /nologo /base:"0x1D170000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"msvcrt" /nodefaultlib:"libc" /out:"./bz2_d.pyd" /pdbtype:sept
+ # SUBTRACT LINK32 /pdb:none
+ 
+ !ENDIF 
+diff -r 70274d53c1dd PC/VC6/pythoncore.dsp
+--- a/PC/VC6/pythoncore.dsp
++++ b/PC/VC6/pythoncore.dsp
+@@ -663,6 +663,10 @@
+ # End Source File
+ # Begin Source File
+ 
++SOURCE=..\..\Python\random.c
++# End Source File
++# Begin Source File
++
+ SOURCE=..\..\Objects\rangeobject.c
+ # End Source File
+ # Begin Source File
+diff -r 70274d53c1dd PC/VC6/readme.txt
+--- a/PC/VC6/readme.txt
++++ b/PC/VC6/readme.txt
+@@ -120,14 +120,14 @@
+     Download the source from the python.org copy into the dist
+     directory:
+ 
+-    svn export http://svn.python.org/projects/external/bzip2-1.0.5
++    svn export http://svn.python.org/projects/external/bzip2-1.0.6
+ 
+     And requires building bz2 first.
+ 
+-    cd dist\bzip2-1.0.5
++    cd dist\bzip2-1.0.6
+     nmake -f makefile.msc
+ 
+-    All of this managed to build bzip2-1.0.5\libbz2.lib, which the Python
++    All of this managed to build bzip2-1.0.6\libbz2.lib, which the Python
+     project links in.
+ 
+ 
+diff -r 70274d53c1dd PC/VS7.1/pythoncore.vcproj
+--- a/PC/VS7.1/pythoncore.vcproj
++++ b/PC/VS7.1/pythoncore.vcproj
+@@ -767,6 +767,9 @@
+ 			RelativePath="..\..\Python\pythonrun.c">
+ 		</File>
+ 		<File
++			RelativePath="..\..\Python\random.c">
++		</File>
++		<File
+ 			RelativePath="..\..\Objects\rangeobject.c">
+ 		</File>
+ 		<File
+diff -r 70274d53c1dd PC/VS8.0/bz2.vcproj
+--- a/PC/VS8.0/bz2.vcproj
++++ b/PC/VS8.0/bz2.vcproj
+@@ -532,7 +532,7 @@
+ 			</File>
+ 		</Filter>
+ 		<Filter
+-			Name="bzip2 1.0.5 Header Files"
++			Name="bzip2 1.0.6 Header Files"
+ 			>
+ 			<File
+ 				RelativePath="$(bz2Dir)\bzlib.h"
+@@ -544,7 +544,7 @@
+ 			</File>
+ 		</Filter>
+ 		<Filter
+-			Name="bzip2 1.0.5 Source Files"
++			Name="bzip2 1.0.6 Source Files"
+ 			>
+ 			<File
+ 				RelativePath="$(bz2Dir)\blocksort.c"
+diff -r 70274d53c1dd PC/VS8.0/pyproject.vsprops
+--- a/PC/VS8.0/pyproject.vsprops
++++ b/PC/VS8.0/pyproject.vsprops
+@@ -78,11 +78,11 @@
+ 	/>
+ 	<UserMacro
+ 		Name="bz2Dir"
+-		Value="$(externalsDir)\bzip2-1.0.5"
++		Value="$(externalsDir)\bzip2-1.0.6"
+ 	/>
+ 	<UserMacro
+ 		Name="opensslDir"
+-		Value="$(externalsDir)\openssl-0.9.8l"
++		Value="$(externalsDir)\openssl-0.9.8x"
+ 	/>
+ 	<UserMacro
+ 		Name="tcltkDir"
+diff -r 70274d53c1dd PC/VS8.0/pythoncore.vcproj
+--- a/PC/VS8.0/pythoncore.vcproj
++++ b/PC/VS8.0/pythoncore.vcproj
+@@ -1835,6 +1835,10 @@
+ 				>
+ 			</File>
+ 			<File
++				RelativePath="..\..\Python\random.c"
++				>
++			</File>
++			<File
+ 				RelativePath="..\..\Python\structmember.c"
+ 				>
+ 			</File>
+diff -r 70274d53c1dd PC/_subprocess.c
+--- a/PC/_subprocess.c
++++ b/PC/_subprocess.c
+@@ -670,4 +670,5 @@
+     defint(d, "WAIT_OBJECT_0", WAIT_OBJECT_0);
+     defint(d, "CREATE_NEW_CONSOLE", CREATE_NEW_CONSOLE);
+     defint(d, "CREATE_NEW_PROCESS_GROUP", CREATE_NEW_PROCESS_GROUP);
++    defint(d, "STILL_ACTIVE", STILL_ACTIVE);
+ }
+diff -r 70274d53c1dd PC/pyconfig.h
+--- a/PC/pyconfig.h
++++ b/PC/pyconfig.h
+@@ -342,7 +342,7 @@
+ #	define SIZEOF_FPOS_T 8
+ #	define SIZEOF_HKEY 8
+ #	define SIZEOF_SIZE_T 8
+-/* configure.in defines HAVE_LARGEFILE_SUPPORT iff HAVE_LONG_LONG,
++/* configure.ac defines HAVE_LARGEFILE_SUPPORT iff HAVE_LONG_LONG,
+    sizeof(off_t) > sizeof(long), and sizeof(PY_LONG_LONG) >= sizeof(off_t).
+    On Win64 the second condition is not true, but if fpos_t replaces off_t
+    then this is true. The uses of HAVE_LARGEFILE_SUPPORT imply that Win64
+diff -r 70274d53c1dd PCbuild/build_ssl.py
+--- a/PCbuild/build_ssl.py
++++ b/PCbuild/build_ssl.py
+@@ -64,37 +64,13 @@
+     print(" Please install ActivePerl and ensure it appears on your path")
+     return None
+ 
+-# Locate the best SSL directory given a few roots to look into.
+-def find_best_ssl_dir(sources):
+-    candidates = []
+-    for s in sources:
+-        try:
+-            # note: do not abspath s; the build will fail if any
+-            # higher up directory name has spaces in it.
+-            fnames = os.listdir(s)
+-        except os.error:
+-            fnames = []
+-        for fname in fnames:
+-            fqn = os.path.join(s, fname)
+-            if os.path.isdir(fqn) and fname.startswith("openssl-"):
+-                candidates.append(fqn)
+-    # Now we have all the candidates, locate the best.
+-    best_parts = []
+-    best_name = None
+-    for c in candidates:
+-        parts = re.split("[.-]", os.path.basename(c))[1:]
+-        # eg - openssl-0.9.7-beta1 - ignore all "beta" or any other qualifiers
+-        if len(parts) >= 4:
+-            continue
+-        if parts > best_parts:
+-            best_parts = parts
+-            best_name = c
+-    if best_name is not None:
+-        print("Found an SSL directory at '%s'" % (best_name,))
+-    else:
+-        print("Could not find an SSL directory in '%s'" % (sources,))
+-    sys.stdout.flush()
+-    return best_name
++# Fetch SSL directory from VC properties
++def get_ssl_dir():
++    propfile = (os.path.join(os.path.dirname(__file__), 'pyproject.vsprops'))
++    with open(propfile) as f:
++        m = re.search('openssl-([^"]+)"', f.read())
++        return "..\..\openssl-"+m.group(1)
++
+ 
+ def create_makefile64(makefile, m32):
+     """Create and fix makefile for 64bit
+@@ -190,7 +166,7 @@
+         print("No Perl installation was found. Existing Makefiles are used.")
+     sys.stdout.flush()
+     # Look for SSL 2 levels up from pcbuild - ie, same place zlib etc all live.
+-    ssl_dir = find_best_ssl_dir(("..\\..",))
++    ssl_dir = get_ssl_dir()
+     if ssl_dir is None:
+         sys.exit(1)
+ 
+diff -r 70274d53c1dd PCbuild/bz2.vcproj
+--- a/PCbuild/bz2.vcproj
++++ b/PCbuild/bz2.vcproj
+@@ -532,7 +532,7 @@
+ 			</File>
+ 		</Filter>
+ 		<Filter
+-			Name="bzip2 1.0.5 Header Files"
++			Name="bzip2 1.0.6 Header Files"
+ 			>
+ 			<File
+ 				RelativePath="$(bz2Dir)\bzlib.h"
+@@ -544,7 +544,7 @@
+ 			</File>
+ 		</Filter>
+ 		<Filter
+-			Name="bzip2 1.0.5 Source Files"
++			Name="bzip2 1.0.6 Source Files"
+ 			>
+ 			<File
+ 				RelativePath="$(bz2Dir)\blocksort.c"
+diff -r 70274d53c1dd PCbuild/pginstrument.vsprops
+--- a/PCbuild/pginstrument.vsprops
++++ b/PCbuild/pginstrument.vsprops
+@@ -22,7 +22,7 @@
+ 	<Tool
+ 		Name="VCLinkerTool"
+ 		OptimizeReferences="2"
+-		EnableCOMDATFolding="2"
++		EnableCOMDATFolding="1"
+ 		LinkTimeCodeGeneration="2"
+ 		ProfileGuidedDatabase="$(SolutionDir)$(PlatformName)-pgi\$(TargetName).pgd"
+ 		ImportLibrary="$(OutDirPGI)\$(TargetName).lib"
+diff -r 70274d53c1dd PCbuild/pyproject.vsprops
+--- a/PCbuild/pyproject.vsprops
++++ b/PCbuild/pyproject.vsprops
+@@ -78,11 +78,11 @@
+ 	/>
+ 	<UserMacro
+ 		Name="bz2Dir"
+-		Value="$(externalsDir)\bzip2-1.0.5"
++		Value="$(externalsDir)\bzip2-1.0.6"
+ 	/>
+ 	<UserMacro
+ 		Name="opensslDir"
+-		Value="$(externalsDir)\openssl-0.9.8l"
++		Value="$(externalsDir)\openssl-0.9.8x"
+ 	/>
+ 	<UserMacro
+ 		Name="tcltkDir"
+diff -r 70274d53c1dd PCbuild/readme.txt
+--- a/PCbuild/readme.txt
++++ b/PCbuild/readme.txt
+@@ -121,28 +121,28 @@
+     Download the source from the python.org copy into the dist
+     directory:
+ 
+-    svn export http://svn.python.org/projects/external/bzip2-1.0.5
++    svn export http://svn.python.org/projects/external/bzip2-1.0.6
+ 
+     ** NOTE: if you use the Tools\buildbot\external(-amd64).bat approach for
+     obtaining external sources then you don't need to manually get the source
+     above via subversion. **
+ 
+     A custom pre-link step in the bz2 project settings should manage to
+-    build bzip2-1.0.5\libbz2.lib by magic before bz2.pyd (or bz2_d.pyd) is
++    build bzip2-1.0.6\libbz2.lib by magic before bz2.pyd (or bz2_d.pyd) is
+     linked in PCbuild\.
+     However, the bz2 project is not smart enough to remove anything under
+-    bzip2-1.0.5\ when you do a clean, so if you want to rebuild bzip2.lib
+-    you need to clean up bzip2-1.0.5\ by hand.
++    bzip2-1.0.6\ when you do a clean, so if you want to rebuild bzip2.lib
++    you need to clean up bzip2-1.0.6\ by hand.
+ 
+     All of this managed to build libbz2.lib in 
+-    bzip2-1.0.5\$platform-$configuration\, which the Python project links in.
++    bzip2-1.0.6\$platform-$configuration\, which the Python project links in.
+ 
+ _ssl
+     Python wrapper for the secure sockets library.
+ 
+     Get the source code through
+ 
+-    svn export http://svn.python.org/projects/external/openssl-0.9.8l
++    svn export http://svn.python.org/projects/external/openssl-0.9.8x
+ 
+     ** NOTE: if you use the Tools\buildbot\external(-amd64).bat approach for
+     obtaining external sources then you don't need to manually get the source
+diff -r 70274d53c1dd Parser/myreadline.c
+--- a/Parser/myreadline.c
++++ b/Parser/myreadline.c
+@@ -40,6 +40,10 @@
+ my_fgets(char *buf, int len, FILE *fp)
+ {
+     char *p;
++#ifdef MS_WINDOWS
++    int i;
++#endif
++
+     while (1) {
+         if (PyOS_InputHook != NULL)
+             (void)(PyOS_InputHook)();
+@@ -49,32 +53,24 @@
+         if (p != NULL)
+             return 0; /* No error */
+ #ifdef MS_WINDOWS
+-        /* In the case of a Ctrl+C or some other external event
+-           interrupting the operation:
+-           Win2k/NT: ERROR_OPERATION_ABORTED is the most recent Win32
+-           error code (and feof() returns TRUE).
+-           Win9x: Ctrl+C seems to have no effect on fgets() returning
+-           early - the signal handler is called, but the fgets()
+-           only returns "normally" (ie, when Enter hit or feof())
++        /* Ctrl-C anywhere on the line or Ctrl-Z if the only character
++           on a line will set ERROR_OPERATION_ABORTED. Under normal
++           circumstances Ctrl-C will also have caused the SIGINT handler
++           to fire. This signal fires in another thread and is not
++           guaranteed to have occurred before this point in the code.
++
++           Therefore: check in a small loop to see if the trigger has
++           fired, in which case assume this is a Ctrl-C event. If it
++           hasn't fired within 10ms assume that this is a Ctrl-Z on its
++           own or that the signal isn't going to fire for some other
++           reason and drop through to check for EOF.
+         */
+         if (GetLastError()==ERROR_OPERATION_ABORTED) {
+-            /* Signals come asynchronously, so we sleep a brief
+-               moment before checking if the handler has been
+-               triggered (we cant just return 1 before the
+-               signal handler has been called, as the later
+-               signal may be treated as a separate interrupt).
+-            */
+-            Sleep(1);
+-            if (PyOS_InterruptOccurred()) {
+-                return 1; /* Interrupt */
++            for (i = 0; i < 10; i++) {
++                if (PyOS_InterruptOccurred())
++                    return 1;
++                Sleep(1);
+             }
+-            /* Either the sleep wasn't long enough (need a
+-               short loop retrying?) or not interrupted at all
+-               (in which case we should revisit the whole thing!)
+-               Logging some warning would be nice.  assert is not
+-               viable as under the debugger, the various dialogs
+-               mean the condition is not true.
+-            */
+         }
+ #endif /* MS_WINDOWS */
+         if (feof(fp)) {
+diff -r 70274d53c1dd Parser/node.c
+--- a/Parser/node.c
++++ b/Parser/node.c
+@@ -114,6 +114,7 @@
+ 
+ /* Forward */
+ static void freechildren(node *);
++static Py_ssize_t sizeofchildren(node *n);
+ 
+ 
+ void
+@@ -125,6 +126,16 @@
+     }
+ }
+ 
++Py_ssize_t
++_PyNode_SizeOf(node *n)
++{
++    Py_ssize_t res = 0;
++
++    if (n != NULL)
++        res = sizeof(node) + sizeofchildren(n);
++    return res;
++}
++
+ static void
+ freechildren(node *n)
+ {
+@@ -136,3 +147,18 @@
+     if (STR(n) != NULL)
+         PyObject_FREE(STR(n));
+ }
++
++static Py_ssize_t
++sizeofchildren(node *n)
++{
++    Py_ssize_t res = 0;
++    int i;
++    for (i = NCH(n); --i >= 0; )
++        res += sizeofchildren(CHILD(n, i));
++    if (n->n_child != NULL)
++        /* allocated size of n->n_child array */
++        res += XXXROUNDUP(NCH(n)) * sizeof(node);
++    if (STR(n) != NULL)
++        res += strlen(STR(n)) + 1;
++    return res;
++}
+diff -r 70274d53c1dd Parser/parsetok.c
+--- a/Parser/parsetok.c
++++ b/Parser/parsetok.c
+@@ -131,7 +131,7 @@
+ {
+     parser_state *ps;
+     node *n;
+-    int started = 0, handling_import = 0, handling_with = 0;
++    int started = 0;
+ 
+     if ((ps = PyParser_New(g, start)) == NULL) {
+         fprintf(stderr, "no mem for new parser\n");
+@@ -163,7 +163,6 @@
+         }
+         if (type == ENDMARKER && started) {
+             type = NEWLINE; /* Add an extra newline */
+-            handling_with = handling_import = 0;
+             started = 0;
+             /* Add the right number of dedent tokens,
+                except if a certain flag is given --
+diff -r 70274d53c1dd Python/bltinmodule.c
+--- a/Python/bltinmodule.c
++++ b/Python/bltinmodule.c
+@@ -53,8 +53,12 @@
+ PyDoc_STRVAR(import_doc,
+ "__import__(name, globals={}, locals={}, fromlist=[], level=-1) -> module\n\
+ \n\
+-Import a module.  The globals are only used to determine the context;\n\
+-they are not modified.  The locals are currently unused.  The fromlist\n\
++Import a module. Because this function is meant for use by the Python\n\
++interpreter and not for general use it is better to use\n\
++importlib.import_module() to programmatically import a module.\n\
++\n\
++The globals argument is only used to determine the context;\n\
++they are not modified.  The locals argument is unused.  The fromlist\n\
+ should be a list of names to emulate ``from name import ...'', or an\n\
+ empty list to emulate ``import name''.\n\
+ When importing a module from a package, note that __import__('A.B', ...)\n\
+@@ -1578,6 +1582,7 @@
+             Py_CLEAR(str_newline);
+             return NULL;
+         }
++#ifdef Py_USING_UNICODE
+         unicode_newline = PyUnicode_FromString("\n");
+         if (unicode_newline == NULL) {
+             Py_CLEAR(str_newline);
+@@ -1591,6 +1596,7 @@
+             Py_CLEAR(unicode_space);
+             return NULL;
+         }
++#endif
+     }
+     if (!PyArg_ParseTupleAndKeywords(dummy_args, kwds, "|OOO:print",
+                                      kwlist, &sep, &end, &file))
+diff -r 70274d53c1dd Python/compile.c
+--- a/Python/compile.c
++++ b/Python/compile.c
+@@ -359,14 +359,31 @@
+ static PyObject *
+ dictbytype(PyObject *src, int scope_type, int flag, int offset)
+ {
+-    Py_ssize_t pos = 0, i = offset, scope;
++    Py_ssize_t i = offset, scope, num_keys, key_i;
+     PyObject *k, *v, *dest = PyDict_New();
++    PyObject *sorted_keys;
+ 
+     assert(offset >= 0);
+     if (dest == NULL)
+         return NULL;
+ 
+-    while (PyDict_Next(src, &pos, &k, &v)) {
++    /* Sort the keys so that we have a deterministic order on the indexes
++       saved in the returned dictionary.  These indexes are used as indexes
++       into the free and cell var storage.  Therefore if they aren't
++       deterministic, then the generated bytecode is not deterministic.
++    */
++    sorted_keys = PyDict_Keys(src);
++    if (sorted_keys == NULL)
++        return NULL;
++    if (PyList_Sort(sorted_keys) != 0) {
++        Py_DECREF(sorted_keys);
++        return NULL;
++    }
++    num_keys = PyList_GET_SIZE(sorted_keys);
++
++    for (key_i = 0; key_i < num_keys; key_i++) {
++        k = PyList_GET_ITEM(sorted_keys, key_i);
++        v = PyDict_GetItem(src, k);
+         /* XXX this should probably be a macro in symtable.h */
+         assert(PyInt_Check(v));
+         scope = (PyInt_AS_LONG(v) >> SCOPE_OFF) & SCOPE_MASK;
+@@ -374,12 +391,14 @@
+         if (scope == scope_type || PyInt_AS_LONG(v) & flag) {
+             PyObject *tuple, *item = PyInt_FromLong(i);
+             if (item == NULL) {
++                Py_DECREF(sorted_keys);
+                 Py_DECREF(dest);
+                 return NULL;
+             }
+             i++;
+             tuple = PyTuple_Pack(2, k, k->ob_type);
+             if (!tuple || PyDict_SetItem(dest, tuple, item) < 0) {
++                Py_DECREF(sorted_keys);
+                 Py_DECREF(item);
+                 Py_DECREF(dest);
+                 Py_XDECREF(tuple);
+@@ -389,6 +408,7 @@
+             Py_DECREF(tuple);
+         }
+     }
++    Py_DECREF(sorted_keys);
+     return dest;
+ }
+ 
+diff -r 70274d53c1dd Python/future.c
+--- a/Python/future.c
++++ b/Python/future.c
+@@ -59,13 +59,6 @@
+ {
+     int i, found_docstring = 0, done = 0, prev_line = 0;
+ 
+-    static PyObject *future;
+-    if (!future) {
+-        future = PyString_InternFromString("__future__");
+-        if (!future)
+-            return 0;
+-    }
+-
+     if (!(mod->kind == Module_kind || mod->kind == Interactive_kind))
+         return 1;
+ 
+@@ -92,7 +85,9 @@
+         */
+ 
+         if (s->kind == ImportFrom_kind) {
+-            if (s->v.ImportFrom.module == future) {
++            identifier modname = s->v.ImportFrom.module;
++            if (modname && PyString_GET_SIZE(modname) == 10 &&
++                !strcmp(PyString_AS_STRING(modname), "__future__")) {
+                 if (done) {
+                     PyErr_SetString(PyExc_SyntaxError,
+                                     ERR_LATE_FUTURE);
+diff -r 70274d53c1dd Python/getargs.c
+--- a/Python/getargs.c
++++ b/Python/getargs.c
+@@ -1410,7 +1410,7 @@
+         *errmsg = "convertible to a buffer";
+         return count;
+     }
+-    PyBuffer_FillInfo(view, NULL, buf, count, 1, 0);
++    PyBuffer_FillInfo(view, arg, buf, count, 1, 0);
+     return 0;
+ }
+ 
+diff -r 70274d53c1dd Python/import.c
+--- a/Python/import.c
++++ b/Python/import.c
+@@ -114,6 +114,34 @@
+ };
+ #endif
+ 
++#ifdef MS_WINDOWS
++static int isdir(char *path) {
++    DWORD rv;
++    /* see issue1293 and issue3677:
++     * stat() on Windows doesn't recognise paths like
++     * "e:\\shared\\" and "\\\\whiterab-c2znlh\\shared" as dirs.
++     * Also reference issue6727:
++     * stat() on Windows is broken and doesn't resolve symlinks properly.
++     */
++    rv = GetFileAttributesA(path);
++    return rv != INVALID_FILE_ATTRIBUTES && rv & FILE_ATTRIBUTE_DIRECTORY;
++}
++#else
++#ifdef HAVE_STAT
++static int isdir(char *path) {
++    struct stat statbuf;
++    return stat(path, &statbuf) == 0 && S_ISDIR(statbuf.st_mode);
++}
++#else
++#ifdef RISCOS
++/* with RISCOS, isdir is in unixstuff */
++#else
++int isdir(char *path) {
++    return 0;
++}
++#endif /* RISCOS */
++#endif /* HAVE_STAT */
++#endif /* MS_WINDOWS */
+ 
+ /* Initialize things */
+ 
+@@ -968,9 +996,9 @@
+ {
+     struct stat st;
+     FILE *fpc;
+-    char buf[MAXPATHLEN+1];
++    char *buf;
+     char *cpathname;
+-    PyCodeObject *co;
++    PyCodeObject *co = NULL;
+     PyObject *m;
+ 
+     if (fstat(fileno(fp), &st) != 0) {
+@@ -987,6 +1015,10 @@
+          */
+         st.st_mtime &= 0xFFFFFFFF;
+     }
++    buf = PyMem_MALLOC(MAXPATHLEN+1);
++    if (buf == NULL) {
++        return PyErr_NoMemory();
++    }
+     cpathname = make_compiled_pathname(pathname, buf,
+                                        (size_t)MAXPATHLEN + 1);
+     if (cpathname != NULL &&
+@@ -994,9 +1026,9 @@
+         co = read_compiled_module(cpathname, fpc);
+         fclose(fpc);
+         if (co == NULL)
+-            return NULL;
++            goto error_exit;
+         if (update_compiled_module(co, pathname) < 0)
+-            return NULL;
++            goto error_exit;
+         if (Py_VerboseFlag)
+             PySys_WriteStderr("import %s # precompiled from %s\n",
+                 name, cpathname);
+@@ -1005,7 +1037,7 @@
+     else {
+         co = parse_source_module(pathname, fp);
+         if (co == NULL)
+-            return NULL;
++            goto error_exit;
+         if (Py_VerboseFlag)
+             PySys_WriteStderr("import %s # from %s\n",
+                 name, pathname);
+@@ -1018,7 +1050,13 @@
+     m = PyImport_ExecCodeModuleEx(name, (PyObject *)co, pathname);
+     Py_DECREF(co);
+ 
++    PyMem_FREE(buf);
+     return m;
++
++error_exit:
++    Py_XDECREF(co);
++    PyMem_FREE(buf);
++    return NULL;
+ }
+ 
+ 
+@@ -1038,7 +1076,7 @@
+     PyObject *file = NULL;
+     PyObject *path = NULL;
+     int err;
+-    char buf[MAXPATHLEN+1];
++    char *buf = NULL;
+     FILE *fp = NULL;
+     struct filedescr *fdp;
+ 
+@@ -1060,8 +1098,13 @@
+         err = PyDict_SetItemString(d, "__path__", path);
+     if (err != 0)
+         goto error;
++    buf = PyMem_MALLOC(MAXPATHLEN+1);
++    if (buf == NULL) {
++        PyErr_NoMemory();
++        goto error;
++    }
+     buf[0] = '\0';
+-    fdp = find_module(name, "__init__", path, buf, sizeof(buf), &fp, NULL);
++    fdp = find_module(name, "__init__", path, buf, MAXPATHLEN+1, &fp, NULL);
+     if (fdp == NULL) {
+         if (PyErr_ExceptionMatches(PyExc_ImportError)) {
+             PyErr_Clear();
+@@ -1079,6 +1122,8 @@
+   error:
+     m = NULL;
+   cleanup:
++    if (buf)
++        PyMem_FREE(buf);
+     Py_XDECREF(path);
+     Py_XDECREF(file);
+     return m;
+@@ -1204,13 +1249,10 @@
+     char *filemode;
+     FILE *fp = NULL;
+     PyObject *path_hooks, *path_importer_cache;
+-#ifndef RISCOS
+-    struct stat statbuf;
+-#endif
+     static struct filedescr fd_frozen = {"", "", PY_FROZEN};
+     static struct filedescr fd_builtin = {"", "", C_BUILTIN};
+     static struct filedescr fd_package = {"", "", PKG_DIRECTORY};
+-    char name[MAXPATHLEN+1];
++    char *name;
+ #if defined(PYOS_OS2)
+     size_t saved_len;
+     size_t saved_namelen;
+@@ -1224,6 +1266,11 @@
+                         "module name is too long");
+         return NULL;
+     }
++    name = PyMem_MALLOC(MAXPATHLEN+1);
++    if (name == NULL) {
++        PyErr_NoMemory();
++        return NULL;
++    }
+     strcpy(name, subname);
+ 
+     /* sys.meta_path import hook */
+@@ -1235,7 +1282,7 @@
+             PyErr_SetString(PyExc_RuntimeError,
+                             "sys.meta_path must be a list of "
+                             "import hooks");
+-            return NULL;
++            goto error_exit;
+         }
+         Py_INCREF(meta_path);  /* zap guard */
+         npath = PyList_Size(meta_path);
+@@ -1248,12 +1295,13 @@
+                                          path : Py_None);
+             if (loader == NULL) {
+                 Py_DECREF(meta_path);
+-                return NULL;  /* true error */
++                goto error_exit;  /* true error */
+             }
+             if (loader != Py_None) {
+                 /* a loader was found */
+                 *p_loader = loader;
+                 Py_DECREF(meta_path);
++                PyMem_FREE(name);
+                 return &importhookdescr;
+             }
+             Py_DECREF(loader);
+@@ -1267,7 +1315,7 @@
+         if (PyString_Size(path) + 1 + strlen(name) >= (size_t)buflen) {
+             PyErr_SetString(PyExc_ImportError,
+                             "full frozen module name too long");
+-            return NULL;
++            goto error_exit;
+         }
+         strcpy(buf, PyString_AsString(path));
+         strcat(buf, ".");
+@@ -1275,19 +1323,22 @@
+         strcpy(name, buf);
+         if (find_frozen(name) != NULL) {
+             strcpy(buf, name);
++            PyMem_FREE(name);
+             return &fd_frozen;
+         }
+         PyErr_Format(PyExc_ImportError,
+                      "No frozen submodule named %.200s", name);
+-        return NULL;
++        goto error_exit;
+     }
+     if (path == NULL) {
+         if (is_builtin(name)) {
+             strcpy(buf, name);
++            PyMem_FREE(name);
+             return &fd_builtin;
+         }
+         if ((find_frozen(name)) != NULL) {
+             strcpy(buf, name);
++            PyMem_FREE(name);
+             return &fd_frozen;
+         }
+ 
+@@ -1295,6 +1346,7 @@
+         fp = PyWin_FindRegisteredModule(name, &fdp, buf, buflen);
+         if (fp != NULL) {
+             *p_fp = fp;
++            PyMem_FREE(name);
+             return fdp;
+         }
+ #endif
+@@ -1303,7 +1355,7 @@
+     if (path == NULL || !PyList_Check(path)) {
+         PyErr_SetString(PyExc_RuntimeError,
+                         "sys.path must be a list of directory names");
+-        return NULL;
++        goto error_exit;
+     }
+ 
+     path_hooks = PySys_GetObject("path_hooks");
+@@ -1311,14 +1363,14 @@
+         PyErr_SetString(PyExc_RuntimeError,
+                         "sys.path_hooks must be a list of "
+                         "import hooks");
+-        return NULL;
++        goto error_exit;
+     }
+     path_importer_cache = PySys_GetObject("path_importer_cache");
+     if (path_importer_cache == NULL ||
+         !PyDict_Check(path_importer_cache)) {
+         PyErr_SetString(PyExc_RuntimeError,
+                         "sys.path_importer_cache must be a dict");
+-        return NULL;
++        goto error_exit;
+     }
+ 
+     npath = PyList_Size(path);
+@@ -1327,13 +1379,13 @@
+         PyObject *copy = NULL;
+         PyObject *v = PyList_GetItem(path, i);
+         if (!v)
+-            return NULL;
++            goto error_exit;
+ #ifdef Py_USING_UNICODE
+         if (PyUnicode_Check(v)) {
+             copy = PyUnicode_Encode(PyUnicode_AS_UNICODE(v),
+                 PyUnicode_GET_SIZE(v), Py_FileSystemDefaultEncoding, NULL);
+             if (copy == NULL)
+-                return NULL;
++                goto error_exit;
+             v = copy;
+         }
+         else
+@@ -1359,7 +1411,7 @@
+                                          path_hooks, v);
+             if (importer == NULL) {
+                 Py_XDECREF(copy);
+-                return NULL;
++                goto error_exit;
+             }
+             /* Note: importer is a borrowed reference */
+             if (importer != Py_None) {
+@@ -1369,10 +1421,11 @@
+                                              "s", fullname);
+                 Py_XDECREF(copy);
+                 if (loader == NULL)
+-                    return NULL;  /* error */
++                    goto error_exit;  /* error */
+                 if (loader != Py_None) {
+                     /* a loader was found */
+                     *p_loader = loader;
++                    PyMem_FREE(name);
+                     return &importhookdescr;
+                 }
+                 Py_DECREF(loader);
+@@ -1392,12 +1445,11 @@
+ 
+         /* Check for package import (buf holds a directory name,
+            and there's an __init__ module in that directory */
+-#ifdef HAVE_STAT
+-        if (stat(buf, &statbuf) == 0 &&         /* it exists */
+-            S_ISDIR(statbuf.st_mode) &&         /* it's a directory */
++        if (isdir(buf) &&         /* it's an existing directory */
+             case_ok(buf, len, namelen, name)) { /* case matches */
+             if (find_init_module(buf)) { /* and has __init__.py */
+                 Py_XDECREF(copy);
++                PyMem_FREE(name);
+                 return &fd_package;
+             }
+             else {
+@@ -1408,32 +1460,10 @@
+                 if (PyErr_Warn(PyExc_ImportWarning,
+                                warnstr)) {
+                     Py_XDECREF(copy);
+-                    return NULL;
++                    goto error_exit;
+                 }
+             }
+         }
+-#else
+-        /* XXX How are you going to test for directories? */
+-#ifdef RISCOS
+-        if (isdir(buf) &&
+-            case_ok(buf, len, namelen, name)) {
+-            if (find_init_module(buf)) {
+-                Py_XDECREF(copy);
+-                return &fd_package;
+-            }
+-            else {
+-                char warnstr[MAXPATHLEN+80];
+-                sprintf(warnstr, "Not importing directory "
+-                    "'%.*s': missing __init__.py",
+-                    MAXPATHLEN, buf);
+-                if (PyErr_Warn(PyExc_ImportWarning,
+-                               warnstr)) {
+-                    Py_XDECREF(copy);
+-                    return NULL;
+-                }
+-        }
+-#endif
+-#endif
+ #if defined(PYOS_OS2)
+         /* take a snapshot of the module spec for restoration
+          * after the 8 character DLL hackery
+@@ -1505,10 +1535,15 @@
+     if (fp == NULL) {
+         PyErr_Format(PyExc_ImportError,
+                      "No module named %.200s", name);
+-        return NULL;
++        goto error_exit;
+     }
+     *p_fp = fp;
++    PyMem_FREE(name);
+     return fdp;
++
++error_exit:
++    PyMem_FREE(name);
++    return NULL;
+ }
+ 
+ /* Helpers for main.c
+@@ -2115,7 +2150,7 @@
+ import_module_level(char *name, PyObject *globals, PyObject *locals,
+                     PyObject *fromlist, int level)
+ {
+-    char buf[MAXPATHLEN+1];
++    char *buf;
+     Py_ssize_t buflen = 0;
+     PyObject *parent, *head, *next, *tail;
+ 
+@@ -2129,14 +2164,18 @@
+         return NULL;
+     }
+ 
++    buf = PyMem_MALLOC(MAXPATHLEN+1);
++    if (buf == NULL) {
++        return PyErr_NoMemory();
++    }
+     parent = get_parent(globals, buf, &buflen, level);
+     if (parent == NULL)
+-        return NULL;
++        goto error_exit;
+ 
+     head = load_next(parent, level < 0 ? Py_None : parent, &name, buf,
+                         &buflen);
+     if (head == NULL)
+-        return NULL;
++        goto error_exit;
+ 
+     tail = head;
+     Py_INCREF(tail);
+@@ -2145,7 +2184,7 @@
+         Py_DECREF(tail);
+         if (next == NULL) {
+             Py_DECREF(head);
+-            return NULL;
++            goto error_exit;
+         }
+         tail = next;
+     }
+@@ -2157,7 +2196,7 @@
+         Py_DECREF(head);
+         PyErr_SetString(PyExc_ValueError,
+                         "Empty module name");
+-        return NULL;
++        goto error_exit;
+     }
+ 
+     if (fromlist != NULL) {
+@@ -2167,16 +2206,22 @@
+ 
+     if (fromlist == NULL) {
+         Py_DECREF(tail);
++        PyMem_FREE(buf);
+         return head;
+     }
+ 
+     Py_DECREF(head);
+     if (!ensure_fromlist(tail, fromlist, buf, buflen, 0)) {
+         Py_DECREF(tail);
+-        return NULL;
++        goto error_exit;
+     }
+ 
++    PyMem_FREE(buf);
+     return tail;
++
++error_exit:
++    PyMem_FREE(buf);
++    return NULL;
+ }
+ 
+ PyObject *
+@@ -2566,7 +2611,7 @@
+     }
+     else {
+         PyObject *path, *loader = NULL;
+-        char buf[MAXPATHLEN+1];
++        char *buf;
+         struct filedescr *fdp;
+         FILE *fp = NULL;
+ 
+@@ -2581,11 +2626,16 @@
+             }
+         }
+ 
++        buf = PyMem_MALLOC(MAXPATHLEN+1);
++        if (buf == NULL) {
++            return PyErr_NoMemory();
++        }
+         buf[0] = '\0';
+         fdp = find_module(fullname, subname, path, buf, MAXPATHLEN+1,
+                           &fp, &loader);
+         Py_XDECREF(path);
+         if (fdp == NULL) {
++            PyMem_FREE(buf);
+             if (!PyErr_ExceptionMatches(PyExc_ImportError))
+                 return NULL;
+             PyErr_Clear();
+@@ -2600,6 +2650,7 @@
+             Py_XDECREF(m);
+             m = NULL;
+         }
++        PyMem_FREE(buf);
+     }
+ 
+     return m;
+@@ -2617,7 +2668,7 @@
+     PyObject *modules = PyImport_GetModuleDict();
+     PyObject *path = NULL, *loader = NULL, *existing_m = NULL;
+     char *name, *subname;
+-    char buf[MAXPATHLEN+1];
++    char *buf;
+     struct filedescr *fdp;
+     FILE *fp = NULL;
+     PyObject *newm;
+@@ -2677,6 +2728,11 @@
+         if (path == NULL)
+             PyErr_Clear();
+     }
++    buf = PyMem_MALLOC(MAXPATHLEN+1);
++    if (buf == NULL) {
++        Py_XDECREF(path);
++        return PyErr_NoMemory();
++    }
+     buf[0] = '\0';
+     fdp = find_module(name, subname, path, buf, MAXPATHLEN+1, &fp, &loader);
+     Py_XDECREF(path);
+@@ -2684,6 +2740,7 @@
+     if (fdp == NULL) {
+         Py_XDECREF(loader);
+         imp_modules_reloading_clear();
++        PyMem_FREE(buf);
+         return NULL;
+     }
+ 
+@@ -2701,6 +2758,7 @@
+         PyDict_SetItemString(modules, name, m);
+     }
+     imp_modules_reloading_clear();
++    PyMem_FREE(buf);
+     return newm;
+ }
+ 
+@@ -2831,19 +2889,27 @@
+     extern int fclose(FILE *);
+     PyObject *fob, *ret;
+     struct filedescr *fdp;
+-    char pathname[MAXPATHLEN+1];
++    char *pathname;
+     FILE *fp = NULL;
+ 
++    pathname = PyMem_MALLOC(MAXPATHLEN+1);
++    if (pathname == NULL) {
++        return PyErr_NoMemory();
++    }
+     pathname[0] = '\0';
+     if (path == Py_None)
+         path = NULL;
+     fdp = find_module(NULL, name, path, pathname, MAXPATHLEN+1, &fp, NULL);
+-    if (fdp == NULL)
++    if (fdp == NULL) {
++        PyMem_FREE(pathname);
+         return NULL;
++    }
+     if (fp != NULL) {
+         fob = PyFile_FromFile(fp, pathname, fdp->mode, fclose);
+-        if (fob == NULL)
++        if (fob == NULL) {
++            PyMem_FREE(pathname);
+             return NULL;
++        }
+     }
+     else {
+         fob = Py_None;
+@@ -2852,6 +2918,7 @@
+     ret = Py_BuildValue("Os(ssi)",
+                   fob, pathname, fdp->suffix, fdp->mode, fdp->type);
+     Py_DECREF(fob);
++    PyMem_FREE(pathname);
+     return ret;
+ }
+ 
+@@ -3199,49 +3266,11 @@
+         PyErr_SetString(PyExc_ImportError, "empty pathname");
+         return -1;
+     } else {
+-#ifndef RISCOS
+-#ifndef MS_WINDOWS
+-        struct stat statbuf;
+-        int rv;
+-
+-        rv = stat(path, &statbuf);
+-        if (rv == 0) {
+-            /* it exists */
+-            if (S_ISDIR(statbuf.st_mode)) {
+-                /* it's a directory */
+-                PyErr_SetString(PyExc_ImportError,
+-                                "existing directory");
+-                return -1;
+-            }
++        if(isdir(path)) {
++            PyErr_SetString(PyExc_ImportError,
++                            "existing directory");
++            return -1;
+         }
+-#else /* MS_WINDOWS */
+-        DWORD rv;
+-        /* see issue1293 and issue3677:
+-         * stat() on Windows doesn't recognise paths like
+-         * "e:\\shared\\" and "\\\\whiterab-c2znlh\\shared" as dirs.
+-         */
+-        rv = GetFileAttributesA(path);
+-        if (rv != INVALID_FILE_ATTRIBUTES) {
+-            /* it exists */
+-            if (rv & FILE_ATTRIBUTE_DIRECTORY) {
+-                /* it's a directory */
+-                PyErr_SetString(PyExc_ImportError,
+-                                "existing directory");
+-                return -1;
+-            }
+-        }
+-#endif
+-#else /* RISCOS */
+-        if (object_exists(path)) {
+-            /* it exists */
+-            if (isdir(path)) {
+-                /* it's a directory */
+-                PyErr_SetString(PyExc_ImportError,
+-                                "existing directory");
+-                return -1;
+-            }
+-        }
+-#endif
+     }
+     return 0;
+ }
+diff -r 70274d53c1dd Python/peephole.c
+--- a/Python/peephole.c
++++ b/Python/peephole.c
+@@ -135,6 +135,7 @@
+                will return a surrogate.  In both the cases skip the
+                optimization in order to produce compatible pycs.
+              */
++#ifdef Py_USING_UNICODE
+             if (newconst != NULL &&
+                 PyUnicode_Check(v) && PyUnicode_Check(newconst)) {
+                 Py_UNICODE ch = PyUnicode_AS_UNICODE(newconst)[0];
+@@ -147,6 +148,7 @@
+                     return 0;
+                 }
+             }
++#endif
+             break;
+         case BINARY_LSHIFT:
+             newconst = PyNumber_Lshift(v, w);
+@@ -345,7 +347,7 @@
+     codestr = (unsigned char *)memcpy(codestr,
+                                       PyString_AS_STRING(code), codelen);
+ 
+-    /* Verify that RETURN_VALUE terminates the codestring.      This allows
++    /* Verify that RETURN_VALUE terminates the codestring. This allows
+        the various transformation patterns to look ahead several
+        instructions without additional checks to make sure they are not
+        looking beyond the end of the code string.
+@@ -443,8 +445,8 @@
+             case BUILD_LIST:
+                 j = GETARG(codestr, i);
+                 h = i - 3 * j;
+-                if (h >= 0  &&
+-                    j <= lastlc                  &&
++                if (h >= 0 &&
++                    j <= lastlc &&
+                     ((opcode == BUILD_TUPLE &&
+                       ISBASICBLOCK(blocks, h, 3*(j+1))) ||
+                      (opcode == BUILD_LIST &&
+@@ -488,8 +490,8 @@
+             case BINARY_AND:
+             case BINARY_XOR:
+             case BINARY_OR:
+-                if (lastlc >= 2                  &&
+-                    ISBASICBLOCK(blocks, i-6, 7)  &&
++                if (lastlc >= 2 &&
++                    ISBASICBLOCK(blocks, i-6, 7) &&
+                     fold_binops_on_constants(&codestr[i-6], consts)) {
+                     i -= 2;
+                     assert(codestr[i] == LOAD_CONST);
+@@ -498,13 +500,13 @@
+                 break;
+ 
+                 /* Fold unary ops on constants.
+-                   LOAD_CONST c1  UNARY_OP -->                  LOAD_CONST unary_op(c) */
++                   LOAD_CONST c1  UNARY_OP --> LOAD_CONST unary_op(c) */
+             case UNARY_NEGATIVE:
+             case UNARY_CONVERT:
+             case UNARY_INVERT:
+-                if (lastlc >= 1                  &&
+-                    ISBASICBLOCK(blocks, i-3, 4)  &&
+-                    fold_unaryops_on_constants(&codestr[i-3], consts))                  {
++                if (lastlc >= 1 &&
++                    ISBASICBLOCK(blocks, i-3, 4) &&
++                    fold_unaryops_on_constants(&codestr[i-3], consts)) {
+                     i -= 2;
+                     assert(codestr[i] == LOAD_CONST);
+                     cumlc = 1;
+@@ -530,8 +532,7 @@
+                 tgt = GETJUMPTGT(codestr, i);
+                 j = codestr[tgt];
+                 if (CONDITIONAL_JUMP(j)) {
+-                    /* NOTE: all possible jumps here are
+-                       absolute! */
++                    /* NOTE: all possible jumps here are absolute! */
+                     if (JUMPS_ON_TRUE(j) == JUMPS_ON_TRUE(opcode)) {
+                         /* The second jump will be
+                            taken iff the first is. */
+@@ -542,13 +543,10 @@
+                         SETARG(codestr, i, tgttgt);
+                         goto reoptimize_current;
+                     } else {
+-                        /* The second jump is not taken
+-                           if the first is (so jump past
+-                           it), and all conditional
+-                           jumps pop their argument when
+-                           they're not taken (so change
+-                           the first jump to pop its
+-                           argument when it's taken). */
++                        /* The second jump is not taken if the first is (so
++                           jump past it), and all conditional jumps pop their
++                           argument when they're not taken (so change the
++                           first jump to pop its argument when it's taken). */
+                         if (JUMPS_ON_TRUE(opcode))
+                             codestr[i] = POP_JUMP_IF_TRUE;
+                         else
+@@ -584,8 +582,8 @@
+                 if (opcode == JUMP_FORWARD) /* JMP_ABS can go backwards */
+                     opcode = JUMP_ABSOLUTE;
+                 if (!ABSOLUTE_JUMP(opcode))
+-                    tgttgt -= i + 3;     /* Calc relative jump addr */
+-                if (tgttgt < 0)                           /* No backward relative jumps */
++                    tgttgt -= i + 3;        /* Calc relative jump addr */
++                if (tgttgt < 0)             /* No backward relative jumps */
+                     continue;
+                 codestr[i] = opcode;
+                 SETARG(codestr, i, tgttgt);
+diff -r 70274d53c1dd Python/pystate.c
+--- a/Python/pystate.c
++++ b/Python/pystate.c
+@@ -22,6 +22,9 @@
+ #endif
+ #endif
+ 
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ #ifdef WITH_THREAD
+ #include "pythread.h"
+@@ -30,10 +33,6 @@
+ #define HEAD_LOCK() PyThread_acquire_lock(head_mutex, WAIT_LOCK)
+ #define HEAD_UNLOCK() PyThread_release_lock(head_mutex)
+ 
+-#ifdef __cplusplus
+-extern "C" {
+-#endif
+-
+ /* The single PyInterpreterState used by this process'
+    GILState implementation
+ */
+@@ -654,10 +653,10 @@
+         PyEval_SaveThread();
+ }
+ 
++#endif /* WITH_THREAD */
++
+ #ifdef __cplusplus
+ }
+ #endif
+ 
+-#endif /* WITH_THREAD */
+ 
+-
+diff -r 70274d53c1dd Python/pythonrun.c
+--- a/Python/pythonrun.c
++++ b/Python/pythonrun.c
+@@ -989,55 +989,67 @@
+         return PyArg_ParseTuple(err, "O(ziiz)", message, filename,
+                                 lineno, offset, text);
+ 
++    *message = NULL;
++
+     /* new style errors.  `err' is an instance */
+-
+-    if (! (v = PyObject_GetAttrString(err, "msg")))
+-        goto finally;
+-    *message = v;
+-
+-    if (!(v = PyObject_GetAttrString(err, "filename")))
+-        goto finally;
+-    if (v == Py_None)
+-        *filename = NULL;
+-    else if (! (*filename = PyString_AsString(v)))
++    *message = PyObject_GetAttrString(err, "msg");
++    if (!*message)
+         goto finally;
+ 
+-    Py_DECREF(v);
+-    if (!(v = PyObject_GetAttrString(err, "lineno")))
++    v = PyObject_GetAttrString(err, "filename");
++    if (!v)
++        goto finally;
++    if (v == Py_None) {
++        Py_DECREF(v);
++        *filename = NULL;
++    }
++    else {
++        *filename = PyString_AsString(v);
++        Py_DECREF(v);
++        if (!*filename)
++            goto finally;
++    }
++
++    v = PyObject_GetAttrString(err, "lineno");
++    if (!v)
+         goto finally;
+     hold = PyInt_AsLong(v);
+     Py_DECREF(v);
+-    v = NULL;
+     if (hold < 0 && PyErr_Occurred())
+         goto finally;
+     *lineno = (int)hold;
+ 
+-    if (!(v = PyObject_GetAttrString(err, "offset")))
++    v = PyObject_GetAttrString(err, "offset");
++    if (!v)
+         goto finally;
+     if (v == Py_None) {
+         *offset = -1;
+         Py_DECREF(v);
+-        v = NULL;
+     } else {
+         hold = PyInt_AsLong(v);
+         Py_DECREF(v);
+-        v = NULL;
+         if (hold < 0 && PyErr_Occurred())
+             goto finally;
+         *offset = (int)hold;
+     }
+ 
+-    if (!(v = PyObject_GetAttrString(err, "text")))
++    v = PyObject_GetAttrString(err, "text");
++    if (!v)
+         goto finally;
+-    if (v == Py_None)
++    if (v == Py_None) {
++        Py_DECREF(v);
+         *text = NULL;
+-    else if (! (*text = PyString_AsString(v)))
+-        goto finally;
+-    Py_DECREF(v);
++    }
++    else {
++        *text = PyString_AsString(v);
++        Py_DECREF(v);
++        if (!*text)
++            goto finally;
++    }
+     return 1;
+ 
+ finally:
+-    Py_XDECREF(v);
++    Py_XDECREF(*message);
+     return 0;
+ }
+ 
+diff -r 70274d53c1dd Python/thread.c
+--- a/Python/thread.c
++++ b/Python/thread.c
+@@ -24,7 +24,7 @@
+ #include <stdlib.h>
+ 
+ #ifdef __sgi
+-#ifndef HAVE_PTHREAD_H /* XXX Need to check in configure.in */
++#ifndef HAVE_PTHREAD_H /* XXX Need to check in configure.ac */
+ #undef _POSIX_THREADS
+ #endif
+ #endif
+diff -r 70274d53c1dd README
+--- a/README
++++ b/README
+@@ -241,7 +241,7 @@
+ - NeXT
+ - Irix 4 and --with-sgi-dl
+ - Linux 1
+-- Systems defining __d6_pthread_create (configure.in)
++- Systems defining __d6_pthread_create (configure.ac)
+ - Systems defining PY_PTHREAD_D4, PY_PTHREAD_D6,
+   or PY_PTHREAD_D7 in thread_pthread.h
+ - Systems using --with-dl-dld
+@@ -680,10 +680,10 @@
+ threads to work properly.  Below is a table of those options,
+ collected by Bill Janssen.  We would love to automate this process
+ more, but the information below is not enough to write a patch for the
+-configure.in file, so manual intervention is required.  If you patch
+-the configure.in file and are confident that the patch works, please
++configure.ac file, so manual intervention is required.  If you patch
++the configure.ac file and are confident that the patch works, please
+ send in the patch.  (Don't bother patching the configure script itself
+--- it is regenerated each time the configure.in file changes.)
++-- it is regenerated each time the configure.ac file changes.)
+ 
+ Compiler switches for threads
+ .............................
+@@ -1201,7 +1201,7 @@
+ Tools/          Some useful programs written in Python
+ pyconfig.h.in   Source from which pyconfig.h is created (GNU autoheader output)
+ configure       Configuration shell script (GNU autoconf output)
+-configure.in    Configuration specification (input for GNU autoconf)
++configure.ac    Configuration specification (input for GNU autoconf)
+ install-sh      Shell script used to install files
+ setup.py        Python script used to build extension modules
+ 
+diff -r 70274d53c1dd Tools/buildbot/build-amd64.bat
+--- a/Tools/buildbot/build-amd64.bat
++++ b/Tools/buildbot/build-amd64.bat
+@@ -1,4 +1,5 @@
+ @rem Used by the buildbot "compile" step.
++set HOST_PYTHON="%CD%\PCbuild\amd64\python_d.exe"
+ cmd /c Tools\buildbot\external-amd64.bat
+ call "%VS90COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64
+ cmd /c Tools\buildbot\clean-amd64.bat
+diff -r 70274d53c1dd Tools/buildbot/external-common.bat
+--- a/Tools/buildbot/external-common.bat
++++ b/Tools/buildbot/external-common.bat
+@@ -4,7 +4,7 @@
+ cd ..
+ @rem XXX: If you need to force the buildbots to start from a fresh environment, uncomment
+ @rem the following, check it in, then check it out, comment it out, then check it back in.
+-@rem if exist bzip2-1.0.5 rd /s/q bzip2-1.0.5
++@rem if exist bzip2-1.0.6 rd /s/q bzip2-1.0.6
+ @rem if exist tcltk rd /s/q tcltk
+ @rem if exist tcltk64 rd /s/q tcltk64
+ @rem if exist tcl8.4.12 rd /s/q tcl8.4.12
+@@ -15,13 +15,13 @@
+ @rem if exist tk-8.4.18.1 rd /s/q tk-8.4.18.1
+ @rem if exist db-4.4.20 rd /s/q db-4.4.20
+ @rem if exist db-4.7.25.0 rd /s/q db-4.7.25.0
+-@rem if exist openssl-0.9.8l rd /s/q openssl-0.9.8l
++@rem if exist openssl-0.9.8x rd /s/q openssl-0.9.8x
+ @rem if exist sqlite-3.6.21 rd /s/q sqlite-3.6.21    
+ 
+ @rem bzip
+-if not exist bzip2-1.0.5 (
+-   rd /s/q bzip2-1.0.3
+-  svn export http://svn.python.org/projects/external/bzip2-1.0.5
++if not exist bzip2-1.0.6 (
++   rd /s/q bzip2-1.0.5
++  svn export http://svn.python.org/projects/external/bzip2-1.0.6
+ )
+ 
+ @rem Berkeley DB
+@@ -29,7 +29,7 @@
+ if not exist db-4.7.25.0 svn export http://svn.python.org/projects/external/db-4.7.25.0
+ 
+ @rem OpenSSL
+-if not exist openssl-0.9.8l svn export http://svn.python.org/projects/external/openssl-0.9.8l
++if not exist openssl-0.9.8x svn export http://svn.python.org/projects/external/openssl-0.9.8x
+ 
+ @rem tcl/tk
+ if not exist tcl-8.5.2.1 (
+diff -r 70274d53c1dd Tools/buildbot/test-amd64.bat
+--- a/Tools/buildbot/test-amd64.bat
++++ b/Tools/buildbot/test-amd64.bat
+@@ -1,3 +1,3 @@
+ @rem Used by the buildbot "test" step.
+ cd PCbuild
+-call rt.bat -q -d -x64 -uall -rw
++call rt.bat -d -q -x64 -uall -rwW %1 %2 %3 %4 %5 %6 %7 %8 %9
+diff -r 70274d53c1dd Tools/buildbot/test.bat
+--- a/Tools/buildbot/test.bat
++++ b/Tools/buildbot/test.bat
+@@ -1,3 +1,3 @@
+ @rem Used by the buildbot "test" step.
+ cd PCbuild
+-call rt.bat -d -q -uall -rwW
++call rt.bat -d -q -uall -rwW %1 %2 %3 %4 %5 %6 %7 %8 %9
+diff -r 70274d53c1dd Tools/scripts/byext.py
+--- a/Tools/scripts/byext.py
++++ b/Tools/scripts/byext.py
+@@ -2,6 +2,8 @@
+ 
+ """Show file statistics by extension."""
+ 
++from __future__ import print_function
++
+ import os
+ import sys
+ 
+diff -r 70274d53c1dd configure.ac
+--- /dev/null
++++ b/configure.ac
+@@ -0,0 +1,4356 @@
++dnl ***********************************************
++dnl * Please run autoreconf to test your changes! *
++dnl ***********************************************
++
++# Set VERSION so we only need to edit in one place (i.e., here)
++m4_define(PYTHON_VERSION, 2.7)
++
++AC_PREREQ(2.65)
++
++AC_REVISION($Revision$)
++AC_INIT(python, PYTHON_VERSION, http://bugs.python.org/)
++AC_CONFIG_SRCDIR([Include/object.h])
++AC_CONFIG_HEADER(pyconfig.h)
++
++dnl Ensure that if prefix is specified, it does not end in a slash. If
++dnl it does, we get path names containing '//' which is both ugly and
++dnl can cause trouble.
++
++dnl Last slash shouldn't be stripped if prefix=/
++if test "$prefix" != "/"; then
++    prefix=`echo "$prefix" | sed -e 's/\/$//g'`
++fi    
++
++dnl This is for stuff that absolutely must end up in pyconfig.h.
++dnl Please use pyport.h instead, if possible.
++AH_TOP([
++#ifndef Py_PYCONFIG_H
++#define Py_PYCONFIG_H
++])
++AH_BOTTOM([
++/* Define the macros needed if on a UnixWare 7.x system. */
++#if defined(__USLC__) && defined(__SCO_VERSION__)
++#define STRICT_SYSV_CURSES /* Don't use ncurses extensions */
++#endif
++
++#endif /*Py_PYCONFIG_H*/
++])
++
++# We don't use PACKAGE_ variables, and they cause conflicts
++# with other autoconf-based packages that include Python.h
++grep -v 'define PACKAGE_' <confdefs.h >confdefs.h.new
++rm confdefs.h
++mv confdefs.h.new confdefs.h
++
++AC_SUBST(VERSION)
++VERSION=PYTHON_VERSION
++
++AC_SUBST(SOVERSION)
++SOVERSION=1.0
++
++# The later defininition of _XOPEN_SOURCE disables certain features
++# on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone).
++AC_DEFINE(_GNU_SOURCE, 1, [Define on Linux to activate all library features])
++
++# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
++# certain features on NetBSD, so we need _NETBSD_SOURCE to re-enable
++# them.
++AC_DEFINE(_NETBSD_SOURCE, 1, [Define on NetBSD to activate all library features])
++
++# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
++# certain features on FreeBSD, so we need __BSD_VISIBLE to re-enable
++# them.
++AC_DEFINE(__BSD_VISIBLE, 1, [Define on FreeBSD to activate all library features])
++
++# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
++# u_int on Irix 5.3. Defining _BSD_TYPES brings it back.
++AC_DEFINE(_BSD_TYPES, 1, [Define on Irix to enable u_int])
++
++# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
++# certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable
++# them.
++AC_DEFINE(_DARWIN_C_SOURCE, 1, [Define on Darwin to activate all library features])
++
++
++define_xopen_source=yes
++
++# Arguments passed to configure.
++AC_SUBST(CONFIG_ARGS)
++CONFIG_ARGS="$ac_configure_args"
++
++AC_MSG_CHECKING([for --enable-universalsdk])
++AC_ARG_ENABLE(universalsdk,
++	AS_HELP_STRING([--enable-universalsdk@<:@=SDKDIR@:>@], [Build against Mac OS X 10.4u SDK (ppc/i386)]),
++[
++	case $enableval in
++	yes)
++		enableval=/Developer/SDKs/MacOSX10.4u.sdk
++		if test ! -d "${enableval}"
++		then
++			enableval=/
++		fi
++		;;
++	esac
++	case $enableval in
++	no)
++		UNIVERSALSDK=
++		enable_universalsdk=
++		;;
++	*)
++		UNIVERSALSDK=$enableval
++		if test ! -d "${UNIVERSALSDK}"
++		then
++			AC_MSG_ERROR([--enable-universalsdk specifies non-existing SDK: ${UNIVERSALSDK}])
++		fi
++		;;
++	esac
++	
++],[
++   	UNIVERSALSDK=
++	enable_universalsdk=
++])
++if test -n "${UNIVERSALSDK}"
++then
++	AC_MSG_RESULT(${UNIVERSALSDK})
++else
++	AC_MSG_RESULT(no)
++fi
++AC_SUBST(UNIVERSALSDK)
++
++AC_SUBST(ARCH_RUN_32BIT)
++
++UNIVERSAL_ARCHS="32-bit"
++AC_SUBST(LIPO_32BIT_FLAGS)
++AC_MSG_CHECKING(for --with-universal-archs)
++AC_ARG_WITH(universal-archs,
++    AS_HELP_STRING([--with-universal-archs=ARCH], [select architectures for universal build ("32-bit", "64-bit", "3-way", "intel" or "all")]),
++[
++	AC_MSG_RESULT($withval)
++	UNIVERSAL_ARCHS="$withval"
++        if test "${enable_universalsdk}" ; then
++		:
++	else
++		AC_MSG_ERROR([--with-universal-archs without --enable-universalsdk. See Mac/README])
++	fi
++],
++[
++ 	AC_MSG_RESULT(32-bit)
++])
++
++
++
++AC_ARG_WITH(framework-name,
++              AS_HELP_STRING([--with-framework-name=FRAMEWORK],
++                             [specify an alternate name of the framework built with --enable-framework]),
++[
++    if test "${enable_framework}"; then
++	    :
++    else
++	AC_MSG_ERROR([--with-framework-name without --enable-framework. See Mac/README])
++    fi
++    PYTHONFRAMEWORK=${withval}
++    PYTHONFRAMEWORKDIR=${withval}.framework
++    PYTHONFRAMEWORKIDENTIFIER=org.python.`echo $withval | tr '[A-Z]' '[a-z]'`
++    ],[
++    PYTHONFRAMEWORK=Python
++    PYTHONFRAMEWORKDIR=Python.framework
++    PYTHONFRAMEWORKIDENTIFIER=org.python.python
++])
++dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
++AC_ARG_ENABLE(framework,
++              AS_HELP_STRING([--enable-framework@<:@=INSTALLDIR@:>@], [Build (MacOSX|Darwin) framework]),
++[
++	case $enableval in
++	yes) 
++		enableval=/Library/Frameworks
++	esac
++	case $enableval in
++	no)
++		PYTHONFRAMEWORK=
++		PYTHONFRAMEWORKDIR=no-framework
++		PYTHONFRAMEWORKPREFIX=
++		PYTHONFRAMEWORKINSTALLDIR=
++		FRAMEWORKINSTALLFIRST=
++		FRAMEWORKINSTALLLAST=
++		FRAMEWORKALTINSTALLFIRST=
++		FRAMEWORKALTINSTALLLAST=
++		if test "x${prefix}" = "xNONE"; then
++			FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
++		else
++			FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
++		fi
++		enable_framework=
++		;;
++	*)
++		PYTHONFRAMEWORKPREFIX="${enableval}"
++		PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
++		FRAMEWORKINSTALLFIRST="frameworkinstallstructure"
++		FRAMEWORKALTINSTALLFIRST="frameworkinstallstructure bininstall maninstall"
++		FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools"
++		FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools"
++		FRAMEWORKINSTALLAPPSPREFIX="/Applications"
++
++		if test "x${prefix}" = "xNONE" ; then
++			FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
++
++		else
++			FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
++		fi
++
++		case "${enableval}" in
++		/System*)
++			FRAMEWORKINSTALLAPPSPREFIX="/Applications"
++			if test "${prefix}" = "NONE" ; then
++				# See below
++				FRAMEWORKUNIXTOOLSPREFIX="/usr"
++			fi
++			;;
++
++		/Library*)
++			FRAMEWORKINSTALLAPPSPREFIX="/Applications"
++			;;
++
++		*/Library/Frameworks)
++			MDIR="`dirname "${enableval}"`"
++			MDIR="`dirname "${MDIR}"`"
++			FRAMEWORKINSTALLAPPSPREFIX="${MDIR}/Applications"
++
++			if test "${prefix}" = "NONE"; then
++				# User hasn't specified the 
++				# --prefix option, but wants to install
++				# the framework in a non-default location,
++				# ensure that the compatibility links get
++				# installed relative to that prefix as well
++				# instead of in /usr/local.
++				FRAMEWORKUNIXTOOLSPREFIX="${MDIR}"
++			fi
++			;;
++
++		*)
++			FRAMEWORKINSTALLAPPSPREFIX="/Applications"
++			;;
++		esac
++
++		prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION
++
++		# Add files for Mac specific code to the list of output
++		# files:
++		AC_CONFIG_FILES(Mac/Makefile)
++		AC_CONFIG_FILES(Mac/PythonLauncher/Makefile)
++		AC_CONFIG_FILES(Mac/IDLE/Makefile)
++		AC_CONFIG_FILES(Mac/Resources/framework/Info.plist)
++		AC_CONFIG_FILES(Mac/Resources/app/Info.plist)
++	esac
++	],[
++	PYTHONFRAMEWORK=
++	PYTHONFRAMEWORKDIR=no-framework
++	PYTHONFRAMEWORKPREFIX=
++	PYTHONFRAMEWORKINSTALLDIR=
++	FRAMEWORKINSTALLFIRST=
++	FRAMEWORKINSTALLLAST=
++	FRAMEWORKALTINSTALLFIRST=
++	FRAMEWORKALTINSTALLLAST=
++	if test "x${prefix}" = "xNONE" ; then
++		FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
++	else
++		FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
++	fi
++	enable_framework=
++
++])
++AC_SUBST(PYTHONFRAMEWORK)
++AC_SUBST(PYTHONFRAMEWORKIDENTIFIER)
++AC_SUBST(PYTHONFRAMEWORKDIR)
++AC_SUBST(PYTHONFRAMEWORKPREFIX)
++AC_SUBST(PYTHONFRAMEWORKINSTALLDIR)
++AC_SUBST(FRAMEWORKINSTALLFIRST)
++AC_SUBST(FRAMEWORKINSTALLLAST)
++AC_SUBST(FRAMEWORKALTINSTALLFIRST)
++AC_SUBST(FRAMEWORKALTINSTALLLAST)
++AC_SUBST(FRAMEWORKUNIXTOOLSPREFIX)
++AC_SUBST(FRAMEWORKINSTALLAPPSPREFIX)
++
++##AC_ARG_WITH(dyld,
++##            AS_HELP_STRING([--with-dyld],
++##                           [Use (OpenStep|Rhapsody) dynamic linker]))
++##
++# Set name for machine-dependent library files
++AC_SUBST(MACHDEP)
++AC_MSG_CHECKING(MACHDEP)
++if test -z "$MACHDEP"
++then
++	ac_sys_system=`uname -s`
++	if test "$ac_sys_system" = "AIX" \
++	-o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then
++		ac_sys_release=`uname -v`
++	else
++		ac_sys_release=`uname -r`
++	fi
++	ac_md_system=`echo $ac_sys_system |
++			   tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
++	ac_md_release=`echo $ac_sys_release |
++			   tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'`
++	MACHDEP="$ac_md_system$ac_md_release"
++
++	case $MACHDEP in
++	linux*) MACHDEP="linux2";;
++	cygwin*) MACHDEP="cygwin";;
++	darwin*) MACHDEP="darwin";;
++	atheos*) MACHDEP="atheos";;
++        irix646) MACHDEP="irix6";;
++	'')	MACHDEP="unknown";;
++	esac
++fi
++	
++# Some systems cannot stand _XOPEN_SOURCE being defined at all; they
++# disable features if it is defined, without any means to access these
++# features as extensions. For these systems, we skip the definition of
++# _XOPEN_SOURCE. Before adding a system to the list to gain access to
++# some feature, make sure there is no alternative way to access this
++# feature. Also, when using wildcards, make sure you have verified the
++# need for not defining _XOPEN_SOURCE on all systems matching the
++# wildcard, and that the wildcard does not include future systems
++# (which may remove their limitations).
++dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
++case $ac_sys_system/$ac_sys_release in
++  # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined,
++  # even though select is a POSIX function. Reported by J. Ribbens.
++  # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish.
++  # In addition, Stefan Krah confirms that issue #1244610 exists through
++  # OpenBSD 4.6, but is fixed in 4.7.
++  OpenBSD/2.* | OpenBSD/3.* | OpenBSD/4.@<:@0123456@:>@) 
++    define_xopen_source=no
++    # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is
++    # also defined. This can be overridden by defining _BSD_SOURCE
++    # As this has a different meaning on Linux, only define it on OpenBSD
++    AC_DEFINE(_BSD_SOURCE, 1, [Define on OpenBSD to activate all library features])
++    ;;
++  OpenBSD/*)
++    # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is
++    # also defined. This can be overridden by defining _BSD_SOURCE
++    # As this has a different meaning on Linux, only define it on OpenBSD
++    AC_DEFINE(_BSD_SOURCE, 1, [Define on OpenBSD to activate all library features])
++    ;;
++  # Defining _XOPEN_SOURCE on NetBSD version prior to the introduction of
++  # _NETBSD_SOURCE disables certain features (eg. setgroups). Reported by
++  # Marc Recht
++  NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6@<:@A-S@:>@)
++    define_xopen_source=no;;
++  # From the perspective of Solaris, _XOPEN_SOURCE is not so much a
++  # request to enable features supported by the standard as a request
++  # to disable features not supported by the standard.  The best way
++  # for Python to use Solaris is simply to leave _XOPEN_SOURCE out
++  # entirely and define __EXTENSIONS__ instead.
++  SunOS/*)
++    define_xopen_source=no;;
++  # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE,
++  # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice.
++  # Reconfirmed for 7.1.4 by Martin v. Loewis.
++  OpenUNIX/8.0.0| UnixWare/7.1.@<:@0-4@:>@)
++    define_xopen_source=no;;
++  # On OpenServer 5, u_short is never defined with _XOPEN_SOURCE,
++  # but used in struct sockaddr.sa_family. Reported by Tim Rice.
++  SCO_SV/3.2)
++    define_xopen_source=no;;
++  # On FreeBSD 4, the math functions C89 does not cover are never defined
++  # with _XOPEN_SOURCE and __BSD_VISIBLE does not re-enable them.
++  FreeBSD/4.*)
++    define_xopen_source=no;;
++  # On MacOS X 10.2, a bug in ncurses.h means that it craps out if 
++  # _XOPEN_EXTENDED_SOURCE is defined. Apparently, this is fixed in 10.3, which
++  # identifies itself as Darwin/7.*
++  # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
++  # disables platform specific features beyond repair.
++  # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE 
++  # has no effect, don't bother defining them
++  Darwin/@<:@6789@:>@.*)
++    define_xopen_source=no;;
++  Darwin/1@<:@0-9@:>@.*)
++    define_xopen_source=no;;
++  # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
++  # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
++  # or has another value. By not (re)defining it, the defaults come in place.
++  AIX/4)
++    define_xopen_source=no;;
++  AIX/5)
++    if test `uname -r` -eq 1; then
++      define_xopen_source=no
++    fi
++    ;;
++  # On QNX 6.3.2, defining _XOPEN_SOURCE prevents netdb.h from
++  # defining NI_NUMERICHOST.
++  QNX/6.3.2)
++    define_xopen_source=no
++    ;;
++
++esac
++
++if test $define_xopen_source = yes
++then
++  AC_DEFINE(_XOPEN_SOURCE, 600, 
++            Define to the level of X/Open that your system supports)
++
++  # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires
++  # definition of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else
++  # several APIs are not declared. Since this is also needed in some
++  # cases for HP-UX, we define it globally.
++  AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1,
++   	    Define to activate Unix95-and-earlier features)
++
++  AC_DEFINE(_POSIX_C_SOURCE, 200112L, Define to activate features from IEEE Stds 1003.1-2001)
++  
++fi
++
++#
++# SGI compilers allow the specification of the both the ABI and the
++# ISA on the command line.  Depending on the values of these switches,
++# different and often incompatable code will be generated.
++#
++# The SGI_ABI variable can be used to modify the CC and LDFLAGS and
++# thus supply support for various ABI/ISA combinations.  The MACHDEP
++# variable is also adjusted.
++#
++AC_SUBST(SGI_ABI)
++if test ! -z "$SGI_ABI"
++then
++        CC="cc $SGI_ABI"
++        LDFLAGS="$SGI_ABI $LDFLAGS"
++        MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
++fi
++AC_MSG_RESULT($MACHDEP)
++
++# And add extra plat-mac for darwin
++AC_SUBST(EXTRAPLATDIR)
++AC_SUBST(EXTRAMACHDEPPATH)
++AC_MSG_CHECKING(EXTRAPLATDIR)
++if test -z "$EXTRAPLATDIR"
++then
++	case $MACHDEP in
++	darwin)	
++		EXTRAPLATDIR="\$(PLATMACDIRS)"
++		EXTRAMACHDEPPATH="\$(PLATMACPATH)"
++		;;
++	*) 
++		EXTRAPLATDIR=""
++		EXTRAMACHDEPPATH=""
++		;;
++	esac
++fi
++AC_MSG_RESULT($EXTRAPLATDIR)
++
++# Record the configure-time value of MACOSX_DEPLOYMENT_TARGET,
++# it may influence the way we can build extensions, so distutils
++# needs to check it
++AC_SUBST(CONFIGURE_MACOSX_DEPLOYMENT_TARGET)
++AC_SUBST(EXPORT_MACOSX_DEPLOYMENT_TARGET)
++CONFIGURE_MACOSX_DEPLOYMENT_TARGET=
++EXPORT_MACOSX_DEPLOYMENT_TARGET='#'
++
++AC_MSG_CHECKING(machine type as reported by uname -m)
++ac_sys_machine=`uname -m`
++AC_MSG_RESULT($ac_sys_machine)
++
++# checks for alternative programs
++
++# compiler flags are generated in two sets, BASECFLAGS and OPT.  OPT is just
++# for debug/optimization stuff.  BASECFLAGS is for flags that are required
++# just to get things to compile and link.  Users are free to override OPT
++# when running configure or make.  The build should not break if they do.
++# BASECFLAGS should generally not be messed with, however.
++
++# XXX shouldn't some/most/all of this code be merged with the stuff later
++# on that fiddles with OPT and BASECFLAGS?
++AC_MSG_CHECKING(for --without-gcc)
++AC_ARG_WITH(gcc,
++            AS_HELP_STRING([--without-gcc], [never use gcc]),
++[
++	case $withval in
++	no)	CC=${CC:-cc}
++		without_gcc=yes;;
++	yes)	CC=gcc
++		without_gcc=no;;
++	*)	CC=$withval
++		without_gcc=$withval;;
++	esac], [
++	case $ac_sys_system in
++	AIX*)   CC=${CC:-xlc_r}
++		without_gcc=;;
++	BeOS*)
++		case $BE_HOST_CPU in
++		ppc)
++			CC=mwcc
++			without_gcc=yes
++			BASECFLAGS="$BASECFLAGS -export pragma"
++			OPT="$OPT -O"
++			LDFLAGS="$LDFLAGS -nodup"
++			;;
++		x86)
++			CC=gcc
++			without_gcc=no
++			OPT="$OPT -O"
++			;;
++		*)
++			AC_MSG_ERROR([Unknown BeOS platform "$BE_HOST_CPU"])
++			;;
++		esac
++		AR="\$(srcdir)/Modules/ar_beos"
++		RANLIB=:
++		;;
++	*)	without_gcc=no;;
++	esac])
++AC_MSG_RESULT($without_gcc)
++
++# If the user switches compilers, we can't believe the cache
++if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
++then
++  AC_MSG_ERROR([cached CC is different -- throw away $cache_file
++(it is also a good idea to do 'make clean' before compiling)])
++fi
++
++# If the user set CFLAGS, use this instead of the automatically
++# determined setting
++preset_cflags="$CFLAGS"
++AC_PROG_CC
++if test ! -z "$preset_cflags"
++then
++	CFLAGS=$preset_cflags
++fi
++
++AC_SUBST(CXX)
++AC_SUBST(MAINCC)
++AC_MSG_CHECKING(for --with-cxx-main=<compiler>)
++AC_ARG_WITH(cxx_main,
++            AS_HELP_STRING([--with-cxx-main=<compiler>],
++                           [compile main() and link python executable with C++ compiler]),
++[
++	
++	case $withval in
++	no)	with_cxx_main=no
++		MAINCC='$(CC)';;
++	yes)	with_cxx_main=yes
++		MAINCC='$(CXX)';;
++	*)	with_cxx_main=yes
++		MAINCC=$withval
++		if test -z "$CXX"
++		then
++			CXX=$withval
++		fi;;
++	esac], [
++	with_cxx_main=no
++	MAINCC='$(CC)'
++])
++AC_MSG_RESULT($with_cxx_main)
++
++preset_cxx="$CXX"
++if test -z "$CXX"
++then
++        case "$CC" in
++        gcc)    AC_PATH_PROG(CXX, [g++], [g++], [notfound]) ;;
++        cc)     AC_PATH_PROG(CXX, [c++], [c++], [notfound]) ;;
++        esac
++	if test "$CXX" = "notfound"
++	then
++		CXX=""
++	fi
++fi
++if test -z "$CXX"
++then
++	AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
++	if test "$CXX" = "notfound"
++	then
++		CXX=""
++	fi
++fi
++if test "$preset_cxx" != "$CXX"
++then
++        AC_MSG_WARN([
++
++  By default, distutils will build C++ extension modules with "$CXX".
++  If this is not intended, then set CXX on the configure command line.
++  ])
++fi
++
++
++# checks for UNIX variants that set C preprocessor variables
++AC_USE_SYSTEM_EXTENSIONS
++
++# Check for unsupported systems
++case $ac_sys_system/$ac_sys_release in
++atheos*|Linux*/1*)
++   echo This system \($ac_sys_system/$ac_sys_release\) is no longer supported.
++   echo See README for details.
++   exit 1;;
++esac
++
++AC_EXEEXT
++AC_MSG_CHECKING(for --with-suffix)
++AC_ARG_WITH(suffix,
++            AS_HELP_STRING([--with-suffix=.exe], [set executable suffix]),
++[
++	case $withval in
++	no)	EXEEXT=;;
++	yes)	EXEEXT=.exe;;
++	*)	EXEEXT=$withval;;
++	esac])
++AC_MSG_RESULT($EXEEXT)
++
++# Test whether we're running on a non-case-sensitive system, in which
++# case we give a warning if no ext is given
++AC_SUBST(BUILDEXEEXT)
++AC_MSG_CHECKING(for case-insensitive build directory)
++if test ! -d CaseSensitiveTestDir; then
++mkdir CaseSensitiveTestDir
++fi
++
++if test -d casesensitivetestdir
++then
++    AC_MSG_RESULT(yes)
++    BUILDEXEEXT=.exe
++else
++	AC_MSG_RESULT(no)
++	BUILDEXEEXT=$EXEEXT
++fi
++rmdir CaseSensitiveTestDir
++
++case $MACHDEP in
++bsdos*)
++    case $CC in
++    gcc) CC="$CC -D_HAVE_BSDI";;
++    esac;;
++esac
++
++case $ac_sys_system in
++hp*|HP*)
++    case $CC in
++    cc|*/cc) CC="$CC -Ae";;
++    esac;;
++SunOS*)
++    # Some functions have a prototype only with that define, e.g. confstr
++    AC_DEFINE(__EXTENSIONS__, 1, [Defined on Solaris to see additional function prototypes.])
++    ;;
++esac
++
++
++AC_SUBST(LIBRARY)
++AC_MSG_CHECKING(LIBRARY)
++if test -z "$LIBRARY"
++then
++	LIBRARY='libpython$(VERSION).a'
++fi
++AC_MSG_RESULT($LIBRARY)
++
++# LDLIBRARY is the name of the library to link against (as opposed to the
++# name of the library into which to insert object files). BLDLIBRARY is also
++# the library to link against, usually. On Mac OS X frameworks, BLDLIBRARY
++# is blank as the main program is not linked directly against LDLIBRARY.
++# LDLIBRARYDIR is the path to LDLIBRARY, which is made in a subdirectory. On
++# systems without shared libraries, LDLIBRARY is the same as LIBRARY
++# (defined in the Makefiles). On Cygwin LDLIBRARY is the import library,
++# DLLLIBRARY is the shared (i.e., DLL) library.
++# 
++# RUNSHARED is used to run shared python without installed libraries
++#
++# INSTSONAME is the name of the shared library that will be use to install
++# on the system - some systems like version suffix, others don't
++AC_SUBST(LDLIBRARY)
++AC_SUBST(DLLLIBRARY)
++AC_SUBST(BLDLIBRARY)
++AC_SUBST(LDLIBRARYDIR)
++AC_SUBST(INSTSONAME)
++AC_SUBST(RUNSHARED)
++LDLIBRARY="$LIBRARY"
++BLDLIBRARY='$(LDLIBRARY)'
++INSTSONAME='$(LDLIBRARY)'
++DLLLIBRARY=''
++LDLIBRARYDIR=''
++RUNSHARED=''
++
++# LINKCC is the command that links the python executable -- default is $(CC).
++# If CXX is set, and if it is needed to link a main function that was
++# compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
++# python might then depend on the C++ runtime
++# This is altered for AIX in order to build the export list before 
++# linking.
++AC_SUBST(LINKCC)
++AC_MSG_CHECKING(LINKCC)
++if test -z "$LINKCC"
++then
++	LINKCC='$(PURIFY) $(MAINCC)'
++	case $ac_sys_system in
++	AIX*)
++	   exp_extra="\"\""
++	   if test $ac_sys_release -ge 5 -o \
++		   $ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
++	       exp_extra="."
++	   fi
++	   LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp $exp_extra \$(LIBRARY); $LINKCC";;
++	QNX*)
++	   # qcc must be used because the other compilers do not
++	   # support -N.
++	   LINKCC=qcc;;
++	esac
++fi
++AC_MSG_RESULT($LINKCC)
++
++# GNULD is set to "yes" if the GNU linker is used.  If this goes wrong
++# make sure we default having it set to "no": this is used by
++# distutils.unixccompiler to know if it should add --enable-new-dtags
++# to linker command lines, and failing to detect GNU ld simply results
++# in the same bahaviour as before.
++AC_SUBST(GNULD)
++AC_MSG_CHECKING(for GNU ld)
++ac_prog=ld
++if test "$GCC" = yes; then
++       ac_prog=`$CC -print-prog-name=ld`
++fi
++case `"$ac_prog" -V 2>&1 < /dev/null` in
++      *GNU*)
++          GNULD=yes;;
++      *)
++          GNULD=no;;
++esac
++AC_MSG_RESULT($GNULD)
++
++AC_MSG_CHECKING(for --enable-shared)
++AC_ARG_ENABLE(shared,
++              AS_HELP_STRING([--enable-shared], [disable/enable building shared python library]))
++
++if test -z "$enable_shared"
++then 
++  case $ac_sys_system in
++  CYGWIN* | atheos*)
++    enable_shared="yes";;
++  *)
++    enable_shared="no";;
++  esac
++fi
++AC_MSG_RESULT($enable_shared)
++
++AC_MSG_CHECKING(for --enable-profiling)
++AC_ARG_ENABLE(profiling,
++              AS_HELP_STRING([--enable-profiling], [enable C-level code profiling]),
++[ac_save_cc="$CC"
++ CC="$CC -pg"
++ AC_RUN_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],
++   [ac_enable_profiling="yes"],
++   [ac_enable_profiling="no"],
++   [ac_enable_profiling="no"])
++ CC="$ac_save_cc"])
++AC_MSG_RESULT($ac_enable_profiling)
++
++case "$ac_enable_profiling" in
++    "yes")
++	BASECFLAGS="-pg $BASECFLAGS"
++	LDFLAGS="-pg $LDFLAGS"
++    ;;
++esac
++
++AC_MSG_CHECKING(LDLIBRARY)
++
++# MacOSX framework builds need more magic. LDLIBRARY is the dynamic
++# library that we build, but we do not want to link against it (we
++# will find it with a -framework option). For this reason there is an
++# extra variable BLDLIBRARY against which Python and the extension
++# modules are linked, BLDLIBRARY. This is normally the same as
++# LDLIBRARY, but empty for MacOSX framework builds.
++if test "$enable_framework"
++then
++  LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
++  RUNSHARED=DYLD_FRAMEWORK_PATH="`pwd`:$DYLD_FRAMEWORK_PATH"
++  BLDLIBRARY=''
++else
++  BLDLIBRARY='$(LDLIBRARY)'
++fi  
++
++# Other platforms follow
++if test $enable_shared = "yes"; then
++  AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.])
++  case $ac_sys_system in
++    BeOS*)
++          LDLIBRARY='libpython$(VERSION).so'
++          ;;
++    CYGWIN*)
++          LDLIBRARY='libpython$(VERSION).dll.a'
++          DLLLIBRARY='libpython$(VERSION).dll'
++          ;;
++    SunOS*)
++	  LDLIBRARY='libpython$(VERSION).so'
++	  BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)'
++	  RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
++	  INSTSONAME="$LDLIBRARY".$SOVERSION
++          ;;
++    Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*)
++	  LDLIBRARY='libpython$(VERSION).so'
++	  BLDLIBRARY='-L. -lpython$(VERSION)'
++	  RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
++	  case $ac_sys_system in
++	      FreeBSD*)
++		SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
++		;;
++	  esac
++	  INSTSONAME="$LDLIBRARY".$SOVERSION
++	  ;;
++    hp*|HP*)
++	  case `uname -m` in
++		ia64)
++			LDLIBRARY='libpython$(VERSION).so'
++			;;
++		*)
++			LDLIBRARY='libpython$(VERSION).sl'
++			;;
++	  esac
++	  BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(VERSION)'
++	  RUNSHARED=SHLIB_PATH=`pwd`:${SHLIB_PATH}
++	  ;;
++    OSF*)
++	  LDLIBRARY='libpython$(VERSION).so'
++	  BLDLIBRARY='-rpath $(LIBDIR) -L. -lpython$(VERSION)'
++	  RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
++	  ;;
++    atheos*)
++	  LDLIBRARY='libpython$(VERSION).so'
++	  BLDLIBRARY='-L. -lpython$(VERSION)'
++	  RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
++	  ;;
++    Darwin*)
++    	LDLIBRARY='libpython$(VERSION).dylib'
++	BLDLIBRARY='-L. -lpython$(VERSION)'
++	RUNSHARED='DYLD_LIBRARY_PATH=`pwd`:${DYLD_LIBRARY_PATH}'
++	;;
++    AIX*)
++	LDLIBRARY='libpython$(VERSION).so'
++	RUNSHARED=LIBPATH=`pwd`:${LIBPATH}
++	;;
++
++  esac
++else # shared is disabled
++  case $ac_sys_system in
++    CYGWIN*)
++          BLDLIBRARY='$(LIBRARY)'
++          LDLIBRARY='libpython$(VERSION).dll.a'
++          ;;
++  esac
++fi
++
++AC_MSG_RESULT($LDLIBRARY)
++
++AC_PROG_RANLIB
++AC_SUBST(AR)
++AC_CHECK_PROGS(AR, ar aal, ar)
++
++# tweak ARFLAGS only if the user didn't set it on the command line
++AC_SUBST(ARFLAGS)
++if test -z "$ARFLAGS"
++then
++        ARFLAGS="rc"
++fi
++
++AC_SUBST(SVNVERSION)
++AC_CHECK_PROG(SVNVERSION, svnversion, found, not-found)
++if test $SVNVERSION = found
++then
++	SVNVERSION="svnversion \$(srcdir)"
++else
++	SVNVERSION="echo Unversioned directory"
++fi
++
++AC_SUBST(HGVERSION)
++AC_SUBST(HGTAG)
++AC_SUBST(HGBRANCH)
++AC_CHECK_PROG(HAS_HG, hg, found, not-found)
++if test $HAS_HG = found
++then
++    HGVERSION="hg id -i \$(srcdir)"
++    HGTAG="hg id -t \$(srcdir)"
++    HGBRANCH="hg id -b \$(srcdir)"
++else
++    HGVERSION=""
++    HGTAG=""
++    HGBRANCH=""
++fi
++
++case $MACHDEP in
++bsdos*|hp*|HP*)
++	# install -d does not work on BSDI or HP-UX
++	if test -z "$INSTALL"
++	then
++		INSTALL="${srcdir}/install-sh -c"
++	fi
++esac
++AC_PROG_INSTALL
++
++# Not every filesystem supports hard links
++AC_SUBST(LN)
++if test -z "$LN" ; then
++	case $ac_sys_system in
++		BeOS*) LN="ln -s";;
++		CYGWIN*) LN="ln -s";;
++		atheos*) LN="ln -s";;
++		*) LN=ln;;
++	esac
++fi
++
++# Check for --with-pydebug
++AC_MSG_CHECKING(for --with-pydebug)
++AC_ARG_WITH(pydebug, 
++            AS_HELP_STRING([--with-pydebug], [build with Py_DEBUG defined]),
++[
++if test "$withval" != no
++then 
++  AC_DEFINE(Py_DEBUG, 1, 
++  [Define if you want to build an interpreter with many run-time checks.]) 
++  AC_MSG_RESULT(yes); 
++  Py_DEBUG='true'
++else AC_MSG_RESULT(no); Py_DEBUG='false'
++fi],
++[AC_MSG_RESULT(no)])
++
++# XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be
++# merged with this chunk of code?
++
++# Optimizer/debugger flags
++# ------------------------
++# (The following bit of code is complicated enough - please keep things
++# indented properly.  Just pretend you're editing Python code. ;-)
++
++# There are two parallel sets of case statements below, one that checks to
++# see if OPT was set and one that does BASECFLAGS setting based upon
++# compiler and platform.  BASECFLAGS tweaks need to be made even if the
++# user set OPT.
++
++# tweak OPT based on compiler and platform, only if the user didn't set
++# it on the command line
++AC_SUBST(OPT)
++if test "${OPT-unset}" = "unset"
++then
++    case $GCC in
++    yes)
++        if test "$CC" != 'g++' ; then
++	    STRICT_PROTO="-Wstrict-prototypes"
++	fi
++        # For gcc 4.x we need to use -fwrapv so lets check if its supported
++        if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then
++           WRAP="-fwrapv"
++        fi
++
++        # Clang also needs -fwrapv
++        case $CC in
++            *clang*) WRAP="-fwrapv"
++            ;;
++        esac
++
++	case $ac_cv_prog_cc_g in
++	yes)
++	    if test "$Py_DEBUG" = 'true' ; then
++		# Optimization messes up debuggers, so turn it off for
++		# debug builds.
++		OPT="-g -O0 -Wall $STRICT_PROTO"
++	    else
++		OPT="-g $WRAP -O3 -Wall $STRICT_PROTO"
++	    fi
++	    ;;
++	*)
++	    OPT="-O3 -Wall $STRICT_PROTO"
++	    ;;
++	esac
++	case $ac_sys_system in
++	    SCO_SV*) OPT="$OPT -m486 -DSCO5"
++	    ;;
++        esac
++	;;
++
++    *)
++	OPT="-O"
++	;;
++    esac
++fi
++
++AC_SUBST(BASECFLAGS)
++
++# The -arch flags for universal builds on OSX
++UNIVERSAL_ARCH_FLAGS=
++AC_SUBST(UNIVERSAL_ARCH_FLAGS)
++
++# tweak BASECFLAGS based on compiler and platform
++case $GCC in
++yes)
++    # Python violates C99 rules, by casting between incompatible
++    # pointer types. GCC may generate bad code as a result of that,
++    # so use -fno-strict-aliasing if supported.
++    AC_MSG_CHECKING(whether $CC accepts -fno-strict-aliasing)
++     ac_save_cc="$CC"
++     CC="$CC -fno-strict-aliasing"
++     AC_CACHE_VAL(ac_cv_no_strict_aliasing_ok,
++       AC_COMPILE_IFELSE(
++         [AC_LANG_PROGRAM([[]], [[]])],
++	 [ac_cv_no_strict_aliasing_ok=yes],
++	 [ac_cv_no_strict_aliasing_ok=no]))
++     CC="$ac_save_cc"
++    AC_MSG_RESULT($ac_cv_no_strict_aliasing_ok)
++    if test $ac_cv_no_strict_aliasing_ok = yes
++    then
++      BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"
++    fi
++
++    # if using gcc on alpha, use -mieee to get (near) full IEEE 754
++    # support.  Without this, treatment of subnormals doesn't follow
++    # the standard.
++    case $ac_sys_machine in
++         alpha*)
++                BASECFLAGS="$BASECFLAGS -mieee"
++                ;;
++    esac
++
++    case $ac_sys_system in
++	SCO_SV*)
++	    BASECFLAGS="$BASECFLAGS -m486 -DSCO5"
++	    ;;
++	# is there any other compiler on Darwin besides gcc?
++	Darwin*)
++	    # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
++	    # used to be here, but non-Apple gcc doesn't accept them.
++	    if test "${CC}" = gcc
++	    then
++		AC_MSG_CHECKING(which compiler should be used)
++		case "${UNIVERSALSDK}" in
++		*/MacOSX10.4u.sdk)
++			# Build using 10.4 SDK, force usage of gcc when the 
++			# compiler is gcc, otherwise the user will get very
++			# confusing error messages when building on OSX 10.6
++			CC=gcc-4.0
++			CPP=cpp-4.0
++			;;
++		esac
++		AC_MSG_RESULT($CC)
++	    fi
++
++	    # Calculate the right deployment target for this build.
++	    #
++	    cur_target=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'`
++	    if test ${cur_target} '>' 10.2; then
++		    cur_target=10.3
++		    if test ${enable_universalsdk}; then
++			    if test "${UNIVERSAL_ARCHS}" = "all"; then
++				    # Ensure that the default platform for a 
++				    # 4-way universal build is OSX 10.5, 
++				    # that's the first OS release where 
++				    # 4-way builds make sense.
++				    cur_target='10.5'
++
++			    elif test "${UNIVERSAL_ARCHS}" = "3-way"; then
++				    cur_target='10.5'
++
++			    elif test "${UNIVERSAL_ARCHS}" = "intel"; then
++				    cur_target='10.5'
++
++			    elif test "${UNIVERSAL_ARCHS}" = "64-bit"; then
++				    cur_target='10.5'
++			    fi
++		    else
++			    if test `/usr/bin/arch` = "i386"; then
++				    # On Intel macs default to a deployment
++				    # target of 10.4, that's the first OSX
++				    # release with Intel support.
++				    cur_target="10.4"
++			    fi
++		    fi
++	    fi
++	    CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
++	    
++	    # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the 
++	    # environment with a value that is the same as what we'll use
++	    # in the Makefile to ensure that we'll get the same compiler
++	    # environment during configure and build time.
++	    MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
++	    export MACOSX_DEPLOYMENT_TARGET
++	    EXPORT_MACOSX_DEPLOYMENT_TARGET=''
++
++	    if test "${enable_universalsdk}"; then
++		UNIVERSAL_ARCH_FLAGS=""
++	        if test "$UNIVERSAL_ARCHS" = "32-bit" ; then
++		   UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
++		   ARCH_RUN_32BIT=""
++		   LIPO_32BIT_FLAGS=""
++
++	         elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then
++		   UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
++		   LIPO_32BIT_FLAGS=""
++		   ARCH_RUN_32BIT="true"
++
++	         elif test "$UNIVERSAL_ARCHS" = "all" ; then
++		   UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
++		   LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
++		   ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
++
++	         elif test "$UNIVERSAL_ARCHS" = "intel" ; then
++		   UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
++		   LIPO_32BIT_FLAGS="-extract i386"
++		   ARCH_RUN_32BIT="/usr/bin/arch -i386"
++
++	         elif test "$UNIVERSAL_ARCHS" = "3-way" ; then
++		   UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64"
++		   LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
++		   ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
++
++		 else
++	           AC_MSG_ERROR([proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way])
++
++		 fi
++
++
++		CFLAGS="${UNIVERSAL_ARCH_FLAGS} ${CFLAGS}"
++		if test "${UNIVERSALSDK}" != "/" 
++		then
++			CPPFLAGS="-isysroot ${UNIVERSALSDK} ${CPPFLAGS}"
++			LDFLAGS="-isysroot ${UNIVERSALSDK} ${LDFLAGS}"
++			CFLAGS="-isysroot ${UNIVERSALSDK} ${CFLAGS}"
++		fi
++
++	    fi
++
++
++	    ;;
++	OSF*)
++	    BASECFLAGS="$BASECFLAGS -mieee"
++	    ;;
++    esac
++    ;;
++
++*)
++    case $ac_sys_system in
++    OpenUNIX*|UnixWare*)
++	BASECFLAGS="$BASECFLAGS -K pentium,host,inline,loop_unroll,alloca "
++	;;
++    OSF*)
++	BASECFLAGS="$BASECFLAGS -ieee -std"
++    	;;
++    SCO_SV*)
++	BASECFLAGS="$BASECFLAGS -belf -Ki486 -DSCO5"
++	;;
++    esac
++    ;;
++esac
++
++if test "$Py_DEBUG" = 'true'; then
++  :
++else
++  OPT="-DNDEBUG $OPT"
++fi
++
++if test "$ac_arch_flags"
++then
++	BASECFLAGS="$BASECFLAGS $ac_arch_flags"
++fi
++
++# disable check for icc since it seems to pass, but generates a warning
++if test "$CC" = icc
++then
++  ac_cv_opt_olimit_ok=no
++fi
++
++AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
++AC_CACHE_VAL(ac_cv_opt_olimit_ok,
++[ac_save_cc="$CC"
++CC="$CC -OPT:Olimit=0"
++AC_COMPILE_IFELSE(
++  [AC_LANG_PROGRAM([[]], [[]])],
++  [ac_cv_opt_olimit_ok=yes],
++  [ac_cv_opt_olimit_ok=no]
++  )
++CC="$ac_save_cc"])
++AC_MSG_RESULT($ac_cv_opt_olimit_ok)
++if test $ac_cv_opt_olimit_ok = yes; then
++    case $ac_sys_system in
++	# XXX is this branch needed? On MacOSX 10.2.2 the result of the
++	# olimit_ok test is "no".  Is it "yes" in some other Darwin-esque
++	# environment?
++        Darwin*)
++	    ;;
++        *)
++	    BASECFLAGS="$BASECFLAGS -OPT:Olimit=0"
++	    ;;
++    esac
++else
++  AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
++  AC_CACHE_VAL(ac_cv_olimit_ok,
++  [ac_save_cc="$CC"
++  CC="$CC -Olimit 1500"
++  AC_COMPILE_IFELSE(
++    [AC_LANG_PROGRAM([[]], [[]])],
++    [ac_cv_olimit_ok=yes],
++    [ac_cv_olimit_ok=no]
++    )
++  CC="$ac_save_cc"])
++  AC_MSG_RESULT($ac_cv_olimit_ok)
++  if test $ac_cv_olimit_ok = yes; then
++    BASECFLAGS="$BASECFLAGS -Olimit 1500"
++  fi
++fi
++
++# Check whether GCC supports PyArg_ParseTuple format
++if test "$GCC" = "yes"
++then
++  AC_MSG_CHECKING(whether gcc supports ParseTuple __format__)
++  save_CFLAGS=$CFLAGS
++  CFLAGS="$CFLAGS -Werror"
++  AC_COMPILE_IFELSE([
++    AC_LANG_PROGRAM([[void f(char*,...)__attribute((format(PyArg_ParseTuple, 1, 2)));]], [[]])
++  ],[
++    AC_DEFINE(HAVE_ATTRIBUTE_FORMAT_PARSETUPLE, 1,
++      [Define if GCC supports __attribute__((format(PyArg_ParseTuple, 2, 3)))])
++    AC_MSG_RESULT(yes)
++  ],[
++    AC_MSG_RESULT(no)
++  ])
++  CFLAGS=$save_CFLAGS
++fi
++
++# On some compilers, pthreads are available without further options
++# (e.g. MacOS X). On some of these systems, the compiler will not
++# complain if unaccepted options are passed (e.g. gcc on Mac OS X).
++# So we have to see first whether pthreads are available without
++# options before we can check whether -Kpthread improves anything.
++AC_MSG_CHECKING(whether pthreads are available without options)
++AC_CACHE_VAL(ac_cv_pthread_is_default,
++[AC_RUN_IFELSE([AC_LANG_SOURCE([[
++#include <pthread.h>
++
++void* routine(void* p){return NULL;}
++
++int main(){
++  pthread_t p;
++  if(pthread_create(&p,NULL,routine,NULL)!=0)
++    return 1;
++  (void)pthread_detach(p);
++  return 0;
++}
++]])],[
++  ac_cv_pthread_is_default=yes
++  ac_cv_kthread=no
++  ac_cv_pthread=no
++],[ac_cv_pthread_is_default=no],[ac_cv_pthread_is_default=no])
++])
++AC_MSG_RESULT($ac_cv_pthread_is_default)
++
++
++if test $ac_cv_pthread_is_default = yes 
++then
++  ac_cv_kpthread=no
++else
++# -Kpthread, if available, provides the right #defines
++# and linker options to make pthread_create available
++# Some compilers won't report that they do not support -Kpthread,
++# so we need to run a program to see whether it really made the
++# function available.
++AC_MSG_CHECKING(whether $CC accepts -Kpthread)
++AC_CACHE_VAL(ac_cv_kpthread,
++[ac_save_cc="$CC"
++CC="$CC -Kpthread"
++AC_RUN_IFELSE([AC_LANG_SOURCE([[
++#include <pthread.h>
++
++void* routine(void* p){return NULL;}
++
++int main(){
++  pthread_t p;
++  if(pthread_create(&p,NULL,routine,NULL)!=0)
++    return 1;
++  (void)pthread_detach(p);
++  return 0;
++}
++]])],[ac_cv_kpthread=yes],[ac_cv_kpthread=no],[ac_cv_kpthread=no])
++CC="$ac_save_cc"])
++AC_MSG_RESULT($ac_cv_kpthread)
++fi
++
++if test $ac_cv_kpthread = no -a $ac_cv_pthread_is_default = no
++then
++# -Kthread, if available, provides the right #defines
++# and linker options to make pthread_create available
++# Some compilers won't report that they do not support -Kthread,
++# so we need to run a program to see whether it really made the
++# function available.
++AC_MSG_CHECKING(whether $CC accepts -Kthread)
++AC_CACHE_VAL(ac_cv_kthread,
++[ac_save_cc="$CC"
++CC="$CC -Kthread"
++AC_RUN_IFELSE([AC_LANG_SOURCE([[
++#include <pthread.h>
++
++void* routine(void* p){return NULL;}
++
++int main(){
++  pthread_t p;
++  if(pthread_create(&p,NULL,routine,NULL)!=0)
++    return 1;
++  (void)pthread_detach(p);
++  return 0;
++}
++]])],[ac_cv_kthread=yes],[ac_cv_kthread=no],[ac_cv_kthread=no])
++CC="$ac_save_cc"])
++AC_MSG_RESULT($ac_cv_kthread)
++fi
++
++if test $ac_cv_kthread = no -a $ac_cv_pthread_is_default = no
++then
++# -pthread, if available, provides the right #defines
++# and linker options to make pthread_create available
++# Some compilers won't report that they do not support -pthread,
++# so we need to run a program to see whether it really made the
++# function available.
++AC_MSG_CHECKING(whether $CC accepts -pthread)
++AC_CACHE_VAL(ac_cv_thread,
++[ac_save_cc="$CC"
++CC="$CC -pthread"
++AC_RUN_IFELSE([AC_LANG_SOURCE([[
++#include <pthread.h>
++
++void* routine(void* p){return NULL;}
++
++int main(){
++  pthread_t p;
++  if(pthread_create(&p,NULL,routine,NULL)!=0)
++    return 1;
++  (void)pthread_detach(p);
++  return 0;
++}
++]])],[ac_cv_pthread=yes],[ac_cv_pthread=no],[ac_cv_pthread=no])
++CC="$ac_save_cc"])
++AC_MSG_RESULT($ac_cv_pthread)
++fi
++
++# If we have set a CC compiler flag for thread support then
++# check if it works for CXX, too.
++ac_cv_cxx_thread=no
++if test ! -z "$CXX"
++then
++AC_MSG_CHECKING(whether $CXX also accepts flags for thread support)
++ac_save_cxx="$CXX"
++
++if test "$ac_cv_kpthread" = "yes"
++then
++  CXX="$CXX -Kpthread"  
++  ac_cv_cxx_thread=yes
++elif test "$ac_cv_kthread" = "yes"
++then
++  CXX="$CXX -Kthread"
++  ac_cv_cxx_thread=yes
++elif test "$ac_cv_pthread" = "yes"
++then 
++  CXX="$CXX -pthread"
++  ac_cv_cxx_thread=yes
++fi
++
++if test $ac_cv_cxx_thread = yes
++then
++  echo 'void foo();int main(){foo();}void foo(){}' > conftest.$ac_ext
++  $CXX -c conftest.$ac_ext 2>&5
++  if $CXX -o conftest$ac_exeext conftest.$ac_objext 2>&5 \
++     && test -s conftest$ac_exeext && ./conftest$ac_exeext
++  then
++    ac_cv_cxx_thread=yes
++  else
++    ac_cv_cxx_thread=no
++  fi
++  rm -fr conftest*
++fi
++AC_MSG_RESULT($ac_cv_cxx_thread)
++fi
++CXX="$ac_save_cxx"
++
++dnl # check for ANSI or K&R ("traditional") preprocessor
++dnl AC_MSG_CHECKING(for C preprocessor type)
++dnl AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
++dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
++dnl int foo;
++dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
++dnl ]], [[;]])],[cpp_type=ansi],[AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional])
++dnl AC_MSG_RESULT($cpp_type)
++
++# checks for header files
++AC_HEADER_STDC
++AC_CHECK_HEADERS(asm/types.h conio.h curses.h direct.h dlfcn.h errno.h \
++fcntl.h grp.h \
++ieeefp.h io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \
++shadow.h signal.h stdint.h stropts.h termios.h thread.h \
++unistd.h utime.h \
++sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \
++sys/lock.h sys/mkdev.h sys/modem.h \
++sys/param.h sys/poll.h sys/select.h sys/socket.h sys/statvfs.h sys/stat.h \
++sys/termio.h sys/time.h \
++sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
++sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
++bluetooth/bluetooth.h linux/tipc.h spawn.h util.h)
++AC_HEADER_DIRENT
++AC_HEADER_MAJOR
++
++# On Solaris, term.h requires curses.h
++AC_CHECK_HEADERS(term.h,,,[
++#ifdef HAVE_CURSES_H
++#include <curses.h>
++#endif
++])
++
++# On Linux, netlink.h requires asm/types.h
++AC_CHECK_HEADERS(linux/netlink.h,,,[
++#ifdef HAVE_ASM_TYPES_H
++#include <asm/types.h>
++#endif
++#ifdef HAVE_SYS_SOCKET_H
++#include <sys/socket.h>
++#endif
++])
++
++# checks for typedefs
++was_it_defined=no
++AC_MSG_CHECKING(for clock_t in time.h)
++AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, [
++    AC_DEFINE(clock_t, long, [Define to 'long' if <time.h> doesn't define.])
++])
++AC_MSG_RESULT($was_it_defined)
++
++# Check whether using makedev requires defining _OSF_SOURCE
++AC_MSG_CHECKING(for makedev)
++AC_LINK_IFELSE([AC_LANG_PROGRAM([[
++#if defined(MAJOR_IN_MKDEV)
++#include <sys/mkdev.h>
++#elif defined(MAJOR_IN_SYSMACROS)
++#include <sys/sysmacros.h>
++#else
++#include <sys/types.h>
++#endif ]], [[ makedev(0, 0) ]])],
++[ac_cv_has_makedev=yes],
++[ac_cv_has_makedev=no])
++if test "$ac_cv_has_makedev" = "no"; then
++    # we didn't link, try if _OSF_SOURCE will allow us to link
++    AC_LINK_IFELSE([AC_LANG_PROGRAM([[
++#define _OSF_SOURCE 1
++#include <sys/types.h>
++    ]], [[ makedev(0, 0) ]])],
++[ac_cv_has_makedev=yes],
++[ac_cv_has_makedev=no])
++    if test "$ac_cv_has_makedev" = "yes"; then
++        AC_DEFINE(_OSF_SOURCE, 1, [Define _OSF_SOURCE to get the makedev macro.])
++    fi
++fi
++AC_MSG_RESULT($ac_cv_has_makedev)
++if test "$ac_cv_has_makedev" = "yes"; then
++    AC_DEFINE(HAVE_MAKEDEV, 1, [Define this if you have the makedev macro.])
++fi
++
++# Enabling LFS on Solaris (2.6 to 9) with gcc 2.95 triggers a bug in
++# the system headers: If _XOPEN_SOURCE and _LARGEFILE_SOURCE are
++# defined, but the compiler does not support pragma redefine_extname,
++# and _LARGEFILE64_SOURCE is not defined, the headers refer to 64-bit
++# structures (such as rlimit64) without declaring them. As a
++# work-around, disable LFS on such configurations
++
++use_lfs=yes
++AC_MSG_CHECKING(Solaris LFS bug)
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
++#define _LARGEFILE_SOURCE 1
++#define _FILE_OFFSET_BITS 64
++#include <sys/resource.h>
++]], [[struct rlimit foo;]])],[sol_lfs_bug=no],[sol_lfs_bug=yes])
++AC_MSG_RESULT($sol_lfs_bug)
++if test "$sol_lfs_bug" = "yes"; then
++  use_lfs=no
++fi
++
++if test "$use_lfs" = "yes"; then
++# Two defines needed to enable largefile support on various platforms
++# These may affect some typedefs
++case $ac_sys_system/$ac_sys_release in
++AIX*)
++    AC_DEFINE(_LARGE_FILES, 1, 
++    [This must be defined on AIX systems to enable large file support.])
++    ;;
++esac
++AC_DEFINE(_LARGEFILE_SOURCE, 1, 
++[This must be defined on some systems to enable large file support.])
++AC_DEFINE(_FILE_OFFSET_BITS, 64,
++[This must be set to 64 on some systems to enable large file support.])
++fi
++
++# Add some code to confdefs.h so that the test for off_t works on SCO
++cat >> confdefs.h <<\EOF
++#if defined(SCO_DS)
++#undef _OFF_T
++#endif
++EOF
++
++# Type availability checks
++AC_TYPE_MODE_T
++AC_TYPE_OFF_T
++AC_TYPE_PID_T
++AC_DEFINE_UNQUOTED([RETSIGTYPE],[void],[assume C89 semantics that RETSIGTYPE is always void])
++AC_TYPE_SIZE_T
++AC_TYPE_UID_T
++AC_TYPE_UINT32_T
++AC_TYPE_UINT64_T
++AC_TYPE_INT32_T
++AC_TYPE_INT64_T
++AC_CHECK_TYPE(ssize_t,
++  AC_DEFINE(HAVE_SSIZE_T, 1, [Define if your compiler provides ssize_t]),,)
++
++# Sizes of various common basic types
++# ANSI C requires sizeof(char) == 1, so no need to check it
++AC_CHECK_SIZEOF(int, 4)
++AC_CHECK_SIZEOF(long, 4)
++AC_CHECK_SIZEOF(void *, 4)
++AC_CHECK_SIZEOF(short, 2)
++AC_CHECK_SIZEOF(float, 4)
++AC_CHECK_SIZEOF(double, 8)
++AC_CHECK_SIZEOF(fpos_t, 4)
++AC_CHECK_SIZEOF(size_t, 4)
++AC_CHECK_SIZEOF(pid_t, 4)
++
++AC_MSG_CHECKING(for long long support)
++have_long_long=no
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[long long x; x = (long long)0;]])],[
++  AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.]) 
++  have_long_long=yes
++],[])
++AC_MSG_RESULT($have_long_long)
++if test "$have_long_long" = yes ; then
++AC_CHECK_SIZEOF(long long, 8)
++fi
++
++AC_MSG_CHECKING(for long double support)
++have_long_double=no
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[long double x; x = (long double)0;]])],[
++  AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define this if you have the type long double.])
++  have_long_double=yes
++],[])
++AC_MSG_RESULT($have_long_double)
++if test "$have_long_double" = yes ; then
++AC_CHECK_SIZEOF(long double, 12)
++fi
++
++AC_MSG_CHECKING(for _Bool support)
++have_c99_bool=no
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[_Bool x; x = (_Bool)0;]])],[
++  AC_DEFINE(HAVE_C99_BOOL, 1, [Define this if you have the type _Bool.]) 
++  have_c99_bool=yes
++],[])
++AC_MSG_RESULT($have_c99_bool)
++if test "$have_c99_bool" = yes ; then
++AC_CHECK_SIZEOF(_Bool, 1)
++fi
++
++AC_CHECK_TYPES(uintptr_t, 
++   [AC_CHECK_SIZEOF(uintptr_t, 4)], 
++   [], [#ifdef HAVE_STDINT_H
++        #include <stdint.h>
++        #endif
++        #ifdef HAVE_INTTYPES_H
++        #include <inttypes.h>
++        #endif])
++
++AC_CHECK_SIZEOF(off_t, [], [
++#ifdef HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++])
++
++AC_MSG_CHECKING(whether to enable large file support)
++if test "$have_long_long" = yes
++then
++if test "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
++	"$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
++  AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1, 
++  [Defined to enable large file support when an off_t is bigger than a long
++   and long long is available and at least as big as an off_t. You may need
++   to add some flags for configuration and compilation to enable this mode.
++   (For Solaris and Linux, the necessary defines are already defined.)])
++  AC_MSG_RESULT(yes)
++else
++  AC_MSG_RESULT(no)
++fi
++else
++  AC_MSG_RESULT(no)
++fi
++
++AC_CHECK_SIZEOF(time_t, [], [
++#ifdef HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++#ifdef HAVE_TIME_H
++#include <time.h>
++#endif
++])
++
++# if have pthread_t then define SIZEOF_PTHREAD_T
++ac_save_cc="$CC"
++if test "$ac_cv_kpthread" = "yes"
++then CC="$CC -Kpthread"
++elif test "$ac_cv_kthread" = "yes"
++then CC="$CC -Kthread"
++elif test "$ac_cv_pthread" = "yes"
++then CC="$CC -pthread"
++fi
++AC_MSG_CHECKING(for pthread_t)
++have_pthread_t=no
++AC_COMPILE_IFELSE([
++  AC_LANG_PROGRAM([[#include <pthread.h>]], [[pthread_t x; x = *(pthread_t*)0;]])
++],[have_pthread_t=yes],[])
++AC_MSG_RESULT($have_pthread_t)
++if test "$have_pthread_t" = yes ; then
++  AC_CHECK_SIZEOF(pthread_t, [], [
++#ifdef HAVE_PTHREAD_H
++#include <pthread.h>
++#endif
++  ])
++fi
++CC="$ac_save_cc"
++
++AC_MSG_CHECKING(for --enable-toolbox-glue)
++AC_ARG_ENABLE(toolbox-glue,
++              AS_HELP_STRING([--enable-toolbox-glue], [disable/enable MacOSX glue code for extensions]))
++
++if test -z "$enable_toolbox_glue"
++then 
++	case $ac_sys_system/$ac_sys_release in
++	Darwin/*)
++		enable_toolbox_glue="yes";;
++	*)
++		enable_toolbox_glue="no";;
++	esac
++fi
++case "$enable_toolbox_glue" in
++yes)
++	extra_machdep_objs="Python/mactoolboxglue.o"
++	extra_undefs="-u _PyMac_Error"
++	AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE, 1,
++         [Define if you want to use MacPython modules on MacOSX in unix-Python.])
++	;;
++*)
++	extra_machdep_objs=""
++	extra_undefs=""
++	;;
++esac
++AC_MSG_RESULT($enable_toolbox_glue)
++
++
++AC_SUBST(OTHER_LIBTOOL_OPT)
++case $ac_sys_system/$ac_sys_release in
++  Darwin/@<:@01567@:>@\..*) 
++    OTHER_LIBTOOL_OPT="-prebind -seg1addr 0x10000000"
++    ;;
++  Darwin/*)
++    OTHER_LIBTOOL_OPT=""
++    ;;
++esac
++
++
++ARCH_RUN_32BIT=""
++AC_SUBST(LIBTOOL_CRUFT)
++case $ac_sys_system/$ac_sys_release in
++  Darwin/@<:@01567@:>@\..*) 
++    LIBTOOL_CRUFT="-framework System -lcc_dynamic"
++    if test "${enable_universalsdk}"; then
++	    :
++    else
++        LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `/usr/bin/arch`"
++    fi
++    LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
++    LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
++  Darwin/*)
++    gcc_version=`gcc -dumpversion`
++    if test ${gcc_version} '<' 4.0
++        then
++            LIBTOOL_CRUFT="-lcc_dynamic"
++        else 
++            LIBTOOL_CRUFT=""
++    fi
++    AC_RUN_IFELSE([AC_LANG_SOURCE([[
++    #include <unistd.h>
++    int main(int argc, char*argv[])
++    {
++      if (sizeof(long) == 4) {
++    	  return 0;
++      } else {
++      	  return 1;
++      }
++    }
++    ]])],[ac_osx_32bit=yes],[ac_osx_32bit=no],[ac_osx_32bit=yes])
++    
++    if test "${ac_osx_32bit}" = "yes"; then
++    	case `/usr/bin/arch` in
++    	i386) 
++    		MACOSX_DEFAULT_ARCH="i386" 
++    		;;
++    	ppc) 
++    		MACOSX_DEFAULT_ARCH="ppc" 
++    		;;
++    	*)
++    		AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
++    		;;
++    	esac
++    else
++    	case `/usr/bin/arch` in
++    	i386) 
++    		MACOSX_DEFAULT_ARCH="x86_64" 
++    		;;
++    	ppc) 
++    		MACOSX_DEFAULT_ARCH="ppc64" 
++    		;;
++    	*)
++    		AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
++    		;;
++    	esac
++
++	#ARCH_RUN_32BIT="true"
++    fi
++
++    LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only ${MACOSX_DEFAULT_ARCH}"
++    LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
++    LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
++esac
++
++AC_MSG_CHECKING(for --enable-framework)
++if test "$enable_framework"
++then
++	BASECFLAGS="$BASECFLAGS -fno-common -dynamic"
++	# -F. is needed to allow linking to the framework while 
++	# in the build location.
++	AC_DEFINE(WITH_NEXT_FRAMEWORK, 1, 
++         [Define if you want to produce an OpenStep/Rhapsody framework
++         (shared library plus accessory files).])
++	AC_MSG_RESULT(yes)
++	if test $enable_shared = "yes"
++	then
++		AC_MSG_ERROR([Specifying both --enable-shared and --enable-framework is not supported, use only --enable-framework instead. See Mac/README.])
++	fi
++else
++	AC_MSG_RESULT(no)
++fi
++
++AC_MSG_CHECKING(for dyld)
++case $ac_sys_system/$ac_sys_release in
++  Darwin/*)
++  	AC_DEFINE(WITH_DYLD, 1, 
++        [Define if you want to use the new-style (Openstep, Rhapsody, MacOS)
++         dynamic linker (dyld) instead of the old-style (NextStep) dynamic
++         linker (rld). Dyld is necessary to support frameworks.])
++  	AC_MSG_RESULT(always on for Darwin)
++  	;;
++  *)
++	AC_MSG_RESULT(no)
++	;;
++esac
++
++# Set info about shared libraries.
++AC_SUBST(SO)
++AC_SUBST(LDSHARED)
++AC_SUBST(LDCXXSHARED)
++AC_SUBST(BLDSHARED)
++AC_SUBST(CCSHARED)
++AC_SUBST(LINKFORSHARED)
++# SO is the extension of shared libraries `(including the dot!)
++# -- usually .so, .sl on HP-UX, .dll on Cygwin
++AC_MSG_CHECKING(SO)
++if test -z "$SO"
++then
++	case $ac_sys_system in
++	hp*|HP*)
++		case `uname -m` in
++			ia64) SO=.so;;
++	  		*)    SO=.sl;;
++		esac
++		;;
++	CYGWIN*)   SO=.dll;;
++	*)	   SO=.so;;
++	esac
++else
++	# this might also be a termcap variable, see #610332
++        echo
++        echo '====================================================================='
++        echo '+                                                                   +'
++	echo '+ WARNING: You have set SO in your environment.                     +'
++        echo '+ Do you really mean to change the extension for shared libraries?  +'
++        echo '+ Continuing in 10 seconds to let you to ponder.                    +'
++        echo '+                                                                   +'
++        echo '====================================================================='
++	sleep 10
++fi
++AC_MSG_RESULT($SO)
++
++AC_DEFINE_UNQUOTED(SHLIB_EXT, "$SO", [Define this to be extension of shared libraries (including the dot!).])
++# LDSHARED is the ld *command* used to create shared library
++# -- "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5
++# (Shared libraries in this instance are shared modules to be loaded into
++# Python, as opposed to building Python itself as a shared library.)
++AC_MSG_CHECKING(LDSHARED)
++if test -z "$LDSHARED"
++then
++	case $ac_sys_system/$ac_sys_release in
++	AIX*)
++		BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:\$(srcdir)/Modules/python.exp"
++		LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
++		;;
++	BeOS*)
++		BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
++		LDSHARED="\$(BINLIBDEST)/config/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
++		;;
++	IRIX/5*) LDSHARED="ld -shared";;
++	IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
++	SunOS/5*) 
++		if test "$GCC" = "yes" ; then
++			LDSHARED='$(CC) -shared'
++			LDCXXSHARED='$(CXX) -shared'
++		else
++			LDSHARED='$(CC) -G'
++			LDCXXSHARED='$(CXX) -G'
++		fi ;;
++	hp*|HP*)
++		if test "$GCC" = "yes" ; then
++			LDSHARED='$(CC) -shared'
++			LDCXXSHARED='$(CXX) -shared'
++		else
++			LDSHARED='ld -b'
++		fi ;;
++	OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
++	Darwin/1.3*)
++		LDSHARED='$(CC) -bundle'
++		LDCXXSHARED='$(CXX) -bundle'
++		if test "$enable_framework" ; then
++			# Link against the framework. All externals should be defined.
++			BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
++			LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
++			LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
++		else
++			# No framework. Ignore undefined symbols, assuming they come from Python
++			LDSHARED="$LDSHARED -undefined suppress"
++			LDCXXSHARED="$LDCXXSHARED -undefined suppress"
++		fi ;;
++	Darwin/1.4*|Darwin/5.*|Darwin/6.*)
++		LDSHARED='$(CC) -bundle'
++		LDCXXSHARED='$(CXX) -bundle'
++		if test "$enable_framework" ; then
++			# Link against the framework. All externals should be defined.
++			BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
++			LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
++			LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
++		else
++			# No framework, use the Python app as bundle-loader
++			BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
++			LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
++			LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
++		fi ;;
++	Darwin/*)
++		# Use -undefined dynamic_lookup whenever possible (10.3 and later).
++		# This allows an extension to be used in any Python
++
++		if test ${MACOSX_DEPLOYMENT_TARGET} '>' 10.2
++		then
++			if test "${enable_universalsdk}"; then
++				LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
++			fi
++			LDSHARED='$(CC) -bundle -undefined dynamic_lookup'
++			LDCXXSHARED='$(CXX) -bundle -undefined dynamic_lookup'
++			BLDSHARED="$LDSHARED"
++		else
++			LDSHARED='$(CC) -bundle'
++			LDCXXSHARED='$(CXX) -bundle'
++			if test "$enable_framework" ; then
++				# Link against the framework. All externals should be defined.
++				BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
++				LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
++				LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
++			else
++				# No framework, use the Python app as bundle-loader
++				BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
++				LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
++				LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
++			fi
++		fi
++		;;
++	Linux*|GNU*|QNX*)
++		LDSHARED='$(CC) -shared'
++		LDCXXSHARED='$(CXX) -shared';;
++	BSD/OS*/4*)
++		LDSHARED="gcc -shared"
++		LDCXXSHARED="g++ -shared";;
++	FreeBSD*)
++		if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
++		then
++			LDSHARED='$(CC) -shared'
++			LDCXXSHARED='$(CXX) -shared'
++		else
++			LDSHARED="ld -Bshareable"
++		fi;;
++	OpenBSD*)
++		if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
++		then
++				LDSHARED='$(CC) -shared $(CCSHARED)'
++				LDCXXSHARED='$(CXX) -shared $(CCSHARED)'
++		else
++				case `uname -r` in
++				[[01]].* | 2.[[0-7]] | 2.[[0-7]].*)
++				   LDSHARED="ld -Bshareable ${LDFLAGS}"
++				   ;;
++				*)
++				   LDSHARED='$(CC) -shared $(CCSHARED)'
++				   LDCXXSHARED='$(CXX) -shared $(CCSHARED)'
++				   ;;
++				esac
++		fi;;
++	NetBSD*|DragonFly*)
++		LDSHARED='$(CC) -shared'
++		LDCXXSHARED='$(CXX) -shared';;
++	OpenUNIX*|UnixWare*)
++		if test "$GCC" = "yes" ; then
++			LDSHARED='$(CC) -shared'
++			LDCXXSHARED='$(CXX) -shared'
++		else
++			LDSHARED='$(CC) -G'
++			LDCXXSHARED='$(CXX) -G'
++		fi;;
++	SCO_SV*)
++		LDSHARED='$(CC) -Wl,-G,-Bexport'
++		LDCXXSHARED='$(CXX) -Wl,-G,-Bexport';;
++	CYGWIN*)
++		LDSHARED="gcc -shared -Wl,--enable-auto-image-base"
++		LDCXXSHARED="g++ -shared -Wl,--enable-auto-image-base";;
++	atheos*)
++		LDSHARED="gcc -shared"
++		LDCXXSHARED="g++ -shared";;
++	*)	LDSHARED="ld";;
++	esac
++fi
++AC_MSG_RESULT($LDSHARED)
++LDCXXSHARED=${LDCXXSHARED-$LDSHARED}
++BLDSHARED=${BLDSHARED-$LDSHARED}
++# CCSHARED are the C *flags* used to create objects to go into a shared
++# library (module) -- this is only needed for a few systems
++AC_MSG_CHECKING(CCSHARED)
++if test -z "$CCSHARED"
++then
++	case $ac_sys_system/$ac_sys_release in
++	SunOS*) if test "$GCC" = yes;
++		then CCSHARED="-fPIC";
++		elif test `uname -p` = sparc;
++		then CCSHARED="-xcode=pic32";
++		else CCSHARED="-Kpic";
++		fi;;
++	hp*|HP*) if test "$GCC" = yes;
++		 then CCSHARED="-fPIC";
++		 else CCSHARED="+z";
++		 fi;;
++	Linux*|GNU*) CCSHARED="-fPIC";;
++	BSD/OS*/4*) CCSHARED="-fpic";;
++	FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";;
++	OpenUNIX*|UnixWare*)
++		if test "$GCC" = "yes"
++		then CCSHARED="-fPIC"
++		else CCSHARED="-KPIC"
++		fi;;
++	SCO_SV*)
++		if test "$GCC" = "yes"
++		then CCSHARED="-fPIC"
++		else CCSHARED="-Kpic -belf"
++		fi;;
++	IRIX*/6*)  case $CC in
++		   *gcc*) CCSHARED="-shared";;
++		   *) CCSHARED="";;
++		   esac;;
++	atheos*) CCSHARED="-fPIC";;
++	esac
++fi
++AC_MSG_RESULT($CCSHARED)
++# LINKFORSHARED are the flags passed to the $(CC) command that links
++# the python executable -- this is only needed for a few systems
++AC_MSG_CHECKING(LINKFORSHARED)
++if test -z "$LINKFORSHARED"
++then
++	case $ac_sys_system/$ac_sys_release in
++	AIX*)	LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
++	hp*|HP*)
++	    LINKFORSHARED="-Wl,-E -Wl,+s";;
++#	    LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
++	BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
++	Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
++	# -u libsys_s pulls in all symbols in libsys
++	Darwin/*) 
++		# -u _PyMac_Error is needed to pull in the mac toolbox glue,
++		# which is
++		# not used by the core itself but which needs to be in the core so
++		# that dynamically loaded extension modules have access to it.
++		# -prebind is no longer used, because it actually seems to give a
++		# slowdown in stead of a speedup, maybe due to the large number of
++		# dynamic loads Python does.
++
++		LINKFORSHARED="$extra_undefs"
++		if test "$enable_framework"
++		then
++			LINKFORSHARED="$LINKFORSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
++		fi
++		LINKFORSHARED="$LINKFORSHARED";;
++	OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
++	SCO_SV*) LINKFORSHARED="-Wl,-Bexport";;
++	ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
++	FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) 
++		if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
++		then
++			LINKFORSHARED="-Wl,--export-dynamic"
++		fi;;
++	SunOS/5*) case $CC in
++		  *gcc*)
++		    if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
++		    then
++			LINKFORSHARED="-Xlinker --export-dynamic"
++		    fi;;
++		  esac;;
++	CYGWIN*)
++		if test $enable_shared = "no"
++		then
++			LINKFORSHARED='-Wl,--out-implib=$(LDLIBRARY)'
++		fi;;
++	QNX*)
++		# -Wl,-E causes the symbols to be added to the dynamic
++		# symbol table so that they can be found when a module
++		# is loaded.  -N 2048K causes the stack size to be set
++		# to 2048 kilobytes so that the stack doesn't overflow
++		# when running test_compile.py.
++		LINKFORSHARED='-Wl,-E -N 2048K';;
++	esac
++fi
++AC_MSG_RESULT($LINKFORSHARED)
++
++
++AC_SUBST(CFLAGSFORSHARED)
++AC_MSG_CHECKING(CFLAGSFORSHARED)
++if test ! "$LIBRARY" = "$LDLIBRARY"
++then
++	case $ac_sys_system in
++	CYGWIN*)
++		# Cygwin needs CCSHARED when building extension DLLs
++		# but not when building the interpreter DLL.
++		CFLAGSFORSHARED='';;
++	*)
++		CFLAGSFORSHARED='$(CCSHARED)'
++	esac
++fi
++AC_MSG_RESULT($CFLAGSFORSHARED)
++
++# SHLIBS are libraries (except -lc and -lm) to link to the python shared
++# library (with --enable-shared).
++# For platforms on which shared libraries are not allowed to have unresolved
++# symbols, this must be set to $(LIBS) (expanded by make). We do this even
++# if it is not required, since it creates a dependency of the shared library
++# to LIBS. This, in turn, means that applications linking the shared libpython
++# don't need to link LIBS explicitly. The default should be only changed
++# on systems where this approach causes problems.
++AC_SUBST(SHLIBS)
++AC_MSG_CHECKING(SHLIBS)
++case "$ac_sys_system" in
++	*)
++		SHLIBS='$(LIBS)';;
++esac
++AC_MSG_RESULT($SHLIBS)
++
++
++# checks for libraries
++AC_CHECK_LIB(dl, dlopen)	# Dynamic linking for SunOS/Solaris and SYSV
++AC_CHECK_LIB(dld, shl_load)	# Dynamic linking for HP-UX
++
++# only check for sem_init if thread support is requested
++if test "$with_threads" = "yes" -o -z "$with_threads"; then
++    AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris
++						# posix4 on Solaris 2.6
++						# pthread (first!) on Linux
++fi
++
++# check if we need libintl for locale functions
++AC_CHECK_LIB(intl, textdomain,
++	AC_DEFINE(WITH_LIBINTL, 1,
++	[Define to 1 if libintl is needed for locale functions.]))
++
++# checks for system dependent C++ extensions support
++case "$ac_sys_system" in
++	AIX*)	AC_MSG_CHECKING(for genuine AIX C++ extensions support)
++		AC_LINK_IFELSE([
++		  AC_LANG_PROGRAM([[#include <load.h>]],
++				  [[loadAndInit("", 0, "")]])
++		],[
++		  AC_DEFINE(AIX_GENUINE_CPLUSPLUS, 1,
++                      [Define for AIX if your compiler is a genuine IBM xlC/xlC_r
++                       and you want support for AIX C++ shared extension modules.])
++		  AC_MSG_RESULT(yes)
++		],[
++		  AC_MSG_RESULT(no)
++		]);;
++	*) ;;
++esac
++
++# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
++# BeOS' sockets are stashed in libnet.
++AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
++AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
++
++case "$ac_sys_system" in
++BeOS*)
++AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
++;;
++esac
++
++AC_MSG_CHECKING(for --with-libs)
++AC_ARG_WITH(libs,
++            AS_HELP_STRING([--with-libs='lib1 ...'], [link against additional libs]),
++[
++AC_MSG_RESULT($withval)
++LIBS="$withval $LIBS"
++],
++[AC_MSG_RESULT(no)])
++
++AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
++
++# Check for use of the system expat library
++AC_MSG_CHECKING(for --with-system-expat)
++AC_ARG_WITH(system_expat,
++            AS_HELP_STRING([--with-system-expat], [build pyexpat module using an installed expat library]),
++            [],
++            [with_system_expat="no"])
++
++AC_MSG_RESULT($with_system_expat)
++
++# Check for use of the system libffi library
++AC_MSG_CHECKING(for --with-system-ffi)
++AC_ARG_WITH(system_ffi,
++            AS_HELP_STRING([--with-system-ffi], [build _ctypes module using an installed ffi library]),
++            [],
++            [with_system_ffi="no"])
++
++if test "$with_system_ffi" = "yes" && test -n "$PKG_CONFIG"; then
++    LIBFFI_INCLUDEDIR="`"$PKG_CONFIG" libffi --cflags-only-I 2>/dev/null | sed -e 's/^-I//;s/ *$//'`"
++else
++    LIBFFI_INCLUDEDIR=""
++fi
++AC_SUBST(LIBFFI_INCLUDEDIR)
++
++AC_MSG_RESULT($with_system_ffi)
++
++# Check for --with-dbmliborder
++AC_MSG_CHECKING(for --with-dbmliborder)
++AC_ARG_WITH(dbmliborder,
++            AS_HELP_STRING([--with-dbmliborder=db1:db2:...], [order to check db backends for dbm. Valid value is a colon separated string with the backend names `ndbm', `gdbm' and `bdb'.]),
++[
++if test x$with_dbmliborder = xyes
++then
++AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...])
++else
++  for db in `echo $with_dbmliborder | sed 's/:/ /g'`; do
++    if test x$db != xndbm && test x$db != xgdbm && test x$db != xbdb
++    then
++      AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...])
++    fi
++  done
++fi])
++AC_MSG_RESULT($with_dbmliborder)
++
++# Determine if signalmodule should be used.
++AC_SUBST(USE_SIGNAL_MODULE)
++AC_SUBST(SIGNAL_OBJS)
++AC_MSG_CHECKING(for --with-signal-module)
++AC_ARG_WITH(signal-module,
++            AS_HELP_STRING([--with-signal-module], [disable/enable signal module]))
++
++if test -z "$with_signal_module"
++then with_signal_module="yes"
++fi
++AC_MSG_RESULT($with_signal_module)
++
++if test "${with_signal_module}" = "yes"; then
++	USE_SIGNAL_MODULE=""
++	SIGNAL_OBJS=""
++else
++	USE_SIGNAL_MODULE="#"
++	SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
++fi
++
++# This is used to generate Setup.config
++AC_SUBST(USE_THREAD_MODULE)
++USE_THREAD_MODULE=""
++
++AC_MSG_CHECKING(for --with-dec-threads)
++AC_SUBST(LDLAST)
++AC_ARG_WITH(dec-threads,
++            AS_HELP_STRING([--with-dec-threads], [use DEC Alpha/OSF1 thread-safe libraries]),
++[
++AC_MSG_RESULT($withval)
++LDLAST=-threads
++if test "${with_thread+set}" != set; then
++   with_thread="$withval";
++fi],
++[AC_MSG_RESULT(no)])
++
++# Templates for things AC_DEFINEd more than once.
++# For a single AC_DEFINE, no template is needed.
++AH_TEMPLATE(C_THREADS,[Define if you have the Mach cthreads package])
++AH_TEMPLATE(_REENTRANT,
++  [Define to force use of thread-safe errno, h_errno, and other functions])
++AH_TEMPLATE(WITH_THREAD,
++  [Define if you want to compile in rudimentary thread support])
++
++AC_MSG_CHECKING(for --with-threads)
++dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
++AC_ARG_WITH(threads,
++            AS_HELP_STRING([--with(out)-threads@<:@=DIRECTORY@:>@], [disable/enable thread support]))
++
++# --with-thread is deprecated, but check for it anyway
++dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
++AC_ARG_WITH(thread,
++            AS_HELP_STRING([--with(out)-thread@<:@=DIRECTORY@:>@], [deprecated; use --with(out)-threads]),
++            [with_threads=$with_thread])
++
++if test -z "$with_threads"
++then with_threads="yes"
++fi
++AC_MSG_RESULT($with_threads)
++
++AC_SUBST(THREADOBJ)
++if test "$with_threads" = "no"
++then
++    USE_THREAD_MODULE="#"
++elif test "$ac_cv_pthread_is_default" = yes
++then
++    AC_DEFINE(WITH_THREAD)
++    # Defining _REENTRANT on system with POSIX threads should not hurt.
++    AC_DEFINE(_REENTRANT)
++    posix_threads=yes
++    THREADOBJ="Python/thread.o"    
++elif test "$ac_cv_kpthread" = "yes"
++then
++    CC="$CC -Kpthread"
++    if test "$ac_cv_cxx_thread" = "yes"; then
++        CXX="$CXX -Kpthread"
++    fi
++    AC_DEFINE(WITH_THREAD)
++    posix_threads=yes
++    THREADOBJ="Python/thread.o"
++elif test "$ac_cv_kthread" = "yes"
++then
++    CC="$CC -Kthread"
++    if test "$ac_cv_cxx_thread" = "yes"; then
++        CXX="$CXX -Kthread"
++    fi
++    AC_DEFINE(WITH_THREAD)
++    posix_threads=yes
++    THREADOBJ="Python/thread.o"
++elif test "$ac_cv_pthread" = "yes"
++then
++    CC="$CC -pthread"
++    if test "$ac_cv_cxx_thread" = "yes"; then
++        CXX="$CXX -pthread"
++    fi
++    AC_DEFINE(WITH_THREAD)
++    posix_threads=yes
++    THREADOBJ="Python/thread.o"
++else
++    if test ! -z "$with_threads" -a -d "$with_threads"
++    then LDFLAGS="$LDFLAGS -L$with_threads"
++    fi
++    if test ! -z "$withval" -a -d "$withval"
++    then LDFLAGS="$LDFLAGS -L$withval"
++    fi
++
++    # According to the POSIX spec, a pthreads implementation must
++    # define _POSIX_THREADS in unistd.h. Some apparently don't
++    # (e.g. gnu pth with pthread emulation)
++    AC_MSG_CHECKING(for _POSIX_THREADS in unistd.h)
++    AC_EGREP_CPP(yes,
++    [
++#include <unistd.h>
++#ifdef _POSIX_THREADS
++yes
++#endif
++    ], unistd_defines_pthreads=yes, unistd_defines_pthreads=no)
++    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, 1,
++    [Define if you are using Mach cthreads directly under /include])
++    LIBS="$LIBS -lthreads"
++    THREADOBJ="Python/thread.o"],[
++    AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
++    AC_DEFINE(C_THREADS)
++    AC_DEFINE(MACH_C_THREADS, 1,
++    [Define if you are using Mach cthreads under mach /])
++    THREADOBJ="Python/thread.o"],[
++    AC_MSG_CHECKING(for --with-pth)
++    AC_ARG_WITH([pth],
++                AS_HELP_STRING([--with-pth], [use GNU pth threading libraries]),
++                [AC_MSG_RESULT($withval)
++                  AC_DEFINE([WITH_THREAD])
++                  AC_DEFINE([HAVE_PTH], 1,
++                            [Define if you have GNU PTH threads.])
++                  LIBS="-lpth $LIBS"
++                  THREADOBJ="Python/thread.o"],
++	        [AC_MSG_RESULT(no)
++
++    # Just looking for pthread_create in libpthread is not enough:
++    # on HP/UX, pthread.h renames pthread_create to a different symbol name.
++    # So we really have to include pthread.h, and then link.
++    _libs=$LIBS
++    LIBS="$LIBS -lpthread"
++    AC_MSG_CHECKING([for pthread_create in -lpthread])
++    AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>
++
++void * start_routine (void *arg) { exit (0); }]], [[
++pthread_create (NULL, NULL, start_routine, NULL)]])],[
++    AC_MSG_RESULT(yes)
++    AC_DEFINE(WITH_THREAD)
++    posix_threads=yes
++    THREADOBJ="Python/thread.o"],[
++    LIBS=$_libs
++    AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
++    posix_threads=yes
++    THREADOBJ="Python/thread.o"],[
++    AC_CHECK_HEADER(atheos/threads.h, [AC_DEFINE(WITH_THREAD)
++    AC_DEFINE(ATHEOS_THREADS, 1,
++    [Define this if you have AtheOS threads.])
++    THREADOBJ="Python/thread.o"],[
++    AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
++    AC_DEFINE(BEOS_THREADS, 1,
++    [Define this if you have BeOS threads.])
++    THREADOBJ="Python/thread.o"],[
++    AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
++    posix_threads=yes
++    LIBS="$LIBS -lpthreads"
++    THREADOBJ="Python/thread.o"], [
++    AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
++    posix_threads=yes
++    LIBS="$LIBS -lc_r"
++    THREADOBJ="Python/thread.o"], [
++    AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
++    posix_threads=yes
++    LIBS="$LIBS -lpthread"
++    THREADOBJ="Python/thread.o"], [
++    AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
++    posix_threads=yes
++    LIBS="$LIBS -lcma"
++    THREADOBJ="Python/thread.o"],[
++    USE_THREAD_MODULE="#"])
++    ])])])])])])])])])])
++
++    AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
++    LIBS="$LIBS -lmpc"
++    THREADOBJ="Python/thread.o"
++    USE_THREAD_MODULE=""])
++
++    if test "$posix_threads" != "yes"; then     
++      AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
++      LIBS="$LIBS -lthread"
++      THREADOBJ="Python/thread.o"
++      USE_THREAD_MODULE=""])
++    fi
++
++    if test "$USE_THREAD_MODULE" != "#"
++    then
++        # If the above checks didn't disable threads, (at least) OSF1
++        # needs this '-threads' argument during linking.
++        case $ac_sys_system in
++        OSF1) LDLAST=-threads;;
++        esac
++    fi
++fi
++
++if test "$posix_threads" = "yes"; then
++      if test "$unistd_defines_pthreads" = "no"; then
++         AC_DEFINE(_POSIX_THREADS, 1,
++         [Define if you have POSIX threads, 
++          and your system does not define that.])
++      fi
++
++      # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8.
++      case  $ac_sys_system/$ac_sys_release in
++      SunOS/5.6) AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1,
++                       [Defined for Solaris 2.6 bug in pthread header.])
++		       ;;
++      SunOS/5.8) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
++		       [Define if the Posix semaphores do not work on your system])
++		       ;;
++      AIX/*) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
++		       [Define if the Posix semaphores do not work on your system])
++		       ;;
++      esac
++
++      AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported)
++      AC_CACHE_VAL(ac_cv_pthread_system_supported,
++      [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <pthread.h>
++      void *foo(void *parm) {
++        return NULL;
++      }
++      main() {
++        pthread_attr_t attr;
++        pthread_t id;
++        if (pthread_attr_init(&attr)) exit(-1);
++        if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
++        if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
++        exit(0);
++      }]])],
++      [ac_cv_pthread_system_supported=yes],
++      [ac_cv_pthread_system_supported=no],
++      [ac_cv_pthread_system_supported=no])
++      ])
++      AC_MSG_RESULT($ac_cv_pthread_system_supported)
++      if test "$ac_cv_pthread_system_supported" = "yes"; then
++        AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED, 1, [Defined if PTHREAD_SCOPE_SYSTEM supported.])
++      fi
++      AC_CHECK_FUNCS(pthread_sigmask,
++        [case $ac_sys_system in
++        CYGWIN*)
++          AC_DEFINE(HAVE_BROKEN_PTHREAD_SIGMASK, 1,
++            [Define if pthread_sigmask() does not work on your system.])
++            ;;
++        esac])
++fi
++
++
++# Check for enable-ipv6
++AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
++AC_MSG_CHECKING([if --enable-ipv6 is specified])
++AC_ARG_ENABLE(ipv6,
++[  --enable-ipv6           Enable ipv6 (with ipv4) support
++  --disable-ipv6          Disable ipv6 support],
++[ case "$enableval" in
++  no)
++       AC_MSG_RESULT(no)
++       ipv6=no
++       ;;
++  *)   AC_MSG_RESULT(yes)
++       AC_DEFINE(ENABLE_IPV6)
++       ipv6=yes
++       ;;
++  esac ],
++
++[
++dnl the check does not work on cross compilation case...
++  AC_RUN_IFELSE([AC_LANG_SOURCE([[ /* AF_INET6 available check */
++#include <sys/types.h>
++#include <sys/socket.h>
++main()
++{
++ if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
++   exit(1);
++ else
++   exit(0);
++}
++]])],[
++  AC_MSG_RESULT(yes)
++  ipv6=yes
++],[
++  AC_MSG_RESULT(no)
++  ipv6=no
++],[
++  AC_MSG_RESULT(no)
++  ipv6=no
++])
++
++if test "$ipv6" = "yes"; then
++	AC_MSG_CHECKING(if RFC2553 API is available)
++	AC_COMPILE_IFELSE([
++	  AC_LANG_PROGRAM([[#include <sys/types.h>
++#include <netinet/in.h>]],
++			  [[struct sockaddr_in6 x;
++			    x.sin6_scope_id;]])
++	],[
++	  AC_MSG_RESULT(yes)
++	  ipv6=yes
++	],[
++	  AC_MSG_RESULT(no, IPv6 disabled)
++	  ipv6=no
++	])
++fi
++
++if test "$ipv6" = "yes"; then
++	AC_DEFINE(ENABLE_IPV6)
++fi
++])
++
++ipv6type=unknown
++ipv6lib=none
++ipv6trylibc=no
++
++if test "$ipv6" = "yes"; then
++	AC_MSG_CHECKING([ipv6 stack type])
++	for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta;
++	do
++		case $i in
++		inria)
++			dnl http://www.kame.net/
++			AC_EGREP_CPP(yes, [
++#include <netinet/in.h>
++#ifdef IPV6_INRIA_VERSION
++yes
++#endif],
++				[ipv6type=$i])
++			;;
++		kame)
++			dnl http://www.kame.net/
++			AC_EGREP_CPP(yes, [
++#include <netinet/in.h>
++#ifdef __KAME__
++yes
++#endif],
++				[ipv6type=$i;
++				ipv6lib=inet6
++				ipv6libdir=/usr/local/v6/lib
++				ipv6trylibc=yes])
++			;;
++		linux-glibc)
++			dnl http://www.v6.linux.or.jp/
++			AC_EGREP_CPP(yes, [
++#include <features.h>
++#if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
++yes
++#endif],
++				[ipv6type=$i;
++				ipv6trylibc=yes])
++			;;
++		linux-inet6)
++			dnl http://www.v6.linux.or.jp/
++			if test -d /usr/inet6; then
++				ipv6type=$i
++				ipv6lib=inet6
++				ipv6libdir=/usr/inet6/lib
++				BASECFLAGS="-I/usr/inet6/include $BASECFLAGS"
++			fi
++			;;
++		solaris)
++			if test -f /etc/netconfig; then
++                          if $GREP -q tcp6 /etc/netconfig; then
++				ipv6type=$i
++				ipv6trylibc=yes
++                          fi
++                        fi
++			;;
++		toshiba)
++			AC_EGREP_CPP(yes, [
++#include <sys/param.h>
++#ifdef _TOSHIBA_INET6
++yes
++#endif],
++				[ipv6type=$i;
++				ipv6lib=inet6;
++				ipv6libdir=/usr/local/v6/lib])
++			;;
++		v6d)
++			AC_EGREP_CPP(yes, [
++#include </usr/local/v6/include/sys/v6config.h>
++#ifdef __V6D__
++yes
++#endif],
++				[ipv6type=$i;
++				ipv6lib=v6;
++				ipv6libdir=/usr/local/v6/lib;
++				BASECFLAGS="-I/usr/local/v6/include $BASECFLAGS"])
++			;;
++		zeta)
++			AC_EGREP_CPP(yes, [
++#include <sys/param.h>
++#ifdef _ZETA_MINAMI_INET6
++yes
++#endif],
++				[ipv6type=$i;
++				ipv6lib=inet6;
++				ipv6libdir=/usr/local/v6/lib])
++			;;
++		esac
++		if test "$ipv6type" != "unknown"; then
++			break
++		fi
++	done
++	AC_MSG_RESULT($ipv6type)
++fi
++
++if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
++	if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
++		LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
++		echo "using lib$ipv6lib"
++	else
++		if test $ipv6trylibc = "yes"; then
++			echo "using libc"
++		else
++			echo 'Fatal: no $ipv6lib library found.  cannot continue.'
++			echo "You need to fetch lib$ipv6lib.a from appropriate"
++			echo 'ipv6 kit and compile beforehand.'
++			exit 1
++		fi
++	fi
++fi
++
++AC_MSG_CHECKING(for OSX 10.5 SDK or later)
++AC_COMPILE_IFELSE([
++  AC_LANG_PROGRAM([[#include <Carbon/Carbon.h>]], [[FSIORefNum fRef = 0]])
++],[
++  AC_DEFINE(HAVE_OSX105_SDK, 1, [Define if compiling using MacOS X 10.5 SDK or later.])
++  AC_MSG_RESULT(yes)
++],[
++  AC_MSG_RESULT(no)
++])
++
++# Check for --with-doc-strings
++AC_MSG_CHECKING(for --with-doc-strings)
++AC_ARG_WITH(doc-strings,
++            AS_HELP_STRING([--with(out)-doc-strings], [disable/enable documentation strings]))
++
++if test -z "$with_doc_strings"
++then with_doc_strings="yes"
++fi
++if test "$with_doc_strings" != "no"
++then
++    AC_DEFINE(WITH_DOC_STRINGS, 1,
++      [Define if you want documentation strings in extension modules])
++fi
++AC_MSG_RESULT($with_doc_strings)
++
++# Check for Python-specific malloc support
++AC_MSG_CHECKING(for --with-tsc)
++AC_ARG_WITH(tsc,
++	    AS_HELP_STRING([--with(out)-tsc],[enable/disable timestamp counter profile]),[
++if test "$withval" != no
++then 
++  AC_DEFINE(WITH_TSC, 1, 
++    [Define to profile with the Pentium timestamp counter]) 
++    AC_MSG_RESULT(yes)
++else AC_MSG_RESULT(no)
++fi],
++[AC_MSG_RESULT(no)])
++
++# Check for Python-specific malloc support
++AC_MSG_CHECKING(for --with-pymalloc)
++AC_ARG_WITH(pymalloc,
++            AS_HELP_STRING([--with(out)-pymalloc], [disable/enable specialized mallocs]))
++
++if test -z "$with_pymalloc"
++then with_pymalloc="yes"
++fi
++if test "$with_pymalloc" != "no"
++then
++    AC_DEFINE(WITH_PYMALLOC, 1, 
++     [Define if you want to compile in Python-specific mallocs])
++fi
++AC_MSG_RESULT($with_pymalloc)
++
++# Check for Valgrind support
++AC_MSG_CHECKING([for --with-valgrind])
++AC_ARG_WITH([valgrind],
++  AS_HELP_STRING([--with-valgrind], [Enable Valgrind support]),,
++  with_valgrind=no)
++AC_MSG_RESULT([$with_valgrind])
++if test "$with_valgrind" != no; then
++    AC_CHECK_HEADER([valgrind/valgrind.h],
++      [AC_DEFINE([WITH_VALGRIND], 1, [Define if you want pymalloc to be disabled when running under valgrind])],
++      [AC_MSG_ERROR([Valgrind support requested but headers not available])]
++    )
++fi
++
++# Check for --with-wctype-functions
++AC_MSG_CHECKING(for --with-wctype-functions)
++AC_ARG_WITH(wctype-functions, 
++            AS_HELP_STRING([--with-wctype-functions], [use wctype.h functions]),
++[
++if test "$withval" != no
++then 
++  AC_DEFINE(WANT_WCTYPE_FUNCTIONS, 1,
++  [Define if you want wctype.h functions to be used instead of the
++   one supplied by Python itself. (see Include/unicodectype.h).]) 
++  AC_MSG_RESULT(yes)
++else AC_MSG_RESULT(no)
++fi],
++[AC_MSG_RESULT(no)])
++
++# -I${DLINCLDIR} is added to the compile rule for importdl.o
++AC_SUBST(DLINCLDIR)
++DLINCLDIR=.
++
++# the dlopen() function means we might want to use dynload_shlib.o. some
++# platforms, such as AIX, have dlopen(), but don't want to use it.
++AC_CHECK_FUNCS(dlopen)
++
++# DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
++# loading of modules.
++AC_SUBST(DYNLOADFILE)
++AC_MSG_CHECKING(DYNLOADFILE)
++if test -z "$DYNLOADFILE"
++then
++	case $ac_sys_system/$ac_sys_release in
++	AIX*) # Use dynload_shlib.c and dlopen() if we have it; otherwise dynload_aix.c
++	if test "$ac_cv_func_dlopen" = yes
++	then DYNLOADFILE="dynload_shlib.o"
++	else DYNLOADFILE="dynload_aix.o"
++	fi
++	;;
++	BeOS*) DYNLOADFILE="dynload_beos.o";;
++	hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
++	# Use dynload_next.c only on 10.2 and below, which don't have native dlopen()
++	Darwin/@<:@0156@:>@\..*) DYNLOADFILE="dynload_next.o";;
++	atheos*) DYNLOADFILE="dynload_atheos.o";;
++	*)
++	# use dynload_shlib.c and dlopen() if we have it; otherwise stub
++	# out any dynamic loading
++	if test "$ac_cv_func_dlopen" = yes
++	then DYNLOADFILE="dynload_shlib.o"
++	else DYNLOADFILE="dynload_stub.o"
++	fi
++	;;
++	esac
++fi
++AC_MSG_RESULT($DYNLOADFILE)
++if test "$DYNLOADFILE" != "dynload_stub.o"
++then
++	AC_DEFINE(HAVE_DYNAMIC_LOADING, 1,
++        [Defined when any dynamic module loading is enabled.])
++fi
++
++# MACHDEP_OBJS can be set to platform-specific object files needed by Python
++
++AC_SUBST(MACHDEP_OBJS)
++AC_MSG_CHECKING(MACHDEP_OBJS)
++if test -z "$MACHDEP_OBJS"
++then
++	MACHDEP_OBJS=$extra_machdep_objs
++else
++	MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs"
++fi
++AC_MSG_RESULT(MACHDEP_OBJS)
++
++# checks for library functions
++AC_CHECK_FUNCS(alarm setitimer getitimer bind_textdomain_codeset chown \
++ clock confstr ctermid execv fchmod fchown fork fpathconf ftime ftruncate \
++ gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
++ getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \
++ initgroups kill killpg lchmod lchown lstat mkfifo mknod mktime \
++ mremap nice pathconf pause plock poll pthread_init \
++ putenv readlink realpath \
++ select sem_open sem_timedwait sem_getvalue sem_unlink setegid seteuid \
++ setgid \
++ setlocale setregid setreuid setsid setpgid setpgrp setuid setvbuf snprintf \
++ setlocale setregid setreuid setresuid setresgid \
++ setsid setpgid setpgrp setuid setvbuf snprintf \
++ sigaction siginterrupt sigrelse strftime \
++ sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
++ truncate uname unsetenv utimes waitpid wait3 wait4 wcscoll _getpty)
++
++# For some functions, having a definition is not sufficient, since
++# we want to take their address.
++AC_MSG_CHECKING(for chroot)
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=chroot]])],
++  [AC_DEFINE(HAVE_CHROOT, 1, Define if you have the 'chroot' function.)
++   AC_MSG_RESULT(yes)],
++  [AC_MSG_RESULT(no)
++])
++AC_MSG_CHECKING(for link)
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=link]])],
++  [AC_DEFINE(HAVE_LINK, 1, Define if you have the 'link' function.)
++   AC_MSG_RESULT(yes)],
++  [AC_MSG_RESULT(no)
++])
++AC_MSG_CHECKING(for symlink)
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=symlink]])],
++  [AC_DEFINE(HAVE_SYMLINK, 1, Define if you have the 'symlink' function.)
++   AC_MSG_RESULT(yes)],
++  [AC_MSG_RESULT(no)
++])
++AC_MSG_CHECKING(for fchdir)
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fchdir]])],
++  [AC_DEFINE(HAVE_FCHDIR, 1, Define if you have the 'fchdir' function.)
++   AC_MSG_RESULT(yes)],
++  [AC_MSG_RESULT(no)
++])
++AC_MSG_CHECKING(for fsync)
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fsync]])],
++  [AC_DEFINE(HAVE_FSYNC, 1, Define if you have the 'fsync' function.)
++   AC_MSG_RESULT(yes)],
++  [AC_MSG_RESULT(no)
++])
++AC_MSG_CHECKING(for fdatasync)
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fdatasync]])],
++  [AC_DEFINE(HAVE_FDATASYNC, 1, Define if you have the 'fdatasync' function.)
++   AC_MSG_RESULT(yes)],
++  [AC_MSG_RESULT(no)
++])
++AC_MSG_CHECKING(for epoll)
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/epoll.h>]], [[void *x=epoll_create]])],
++  [AC_DEFINE(HAVE_EPOLL, 1, Define if you have the 'epoll' functions.)
++   AC_MSG_RESULT(yes)],
++  [AC_MSG_RESULT(no)
++])
++AC_MSG_CHECKING(for kqueue)
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
++#include <sys/types.h>
++#include <sys/event.h>
++    ]], [[int x=kqueue()]])],
++  [AC_DEFINE(HAVE_KQUEUE, 1, Define if you have the 'kqueue' functions.)
++   AC_MSG_RESULT(yes)],
++  [AC_MSG_RESULT(no)
++])
++# On some systems (eg. FreeBSD 5), we would find a definition of the
++# functions ctermid_r, setgroups in the library, but no prototype
++# (e.g. because we use _XOPEN_SOURCE). See whether we can take their
++# address to avoid compiler warnings and potential miscompilations
++# because of the missing prototypes.
++
++AC_MSG_CHECKING(for ctermid_r)
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
++#include <stdio.h>
++]], [[void* p = ctermid_r]])],
++  [AC_DEFINE(HAVE_CTERMID_R, 1, Define if you have the 'ctermid_r' function.)
++   AC_MSG_RESULT(yes)],
++  [AC_MSG_RESULT(no)
++])
++
++AC_CACHE_CHECK([for flock declaration], [ac_cv_flock_decl],
++  [AC_COMPILE_IFELSE(
++    [AC_LANG_PROGRAM(
++      [#include <sys/file.h>],
++      [void* p = flock]
++    )],
++    [ac_cv_flock_decl=yes],
++    [ac_cv_flock_decl=no]
++  )
++])
++if test "x${ac_cv_flock_decl}" = xyes; then
++  AC_CHECK_FUNCS(flock,,
++    AC_CHECK_LIB(bsd,flock,
++      [AC_DEFINE(HAVE_FLOCK)
++       AC_DEFINE(FLOCK_NEEDS_LIBBSD, 1, Define if flock needs to be linked with bsd library.)
++    ])
++  )
++fi
++
++AC_MSG_CHECKING(for getpagesize)
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
++#include <unistd.h>
++]], [[void* p = getpagesize]])],
++  [AC_DEFINE(HAVE_GETPAGESIZE, 1, Define if you have the 'getpagesize' function.)
++   AC_MSG_RESULT(yes)],
++  [AC_MSG_RESULT(no)
++])
++
++AC_MSG_CHECKING(for broken unsetenv)
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
++#include <stdlib.h>
++]], [[int res = unsetenv("DUMMY")]])],
++  [AC_MSG_RESULT(no)],
++  [AC_DEFINE(HAVE_BROKEN_UNSETENV, 1, Define if `unsetenv` does not return an int.)
++   AC_MSG_RESULT(yes)
++])
++
++dnl check for true
++AC_CHECK_PROGS(TRUE, true, /bin/true)
++
++dnl On some systems (e.g. Solaris 9), hstrerror and inet_aton are in -lresolv
++dnl On others, they are in the C library, so we to take no action
++AC_CHECK_LIB(c, inet_aton, [$ac_cv_prog_TRUE],
++  AC_CHECK_LIB(resolv, inet_aton)
++)
++
++# On Tru64, chflags seems to be present, but calling it will
++# exit Python
++AC_CACHE_CHECK([for chflags], [ac_cv_have_chflags], [dnl
++AC_RUN_IFELSE([AC_LANG_SOURCE([[
++#include <sys/stat.h>
++#include <unistd.h>
++int main(int argc, char*argv[])
++{
++  if(chflags(argv[0], 0) != 0)
++    return 1;
++  return 0;
++}
++]])],
++[ac_cv_have_chflags=yes],
++[ac_cv_have_chflags=no],
++[ac_cv_have_chflags=cross])
++])
++if test "$ac_cv_have_chflags" = cross ; then
++  AC_CHECK_FUNC([chflags], [ac_cv_have_chflags="yes"], [ac_cv_have_chflags="no"])
++fi
++if test "$ac_cv_have_chflags" = yes ; then
++  AC_DEFINE(HAVE_CHFLAGS, 1, [Define to 1 if you have the 'chflags' function.])
++fi
++
++AC_CACHE_CHECK([for lchflags], [ac_cv_have_lchflags], [dnl
++AC_RUN_IFELSE([AC_LANG_SOURCE([[
++#include <sys/stat.h>
++#include <unistd.h>
++int main(int argc, char*argv[])
++{
++  if(lchflags(argv[0], 0) != 0)
++    return 1;
++  return 0;
++}
++]])],[ac_cv_have_lchflags=yes],[ac_cv_have_lchflags=no],[ac_cv_have_lchflags=cross])
++])
++if test "$ac_cv_have_lchflags" = cross ; then
++  AC_CHECK_FUNC([lchflags], [ac_cv_have_lchflags="yes"], [ac_cv_have_lchflags="no"])
++fi
++if test "$ac_cv_have_lchflags" = yes ; then
++  AC_DEFINE(HAVE_LCHFLAGS, 1, [Define to 1 if you have the 'lchflags' function.])
++fi
++
++dnl Check if system zlib has *Copy() functions
++dnl
++dnl On MacOSX the linker will search for dylibs on the entire linker path
++dnl before searching for static libraries. setup.py adds -Wl,-search_paths_first
++dnl to revert to a more traditional unix behaviour and make it possible to
++dnl override the system libz with a local static library of libz. Temporarily
++dnl add that flag to our CFLAGS as well to ensure that we check the version
++dnl of libz that will be used by setup.py. 
++dnl The -L/usr/local/lib is needed as wel to get the same compilation 
++dnl environment as setup.py (and leaving it out can cause configure to use the
++dnl wrong version of the library)
++case $ac_sys_system/$ac_sys_release in
++Darwin/*) 
++	_CUR_CFLAGS="${CFLAGS}"
++	_CUR_LDFLAGS="${LDFLAGS}"
++	CFLAGS="${CFLAGS} -Wl,-search_paths_first"
++	LDFLAGS="${LDFLAGS} -Wl,-search_paths_first -L/usr/local/lib"
++	;;
++esac
++
++AC_CHECK_LIB(z, inflateCopy, AC_DEFINE(HAVE_ZLIB_COPY, 1, [Define if the zlib library has inflateCopy]))
++
++case $ac_sys_system/$ac_sys_release in
++Darwin/*) 
++	CFLAGS="${_CUR_CFLAGS}"
++	LDFLAGS="${_CUR_LDFLAGS}"
++	;;
++esac
++
++AC_MSG_CHECKING(for hstrerror)
++AC_LINK_IFELSE([AC_LANG_PROGRAM([[
++#include <netdb.h>
++]], [[void* p = hstrerror; hstrerror(0)]])],
++  [AC_DEFINE(HAVE_HSTRERROR, 1, Define if you have the 'hstrerror' function.)
++   AC_MSG_RESULT(yes)],
++  [AC_MSG_RESULT(no)
++])
++
++AC_MSG_CHECKING(for inet_aton)
++AC_LINK_IFELSE([AC_LANG_PROGRAM([[
++#include <sys/types.h>
++#include <sys/socket.h>
++#include <netinet/in.h>
++#include <arpa/inet.h>
++]], [[void* p = inet_aton;inet_aton(0,0)]])],
++  [AC_DEFINE(HAVE_INET_ATON, 1, Define if you have the 'inet_aton' function.)
++   AC_MSG_RESULT(yes)],
++  [AC_MSG_RESULT(no)
++])
++
++AC_MSG_CHECKING(for inet_pton)
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
++#include <sys/types.h>
++#include <sys/socket.h>
++#include <netinet/in.h>
++#include <arpa/inet.h>
++]], [[void* p = inet_pton]])],
++  [AC_DEFINE(HAVE_INET_PTON, 1, Define if you have the 'inet_pton' function.)
++   AC_MSG_RESULT(yes)],
++  [AC_MSG_RESULT(no)
++])
++
++# On some systems, setgroups is in unistd.h, on others, in grp.h
++AC_MSG_CHECKING(for setgroups)
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
++#include <unistd.h>
++#ifdef HAVE_GRP_H
++#include <grp.h>
++#endif
++]], [[void* p = setgroups]])],
++  [AC_DEFINE(HAVE_SETGROUPS, 1, Define if you have the 'setgroups' function.)
++   AC_MSG_RESULT(yes)],
++  [AC_MSG_RESULT(no)
++])
++
++# check for openpty and forkpty
++
++AC_CHECK_FUNCS(openpty,, 
++   AC_CHECK_LIB(util,openpty,
++     [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"],
++     AC_CHECK_LIB(bsd,openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lbsd"])
++   )
++)
++AC_CHECK_FUNCS(forkpty,, 
++   AC_CHECK_LIB(util,forkpty, 
++     [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lutil"],
++     AC_CHECK_LIB(bsd,forkpty, [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lbsd"])
++   )
++)
++
++# Stuff for expat.
++AC_CHECK_FUNCS(memmove)
++
++# check for long file support functions
++AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
++
++AC_REPLACE_FUNCS(dup2 getcwd strdup)
++AC_CHECK_FUNCS(getpgrp, 
++  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[getpgrp(0);]])],
++    [AC_DEFINE(GETPGRP_HAVE_ARG, 1, [Define if getpgrp() must be called as getpgrp(0).])],
++    [])
++)
++AC_CHECK_FUNCS(setpgrp,
++  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[setpgrp(0,0);]])],
++    [AC_DEFINE(SETPGRP_HAVE_ARG, 1, [Define if setpgrp() must be called as setpgrp(0, 0).])],
++    [])
++)
++AC_CHECK_FUNCS(gettimeofday, 
++  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/time.h>]],
++  				     [[gettimeofday((struct timeval*)0,(struct timezone*)0);]])],
++    [],
++    [AC_DEFINE(GETTIMEOFDAY_NO_TZ, 1,
++      [Define if gettimeofday() does not have second (timezone) argument
++       This is the case on Motorola V4 (R40V4.2)])
++    ])
++)
++
++AC_MSG_CHECKING(for major, minor, and makedev)
++AC_LINK_IFELSE([AC_LANG_PROGRAM([[
++#if defined(MAJOR_IN_MKDEV)
++#include <sys/mkdev.h>
++#elif defined(MAJOR_IN_SYSMACROS)
++#include <sys/sysmacros.h>
++#else
++#include <sys/types.h>
++#endif
++]], [[
++  makedev(major(0),minor(0));
++]])],[
++  AC_DEFINE(HAVE_DEVICE_MACROS, 1,
++	    [Define to 1 if you have the device macros.])
++  AC_MSG_RESULT(yes)
++],[
++  AC_MSG_RESULT(no)
++])
++
++# On OSF/1 V5.1, getaddrinfo is available, but a define
++# for [no]getaddrinfo in netdb.h. 
++AC_MSG_CHECKING(for getaddrinfo)
++AC_LINK_IFELSE([AC_LANG_PROGRAM([[
++#include <sys/types.h>
++#include <sys/socket.h>
++#include <netdb.h>
++#include <stdio.h>
++]], [[getaddrinfo(NULL, NULL, NULL, NULL);]])],
++[have_getaddrinfo=yes],
++[have_getaddrinfo=no])
++AC_MSG_RESULT($have_getaddrinfo)
++if test $have_getaddrinfo = yes
++then
++  AC_MSG_CHECKING(getaddrinfo bug)
++  AC_CACHE_VAL(ac_cv_buggy_getaddrinfo,
++  AC_RUN_IFELSE([AC_LANG_SOURCE([[[
++#include <sys/types.h>
++#include <netdb.h>
++#include <string.h>
++#include <sys/socket.h>
++#include <netinet/in.h>
++
++int main()
++{
++  int passive, gaierr, inet4 = 0, inet6 = 0;
++  struct addrinfo hints, *ai, *aitop;
++  char straddr[INET6_ADDRSTRLEN], strport[16];
++
++  for (passive = 0; passive <= 1; passive++) {
++    memset(&hints, 0, sizeof(hints));
++    hints.ai_family = AF_UNSPEC;
++    hints.ai_flags = passive ? AI_PASSIVE : 0;
++    hints.ai_socktype = SOCK_STREAM;
++    hints.ai_protocol = IPPROTO_TCP;
++    if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
++      (void)gai_strerror(gaierr);
++      goto bad;
++    }
++    for (ai = aitop; ai; ai = ai->ai_next) {
++      if (ai->ai_addr == NULL ||
++          ai->ai_addrlen == 0 ||
++          getnameinfo(ai->ai_addr, ai->ai_addrlen,
++                      straddr, sizeof(straddr), strport, sizeof(strport),
++                      NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
++        goto bad;
++      }
++      switch (ai->ai_family) {
++      case AF_INET:
++        if (strcmp(strport, "54321") != 0) {
++          goto bad;
++        }
++        if (passive) {
++          if (strcmp(straddr, "0.0.0.0") != 0) {
++            goto bad;
++          }
++        } else {
++          if (strcmp(straddr, "127.0.0.1") != 0) {
++            goto bad;
++          }
++        }
++        inet4++;
++        break;
++      case AF_INET6:
++        if (strcmp(strport, "54321") != 0) {
++          goto bad;
++        }
++        if (passive) {
++          if (strcmp(straddr, "::") != 0) {
++            goto bad;
++          }
++        } else {
++          if (strcmp(straddr, "::1") != 0) {
++            goto bad;
++          }
++        }
++        inet6++;
++        break;
++      case AF_UNSPEC:
++        goto bad;
++        break;
++      default:
++        /* another family support? */
++        break;
++      }
++    }
++  }
++
++  if (!(inet4 == 0 || inet4 == 2))
++    goto bad;
++  if (!(inet6 == 0 || inet6 == 2))
++    goto bad;
++
++  if (aitop)
++    freeaddrinfo(aitop);
++  return 0;
++
++ bad:
++  if (aitop)
++    freeaddrinfo(aitop);
++  return 1;
++}
++]]])],
++[ac_cv_buggy_getaddrinfo=no],
++[ac_cv_buggy_getaddrinfo=yes],
++[ac_cv_buggy_getaddrinfo=yes]))
++fi
++
++AC_MSG_RESULT($ac_cv_buggy_getaddrinfo)
++
++if test $have_getaddrinfo = no -o "$ac_cv_buggy_getaddrinfo" = yes
++then
++	if test $ipv6 = yes
++	then
++		echo 'Fatal: You must get working getaddrinfo() function.'
++		echo '       or you can specify "--disable-ipv6"'.
++		exit 1
++	fi
++else
++	AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if you have the getaddrinfo function.])
++fi
++
++AC_CHECK_FUNCS(getnameinfo)
++
++# checks for structures
++AC_HEADER_TIME
++AC_STRUCT_TM
++AC_STRUCT_TIMEZONE
++AC_CHECK_MEMBERS([struct stat.st_rdev])
++AC_CHECK_MEMBERS([struct stat.st_blksize])
++AC_CHECK_MEMBERS([struct stat.st_flags])
++AC_CHECK_MEMBERS([struct stat.st_gen])
++AC_CHECK_MEMBERS([struct stat.st_birthtime])
++AC_STRUCT_ST_BLOCKS
++
++AC_MSG_CHECKING(for time.h that defines altzone)
++AC_CACHE_VAL(ac_cv_header_time_altzone,[
++  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[return altzone;]])],
++    [ac_cv_header_time_altzone=yes],
++    [ac_cv_header_time_altzone=no])
++  ])
++AC_MSG_RESULT($ac_cv_header_time_altzone)
++if test $ac_cv_header_time_altzone = yes; then
++  AC_DEFINE(HAVE_ALTZONE, 1, [Define this if your time.h defines altzone.])
++fi
++
++was_it_defined=no
++AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
++#include <sys/types.h>
++#include <sys/select.h>
++#include <sys/time.h>
++]], [[;]])],[
++  AC_DEFINE(SYS_SELECT_WITH_SYS_TIME, 1,
++  [Define if  you can safely include both <sys/select.h> and <sys/time.h>
++   (which you can't on SCO ODT 3.0).]) 
++  was_it_defined=yes
++],[])
++AC_MSG_RESULT($was_it_defined)
++
++AC_MSG_CHECKING(for addrinfo)
++AC_CACHE_VAL(ac_cv_struct_addrinfo,
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]], [[struct addrinfo a]])],
++  [ac_cv_struct_addrinfo=yes],
++  [ac_cv_struct_addrinfo=no]))
++AC_MSG_RESULT($ac_cv_struct_addrinfo)
++if test $ac_cv_struct_addrinfo = yes; then
++	AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo (netdb.h)])
++fi
++
++AC_MSG_CHECKING(for sockaddr_storage)
++AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
++#		include <sys/types.h>
++#		include <sys/socket.h>]], [[struct sockaddr_storage s]])],
++  [ac_cv_struct_sockaddr_storage=yes],
++  [ac_cv_struct_sockaddr_storage=no]))
++AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
++if test $ac_cv_struct_sockaddr_storage = yes; then
++	AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [struct sockaddr_storage (sys/socket.h)])
++fi
++
++# checks for compiler characteristics
++
++AC_C_CHAR_UNSIGNED
++AC_C_CONST
++
++works=no
++AC_MSG_CHECKING(for working volatile)
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[volatile int x; x = 0;]])],
++  [works=yes],
++  [AC_DEFINE(volatile, , [Define to empty if the keyword does not work.])]
++)
++AC_MSG_RESULT($works)
++
++works=no
++AC_MSG_CHECKING(for working signed char)
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[signed char c;]])],
++  [works=yes],
++  [AC_DEFINE(signed, , [Define to empty if the keyword does not work.])]
++)
++AC_MSG_RESULT($works)
++
++have_prototypes=no
++AC_MSG_CHECKING(for prototypes)
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int foo(int x) { return 0; }]], [[return foo(10);]])],
++  [AC_DEFINE(HAVE_PROTOTYPES, 1, 
++     [Define if your compiler supports function prototype]) 
++   have_prototypes=yes],
++  []
++)
++AC_MSG_RESULT($have_prototypes)
++
++works=no
++AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
++#include <stdarg.h>
++int foo(int x, ...) {
++	va_list va;
++	va_start(va, x);
++	va_arg(va, int);
++	va_arg(va, char *);
++	va_arg(va, double);
++	return 0;
++}
++]], [[return foo(10, "", 3.14);]])],[
++  AC_DEFINE(HAVE_STDARG_PROTOTYPES, 1,
++   [Define if your compiler supports variable length function prototypes
++   (e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h>]) 
++  works=yes
++],[])
++AC_MSG_RESULT($works)
++
++# check for socketpair
++AC_MSG_CHECKING(for socketpair)
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
++#include <sys/types.h>
++#include <sys/socket.h>
++]], [[void *x=socketpair]])],
++  [AC_DEFINE(HAVE_SOCKETPAIR, 1, [Define if you have the 'socketpair' function.])
++   AC_MSG_RESULT(yes)],
++  [AC_MSG_RESULT(no)]
++)
++
++# check if sockaddr has sa_len member
++AC_MSG_CHECKING(if sockaddr has sa_len member)
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
++#include <sys/socket.h>]], [[struct sockaddr x;
++x.sa_len = 0;]])],
++  [AC_MSG_RESULT(yes)
++   AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if sockaddr has sa_len member])],
++  [AC_MSG_RESULT(no)]
++)
++
++va_list_is_array=no
++AC_MSG_CHECKING(whether va_list is an array)
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
++#ifdef HAVE_STDARG_PROTOTYPES
++#include <stdarg.h>
++#else
++#include <varargs.h>
++#endif
++]], [[va_list list1, list2; list1 = list2;]])],[],[
++ AC_DEFINE(VA_LIST_IS_ARRAY, 1, [Define if a va_list is an array of some kind]) 
++ va_list_is_array=yes
++])
++AC_MSG_RESULT($va_list_is_array)
++
++# sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
++AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
++  [Define this if you have some version of gethostbyname_r()])
++
++AC_CHECK_FUNC(gethostbyname_r, [
++  AC_DEFINE(HAVE_GETHOSTBYNAME_R)
++  AC_MSG_CHECKING([gethostbyname_r with 6 args])
++  OLD_CFLAGS=$CFLAGS
++  CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
++  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
++#   include <netdb.h>
++  ]], [[
++    char *name;
++    struct hostent *he, *res;
++    char buffer[2048];
++    int buflen = 2048;
++    int h_errnop;
++
++    (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
++  ]])],[
++    AC_DEFINE(HAVE_GETHOSTBYNAME_R)
++    AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
++    [Define this if you have the 6-arg version of gethostbyname_r().])
++    AC_MSG_RESULT(yes)
++  ],[
++    AC_MSG_RESULT(no)
++    AC_MSG_CHECKING([gethostbyname_r with 5 args])
++    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
++#       include <netdb.h>
++      ]], [[
++        char *name;
++        struct hostent *he;
++        char buffer[2048];
++        int buflen = 2048;
++        int h_errnop;
++
++        (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
++      ]])],
++      [
++        AC_DEFINE(HAVE_GETHOSTBYNAME_R)
++        AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
++          [Define this if you have the 5-arg version of gethostbyname_r().])
++        AC_MSG_RESULT(yes)
++      ], [
++        AC_MSG_RESULT(no)
++        AC_MSG_CHECKING([gethostbyname_r with 3 args])
++        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
++#           include <netdb.h>
++          ]], [[
++            char *name;
++            struct hostent *he;
++            struct hostent_data data;
++
++            (void) gethostbyname_r(name, he, &data);
++          ]])],
++          [
++            AC_DEFINE(HAVE_GETHOSTBYNAME_R)
++            AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
++              [Define this if you have the 3-arg version of gethostbyname_r().])
++            AC_MSG_RESULT(yes)
++          ], [
++           AC_MSG_RESULT(no)
++        ])
++    ])
++  ])
++  CFLAGS=$OLD_CFLAGS
++], [
++  AC_CHECK_FUNCS(gethostbyname)
++])
++AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
++AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
++AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
++AC_SUBST(HAVE_GETHOSTBYNAME_R)
++AC_SUBST(HAVE_GETHOSTBYNAME)
++
++# checks for system services
++# (none yet)
++
++# Linux requires this for correct f.p. operations
++AC_CHECK_FUNC(__fpu_control,
++  [],
++  [AC_CHECK_LIB(ieee, __fpu_control)
++])
++
++# Check for --with-fpectl
++AC_MSG_CHECKING(for --with-fpectl)
++AC_ARG_WITH(fpectl,
++            AS_HELP_STRING([--with-fpectl], [enable SIGFPE catching]),
++[
++if test "$withval" != no
++then 
++  AC_DEFINE(WANT_SIGFPE_HANDLER, 1,
++  [Define if you want SIGFPE handled (see Include/pyfpe.h).]) 
++  AC_MSG_RESULT(yes)
++else AC_MSG_RESULT(no)
++fi],
++[AC_MSG_RESULT(no)])
++
++# check for --with-libm=...
++AC_SUBST(LIBM)
++case $ac_sys_system in
++Darwin) ;;
++BeOS) ;;
++*) LIBM=-lm
++esac
++AC_MSG_CHECKING(for --with-libm=STRING)
++AC_ARG_WITH(libm,
++            AS_HELP_STRING([--with-libm=STRING], [math library]),
++[
++if test "$withval" = no
++then LIBM=
++     AC_MSG_RESULT(force LIBM empty)
++elif test "$withval" != yes
++then LIBM=$withval
++     AC_MSG_RESULT(set LIBM="$withval")
++else AC_MSG_ERROR([proper usage is --with-libm=STRING])
++fi],
++[AC_MSG_RESULT(default LIBM="$LIBM")])
++
++# check for --with-libc=...
++AC_SUBST(LIBC)
++AC_MSG_CHECKING(for --with-libc=STRING)
++AC_ARG_WITH(libc,
++            AS_HELP_STRING([--with-libc=STRING], [C library]),
++[
++if test "$withval" = no
++then LIBC=
++     AC_MSG_RESULT(force LIBC empty)
++elif test "$withval" != yes
++then LIBC=$withval
++     AC_MSG_RESULT(set LIBC="$withval")
++else AC_MSG_ERROR([proper usage is --with-libc=STRING])
++fi],
++[AC_MSG_RESULT(default LIBC="$LIBC")])
++
++# **************************************************
++# * Check for various properties of floating point *
++# **************************************************
++
++AC_MSG_CHECKING(whether C doubles are little-endian IEEE 754 binary64)
++AC_CACHE_VAL(ac_cv_little_endian_double, [
++AC_RUN_IFELSE([AC_LANG_SOURCE([[
++#include <string.h>
++int main() {
++    double x = 9006104071832581.0;
++    if (memcmp(&x, "\x05\x04\x03\x02\x01\xff\x3f\x43", 8) == 0)
++        return 0;
++    else
++        return 1;
++}
++]])],
++[ac_cv_little_endian_double=yes],
++[ac_cv_little_endian_double=no],
++[ac_cv_little_endian_double=no])])
++AC_MSG_RESULT($ac_cv_little_endian_double)
++if test "$ac_cv_little_endian_double" = yes
++then
++  AC_DEFINE(DOUBLE_IS_LITTLE_ENDIAN_IEEE754, 1,
++  [Define if C doubles are 64-bit IEEE 754 binary format, stored
++   with the least significant byte first])
++fi
++
++AC_MSG_CHECKING(whether C doubles are big-endian IEEE 754 binary64)
++AC_CACHE_VAL(ac_cv_big_endian_double, [
++AC_RUN_IFELSE([AC_LANG_SOURCE([[
++#include <string.h>
++int main() {
++    double x = 9006104071832581.0;
++    if (memcmp(&x, "\x43\x3f\xff\x01\x02\x03\x04\x05", 8) == 0)
++        return 0;
++    else
++        return 1;
++}
++]])],
++[ac_cv_big_endian_double=yes],
++[ac_cv_big_endian_double=no],
++[ac_cv_big_endian_double=no])])
++AC_MSG_RESULT($ac_cv_big_endian_double)
++if test "$ac_cv_big_endian_double" = yes
++then
++  AC_DEFINE(DOUBLE_IS_BIG_ENDIAN_IEEE754, 1,
++  [Define if C doubles are 64-bit IEEE 754 binary format, stored
++   with the most significant byte first])
++fi
++
++# Some ARM platforms use a mixed-endian representation for doubles.
++# While Python doesn't currently have full support for these platforms
++# (see e.g., issue 1762561), we can at least make sure that float <-> string
++# conversions work.
++AC_MSG_CHECKING(whether C doubles are ARM mixed-endian IEEE 754 binary64)
++AC_CACHE_VAL(ac_cv_mixed_endian_double, [
++AC_RUN_IFELSE([AC_LANG_SOURCE([[
++#include <string.h>
++int main() {
++    double x = 9006104071832581.0;
++    if (memcmp(&x, "\x01\xff\x3f\x43\x05\x04\x03\x02", 8) == 0)
++        return 0;
++    else
++        return 1;
++}
++]])],
++[ac_cv_mixed_endian_double=yes],
++[ac_cv_mixed_endian_double=no],
++[ac_cv_mixed_endian_double=no])])
++AC_MSG_RESULT($ac_cv_mixed_endian_double)
++if test "$ac_cv_mixed_endian_double" = yes
++then
++  AC_DEFINE(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754, 1,
++  [Define if C doubles are 64-bit IEEE 754 binary format, stored
++   in ARM mixed-endian order (byte order 45670123)])
++fi
++
++# The short float repr introduced in Python 3.1 requires the
++# correctly-rounded string <-> double conversion functions from
++# Python/dtoa.c, which in turn require that the FPU uses 53-bit
++# rounding; this is a problem on x86, where the x87 FPU has a default
++# rounding precision of 64 bits.  For gcc/x86, we can fix this by
++# using inline assembler to get and set the x87 FPU control word.
++
++# This inline assembler syntax may also work for suncc and icc,
++# so we try it on all platforms.
++
++AC_MSG_CHECKING(whether we can use gcc inline assembler to get and set x87 control word)
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
++  unsigned short cw;
++  __asm__ __volatile__ ("fnstcw %0" : "=m" (cw));
++  __asm__ __volatile__ ("fldcw %0" : : "m" (cw));
++]])],[have_gcc_asm_for_x87=yes],[have_gcc_asm_for_x87=no])
++AC_MSG_RESULT($have_gcc_asm_for_x87)
++if test "$have_gcc_asm_for_x87" = yes
++then
++    AC_DEFINE(HAVE_GCC_ASM_FOR_X87, 1,
++    [Define if we can use gcc inline assembler to get and set x87 control word])
++fi
++
++# Detect whether system arithmetic is subject to x87-style double
++# rounding issues.  The result of this test has little meaning on non
++# IEEE 754 platforms.  On IEEE 754, test should return 1 if rounding
++# mode is round-to-nearest and double rounding issues are present, and
++# 0 otherwise.  See http://bugs.python.org/issue2937 for more info.
++AC_MSG_CHECKING(for x87-style double rounding)
++# $BASECFLAGS may affect the result
++ac_save_cc="$CC"
++CC="$CC $BASECFLAGS"
++AC_RUN_IFELSE([AC_LANG_SOURCE([[
++#include <stdlib.h>
++#include <math.h>
++int main() {
++    volatile double x, y, z;
++    /* 1./(1-2**-53) -> 1+2**-52 (correct), 1.0 (double rounding) */
++    x = 0.99999999999999989; /* 1-2**-53 */
++    y = 1./x;
++    if (y != 1.)
++        exit(0);
++    /* 1e16+2.99999 -> 1e16+2. (correct), 1e16+4. (double rounding) */
++    x = 1e16;
++    y = 2.99999;
++    z = x + y;
++    if (z != 1e16+4.)
++        exit(0);
++    /* both tests show evidence of double rounding */
++    exit(1);
++}
++]])],
++[ac_cv_x87_double_rounding=no],
++[ac_cv_x87_double_rounding=yes],
++[ac_cv_x87_double_rounding=no])
++CC="$ac_save_cc"
++AC_MSG_RESULT($ac_cv_x87_double_rounding)
++if test "$ac_cv_x87_double_rounding" = yes
++then
++  AC_DEFINE(X87_DOUBLE_ROUNDING, 1,
++  [Define if arithmetic is subject to x87-style double rounding issue])
++fi
++
++# ************************************
++# * Check for mathematical functions *
++# ************************************
++
++LIBS_SAVE=$LIBS
++LIBS="$LIBS $LIBM"
++
++# On FreeBSD 6.2, it appears that tanh(-0.) returns 0. instead of
++# -0. on some architectures.
++AC_MSG_CHECKING(whether tanh preserves the sign of zero)
++AC_CACHE_VAL(ac_cv_tanh_preserves_zero_sign, [
++AC_RUN_IFELSE([AC_LANG_SOURCE([[
++#include <math.h>
++#include <stdlib.h>
++int main() {
++    /* return 0 if either negative zeros don't exist
++       on this platform or if negative zeros exist
++       and tanh(-0.) == -0. */
++  if (atan2(0., -1.) == atan2(-0., -1.) ||
++      atan2(tanh(-0.), -1.) == atan2(-0., -1.)) exit(0);
++  else exit(1);
++}
++]])],
++[ac_cv_tanh_preserves_zero_sign=yes],
++[ac_cv_tanh_preserves_zero_sign=no],
++[ac_cv_tanh_preserves_zero_sign=no])])
++AC_MSG_RESULT($ac_cv_tanh_preserves_zero_sign)
++if test "$ac_cv_tanh_preserves_zero_sign" = yes
++then
++  AC_DEFINE(TANH_PRESERVES_ZERO_SIGN, 1,
++  [Define if tanh(-0.) is -0., or if platform doesn't have signed zeros])
++fi
++
++AC_CHECK_FUNCS([acosh asinh atanh copysign erf erfc expm1 finite gamma])
++AC_CHECK_FUNCS([hypot lgamma log1p round tgamma])
++AC_CHECK_DECLS([isinf, isnan, isfinite], [], [], [[#include <math.h>]])
++
++LIBS=$LIBS_SAVE
++
++# For multiprocessing module, check that sem_open
++# actually works.  For FreeBSD versions <= 7.2,
++# the kernel module that provides POSIX semaphores
++# isn't loaded by default, so an attempt to call
++# sem_open results in a 'Signal 12' error.
++AC_MSG_CHECKING(whether POSIX semaphores are enabled)
++AC_CACHE_VAL(ac_cv_posix_semaphores_enabled,
++AC_RUN_IFELSE([AC_LANG_SOURCE([[
++#include <unistd.h>
++#include <fcntl.h>
++#include <stdio.h>
++#include <semaphore.h>
++#include <sys/stat.h>
++
++int main(void) {
++  sem_t *a = sem_open("/autoconf", O_CREAT, S_IRUSR|S_IWUSR, 0);
++  if (a == SEM_FAILED) {
++    perror("sem_open");
++    return 1;
++  }
++  sem_close(a);
++  sem_unlink("/autoconf");
++  return 0;
++}
++]])],
++[ac_cv_posix_semaphores_enabled=yes],
++[ac_cv_posix_semaphores_enabled=no],
++[ac_cv_posix_semaphores_enabled=yes])
++)
++AC_MSG_RESULT($ac_cv_posix_semaphores_enabled)
++if test $ac_cv_posix_semaphores_enabled = no
++then
++  AC_DEFINE(POSIX_SEMAPHORES_NOT_ENABLED, 1,
++            [Define if POSIX semaphores aren't enabled on your system])
++fi
++
++# Multiprocessing check for broken sem_getvalue
++AC_MSG_CHECKING(for broken sem_getvalue)
++AC_CACHE_VAL(ac_cv_broken_sem_getvalue,
++AC_RUN_IFELSE([AC_LANG_SOURCE([[
++#include <unistd.h>
++#include <fcntl.h>
++#include <stdio.h>
++#include <semaphore.h>
++#include <sys/stat.h>
++
++int main(void){
++  sem_t *a = sem_open("/autocftw", O_CREAT, S_IRUSR|S_IWUSR, 0);
++  int count;
++  int res;
++  if(a==SEM_FAILED){
++    perror("sem_open");
++    return 1;
++
++  }
++  res = sem_getvalue(a, &count);
++  sem_close(a);
++  sem_unlink("/autocftw");
++  return res==-1 ? 1 : 0;
++}
++]])],
++[ac_cv_broken_sem_getvalue=no],
++[ac_cv_broken_sem_getvalue=yes],
++[ac_cv_broken_sem_getvalue=yes])
++)
++AC_MSG_RESULT($ac_cv_broken_sem_getvalue)
++if test $ac_cv_broken_sem_getvalue = yes
++then
++  AC_DEFINE(HAVE_BROKEN_SEM_GETVALUE, 1,
++  [define to 1 if your sem_getvalue is broken.])
++fi
++
++# determine what size digit to use for Python's longs
++AC_MSG_CHECKING([digit size for Python's longs])
++AC_ARG_ENABLE(big-digits,
++AS_HELP_STRING([--enable-big-digits@<:@=BITS@:>@],[use big digits for Python longs [[BITS=30]]]),
++[case $enable_big_digits in
++yes)
++  enable_big_digits=30 ;;
++no)
++  enable_big_digits=15 ;;
++[15|30])
++  ;;
++*)
++  AC_MSG_ERROR([bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30]) ;;
++esac
++AC_MSG_RESULT($enable_big_digits)
++AC_DEFINE_UNQUOTED(PYLONG_BITS_IN_DIGIT, $enable_big_digits, [Define as the preferred size in bits of long digits])
++],
++[AC_MSG_RESULT(no value specified)])
++
++# check for wchar.h
++AC_CHECK_HEADER(wchar.h, [
++  AC_DEFINE(HAVE_WCHAR_H, 1, 
++  [Define if the compiler provides a wchar.h header file.]) 
++  wchar_h="yes"
++],
++wchar_h="no"
++)
++
++# determine wchar_t size
++if test "$wchar_h" = yes
++then
++  AC_CHECK_SIZEOF(wchar_t, 4, [#include <wchar.h>])
++fi
++
++AC_MSG_CHECKING(for UCS-4 tcl)
++have_ucs4_tcl=no
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
++#include <tcl.h>
++#if TCL_UTF_MAX != 6
++# error "NOT UCS4_TCL"
++#endif]], [[]])],[
++  AC_DEFINE(HAVE_UCS4_TCL, 1, [Define this if you have tcl and TCL_UTF_MAX==6])
++  have_ucs4_tcl=yes
++],[])
++AC_MSG_RESULT($have_ucs4_tcl)
++
++# check whether wchar_t is signed or not
++if test "$wchar_h" = yes
++then
++  # check whether wchar_t is signed or not
++  AC_MSG_CHECKING(whether wchar_t is signed)
++  AC_CACHE_VAL(ac_cv_wchar_t_signed, [
++  AC_RUN_IFELSE([AC_LANG_SOURCE([[
++  #include <wchar.h>
++  int main()
++  {
++	/* Success: exit code 0 */
++        exit((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
++  }
++  ]])],
++  [ac_cv_wchar_t_signed=yes],
++  [ac_cv_wchar_t_signed=no],
++  [ac_cv_wchar_t_signed=yes])])
++  AC_MSG_RESULT($ac_cv_wchar_t_signed)
++fi
++  
++AC_MSG_CHECKING(what type to use for unicode)
++dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
++AC_ARG_ENABLE(unicode, 
++              AS_HELP_STRING([--enable-unicode@<:@=ucs@<:@24@:>@@:>@], [Enable Unicode strings (default is ucs2)]),
++              [],
++              [enable_unicode=yes])
++
++if test $enable_unicode = yes
++then
++  # Without any arguments, Py_UNICODE defaults to two-byte mode
++  case "$have_ucs4_tcl" in
++  yes) enable_unicode="ucs4"
++       ;;
++  *)   enable_unicode="ucs2"
++       ;;
++  esac
++fi
++
++AH_TEMPLATE(Py_UNICODE_SIZE,
++  [Define as the size of the unicode type.])
++case "$enable_unicode" in
++ucs2) unicode_size="2"
++      AC_DEFINE(Py_UNICODE_SIZE,2)
++      ;;
++ucs4) unicode_size="4"
++      AC_DEFINE(Py_UNICODE_SIZE,4)
++      ;;
++no)   ;;      # To allow --disable-unicode
++*) AC_MSG_ERROR([invalid value for --enable-unicode. Use either ucs2 or ucs4 (lowercase).]) ;;
++esac
++
++AH_TEMPLATE(PY_UNICODE_TYPE,
++  [Define as the integral type used for Unicode representation.])
++
++AC_SUBST(UNICODE_OBJS)
++if test "$enable_unicode" = "no"
++then
++  UNICODE_OBJS=""
++  AC_MSG_RESULT(not used)
++else
++  UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o"
++  AC_DEFINE(Py_USING_UNICODE, 1,
++  [Define if you want to have a Unicode type.])
++
++  # wchar_t is only usable if it maps to an unsigned type
++  if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \
++          -a "$ac_cv_wchar_t_signed" = "no"
++  then
++    PY_UNICODE_TYPE="wchar_t"
++    AC_DEFINE(HAVE_USABLE_WCHAR_T, 1,
++    [Define if you have a useable wchar_t type defined in wchar.h; useable
++     means wchar_t must be an unsigned type with at least 16 bits. (see
++     Include/unicodeobject.h).])
++    AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
++  elif test "$ac_cv_sizeof_short" = "$unicode_size"
++  then
++       PY_UNICODE_TYPE="unsigned short"
++       AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
++  elif test "$ac_cv_sizeof_long" = "$unicode_size"
++  then
++       PY_UNICODE_TYPE="unsigned long"
++       AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
++  else
++       PY_UNICODE_TYPE="no type found"
++  fi
++  AC_MSG_RESULT($PY_UNICODE_TYPE)
++fi
++
++# check for endianness
++AC_C_BIGENDIAN
++
++# Check whether right shifting a negative integer extends the sign bit
++# or fills with zeros (like the Cray J90, according to Tim Peters).
++AC_MSG_CHECKING(whether right shift extends the sign bit)
++AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
++AC_RUN_IFELSE([AC_LANG_SOURCE([[
++int main()
++{
++	exit(((-1)>>3 == -1) ? 0 : 1);
++}
++]])],
++[ac_cv_rshift_extends_sign=yes],
++[ac_cv_rshift_extends_sign=no],
++[ac_cv_rshift_extends_sign=yes])])
++AC_MSG_RESULT($ac_cv_rshift_extends_sign)
++if test "$ac_cv_rshift_extends_sign" = no
++then
++  AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS, 1,
++  [Define if i>>j for signed int i does not extend the sign bit
++   when i < 0])
++fi
++
++# check for getc_unlocked and related locking functions
++AC_MSG_CHECKING(for getc_unlocked() and friends)
++AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
++AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[
++	FILE *f = fopen("/dev/null", "r");
++	flockfile(f);
++	getc_unlocked(f);
++	funlockfile(f);
++]])],[ac_cv_have_getc_unlocked=yes],[ac_cv_have_getc_unlocked=no])])
++AC_MSG_RESULT($ac_cv_have_getc_unlocked)
++if test "$ac_cv_have_getc_unlocked" = yes
++then
++  AC_DEFINE(HAVE_GETC_UNLOCKED, 1,
++  [Define this if you have flockfile(), getc_unlocked(), and funlockfile()])
++fi
++
++# check where readline lives
++# save the value of LIBS so we don't actually link Python with readline
++LIBS_no_readline=$LIBS
++
++# On some systems we need to link readline to a termcap compatible
++# library.  NOTE: Keep the precedence of listed libraries synchronised
++# with setup.py.
++py_cv_lib_readline=no
++AC_MSG_CHECKING([how to link readline libs])
++for py_libtermcap in "" ncursesw ncurses curses termcap; do
++  if test -z "$py_libtermcap"; then
++    READLINE_LIBS="-lreadline"
++  else
++    READLINE_LIBS="-lreadline -l$py_libtermcap"
++  fi
++  LIBS="$READLINE_LIBS $LIBS_no_readline"
++  AC_LINK_IFELSE(
++    [AC_LANG_CALL([],[readline])],
++    [py_cv_lib_readline=yes])
++  if test $py_cv_lib_readline = yes; then
++    break
++  fi
++done
++# Uncomment this line if you want to use READINE_LIBS in Makefile or scripts
++#AC_SUBST([READLINE_LIBS])
++if test $py_cv_lib_readline = no; then
++  AC_MSG_RESULT([none])
++else
++  AC_MSG_RESULT([$READLINE_LIBS])
++  AC_DEFINE(HAVE_LIBREADLINE, 1,
++    [Define if you have the readline library (-lreadline).])
++fi
++
++# check for readline 2.1
++AC_CHECK_LIB(readline, rl_callback_handler_install,
++	AC_DEFINE(HAVE_RL_CALLBACK, 1,
++        [Define if you have readline 2.1]), ,$READLINE_LIBS)
++
++# check for readline 2.2
++AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <readline/readline.h>]])],
++  [have_readline=yes],
++  [have_readline=no]
++)
++if test $have_readline = yes
++then
++  AC_EGREP_HEADER([extern int rl_completion_append_character;],
++  [readline/readline.h],
++  AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
++  [Define if you have readline 2.2]), )
++  AC_EGREP_HEADER([extern int rl_completion_suppress_append;],
++  [readline/readline.h],
++  AC_DEFINE(HAVE_RL_COMPLETION_SUPPRESS_APPEND, 1,
++  [Define if you have rl_completion_suppress_append]), )
++fi
++
++# check for readline 4.0
++AC_CHECK_LIB(readline, rl_pre_input_hook,
++	AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
++        [Define if you have readline 4.0]), ,$READLINE_LIBS)
++
++# also in 4.0
++AC_CHECK_LIB(readline, rl_completion_display_matches_hook,
++	AC_DEFINE(HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK, 1,
++        [Define if you have readline 4.0]), ,$READLINE_LIBS)
++
++# check for readline 4.2
++AC_CHECK_LIB(readline, rl_completion_matches,
++	AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
++        [Define if you have readline 4.2]), ,$READLINE_LIBS)
++
++# also in readline 4.2
++AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <readline/readline.h>]])],
++  [have_readline=yes],
++  [have_readline=no]
++)
++if test $have_readline = yes
++then
++  AC_EGREP_HEADER([extern int rl_catch_signals;],
++  [readline/readline.h],
++  AC_DEFINE(HAVE_RL_CATCH_SIGNAL, 1,
++  [Define if you can turn off readline's signal handling.]), )
++fi
++
++# End of readline checks: restore LIBS
++LIBS=$LIBS_no_readline
++
++AC_MSG_CHECKING(for broken nice())
++AC_CACHE_VAL(ac_cv_broken_nice, [
++AC_RUN_IFELSE([AC_LANG_SOURCE([[
++int main()
++{
++	int val1 = nice(1);
++	if (val1 != -1 && val1 == nice(2))
++		exit(0);
++	exit(1);
++}
++]])],
++[ac_cv_broken_nice=yes],
++[ac_cv_broken_nice=no],
++[ac_cv_broken_nice=no])])
++AC_MSG_RESULT($ac_cv_broken_nice)
++if test "$ac_cv_broken_nice" = yes
++then
++  AC_DEFINE(HAVE_BROKEN_NICE, 1,
++  [Define if nice() returns success/failure instead of the new priority.])
++fi
++
++AC_MSG_CHECKING(for broken poll())
++AC_CACHE_VAL(ac_cv_broken_poll,
++AC_RUN_IFELSE([AC_LANG_SOURCE([[
++#include <poll.h>
++
++int main()
++{
++    struct pollfd poll_struct = { 42, POLLIN|POLLPRI|POLLOUT, 0 };
++    int poll_test;
++
++    close (42);
++
++    poll_test = poll(&poll_struct, 1, 0);
++    if (poll_test < 0)
++        return 0;
++    else if (poll_test == 0 && poll_struct.revents != POLLNVAL)
++        return 0;
++    else
++        return 1;
++}
++]])],
++[ac_cv_broken_poll=yes],
++[ac_cv_broken_poll=no],
++[ac_cv_broken_poll=no]))
++AC_MSG_RESULT($ac_cv_broken_poll)
++if test "$ac_cv_broken_poll" = yes
++then
++  AC_DEFINE(HAVE_BROKEN_POLL, 1,
++      [Define if poll() sets errno on invalid file descriptors.])
++fi
++
++# Before we can test tzset, we need to check if struct tm has a tm_zone 
++# (which is not required by ISO C or UNIX spec) and/or if we support
++# tzname[]
++AC_STRUCT_TIMEZONE
++
++# check tzset(3) exists and works like we expect it to
++AC_MSG_CHECKING(for working tzset())
++AC_CACHE_VAL(ac_cv_working_tzset, [
++AC_RUN_IFELSE([AC_LANG_SOURCE([[
++#include <stdlib.h>
++#include <time.h>
++#include <string.h>
++
++#if HAVE_TZNAME
++extern char *tzname[];
++#endif
++
++int main()
++{
++	/* Note that we need to ensure that not only does tzset(3)
++	   do 'something' with localtime, but it works as documented
++	   in the library reference and as expected by the test suite.
++	   This includes making sure that tzname is set properly if
++	   tm->tm_zone does not exist since it is the alternative way
++	   of getting timezone info.
++
++	   Red Hat 6.2 doesn't understand the southern hemisphere 
++	   after New Year's Day.
++	*/
++
++	time_t groundhogday = 1044144000; /* GMT-based */
++	time_t midyear = groundhogday + (365 * 24 * 3600 / 2);
++
++	putenv("TZ=UTC+0");
++	tzset();
++	if (localtime(&groundhogday)->tm_hour != 0)
++	    exit(1);
++#if HAVE_TZNAME
++	/* For UTC, tzname[1] is sometimes "", sometimes "   " */
++	if (strcmp(tzname[0], "UTC") || 
++		(tzname[1][0] != 0 && tzname[1][0] != ' '))
++	    exit(1);
++#endif
++
++	putenv("TZ=EST+5EDT,M4.1.0,M10.5.0");
++	tzset();
++	if (localtime(&groundhogday)->tm_hour != 19)
++	    exit(1);
++#if HAVE_TZNAME
++	if (strcmp(tzname[0], "EST") || strcmp(tzname[1], "EDT"))
++	    exit(1);
++#endif
++
++	putenv("TZ=AEST-10AEDT-11,M10.5.0,M3.5.0");
++	tzset();
++	if (localtime(&groundhogday)->tm_hour != 11)
++	    exit(1);
++#if HAVE_TZNAME
++	if (strcmp(tzname[0], "AEST") || strcmp(tzname[1], "AEDT"))
++	    exit(1);
++#endif
++
++#if HAVE_STRUCT_TM_TM_ZONE
++	if (strcmp(localtime(&groundhogday)->tm_zone, "AEDT"))
++	    exit(1);
++	if (strcmp(localtime(&midyear)->tm_zone, "AEST"))
++	    exit(1);
++#endif
++
++	exit(0);
++}
++]])],
++[ac_cv_working_tzset=yes],
++[ac_cv_working_tzset=no],
++[ac_cv_working_tzset=no])])
++AC_MSG_RESULT($ac_cv_working_tzset)
++if test "$ac_cv_working_tzset" = yes
++then
++  AC_DEFINE(HAVE_WORKING_TZSET, 1,
++  [Define if tzset() actually switches the local timezone in a meaningful way.])
++fi
++
++# Look for subsecond timestamps in struct stat
++AC_MSG_CHECKING(for tv_nsec in struct stat)
++AC_CACHE_VAL(ac_cv_stat_tv_nsec,
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[
++struct stat st;
++st.st_mtim.tv_nsec = 1;
++]])],
++[ac_cv_stat_tv_nsec=yes],
++[ac_cv_stat_tv_nsec=no]))
++AC_MSG_RESULT($ac_cv_stat_tv_nsec)
++if test "$ac_cv_stat_tv_nsec" = yes
++then
++  AC_DEFINE(HAVE_STAT_TV_NSEC, 1,
++  [Define if you have struct stat.st_mtim.tv_nsec])
++fi
++
++# Look for BSD style subsecond timestamps in struct stat
++AC_MSG_CHECKING(for tv_nsec2 in struct stat)
++AC_CACHE_VAL(ac_cv_stat_tv_nsec2,
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[
++struct stat st;
++st.st_mtimespec.tv_nsec = 1;
++]])],
++[ac_cv_stat_tv_nsec2=yes],
++[ac_cv_stat_tv_nsec2=no]))
++AC_MSG_RESULT($ac_cv_stat_tv_nsec2)
++if test "$ac_cv_stat_tv_nsec2" = yes
++then
++  AC_DEFINE(HAVE_STAT_TV_NSEC2, 1,
++  [Define if you have struct stat.st_mtimensec])
++fi
++
++# On HP/UX 11.0, mvwdelch is a block with a return statement
++AC_MSG_CHECKING(whether mvwdelch is an expression)
++AC_CACHE_VAL(ac_cv_mvwdelch_is_expression,
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
++  int rtn;
++  rtn = mvwdelch(0,0,0);
++]])],
++[ac_cv_mvwdelch_is_expression=yes],
++[ac_cv_mvwdelch_is_expression=no]))
++AC_MSG_RESULT($ac_cv_mvwdelch_is_expression)
++
++if test "$ac_cv_mvwdelch_is_expression" = yes
++then
++  AC_DEFINE(MVWDELCH_IS_EXPRESSION, 1,
++  [Define if mvwdelch in curses.h is an expression.])
++fi
++
++AC_MSG_CHECKING(whether WINDOW has _flags)
++AC_CACHE_VAL(ac_cv_window_has_flags,
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
++  WINDOW *w;
++  w->_flags = 0;
++]])],
++[ac_cv_window_has_flags=yes],
++[ac_cv_window_has_flags=no]))
++AC_MSG_RESULT($ac_cv_window_has_flags)
++
++
++if test "$ac_cv_window_has_flags" = yes
++then
++  AC_DEFINE(WINDOW_HAS_FLAGS, 1, 
++  [Define if WINDOW in curses.h offers a field _flags.])
++fi
++
++AC_MSG_CHECKING(for is_term_resized)
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=is_term_resized]])],
++  [AC_DEFINE(HAVE_CURSES_IS_TERM_RESIZED, 1, Define if you have the 'is_term_resized' function.)
++   AC_MSG_RESULT(yes)],
++  [AC_MSG_RESULT(no)]
++)
++
++AC_MSG_CHECKING(for resize_term)
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=resize_term]])],
++  [AC_DEFINE(HAVE_CURSES_RESIZE_TERM, 1, Define if you have the 'resize_term' function.)
++   AC_MSG_RESULT(yes)],
++  [AC_MSG_RESULT(no)]
++)
++
++AC_MSG_CHECKING(for resizeterm)
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=resizeterm]])],
++  [AC_DEFINE(HAVE_CURSES_RESIZETERM, 1, Define if you have the 'resizeterm' function.)
++   AC_MSG_RESULT(yes)],
++  [AC_MSG_RESULT(no)]
++)
++
++AC_MSG_CHECKING(for /dev/ptmx)
++
++if test -r /dev/ptmx
++then
++  AC_MSG_RESULT(yes)
++  AC_DEFINE(HAVE_DEV_PTMX, 1,
++  [Define if we have /dev/ptmx.])
++else
++  AC_MSG_RESULT(no)
++fi
++
++AC_MSG_CHECKING(for /dev/ptc)
++
++if test -r /dev/ptc
++then
++  AC_MSG_RESULT(yes)
++  AC_DEFINE(HAVE_DEV_PTC, 1,
++  [Define if we have /dev/ptc.])
++else
++  AC_MSG_RESULT(no)
++fi
++
++if test "$have_long_long" = yes
++then
++  AC_MSG_CHECKING(for %lld and %llu printf() format support)
++  AC_CACHE_VAL(ac_cv_have_long_long_format,
++  AC_RUN_IFELSE([AC_LANG_SOURCE([[[
++  #include <stdio.h>
++  #include <stddef.h>
++  #include <string.h>
++
++  #ifdef HAVE_SYS_TYPES_H
++  #include <sys/types.h>
++  #endif
++
++  int main()
++  {
++      char buffer[256];
++
++      if (sprintf(buffer, "%lld", (long long)123) < 0)
++          return 1;
++      if (strcmp(buffer, "123"))
++          return 1;
++
++      if (sprintf(buffer, "%lld", (long long)-123) < 0)
++          return 1;
++      if (strcmp(buffer, "-123"))
++          return 1;
++
++      if (sprintf(buffer, "%llu", (unsigned long long)123) < 0)
++          return 1;
++      if (strcmp(buffer, "123"))
++          return 1;
++
++      return 0;
++  }
++  ]]])],
++  [ac_cv_have_long_long_format=yes],
++  [ac_cv_have_long_long_format=no],
++  [ac_cv_have_long_long_format=no])
++  )
++  AC_MSG_RESULT($ac_cv_have_long_long_format)
++fi
++
++if test "$ac_cv_have_long_long_format" = yes
++then
++  AC_DEFINE(PY_FORMAT_LONG_LONG, "ll",
++  [Define to printf format modifier for long long type])
++fi
++
++if test $ac_sys_system = Darwin
++then
++	LIBS="$LIBS -framework CoreFoundation"
++fi
++
++
++AC_CACHE_CHECK([for %zd printf() format support], ac_cv_have_size_t_format, [dnl
++AC_RUN_IFELSE([AC_LANG_SOURCE([[
++#include <stdio.h>
++#include <stddef.h>
++#include <string.h>
++
++#ifdef HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++
++#ifdef HAVE_SSIZE_T
++typedef ssize_t Py_ssize_t;
++#elif SIZEOF_VOID_P == SIZEOF_LONG
++typedef long Py_ssize_t;
++#else
++typedef int Py_ssize_t;
++#endif
++
++int main()
++{
++    char buffer[256];
++
++    if(sprintf(buffer, "%zd", (size_t)123) < 0)
++       	return 1;
++
++    if (strcmp(buffer, "123"))
++	return 1;
++
++    if (sprintf(buffer, "%zd", (Py_ssize_t)-123) < 0)
++       	return 1;
++
++    if (strcmp(buffer, "-123"))
++	return 1;
++
++    return 0;
++}
++]])],
++[ac_cv_have_size_t_format=yes],
++[ac_cv_have_size_t_format=no],
++[ac_cv_have_size_t_format="cross -- assuming yes"
++])])
++if test "$ac_cv_have_size_t_format" != no ; then
++  AC_DEFINE(PY_FORMAT_SIZE_T, "z",
++  [Define to printf format modifier for Py_ssize_t])
++fi
++
++AC_CHECK_TYPE(socklen_t,,
++  AC_DEFINE(socklen_t,int,
++            [Define to `int' if <sys/socket.h> does not define.]),[
++#ifdef HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++#ifdef HAVE_SYS_SOCKET_H
++#include <sys/socket.h>
++#endif
++])
++
++case $ac_sys_system in
++AIX*)
++  AC_DEFINE(HAVE_BROKEN_PIPE_BUF, 1, [Define if the system reports an invalid PIPE_BUF value.]) ;;
++esac
++
++
++AC_SUBST(THREADHEADERS)
++
++for h in `(cd $srcdir;echo Python/thread_*.h)`
++do
++  THREADHEADERS="$THREADHEADERS \$(srcdir)/$h"
++done
++
++AC_SUBST(SRCDIRS)
++SRCDIRS="Parser Grammar Objects Python Modules Mac"
++AC_MSG_CHECKING(for build directories)
++for dir in $SRCDIRS; do
++    if test ! -d $dir; then
++        mkdir $dir
++    fi
++done
++AC_MSG_RESULT(done)
++
++# generate output files
++AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc)
++AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix])
++AC_OUTPUT
++
++echo "creating Modules/Setup"
++if test ! -f Modules/Setup
++then
++	cp $srcdir/Modules/Setup.dist Modules/Setup
++fi
++
++echo "creating Modules/Setup.local"
++if test ! -f Modules/Setup.local
++then
++	echo "# Edit this file for local setup changes" >Modules/Setup.local
++fi
++
++echo "creating Makefile"
++$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
++			-s Modules Modules/Setup.config \
++			Modules/Setup.local Modules/Setup
++
++case $ac_sys_system in
++BeOS)
++        AC_MSG_WARN([
++
++  Support for BeOS is deprecated as of Python 2.6.
++  See PEP 11 for the gory details.
++  ])
++  ;;
++*) ;;
++esac
++
++mv config.c Modules
+diff -r 70274d53c1dd configure.in
+--- a/configure.in
++++ /dev/null
+@@ -1,4355 +0,0 @@
+-dnl ***********************************************
+-dnl * Please run autoreconf to test your changes! *
+-dnl ***********************************************
+-
+-# Set VERSION so we only need to edit in one place (i.e., here)
+-m4_define(PYTHON_VERSION, 2.7)
+-
+-AC_PREREQ(2.65)
+-
+-AC_REVISION($Revision$)
+-AC_INIT(python, PYTHON_VERSION, http://bugs.python.org/)
+-AC_CONFIG_SRCDIR([Include/object.h])
+-AC_CONFIG_HEADER(pyconfig.h)
+-
+-dnl Ensure that if prefix is specified, it does not end in a slash. If
+-dnl it does, we get path names containing '//' which is both ugly and
+-dnl can cause trouble.
+-
+-dnl Last slash shouldn't be stripped if prefix=/
+-if test "$prefix" != "/"; then
+-    prefix=`echo "$prefix" | sed -e 's/\/$//g'`
+-fi    
+-
+-dnl This is for stuff that absolutely must end up in pyconfig.h.
+-dnl Please use pyport.h instead, if possible.
+-AH_TOP([
+-#ifndef Py_PYCONFIG_H
+-#define Py_PYCONFIG_H
+-])
+-AH_BOTTOM([
+-/* Define the macros needed if on a UnixWare 7.x system. */
+-#if defined(__USLC__) && defined(__SCO_VERSION__)
+-#define STRICT_SYSV_CURSES /* Don't use ncurses extensions */
+-#endif
+-
+-#endif /*Py_PYCONFIG_H*/
+-])
+-
+-# We don't use PACKAGE_ variables, and they cause conflicts
+-# with other autoconf-based packages that include Python.h
+-grep -v 'define PACKAGE_' <confdefs.h >confdefs.h.new
+-rm confdefs.h
+-mv confdefs.h.new confdefs.h
+-
+-AC_SUBST(VERSION)
+-VERSION=PYTHON_VERSION
+-
+-AC_SUBST(SOVERSION)
+-SOVERSION=1.0
+-
+-# The later defininition of _XOPEN_SOURCE disables certain features
+-# on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone).
+-AC_DEFINE(_GNU_SOURCE, 1, [Define on Linux to activate all library features])
+-
+-# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
+-# certain features on NetBSD, so we need _NETBSD_SOURCE to re-enable
+-# them.
+-AC_DEFINE(_NETBSD_SOURCE, 1, [Define on NetBSD to activate all library features])
+-
+-# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
+-# certain features on FreeBSD, so we need __BSD_VISIBLE to re-enable
+-# them.
+-AC_DEFINE(__BSD_VISIBLE, 1, [Define on FreeBSD to activate all library features])
+-
+-# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
+-# u_int on Irix 5.3. Defining _BSD_TYPES brings it back.
+-AC_DEFINE(_BSD_TYPES, 1, [Define on Irix to enable u_int])
+-
+-# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
+-# certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable
+-# them.
+-AC_DEFINE(_DARWIN_C_SOURCE, 1, [Define on Darwin to activate all library features])
+-
+-
+-define_xopen_source=yes
+-
+-# Arguments passed to configure.
+-AC_SUBST(CONFIG_ARGS)
+-CONFIG_ARGS="$ac_configure_args"
+-
+-AC_MSG_CHECKING([for --enable-universalsdk])
+-AC_ARG_ENABLE(universalsdk,
+-	AS_HELP_STRING([--enable-universalsdk@<:@=SDKDIR@:>@], [Build against Mac OS X 10.4u SDK (ppc/i386)]),
+-[
+-	case $enableval in
+-	yes)
+-		enableval=/Developer/SDKs/MacOSX10.4u.sdk
+-		if test ! -d "${enableval}"
+-		then
+-			enableval=/
+-		fi
+-		;;
+-	esac
+-	case $enableval in
+-	no)
+-		UNIVERSALSDK=
+-		enable_universalsdk=
+-		;;
+-	*)
+-		UNIVERSALSDK=$enableval
+-		if test ! -d "${UNIVERSALSDK}"
+-		then
+-			AC_MSG_ERROR([--enable-universalsdk specifies non-existing SDK: ${UNIVERSALSDK}])
+-		fi
+-		;;
+-	esac
+-	
+-],[
+-   	UNIVERSALSDK=
+-	enable_universalsdk=
+-])
+-if test -n "${UNIVERSALSDK}"
+-then
+-	AC_MSG_RESULT(${UNIVERSALSDK})
+-else
+-	AC_MSG_RESULT(no)
+-fi
+-AC_SUBST(UNIVERSALSDK)
+-
+-AC_SUBST(ARCH_RUN_32BIT)
+-
+-UNIVERSAL_ARCHS="32-bit"
+-AC_SUBST(LIPO_32BIT_FLAGS)
+-AC_MSG_CHECKING(for --with-universal-archs)
+-AC_ARG_WITH(universal-archs,
+-    AS_HELP_STRING([--with-universal-archs=ARCH], [select architectures for universal build ("32-bit", "64-bit", "3-way", "intel" or "all")]),
+-[
+-	AC_MSG_RESULT($withval)
+-	UNIVERSAL_ARCHS="$withval"
+-        if test "${enable_universalsdk}" ; then
+-		:
+-	else
+-		AC_MSG_ERROR([--with-universal-archs without --enable-universalsdk. See Mac/README])
+-	fi
+-],
+-[
+- 	AC_MSG_RESULT(32-bit)
+-])
+-
+-
+-
+-AC_ARG_WITH(framework-name,
+-              AS_HELP_STRING([--with-framework-name=FRAMEWORK],
+-                             [specify an alternate name of the framework built with --enable-framework]),
+-[
+-    if test "${enable_framework}"; then
+-	    :
+-    else
+-	AC_MSG_ERROR([--with-framework-name without --enable-framework. See Mac/README])
+-    fi
+-    PYTHONFRAMEWORK=${withval}
+-    PYTHONFRAMEWORKDIR=${withval}.framework
+-    PYTHONFRAMEWORKIDENTIFIER=org.python.`echo $withval | tr '[A-Z]' '[a-z]'`
+-    ],[
+-    PYTHONFRAMEWORK=Python
+-    PYTHONFRAMEWORKDIR=Python.framework
+-    PYTHONFRAMEWORKIDENTIFIER=org.python.python
+-])
+-dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
+-AC_ARG_ENABLE(framework,
+-              AS_HELP_STRING([--enable-framework@<:@=INSTALLDIR@:>@], [Build (MacOSX|Darwin) framework]),
+-[
+-	case $enableval in
+-	yes) 
+-		enableval=/Library/Frameworks
+-	esac
+-	case $enableval in
+-	no)
+-		PYTHONFRAMEWORK=
+-		PYTHONFRAMEWORKDIR=no-framework
+-		PYTHONFRAMEWORKPREFIX=
+-		PYTHONFRAMEWORKINSTALLDIR=
+-		FRAMEWORKINSTALLFIRST=
+-		FRAMEWORKINSTALLLAST=
+-		FRAMEWORKALTINSTALLFIRST=
+-		FRAMEWORKALTINSTALLLAST=
+-		if test "x${prefix}" = "xNONE"; then
+-			FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
+-		else
+-			FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
+-		fi
+-		enable_framework=
+-		;;
+-	*)
+-		PYTHONFRAMEWORKPREFIX="${enableval}"
+-		PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
+-		FRAMEWORKINSTALLFIRST="frameworkinstallstructure"
+-		FRAMEWORKALTINSTALLFIRST="frameworkinstallstructure bininstall maninstall"
+-		FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools"
+-		FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools"
+-		FRAMEWORKINSTALLAPPSPREFIX="/Applications"
+-
+-		if test "x${prefix}" = "xNONE" ; then
+-			FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
+-
+-		else
+-			FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
+-		fi
+-
+-		case "${enableval}" in
+-		/System*)
+-			FRAMEWORKINSTALLAPPSPREFIX="/Applications"
+-			if test "${prefix}" = "NONE" ; then
+-				# See below
+-				FRAMEWORKUNIXTOOLSPREFIX="/usr"
+-			fi
+-			;;
+-
+-		/Library*)
+-			FRAMEWORKINSTALLAPPSPREFIX="/Applications"
+-			;;
+-
+-		*/Library/Frameworks)
+-			MDIR="`dirname "${enableval}"`"
+-			MDIR="`dirname "${MDIR}"`"
+-			FRAMEWORKINSTALLAPPSPREFIX="${MDIR}/Applications"
+-
+-			if test "${prefix}" = "NONE"; then
+-				# User hasn't specified the 
+-				# --prefix option, but wants to install
+-				# the framework in a non-default location,
+-				# ensure that the compatibility links get
+-				# installed relative to that prefix as well
+-				# instead of in /usr/local.
+-				FRAMEWORKUNIXTOOLSPREFIX="${MDIR}"
+-			fi
+-			;;
+-
+-		*)
+-			FRAMEWORKINSTALLAPPSPREFIX="/Applications"
+-			;;
+-		esac
+-
+-		prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION
+-
+-		# Add files for Mac specific code to the list of output
+-		# files:
+-		AC_CONFIG_FILES(Mac/Makefile)
+-		AC_CONFIG_FILES(Mac/PythonLauncher/Makefile)
+-		AC_CONFIG_FILES(Mac/IDLE/Makefile)
+-		AC_CONFIG_FILES(Mac/Resources/framework/Info.plist)
+-		AC_CONFIG_FILES(Mac/Resources/app/Info.plist)
+-	esac
+-	],[
+-	PYTHONFRAMEWORK=
+-	PYTHONFRAMEWORKDIR=no-framework
+-	PYTHONFRAMEWORKPREFIX=
+-	PYTHONFRAMEWORKINSTALLDIR=
+-	FRAMEWORKINSTALLFIRST=
+-	FRAMEWORKINSTALLLAST=
+-	FRAMEWORKALTINSTALLFIRST=
+-	FRAMEWORKALTINSTALLLAST=
+-	if test "x${prefix}" = "xNONE" ; then
+-		FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
+-	else
+-		FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
+-	fi
+-	enable_framework=
+-
+-])
+-AC_SUBST(PYTHONFRAMEWORK)
+-AC_SUBST(PYTHONFRAMEWORKIDENTIFIER)
+-AC_SUBST(PYTHONFRAMEWORKDIR)
+-AC_SUBST(PYTHONFRAMEWORKPREFIX)
+-AC_SUBST(PYTHONFRAMEWORKINSTALLDIR)
+-AC_SUBST(FRAMEWORKINSTALLFIRST)
+-AC_SUBST(FRAMEWORKINSTALLLAST)
+-AC_SUBST(FRAMEWORKALTINSTALLFIRST)
+-AC_SUBST(FRAMEWORKALTINSTALLLAST)
+-AC_SUBST(FRAMEWORKUNIXTOOLSPREFIX)
+-AC_SUBST(FRAMEWORKINSTALLAPPSPREFIX)
+-
+-##AC_ARG_WITH(dyld,
+-##            AS_HELP_STRING([--with-dyld],
+-##                           [Use (OpenStep|Rhapsody) dynamic linker]))
+-##
+-# Set name for machine-dependent library files
+-AC_SUBST(MACHDEP)
+-AC_MSG_CHECKING(MACHDEP)
+-if test -z "$MACHDEP"
+-then
+-	ac_sys_system=`uname -s`
+-	if test "$ac_sys_system" = "AIX" \
+-	-o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then
+-		ac_sys_release=`uname -v`
+-	else
+-		ac_sys_release=`uname -r`
+-	fi
+-	ac_md_system=`echo $ac_sys_system |
+-			   tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
+-	ac_md_release=`echo $ac_sys_release |
+-			   tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'`
+-	MACHDEP="$ac_md_system$ac_md_release"
+-
+-	case $MACHDEP in
+-	linux*) MACHDEP="linux2";;
+-	cygwin*) MACHDEP="cygwin";;
+-	darwin*) MACHDEP="darwin";;
+-	atheos*) MACHDEP="atheos";;
+-        irix646) MACHDEP="irix6";;
+-	'')	MACHDEP="unknown";;
+-	esac
+-fi
+-	
+-# Some systems cannot stand _XOPEN_SOURCE being defined at all; they
+-# disable features if it is defined, without any means to access these
+-# features as extensions. For these systems, we skip the definition of
+-# _XOPEN_SOURCE. Before adding a system to the list to gain access to
+-# some feature, make sure there is no alternative way to access this
+-# feature. Also, when using wildcards, make sure you have verified the
+-# need for not defining _XOPEN_SOURCE on all systems matching the
+-# wildcard, and that the wildcard does not include future systems
+-# (which may remove their limitations).
+-dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
+-case $ac_sys_system/$ac_sys_release in
+-  # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined,
+-  # even though select is a POSIX function. Reported by J. Ribbens.
+-  # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish.
+-  # In addition, Stefan Krah confirms that issue #1244610 exists through
+-  # OpenBSD 4.6, but is fixed in 4.7.
+-  OpenBSD/2.* | OpenBSD/3.* | OpenBSD/4.@<:@0123456@:>@) 
+-    define_xopen_source=no
+-    # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is
+-    # also defined. This can be overridden by defining _BSD_SOURCE
+-    # As this has a different meaning on Linux, only define it on OpenBSD
+-    AC_DEFINE(_BSD_SOURCE, 1, [Define on OpenBSD to activate all library features])
+-    ;;
+-  OpenBSD/*)
+-    # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is
+-    # also defined. This can be overridden by defining _BSD_SOURCE
+-    # As this has a different meaning on Linux, only define it on OpenBSD
+-    AC_DEFINE(_BSD_SOURCE, 1, [Define on OpenBSD to activate all library features])
+-    ;;
+-  # Defining _XOPEN_SOURCE on NetBSD version prior to the introduction of
+-  # _NETBSD_SOURCE disables certain features (eg. setgroups). Reported by
+-  # Marc Recht
+-  NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6@<:@A-S@:>@)
+-    define_xopen_source=no;;
+-  # From the perspective of Solaris, _XOPEN_SOURCE is not so much a
+-  # request to enable features supported by the standard as a request
+-  # to disable features not supported by the standard.  The best way
+-  # for Python to use Solaris is simply to leave _XOPEN_SOURCE out
+-  # entirely and define __EXTENSIONS__ instead.
+-  SunOS/*)
+-    define_xopen_source=no;;
+-  # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE,
+-  # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice.
+-  # Reconfirmed for 7.1.4 by Martin v. Loewis.
+-  OpenUNIX/8.0.0| UnixWare/7.1.@<:@0-4@:>@)
+-    define_xopen_source=no;;
+-  # On OpenServer 5, u_short is never defined with _XOPEN_SOURCE,
+-  # but used in struct sockaddr.sa_family. Reported by Tim Rice.
+-  SCO_SV/3.2)
+-    define_xopen_source=no;;
+-  # On FreeBSD 4, the math functions C89 does not cover are never defined
+-  # with _XOPEN_SOURCE and __BSD_VISIBLE does not re-enable them.
+-  FreeBSD/4.*)
+-    define_xopen_source=no;;
+-  # On MacOS X 10.2, a bug in ncurses.h means that it craps out if 
+-  # _XOPEN_EXTENDED_SOURCE is defined. Apparently, this is fixed in 10.3, which
+-  # identifies itself as Darwin/7.*
+-  # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
+-  # disables platform specific features beyond repair.
+-  # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE 
+-  # has no effect, don't bother defining them
+-  Darwin/@<:@6789@:>@.*)
+-    define_xopen_source=no;;
+-  Darwin/1@<:@0-9@:>@.*)
+-    define_xopen_source=no;;
+-  # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
+-  # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
+-  # or has another value. By not (re)defining it, the defaults come in place.
+-  AIX/4)
+-    define_xopen_source=no;;
+-  AIX/5)
+-    if test `uname -r` -eq 1; then
+-      define_xopen_source=no
+-    fi
+-    ;;
+-  # On QNX 6.3.2, defining _XOPEN_SOURCE prevents netdb.h from
+-  # defining NI_NUMERICHOST.
+-  QNX/6.3.2)
+-    define_xopen_source=no
+-    ;;
+-
+-esac
+-
+-if test $define_xopen_source = yes
+-then
+-  AC_DEFINE(_XOPEN_SOURCE, 600, 
+-            Define to the level of X/Open that your system supports)
+-
+-  # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires
+-  # definition of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else
+-  # several APIs are not declared. Since this is also needed in some
+-  # cases for HP-UX, we define it globally.
+-  AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1,
+-   	    Define to activate Unix95-and-earlier features)
+-
+-  AC_DEFINE(_POSIX_C_SOURCE, 200112L, Define to activate features from IEEE Stds 1003.1-2001)
+-  
+-fi
+-
+-#
+-# SGI compilers allow the specification of the both the ABI and the
+-# ISA on the command line.  Depending on the values of these switches,
+-# different and often incompatable code will be generated.
+-#
+-# The SGI_ABI variable can be used to modify the CC and LDFLAGS and
+-# thus supply support for various ABI/ISA combinations.  The MACHDEP
+-# variable is also adjusted.
+-#
+-AC_SUBST(SGI_ABI)
+-if test ! -z "$SGI_ABI"
+-then
+-        CC="cc $SGI_ABI"
+-        LDFLAGS="$SGI_ABI $LDFLAGS"
+-        MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
+-fi
+-AC_MSG_RESULT($MACHDEP)
+-
+-# And add extra plat-mac for darwin
+-AC_SUBST(EXTRAPLATDIR)
+-AC_SUBST(EXTRAMACHDEPPATH)
+-AC_MSG_CHECKING(EXTRAPLATDIR)
+-if test -z "$EXTRAPLATDIR"
+-then
+-	case $MACHDEP in
+-	darwin)	
+-		EXTRAPLATDIR="\$(PLATMACDIRS)"
+-		EXTRAMACHDEPPATH="\$(PLATMACPATH)"
+-		;;
+-	*) 
+-		EXTRAPLATDIR=""
+-		EXTRAMACHDEPPATH=""
+-		;;
+-	esac
+-fi
+-AC_MSG_RESULT($EXTRAPLATDIR)
+-
+-# Record the configure-time value of MACOSX_DEPLOYMENT_TARGET,
+-# it may influence the way we can build extensions, so distutils
+-# needs to check it
+-AC_SUBST(CONFIGURE_MACOSX_DEPLOYMENT_TARGET)
+-AC_SUBST(EXPORT_MACOSX_DEPLOYMENT_TARGET)
+-CONFIGURE_MACOSX_DEPLOYMENT_TARGET=
+-EXPORT_MACOSX_DEPLOYMENT_TARGET='#'
+-
+-AC_MSG_CHECKING(machine type as reported by uname -m)
+-ac_sys_machine=`uname -m`
+-AC_MSG_RESULT($ac_sys_machine)
+-
+-# checks for alternative programs
+-
+-# compiler flags are generated in two sets, BASECFLAGS and OPT.  OPT is just
+-# for debug/optimization stuff.  BASECFLAGS is for flags that are required
+-# just to get things to compile and link.  Users are free to override OPT
+-# when running configure or make.  The build should not break if they do.
+-# BASECFLAGS should generally not be messed with, however.
+-
+-# XXX shouldn't some/most/all of this code be merged with the stuff later
+-# on that fiddles with OPT and BASECFLAGS?
+-AC_MSG_CHECKING(for --without-gcc)
+-AC_ARG_WITH(gcc,
+-            AS_HELP_STRING([--without-gcc], [never use gcc]),
+-[
+-	case $withval in
+-	no)	CC=${CC:-cc}
+-		without_gcc=yes;;
+-	yes)	CC=gcc
+-		without_gcc=no;;
+-	*)	CC=$withval
+-		without_gcc=$withval;;
+-	esac], [
+-	case $ac_sys_system in
+-	AIX*)   CC=${CC:-xlc_r}
+-		without_gcc=;;
+-	BeOS*)
+-		case $BE_HOST_CPU in
+-		ppc)
+-			CC=mwcc
+-			without_gcc=yes
+-			BASECFLAGS="$BASECFLAGS -export pragma"
+-			OPT="$OPT -O"
+-			LDFLAGS="$LDFLAGS -nodup"
+-			;;
+-		x86)
+-			CC=gcc
+-			without_gcc=no
+-			OPT="$OPT -O"
+-			;;
+-		*)
+-			AC_MSG_ERROR([Unknown BeOS platform "$BE_HOST_CPU"])
+-			;;
+-		esac
+-		AR="\$(srcdir)/Modules/ar_beos"
+-		RANLIB=:
+-		;;
+-	*)	without_gcc=no;;
+-	esac])
+-AC_MSG_RESULT($without_gcc)
+-
+-# If the user switches compilers, we can't believe the cache
+-if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
+-then
+-  AC_MSG_ERROR([cached CC is different -- throw away $cache_file
+-(it is also a good idea to do 'make clean' before compiling)])
+-fi
+-
+-# If the user set CFLAGS, use this instead of the automatically
+-# determined setting
+-preset_cflags="$CFLAGS"
+-AC_PROG_CC
+-if test ! -z "$preset_cflags"
+-then
+-	CFLAGS=$preset_cflags
+-fi
+-
+-AC_SUBST(CXX)
+-AC_SUBST(MAINCC)
+-AC_MSG_CHECKING(for --with-cxx-main=<compiler>)
+-AC_ARG_WITH(cxx_main,
+-            AS_HELP_STRING([--with-cxx-main=<compiler>],
+-                           [compile main() and link python executable with C++ compiler]),
+-[
+-	
+-	case $withval in
+-	no)	with_cxx_main=no
+-		MAINCC='$(CC)';;
+-	yes)	with_cxx_main=yes
+-		MAINCC='$(CXX)';;
+-	*)	with_cxx_main=yes
+-		MAINCC=$withval
+-		if test -z "$CXX"
+-		then
+-			CXX=$withval
+-		fi;;
+-	esac], [
+-	with_cxx_main=no
+-	MAINCC='$(CC)'
+-])
+-AC_MSG_RESULT($with_cxx_main)
+-
+-preset_cxx="$CXX"
+-if test -z "$CXX"
+-then
+-        case "$CC" in
+-        gcc)    AC_PATH_PROG(CXX, [g++], [g++], [notfound]) ;;
+-        cc)     AC_PATH_PROG(CXX, [c++], [c++], [notfound]) ;;
+-        esac
+-	if test "$CXX" = "notfound"
+-	then
+-		CXX=""
+-	fi
+-fi
+-if test -z "$CXX"
+-then
+-	AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
+-	if test "$CXX" = "notfound"
+-	then
+-		CXX=""
+-	fi
+-fi
+-if test "$preset_cxx" != "$CXX"
+-then
+-        AC_MSG_WARN([
+-
+-  By default, distutils will build C++ extension modules with "$CXX".
+-  If this is not intended, then set CXX on the configure command line.
+-  ])
+-fi
+-
+-
+-# checks for UNIX variants that set C preprocessor variables
+-AC_USE_SYSTEM_EXTENSIONS
+-
+-# Check for unsupported systems
+-case $ac_sys_system/$ac_sys_release in
+-atheos*|Linux*/1*)
+-   echo This system \($ac_sys_system/$ac_sys_release\) is no longer supported.
+-   echo See README for details.
+-   exit 1;;
+-esac
+-
+-AC_EXEEXT
+-AC_MSG_CHECKING(for --with-suffix)
+-AC_ARG_WITH(suffix,
+-            AS_HELP_STRING([--with-suffix=.exe], [set executable suffix]),
+-[
+-	case $withval in
+-	no)	EXEEXT=;;
+-	yes)	EXEEXT=.exe;;
+-	*)	EXEEXT=$withval;;
+-	esac])
+-AC_MSG_RESULT($EXEEXT)
+-
+-# Test whether we're running on a non-case-sensitive system, in which
+-# case we give a warning if no ext is given
+-AC_SUBST(BUILDEXEEXT)
+-AC_MSG_CHECKING(for case-insensitive build directory)
+-if test ! -d CaseSensitiveTestDir; then
+-mkdir CaseSensitiveTestDir
+-fi
+-
+-if test -d casesensitivetestdir
+-then
+-    AC_MSG_RESULT(yes)
+-    BUILDEXEEXT=.exe
+-else
+-	AC_MSG_RESULT(no)
+-	BUILDEXEEXT=$EXEEXT
+-fi
+-rmdir CaseSensitiveTestDir
+-
+-case $MACHDEP in
+-bsdos*)
+-    case $CC in
+-    gcc) CC="$CC -D_HAVE_BSDI";;
+-    esac;;
+-esac
+-
+-case $ac_sys_system in
+-hp*|HP*)
+-    case $CC in
+-    cc|*/cc) CC="$CC -Ae";;
+-    esac;;
+-SunOS*)
+-    # Some functions have a prototype only with that define, e.g. confstr
+-    AC_DEFINE(__EXTENSIONS__, 1, [Defined on Solaris to see additional function prototypes.])
+-    ;;
+-esac
+-
+-
+-AC_SUBST(LIBRARY)
+-AC_MSG_CHECKING(LIBRARY)
+-if test -z "$LIBRARY"
+-then
+-	LIBRARY='libpython$(VERSION).a'
+-fi
+-AC_MSG_RESULT($LIBRARY)
+-
+-# LDLIBRARY is the name of the library to link against (as opposed to the
+-# name of the library into which to insert object files). BLDLIBRARY is also
+-# the library to link against, usually. On Mac OS X frameworks, BLDLIBRARY
+-# is blank as the main program is not linked directly against LDLIBRARY.
+-# LDLIBRARYDIR is the path to LDLIBRARY, which is made in a subdirectory. On
+-# systems without shared libraries, LDLIBRARY is the same as LIBRARY
+-# (defined in the Makefiles). On Cygwin LDLIBRARY is the import library,
+-# DLLLIBRARY is the shared (i.e., DLL) library.
+-# 
+-# RUNSHARED is used to run shared python without installed libraries
+-#
+-# INSTSONAME is the name of the shared library that will be use to install
+-# on the system - some systems like version suffix, others don't
+-AC_SUBST(LDLIBRARY)
+-AC_SUBST(DLLLIBRARY)
+-AC_SUBST(BLDLIBRARY)
+-AC_SUBST(LDLIBRARYDIR)
+-AC_SUBST(INSTSONAME)
+-AC_SUBST(RUNSHARED)
+-LDLIBRARY="$LIBRARY"
+-BLDLIBRARY='$(LDLIBRARY)'
+-INSTSONAME='$(LDLIBRARY)'
+-DLLLIBRARY=''
+-LDLIBRARYDIR=''
+-RUNSHARED=''
+-
+-# LINKCC is the command that links the python executable -- default is $(CC).
+-# If CXX is set, and if it is needed to link a main function that was
+-# compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
+-# python might then depend on the C++ runtime
+-# This is altered for AIX in order to build the export list before 
+-# linking.
+-AC_SUBST(LINKCC)
+-AC_MSG_CHECKING(LINKCC)
+-if test -z "$LINKCC"
+-then
+-	LINKCC='$(PURIFY) $(MAINCC)'
+-	case $ac_sys_system in
+-	AIX*)
+-	   exp_extra="\"\""
+-	   if test $ac_sys_release -ge 5 -o \
+-		   $ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
+-	       exp_extra="."
+-	   fi
+-	   LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp $exp_extra \$(LIBRARY); $LINKCC";;
+-	QNX*)
+-	   # qcc must be used because the other compilers do not
+-	   # support -N.
+-	   LINKCC=qcc;;
+-	esac
+-fi
+-AC_MSG_RESULT($LINKCC)
+-
+-# GNULD is set to "yes" if the GNU linker is used.  If this goes wrong
+-# make sure we default having it set to "no": this is used by
+-# distutils.unixccompiler to know if it should add --enable-new-dtags
+-# to linker command lines, and failing to detect GNU ld simply results
+-# in the same bahaviour as before.
+-AC_SUBST(GNULD)
+-AC_MSG_CHECKING(for GNU ld)
+-ac_prog=ld
+-if test "$GCC" = yes; then
+-       ac_prog=`$CC -print-prog-name=ld`
+-fi
+-case `"$ac_prog" -V 2>&1 < /dev/null` in
+-      *GNU*)
+-          GNULD=yes;;
+-      *)
+-          GNULD=no;;
+-esac
+-AC_MSG_RESULT($GNULD)
+-
+-AC_MSG_CHECKING(for --enable-shared)
+-AC_ARG_ENABLE(shared,
+-              AS_HELP_STRING([--enable-shared], [disable/enable building shared python library]))
+-
+-if test -z "$enable_shared"
+-then 
+-  case $ac_sys_system in
+-  CYGWIN* | atheos*)
+-    enable_shared="yes";;
+-  *)
+-    enable_shared="no";;
+-  esac
+-fi
+-AC_MSG_RESULT($enable_shared)
+-
+-AC_MSG_CHECKING(for --enable-profiling)
+-AC_ARG_ENABLE(profiling,
+-              AS_HELP_STRING([--enable-profiling], [enable C-level code profiling]),
+-[ac_save_cc="$CC"
+- CC="$CC -pg"
+- AC_RUN_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],
+-   [ac_enable_profiling="yes"],
+-   [ac_enable_profiling="no"],
+-   [ac_enable_profiling="no"])
+- CC="$ac_save_cc"])
+-AC_MSG_RESULT($ac_enable_profiling)
+-
+-case "$ac_enable_profiling" in
+-    "yes")
+-	BASECFLAGS="-pg $BASECFLAGS"
+-	LDFLAGS="-pg $LDFLAGS"
+-    ;;
+-esac
+-
+-AC_MSG_CHECKING(LDLIBRARY)
+-
+-# MacOSX framework builds need more magic. LDLIBRARY is the dynamic
+-# library that we build, but we do not want to link against it (we
+-# will find it with a -framework option). For this reason there is an
+-# extra variable BLDLIBRARY against which Python and the extension
+-# modules are linked, BLDLIBRARY. This is normally the same as
+-# LDLIBRARY, but empty for MacOSX framework builds.
+-if test "$enable_framework"
+-then
+-  LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
+-  RUNSHARED=DYLD_FRAMEWORK_PATH="`pwd`:$DYLD_FRAMEWORK_PATH"
+-  BLDLIBRARY=''
+-else
+-  BLDLIBRARY='$(LDLIBRARY)'
+-fi  
+-
+-# Other platforms follow
+-if test $enable_shared = "yes"; then
+-  AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.])
+-  case $ac_sys_system in
+-    BeOS*)
+-          LDLIBRARY='libpython$(VERSION).so'
+-          ;;
+-    CYGWIN*)
+-          LDLIBRARY='libpython$(VERSION).dll.a'
+-          DLLLIBRARY='libpython$(VERSION).dll'
+-          ;;
+-    SunOS*)
+-	  LDLIBRARY='libpython$(VERSION).so'
+-	  BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)'
+-	  RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
+-	  INSTSONAME="$LDLIBRARY".$SOVERSION
+-          ;;
+-    Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*)
+-	  LDLIBRARY='libpython$(VERSION).so'
+-	  BLDLIBRARY='-L. -lpython$(VERSION)'
+-	  RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
+-	  case $ac_sys_system in
+-	      FreeBSD*)
+-		SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
+-		;;
+-	  esac
+-	  INSTSONAME="$LDLIBRARY".$SOVERSION
+-	  ;;
+-    hp*|HP*)
+-	  case `uname -m` in
+-		ia64)
+-			LDLIBRARY='libpython$(VERSION).so'
+-			;;
+-		*)
+-			LDLIBRARY='libpython$(VERSION).sl'
+-			;;
+-	  esac
+-	  BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(VERSION)'
+-	  RUNSHARED=SHLIB_PATH=`pwd`:${SHLIB_PATH}
+-	  ;;
+-    OSF*)
+-	  LDLIBRARY='libpython$(VERSION).so'
+-	  BLDLIBRARY='-rpath $(LIBDIR) -L. -lpython$(VERSION)'
+-	  RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
+-	  ;;
+-    atheos*)
+-	  LDLIBRARY='libpython$(VERSION).so'
+-	  BLDLIBRARY='-L. -lpython$(VERSION)'
+-	  RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
+-	  ;;
+-    Darwin*)
+-    	LDLIBRARY='libpython$(VERSION).dylib'
+-	BLDLIBRARY='-L. -lpython$(VERSION)'
+-	RUNSHARED='DYLD_LIBRARY_PATH=`pwd`:${DYLD_LIBRARY_PATH}'
+-	;;
+-    AIX*)
+-	LDLIBRARY='libpython$(VERSION).so'
+-	RUNSHARED=LIBPATH=`pwd`:${LIBPATH}
+-	;;
+-
+-  esac
+-else # shared is disabled
+-  case $ac_sys_system in
+-    CYGWIN*)
+-          BLDLIBRARY='$(LIBRARY)'
+-          LDLIBRARY='libpython$(VERSION).dll.a'
+-          ;;
+-  esac
+-fi
+-
+-AC_MSG_RESULT($LDLIBRARY)
+-
+-AC_PROG_RANLIB
+-AC_SUBST(AR)
+-AC_CHECK_PROGS(AR, ar aal, ar)
+-
+-# tweak ARFLAGS only if the user didn't set it on the command line
+-AC_SUBST(ARFLAGS)
+-if test -z "$ARFLAGS"
+-then
+-        ARFLAGS="rc"
+-fi
+-
+-AC_SUBST(SVNVERSION)
+-AC_CHECK_PROG(SVNVERSION, svnversion, found, not-found)
+-if test $SVNVERSION = found
+-then
+-	SVNVERSION="svnversion \$(srcdir)"
+-else
+-	SVNVERSION="echo Unversioned directory"
+-fi
+-
+-AC_SUBST(HGVERSION)
+-AC_SUBST(HGTAG)
+-AC_SUBST(HGBRANCH)
+-AC_CHECK_PROG(HAS_HG, hg, found, not-found)
+-if test $HAS_HG = found
+-then
+-    HGVERSION="hg id -i \$(srcdir)"
+-    HGTAG="hg id -t \$(srcdir)"
+-    HGBRANCH="hg id -b \$(srcdir)"
+-else
+-    HGVERSION=""
+-    HGTAG=""
+-    HGBRANCH=""
+-fi
+-
+-case $MACHDEP in
+-bsdos*|hp*|HP*)
+-	# install -d does not work on BSDI or HP-UX
+-	if test -z "$INSTALL"
+-	then
+-		INSTALL="${srcdir}/install-sh -c"
+-	fi
+-esac
+-AC_PROG_INSTALL
+-
+-# Not every filesystem supports hard links
+-AC_SUBST(LN)
+-if test -z "$LN" ; then
+-	case $ac_sys_system in
+-		BeOS*) LN="ln -s";;
+-		CYGWIN*) LN="ln -s";;
+-		atheos*) LN="ln -s";;
+-		*) LN=ln;;
+-	esac
+-fi
+-
+-# Check for --with-pydebug
+-AC_MSG_CHECKING(for --with-pydebug)
+-AC_ARG_WITH(pydebug, 
+-            AS_HELP_STRING([--with-pydebug], [build with Py_DEBUG defined]),
+-[
+-if test "$withval" != no
+-then 
+-  AC_DEFINE(Py_DEBUG, 1, 
+-  [Define if you want to build an interpreter with many run-time checks.]) 
+-  AC_MSG_RESULT(yes); 
+-  Py_DEBUG='true'
+-else AC_MSG_RESULT(no); Py_DEBUG='false'
+-fi],
+-[AC_MSG_RESULT(no)])
+-
+-# XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be
+-# merged with this chunk of code?
+-
+-# Optimizer/debugger flags
+-# ------------------------
+-# (The following bit of code is complicated enough - please keep things
+-# indented properly.  Just pretend you're editing Python code. ;-)
+-
+-# There are two parallel sets of case statements below, one that checks to
+-# see if OPT was set and one that does BASECFLAGS setting based upon
+-# compiler and platform.  BASECFLAGS tweaks need to be made even if the
+-# user set OPT.
+-
+-# tweak OPT based on compiler and platform, only if the user didn't set
+-# it on the command line
+-AC_SUBST(OPT)
+-if test "${OPT-unset}" = "unset"
+-then
+-    case $GCC in
+-    yes)
+-        if test "$CC" != 'g++' ; then
+-	    STRICT_PROTO="-Wstrict-prototypes"
+-	fi
+-        # For gcc 4.x we need to use -fwrapv so lets check if its supported
+-        if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then
+-           WRAP="-fwrapv"
+-        fi
+-
+-        # Clang also needs -fwrapv
+-        case $CC in
+-            *clang*) WRAP="-fwrapv"
+-            ;;
+-        esac
+-
+-	case $ac_cv_prog_cc_g in
+-	yes)
+-	    if test "$Py_DEBUG" = 'true' ; then
+-		# Optimization messes up debuggers, so turn it off for
+-		# debug builds.
+-		OPT="-g -O0 -Wall $STRICT_PROTO"
+-	    else
+-		OPT="-g $WRAP -O3 -Wall $STRICT_PROTO"
+-	    fi
+-	    ;;
+-	*)
+-	    OPT="-O3 -Wall $STRICT_PROTO"
+-	    ;;
+-	esac
+-	case $ac_sys_system in
+-	    SCO_SV*) OPT="$OPT -m486 -DSCO5"
+-	    ;;
+-        esac
+-	;;
+-
+-    *)
+-	OPT="-O"
+-	;;
+-    esac
+-fi
+-
+-AC_SUBST(BASECFLAGS)
+-
+-# The -arch flags for universal builds on OSX
+-UNIVERSAL_ARCH_FLAGS=
+-AC_SUBST(UNIVERSAL_ARCH_FLAGS)
+-
+-# tweak BASECFLAGS based on compiler and platform
+-case $GCC in
+-yes)
+-    # Python violates C99 rules, by casting between incompatible
+-    # pointer types. GCC may generate bad code as a result of that,
+-    # so use -fno-strict-aliasing if supported.
+-    AC_MSG_CHECKING(whether $CC accepts -fno-strict-aliasing)
+-     ac_save_cc="$CC"
+-     CC="$CC -fno-strict-aliasing"
+-     AC_CACHE_VAL(ac_cv_no_strict_aliasing_ok,
+-       AC_COMPILE_IFELSE(
+-         [AC_LANG_PROGRAM([[]], [[]])],
+-	 [ac_cv_no_strict_aliasing_ok=yes],
+-	 [ac_cv_no_strict_aliasing_ok=no]))
+-     CC="$ac_save_cc"
+-    AC_MSG_RESULT($ac_cv_no_strict_aliasing_ok)
+-    if test $ac_cv_no_strict_aliasing_ok = yes
+-    then
+-      BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"
+-    fi
+-
+-    # if using gcc on alpha, use -mieee to get (near) full IEEE 754
+-    # support.  Without this, treatment of subnormals doesn't follow
+-    # the standard.
+-    case $ac_sys_machine in
+-         alpha*)
+-                BASECFLAGS="$BASECFLAGS -mieee"
+-                ;;
+-    esac
+-
+-    case $ac_sys_system in
+-	SCO_SV*)
+-	    BASECFLAGS="$BASECFLAGS -m486 -DSCO5"
+-	    ;;
+-	# is there any other compiler on Darwin besides gcc?
+-	Darwin*)
+-	    # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
+-	    # used to be here, but non-Apple gcc doesn't accept them.
+-	    if test "${CC}" = gcc
+-	    then
+-		AC_MSG_CHECKING(which compiler should be used)
+-		case "${UNIVERSALSDK}" in
+-		*/MacOSX10.4u.sdk)
+-			# Build using 10.4 SDK, force usage of gcc when the 
+-			# compiler is gcc, otherwise the user will get very
+-			# confusing error messages when building on OSX 10.6
+-			CC=gcc-4.0
+-			CPP=cpp-4.0
+-			;;
+-		esac
+-		AC_MSG_RESULT($CC)
+-	    fi
+-
+-	    # Calculate the right deployment target for this build.
+-	    #
+-	    cur_target=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'`
+-	    if test ${cur_target} '>' 10.2; then
+-		    cur_target=10.3
+-		    if test ${enable_universalsdk}; then
+-			    if test "${UNIVERSAL_ARCHS}" = "all"; then
+-				    # Ensure that the default platform for a 
+-				    # 4-way universal build is OSX 10.5, 
+-				    # that's the first OS release where 
+-				    # 4-way builds make sense.
+-				    cur_target='10.5'
+-
+-			    elif test "${UNIVERSAL_ARCHS}" = "3-way"; then
+-				    cur_target='10.5'
+-
+-			    elif test "${UNIVERSAL_ARCHS}" = "intel"; then
+-				    cur_target='10.5'
+-
+-			    elif test "${UNIVERSAL_ARCHS}" = "64-bit"; then
+-				    cur_target='10.5'
+-			    fi
+-		    else
+-			    if test `/usr/bin/arch` = "i386"; then
+-				    # On Intel macs default to a deployment
+-				    # target of 10.4, that's the first OSX
+-				    # release with Intel support.
+-				    cur_target="10.4"
+-			    fi
+-		    fi
+-	    fi
+-	    CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
+-	    
+-	    # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the 
+-	    # environment with a value that is the same as what we'll use
+-	    # in the Makefile to ensure that we'll get the same compiler
+-	    # environment during configure and build time.
+-	    MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
+-	    export MACOSX_DEPLOYMENT_TARGET
+-	    EXPORT_MACOSX_DEPLOYMENT_TARGET=''
+-
+-	    if test "${enable_universalsdk}"; then
+-		UNIVERSAL_ARCH_FLAGS=""
+-	        if test "$UNIVERSAL_ARCHS" = "32-bit" ; then
+-		   UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
+-		   ARCH_RUN_32BIT=""
+-		   LIPO_32BIT_FLAGS=""
+-
+-	         elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then
+-		   UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
+-		   LIPO_32BIT_FLAGS=""
+-		   ARCH_RUN_32BIT="true"
+-
+-	         elif test "$UNIVERSAL_ARCHS" = "all" ; then
+-		   UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
+-		   LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
+-		   ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
+-
+-	         elif test "$UNIVERSAL_ARCHS" = "intel" ; then
+-		   UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
+-		   LIPO_32BIT_FLAGS="-extract i386"
+-		   ARCH_RUN_32BIT="/usr/bin/arch -i386"
+-
+-	         elif test "$UNIVERSAL_ARCHS" = "3-way" ; then
+-		   UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64"
+-		   LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
+-		   ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
+-
+-		 else
+-	           AC_MSG_ERROR([proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way])
+-
+-		 fi
+-
+-
+-		CFLAGS="${UNIVERSAL_ARCH_FLAGS} ${CFLAGS}"
+-		if test "${UNIVERSALSDK}" != "/" 
+-		then
+-			CPPFLAGS="-isysroot ${UNIVERSALSDK} ${CPPFLAGS}"
+-			LDFLAGS="-isysroot ${UNIVERSALSDK} ${LDFLAGS}"
+-			CFLAGS="-isysroot ${UNIVERSALSDK} ${CFLAGS}"
+-		fi
+-
+-	    fi
+-
+-
+-	    ;;
+-	OSF*)
+-	    BASECFLAGS="$BASECFLAGS -mieee"
+-	    ;;
+-    esac
+-    ;;
+-
+-*)
+-    case $ac_sys_system in
+-    OpenUNIX*|UnixWare*)
+-	BASECFLAGS="$BASECFLAGS -K pentium,host,inline,loop_unroll,alloca "
+-	;;
+-    OSF*)
+-	BASECFLAGS="$BASECFLAGS -ieee -std"
+-    	;;
+-    SCO_SV*)
+-	BASECFLAGS="$BASECFLAGS -belf -Ki486 -DSCO5"
+-	;;
+-    esac
+-    ;;
+-esac
+-
+-if test "$Py_DEBUG" = 'true'; then
+-  :
+-else
+-  OPT="-DNDEBUG $OPT"
+-fi
+-
+-if test "$ac_arch_flags"
+-then
+-	BASECFLAGS="$BASECFLAGS $ac_arch_flags"
+-fi
+-
+-# disable check for icc since it seems to pass, but generates a warning
+-if test "$CC" = icc
+-then
+-  ac_cv_opt_olimit_ok=no
+-fi
+-
+-AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
+-AC_CACHE_VAL(ac_cv_opt_olimit_ok,
+-[ac_save_cc="$CC"
+-CC="$CC -OPT:Olimit=0"
+-AC_COMPILE_IFELSE(
+-  [AC_LANG_PROGRAM([[]], [[]])],
+-  [ac_cv_opt_olimit_ok=yes],
+-  [ac_cv_opt_olimit_ok=no]
+-  )
+-CC="$ac_save_cc"])
+-AC_MSG_RESULT($ac_cv_opt_olimit_ok)
+-if test $ac_cv_opt_olimit_ok = yes; then
+-    case $ac_sys_system in
+-	# XXX is this branch needed? On MacOSX 10.2.2 the result of the
+-	# olimit_ok test is "no".  Is it "yes" in some other Darwin-esque
+-	# environment?
+-        Darwin*)
+-	    ;;
+-        *)
+-	    BASECFLAGS="$BASECFLAGS -OPT:Olimit=0"
+-	    ;;
+-    esac
+-else
+-  AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
+-  AC_CACHE_VAL(ac_cv_olimit_ok,
+-  [ac_save_cc="$CC"
+-  CC="$CC -Olimit 1500"
+-  AC_COMPILE_IFELSE(
+-    [AC_LANG_PROGRAM([[]], [[]])],
+-    [ac_cv_olimit_ok=yes],
+-    [ac_cv_olimit_ok=no]
+-    )
+-  CC="$ac_save_cc"])
+-  AC_MSG_RESULT($ac_cv_olimit_ok)
+-  if test $ac_cv_olimit_ok = yes; then
+-    BASECFLAGS="$BASECFLAGS -Olimit 1500"
+-  fi
+-fi
+-
+-# Check whether GCC supports PyArg_ParseTuple format
+-if test "$GCC" = "yes"
+-then
+-  AC_MSG_CHECKING(whether gcc supports ParseTuple __format__)
+-  save_CFLAGS=$CFLAGS
+-  CFLAGS="$CFLAGS -Werror"
+-  AC_COMPILE_IFELSE([
+-    AC_LANG_PROGRAM([[void f(char*,...)__attribute((format(PyArg_ParseTuple, 1, 2)));]], [[]])
+-  ],[
+-    AC_DEFINE(HAVE_ATTRIBUTE_FORMAT_PARSETUPLE, 1,
+-      [Define if GCC supports __attribute__((format(PyArg_ParseTuple, 2, 3)))])
+-    AC_MSG_RESULT(yes)
+-  ],[
+-    AC_MSG_RESULT(no)
+-  ])
+-  CFLAGS=$save_CFLAGS
+-fi
+-
+-# On some compilers, pthreads are available without further options
+-# (e.g. MacOS X). On some of these systems, the compiler will not
+-# complain if unaccepted options are passed (e.g. gcc on Mac OS X).
+-# So we have to see first whether pthreads are available without
+-# options before we can check whether -Kpthread improves anything.
+-AC_MSG_CHECKING(whether pthreads are available without options)
+-AC_CACHE_VAL(ac_cv_pthread_is_default,
+-[AC_RUN_IFELSE([AC_LANG_SOURCE([[
+-#include <pthread.h>
+-
+-void* routine(void* p){return NULL;}
+-
+-int main(){
+-  pthread_t p;
+-  if(pthread_create(&p,NULL,routine,NULL)!=0)
+-    return 1;
+-  (void)pthread_detach(p);
+-  return 0;
+-}
+-]])],[
+-  ac_cv_pthread_is_default=yes
+-  ac_cv_kthread=no
+-  ac_cv_pthread=no
+-],[ac_cv_pthread_is_default=no],[ac_cv_pthread_is_default=no])
+-])
+-AC_MSG_RESULT($ac_cv_pthread_is_default)
+-
+-
+-if test $ac_cv_pthread_is_default = yes 
+-then
+-  ac_cv_kpthread=no
+-else
+-# -Kpthread, if available, provides the right #defines
+-# and linker options to make pthread_create available
+-# Some compilers won't report that they do not support -Kpthread,
+-# so we need to run a program to see whether it really made the
+-# function available.
+-AC_MSG_CHECKING(whether $CC accepts -Kpthread)
+-AC_CACHE_VAL(ac_cv_kpthread,
+-[ac_save_cc="$CC"
+-CC="$CC -Kpthread"
+-AC_RUN_IFELSE([AC_LANG_SOURCE([[
+-#include <pthread.h>
+-
+-void* routine(void* p){return NULL;}
+-
+-int main(){
+-  pthread_t p;
+-  if(pthread_create(&p,NULL,routine,NULL)!=0)
+-    return 1;
+-  (void)pthread_detach(p);
+-  return 0;
+-}
+-]])],[ac_cv_kpthread=yes],[ac_cv_kpthread=no],[ac_cv_kpthread=no])
+-CC="$ac_save_cc"])
+-AC_MSG_RESULT($ac_cv_kpthread)
+-fi
+-
+-if test $ac_cv_kpthread = no -a $ac_cv_pthread_is_default = no
+-then
+-# -Kthread, if available, provides the right #defines
+-# and linker options to make pthread_create available
+-# Some compilers won't report that they do not support -Kthread,
+-# so we need to run a program to see whether it really made the
+-# function available.
+-AC_MSG_CHECKING(whether $CC accepts -Kthread)
+-AC_CACHE_VAL(ac_cv_kthread,
+-[ac_save_cc="$CC"
+-CC="$CC -Kthread"
+-AC_RUN_IFELSE([AC_LANG_SOURCE([[
+-#include <pthread.h>
+-
+-void* routine(void* p){return NULL;}
+-
+-int main(){
+-  pthread_t p;
+-  if(pthread_create(&p,NULL,routine,NULL)!=0)
+-    return 1;
+-  (void)pthread_detach(p);
+-  return 0;
+-}
+-]])],[ac_cv_kthread=yes],[ac_cv_kthread=no],[ac_cv_kthread=no])
+-CC="$ac_save_cc"])
+-AC_MSG_RESULT($ac_cv_kthread)
+-fi
+-
+-if test $ac_cv_kthread = no -a $ac_cv_pthread_is_default = no
+-then
+-# -pthread, if available, provides the right #defines
+-# and linker options to make pthread_create available
+-# Some compilers won't report that they do not support -pthread,
+-# so we need to run a program to see whether it really made the
+-# function available.
+-AC_MSG_CHECKING(whether $CC accepts -pthread)
+-AC_CACHE_VAL(ac_cv_thread,
+-[ac_save_cc="$CC"
+-CC="$CC -pthread"
+-AC_RUN_IFELSE([AC_LANG_SOURCE([[
+-#include <pthread.h>
+-
+-void* routine(void* p){return NULL;}
+-
+-int main(){
+-  pthread_t p;
+-  if(pthread_create(&p,NULL,routine,NULL)!=0)
+-    return 1;
+-  (void)pthread_detach(p);
+-  return 0;
+-}
+-]])],[ac_cv_pthread=yes],[ac_cv_pthread=no],[ac_cv_pthread=no])
+-CC="$ac_save_cc"])
+-AC_MSG_RESULT($ac_cv_pthread)
+-fi
+-
+-# If we have set a CC compiler flag for thread support then
+-# check if it works for CXX, too.
+-ac_cv_cxx_thread=no
+-if test ! -z "$CXX"
+-then
+-AC_MSG_CHECKING(whether $CXX also accepts flags for thread support)
+-ac_save_cxx="$CXX"
+-
+-if test "$ac_cv_kpthread" = "yes"
+-then
+-  CXX="$CXX -Kpthread"  
+-  ac_cv_cxx_thread=yes
+-elif test "$ac_cv_kthread" = "yes"
+-then
+-  CXX="$CXX -Kthread"
+-  ac_cv_cxx_thread=yes
+-elif test "$ac_cv_pthread" = "yes"
+-then 
+-  CXX="$CXX -pthread"
+-  ac_cv_cxx_thread=yes
+-fi
+-
+-if test $ac_cv_cxx_thread = yes
+-then
+-  echo 'void foo();int main(){foo();}void foo(){}' > conftest.$ac_ext
+-  $CXX -c conftest.$ac_ext 2>&5
+-  if $CXX -o conftest$ac_exeext conftest.$ac_objext 2>&5 \
+-     && test -s conftest$ac_exeext && ./conftest$ac_exeext
+-  then
+-    ac_cv_cxx_thread=yes
+-  else
+-    ac_cv_cxx_thread=no
+-  fi
+-  rm -fr conftest*
+-fi
+-AC_MSG_RESULT($ac_cv_cxx_thread)
+-fi
+-CXX="$ac_save_cxx"
+-
+-dnl # check for ANSI or K&R ("traditional") preprocessor
+-dnl AC_MSG_CHECKING(for C preprocessor type)
+-dnl AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+-dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
+-dnl int foo;
+-dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
+-dnl ]], [[;]])],[cpp_type=ansi],[AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional])
+-dnl AC_MSG_RESULT($cpp_type)
+-
+-# checks for header files
+-AC_HEADER_STDC
+-AC_CHECK_HEADERS(asm/types.h conio.h curses.h direct.h dlfcn.h errno.h \
+-fcntl.h grp.h \
+-ieeefp.h io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \
+-shadow.h signal.h stdint.h stropts.h termios.h thread.h \
+-unistd.h utime.h \
+-sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \
+-sys/lock.h sys/mkdev.h sys/modem.h \
+-sys/param.h sys/poll.h sys/select.h sys/socket.h sys/statvfs.h sys/stat.h \
+-sys/termio.h sys/time.h \
+-sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
+-sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
+-bluetooth/bluetooth.h linux/tipc.h spawn.h util.h)
+-AC_HEADER_DIRENT
+-AC_HEADER_MAJOR
+-
+-# On Solaris, term.h requires curses.h
+-AC_CHECK_HEADERS(term.h,,,[
+-#ifdef HAVE_CURSES_H
+-#include <curses.h>
+-#endif
+-])
+-
+-# On Linux, netlink.h requires asm/types.h
+-AC_CHECK_HEADERS(linux/netlink.h,,,[
+-#ifdef HAVE_ASM_TYPES_H
+-#include <asm/types.h>
+-#endif
+-#ifdef HAVE_SYS_SOCKET_H
+-#include <sys/socket.h>
+-#endif
+-])
+-
+-# checks for typedefs
+-was_it_defined=no
+-AC_MSG_CHECKING(for clock_t in time.h)
+-AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, [
+-    AC_DEFINE(clock_t, long, [Define to 'long' if <time.h> doesn't define.])
+-])
+-AC_MSG_RESULT($was_it_defined)
+-
+-# Check whether using makedev requires defining _OSF_SOURCE
+-AC_MSG_CHECKING(for makedev)
+-AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+-#if defined(MAJOR_IN_MKDEV)
+-#include <sys/mkdev.h>
+-#elif defined(MAJOR_IN_SYSMACROS)
+-#include <sys/sysmacros.h>
+-#else
+-#include <sys/types.h>
+-#endif ]], [[ makedev(0, 0) ]])],
+-[ac_cv_has_makedev=yes],
+-[ac_cv_has_makedev=no])
+-if test "$ac_cv_has_makedev" = "no"; then
+-    # we didn't link, try if _OSF_SOURCE will allow us to link
+-    AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+-#define _OSF_SOURCE 1
+-#include <sys/types.h>
+-    ]], [[ makedev(0, 0) ]])],
+-[ac_cv_has_makedev=yes],
+-[ac_cv_has_makedev=no])
+-    if test "$ac_cv_has_makedev" = "yes"; then
+-        AC_DEFINE(_OSF_SOURCE, 1, [Define _OSF_SOURCE to get the makedev macro.])
+-    fi
+-fi
+-AC_MSG_RESULT($ac_cv_has_makedev)
+-if test "$ac_cv_has_makedev" = "yes"; then
+-    AC_DEFINE(HAVE_MAKEDEV, 1, [Define this if you have the makedev macro.])
+-fi
+-
+-# Enabling LFS on Solaris (2.6 to 9) with gcc 2.95 triggers a bug in
+-# the system headers: If _XOPEN_SOURCE and _LARGEFILE_SOURCE are
+-# defined, but the compiler does not support pragma redefine_extname,
+-# and _LARGEFILE64_SOURCE is not defined, the headers refer to 64-bit
+-# structures (such as rlimit64) without declaring them. As a
+-# work-around, disable LFS on such configurations
+-
+-use_lfs=yes
+-AC_MSG_CHECKING(Solaris LFS bug)
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+-#define _LARGEFILE_SOURCE 1
+-#define _FILE_OFFSET_BITS 64
+-#include <sys/resource.h>
+-]], [[struct rlimit foo;]])],[sol_lfs_bug=no],[sol_lfs_bug=yes])
+-AC_MSG_RESULT($sol_lfs_bug)
+-if test "$sol_lfs_bug" = "yes"; then
+-  use_lfs=no
+-fi
+-
+-if test "$use_lfs" = "yes"; then
+-# Two defines needed to enable largefile support on various platforms
+-# These may affect some typedefs
+-case $ac_sys_system/$ac_sys_release in
+-AIX*)
+-    AC_DEFINE(_LARGE_FILES, 1, 
+-    [This must be defined on AIX systems to enable large file support.])
+-    ;;
+-esac
+-AC_DEFINE(_LARGEFILE_SOURCE, 1, 
+-[This must be defined on some systems to enable large file support.])
+-AC_DEFINE(_FILE_OFFSET_BITS, 64,
+-[This must be set to 64 on some systems to enable large file support.])
+-fi
+-
+-# Add some code to confdefs.h so that the test for off_t works on SCO
+-cat >> confdefs.h <<\EOF
+-#if defined(SCO_DS)
+-#undef _OFF_T
+-#endif
+-EOF
+-
+-# Type availability checks
+-AC_TYPE_MODE_T
+-AC_TYPE_OFF_T
+-AC_TYPE_PID_T
+-AC_DEFINE_UNQUOTED([RETSIGTYPE],[void],[assume C89 semantics that RETSIGTYPE is always void])
+-AC_TYPE_SIZE_T
+-AC_TYPE_UID_T
+-AC_TYPE_UINT32_T
+-AC_TYPE_UINT64_T
+-AC_TYPE_INT32_T
+-AC_TYPE_INT64_T
+-AC_CHECK_TYPE(ssize_t,
+-  AC_DEFINE(HAVE_SSIZE_T, 1, [Define if your compiler provides ssize_t]),,)
+-
+-# Sizes of various common basic types
+-# ANSI C requires sizeof(char) == 1, so no need to check it
+-AC_CHECK_SIZEOF(int, 4)
+-AC_CHECK_SIZEOF(long, 4)
+-AC_CHECK_SIZEOF(void *, 4)
+-AC_CHECK_SIZEOF(short, 2)
+-AC_CHECK_SIZEOF(float, 4)
+-AC_CHECK_SIZEOF(double, 8)
+-AC_CHECK_SIZEOF(fpos_t, 4)
+-AC_CHECK_SIZEOF(size_t, 4)
+-AC_CHECK_SIZEOF(pid_t, 4)
+-
+-AC_MSG_CHECKING(for long long support)
+-have_long_long=no
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[long long x; x = (long long)0;]])],[
+-  AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.]) 
+-  have_long_long=yes
+-],[])
+-AC_MSG_RESULT($have_long_long)
+-if test "$have_long_long" = yes ; then
+-AC_CHECK_SIZEOF(long long, 8)
+-fi
+-
+-AC_MSG_CHECKING(for long double support)
+-have_long_double=no
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[long double x; x = (long double)0;]])],[
+-  AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define this if you have the type long double.])
+-  have_long_double=yes
+-],[])
+-AC_MSG_RESULT($have_long_double)
+-if test "$have_long_double" = yes ; then
+-AC_CHECK_SIZEOF(long double, 12)
+-fi
+-
+-AC_MSG_CHECKING(for _Bool support)
+-have_c99_bool=no
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[_Bool x; x = (_Bool)0;]])],[
+-  AC_DEFINE(HAVE_C99_BOOL, 1, [Define this if you have the type _Bool.]) 
+-  have_c99_bool=yes
+-],[])
+-AC_MSG_RESULT($have_c99_bool)
+-if test "$have_c99_bool" = yes ; then
+-AC_CHECK_SIZEOF(_Bool, 1)
+-fi
+-
+-AC_CHECK_TYPES(uintptr_t, 
+-   [AC_CHECK_SIZEOF(uintptr_t, 4)], 
+-   [], [#ifdef HAVE_STDINT_H
+-        #include <stdint.h>
+-        #endif
+-        #ifdef HAVE_INTTYPES_H
+-        #include <inttypes.h>
+-        #endif])
+-
+-AC_CHECK_SIZEOF(off_t, [], [
+-#ifdef HAVE_SYS_TYPES_H
+-#include <sys/types.h>
+-#endif
+-])
+-
+-AC_MSG_CHECKING(whether to enable large file support)
+-if test "$have_long_long" = yes
+-then
+-if test "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
+-	"$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
+-  AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1, 
+-  [Defined to enable large file support when an off_t is bigger than a long
+-   and long long is available and at least as big as an off_t. You may need
+-   to add some flags for configuration and compilation to enable this mode.
+-   (For Solaris and Linux, the necessary defines are already defined.)])
+-  AC_MSG_RESULT(yes)
+-else
+-  AC_MSG_RESULT(no)
+-fi
+-else
+-  AC_MSG_RESULT(no)
+-fi
+-
+-AC_CHECK_SIZEOF(time_t, [], [
+-#ifdef HAVE_SYS_TYPES_H
+-#include <sys/types.h>
+-#endif
+-#ifdef HAVE_TIME_H
+-#include <time.h>
+-#endif
+-])
+-
+-# if have pthread_t then define SIZEOF_PTHREAD_T
+-ac_save_cc="$CC"
+-if test "$ac_cv_kpthread" = "yes"
+-then CC="$CC -Kpthread"
+-elif test "$ac_cv_kthread" = "yes"
+-then CC="$CC -Kthread"
+-elif test "$ac_cv_pthread" = "yes"
+-then CC="$CC -pthread"
+-fi
+-AC_MSG_CHECKING(for pthread_t)
+-have_pthread_t=no
+-AC_COMPILE_IFELSE([
+-  AC_LANG_PROGRAM([[#include <pthread.h>]], [[pthread_t x; x = *(pthread_t*)0;]])
+-],[have_pthread_t=yes],[])
+-AC_MSG_RESULT($have_pthread_t)
+-if test "$have_pthread_t" = yes ; then
+-  AC_CHECK_SIZEOF(pthread_t, [], [
+-#ifdef HAVE_PTHREAD_H
+-#include <pthread.h>
+-#endif
+-  ])
+-fi
+-CC="$ac_save_cc"
+-
+-AC_MSG_CHECKING(for --enable-toolbox-glue)
+-AC_ARG_ENABLE(toolbox-glue,
+-              AS_HELP_STRING([--enable-toolbox-glue], [disable/enable MacOSX glue code for extensions]))
+-
+-if test -z "$enable_toolbox_glue"
+-then 
+-	case $ac_sys_system/$ac_sys_release in
+-	Darwin/*)
+-		enable_toolbox_glue="yes";;
+-	*)
+-		enable_toolbox_glue="no";;
+-	esac
+-fi
+-case "$enable_toolbox_glue" in
+-yes)
+-	extra_machdep_objs="Python/mactoolboxglue.o"
+-	extra_undefs="-u _PyMac_Error"
+-	AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE, 1,
+-         [Define if you want to use MacPython modules on MacOSX in unix-Python.])
+-	;;
+-*)
+-	extra_machdep_objs=""
+-	extra_undefs=""
+-	;;
+-esac
+-AC_MSG_RESULT($enable_toolbox_glue)
+-
+-
+-AC_SUBST(OTHER_LIBTOOL_OPT)
+-case $ac_sys_system/$ac_sys_release in
+-  Darwin/@<:@01567@:>@\..*) 
+-    OTHER_LIBTOOL_OPT="-prebind -seg1addr 0x10000000"
+-    ;;
+-  Darwin/*)
+-    OTHER_LIBTOOL_OPT=""
+-    ;;
+-esac
+-
+-
+-ARCH_RUN_32BIT=""
+-AC_SUBST(LIBTOOL_CRUFT)
+-case $ac_sys_system/$ac_sys_release in
+-  Darwin/@<:@01567@:>@\..*) 
+-    LIBTOOL_CRUFT="-framework System -lcc_dynamic"
+-    if test "${enable_universalsdk}"; then
+-	    :
+-    else
+-        LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `/usr/bin/arch`"
+-    fi
+-    LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
+-    LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
+-  Darwin/*)
+-    gcc_version=`gcc -dumpversion`
+-    if test ${gcc_version} '<' 4.0
+-        then
+-            LIBTOOL_CRUFT="-lcc_dynamic"
+-        else 
+-            LIBTOOL_CRUFT=""
+-    fi
+-    AC_RUN_IFELSE([AC_LANG_SOURCE([[
+-    #include <unistd.h>
+-    int main(int argc, char*argv[])
+-    {
+-      if (sizeof(long) == 4) {
+-    	  return 0;
+-      } else {
+-      	  return 1;
+-      }
+-    }
+-    ]])],[ac_osx_32bit=yes],[ac_osx_32bit=no],[ac_osx_32bit=yes])
+-    
+-    if test "${ac_osx_32bit}" = "yes"; then
+-    	case `/usr/bin/arch` in
+-    	i386) 
+-    		MACOSX_DEFAULT_ARCH="i386" 
+-    		;;
+-    	ppc) 
+-    		MACOSX_DEFAULT_ARCH="ppc" 
+-    		;;
+-    	*)
+-    		AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
+-    		;;
+-    	esac
+-    else
+-    	case `/usr/bin/arch` in
+-    	i386) 
+-    		MACOSX_DEFAULT_ARCH="x86_64" 
+-    		;;
+-    	ppc) 
+-    		MACOSX_DEFAULT_ARCH="ppc64" 
+-    		;;
+-    	*)
+-    		AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
+-    		;;
+-    	esac
+-
+-	#ARCH_RUN_32BIT="true"
+-    fi
+-
+-    LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only ${MACOSX_DEFAULT_ARCH}"
+-    LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
+-    LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
+-esac
+-
+-AC_MSG_CHECKING(for --enable-framework)
+-if test "$enable_framework"
+-then
+-	BASECFLAGS="$BASECFLAGS -fno-common -dynamic"
+-	# -F. is needed to allow linking to the framework while 
+-	# in the build location.
+-	AC_DEFINE(WITH_NEXT_FRAMEWORK, 1, 
+-         [Define if you want to produce an OpenStep/Rhapsody framework
+-         (shared library plus accessory files).])
+-	AC_MSG_RESULT(yes)
+-	if test $enable_shared = "yes"
+-	then
+-		AC_MSG_ERROR([Specifying both --enable-shared and --enable-framework is not supported, use only --enable-framework instead. See Mac/README.])
+-	fi
+-else
+-	AC_MSG_RESULT(no)
+-fi
+-
+-AC_MSG_CHECKING(for dyld)
+-case $ac_sys_system/$ac_sys_release in
+-  Darwin/*)
+-  	AC_DEFINE(WITH_DYLD, 1, 
+-        [Define if you want to use the new-style (Openstep, Rhapsody, MacOS)
+-         dynamic linker (dyld) instead of the old-style (NextStep) dynamic
+-         linker (rld). Dyld is necessary to support frameworks.])
+-  	AC_MSG_RESULT(always on for Darwin)
+-  	;;
+-  *)
+-	AC_MSG_RESULT(no)
+-	;;
+-esac
+-
+-# Set info about shared libraries.
+-AC_SUBST(SO)
+-AC_SUBST(LDSHARED)
+-AC_SUBST(LDCXXSHARED)
+-AC_SUBST(BLDSHARED)
+-AC_SUBST(CCSHARED)
+-AC_SUBST(LINKFORSHARED)
+-# SO is the extension of shared libraries `(including the dot!)
+-# -- usually .so, .sl on HP-UX, .dll on Cygwin
+-AC_MSG_CHECKING(SO)
+-if test -z "$SO"
+-then
+-	case $ac_sys_system in
+-	hp*|HP*)
+-		case `uname -m` in
+-			ia64) SO=.so;;
+-	  		*)    SO=.sl;;
+-		esac
+-		;;
+-	CYGWIN*)   SO=.dll;;
+-	*)	   SO=.so;;
+-	esac
+-else
+-	# this might also be a termcap variable, see #610332
+-        echo
+-        echo '====================================================================='
+-        echo '+                                                                   +'
+-	echo '+ WARNING: You have set SO in your environment.                     +'
+-        echo '+ Do you really mean to change the extension for shared libraries?  +'
+-        echo '+ Continuing in 10 seconds to let you to ponder.                    +'
+-        echo '+                                                                   +'
+-        echo '====================================================================='
+-	sleep 10
+-fi
+-AC_MSG_RESULT($SO)
+-
+-AC_DEFINE_UNQUOTED(SHLIB_EXT, "$SO", [Define this to be extension of shared libraries (including the dot!).])
+-# LDSHARED is the ld *command* used to create shared library
+-# -- "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5
+-# (Shared libraries in this instance are shared modules to be loaded into
+-# Python, as opposed to building Python itself as a shared library.)
+-AC_MSG_CHECKING(LDSHARED)
+-if test -z "$LDSHARED"
+-then
+-	case $ac_sys_system/$ac_sys_release in
+-	AIX*)
+-		BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:\$(srcdir)/Modules/python.exp"
+-		LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
+-		;;
+-	BeOS*)
+-		BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
+-		LDSHARED="\$(BINLIBDEST)/config/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
+-		;;
+-	IRIX/5*) LDSHARED="ld -shared";;
+-	IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
+-	SunOS/5*) 
+-		if test "$GCC" = "yes" ; then
+-			LDSHARED='$(CC) -shared'
+-			LDCXXSHARED='$(CXX) -shared'
+-		else
+-			LDSHARED='$(CC) -G'
+-			LDCXXSHARED='$(CXX) -G'
+-		fi ;;
+-	hp*|HP*)
+-		if test "$GCC" = "yes" ; then
+-			LDSHARED='$(CC) -shared'
+-			LDCXXSHARED='$(CXX) -shared'
+-		else
+-			LDSHARED='ld -b'
+-		fi ;;
+-	OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
+-	Darwin/1.3*)
+-		LDSHARED='$(CC) -bundle'
+-		LDCXXSHARED='$(CXX) -bundle'
+-		if test "$enable_framework" ; then
+-			# Link against the framework. All externals should be defined.
+-			BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
+-			LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
+-			LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
+-		else
+-			# No framework. Ignore undefined symbols, assuming they come from Python
+-			LDSHARED="$LDSHARED -undefined suppress"
+-			LDCXXSHARED="$LDCXXSHARED -undefined suppress"
+-		fi ;;
+-	Darwin/1.4*|Darwin/5.*|Darwin/6.*)
+-		LDSHARED='$(CC) -bundle'
+-		LDCXXSHARED='$(CXX) -bundle'
+-		if test "$enable_framework" ; then
+-			# Link against the framework. All externals should be defined.
+-			BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
+-			LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
+-			LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
+-		else
+-			# No framework, use the Python app as bundle-loader
+-			BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
+-			LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
+-			LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
+-		fi ;;
+-	Darwin/*)
+-		# Use -undefined dynamic_lookup whenever possible (10.3 and later).
+-		# This allows an extension to be used in any Python
+-
+-		if test ${MACOSX_DEPLOYMENT_TARGET} '>' 10.2
+-		then
+-			if test "${enable_universalsdk}"; then
+-				LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
+-			fi
+-			LDSHARED='$(CC) -bundle -undefined dynamic_lookup'
+-			LDCXXSHARED='$(CXX) -bundle -undefined dynamic_lookup'
+-			BLDSHARED="$LDSHARED"
+-		else
+-			LDSHARED='$(CC) -bundle'
+-			LDCXXSHARED='$(CXX) -bundle'
+-			if test "$enable_framework" ; then
+-				# Link against the framework. All externals should be defined.
+-				BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
+-				LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
+-				LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
+-			else
+-				# No framework, use the Python app as bundle-loader
+-				BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
+-				LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
+-				LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
+-			fi
+-		fi
+-		;;
+-	Linux*|GNU*|QNX*)
+-		LDSHARED='$(CC) -shared'
+-		LDCXXSHARED='$(CXX) -shared';;
+-	BSD/OS*/4*)
+-		LDSHARED="gcc -shared"
+-		LDCXXSHARED="g++ -shared";;
+-	FreeBSD*)
+-		if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
+-		then
+-			LDSHARED='$(CC) -shared'
+-			LDCXXSHARED='$(CXX) -shared'
+-		else
+-			LDSHARED="ld -Bshareable"
+-		fi;;
+-	OpenBSD*)
+-		if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
+-		then
+-				LDSHARED='$(CC) -shared $(CCSHARED)'
+-				LDCXXSHARED='$(CXX) -shared $(CCSHARED)'
+-		else
+-				case `uname -r` in
+-				[[01]].* | 2.[[0-7]] | 2.[[0-7]].*)
+-				   LDSHARED="ld -Bshareable ${LDFLAGS}"
+-				   ;;
+-				*)
+-				   LDSHARED='$(CC) -shared $(CCSHARED)'
+-				   LDCXXSHARED='$(CXX) -shared $(CCSHARED)'
+-				   ;;
+-				esac
+-		fi;;
+-	NetBSD*|DragonFly*)
+-		LDSHARED='$(CC) -shared'
+-		LDCXXSHARED='$(CXX) -shared';;
+-	OpenUNIX*|UnixWare*)
+-		if test "$GCC" = "yes" ; then
+-			LDSHARED='$(CC) -shared'
+-			LDCXXSHARED='$(CXX) -shared'
+-		else
+-			LDSHARED='$(CC) -G'
+-			LDCXXSHARED='$(CXX) -G'
+-		fi;;
+-	SCO_SV*)
+-		LDSHARED='$(CC) -Wl,-G,-Bexport'
+-		LDCXXSHARED='$(CXX) -Wl,-G,-Bexport';;
+-	CYGWIN*)
+-		LDSHARED="gcc -shared -Wl,--enable-auto-image-base"
+-		LDCXXSHARED="g++ -shared -Wl,--enable-auto-image-base";;
+-	atheos*)
+-		LDSHARED="gcc -shared"
+-		LDCXXSHARED="g++ -shared";;
+-	*)	LDSHARED="ld";;
+-	esac
+-fi
+-AC_MSG_RESULT($LDSHARED)
+-LDCXXSHARED=${LDCXXSHARED-$LDSHARED}
+-BLDSHARED=${BLDSHARED-$LDSHARED}
+-# CCSHARED are the C *flags* used to create objects to go into a shared
+-# library (module) -- this is only needed for a few systems
+-AC_MSG_CHECKING(CCSHARED)
+-if test -z "$CCSHARED"
+-then
+-	case $ac_sys_system/$ac_sys_release in
+-	SunOS*) if test "$GCC" = yes;
+-		then CCSHARED="-fPIC";
+-		elif test `uname -p` = sparc;
+-		then CCSHARED="-xcode=pic32";
+-		else CCSHARED="-Kpic";
+-		fi;;
+-	hp*|HP*) if test "$GCC" = yes;
+-		 then CCSHARED="-fPIC";
+-		 else CCSHARED="+z";
+-		 fi;;
+-	Linux*|GNU*) CCSHARED="-fPIC";;
+-	BSD/OS*/4*) CCSHARED="-fpic";;
+-	FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";;
+-	OpenUNIX*|UnixWare*)
+-		if test "$GCC" = "yes"
+-		then CCSHARED="-fPIC"
+-		else CCSHARED="-KPIC"
+-		fi;;
+-	SCO_SV*)
+-		if test "$GCC" = "yes"
+-		then CCSHARED="-fPIC"
+-		else CCSHARED="-Kpic -belf"
+-		fi;;
+-	IRIX*/6*)  case $CC in
+-		   *gcc*) CCSHARED="-shared";;
+-		   *) CCSHARED="";;
+-		   esac;;
+-	atheos*) CCSHARED="-fPIC";;
+-	esac
+-fi
+-AC_MSG_RESULT($CCSHARED)
+-# LINKFORSHARED are the flags passed to the $(CC) command that links
+-# the python executable -- this is only needed for a few systems
+-AC_MSG_CHECKING(LINKFORSHARED)
+-if test -z "$LINKFORSHARED"
+-then
+-	case $ac_sys_system/$ac_sys_release in
+-	AIX*)	LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
+-	hp*|HP*)
+-	    LINKFORSHARED="-Wl,-E -Wl,+s";;
+-#	    LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
+-	BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
+-	Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
+-	# -u libsys_s pulls in all symbols in libsys
+-	Darwin/*) 
+-		# -u _PyMac_Error is needed to pull in the mac toolbox glue,
+-		# which is
+-		# not used by the core itself but which needs to be in the core so
+-		# that dynamically loaded extension modules have access to it.
+-		# -prebind is no longer used, because it actually seems to give a
+-		# slowdown in stead of a speedup, maybe due to the large number of
+-		# dynamic loads Python does.
+-
+-		LINKFORSHARED="$extra_undefs"
+-		if test "$enable_framework"
+-		then
+-			LINKFORSHARED="$LINKFORSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
+-		fi
+-		LINKFORSHARED="$LINKFORSHARED";;
+-	OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
+-	SCO_SV*) LINKFORSHARED="-Wl,-Bexport";;
+-	ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
+-	FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) 
+-		if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
+-		then
+-			LINKFORSHARED="-Wl,--export-dynamic"
+-		fi;;
+-	SunOS/5*) case $CC in
+-		  *gcc*)
+-		    if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
+-		    then
+-			LINKFORSHARED="-Xlinker --export-dynamic"
+-		    fi;;
+-		  esac;;
+-	CYGWIN*)
+-		if test $enable_shared = "no"
+-		then
+-			LINKFORSHARED='-Wl,--out-implib=$(LDLIBRARY)'
+-		fi;;
+-	QNX*)
+-		# -Wl,-E causes the symbols to be added to the dynamic
+-		# symbol table so that they can be found when a module
+-		# is loaded.  -N 2048K causes the stack size to be set
+-		# to 2048 kilobytes so that the stack doesn't overflow
+-		# when running test_compile.py.
+-		LINKFORSHARED='-Wl,-E -N 2048K';;
+-	esac
+-fi
+-AC_MSG_RESULT($LINKFORSHARED)
+-
+-
+-AC_SUBST(CFLAGSFORSHARED)
+-AC_MSG_CHECKING(CFLAGSFORSHARED)
+-if test ! "$LIBRARY" = "$LDLIBRARY"
+-then
+-	case $ac_sys_system in
+-	CYGWIN*)
+-		# Cygwin needs CCSHARED when building extension DLLs
+-		# but not when building the interpreter DLL.
+-		CFLAGSFORSHARED='';;
+-	*)
+-		CFLAGSFORSHARED='$(CCSHARED)'
+-	esac
+-fi
+-AC_MSG_RESULT($CFLAGSFORSHARED)
+-
+-# SHLIBS are libraries (except -lc and -lm) to link to the python shared
+-# library (with --enable-shared).
+-# For platforms on which shared libraries are not allowed to have unresolved
+-# symbols, this must be set to $(LIBS) (expanded by make). We do this even
+-# if it is not required, since it creates a dependency of the shared library
+-# to LIBS. This, in turn, means that applications linking the shared libpython
+-# don't need to link LIBS explicitly. The default should be only changed
+-# on systems where this approach causes problems.
+-AC_SUBST(SHLIBS)
+-AC_MSG_CHECKING(SHLIBS)
+-case "$ac_sys_system" in
+-	*)
+-		SHLIBS='$(LIBS)';;
+-esac
+-AC_MSG_RESULT($SHLIBS)
+-
+-
+-# checks for libraries
+-AC_CHECK_LIB(dl, dlopen)	# Dynamic linking for SunOS/Solaris and SYSV
+-AC_CHECK_LIB(dld, shl_load)	# Dynamic linking for HP-UX
+-
+-# only check for sem_init if thread support is requested
+-if test "$with_threads" = "yes" -o -z "$with_threads"; then
+-    AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris
+-						# posix4 on Solaris 2.6
+-						# pthread (first!) on Linux
+-fi
+-
+-# check if we need libintl for locale functions
+-AC_CHECK_LIB(intl, textdomain,
+-	AC_DEFINE(WITH_LIBINTL, 1,
+-	[Define to 1 if libintl is needed for locale functions.]))
+-
+-# checks for system dependent C++ extensions support
+-case "$ac_sys_system" in
+-	AIX*)	AC_MSG_CHECKING(for genuine AIX C++ extensions support)
+-		AC_LINK_IFELSE([
+-		  AC_LANG_PROGRAM([[#include <load.h>]],
+-				  [[loadAndInit("", 0, "")]])
+-		],[
+-		  AC_DEFINE(AIX_GENUINE_CPLUSPLUS, 1,
+-                      [Define for AIX if your compiler is a genuine IBM xlC/xlC_r
+-                       and you want support for AIX C++ shared extension modules.])
+-		  AC_MSG_RESULT(yes)
+-		],[
+-		  AC_MSG_RESULT(no)
+-		]);;
+-	*) ;;
+-esac
+-
+-# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
+-# BeOS' sockets are stashed in libnet.
+-AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
+-AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
+-
+-case "$ac_sys_system" in
+-BeOS*)
+-AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
+-;;
+-esac
+-
+-AC_MSG_CHECKING(for --with-libs)
+-AC_ARG_WITH(libs,
+-            AS_HELP_STRING([--with-libs='lib1 ...'], [link against additional libs]),
+-[
+-AC_MSG_RESULT($withval)
+-LIBS="$withval $LIBS"
+-],
+-[AC_MSG_RESULT(no)])
+-
+-AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
+-
+-# Check for use of the system expat library
+-AC_MSG_CHECKING(for --with-system-expat)
+-AC_ARG_WITH(system_expat,
+-            AS_HELP_STRING([--with-system-expat], [build pyexpat module using an installed expat library]),
+-            [],
+-            [with_system_expat="no"])
+-
+-AC_MSG_RESULT($with_system_expat)
+-
+-# Check for use of the system libffi library
+-AC_MSG_CHECKING(for --with-system-ffi)
+-AC_ARG_WITH(system_ffi,
+-            AS_HELP_STRING([--with-system-ffi], [build _ctypes module using an installed ffi library]),
+-            [],
+-            [with_system_ffi="no"])
+-
+-if test "$with_system_ffi" = "yes" && test -n "$PKG_CONFIG"; then
+-    LIBFFI_INCLUDEDIR="`"$PKG_CONFIG" libffi --cflags-only-I 2>/dev/null | sed -e 's/^-I//;s/ *$//'`"
+-else
+-    LIBFFI_INCLUDEDIR=""
+-fi
+-AC_SUBST(LIBFFI_INCLUDEDIR)
+-
+-AC_MSG_RESULT($with_system_ffi)
+-
+-# Check for --with-dbmliborder
+-AC_MSG_CHECKING(for --with-dbmliborder)
+-AC_ARG_WITH(dbmliborder,
+-            AS_HELP_STRING([--with-dbmliborder=db1:db2:...], [order to check db backends for dbm. Valid value is a colon separated string with the backend names `ndbm', `gdbm' and `bdb'.]),
+-[
+-if test x$with_dbmliborder = xyes
+-then
+-AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...])
+-else
+-  for db in `echo $with_dbmliborder | sed 's/:/ /g'`; do
+-    if test x$db != xndbm && test x$db != xgdbm && test x$db != xbdb
+-    then
+-      AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...])
+-    fi
+-  done
+-fi])
+-AC_MSG_RESULT($with_dbmliborder)
+-
+-# Determine if signalmodule should be used.
+-AC_SUBST(USE_SIGNAL_MODULE)
+-AC_SUBST(SIGNAL_OBJS)
+-AC_MSG_CHECKING(for --with-signal-module)
+-AC_ARG_WITH(signal-module,
+-            AS_HELP_STRING([--with-signal-module], [disable/enable signal module]))
+-
+-if test -z "$with_signal_module"
+-then with_signal_module="yes"
+-fi
+-AC_MSG_RESULT($with_signal_module)
+-
+-if test "${with_signal_module}" = "yes"; then
+-	USE_SIGNAL_MODULE=""
+-	SIGNAL_OBJS=""
+-else
+-	USE_SIGNAL_MODULE="#"
+-	SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
+-fi
+-
+-# This is used to generate Setup.config
+-AC_SUBST(USE_THREAD_MODULE)
+-USE_THREAD_MODULE=""
+-
+-AC_MSG_CHECKING(for --with-dec-threads)
+-AC_SUBST(LDLAST)
+-AC_ARG_WITH(dec-threads,
+-            AS_HELP_STRING([--with-dec-threads], [use DEC Alpha/OSF1 thread-safe libraries]),
+-[
+-AC_MSG_RESULT($withval)
+-LDLAST=-threads
+-if test "${with_thread+set}" != set; then
+-   with_thread="$withval";
+-fi],
+-[AC_MSG_RESULT(no)])
+-
+-# Templates for things AC_DEFINEd more than once.
+-# For a single AC_DEFINE, no template is needed.
+-AH_TEMPLATE(C_THREADS,[Define if you have the Mach cthreads package])
+-AH_TEMPLATE(_REENTRANT,
+-  [Define to force use of thread-safe errno, h_errno, and other functions])
+-AH_TEMPLATE(WITH_THREAD,
+-  [Define if you want to compile in rudimentary thread support])
+-
+-AC_MSG_CHECKING(for --with-threads)
+-dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
+-AC_ARG_WITH(threads,
+-            AS_HELP_STRING([--with(out)-threads@<:@=DIRECTORY@:>@], [disable/enable thread support]))
+-
+-# --with-thread is deprecated, but check for it anyway
+-dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
+-AC_ARG_WITH(thread,
+-            AS_HELP_STRING([--with(out)-thread@<:@=DIRECTORY@:>@], [deprecated; use --with(out)-threads]),
+-            [with_threads=$with_thread])
+-
+-if test -z "$with_threads"
+-then with_threads="yes"
+-fi
+-AC_MSG_RESULT($with_threads)
+-
+-AC_SUBST(THREADOBJ)
+-if test "$with_threads" = "no"
+-then
+-    USE_THREAD_MODULE="#"
+-elif test "$ac_cv_pthread_is_default" = yes
+-then
+-    AC_DEFINE(WITH_THREAD)
+-    # Defining _REENTRANT on system with POSIX threads should not hurt.
+-    AC_DEFINE(_REENTRANT)
+-    posix_threads=yes
+-    THREADOBJ="Python/thread.o"    
+-elif test "$ac_cv_kpthread" = "yes"
+-then
+-    CC="$CC -Kpthread"
+-    if test "$ac_cv_cxx_thread" = "yes"; then
+-        CXX="$CXX -Kpthread"
+-    fi
+-    AC_DEFINE(WITH_THREAD)
+-    posix_threads=yes
+-    THREADOBJ="Python/thread.o"
+-elif test "$ac_cv_kthread" = "yes"
+-then
+-    CC="$CC -Kthread"
+-    if test "$ac_cv_cxx_thread" = "yes"; then
+-        CXX="$CXX -Kthread"
+-    fi
+-    AC_DEFINE(WITH_THREAD)
+-    posix_threads=yes
+-    THREADOBJ="Python/thread.o"
+-elif test "$ac_cv_pthread" = "yes"
+-then
+-    CC="$CC -pthread"
+-    if test "$ac_cv_cxx_thread" = "yes"; then
+-        CXX="$CXX -pthread"
+-    fi
+-    AC_DEFINE(WITH_THREAD)
+-    posix_threads=yes
+-    THREADOBJ="Python/thread.o"
+-else
+-    if test ! -z "$with_threads" -a -d "$with_threads"
+-    then LDFLAGS="$LDFLAGS -L$with_threads"
+-    fi
+-    if test ! -z "$withval" -a -d "$withval"
+-    then LDFLAGS="$LDFLAGS -L$withval"
+-    fi
+-
+-    # According to the POSIX spec, a pthreads implementation must
+-    # define _POSIX_THREADS in unistd.h. Some apparently don't
+-    # (e.g. gnu pth with pthread emulation)
+-    AC_MSG_CHECKING(for _POSIX_THREADS in unistd.h)
+-    AC_EGREP_CPP(yes,
+-    [
+-#include <unistd.h>
+-#ifdef _POSIX_THREADS
+-yes
+-#endif
+-    ], unistd_defines_pthreads=yes, unistd_defines_pthreads=no)
+-    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, 1,
+-    [Define if you are using Mach cthreads directly under /include])
+-    LIBS="$LIBS -lthreads"
+-    THREADOBJ="Python/thread.o"],[
+-    AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
+-    AC_DEFINE(C_THREADS)
+-    AC_DEFINE(MACH_C_THREADS, 1,
+-    [Define if you are using Mach cthreads under mach /])
+-    THREADOBJ="Python/thread.o"],[
+-    AC_MSG_CHECKING(for --with-pth)
+-    AC_ARG_WITH([pth],
+-                AS_HELP_STRING([--with-pth], [use GNU pth threading libraries]),
+-                [AC_MSG_RESULT($withval)
+-                  AC_DEFINE([WITH_THREAD])
+-                  AC_DEFINE([HAVE_PTH], 1,
+-                            [Define if you have GNU PTH threads.])
+-                  LIBS="-lpth $LIBS"
+-                  THREADOBJ="Python/thread.o"],
+-	        [AC_MSG_RESULT(no)
+-
+-    # Just looking for pthread_create in libpthread is not enough:
+-    # on HP/UX, pthread.h renames pthread_create to a different symbol name.
+-    # So we really have to include pthread.h, and then link.
+-    _libs=$LIBS
+-    LIBS="$LIBS -lpthread"
+-    AC_MSG_CHECKING([for pthread_create in -lpthread])
+-    AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>
+-
+-void * start_routine (void *arg) { exit (0); }]], [[
+-pthread_create (NULL, NULL, start_routine, NULL)]])],[
+-    AC_MSG_RESULT(yes)
+-    AC_DEFINE(WITH_THREAD)
+-    posix_threads=yes
+-    THREADOBJ="Python/thread.o"],[
+-    LIBS=$_libs
+-    AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
+-    posix_threads=yes
+-    THREADOBJ="Python/thread.o"],[
+-    AC_CHECK_HEADER(atheos/threads.h, [AC_DEFINE(WITH_THREAD)
+-    AC_DEFINE(ATHEOS_THREADS, 1,
+-    [Define this if you have AtheOS threads.])
+-    THREADOBJ="Python/thread.o"],[
+-    AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
+-    AC_DEFINE(BEOS_THREADS, 1,
+-    [Define this if you have BeOS threads.])
+-    THREADOBJ="Python/thread.o"],[
+-    AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
+-    posix_threads=yes
+-    LIBS="$LIBS -lpthreads"
+-    THREADOBJ="Python/thread.o"], [
+-    AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
+-    posix_threads=yes
+-    LIBS="$LIBS -lc_r"
+-    THREADOBJ="Python/thread.o"], [
+-    AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
+-    posix_threads=yes
+-    LIBS="$LIBS -lpthread"
+-    THREADOBJ="Python/thread.o"], [
+-    AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
+-    posix_threads=yes
+-    LIBS="$LIBS -lcma"
+-    THREADOBJ="Python/thread.o"],[
+-    USE_THREAD_MODULE="#"])
+-    ])])])])])])])])])])
+-
+-    AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
+-    LIBS="$LIBS -lmpc"
+-    THREADOBJ="Python/thread.o"
+-    USE_THREAD_MODULE=""])
+-
+-    if test "$posix_threads" != "yes"; then     
+-      AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
+-      LIBS="$LIBS -lthread"
+-      THREADOBJ="Python/thread.o"
+-      USE_THREAD_MODULE=""])
+-    fi
+-
+-    if test "$USE_THREAD_MODULE" != "#"
+-    then
+-        # If the above checks didn't disable threads, (at least) OSF1
+-        # needs this '-threads' argument during linking.
+-        case $ac_sys_system in
+-        OSF1) LDLAST=-threads;;
+-        esac
+-    fi
+-fi
+-
+-if test "$posix_threads" = "yes"; then
+-      if test "$unistd_defines_pthreads" = "no"; then
+-         AC_DEFINE(_POSIX_THREADS, 1,
+-         [Define if you have POSIX threads, 
+-          and your system does not define that.])
+-      fi
+-
+-      # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8.
+-      case  $ac_sys_system/$ac_sys_release in
+-      SunOS/5.6) AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1,
+-                       [Defined for Solaris 2.6 bug in pthread header.])
+-		       ;;
+-      SunOS/5.8) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
+-		       [Define if the Posix semaphores do not work on your system])
+-		       ;;
+-      AIX/*) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
+-		       [Define if the Posix semaphores do not work on your system])
+-		       ;;
+-      esac
+-
+-      AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported)
+-      AC_CACHE_VAL(ac_cv_pthread_system_supported,
+-      [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <pthread.h>
+-      void *foo(void *parm) {
+-        return NULL;
+-      }
+-      main() {
+-        pthread_attr_t attr;
+-        pthread_t id;
+-        if (pthread_attr_init(&attr)) exit(-1);
+-        if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
+-        if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
+-        exit(0);
+-      }]])],
+-      [ac_cv_pthread_system_supported=yes],
+-      [ac_cv_pthread_system_supported=no],
+-      [ac_cv_pthread_system_supported=no])
+-      ])
+-      AC_MSG_RESULT($ac_cv_pthread_system_supported)
+-      if test "$ac_cv_pthread_system_supported" = "yes"; then
+-        AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED, 1, [Defined if PTHREAD_SCOPE_SYSTEM supported.])
+-      fi
+-      AC_CHECK_FUNCS(pthread_sigmask,
+-        [case $ac_sys_system in
+-        CYGWIN*)
+-          AC_DEFINE(HAVE_BROKEN_PTHREAD_SIGMASK, 1,
+-            [Define if pthread_sigmask() does not work on your system.])
+-            ;;
+-        esac])
+-fi
+-
+-
+-# Check for enable-ipv6
+-AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
+-AC_MSG_CHECKING([if --enable-ipv6 is specified])
+-AC_ARG_ENABLE(ipv6,
+-[  --enable-ipv6           Enable ipv6 (with ipv4) support
+-  --disable-ipv6          Disable ipv6 support],
+-[ case "$enableval" in
+-  no)
+-       AC_MSG_RESULT(no)
+-       ipv6=no
+-       ;;
+-  *)   AC_MSG_RESULT(yes)
+-       AC_DEFINE(ENABLE_IPV6)
+-       ipv6=yes
+-       ;;
+-  esac ],
+-
+-[
+-dnl the check does not work on cross compilation case...
+-  AC_RUN_IFELSE([AC_LANG_SOURCE([[ /* AF_INET6 available check */
+-#include <sys/types.h>
+-#include <sys/socket.h>
+-main()
+-{
+- if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
+-   exit(1);
+- else
+-   exit(0);
+-}
+-]])],[
+-  AC_MSG_RESULT(yes)
+-  ipv6=yes
+-],[
+-  AC_MSG_RESULT(no)
+-  ipv6=no
+-],[
+-  AC_MSG_RESULT(no)
+-  ipv6=no
+-])
+-
+-if test "$ipv6" = "yes"; then
+-	AC_MSG_CHECKING(if RFC2553 API is available)
+-	AC_COMPILE_IFELSE([
+-	  AC_LANG_PROGRAM([[#include <sys/types.h>
+-#include <netinet/in.h>]],
+-			  [[struct sockaddr_in6 x;
+-			    x.sin6_scope_id;]])
+-	],[
+-	  AC_MSG_RESULT(yes)
+-	  ipv6=yes
+-	],[
+-	  AC_MSG_RESULT(no, IPv6 disabled)
+-	  ipv6=no
+-	])
+-fi
+-
+-if test "$ipv6" = "yes"; then
+-	AC_DEFINE(ENABLE_IPV6)
+-fi
+-])
+-
+-ipv6type=unknown
+-ipv6lib=none
+-ipv6trylibc=no
+-
+-if test "$ipv6" = "yes"; then
+-	AC_MSG_CHECKING([ipv6 stack type])
+-	for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta;
+-	do
+-		case $i in
+-		inria)
+-			dnl http://www.kame.net/
+-			AC_EGREP_CPP(yes, [
+-#include <netinet/in.h>
+-#ifdef IPV6_INRIA_VERSION
+-yes
+-#endif],
+-				[ipv6type=$i])
+-			;;
+-		kame)
+-			dnl http://www.kame.net/
+-			AC_EGREP_CPP(yes, [
+-#include <netinet/in.h>
+-#ifdef __KAME__
+-yes
+-#endif],
+-				[ipv6type=$i;
+-				ipv6lib=inet6
+-				ipv6libdir=/usr/local/v6/lib
+-				ipv6trylibc=yes])
+-			;;
+-		linux-glibc)
+-			dnl http://www.v6.linux.or.jp/
+-			AC_EGREP_CPP(yes, [
+-#include <features.h>
+-#if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
+-yes
+-#endif],
+-				[ipv6type=$i;
+-				ipv6trylibc=yes])
+-			;;
+-		linux-inet6)
+-			dnl http://www.v6.linux.or.jp/
+-			if test -d /usr/inet6; then
+-				ipv6type=$i
+-				ipv6lib=inet6
+-				ipv6libdir=/usr/inet6/lib
+-				BASECFLAGS="-I/usr/inet6/include $BASECFLAGS"
+-			fi
+-			;;
+-		solaris)
+-			if test -f /etc/netconfig; then
+-                          if $GREP -q tcp6 /etc/netconfig; then
+-				ipv6type=$i
+-				ipv6trylibc=yes
+-                          fi
+-                        fi
+-			;;
+-		toshiba)
+-			AC_EGREP_CPP(yes, [
+-#include <sys/param.h>
+-#ifdef _TOSHIBA_INET6
+-yes
+-#endif],
+-				[ipv6type=$i;
+-				ipv6lib=inet6;
+-				ipv6libdir=/usr/local/v6/lib])
+-			;;
+-		v6d)
+-			AC_EGREP_CPP(yes, [
+-#include </usr/local/v6/include/sys/v6config.h>
+-#ifdef __V6D__
+-yes
+-#endif],
+-				[ipv6type=$i;
+-				ipv6lib=v6;
+-				ipv6libdir=/usr/local/v6/lib;
+-				BASECFLAGS="-I/usr/local/v6/include $BASECFLAGS"])
+-			;;
+-		zeta)
+-			AC_EGREP_CPP(yes, [
+-#include <sys/param.h>
+-#ifdef _ZETA_MINAMI_INET6
+-yes
+-#endif],
+-				[ipv6type=$i;
+-				ipv6lib=inet6;
+-				ipv6libdir=/usr/local/v6/lib])
+-			;;
+-		esac
+-		if test "$ipv6type" != "unknown"; then
+-			break
+-		fi
+-	done
+-	AC_MSG_RESULT($ipv6type)
+-fi
+-
+-if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
+-	if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
+-		LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
+-		echo "using lib$ipv6lib"
+-	else
+-		if test $ipv6trylibc = "yes"; then
+-			echo "using libc"
+-		else
+-			echo 'Fatal: no $ipv6lib library found.  cannot continue.'
+-			echo "You need to fetch lib$ipv6lib.a from appropriate"
+-			echo 'ipv6 kit and compile beforehand.'
+-			exit 1
+-		fi
+-	fi
+-fi
+-
+-AC_MSG_CHECKING(for OSX 10.5 SDK or later)
+-AC_COMPILE_IFELSE([
+-  AC_LANG_PROGRAM([[#include <Carbon/Carbon.h>]], [[FSIORefNum fRef = 0]])
+-],[
+-  AC_DEFINE(HAVE_OSX105_SDK, 1, [Define if compiling using MacOS X 10.5 SDK or later.])
+-  AC_MSG_RESULT(yes)
+-],[
+-  AC_MSG_RESULT(no)
+-])
+-
+-# Check for --with-doc-strings
+-AC_MSG_CHECKING(for --with-doc-strings)
+-AC_ARG_WITH(doc-strings,
+-            AS_HELP_STRING([--with(out)-doc-strings], [disable/enable documentation strings]))
+-
+-if test -z "$with_doc_strings"
+-then with_doc_strings="yes"
+-fi
+-if test "$with_doc_strings" != "no"
+-then
+-    AC_DEFINE(WITH_DOC_STRINGS, 1,
+-      [Define if you want documentation strings in extension modules])
+-fi
+-AC_MSG_RESULT($with_doc_strings)
+-
+-# Check for Python-specific malloc support
+-AC_MSG_CHECKING(for --with-tsc)
+-AC_ARG_WITH(tsc,
+-	    AS_HELP_STRING([--with(out)-tsc],[enable/disable timestamp counter profile]),[
+-if test "$withval" != no
+-then 
+-  AC_DEFINE(WITH_TSC, 1, 
+-    [Define to profile with the Pentium timestamp counter]) 
+-    AC_MSG_RESULT(yes)
+-else AC_MSG_RESULT(no)
+-fi],
+-[AC_MSG_RESULT(no)])
+-
+-# Check for Python-specific malloc support
+-AC_MSG_CHECKING(for --with-pymalloc)
+-AC_ARG_WITH(pymalloc,
+-            AS_HELP_STRING([--with(out)-pymalloc], [disable/enable specialized mallocs]))
+-
+-if test -z "$with_pymalloc"
+-then with_pymalloc="yes"
+-fi
+-if test "$with_pymalloc" != "no"
+-then
+-    AC_DEFINE(WITH_PYMALLOC, 1, 
+-     [Define if you want to compile in Python-specific mallocs])
+-fi
+-AC_MSG_RESULT($with_pymalloc)
+-
+-# Check for Valgrind support
+-AC_MSG_CHECKING([for --with-valgrind])
+-AC_ARG_WITH([valgrind],
+-  AS_HELP_STRING([--with-valgrind], [Enable Valgrind support]),,
+-  with_valgrind=no)
+-AC_MSG_RESULT([$with_valgrind])
+-if test "$with_valgrind" != no; then
+-    AC_CHECK_HEADER([valgrind/valgrind.h],
+-      [AC_DEFINE([WITH_VALGRIND], 1, [Define if you want pymalloc to be disabled when running under valgrind])],
+-      [AC_MSG_ERROR([Valgrind support requested but headers not available])]
+-    )
+-fi
+-
+-# Check for --with-wctype-functions
+-AC_MSG_CHECKING(for --with-wctype-functions)
+-AC_ARG_WITH(wctype-functions, 
+-            AS_HELP_STRING([--with-wctype-functions], [use wctype.h functions]),
+-[
+-if test "$withval" != no
+-then 
+-  AC_DEFINE(WANT_WCTYPE_FUNCTIONS, 1,
+-  [Define if you want wctype.h functions to be used instead of the
+-   one supplied by Python itself. (see Include/unicodectype.h).]) 
+-  AC_MSG_RESULT(yes)
+-else AC_MSG_RESULT(no)
+-fi],
+-[AC_MSG_RESULT(no)])
+-
+-# -I${DLINCLDIR} is added to the compile rule for importdl.o
+-AC_SUBST(DLINCLDIR)
+-DLINCLDIR=.
+-
+-# the dlopen() function means we might want to use dynload_shlib.o. some
+-# platforms, such as AIX, have dlopen(), but don't want to use it.
+-AC_CHECK_FUNCS(dlopen)
+-
+-# DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
+-# loading of modules.
+-AC_SUBST(DYNLOADFILE)
+-AC_MSG_CHECKING(DYNLOADFILE)
+-if test -z "$DYNLOADFILE"
+-then
+-	case $ac_sys_system/$ac_sys_release in
+-	AIX*) # Use dynload_shlib.c and dlopen() if we have it; otherwise dynload_aix.c
+-	if test "$ac_cv_func_dlopen" = yes
+-	then DYNLOADFILE="dynload_shlib.o"
+-	else DYNLOADFILE="dynload_aix.o"
+-	fi
+-	;;
+-	BeOS*) DYNLOADFILE="dynload_beos.o";;
+-	hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
+-	# Use dynload_next.c only on 10.2 and below, which don't have native dlopen()
+-	Darwin/@<:@0156@:>@\..*) DYNLOADFILE="dynload_next.o";;
+-	atheos*) DYNLOADFILE="dynload_atheos.o";;
+-	*)
+-	# use dynload_shlib.c and dlopen() if we have it; otherwise stub
+-	# out any dynamic loading
+-	if test "$ac_cv_func_dlopen" = yes
+-	then DYNLOADFILE="dynload_shlib.o"
+-	else DYNLOADFILE="dynload_stub.o"
+-	fi
+-	;;
+-	esac
+-fi
+-AC_MSG_RESULT($DYNLOADFILE)
+-if test "$DYNLOADFILE" != "dynload_stub.o"
+-then
+-	AC_DEFINE(HAVE_DYNAMIC_LOADING, 1,
+-        [Defined when any dynamic module loading is enabled.])
+-fi
+-
+-# MACHDEP_OBJS can be set to platform-specific object files needed by Python
+-
+-AC_SUBST(MACHDEP_OBJS)
+-AC_MSG_CHECKING(MACHDEP_OBJS)
+-if test -z "$MACHDEP_OBJS"
+-then
+-	MACHDEP_OBJS=$extra_machdep_objs
+-else
+-	MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs"
+-fi
+-AC_MSG_RESULT(MACHDEP_OBJS)
+-
+-# checks for library functions
+-AC_CHECK_FUNCS(alarm setitimer getitimer bind_textdomain_codeset chown \
+- clock confstr ctermid execv fchmod fchown fork fpathconf ftime ftruncate \
+- gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
+- getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \
+- initgroups kill killpg lchmod lchown lstat mkfifo mknod mktime \
+- mremap nice pathconf pause plock poll pthread_init \
+- putenv readlink realpath \
+- select sem_open sem_timedwait sem_getvalue sem_unlink setegid seteuid \
+- setgid \
+- setlocale setregid setreuid setsid setpgid setpgrp setuid setvbuf snprintf \
+- setlocale setregid setreuid setresuid setresgid \
+- setsid setpgid setpgrp setuid setvbuf snprintf \
+- sigaction siginterrupt sigrelse strftime \
+- sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
+- truncate uname unsetenv utimes waitpid wait3 wait4 wcscoll _getpty)
+-
+-# For some functions, having a definition is not sufficient, since
+-# we want to take their address.
+-AC_MSG_CHECKING(for chroot)
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=chroot]])],
+-  [AC_DEFINE(HAVE_CHROOT, 1, Define if you have the 'chroot' function.)
+-   AC_MSG_RESULT(yes)],
+-  [AC_MSG_RESULT(no)
+-])
+-AC_MSG_CHECKING(for link)
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=link]])],
+-  [AC_DEFINE(HAVE_LINK, 1, Define if you have the 'link' function.)
+-   AC_MSG_RESULT(yes)],
+-  [AC_MSG_RESULT(no)
+-])
+-AC_MSG_CHECKING(for symlink)
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=symlink]])],
+-  [AC_DEFINE(HAVE_SYMLINK, 1, Define if you have the 'symlink' function.)
+-   AC_MSG_RESULT(yes)],
+-  [AC_MSG_RESULT(no)
+-])
+-AC_MSG_CHECKING(for fchdir)
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fchdir]])],
+-  [AC_DEFINE(HAVE_FCHDIR, 1, Define if you have the 'fchdir' function.)
+-   AC_MSG_RESULT(yes)],
+-  [AC_MSG_RESULT(no)
+-])
+-AC_MSG_CHECKING(for fsync)
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fsync]])],
+-  [AC_DEFINE(HAVE_FSYNC, 1, Define if you have the 'fsync' function.)
+-   AC_MSG_RESULT(yes)],
+-  [AC_MSG_RESULT(no)
+-])
+-AC_MSG_CHECKING(for fdatasync)
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void *x=fdatasync]])],
+-  [AC_DEFINE(HAVE_FDATASYNC, 1, Define if you have the 'fdatasync' function.)
+-   AC_MSG_RESULT(yes)],
+-  [AC_MSG_RESULT(no)
+-])
+-AC_MSG_CHECKING(for epoll)
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/epoll.h>]], [[void *x=epoll_create]])],
+-  [AC_DEFINE(HAVE_EPOLL, 1, Define if you have the 'epoll' functions.)
+-   AC_MSG_RESULT(yes)],
+-  [AC_MSG_RESULT(no)
+-])
+-AC_MSG_CHECKING(for kqueue)
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+-#include <sys/types.h>
+-#include <sys/event.h>
+-    ]], [[int x=kqueue()]])],
+-  [AC_DEFINE(HAVE_KQUEUE, 1, Define if you have the 'kqueue' functions.)
+-   AC_MSG_RESULT(yes)],
+-  [AC_MSG_RESULT(no)
+-])
+-# On some systems (eg. FreeBSD 5), we would find a definition of the
+-# functions ctermid_r, setgroups in the library, but no prototype
+-# (e.g. because we use _XOPEN_SOURCE). See whether we can take their
+-# address to avoid compiler warnings and potential miscompilations
+-# because of the missing prototypes.
+-
+-AC_MSG_CHECKING(for ctermid_r)
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+-#include <stdio.h>
+-]], [[void* p = ctermid_r]])],
+-  [AC_DEFINE(HAVE_CTERMID_R, 1, Define if you have the 'ctermid_r' function.)
+-   AC_MSG_RESULT(yes)],
+-  [AC_MSG_RESULT(no)
+-])
+-
+-AC_CACHE_CHECK([for flock declaration], [ac_cv_flock_decl],
+-  [AC_COMPILE_IFELSE(
+-    [AC_LANG_PROGRAM(
+-      [#include <sys/file.h>],
+-      [void* p = flock]
+-    )],
+-    [ac_cv_flock_decl=yes],
+-    [ac_cv_flock_decl=no]
+-  )
+-])
+-if test "x${ac_cv_flock_decl}" = xyes; then
+-  AC_CHECK_FUNCS(flock,,
+-    AC_CHECK_LIB(bsd,flock,
+-      [AC_DEFINE(HAVE_FLOCK)
+-       AC_DEFINE(FLOCK_NEEDS_LIBBSD, 1, Define if flock needs to be linked with bsd library.)
+-    ])
+-  )
+-fi
+-
+-AC_MSG_CHECKING(for getpagesize)
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+-#include <unistd.h>
+-]], [[void* p = getpagesize]])],
+-  [AC_DEFINE(HAVE_GETPAGESIZE, 1, Define if you have the 'getpagesize' function.)
+-   AC_MSG_RESULT(yes)],
+-  [AC_MSG_RESULT(no)
+-])
+-
+-AC_MSG_CHECKING(for broken unsetenv)
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+-#include <stdlib.h>
+-]], [[int res = unsetenv("DUMMY")]])],
+-  [AC_MSG_RESULT(no)],
+-  [AC_DEFINE(HAVE_BROKEN_UNSETENV, 1, Define if `unsetenv` does not return an int.)
+-   AC_MSG_RESULT(yes)
+-])
+-
+-dnl check for true
+-AC_CHECK_PROGS(TRUE, true, /bin/true)
+-
+-dnl On some systems (e.g. Solaris 9), hstrerror and inet_aton are in -lresolv
+-dnl On others, they are in the C library, so we to take no action
+-AC_CHECK_LIB(c, inet_aton, [$ac_cv_prog_TRUE],
+-  AC_CHECK_LIB(resolv, inet_aton)
+-)
+-
+-# On Tru64, chflags seems to be present, but calling it will
+-# exit Python
+-AC_CACHE_CHECK([for chflags], [ac_cv_have_chflags], [dnl
+-AC_RUN_IFELSE([AC_LANG_SOURCE([[
+-#include <sys/stat.h>
+-#include <unistd.h>
+-int main(int argc, char*argv[])
+-{
+-  if(chflags(argv[0], 0) != 0)
+-    return 1;
+-  return 0;
+-}
+-]])],
+-[ac_cv_have_chflags=yes],
+-[ac_cv_have_chflags=no],
+-[ac_cv_have_chflags=cross])
+-])
+-if test "$ac_cv_have_chflags" = cross ; then
+-  AC_CHECK_FUNC([chflags], [ac_cv_have_chflags="yes"], [ac_cv_have_chflags="no"])
+-fi
+-if test "$ac_cv_have_chflags" = yes ; then
+-  AC_DEFINE(HAVE_CHFLAGS, 1, [Define to 1 if you have the 'chflags' function.])
+-fi
+-
+-AC_CACHE_CHECK([for lchflags], [ac_cv_have_lchflags], [dnl
+-AC_RUN_IFELSE([AC_LANG_SOURCE([[
+-#include <sys/stat.h>
+-#include <unistd.h>
+-int main(int argc, char*argv[])
+-{
+-  if(lchflags(argv[0], 0) != 0)
+-    return 1;
+-  return 0;
+-}
+-]])],[ac_cv_have_lchflags=yes],[ac_cv_have_lchflags=no],[ac_cv_have_lchflags=cross])
+-])
+-if test "$ac_cv_have_lchflags" = cross ; then
+-  AC_CHECK_FUNC([lchflags], [ac_cv_have_lchflags="yes"], [ac_cv_have_lchflags="no"])
+-fi
+-if test "$ac_cv_have_lchflags" = yes ; then
+-  AC_DEFINE(HAVE_LCHFLAGS, 1, [Define to 1 if you have the 'lchflags' function.])
+-fi
+-
+-dnl Check if system zlib has *Copy() functions
+-dnl
+-dnl On MacOSX the linker will search for dylibs on the entire linker path
+-dnl before searching for static libraries. setup.py adds -Wl,-search_paths_first
+-dnl to revert to a more traditional unix behaviour and make it possible to
+-dnl override the system libz with a local static library of libz. Temporarily
+-dnl add that flag to our CFLAGS as well to ensure that we check the version
+-dnl of libz that will be used by setup.py. 
+-dnl The -L/usr/local/lib is needed as wel to get the same compilation 
+-dnl environment as setup.py (and leaving it out can cause configure to use the
+-dnl wrong version of the library)
+-case $ac_sys_system/$ac_sys_release in
+-Darwin/*) 
+-	_CUR_CFLAGS="${CFLAGS}"
+-	_CUR_LDFLAGS="${LDFLAGS}"
+-	CFLAGS="${CFLAGS} -Wl,-search_paths_first"
+-	LDFLAGS="${LDFLAGS} -Wl,-search_paths_first -L/usr/local/lib"
+-	;;
+-esac
+-
+-AC_CHECK_LIB(z, inflateCopy, AC_DEFINE(HAVE_ZLIB_COPY, 1, [Define if the zlib library has inflateCopy]))
+-
+-case $ac_sys_system/$ac_sys_release in
+-Darwin/*) 
+-	CFLAGS="${_CUR_CFLAGS}"
+-	LDFLAGS="${_CUR_LDFLAGS}"
+-	;;
+-esac
+-
+-AC_MSG_CHECKING(for hstrerror)
+-AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+-#include <netdb.h>
+-]], [[void* p = hstrerror; hstrerror(0)]])],
+-  [AC_DEFINE(HAVE_HSTRERROR, 1, Define if you have the 'hstrerror' function.)
+-   AC_MSG_RESULT(yes)],
+-  [AC_MSG_RESULT(no)
+-])
+-
+-AC_MSG_CHECKING(for inet_aton)
+-AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+-#include <sys/types.h>
+-#include <sys/socket.h>
+-#include <netinet/in.h>
+-#include <arpa/inet.h>
+-]], [[void* p = inet_aton;inet_aton(0,0)]])],
+-  [AC_DEFINE(HAVE_INET_ATON, 1, Define if you have the 'inet_aton' function.)
+-   AC_MSG_RESULT(yes)],
+-  [AC_MSG_RESULT(no)
+-])
+-
+-AC_MSG_CHECKING(for inet_pton)
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+-#include <sys/types.h>
+-#include <sys/socket.h>
+-#include <netinet/in.h>
+-#include <arpa/inet.h>
+-]], [[void* p = inet_pton]])],
+-  [AC_DEFINE(HAVE_INET_PTON, 1, Define if you have the 'inet_pton' function.)
+-   AC_MSG_RESULT(yes)],
+-  [AC_MSG_RESULT(no)
+-])
+-
+-# On some systems, setgroups is in unistd.h, on others, in grp.h
+-AC_MSG_CHECKING(for setgroups)
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+-#include <unistd.h>
+-#ifdef HAVE_GRP_H
+-#include <grp.h>
+-#endif
+-]], [[void* p = setgroups]])],
+-  [AC_DEFINE(HAVE_SETGROUPS, 1, Define if you have the 'setgroups' function.)
+-   AC_MSG_RESULT(yes)],
+-  [AC_MSG_RESULT(no)
+-])
+-
+-# check for openpty and forkpty
+-
+-AC_CHECK_FUNCS(openpty,, 
+-   AC_CHECK_LIB(util,openpty,
+-     [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"],
+-     AC_CHECK_LIB(bsd,openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lbsd"])
+-   )
+-)
+-AC_CHECK_FUNCS(forkpty,, 
+-   AC_CHECK_LIB(util,forkpty, 
+-     [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lutil"],
+-     AC_CHECK_LIB(bsd,forkpty, [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lbsd"])
+-   )
+-)
+-
+-# Stuff for expat.
+-AC_CHECK_FUNCS(memmove)
+-
+-# check for long file support functions
+-AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
+-
+-AC_REPLACE_FUNCS(dup2 getcwd strdup)
+-AC_CHECK_FUNCS(getpgrp, 
+-  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[getpgrp(0);]])],
+-    [AC_DEFINE(GETPGRP_HAVE_ARG, 1, [Define if getpgrp() must be called as getpgrp(0).])],
+-    [])
+-)
+-AC_CHECK_FUNCS(setpgrp,
+-  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[setpgrp(0,0);]])],
+-    [AC_DEFINE(SETPGRP_HAVE_ARG, 1, [Define if setpgrp() must be called as setpgrp(0, 0).])],
+-    [])
+-)
+-AC_CHECK_FUNCS(gettimeofday, 
+-  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/time.h>]],
+-  				     [[gettimeofday((struct timeval*)0,(struct timezone*)0);]])],
+-    [],
+-    [AC_DEFINE(GETTIMEOFDAY_NO_TZ, 1,
+-      [Define if gettimeofday() does not have second (timezone) argument
+-       This is the case on Motorola V4 (R40V4.2)])
+-    ])
+-)
+-
+-AC_MSG_CHECKING(for major, minor, and makedev)
+-AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+-#if defined(MAJOR_IN_MKDEV)
+-#include <sys/mkdev.h>
+-#elif defined(MAJOR_IN_SYSMACROS)
+-#include <sys/sysmacros.h>
+-#else
+-#include <sys/types.h>
+-#endif
+-]], [[
+-  makedev(major(0),minor(0));
+-]])],[
+-  AC_DEFINE(HAVE_DEVICE_MACROS, 1,
+-	    [Define to 1 if you have the device macros.])
+-  AC_MSG_RESULT(yes)
+-],[
+-  AC_MSG_RESULT(no)
+-])
+-
+-# On OSF/1 V5.1, getaddrinfo is available, but a define
+-# for [no]getaddrinfo in netdb.h. 
+-AC_MSG_CHECKING(for getaddrinfo)
+-AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+-#include <sys/types.h>
+-#include <sys/socket.h>
+-#include <netdb.h>
+-#include <stdio.h>
+-]], [[getaddrinfo(NULL, NULL, NULL, NULL);]])],
+-[have_getaddrinfo=yes],
+-[have_getaddrinfo=no])
+-AC_MSG_RESULT($have_getaddrinfo)
+-if test $have_getaddrinfo = yes
+-then
+-  AC_MSG_CHECKING(getaddrinfo bug)
+-  AC_CACHE_VAL(ac_cv_buggy_getaddrinfo,
+-  AC_RUN_IFELSE([AC_LANG_SOURCE([[[
+-#include <sys/types.h>
+-#include <netdb.h>
+-#include <string.h>
+-#include <sys/socket.h>
+-#include <netinet/in.h>
+-
+-int main()
+-{
+-  int passive, gaierr, inet4 = 0, inet6 = 0;
+-  struct addrinfo hints, *ai, *aitop;
+-  char straddr[INET6_ADDRSTRLEN], strport[16];
+-
+-  for (passive = 0; passive <= 1; passive++) {
+-    memset(&hints, 0, sizeof(hints));
+-    hints.ai_family = AF_UNSPEC;
+-    hints.ai_flags = passive ? AI_PASSIVE : 0;
+-    hints.ai_socktype = SOCK_STREAM;
+-    hints.ai_protocol = IPPROTO_TCP;
+-    if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
+-      (void)gai_strerror(gaierr);
+-      goto bad;
+-    }
+-    for (ai = aitop; ai; ai = ai->ai_next) {
+-      if (ai->ai_addr == NULL ||
+-          ai->ai_addrlen == 0 ||
+-          getnameinfo(ai->ai_addr, ai->ai_addrlen,
+-                      straddr, sizeof(straddr), strport, sizeof(strport),
+-                      NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
+-        goto bad;
+-      }
+-      switch (ai->ai_family) {
+-      case AF_INET:
+-        if (strcmp(strport, "54321") != 0) {
+-          goto bad;
+-        }
+-        if (passive) {
+-          if (strcmp(straddr, "0.0.0.0") != 0) {
+-            goto bad;
+-          }
+-        } else {
+-          if (strcmp(straddr, "127.0.0.1") != 0) {
+-            goto bad;
+-          }
+-        }
+-        inet4++;
+-        break;
+-      case AF_INET6:
+-        if (strcmp(strport, "54321") != 0) {
+-          goto bad;
+-        }
+-        if (passive) {
+-          if (strcmp(straddr, "::") != 0) {
+-            goto bad;
+-          }
+-        } else {
+-          if (strcmp(straddr, "::1") != 0) {
+-            goto bad;
+-          }
+-        }
+-        inet6++;
+-        break;
+-      case AF_UNSPEC:
+-        goto bad;
+-        break;
+-      default:
+-        /* another family support? */
+-        break;
+-      }
+-    }
+-  }
+-
+-  if (!(inet4 == 0 || inet4 == 2))
+-    goto bad;
+-  if (!(inet6 == 0 || inet6 == 2))
+-    goto bad;
+-
+-  if (aitop)
+-    freeaddrinfo(aitop);
+-  return 0;
+-
+- bad:
+-  if (aitop)
+-    freeaddrinfo(aitop);
+-  return 1;
+-}
+-]]])],
+-[ac_cv_buggy_getaddrinfo=no],
+-[ac_cv_buggy_getaddrinfo=yes],
+-[ac_cv_buggy_getaddrinfo=yes]))
+-fi
+-
+-AC_MSG_RESULT($ac_cv_buggy_getaddrinfo)
+-
+-if test $have_getaddrinfo = no -o "$ac_cv_buggy_getaddrinfo" = yes
+-then
+-	if test $ipv6 = yes
+-	then
+-		echo 'Fatal: You must get working getaddrinfo() function.'
+-		echo '       or you can specify "--disable-ipv6"'.
+-		exit 1
+-	fi
+-else
+-	AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if you have the getaddrinfo function.])
+-fi
+-
+-AC_CHECK_FUNCS(getnameinfo)
+-
+-# checks for structures
+-AC_HEADER_TIME
+-AC_STRUCT_TM
+-AC_STRUCT_TIMEZONE
+-AC_CHECK_MEMBERS([struct stat.st_rdev])
+-AC_CHECK_MEMBERS([struct stat.st_blksize])
+-AC_CHECK_MEMBERS([struct stat.st_flags])
+-AC_CHECK_MEMBERS([struct stat.st_gen])
+-AC_CHECK_MEMBERS([struct stat.st_birthtime])
+-AC_STRUCT_ST_BLOCKS
+-
+-AC_MSG_CHECKING(for time.h that defines altzone)
+-AC_CACHE_VAL(ac_cv_header_time_altzone,[
+-  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[return altzone;]])],
+-    [ac_cv_header_time_altzone=yes],
+-    [ac_cv_header_time_altzone=no])
+-  ])
+-AC_MSG_RESULT($ac_cv_header_time_altzone)
+-if test $ac_cv_header_time_altzone = yes; then
+-  AC_DEFINE(HAVE_ALTZONE, 1, [Define this if your time.h defines altzone.])
+-fi
+-
+-was_it_defined=no
+-AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+-#include <sys/types.h>
+-#include <sys/select.h>
+-#include <sys/time.h>
+-]], [[;]])],[
+-  AC_DEFINE(SYS_SELECT_WITH_SYS_TIME, 1,
+-  [Define if  you can safely include both <sys/select.h> and <sys/time.h>
+-   (which you can't on SCO ODT 3.0).]) 
+-  was_it_defined=yes
+-],[])
+-AC_MSG_RESULT($was_it_defined)
+-
+-AC_MSG_CHECKING(for addrinfo)
+-AC_CACHE_VAL(ac_cv_struct_addrinfo,
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]], [[struct addrinfo a]])],
+-  [ac_cv_struct_addrinfo=yes],
+-  [ac_cv_struct_addrinfo=no]))
+-AC_MSG_RESULT($ac_cv_struct_addrinfo)
+-if test $ac_cv_struct_addrinfo = yes; then
+-	AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo (netdb.h)])
+-fi
+-
+-AC_MSG_CHECKING(for sockaddr_storage)
+-AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+-#		include <sys/types.h>
+-#		include <sys/socket.h>]], [[struct sockaddr_storage s]])],
+-  [ac_cv_struct_sockaddr_storage=yes],
+-  [ac_cv_struct_sockaddr_storage=no]))
+-AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
+-if test $ac_cv_struct_sockaddr_storage = yes; then
+-	AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [struct sockaddr_storage (sys/socket.h)])
+-fi
+-
+-# checks for compiler characteristics
+-
+-AC_C_CHAR_UNSIGNED
+-AC_C_CONST
+-
+-works=no
+-AC_MSG_CHECKING(for working volatile)
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[volatile int x; x = 0;]])],
+-  [works=yes],
+-  [AC_DEFINE(volatile, , [Define to empty if the keyword does not work.])]
+-)
+-AC_MSG_RESULT($works)
+-
+-works=no
+-AC_MSG_CHECKING(for working signed char)
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[signed char c;]])],
+-  [works=yes],
+-  [AC_DEFINE(signed, , [Define to empty if the keyword does not work.])]
+-)
+-AC_MSG_RESULT($works)
+-
+-have_prototypes=no
+-AC_MSG_CHECKING(for prototypes)
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int foo(int x) { return 0; }]], [[return foo(10);]])],
+-  [AC_DEFINE(HAVE_PROTOTYPES, 1, 
+-     [Define if your compiler supports function prototype]) 
+-   have_prototypes=yes],
+-  []
+-)
+-AC_MSG_RESULT($have_prototypes)
+-
+-works=no
+-AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+-#include <stdarg.h>
+-int foo(int x, ...) {
+-	va_list va;
+-	va_start(va, x);
+-	va_arg(va, int);
+-	va_arg(va, char *);
+-	va_arg(va, double);
+-	return 0;
+-}
+-]], [[return foo(10, "", 3.14);]])],[
+-  AC_DEFINE(HAVE_STDARG_PROTOTYPES, 1,
+-   [Define if your compiler supports variable length function prototypes
+-   (e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h>]) 
+-  works=yes
+-],[])
+-AC_MSG_RESULT($works)
+-
+-# check for socketpair
+-AC_MSG_CHECKING(for socketpair)
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+-#include <sys/types.h>
+-#include <sys/socket.h>
+-]], [[void *x=socketpair]])],
+-  [AC_DEFINE(HAVE_SOCKETPAIR, 1, [Define if you have the 'socketpair' function.])
+-   AC_MSG_RESULT(yes)],
+-  [AC_MSG_RESULT(no)]
+-)
+-
+-# check if sockaddr has sa_len member
+-AC_MSG_CHECKING(if sockaddr has sa_len member)
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
+-#include <sys/socket.h>]], [[struct sockaddr x;
+-x.sa_len = 0;]])],
+-  [AC_MSG_RESULT(yes)
+-   AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if sockaddr has sa_len member])],
+-  [AC_MSG_RESULT(no)]
+-)
+-
+-va_list_is_array=no
+-AC_MSG_CHECKING(whether va_list is an array)
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+-#ifdef HAVE_STDARG_PROTOTYPES
+-#include <stdarg.h>
+-#else
+-#include <varargs.h>
+-#endif
+-]], [[va_list list1, list2; list1 = list2;]])],[],[
+- AC_DEFINE(VA_LIST_IS_ARRAY, 1, [Define if a va_list is an array of some kind]) 
+- va_list_is_array=yes
+-])
+-AC_MSG_RESULT($va_list_is_array)
+-
+-# sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
+-AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
+-  [Define this if you have some version of gethostbyname_r()])
+-
+-AC_CHECK_FUNC(gethostbyname_r, [
+-  AC_DEFINE(HAVE_GETHOSTBYNAME_R)
+-  AC_MSG_CHECKING([gethostbyname_r with 6 args])
+-  OLD_CFLAGS=$CFLAGS
+-  CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
+-  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+-#   include <netdb.h>
+-  ]], [[
+-    char *name;
+-    struct hostent *he, *res;
+-    char buffer[2048];
+-    int buflen = 2048;
+-    int h_errnop;
+-
+-    (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
+-  ]])],[
+-    AC_DEFINE(HAVE_GETHOSTBYNAME_R)
+-    AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
+-    [Define this if you have the 6-arg version of gethostbyname_r().])
+-    AC_MSG_RESULT(yes)
+-  ],[
+-    AC_MSG_RESULT(no)
+-    AC_MSG_CHECKING([gethostbyname_r with 5 args])
+-    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+-#       include <netdb.h>
+-      ]], [[
+-        char *name;
+-        struct hostent *he;
+-        char buffer[2048];
+-        int buflen = 2048;
+-        int h_errnop;
+-
+-        (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
+-      ]])],
+-      [
+-        AC_DEFINE(HAVE_GETHOSTBYNAME_R)
+-        AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
+-          [Define this if you have the 5-arg version of gethostbyname_r().])
+-        AC_MSG_RESULT(yes)
+-      ], [
+-        AC_MSG_RESULT(no)
+-        AC_MSG_CHECKING([gethostbyname_r with 3 args])
+-        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+-#           include <netdb.h>
+-          ]], [[
+-            char *name;
+-            struct hostent *he;
+-            struct hostent_data data;
+-
+-            (void) gethostbyname_r(name, he, &data);
+-          ]])],
+-          [
+-            AC_DEFINE(HAVE_GETHOSTBYNAME_R)
+-            AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
+-              [Define this if you have the 3-arg version of gethostbyname_r().])
+-            AC_MSG_RESULT(yes)
+-          ], [
+-           AC_MSG_RESULT(no)
+-        ])
+-    ])
+-  ])
+-  CFLAGS=$OLD_CFLAGS
+-], [
+-  AC_CHECK_FUNCS(gethostbyname)
+-])
+-AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
+-AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
+-AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
+-AC_SUBST(HAVE_GETHOSTBYNAME_R)
+-AC_SUBST(HAVE_GETHOSTBYNAME)
+-
+-# checks for system services
+-# (none yet)
+-
+-# Linux requires this for correct f.p. operations
+-AC_CHECK_FUNC(__fpu_control,
+-  [],
+-  [AC_CHECK_LIB(ieee, __fpu_control)
+-])
+-
+-# Check for --with-fpectl
+-AC_MSG_CHECKING(for --with-fpectl)
+-AC_ARG_WITH(fpectl,
+-            AS_HELP_STRING([--with-fpectl], [enable SIGFPE catching]),
+-[
+-if test "$withval" != no
+-then 
+-  AC_DEFINE(WANT_SIGFPE_HANDLER, 1,
+-  [Define if you want SIGFPE handled (see Include/pyfpe.h).]) 
+-  AC_MSG_RESULT(yes)
+-else AC_MSG_RESULT(no)
+-fi],
+-[AC_MSG_RESULT(no)])
+-
+-# check for --with-libm=...
+-AC_SUBST(LIBM)
+-case $ac_sys_system in
+-Darwin) ;;
+-BeOS) ;;
+-*) LIBM=-lm
+-esac
+-AC_MSG_CHECKING(for --with-libm=STRING)
+-AC_ARG_WITH(libm,
+-            AS_HELP_STRING([--with-libm=STRING], [math library]),
+-[
+-if test "$withval" = no
+-then LIBM=
+-     AC_MSG_RESULT(force LIBM empty)
+-elif test "$withval" != yes
+-then LIBM=$withval
+-     AC_MSG_RESULT(set LIBM="$withval")
+-else AC_MSG_ERROR([proper usage is --with-libm=STRING])
+-fi],
+-[AC_MSG_RESULT(default LIBM="$LIBM")])
+-
+-# check for --with-libc=...
+-AC_SUBST(LIBC)
+-AC_MSG_CHECKING(for --with-libc=STRING)
+-AC_ARG_WITH(libc,
+-            AS_HELP_STRING([--with-libc=STRING], [C library]),
+-[
+-if test "$withval" = no
+-then LIBC=
+-     AC_MSG_RESULT(force LIBC empty)
+-elif test "$withval" != yes
+-then LIBC=$withval
+-     AC_MSG_RESULT(set LIBC="$withval")
+-else AC_MSG_ERROR([proper usage is --with-libc=STRING])
+-fi],
+-[AC_MSG_RESULT(default LIBC="$LIBC")])
+-
+-# **************************************************
+-# * Check for various properties of floating point *
+-# **************************************************
+-
+-AC_MSG_CHECKING(whether C doubles are little-endian IEEE 754 binary64)
+-AC_CACHE_VAL(ac_cv_little_endian_double, [
+-AC_RUN_IFELSE([AC_LANG_SOURCE([[
+-#include <string.h>
+-int main() {
+-    double x = 9006104071832581.0;
+-    if (memcmp(&x, "\x05\x04\x03\x02\x01\xff\x3f\x43", 8) == 0)
+-        return 0;
+-    else
+-        return 1;
+-}
+-]])],
+-[ac_cv_little_endian_double=yes],
+-[ac_cv_little_endian_double=no],
+-[ac_cv_little_endian_double=no])])
+-AC_MSG_RESULT($ac_cv_little_endian_double)
+-if test "$ac_cv_little_endian_double" = yes
+-then
+-  AC_DEFINE(DOUBLE_IS_LITTLE_ENDIAN_IEEE754, 1,
+-  [Define if C doubles are 64-bit IEEE 754 binary format, stored
+-   with the least significant byte first])
+-fi
+-
+-AC_MSG_CHECKING(whether C doubles are big-endian IEEE 754 binary64)
+-AC_CACHE_VAL(ac_cv_big_endian_double, [
+-AC_RUN_IFELSE([AC_LANG_SOURCE([[
+-#include <string.h>
+-int main() {
+-    double x = 9006104071832581.0;
+-    if (memcmp(&x, "\x43\x3f\xff\x01\x02\x03\x04\x05", 8) == 0)
+-        return 0;
+-    else
+-        return 1;
+-}
+-]])],
+-[ac_cv_big_endian_double=yes],
+-[ac_cv_big_endian_double=no],
+-[ac_cv_big_endian_double=no])])
+-AC_MSG_RESULT($ac_cv_big_endian_double)
+-if test "$ac_cv_big_endian_double" = yes
+-then
+-  AC_DEFINE(DOUBLE_IS_BIG_ENDIAN_IEEE754, 1,
+-  [Define if C doubles are 64-bit IEEE 754 binary format, stored
+-   with the most significant byte first])
+-fi
+-
+-# Some ARM platforms use a mixed-endian representation for doubles.
+-# While Python doesn't currently have full support for these platforms
+-# (see e.g., issue 1762561), we can at least make sure that float <-> string
+-# conversions work.
+-AC_MSG_CHECKING(whether C doubles are ARM mixed-endian IEEE 754 binary64)
+-AC_CACHE_VAL(ac_cv_mixed_endian_double, [
+-AC_RUN_IFELSE([AC_LANG_SOURCE([[
+-#include <string.h>
+-int main() {
+-    double x = 9006104071832581.0;
+-    if (memcmp(&x, "\x01\xff\x3f\x43\x05\x04\x03\x02", 8) == 0)
+-        return 0;
+-    else
+-        return 1;
+-}
+-]])],
+-[ac_cv_mixed_endian_double=yes],
+-[ac_cv_mixed_endian_double=no],
+-[ac_cv_mixed_endian_double=no])])
+-AC_MSG_RESULT($ac_cv_mixed_endian_double)
+-if test "$ac_cv_mixed_endian_double" = yes
+-then
+-  AC_DEFINE(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754, 1,
+-  [Define if C doubles are 64-bit IEEE 754 binary format, stored
+-   in ARM mixed-endian order (byte order 45670123)])
+-fi
+-
+-# The short float repr introduced in Python 3.1 requires the
+-# correctly-rounded string <-> double conversion functions from
+-# Python/dtoa.c, which in turn require that the FPU uses 53-bit
+-# rounding; this is a problem on x86, where the x87 FPU has a default
+-# rounding precision of 64 bits.  For gcc/x86, we can fix this by
+-# using inline assembler to get and set the x87 FPU control word.
+-
+-# This inline assembler syntax may also work for suncc and icc,
+-# so we try it on all platforms.
+-
+-AC_MSG_CHECKING(whether we can use gcc inline assembler to get and set x87 control word)
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
+-  unsigned short cw;
+-  __asm__ __volatile__ ("fnstcw %0" : "=m" (cw));
+-  __asm__ __volatile__ ("fldcw %0" : : "m" (cw));
+-]])],[have_gcc_asm_for_x87=yes],[have_gcc_asm_for_x87=no])
+-AC_MSG_RESULT($have_gcc_asm_for_x87)
+-if test "$have_gcc_asm_for_x87" = yes
+-then
+-    AC_DEFINE(HAVE_GCC_ASM_FOR_X87, 1,
+-    [Define if we can use gcc inline assembler to get and set x87 control word])
+-fi
+-
+-# Detect whether system arithmetic is subject to x87-style double
+-# rounding issues.  The result of this test has little meaning on non
+-# IEEE 754 platforms.  On IEEE 754, test should return 1 if rounding
+-# mode is round-to-nearest and double rounding issues are present, and
+-# 0 otherwise.  See http://bugs.python.org/issue2937 for more info.
+-AC_MSG_CHECKING(for x87-style double rounding)
+-# $BASECFLAGS may affect the result
+-ac_save_cc="$CC"
+-CC="$CC $BASECFLAGS"
+-AC_RUN_IFELSE([AC_LANG_SOURCE([[
+-#include <stdlib.h>
+-#include <math.h>
+-int main() {
+-    volatile double x, y, z;
+-    /* 1./(1-2**-53) -> 1+2**-52 (correct), 1.0 (double rounding) */
+-    x = 0.99999999999999989; /* 1-2**-53 */
+-    y = 1./x;
+-    if (y != 1.)
+-        exit(0);
+-    /* 1e16+2.99999 -> 1e16+2. (correct), 1e16+4. (double rounding) */
+-    x = 1e16;
+-    y = 2.99999;
+-    z = x + y;
+-    if (z != 1e16+4.)
+-        exit(0);
+-    /* both tests show evidence of double rounding */
+-    exit(1);
+-}
+-]])],
+-[ac_cv_x87_double_rounding=no],
+-[ac_cv_x87_double_rounding=yes],
+-[ac_cv_x87_double_rounding=no])
+-CC="$ac_save_cc"
+-AC_MSG_RESULT($ac_cv_x87_double_rounding)
+-if test "$ac_cv_x87_double_rounding" = yes
+-then
+-  AC_DEFINE(X87_DOUBLE_ROUNDING, 1,
+-  [Define if arithmetic is subject to x87-style double rounding issue])
+-fi
+-
+-# ************************************
+-# * Check for mathematical functions *
+-# ************************************
+-
+-LIBS_SAVE=$LIBS
+-LIBS="$LIBS $LIBM"
+-
+-# On FreeBSD 6.2, it appears that tanh(-0.) returns 0. instead of
+-# -0. on some architectures.
+-AC_MSG_CHECKING(whether tanh preserves the sign of zero)
+-AC_CACHE_VAL(ac_cv_tanh_preserves_zero_sign, [
+-AC_RUN_IFELSE([AC_LANG_SOURCE([[
+-#include <math.h>
+-#include <stdlib.h>
+-int main() {
+-    /* return 0 if either negative zeros don't exist
+-       on this platform or if negative zeros exist
+-       and tanh(-0.) == -0. */
+-  if (atan2(0., -1.) == atan2(-0., -1.) ||
+-      atan2(tanh(-0.), -1.) == atan2(-0., -1.)) exit(0);
+-  else exit(1);
+-}
+-]])],
+-[ac_cv_tanh_preserves_zero_sign=yes],
+-[ac_cv_tanh_preserves_zero_sign=no],
+-[ac_cv_tanh_preserves_zero_sign=no])])
+-AC_MSG_RESULT($ac_cv_tanh_preserves_zero_sign)
+-if test "$ac_cv_tanh_preserves_zero_sign" = yes
+-then
+-  AC_DEFINE(TANH_PRESERVES_ZERO_SIGN, 1,
+-  [Define if tanh(-0.) is -0., or if platform doesn't have signed zeros])
+-fi
+-
+-AC_CHECK_FUNCS([acosh asinh atanh copysign erf erfc expm1 finite gamma])
+-AC_CHECK_FUNCS([hypot lgamma log1p round tgamma])
+-AC_CHECK_DECLS([isinf, isnan, isfinite], [], [], [[#include <math.h>]])
+-
+-LIBS=$LIBS_SAVE
+-
+-# For multiprocessing module, check that sem_open
+-# actually works.  For FreeBSD versions <= 7.2,
+-# the kernel module that provides POSIX semaphores
+-# isn't loaded by default, so an attempt to call
+-# sem_open results in a 'Signal 12' error.
+-AC_MSG_CHECKING(whether POSIX semaphores are enabled)
+-AC_CACHE_VAL(ac_cv_posix_semaphores_enabled,
+-AC_RUN_IFELSE([AC_LANG_SOURCE([[
+-#include <unistd.h>
+-#include <fcntl.h>
+-#include <stdio.h>
+-#include <semaphore.h>
+-#include <sys/stat.h>
+-
+-int main(void) {
+-  sem_t *a = sem_open("/autoconf", O_CREAT, S_IRUSR|S_IWUSR, 0);
+-  if (a == SEM_FAILED) {
+-    perror("sem_open");
+-    return 1;
+-  }
+-  sem_close(a);
+-  sem_unlink("/autoconf");
+-  return 0;
+-}
+-]])],
+-[ac_cv_posix_semaphores_enabled=yes],
+-[ac_cv_posix_semaphores_enabled=no],
+-[ac_cv_posix_semaphores_enabled=yes])
+-)
+-AC_MSG_RESULT($ac_cv_posix_semaphores_enabled)
+-if test $ac_cv_posix_semaphores_enabled = no
+-then
+-  AC_DEFINE(POSIX_SEMAPHORES_NOT_ENABLED, 1,
+-            [Define if POSIX semaphores aren't enabled on your system])
+-fi
+-
+-# Multiprocessing check for broken sem_getvalue
+-AC_MSG_CHECKING(for broken sem_getvalue)
+-AC_CACHE_VAL(ac_cv_broken_sem_getvalue,
+-AC_RUN_IFELSE([AC_LANG_SOURCE([[
+-#include <unistd.h>
+-#include <fcntl.h>
+-#include <stdio.h>
+-#include <semaphore.h>
+-#include <sys/stat.h>
+-
+-int main(void){
+-  sem_t *a = sem_open("/autocftw", O_CREAT, S_IRUSR|S_IWUSR, 0);
+-  int count;
+-  int res;
+-  if(a==SEM_FAILED){
+-    perror("sem_open");
+-    return 1;
+-
+-  }
+-  res = sem_getvalue(a, &count);
+-  sem_close(a);
+-  sem_unlink("/autocftw");
+-  return res==-1 ? 1 : 0;
+-}
+-]])],
+-[ac_cv_broken_sem_getvalue=no],
+-[ac_cv_broken_sem_getvalue=yes],
+-[ac_cv_broken_sem_getvalue=yes])
+-)
+-AC_MSG_RESULT($ac_cv_broken_sem_getvalue)
+-if test $ac_cv_broken_sem_getvalue = yes
+-then
+-  AC_DEFINE(HAVE_BROKEN_SEM_GETVALUE, 1,
+-  [define to 1 if your sem_getvalue is broken.])
+-fi
+-
+-# determine what size digit to use for Python's longs
+-AC_MSG_CHECKING([digit size for Python's longs])
+-AC_ARG_ENABLE(big-digits,
+-AS_HELP_STRING([--enable-big-digits@<:@=BITS@:>@],[use big digits for Python longs [[BITS=30]]]),
+-[case $enable_big_digits in
+-yes)
+-  enable_big_digits=30 ;;
+-no)
+-  enable_big_digits=15 ;;
+-[15|30])
+-  ;;
+-*)
+-  AC_MSG_ERROR([bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30]) ;;
+-esac
+-AC_MSG_RESULT($enable_big_digits)
+-AC_DEFINE_UNQUOTED(PYLONG_BITS_IN_DIGIT, $enable_big_digits, [Define as the preferred size in bits of long digits])
+-],
+-[AC_MSG_RESULT(no value specified)])
+-
+-# check for wchar.h
+-AC_CHECK_HEADER(wchar.h, [
+-  AC_DEFINE(HAVE_WCHAR_H, 1, 
+-  [Define if the compiler provides a wchar.h header file.]) 
+-  wchar_h="yes"
+-],
+-wchar_h="no"
+-)
+-
+-# determine wchar_t size
+-if test "$wchar_h" = yes
+-then
+-  AC_CHECK_SIZEOF(wchar_t, 4, [#include <wchar.h>])
+-fi
+-
+-AC_MSG_CHECKING(for UCS-4 tcl)
+-have_ucs4_tcl=no
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+-#include <tcl.h>
+-#if TCL_UTF_MAX != 6
+-# error "NOT UCS4_TCL"
+-#endif]], [[]])],[
+-  AC_DEFINE(HAVE_UCS4_TCL, 1, [Define this if you have tcl and TCL_UTF_MAX==6])
+-  have_ucs4_tcl=yes
+-],[])
+-AC_MSG_RESULT($have_ucs4_tcl)
+-
+-# check whether wchar_t is signed or not
+-if test "$wchar_h" = yes
+-then
+-  # check whether wchar_t is signed or not
+-  AC_MSG_CHECKING(whether wchar_t is signed)
+-  AC_CACHE_VAL(ac_cv_wchar_t_signed, [
+-  AC_RUN_IFELSE([AC_LANG_SOURCE([[
+-  #include <wchar.h>
+-  int main()
+-  {
+-	/* Success: exit code 0 */
+-        exit((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
+-  }
+-  ]])],
+-  [ac_cv_wchar_t_signed=yes],
+-  [ac_cv_wchar_t_signed=no],
+-  [ac_cv_wchar_t_signed=yes])])
+-  AC_MSG_RESULT($ac_cv_wchar_t_signed)
+-fi
+-  
+-AC_MSG_CHECKING(what type to use for unicode)
+-dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
+-AC_ARG_ENABLE(unicode, 
+-              AS_HELP_STRING([--enable-unicode@<:@=ucs@<:@24@:>@@:>@], [Enable Unicode strings (default is ucs2)]),
+-              [],
+-              [enable_unicode=yes])
+-
+-if test $enable_unicode = yes
+-then
+-  # Without any arguments, Py_UNICODE defaults to two-byte mode
+-  case "$have_ucs4_tcl" in
+-  yes) enable_unicode="ucs4"
+-       ;;
+-  *)   enable_unicode="ucs2"
+-       ;;
+-  esac
+-fi
+-
+-AH_TEMPLATE(Py_UNICODE_SIZE,
+-  [Define as the size of the unicode type.])
+-case "$enable_unicode" in
+-ucs2) unicode_size="2"
+-      AC_DEFINE(Py_UNICODE_SIZE,2)
+-      ;;
+-ucs4) unicode_size="4"
+-      AC_DEFINE(Py_UNICODE_SIZE,4)
+-      ;;
+-*) AC_MSG_ERROR([invalid value for --enable-unicode. Use either ucs2 or ucs4 (lowercase).]) ;;
+-esac
+-
+-AH_TEMPLATE(PY_UNICODE_TYPE,
+-  [Define as the integral type used for Unicode representation.])
+-
+-AC_SUBST(UNICODE_OBJS)
+-if test "$enable_unicode" = "no"
+-then
+-  UNICODE_OBJS=""
+-  AC_MSG_RESULT(not used)
+-else
+-  UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o"
+-  AC_DEFINE(Py_USING_UNICODE, 1,
+-  [Define if you want to have a Unicode type.])
+-
+-  # wchar_t is only usable if it maps to an unsigned type
+-  if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \
+-          -a "$ac_cv_wchar_t_signed" = "no"
+-  then
+-    PY_UNICODE_TYPE="wchar_t"
+-    AC_DEFINE(HAVE_USABLE_WCHAR_T, 1,
+-    [Define if you have a useable wchar_t type defined in wchar.h; useable
+-     means wchar_t must be an unsigned type with at least 16 bits. (see
+-     Include/unicodeobject.h).])
+-    AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
+-  elif test "$ac_cv_sizeof_short" = "$unicode_size"
+-  then
+-       PY_UNICODE_TYPE="unsigned short"
+-       AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
+-  elif test "$ac_cv_sizeof_long" = "$unicode_size"
+-  then
+-       PY_UNICODE_TYPE="unsigned long"
+-       AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
+-  else
+-       PY_UNICODE_TYPE="no type found"
+-  fi
+-  AC_MSG_RESULT($PY_UNICODE_TYPE)
+-fi
+-
+-# check for endianness
+-AC_C_BIGENDIAN
+-
+-# Check whether right shifting a negative integer extends the sign bit
+-# or fills with zeros (like the Cray J90, according to Tim Peters).
+-AC_MSG_CHECKING(whether right shift extends the sign bit)
+-AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
+-AC_RUN_IFELSE([AC_LANG_SOURCE([[
+-int main()
+-{
+-	exit(((-1)>>3 == -1) ? 0 : 1);
+-}
+-]])],
+-[ac_cv_rshift_extends_sign=yes],
+-[ac_cv_rshift_extends_sign=no],
+-[ac_cv_rshift_extends_sign=yes])])
+-AC_MSG_RESULT($ac_cv_rshift_extends_sign)
+-if test "$ac_cv_rshift_extends_sign" = no
+-then
+-  AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS, 1,
+-  [Define if i>>j for signed int i does not extend the sign bit
+-   when i < 0])
+-fi
+-
+-# check for getc_unlocked and related locking functions
+-AC_MSG_CHECKING(for getc_unlocked() and friends)
+-AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
+-AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[
+-	FILE *f = fopen("/dev/null", "r");
+-	flockfile(f);
+-	getc_unlocked(f);
+-	funlockfile(f);
+-]])],[ac_cv_have_getc_unlocked=yes],[ac_cv_have_getc_unlocked=no])])
+-AC_MSG_RESULT($ac_cv_have_getc_unlocked)
+-if test "$ac_cv_have_getc_unlocked" = yes
+-then
+-  AC_DEFINE(HAVE_GETC_UNLOCKED, 1,
+-  [Define this if you have flockfile(), getc_unlocked(), and funlockfile()])
+-fi
+-
+-# check where readline lives
+-# save the value of LIBS so we don't actually link Python with readline
+-LIBS_no_readline=$LIBS
+-
+-# On some systems we need to link readline to a termcap compatible
+-# library.  NOTE: Keep the precedence of listed libraries synchronised
+-# with setup.py.
+-py_cv_lib_readline=no
+-AC_MSG_CHECKING([how to link readline libs])
+-for py_libtermcap in "" ncursesw ncurses curses termcap; do
+-  if test -z "$py_libtermcap"; then
+-    READLINE_LIBS="-lreadline"
+-  else
+-    READLINE_LIBS="-lreadline -l$py_libtermcap"
+-  fi
+-  LIBS="$READLINE_LIBS $LIBS_no_readline"
+-  AC_LINK_IFELSE(
+-    [AC_LANG_CALL([],[readline])],
+-    [py_cv_lib_readline=yes])
+-  if test $py_cv_lib_readline = yes; then
+-    break
+-  fi
+-done
+-# Uncomment this line if you want to use READINE_LIBS in Makefile or scripts
+-#AC_SUBST([READLINE_LIBS])
+-if test $py_cv_lib_readline = no; then
+-  AC_MSG_RESULT([none])
+-else
+-  AC_MSG_RESULT([$READLINE_LIBS])
+-  AC_DEFINE(HAVE_LIBREADLINE, 1,
+-    [Define if you have the readline library (-lreadline).])
+-fi
+-
+-# check for readline 2.1
+-AC_CHECK_LIB(readline, rl_callback_handler_install,
+-	AC_DEFINE(HAVE_RL_CALLBACK, 1,
+-        [Define if you have readline 2.1]), ,$READLINE_LIBS)
+-
+-# check for readline 2.2
+-AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <readline/readline.h>]])],
+-  [have_readline=yes],
+-  [have_readline=no]
+-)
+-if test $have_readline = yes
+-then
+-  AC_EGREP_HEADER([extern int rl_completion_append_character;],
+-  [readline/readline.h],
+-  AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
+-  [Define if you have readline 2.2]), )
+-  AC_EGREP_HEADER([extern int rl_completion_suppress_append;],
+-  [readline/readline.h],
+-  AC_DEFINE(HAVE_RL_COMPLETION_SUPPRESS_APPEND, 1,
+-  [Define if you have rl_completion_suppress_append]), )
+-fi
+-
+-# check for readline 4.0
+-AC_CHECK_LIB(readline, rl_pre_input_hook,
+-	AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
+-        [Define if you have readline 4.0]), ,$READLINE_LIBS)
+-
+-# also in 4.0
+-AC_CHECK_LIB(readline, rl_completion_display_matches_hook,
+-	AC_DEFINE(HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK, 1,
+-        [Define if you have readline 4.0]), ,$READLINE_LIBS)
+-
+-# check for readline 4.2
+-AC_CHECK_LIB(readline, rl_completion_matches,
+-	AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
+-        [Define if you have readline 4.2]), ,$READLINE_LIBS)
+-
+-# also in readline 4.2
+-AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <readline/readline.h>]])],
+-  [have_readline=yes],
+-  [have_readline=no]
+-)
+-if test $have_readline = yes
+-then
+-  AC_EGREP_HEADER([extern int rl_catch_signals;],
+-  [readline/readline.h],
+-  AC_DEFINE(HAVE_RL_CATCH_SIGNAL, 1,
+-  [Define if you can turn off readline's signal handling.]), )
+-fi
+-
+-# End of readline checks: restore LIBS
+-LIBS=$LIBS_no_readline
+-
+-AC_MSG_CHECKING(for broken nice())
+-AC_CACHE_VAL(ac_cv_broken_nice, [
+-AC_RUN_IFELSE([AC_LANG_SOURCE([[
+-int main()
+-{
+-	int val1 = nice(1);
+-	if (val1 != -1 && val1 == nice(2))
+-		exit(0);
+-	exit(1);
+-}
+-]])],
+-[ac_cv_broken_nice=yes],
+-[ac_cv_broken_nice=no],
+-[ac_cv_broken_nice=no])])
+-AC_MSG_RESULT($ac_cv_broken_nice)
+-if test "$ac_cv_broken_nice" = yes
+-then
+-  AC_DEFINE(HAVE_BROKEN_NICE, 1,
+-  [Define if nice() returns success/failure instead of the new priority.])
+-fi
+-
+-AC_MSG_CHECKING(for broken poll())
+-AC_CACHE_VAL(ac_cv_broken_poll,
+-AC_RUN_IFELSE([AC_LANG_SOURCE([[
+-#include <poll.h>
+-
+-int main()
+-{
+-    struct pollfd poll_struct = { 42, POLLIN|POLLPRI|POLLOUT, 0 };
+-    int poll_test;
+-
+-    close (42);
+-
+-    poll_test = poll(&poll_struct, 1, 0);
+-    if (poll_test < 0)
+-        return 0;
+-    else if (poll_test == 0 && poll_struct.revents != POLLNVAL)
+-        return 0;
+-    else
+-        return 1;
+-}
+-]])],
+-[ac_cv_broken_poll=yes],
+-[ac_cv_broken_poll=no],
+-[ac_cv_broken_poll=no]))
+-AC_MSG_RESULT($ac_cv_broken_poll)
+-if test "$ac_cv_broken_poll" = yes
+-then
+-  AC_DEFINE(HAVE_BROKEN_POLL, 1,
+-      [Define if poll() sets errno on invalid file descriptors.])
+-fi
+-
+-# Before we can test tzset, we need to check if struct tm has a tm_zone 
+-# (which is not required by ISO C or UNIX spec) and/or if we support
+-# tzname[]
+-AC_STRUCT_TIMEZONE
+-
+-# check tzset(3) exists and works like we expect it to
+-AC_MSG_CHECKING(for working tzset())
+-AC_CACHE_VAL(ac_cv_working_tzset, [
+-AC_RUN_IFELSE([AC_LANG_SOURCE([[
+-#include <stdlib.h>
+-#include <time.h>
+-#include <string.h>
+-
+-#if HAVE_TZNAME
+-extern char *tzname[];
+-#endif
+-
+-int main()
+-{
+-	/* Note that we need to ensure that not only does tzset(3)
+-	   do 'something' with localtime, but it works as documented
+-	   in the library reference and as expected by the test suite.
+-	   This includes making sure that tzname is set properly if
+-	   tm->tm_zone does not exist since it is the alternative way
+-	   of getting timezone info.
+-
+-	   Red Hat 6.2 doesn't understand the southern hemisphere 
+-	   after New Year's Day.
+-	*/
+-
+-	time_t groundhogday = 1044144000; /* GMT-based */
+-	time_t midyear = groundhogday + (365 * 24 * 3600 / 2);
+-
+-	putenv("TZ=UTC+0");
+-	tzset();
+-	if (localtime(&groundhogday)->tm_hour != 0)
+-	    exit(1);
+-#if HAVE_TZNAME
+-	/* For UTC, tzname[1] is sometimes "", sometimes "   " */
+-	if (strcmp(tzname[0], "UTC") || 
+-		(tzname[1][0] != 0 && tzname[1][0] != ' '))
+-	    exit(1);
+-#endif
+-
+-	putenv("TZ=EST+5EDT,M4.1.0,M10.5.0");
+-	tzset();
+-	if (localtime(&groundhogday)->tm_hour != 19)
+-	    exit(1);
+-#if HAVE_TZNAME
+-	if (strcmp(tzname[0], "EST") || strcmp(tzname[1], "EDT"))
+-	    exit(1);
+-#endif
+-
+-	putenv("TZ=AEST-10AEDT-11,M10.5.0,M3.5.0");
+-	tzset();
+-	if (localtime(&groundhogday)->tm_hour != 11)
+-	    exit(1);
+-#if HAVE_TZNAME
+-	if (strcmp(tzname[0], "AEST") || strcmp(tzname[1], "AEDT"))
+-	    exit(1);
+-#endif
+-
+-#if HAVE_STRUCT_TM_TM_ZONE
+-	if (strcmp(localtime(&groundhogday)->tm_zone, "AEDT"))
+-	    exit(1);
+-	if (strcmp(localtime(&midyear)->tm_zone, "AEST"))
+-	    exit(1);
+-#endif
+-
+-	exit(0);
+-}
+-]])],
+-[ac_cv_working_tzset=yes],
+-[ac_cv_working_tzset=no],
+-[ac_cv_working_tzset=no])])
+-AC_MSG_RESULT($ac_cv_working_tzset)
+-if test "$ac_cv_working_tzset" = yes
+-then
+-  AC_DEFINE(HAVE_WORKING_TZSET, 1,
+-  [Define if tzset() actually switches the local timezone in a meaningful way.])
+-fi
+-
+-# Look for subsecond timestamps in struct stat
+-AC_MSG_CHECKING(for tv_nsec in struct stat)
+-AC_CACHE_VAL(ac_cv_stat_tv_nsec,
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[
+-struct stat st;
+-st.st_mtim.tv_nsec = 1;
+-]])],
+-[ac_cv_stat_tv_nsec=yes],
+-[ac_cv_stat_tv_nsec=no]))
+-AC_MSG_RESULT($ac_cv_stat_tv_nsec)
+-if test "$ac_cv_stat_tv_nsec" = yes
+-then
+-  AC_DEFINE(HAVE_STAT_TV_NSEC, 1,
+-  [Define if you have struct stat.st_mtim.tv_nsec])
+-fi
+-
+-# Look for BSD style subsecond timestamps in struct stat
+-AC_MSG_CHECKING(for tv_nsec2 in struct stat)
+-AC_CACHE_VAL(ac_cv_stat_tv_nsec2,
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[
+-struct stat st;
+-st.st_mtimespec.tv_nsec = 1;
+-]])],
+-[ac_cv_stat_tv_nsec2=yes],
+-[ac_cv_stat_tv_nsec2=no]))
+-AC_MSG_RESULT($ac_cv_stat_tv_nsec2)
+-if test "$ac_cv_stat_tv_nsec2" = yes
+-then
+-  AC_DEFINE(HAVE_STAT_TV_NSEC2, 1,
+-  [Define if you have struct stat.st_mtimensec])
+-fi
+-
+-# On HP/UX 11.0, mvwdelch is a block with a return statement
+-AC_MSG_CHECKING(whether mvwdelch is an expression)
+-AC_CACHE_VAL(ac_cv_mvwdelch_is_expression,
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
+-  int rtn;
+-  rtn = mvwdelch(0,0,0);
+-]])],
+-[ac_cv_mvwdelch_is_expression=yes],
+-[ac_cv_mvwdelch_is_expression=no]))
+-AC_MSG_RESULT($ac_cv_mvwdelch_is_expression)
+-
+-if test "$ac_cv_mvwdelch_is_expression" = yes
+-then
+-  AC_DEFINE(MVWDELCH_IS_EXPRESSION, 1,
+-  [Define if mvwdelch in curses.h is an expression.])
+-fi
+-
+-AC_MSG_CHECKING(whether WINDOW has _flags)
+-AC_CACHE_VAL(ac_cv_window_has_flags,
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
+-  WINDOW *w;
+-  w->_flags = 0;
+-]])],
+-[ac_cv_window_has_flags=yes],
+-[ac_cv_window_has_flags=no]))
+-AC_MSG_RESULT($ac_cv_window_has_flags)
+-
+-
+-if test "$ac_cv_window_has_flags" = yes
+-then
+-  AC_DEFINE(WINDOW_HAS_FLAGS, 1, 
+-  [Define if WINDOW in curses.h offers a field _flags.])
+-fi
+-
+-AC_MSG_CHECKING(for is_term_resized)
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=is_term_resized]])],
+-  [AC_DEFINE(HAVE_CURSES_IS_TERM_RESIZED, 1, Define if you have the 'is_term_resized' function.)
+-   AC_MSG_RESULT(yes)],
+-  [AC_MSG_RESULT(no)]
+-)
+-
+-AC_MSG_CHECKING(for resize_term)
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=resize_term]])],
+-  [AC_DEFINE(HAVE_CURSES_RESIZE_TERM, 1, Define if you have the 'resize_term' function.)
+-   AC_MSG_RESULT(yes)],
+-  [AC_MSG_RESULT(no)]
+-)
+-
+-AC_MSG_CHECKING(for resizeterm)
+-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=resizeterm]])],
+-  [AC_DEFINE(HAVE_CURSES_RESIZETERM, 1, Define if you have the 'resizeterm' function.)
+-   AC_MSG_RESULT(yes)],
+-  [AC_MSG_RESULT(no)]
+-)
+-
+-AC_MSG_CHECKING(for /dev/ptmx)
+-
+-if test -r /dev/ptmx
+-then
+-  AC_MSG_RESULT(yes)
+-  AC_DEFINE(HAVE_DEV_PTMX, 1,
+-  [Define if we have /dev/ptmx.])
+-else
+-  AC_MSG_RESULT(no)
+-fi
+-
+-AC_MSG_CHECKING(for /dev/ptc)
+-
+-if test -r /dev/ptc
+-then
+-  AC_MSG_RESULT(yes)
+-  AC_DEFINE(HAVE_DEV_PTC, 1,
+-  [Define if we have /dev/ptc.])
+-else
+-  AC_MSG_RESULT(no)
+-fi
+-
+-if test "$have_long_long" = yes
+-then
+-  AC_MSG_CHECKING(for %lld and %llu printf() format support)
+-  AC_CACHE_VAL(ac_cv_have_long_long_format,
+-  AC_RUN_IFELSE([AC_LANG_SOURCE([[[
+-  #include <stdio.h>
+-  #include <stddef.h>
+-  #include <string.h>
+-
+-  #ifdef HAVE_SYS_TYPES_H
+-  #include <sys/types.h>
+-  #endif
+-
+-  int main()
+-  {
+-      char buffer[256];
+-
+-      if (sprintf(buffer, "%lld", (long long)123) < 0)
+-          return 1;
+-      if (strcmp(buffer, "123"))
+-          return 1;
+-
+-      if (sprintf(buffer, "%lld", (long long)-123) < 0)
+-          return 1;
+-      if (strcmp(buffer, "-123"))
+-          return 1;
+-
+-      if (sprintf(buffer, "%llu", (unsigned long long)123) < 0)
+-          return 1;
+-      if (strcmp(buffer, "123"))
+-          return 1;
+-
+-      return 0;
+-  }
+-  ]]])],
+-  [ac_cv_have_long_long_format=yes],
+-  [ac_cv_have_long_long_format=no],
+-  [ac_cv_have_long_long_format=no])
+-  )
+-  AC_MSG_RESULT($ac_cv_have_long_long_format)
+-fi
+-
+-if test "$ac_cv_have_long_long_format" = yes
+-then
+-  AC_DEFINE(PY_FORMAT_LONG_LONG, "ll",
+-  [Define to printf format modifier for long long type])
+-fi
+-
+-if test $ac_sys_system = Darwin
+-then
+-	LIBS="$LIBS -framework CoreFoundation"
+-fi
+-
+-
+-AC_CACHE_CHECK([for %zd printf() format support], ac_cv_have_size_t_format, [dnl
+-AC_RUN_IFELSE([AC_LANG_SOURCE([[
+-#include <stdio.h>
+-#include <stddef.h>
+-#include <string.h>
+-
+-#ifdef HAVE_SYS_TYPES_H
+-#include <sys/types.h>
+-#endif
+-
+-#ifdef HAVE_SSIZE_T
+-typedef ssize_t Py_ssize_t;
+-#elif SIZEOF_VOID_P == SIZEOF_LONG
+-typedef long Py_ssize_t;
+-#else
+-typedef int Py_ssize_t;
+-#endif
+-
+-int main()
+-{
+-    char buffer[256];
+-
+-    if(sprintf(buffer, "%zd", (size_t)123) < 0)
+-       	return 1;
+-
+-    if (strcmp(buffer, "123"))
+-	return 1;
+-
+-    if (sprintf(buffer, "%zd", (Py_ssize_t)-123) < 0)
+-       	return 1;
+-
+-    if (strcmp(buffer, "-123"))
+-	return 1;
+-
+-    return 0;
+-}
+-]])],
+-[ac_cv_have_size_t_format=yes],
+-[ac_cv_have_size_t_format=no],
+-[ac_cv_have_size_t_format="cross -- assuming yes"
+-])])
+-if test "$ac_cv_have_size_t_format" != no ; then
+-  AC_DEFINE(PY_FORMAT_SIZE_T, "z",
+-  [Define to printf format modifier for Py_ssize_t])
+-fi
+-
+-AC_CHECK_TYPE(socklen_t,,
+-  AC_DEFINE(socklen_t,int,
+-            [Define to `int' if <sys/socket.h> does not define.]),[
+-#ifdef HAVE_SYS_TYPES_H
+-#include <sys/types.h>
+-#endif
+-#ifdef HAVE_SYS_SOCKET_H
+-#include <sys/socket.h>
+-#endif
+-])
+-
+-case $ac_sys_system in
+-AIX*)
+-  AC_DEFINE(HAVE_BROKEN_PIPE_BUF, 1, [Define if the system reports an invalid PIPE_BUF value.]) ;;
+-esac
+-
+-
+-AC_SUBST(THREADHEADERS)
+-
+-for h in `(cd $srcdir;echo Python/thread_*.h)`
+-do
+-  THREADHEADERS="$THREADHEADERS \$(srcdir)/$h"
+-done
+-
+-AC_SUBST(SRCDIRS)
+-SRCDIRS="Parser Grammar Objects Python Modules Mac"
+-AC_MSG_CHECKING(for build directories)
+-for dir in $SRCDIRS; do
+-    if test ! -d $dir; then
+-        mkdir $dir
+-    fi
+-done
+-AC_MSG_RESULT(done)
+-
+-# generate output files
+-AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc)
+-AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix])
+-AC_OUTPUT
+-
+-echo "creating Modules/Setup"
+-if test ! -f Modules/Setup
+-then
+-	cp $srcdir/Modules/Setup.dist Modules/Setup
+-fi
+-
+-echo "creating Modules/Setup.local"
+-if test ! -f Modules/Setup.local
+-then
+-	echo "# Edit this file for local setup changes" >Modules/Setup.local
+-fi
+-
+-echo "creating Makefile"
+-$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
+-			-s Modules Modules/Setup.config \
+-			Modules/Setup.local Modules/Setup
+-
+-case $ac_sys_system in
+-BeOS)
+-        AC_MSG_WARN([
+-
+-  Support for BeOS is deprecated as of Python 2.6.
+-  See PEP 11 for the gory details.
+-  ])
+-  ;;
+-*) ;;
+-esac
+-
+-mv config.c Modules
+diff -r 70274d53c1dd pyconfig.h.in
+--- a/pyconfig.h.in
++++ b/pyconfig.h.in
+@@ -1,4 +1,4 @@
+-/* pyconfig.h.in.  Generated from configure.in by autoheader.  */
++/* pyconfig.h.in.  Generated from configure.ac by autoheader.  */
+ 
+ 
+ #ifndef Py_PYCONFIG_H
+diff -r 70274d53c1dd setup.py
+--- a/setup.py
++++ b/setup.py
+@@ -48,6 +48,9 @@
+     Returns True if 'path' can be located in an OSX SDK
+     """
+     return (path.startswith('/usr/') and not path.startswith('/usr/local')) or path.startswith('/System/')
++    return ( (path.startswith('/usr/') and not path.startswith('/usr/local'))
++                or path.startswith('/System/')
++                or path.startswith('/Library/') )
+ 
+ def find_file(filename, std_dirs, paths):
+     """Searches for the directory where a given file is located,
+@@ -186,7 +189,7 @@
+ 
+         # Python header files
+         headers = [sysconfig.get_config_h_filename()]
+-        headers += glob(os.path.join(sysconfig.get_path('platinclude'), "*.h"))
++        headers += glob(os.path.join(sysconfig.get_path('include'), "*.h"))
+         for ext in self.extensions[:]:
+             ext.sources = [ find_module_file(filename, moddirlist)
+                             for filename in ext.sources ]
+@@ -451,6 +454,10 @@
+         if platform in ['osf1', 'unixware7', 'openunix8']:
+             lib_dirs += ['/usr/ccs/lib']
+ 
++        # HP-UX11iv3 keeps files in lib/hpux folders.
++        if platform == 'hp-ux11':
++            lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32']
++
+         if platform == 'darwin':
+             # This should work on any unixy platform ;-)
+             # If the user has bothered specifying additional -I and -L flags
+@@ -1021,12 +1028,12 @@
+         if sys.platform == 'darwin':
+             sysroot = macosx_sdk_root()
+ 
+-        for d in inc_dirs + sqlite_inc_paths:
++        for d_ in inc_dirs + sqlite_inc_paths:
++            d = d_
++            if sys.platform == 'darwin' and is_macosx_sdk_path(d):
++                d = os.path.join(sysroot, d[1:])
++
+             f = os.path.join(d, "sqlite3.h")
+-
+-            if sys.platform == 'darwin' and is_macosx_sdk_path(d):
+-                f = os.path.join(sysroot, d[1:], "sqlite3.h")
+-
+             if os.path.exists(f):
+                 if sqlite_setup_debug: print "sqlite: found %s"%f
+                 incf = open(f).read()
+@@ -1154,10 +1161,14 @@
+             for cand in dbm_order:
+                 if cand == "ndbm":
+                     if find_file("ndbm.h", inc_dirs, []) is not None:
+-                        # Some systems have -lndbm, others don't
++                        # Some systems have -lndbm, others have -lgdbm_compat,
++                        # others don't have either
+                         if self.compiler.find_library_file(lib_dirs,
+                                                                'ndbm'):
+                             ndbm_libs = ['ndbm']
++                        elif self.compiler.find_library_file(lib_dirs,
++                                                             'gdbm_compat'):
++                            ndbm_libs = ['gdbm_compat']
+                         else:
+                             ndbm_libs = []
+                         print "building dbm using ndbm"
--- python2.7-2.7.3.orig/debian/patches/plat-linux2_mips.diff
+++ python2.7-2.7.3/debian/patches/plat-linux2_mips.diff
@@ -0,0 +1,88 @@
+Index: Lib/plat-linux2/DLFCN.py
+===================================================================
+--- ./Lib/plat-linux2/DLFCN.py	(Revision 77754)
++++ ./Lib/plat-linux2/DLFCN.py	(Arbeitskopie)
+@@ -77,7 +77,7 @@
+ RTLD_LAZY = 0x00001
+ RTLD_NOW = 0x00002
+ RTLD_BINDING_MASK = 0x3
+-RTLD_NOLOAD = 0x00004
+-RTLD_GLOBAL = 0x00100
++RTLD_NOLOAD = 0x00008
++RTLD_GLOBAL = 0x00004
+ RTLD_LOCAL = 0
+ RTLD_NODELETE = 0x01000
+Index: Lib/plat-linux2/IN.py
+===================================================================
+--- ./Lib/plat-linux2/IN.py	(Revision 77754)
++++ ./Lib/plat-linux2/IN.py	(Arbeitskopie)
+@@ -436,33 +436,33 @@
+ # Included from asm/socket.h
+ 
+ # Included from asm/sockios.h
+-FIOSETOWN = 0x8901
+-SIOCSPGRP = 0x8902
+-FIOGETOWN = 0x8903
+-SIOCGPGRP = 0x8904
+-SIOCATMARK = 0x8905
++FIOSETOWN = 0x8004667c
++SIOCSPGRP = 0x80047308
++FIOGETOWN = 0x4004667b
++SIOCGPGRP = 0x40047309
++SIOCATMARK = 0x40047307
+ SIOCGSTAMP = 0x8906
+-SOL_SOCKET = 1
+-SO_DEBUG = 1
+-SO_REUSEADDR = 2
+-SO_TYPE = 3
+-SO_ERROR = 4
+-SO_DONTROUTE = 5
+-SO_BROADCAST = 6
+-SO_SNDBUF = 7
+-SO_RCVBUF = 8
+-SO_KEEPALIVE = 9
+-SO_OOBINLINE = 10
++SOL_SOCKET = 0xffff
++SO_DEBUG = 0x0001
++SO_REUSEADDR = 0x0004
++SO_TYPE = 0x1008
++SO_ERROR = 0x1007
++SO_DONTROUTE = 0x0010
++SO_BROADCAST = 0x0020
++SO_SNDBUF = 0x1001
++SO_RCVBUF = 0x1002
++SO_KEEPALIVE = 0x0008
++SO_OOBINLINE = 0x0100
+ SO_NO_CHECK = 11
+ SO_PRIORITY = 12
+-SO_LINGER = 13
++SO_LINGER = 0x0080
+ SO_BSDCOMPAT = 14
+-SO_PASSCRED = 16
+-SO_PEERCRED = 17
+-SO_RCVLOWAT = 18
+-SO_SNDLOWAT = 19
+-SO_RCVTIMEO = 20
+-SO_SNDTIMEO = 21
++SO_PASSCRED = 17
++SO_PEERCRED = 18
++SO_RCVLOWAT = 0x1004
++SO_SNDLOWAT = 0x1003
++SO_RCVTIMEO = 0x1006
++SO_SNDTIMEO = 0x1005
+ SO_SECURITY_AUTHENTICATION = 22
+ SO_SECURITY_ENCRYPTION_TRANSPORT = 23
+ SO_SECURITY_ENCRYPTION_NETWORK = 24
+@@ -472,9 +472,9 @@
+ SO_PEERNAME = 28
+ SO_TIMESTAMP = 29
+ SCM_TIMESTAMP = SO_TIMESTAMP
+-SO_ACCEPTCONN = 30
+-SOCK_STREAM = 1
+-SOCK_DGRAM = 2
++SO_ACCEPTCONN = 0x1009
++SOCK_STREAM = 2
++SOCK_DGRAM = 1
+ SOCK_RAW = 3
+ SOCK_RDM = 4
+ SOCK_SEQPACKET = 5
--- python2.7-2.7.3.orig/debian/patches/link-opt.diff
+++ python2.7-2.7.3/debian/patches/link-opt.diff
@@ -0,0 +1,24 @@
+# DP: Call the linker with -O1 -Bsymbolic-functions
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -1866,8 +1866,8 @@
+ 		fi
+ 		;;
+ 	Linux*|GNU*|QNX*)
+-		LDSHARED='$(CC) -shared'
+-		LDCXXSHARED='$(CXX) -shared';;
++		LDSHARED='$(CC) -shared -Wl,-O1 -Wl,-Bsymbolic-functions'
++		LDCXXSHARED='$(CXX) -shared -Wl,-O1 -Wl,-Bsymbolic-functions';;
+ 	BSD/OS*/4*)
+ 		LDSHARED="gcc -shared"
+ 		LDCXXSHARED="g++ -shared";;
+@@ -1969,7 +1969,7 @@
+ 	    LINKFORSHARED="-Wl,-E -Wl,+s";;
+ #	    LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
+ 	BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
+-	Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
++	Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions";;
+ 	# -u libsys_s pulls in all symbols in libsys
+ 	Darwin/*) 
+ 		# -u _PyMac_Error is needed to pull in the mac toolbox glue,
--- python2.7-2.7.3.orig/debian/patches/revert-issue14635.diff
+++ python2.7-2.7.3/debian/patches/revert-issue14635.diff
@@ -0,0 +1,294 @@
+diff -urN a/Lib/telnetlib.py b/Lib/telnetlib.py
+--- a/Lib/telnetlib.py	2012-12-25 13:41:08.467405725 +0100
++++ b/Lib/telnetlib.py	2012-12-25 14:00:31.339404759 +0100
+@@ -34,7 +34,6 @@
+ 
+ 
+ # Imported modules
+-import errno
+ import sys
+ import socket
+ import select
+@@ -206,7 +205,6 @@
+         self.sb = 0 # flag for SB and SE sequence.
+         self.sbdataq = ''
+         self.option_callback = None
+-        self._has_poll = hasattr(select, 'poll')
+         if host is not None:
+             self.open(host, port, timeout)
+ 
+@@ -289,61 +287,6 @@
+         is closed and no cooked data is available.
+ 
+         """
+-        if self._has_poll:
+-            return self._read_until_with_poll(match, timeout)
+-        else:
+-            return self._read_until_with_select(match, timeout)
+-
+-    def _read_until_with_poll(self, match, timeout):
+-        """Read until a given string is encountered or until timeout.
+-
+-        This method uses select.poll() to implement the timeout.
+-        """
+-        n = len(match)
+-        call_timeout = timeout
+-        if timeout is not None:
+-            from time import time
+-            time_start = time()
+-        self.process_rawq()
+-        i = self.cookedq.find(match)
+-        if i < 0:
+-            poller = select.poll()
+-            poll_in_or_priority_flags = select.POLLIN | select.POLLPRI
+-            poller.register(self, poll_in_or_priority_flags)
+-            while i < 0 and not self.eof:
+-                try:
+-                    ready = poller.poll(call_timeout)
+-                except select.error as e:
+-                    if e.errno == errno.EINTR:
+-                        if timeout is not None:
+-                            elapsed = time() - time_start
+-                            call_timeout = timeout-elapsed
+-                        continue
+-                    raise
+-                for fd, mode in ready:
+-                    if mode & poll_in_or_priority_flags:
+-                        i = max(0, len(self.cookedq)-n)
+-                        self.fill_rawq()
+-                        self.process_rawq()
+-                        i = self.cookedq.find(match, i)
+-                if timeout is not None:
+-                    elapsed = time() - time_start
+-                    if elapsed >= timeout:
+-                        break
+-                    call_timeout = timeout-elapsed
+-            poller.unregister(self)
+-        if i >= 0:
+-            i = i + n
+-            buf = self.cookedq[:i]
+-            self.cookedq = self.cookedq[i:]
+-            return buf
+-        return self.read_very_lazy()
+-
+-    def _read_until_with_select(self, match, timeout=None):
+-        """Read until a given string is encountered or until timeout.
+-
+-        The timeout is implemented using select.select().
+-        """
+         n = len(match)
+         self.process_rawq()
+         i = self.cookedq.find(match)
+@@ -646,79 +589,6 @@
+         results are undeterministic, and may depend on the I/O timing.
+ 
+         """
+-        if self._has_poll:
+-            return self._expect_with_poll(list, timeout)
+-        else:
+-            return self._expect_with_select(list, timeout)
+-
+-    def _expect_with_poll(self, expect_list, timeout=None):
+-        """Read until one from a list of a regular expressions matches.
+-
+-        This method uses select.poll() to implement the timeout.
+-        """
+-        re = None
+-        expect_list = expect_list[:]
+-        indices = range(len(expect_list))
+-        for i in indices:
+-            if not hasattr(expect_list[i], "search"):
+-                if not re: import re
+-                expect_list[i] = re.compile(expect_list[i])
+-        call_timeout = timeout
+-        if timeout is not None:
+-            from time import time
+-            time_start = time()
+-        self.process_rawq()
+-        m = None
+-        for i in indices:
+-            m = expect_list[i].search(self.cookedq)
+-            if m:
+-                e = m.end()
+-                text = self.cookedq[:e]
+-                self.cookedq = self.cookedq[e:]
+-                break
+-        if not m:
+-            poller = select.poll()
+-            poll_in_or_priority_flags = select.POLLIN | select.POLLPRI
+-            poller.register(self, poll_in_or_priority_flags)
+-            while not m and not self.eof:
+-                try:
+-                    ready = poller.poll(call_timeout)
+-                except select.error as e:
+-                    if e.errno == errno.EINTR:
+-                        if timeout is not None:
+-                            elapsed = time() - time_start
+-                            call_timeout = timeout-elapsed
+-                        continue
+-                    raise
+-                for fd, mode in ready:
+-                    if mode & poll_in_or_priority_flags:
+-                        self.fill_rawq()
+-                        self.process_rawq()
+-                        for i in indices:
+-                            m = expect_list[i].search(self.cookedq)
+-                            if m:
+-                                e = m.end()
+-                                text = self.cookedq[:e]
+-                                self.cookedq = self.cookedq[e:]
+-                                break
+-                if timeout is not None:
+-                    elapsed = time() - time_start
+-                    if elapsed >= timeout:
+-                        break
+-                    call_timeout = timeout-elapsed
+-            poller.unregister(self)
+-        if m:
+-            return (i, m, text)
+-        text = self.read_very_lazy()
+-        if not text and self.eof:
+-            raise EOFError
+-        return (-1, None, text)
+-
+-    def _expect_with_select(self, list, timeout=None):
+-        """Read until one from a list of a regular expressions matches.
+-
+-        The timeout is implemented using select.select().
+-        """
+         re = None
+         list = list[:]
+         indices = range(len(list))
+diff -urN a/Lib/test/test_telnetlib.py b/Lib/test/test_telnetlib.py
+--- a/Lib/test/test_telnetlib.py	2012-12-25 13:41:08.499405725 +0100
++++ b/Lib/test/test_telnetlib.py	2012-12-25 14:00:31.339404759 +0100
+@@ -136,28 +136,6 @@
+         self.assertEqual(data, want[0])
+         self.assertEqual(telnet.read_all(), 'not seen')
+ 
+-    def test_read_until_with_poll(self):
+-        """Use select.poll() to implement telnet.read_until()."""
+-        want = ['x' * 10, 'match', 'y' * 10, EOF_sigil]
+-        self.dataq.put(want)
+-        telnet = telnetlib.Telnet(HOST, self.port)
+-        if not telnet._has_poll:
+-            raise unittest.SkipTest('select.poll() is required')
+-        telnet._has_poll = True
+-        self.dataq.join()
+-        data = telnet.read_until('match')
+-        self.assertEqual(data, ''.join(want[:-2]))
+-
+-    def test_read_until_with_select(self):
+-        """Use select.select() to implement telnet.read_until()."""
+-        want = ['x' * 10, 'match', 'y' * 10, EOF_sigil]
+-        self.dataq.put(want)
+-        telnet = telnetlib.Telnet(HOST, self.port)
+-        telnet._has_poll = False
+-        self.dataq.join()
+-        data = telnet.read_until('match')
+-        self.assertEqual(data, ''.join(want[:-2]))
+-
+     def test_read_all_A(self):
+         """
+         read_all()
+@@ -380,75 +358,8 @@
+         self.assertEqual('', telnet.read_sb_data())
+         nego.sb_getter = None # break the nego => telnet cycle
+ 
+-
+-class ExpectTests(TestCase):
+-    def setUp(self):
+-        self.evt = threading.Event()
+-        self.dataq = Queue.Queue()
+-        self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+-        self.sock.settimeout(10)
+-        self.port = test_support.bind_port(self.sock)
+-        self.thread = threading.Thread(target=server, args=(self.evt,self.sock,
+-                                                            self.dataq))
+-        self.thread.start()
+-        self.evt.wait()
+-
+-    def tearDown(self):
+-        self.thread.join()
+-
+-    # use a similar approach to testing timeouts as test_timeout.py
+-    # these will never pass 100% but make the fuzz big enough that it is rare
+-    block_long = 0.6
+-    block_short = 0.3
+-    def test_expect_A(self):
+-        """
+-        expect(expected, [timeout])
+-          Read until the expected string has been seen, or a timeout is
+-          hit (default is no timeout); may block.
+-        """
+-        want = ['x' * 10, 'match', 'y' * 10, EOF_sigil]
+-        self.dataq.put(want)
+-        telnet = telnetlib.Telnet(HOST, self.port)
+-        self.dataq.join()
+-        (_,_,data) = telnet.expect(['match'])
+-        self.assertEqual(data, ''.join(want[:-2]))
+-
+-    def test_expect_B(self):
+-        # test the timeout - it does NOT raise socket.timeout
+-        want = ['hello', self.block_long, 'not seen', EOF_sigil]
+-        self.dataq.put(want)
+-        telnet = telnetlib.Telnet(HOST, self.port)
+-        self.dataq.join()
+-        (_,_,data) = telnet.expect(['not seen'], self.block_short)
+-        self.assertEqual(data, want[0])
+-        self.assertEqual(telnet.read_all(), 'not seen')
+-
+-    def test_expect_with_poll(self):
+-        """Use select.poll() to implement telnet.expect()."""
+-        want = ['x' * 10, 'match', 'y' * 10, EOF_sigil]
+-        self.dataq.put(want)
+-        telnet = telnetlib.Telnet(HOST, self.port)
+-        if not telnet._has_poll:
+-            raise unittest.SkipTest('select.poll() is required')
+-        telnet._has_poll = True
+-        self.dataq.join()
+-        (_,_,data) = telnet.expect(['match'])
+-        self.assertEqual(data, ''.join(want[:-2]))
+-
+-    def test_expect_with_select(self):
+-        """Use select.select() to implement telnet.expect()."""
+-        want = ['x' * 10, 'match', 'y' * 10, EOF_sigil]
+-        self.dataq.put(want)
+-        telnet = telnetlib.Telnet(HOST, self.port)
+-        telnet._has_poll = False
+-        self.dataq.join()
+-        (_,_,data) = telnet.expect(['match'])
+-        self.assertEqual(data, ''.join(want[:-2]))
+-
+-
+ def test_main(verbose=None):
+-    test_support.run_unittest(GeneralTests, ReadTests, OptionTests,
+-                              ExpectTests)
++    test_support.run_unittest(GeneralTests, ReadTests, OptionTests)
+ 
+ if __name__ == '__main__':
+     test_main()
+diff -urN a/Misc/ACKS b/Misc/ACKS
+--- a/Misc/ACKS	2012-12-25 13:48:09.675405378 +0100
++++ b/Misc/ACKS	2012-12-25 14:00:31.339404759 +0100
+@@ -372,7 +372,6 @@
+ Albert Hofkamp
+ Tomas Hoger
+ Jonathan Hogg
+-Akintayo Holder
+ Gerrit Holl
+ Shane Holloway
+ Rune Holm
+diff -urN a/Misc/NEWS b/Misc/NEWS
+--- a/Misc/NEWS	2012-12-25 13:48:48.947405345 +0100
++++ b/Misc/NEWS	2012-12-25 14:00:31.347404759 +0100
+@@ -123,9 +123,6 @@
+ - Issue #6493: An issue in ctypes on Windows that caused structure bitfields
+   of type ctypes.c_uint32 and width 32 to incorrectly be set has been fixed.
+ 
+-- Issue #14635: telnetlib will use poll() rather than select() when possible
+-  to avoid failing due to the select() file descriptor limit.
+-
+ - Issue #15247: FileIO now raises an error when given a file descriptor
+   pointing to a directory.
+ 
--- python2.7-2.7.3.orig/debian/patches/tkinter-import.diff
+++ python2.7-2.7.3/debian/patches/tkinter-import.diff
@@ -0,0 +1,16 @@
+# DP: suggest installation of python-tk package on failing _tkinter import
+
+--- a/Lib/lib-tk/Tkinter.py
++++ b/Lib/lib-tk/Tkinter.py
+@@ -36,7 +36,10 @@
+ if sys.platform == "win32":
+     # Attempt to configure Tcl/Tk without requiring PATH
+     import FixTk
+-import _tkinter # If this fails your Python may not be configured for Tk
++try:
++    import _tkinter
++except ImportError, msg:
++    raise ImportError, str(msg) + ', please install the python-tk package'
+ tkinter = _tkinter # b/w compat for export
+ TclError = _tkinter.TclError
+ from types import *
--- python2.7-2.7.3.orig/debian/patches/CVE-2016-0772.diff
+++ python2.7-2.7.3/debian/patches/CVE-2016-0772.diff
@@ -0,0 +1,37 @@
+
+# HG changeset patch
+# User Benjamin Peterson <benjamin@python.org>
+# Date 1465676202 25200
+# Node ID b3ce713fb9beebfff9848cefa0acbd59acc68fe9
+# Parent  3017e41b0c99d24e88faf1de447f230e2f64d122
+raise an error when STARTTLS fails
+
+diff --git a/Lib/smtplib.py b/Lib/smtplib.py
+--- a/Lib/smtplib.py
++++ b/Lib/smtplib.py
+@@ -656,6 +656,11 @@ class SMTP:
+             self.ehlo_resp = None
+             self.esmtp_features = {}
+             self.does_esmtp = 0
++        else:
++            # RFC 3207:
++            # 501 Syntax error (no parameters allowed)
++            # 454 TLS not available due to temporary reason
++            raise SMTPResponseException(resp, reply)
+         return (resp, reply)
+ 
+     def sendmail(self, from_addr, to_addrs, msg, mail_options=[],
+diff --git a/Misc/NEWS b/Misc/NEWS
+--- a/Misc/NEWS
++++ b/Misc/NEWS
+@@ -92,6 +92,9 @@ Core and Builtins
+ Library
+ -------
+ 
++- Fix TLS stripping vulnerability in smptlib, CVE-2016-0772.  Reported by Team
++  Oststrom
++
+ - Issue #7356: ctypes.util: Make parsing of ldconfig output independent of the
+   locale.
+ 
+
--- python2.7-2.7.3.orig/debian/patches/enable-fpectl.diff
+++ python2.7-2.7.3/debian/patches/enable-fpectl.diff
@@ -0,0 +1,14 @@
+# DP: Enable the build of the fpectl module.
+
+--- a/setup.py
++++ b/setup.py
+@@ -1276,6 +1276,9 @@
+         else:
+             missing.append('_curses_panel')
+ 
++        #fpectl fpectlmodule.c ...
++        exts.append( Extension('fpectl', ['fpectlmodule.c']) )
++
+         # Andrew Kuchling's zlib module.  Note that some versions of zlib
+         # 1.1.3 have security problems.  See CERT Advisory CA-2002-07:
+         # http://www.cert.org/advisories/CA-2002-07.html
--- python2.7-2.7.3.orig/debian/patches/debug-build.diff
+++ python2.7-2.7.3/debian/patches/debug-build.diff
@@ -0,0 +1,228 @@
+# DP: Change the interpreter to build and install python extensions
+# DP: built with the python-dbg interpreter with a different name into
+# DP: the same path (by appending `_d' to the extension name).
+
+--- a/Lib/distutils/command/build.py
++++ b/Lib/distutils/command/build.py
+@@ -91,7 +91,8 @@
+         # 'lib.<plat>' under the base build directory.  We only use one of
+         # them for a given distribution, though --
+         if self.build_purelib is None:
+-            self.build_purelib = os.path.join(self.build_base, 'lib')
++            self.build_purelib = os.path.join(self.build_base,
++                                              'lib' + plat_specifier)
+         if self.build_platlib is None:
+             self.build_platlib = os.path.join(self.build_base,
+                                               'lib' + plat_specifier)
+--- a/Lib/distutils/sysconfig.py
++++ b/Lib/distutils/sysconfig.py
+@@ -85,7 +85,7 @@
+                 # Include is located in the srcdir
+                 inc_dir = os.path.join(srcdir, "Include")
+             return inc_dir
+-        return os.path.join(prefix, "include", "python" + get_python_version())
++        return os.path.join(prefix, "include", "python" + get_python_version())+(sys.pydebug and "_d" or "")
+     elif os.name == "nt":
+         return os.path.join(prefix, "include")
+     elif os.name == "os2":
+@@ -216,7 +216,7 @@
+     if python_build:
+         return os.path.join(os.path.dirname(sys.executable), "Makefile")
+     lib_dir = get_python_lib(plat_specific=1, standard_lib=1)
+-    return os.path.join(lib_dir, "config", "Makefile")
++    return os.path.join(lib_dir, "config"+(sys.pydebug and "_d" or ""), "Makefile")
+ 
+ 
+ def parse_config_h(fp, g=None):
+--- a/Lib/sysconfig.py
++++ b/Lib/sysconfig.py
+@@ -299,7 +299,7 @@
+ def _get_makefile_filename():
+     if _PYTHON_BUILD:
+         return os.path.join(_PROJECT_BASE, "Makefile")
+-    return os.path.join(get_path('platstdlib').replace("/usr/local","/usr",1), "config", "Makefile")
++    return os.path.join(get_path('platstdlib').replace("/usr/local","/usr",1), "config" + (sys.pydebug and "_d" or ""), "Makefile")
+ 
+ 
+ def _init_posix(vars):
+@@ -384,7 +384,7 @@
+         else:
+             inc_dir = _PROJECT_BASE
+     else:
+-        inc_dir = get_path('platinclude').replace("/usr/local","/usr",1)
++        inc_dir = get_path('platinclude').replace("/usr/local","/usr",1)+(sys.pydebug and "_d" or "")
+     return os.path.join(inc_dir, 'pyconfig.h')
+ 
+ def get_scheme_names():
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -108,8 +108,8 @@
+ # Detailed destination directories
+ BINLIBDEST=	$(LIBDIR)/python$(VERSION)
+ LIBDEST=	$(SCRIPTDIR)/python$(VERSION)
+-INCLUDEPY=	$(INCLUDEDIR)/python$(VERSION)
+-CONFINCLUDEPY=	$(CONFINCLUDEDIR)/python$(VERSION)
++INCLUDEPY=	$(INCLUDEDIR)/python$(VERSION)$(DEBUG_EXT)
++CONFINCLUDEPY=	$(CONFINCLUDEDIR)/python$(VERSION)$(DEBUG_EXT)
+ LIBP=		$(LIBDIR)/python$(VERSION)
+ 
+ # Symbols used for using shared libraries
+@@ -123,6 +123,8 @@
+ EXE=		@EXEEXT@
+ BUILDEXE=	@BUILDEXEEXT@
+ 
++DEBUG_EXT=	@DEBUG_EXT@
++
+ # Short name and location for Mac OS X Python framework
+ UNIVERSALSDK=@UNIVERSALSDK@
+ PYTHONFRAMEWORK=	@PYTHONFRAMEWORK@
+@@ -429,7 +431,7 @@
+ 	$(AR) $(ARFLAGS) $@ $(MODOBJS)
+ 	$(RANLIB) $@
+ 
+-libpython$(VERSION).so: $(LIBRARY_OBJS)
++libpython$(VERSION)$(DEBUG_EXT).so: $(LIBRARY_OBJS)
+ 	if test $(INSTSONAME) != $(LDLIBRARY); then \
+ 		$(BLDSHARED) $(PY_LDFLAGS) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
+ 		$(LN) -f $(INSTSONAME) $@; \
+@@ -990,8 +992,8 @@
+ 	$(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
+ 
+ # Install the library and miscellaneous stuff needed for extending/embedding
+-# This goes into $(exec_prefix)
+-LIBPL=		$(LIBP)/config
++# This goes into $(exec_prefix)$(DEBUG_EXT)
++LIBPL=		$(LIBP)/config$(DEBUG_EXT)
+ 
+ # pkgconfig directory
+ LIBPC=		$(LIBDIR)/pkgconfig
+--- a/Misc/python-config.in
++++ b/Misc/python-config.in
+@@ -45,7 +45,7 @@
+ 
+     elif opt in ('--libs', '--ldflags'):
+         libs = getvar('LIBS').split() + getvar('SYSLIBS').split()
+-        libs.append('-lpython'+pyver)
++        libs.append('-lpython' + pyver + (sys.pydebug and "_d" or ""))
+         # add the prefix/lib/pythonX.Y/config dir, but only if there is no
+         # shared library in prefix/lib/.
+         if opt == '--ldflags':
+--- a/Python/dynload_shlib.c
++++ b/Python/dynload_shlib.c
+@@ -46,6 +46,10 @@
+     {"module.exe", "rb", C_EXTENSION},
+     {"MODULE.EXE", "rb", C_EXTENSION},
+ #else
++#ifdef Py_DEBUG
++    {"_d.so", "rb", C_EXTENSION},
++    {"module_d.so", "rb", C_EXTENSION},
++#endif
+     {".so", "rb", C_EXTENSION},
+     {"module.so", "rb", C_EXTENSION},
+ #endif
+--- a/Python/sysmodule.c
++++ b/Python/sysmodule.c
+@@ -1504,6 +1504,12 @@
+                         PyString_FromString("legacy"));
+ #endif
+ 
++#ifdef Py_DEBUG
++	PyDict_SetItemString(sysdict, "pydebug", Py_True);
++#else
++	PyDict_SetItemString(sysdict, "pydebug", Py_False);
++#endif
++
+ #undef SET_SYS_FROM_STRING
+     if (PyErr_Occurred())
+         return NULL;
+--- a/configure.ac
++++ b/configure.ac
+@@ -634,7 +634,7 @@
+ AC_MSG_CHECKING(LIBRARY)
+ if test -z "$LIBRARY"
+ then
+-	LIBRARY='libpython$(VERSION).a'
++	LIBRARY='libpython$(VERSION)$(DEBUG_EXT).a'
+ fi
+ AC_MSG_RESULT($LIBRARY)
+ 
+@@ -779,8 +779,8 @@
+ 	  INSTSONAME="$LDLIBRARY".$SOVERSION
+           ;;
+     Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*)
+-	  LDLIBRARY='libpython$(VERSION).so'
+-	  BLDLIBRARY='-L. -lpython$(VERSION)'
++	  LDLIBRARY='libpython$(VERSION)$(DEBUG_EXT).so'
++	  BLDLIBRARY='-L. -lpython$(VERSION)$(DEBUG_EXT)'
+ 	  RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
+ 	  case $ac_sys_system in
+ 	      FreeBSD*)
+@@ -904,6 +904,12 @@
+ fi],
+ [AC_MSG_RESULT(no)])
+ 
++if test "$Py_DEBUG" = 'true'
++then
++	DEBUG_EXT=_d
++fi
++AC_SUBST(DEBUG_EXT)
++
+ # XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be
+ # merged with this chunk of code?
+ 
+@@ -1759,7 +1765,7 @@
+ 		esac
+ 		;;
+ 	CYGWIN*)   SO=.dll;;
+-	*)	   SO=.so;;
++	*)	   SO=$DEBUG_EXT.so;;
+ 	esac
+ else
+ 	# this might also be a termcap variable, see #610332
+--- a/Lib/distutils/tests/test_build_ext.py
++++ b/Lib/distutils/tests/test_build_ext.py
+@@ -287,8 +287,8 @@
+         finally:
+             os.chdir(old_wd)
+         self.assertTrue(os.path.exists(so_file))
+-        self.assertEqual(os.path.splitext(so_file)[-1],
+-                         sysconfig.get_config_var('SO'))
++        so_ext = sysconfig.get_config_var('SO')
++        self.assertEqual(so_file[len(so_file)-len(so_ext):], so_ext)
+         so_dir = os.path.dirname(so_file)
+         self.assertEqual(so_dir, other_tmp_dir)
+         cmd.compiler = None
+@@ -296,8 +296,7 @@
+         cmd.run()
+         so_file = cmd.get_outputs()[0]
+         self.assertTrue(os.path.exists(so_file))
+-        self.assertEqual(os.path.splitext(so_file)[-1],
+-                         sysconfig.get_config_var('SO'))
++        self.assertEqual(so_file[len(so_file)-len(so_ext):], so_ext)
+         so_dir = os.path.dirname(so_file)
+         self.assertEqual(so_dir, cmd.build_lib)
+ 
+--- a/Lib/distutils/tests/test_build.py
++++ b/Lib/distutils/tests/test_build.py
+@@ -20,10 +20,6 @@
+         # if not specified, plat_name gets the current platform
+         self.assertEqual(cmd.plat_name, get_platform())
+ 
+-        # build_purelib is build + lib
+-        wanted = os.path.join(cmd.build_base, 'lib')
+-        self.assertEqual(cmd.build_purelib, wanted)
+-
+         # build_platlib is 'build/lib.platform-x.x[-pydebug]'
+         # examples:
+         #   build/lib.macosx-10.3-i386-2.7
+@@ -34,6 +30,10 @@
+         wanted = os.path.join(cmd.build_base, 'lib' + plat_spec)
+         self.assertEqual(cmd.build_platlib, wanted)
+ 
++        # build_purelib is build + lib
++        wanted = os.path.join(cmd.build_base, 'lib' + plat_spec)
++        self.assertEqual(cmd.build_purelib, wanted)
++
+         # by default, build_lib = build_purelib
+         self.assertEqual(cmd.build_lib, cmd.build_purelib)
+ 
--- python2.7-2.7.3.orig/debian/patches/plat-gnukfreebsd.diff
+++ python2.7-2.7.3/debian/patches/plat-gnukfreebsd.diff
@@ -0,0 +1,2478 @@
+--- /dev/null
++++ b/Lib/plat-gnukfreebsd7/IN.py
+@@ -0,0 +1,809 @@
++# Generated by h2py from /usr/include/netinet/in.h
++_NETINET_IN_H = 1
++
++# Included from features.h
++_FEATURES_H = 1
++__USE_ANSI = 1
++__FAVOR_BSD = 1
++_ISOC99_SOURCE = 1
++_POSIX_SOURCE = 1
++_POSIX_C_SOURCE = 200809L
++_XOPEN_SOURCE = 700
++_XOPEN_SOURCE_EXTENDED = 1
++_LARGEFILE64_SOURCE = 1
++_BSD_SOURCE = 1
++_SVID_SOURCE = 1
++_ATFILE_SOURCE = 1
++_BSD_SOURCE = 1
++_SVID_SOURCE = 1
++__USE_ISOC99 = 1
++__USE_ISOC95 = 1
++_POSIX_SOURCE = 1
++_POSIX_C_SOURCE = 2
++_POSIX_C_SOURCE = 199506L
++_POSIX_C_SOURCE = 200112L
++_POSIX_C_SOURCE = 200809L
++__USE_POSIX_IMPLICITLY = 1
++__USE_POSIX = 1
++__USE_POSIX2 = 1
++__USE_POSIX199309 = 1
++__USE_POSIX199506 = 1
++__USE_XOPEN2K = 1
++__USE_ISOC99 = 1
++__USE_XOPEN2K8 = 1
++_ATFILE_SOURCE = 1
++__USE_XOPEN = 1
++__USE_XOPEN_EXTENDED = 1
++__USE_UNIX98 = 1
++_LARGEFILE_SOURCE = 1
++__USE_XOPEN2K8 = 1
++__USE_XOPEN2K = 1
++__USE_ISOC99 = 1
++__USE_XOPEN_EXTENDED = 1
++__USE_LARGEFILE = 1
++__USE_LARGEFILE64 = 1
++__USE_FILE_OFFSET64 = 1
++__USE_MISC = 1
++__USE_BSD = 1
++__USE_SVID = 1
++__USE_ATFILE = 1
++__USE_GNU = 1
++__USE_REENTRANT = 1
++__USE_FORTIFY_LEVEL = 2
++__USE_FORTIFY_LEVEL = 1
++__USE_FORTIFY_LEVEL = 0
++
++# Included from bits/predefs.h
++__STDC_IEC_559__ = 1
++__STDC_IEC_559_COMPLEX__ = 1
++__STDC_ISO_10646__ = 200009L
++__GNU_LIBRARY__ = 6
++__GLIBC__ = 2
++__GLIBC_MINOR__ = 11
++__GLIBC_HAVE_LONG_LONG = 1
++
++# Included from sys/cdefs.h
++_SYS_CDEFS_H = 1
++def __NTH(fct): return fct
++
++def __NTH(fct): return fct
++
++def __P(args): return args
++
++def __PMT(args): return args
++
++def __STRING(x): return #x
++
++def __bos(ptr): return __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1)
++
++def __bos0(ptr): return __builtin_object_size (ptr, 0)
++
++def __warnattr(msg): return __attribute__((__warning__ (msg)))
++
++__flexarr = []
++__flexarr = [0]
++__flexarr = []
++__flexarr = [1]
++def __ASMNAME(cname): return __ASMNAME2 (__USER_LABEL_PREFIX__, cname)
++
++def __attribute__(xyz): return  
++
++def __attribute_format_arg__(x): return __attribute__ ((__format_arg__ (x)))
++
++def __attribute_format_arg__(x): return  
++
++
++# Included from bits/wordsize.h
++__WORDSIZE = 32
++__LDBL_COMPAT = 1
++def __LDBL_REDIR_DECL(name): return \
++
++__USE_LARGEFILE = 1
++__USE_LARGEFILE64 = 1
++__USE_EXTERN_INLINES = 1
++__USE_EXTERN_INLINES_IN_LIBC = 1
++
++# Included from gnu/stubs.h
++
++# Included from stdint.h
++_STDINT_H = 1
++
++# Included from bits/wchar.h
++_BITS_WCHAR_H = 1
++__WCHAR_MAX = (2147483647)
++__WCHAR_MIN = (-__WCHAR_MAX - 1)
++def __INT64_C(c): return c ## L
++
++def __UINT64_C(c): return c ## UL
++
++def __INT64_C(c): return c ## LL
++
++def __UINT64_C(c): return c ## ULL
++
++INT8_MIN = (-128)
++INT16_MIN = (-32767-1)
++INT32_MIN = (-2147483647-1)
++INT64_MIN = (-__INT64_C(9223372036854775807)-1)
++INT8_MAX = (127)
++INT16_MAX = (32767)
++INT32_MAX = (2147483647)
++INT64_MAX = (__INT64_C(9223372036854775807))
++UINT8_MAX = (255)
++UINT16_MAX = (65535)
++UINT64_MAX = (__UINT64_C(18446744073709551615))
++INT_LEAST8_MIN = (-128)
++INT_LEAST16_MIN = (-32767-1)
++INT_LEAST32_MIN = (-2147483647-1)
++INT_LEAST64_MIN = (-__INT64_C(9223372036854775807)-1)
++INT_LEAST8_MAX = (127)
++INT_LEAST16_MAX = (32767)
++INT_LEAST32_MAX = (2147483647)
++INT_LEAST64_MAX = (__INT64_C(9223372036854775807))
++UINT_LEAST8_MAX = (255)
++UINT_LEAST16_MAX = (65535)
++UINT_LEAST64_MAX = (__UINT64_C(18446744073709551615))
++INT_FAST8_MIN = (-128)
++INT_FAST16_MIN = (-9223372036854775807L-1)
++INT_FAST32_MIN = (-9223372036854775807L-1)
++INT_FAST16_MIN = (-2147483647-1)
++INT_FAST32_MIN = (-2147483647-1)
++INT_FAST64_MIN = (-__INT64_C(9223372036854775807)-1)
++INT_FAST8_MAX = (127)
++INT_FAST16_MAX = (9223372036854775807L)
++INT_FAST32_MAX = (9223372036854775807L)
++INT_FAST16_MAX = (2147483647)
++INT_FAST32_MAX = (2147483647)
++INT_FAST64_MAX = (__INT64_C(9223372036854775807))
++UINT_FAST8_MAX = (255)
++UINT_FAST64_MAX = (__UINT64_C(18446744073709551615))
++INTPTR_MIN = (-9223372036854775807L-1)
++INTPTR_MAX = (9223372036854775807L)
++INTPTR_MIN = (-2147483647-1)
++INTPTR_MAX = (2147483647)
++INTMAX_MIN = (-__INT64_C(9223372036854775807)-1)
++INTMAX_MAX = (__INT64_C(9223372036854775807))
++UINTMAX_MAX = (__UINT64_C(18446744073709551615))
++PTRDIFF_MIN = (-9223372036854775807L-1)
++PTRDIFF_MAX = (9223372036854775807L)
++PTRDIFF_MIN = (-2147483647-1)
++PTRDIFF_MAX = (2147483647)
++SIG_ATOMIC_MIN = (-2147483647-1)
++SIG_ATOMIC_MAX = (2147483647)
++WCHAR_MIN = __WCHAR_MIN
++WCHAR_MAX = __WCHAR_MAX
++def INT8_C(c): return c
++
++def INT16_C(c): return c
++
++def INT32_C(c): return c
++
++def INT64_C(c): return c ## L
++
++def INT64_C(c): return c ## LL
++
++def UINT8_C(c): return c
++
++def UINT16_C(c): return c
++
++def UINT32_C(c): return c ## U
++
++def UINT64_C(c): return c ## UL
++
++def UINT64_C(c): return c ## ULL
++
++def INTMAX_C(c): return c ## L
++
++def UINTMAX_C(c): return c ## UL
++
++def INTMAX_C(c): return c ## LL
++
++def UINTMAX_C(c): return c ## ULL
++
++
++# Included from sys/socket.h
++_SYS_SOCKET_H = 1
++
++# Included from sys/uio.h
++_SYS_UIO_H = 1
++from TYPES import *
++
++# Included from bits/uio.h
++_BITS_UIO_H = 1
++from TYPES import *
++UIO_MAXIOV = 1024
++
++# Included from bits/sigset.h
++_SIGSET_H_types = 1
++_SIGSET_H_fns = 1
++def __sigword(sig): return (((sig) - 1) >> 5)
++
++def __sigemptyset(set): return \
++
++def __sigfillset(set): return \
++
++def __sigisemptyset(set): return \
++
++
++# Included from bits/socket.h
++__BITS_SOCKET_H = 1
++
++# Included from limits.h
++_LIBC_LIMITS_H_ = 1
++MB_LEN_MAX = 16
++_LIMITS_H = 1
++CHAR_BIT = 8
++SCHAR_MIN = (-128)
++SCHAR_MAX = 127
++UCHAR_MAX = 255
++CHAR_MIN = 0
++CHAR_MAX = UCHAR_MAX
++CHAR_MIN = SCHAR_MIN
++CHAR_MAX = SCHAR_MAX
++SHRT_MIN = (-32768)
++SHRT_MAX = 32767
++USHRT_MAX = 65535
++INT_MAX = 2147483647
++LONG_MAX = 9223372036854775807L
++LONG_MAX = 2147483647L
++LONG_MIN = (-LONG_MAX - 1L)
++
++# Included from bits/posix1_lim.h
++_BITS_POSIX1_LIM_H = 1
++_POSIX_AIO_LISTIO_MAX = 2
++_POSIX_AIO_MAX = 1
++_POSIX_ARG_MAX = 4096
++_POSIX_CHILD_MAX = 25
++_POSIX_CHILD_MAX = 6
++_POSIX_DELAYTIMER_MAX = 32
++_POSIX_HOST_NAME_MAX = 255
++_POSIX_LINK_MAX = 8
++_POSIX_LOGIN_NAME_MAX = 9
++_POSIX_MAX_CANON = 255
++_POSIX_MAX_INPUT = 255
++_POSIX_MQ_OPEN_MAX = 8
++_POSIX_MQ_PRIO_MAX = 32
++_POSIX_NAME_MAX = 14
++_POSIX_NGROUPS_MAX = 8
++_POSIX_NGROUPS_MAX = 0
++_POSIX_OPEN_MAX = 20
++_POSIX_OPEN_MAX = 16
++_POSIX_FD_SETSIZE = _POSIX_OPEN_MAX
++_POSIX_PATH_MAX = 256
++_POSIX_PIPE_BUF = 512
++_POSIX_RE_DUP_MAX = 255
++_POSIX_RTSIG_MAX = 8
++_POSIX_SEM_NSEMS_MAX = 256
++_POSIX_SEM_VALUE_MAX = 32767
++_POSIX_SIGQUEUE_MAX = 32
++_POSIX_SSIZE_MAX = 32767
++_POSIX_STREAM_MAX = 8
++_POSIX_SYMLINK_MAX = 255
++_POSIX_SYMLOOP_MAX = 8
++_POSIX_TIMER_MAX = 32
++_POSIX_TTY_NAME_MAX = 9
++_POSIX_TZNAME_MAX = 6
++_POSIX_QLIMIT = 1
++_POSIX_HIWAT = _POSIX_PIPE_BUF
++_POSIX_UIO_MAXIOV = 16
++_POSIX_CLOCKRES_MIN = 20000000
++
++# Included from bits/local_lim.h
++
++# Included from sys/syslimits.h
++ARG_MAX = 262144
++CHILD_MAX = 40
++LINK_MAX = 32767
++MAX_CANON = 255
++MAX_INPUT = 255
++NAME_MAX = 255
++NGROUPS_MAX = 1023
++OPEN_MAX = 64
++PATH_MAX = 1024
++PIPE_BUF = 512
++IOV_MAX = 1024
++_POSIX_THREAD_KEYS_MAX = 128
++PTHREAD_KEYS_MAX = 1024
++_POSIX_THREAD_DESTRUCTOR_ITERATIONS = 4
++PTHREAD_DESTRUCTOR_ITERATIONS = _POSIX_THREAD_DESTRUCTOR_ITERATIONS
++_POSIX_THREAD_THREADS_MAX = 64
++PTHREAD_THREADS_MAX = 1024
++AIO_PRIO_DELTA_MAX = 20
++PTHREAD_STACK_MIN = 16384
++TIMER_MAX = 256
++DELAYTIMER_MAX = 2147483647
++SSIZE_MAX = LONG_MAX
++NGROUPS_MAX = 8
++
++# Included from bits/posix2_lim.h
++_BITS_POSIX2_LIM_H = 1
++_POSIX2_BC_BASE_MAX = 99
++_POSIX2_BC_DIM_MAX = 2048
++_POSIX2_BC_SCALE_MAX = 99
++_POSIX2_BC_STRING_MAX = 1000
++_POSIX2_COLL_WEIGHTS_MAX = 2
++_POSIX2_EXPR_NEST_MAX = 32
++_POSIX2_LINE_MAX = 2048
++_POSIX2_RE_DUP_MAX = 255
++_POSIX2_CHARCLASS_NAME_MAX = 14
++BC_BASE_MAX = _POSIX2_BC_BASE_MAX
++BC_DIM_MAX = _POSIX2_BC_DIM_MAX
++BC_SCALE_MAX = _POSIX2_BC_SCALE_MAX
++BC_STRING_MAX = _POSIX2_BC_STRING_MAX
++COLL_WEIGHTS_MAX = 255
++EXPR_NEST_MAX = _POSIX2_EXPR_NEST_MAX
++LINE_MAX = _POSIX2_LINE_MAX
++CHARCLASS_NAME_MAX = 2048
++RE_DUP_MAX = (0x7fff)
++
++# Included from bits/xopen_lim.h
++_XOPEN_LIM_H = 1
++
++# Included from bits/stdio_lim.h
++L_tmpnam = 20
++TMP_MAX = 238328
++FILENAME_MAX = 1024
++L_ctermid = 9
++L_cuserid = 9
++FOPEN_MAX = 64
++IOV_MAX = 1024
++_XOPEN_IOV_MAX = _POSIX_UIO_MAXIOV
++NL_ARGMAX = _POSIX_ARG_MAX
++NL_LANGMAX = _POSIX2_LINE_MAX
++NL_MSGMAX = INT_MAX
++NL_NMAX = INT_MAX
++NL_SETMAX = INT_MAX
++NL_TEXTMAX = INT_MAX
++NZERO = 20
++WORD_BIT = 16
++WORD_BIT = 32
++WORD_BIT = 64
++WORD_BIT = 16
++WORD_BIT = 32
++WORD_BIT = 64
++WORD_BIT = 32
++LONG_BIT = 32
++LONG_BIT = 64
++LONG_BIT = 32
++LONG_BIT = 64
++LONG_BIT = 64
++LONG_BIT = 32
++
++# Included from bits/types.h
++_BITS_TYPES_H = 1
++__S32_TYPE = int
++__SWORD_TYPE = int
++__SLONG32_TYPE = int
++
++# Included from bits/typesizes.h
++_BITS_TYPESIZES_H = 1
++__PID_T_TYPE = __S32_TYPE
++__CLOCK_T_TYPE = __S32_TYPE
++__SWBLK_T_TYPE = __S32_TYPE
++__CLOCKID_T_TYPE = __S32_TYPE
++__TIMER_T_TYPE = __S32_TYPE
++__SSIZE_T_TYPE = __SWORD_TYPE
++__FD_SETSIZE = 1024
++PF_UNSPEC = 0
++PF_LOCAL = 1
++PF_UNIX = PF_LOCAL
++PF_FILE = PF_LOCAL
++PF_INET = 2
++PF_IMPLINK = 3
++PF_PUP = 4
++PF_CHAOS = 5
++PF_NS = 6
++PF_ISO = 7
++PF_OSI = PF_ISO
++PF_ECMA = 8
++PF_DATAKIT = 9
++PF_CCITT = 10
++PF_SNA = 11
++PF_DECnet = 12
++PF_DLI = 13
++PF_LAT = 14
++PF_HYLINK = 15
++PF_APPLETALK = 16
++PF_ROUTE = 17
++PF_LINK = 18
++PF_XTP = 19
++PF_COIP = 20
++PF_CNT = 21
++PF_RTIP = 22
++PF_IPX = 23
++PF_SIP = 24
++PF_PIP = 25
++PF_ISDN = 26
++PF_KEY = 27
++PF_INET6 = 28
++PF_NATM = 29
++PF_ATM = 30
++PF_HDRCMPLT = 31
++PF_NETGRAPH = 32
++PF_MAX = 33
++AF_UNSPEC = PF_UNSPEC
++AF_LOCAL = PF_LOCAL
++AF_UNIX = PF_UNIX
++AF_FILE = PF_FILE
++AF_INET = PF_INET
++AF_IMPLINK = PF_IMPLINK
++AF_PUP = PF_PUP
++AF_CHAOS = PF_CHAOS
++AF_NS = PF_NS
++AF_ISO = PF_ISO
++AF_OSI = PF_OSI
++AF_ECMA = PF_ECMA
++AF_DATAKIT = PF_DATAKIT
++AF_CCITT = PF_CCITT
++AF_SNA = PF_SNA
++AF_DECnet = PF_DECnet
++AF_DLI = PF_DLI
++AF_LAT = PF_LAT
++AF_HYLINK = PF_HYLINK
++AF_APPLETALK = PF_APPLETALK
++AF_ROUTE = PF_ROUTE
++AF_LINK = PF_LINK
++pseudo_AF_XTP = PF_XTP
++AF_COIP = PF_COIP
++AF_CNT = PF_CNT
++pseudo_AF_RTIP = PF_RTIP
++AF_IPX = PF_IPX
++AF_SIP = PF_SIP
++pseudo_AF_PIP = PF_PIP
++AF_ISDN = PF_ISDN
++AF_E164 = AF_ISDN
++pseudo_AF_KEY = PF_KEY
++AF_INET6 = PF_INET6
++AF_NATM = PF_NATM
++AF_ATM = PF_ATM
++pseudo_AF_HDRCMPLT = PF_HDRCMPLT
++AF_NETGRAPH = PF_NETGRAPH
++AF_MAX = PF_MAX
++SOMAXCONN = 128
++
++# Included from bits/sockaddr.h
++_BITS_SOCKADDR_H = 1
++def __SOCKADDR_COMMON(sa_prefix): return \
++
++_HAVE_SA_LEN = 1
++_SS_SIZE = 128
++def CMSG_FIRSTHDR(mhdr): return \
++
++CMGROUP_MAX = 16
++SOL_SOCKET = 0xffff
++LOCAL_PEERCRED = 0x001
++LOCAL_CREDS = 0x002
++LOCAL_CONNWAIT = 0x004
++
++# Included from bits/socket2.h
++def IN_CLASSA(a): return ((((in_addr_t)(a)) & (-2147483648)) == 0)
++
++IN_CLASSA_NET = (-16777216)
++IN_CLASSA_NSHIFT = 24
++IN_CLASSA_HOST = ((-1) & ~IN_CLASSA_NET)
++IN_CLASSA_MAX = 128
++def IN_CLASSB(a): return ((((in_addr_t)(a)) & (-1073741824)) == (-2147483648))
++
++IN_CLASSB_NET = (-65536)
++IN_CLASSB_NSHIFT = 16
++IN_CLASSB_HOST = ((-1) & ~IN_CLASSB_NET)
++IN_CLASSB_MAX = 65536
++def IN_CLASSC(a): return ((((in_addr_t)(a)) & (-536870912)) == (-1073741824))
++
++IN_CLASSC_NET = (-256)
++IN_CLASSC_NSHIFT = 8
++IN_CLASSC_HOST = ((-1) & ~IN_CLASSC_NET)
++def IN_CLASSD(a): return ((((in_addr_t)(a)) & (-268435456)) == (-536870912))
++
++def IN_MULTICAST(a): return IN_CLASSD(a)
++
++def IN_EXPERIMENTAL(a): return ((((in_addr_t)(a)) & (-536870912)) == (-536870912))
++
++def IN_BADCLASS(a): return ((((in_addr_t)(a)) & (-268435456)) == (-268435456))
++
++IN_LOOPBACKNET = 127
++INET_ADDRSTRLEN = 16
++INET6_ADDRSTRLEN = 46
++
++# Included from bits/in.h
++IMPLINK_IP = 155
++IMPLINK_LOWEXPER = 156
++IMPLINK_HIGHEXPER = 158
++IPPROTO_DIVERT = 258
++SOL_IP = 0
++IP_OPTIONS = 1
++IP_HDRINCL = 2
++IP_TOS = 3
++IP_TTL = 4
++IP_RECVOPTS = 5
++IP_RECVRETOPTS = 6
++IP_RECVDSTADDR = 7
++IP_SENDSRCADDR = IP_RECVDSTADDR
++IP_RETOPTS = 8
++IP_MULTICAST_IF = 9
++IP_MULTICAST_TTL = 10
++IP_MULTICAST_LOOP = 11
++IP_ADD_MEMBERSHIP = 12
++IP_DROP_MEMBERSHIP = 13
++IP_MULTICAST_VIF = 14
++IP_RSVP_ON = 15
++IP_RSVP_OFF = 16
++IP_RSVP_VIF_ON = 17
++IP_RSVP_VIF_OFF = 18
++IP_PORTRANGE = 19
++IP_RECVIF = 20
++IP_IPSEC_POLICY = 21
++IP_FAITH = 22
++IP_ONESBCAST = 23
++IP_NONLOCALOK = 24
++IP_FW_TABLE_ADD = 40
++IP_FW_TABLE_DEL = 41
++IP_FW_TABLE_FLUSH = 42
++IP_FW_TABLE_GETSIZE = 43
++IP_FW_TABLE_LIST = 44
++IP_FW_ADD = 50
++IP_FW_DEL = 51
++IP_FW_FLUSH = 52
++IP_FW_ZERO = 53
++IP_FW_GET = 54
++IP_FW_RESETLOG = 55
++IP_FW_NAT_CFG = 56
++IP_FW_NAT_DEL = 57
++IP_FW_NAT_GET_CONFIG = 58
++IP_FW_NAT_GET_LOG = 59
++IP_DUMMYNET_CONFIGURE = 60
++IP_DUMMYNET_DEL = 61
++IP_DUMMYNET_FLUSH = 62
++IP_DUMMYNET_GET = 64
++IP_RECVTTL = 65
++IP_MINTTL = 66
++IP_DONTFRAG = 67
++IP_ADD_SOURCE_MEMBERSHIP = 70
++IP_DROP_SOURCE_MEMBERSHIP = 71
++IP_BLOCK_SOURCE = 72
++IP_UNBLOCK_SOURCE = 73
++IP_MSFILTER = 74
++MCAST_JOIN_GROUP = 80
++MCAST_LEAVE_GROUP = 81
++MCAST_JOIN_SOURCE_GROUP = 82
++MCAST_LEAVE_SOURCE_GROUP = 83
++MCAST_BLOCK_SOURCE = 84
++MCAST_UNBLOCK_SOURCE = 85
++IP_DEFAULT_MULTICAST_TTL = 1
++IP_DEFAULT_MULTICAST_LOOP = 1
++IP_MIN_MEMBERSHIPS = 31
++IP_MAX_MEMBERSHIPS = 4095
++IP_MAX_SOURCE_FILTER = 1024
++MCAST_UNDEFINED = 0
++MCAST_INCLUDE = 1
++MCAST_EXCLUDE = 2
++IP_PORTRANGE_DEFAULT = 0
++IP_PORTRANGE_HIGH = 1
++IP_PORTRANGE_LOW = 2
++IPCTL_FORWARDING = 1
++IPCTL_SENDREDIRECTS = 2
++IPCTL_DEFTTL = 3
++IPCTL_DEFMTU = 4
++IPCTL_RTEXPIRE = 5
++IPCTL_RTMINEXPIRE = 6
++IPCTL_RTMAXCACHE = 7
++IPCTL_SOURCEROUTE = 8
++IPCTL_DIRECTEDBROADCAST = 9
++IPCTL_INTRQMAXLEN = 10
++IPCTL_INTRQDROPS = 11
++IPCTL_STATS = 12
++IPCTL_ACCEPTSOURCEROUTE = 13
++IPCTL_FASTFORWARDING = 14
++IPCTL_KEEPFAITH = 15
++IPCTL_GIF_TTL = 16
++IPCTL_MAXID = 17
++IPV6_SOCKOPT_RESERVED1 = 3
++IPV6_UNICAST_HOPS = 4
++IPV6_MULTICAST_IF = 9
++IPV6_MULTICAST_HOPS = 10
++IPV6_MULTICAST_LOOP = 11
++IPV6_JOIN_GROUP = 12
++IPV6_LEAVE_GROUP = 13
++IPV6_PORTRANGE = 14
++ICMP6_FILTER = 18
++IPV6_CHECKSUM = 26
++IPV6_V6ONLY = 27
++IPV6_IPSEC_POLICY = 28
++IPV6_FAITH = 29
++IPV6_FW_ADD = 30
++IPV6_FW_DEL = 31
++IPV6_FW_FLUSH = 32
++IPV6_FW_ZERO = 33
++IPV6_FW_GET = 34
++IPV6_RTHDRDSTOPTS = 35
++IPV6_RECVPKTINFO = 36
++IPV6_RECVHOPLIMIT = 37
++IPV6_RECVRTHDR = 38
++IPV6_RECVHOPOPTS = 39
++IPV6_RECVDSTOPTS = 40
++IPV6_USE_MIN_MTU = 42
++IPV6_RECVPATHMTU = 43
++IPV6_PATHMTU = 44
++IPV6_PKTINFO = 46
++IPV6_HOPLIMIT = 47
++IPV6_NEXTHOP = 48
++IPV6_HOPOPTS = 49
++IPV6_DSTOPTS = 50
++IPV6_RTHDR = 51
++IPV6_RECVTCLASS = 57
++IPV6_AUTOFLOWLABEL = 59
++IPV6_TCLASS = 61
++IPV6_DONTFRAG = 62
++IPV6_PREFER_TEMPADDR = 63
++IPV6_ADD_MEMBERSHIP = IPV6_JOIN_GROUP
++IPV6_DROP_MEMBERSHIP = IPV6_LEAVE_GROUP
++IPV6_RXHOPOPTS = IPV6_HOPOPTS
++IPV6_RXDSTOPTS = IPV6_DSTOPTS
++SOL_IPV6 = 41
++SOL_ICMPV6 = 58
++IPV6_DEFAULT_MULTICAST_HOPS = 1
++IPV6_DEFAULT_MULTICAST_LOOP = 1
++IPV6_PORTRANGE_DEFAULT = 0
++IPV6_PORTRANGE_HIGH = 1
++IPV6_PORTRANGE_LOW = 2
++IPV6_RTHDR_LOOSE = 0
++IPV6_RTHDR_STRICT = 1
++IPV6_RTHDR_TYPE_0 = 0
++IPV6CTL_FORWARDING = 1
++IPV6CTL_SENDREDIRECTS = 2
++IPV6CTL_DEFHLIM = 3
++IPV6CTL_FORWSRCRT = 5
++IPV6CTL_STATS = 6
++IPV6CTL_MRTSTATS = 7
++IPV6CTL_MRTPROTO = 8
++IPV6CTL_MAXFRAGPACKETS = 9
++IPV6CTL_SOURCECHECK = 10
++IPV6CTL_SOURCECHECK_LOGINT = 11
++IPV6CTL_ACCEPT_RTADV = 12
++IPV6CTL_KEEPFAITH = 13
++IPV6CTL_LOG_INTERVAL = 14
++IPV6CTL_HDRNESTLIMIT = 15
++IPV6CTL_DAD_COUNT = 16
++IPV6CTL_AUTO_FLOWLABEL = 17
++IPV6CTL_DEFMCASTHLIM = 18
++IPV6CTL_GIF_HLIM = 19
++IPV6CTL_KAME_VERSION = 20
++IPV6CTL_USE_DEPRECATED = 21
++IPV6CTL_RR_PRUNE = 22
++IPV6CTL_V6ONLY = 24
++IPV6CTL_RTEXPIRE = 25
++IPV6CTL_RTMINEXPIRE = 26
++IPV6CTL_RTMAXCACHE = 27
++IPV6CTL_USETEMPADDR = 32
++IPV6CTL_TEMPPLTIME = 33
++IPV6CTL_TEMPVLTIME = 34
++IPV6CTL_AUTO_LINKLOCAL = 35
++IPV6CTL_RIP6STATS = 36
++IPV6CTL_PREFER_TEMPADDR = 37
++IPV6CTL_ADDRCTLPOLICY = 38
++IPV6CTL_USE_DEFAULTZONE = 39
++IPV6CTL_MAXFRAGS = 41
++IPV6CTL_MCAST_PMTU = 44
++IPV6CTL_STEALTH = 45
++ICMPV6CTL_ND6_ONLINKNSRFC4861 = 47
++IPV6CTL_MAXID = 48
++
++# Included from endian.h
++_ENDIAN_H = 1
++__LITTLE_ENDIAN = 1234
++__BIG_ENDIAN = 4321
++__PDP_ENDIAN = 3412
++
++# Included from bits/endian.h
++__BYTE_ORDER = __LITTLE_ENDIAN
++__FLOAT_WORD_ORDER = __BYTE_ORDER
++LITTLE_ENDIAN = __LITTLE_ENDIAN
++BIG_ENDIAN = __BIG_ENDIAN
++PDP_ENDIAN = __PDP_ENDIAN
++BYTE_ORDER = __BYTE_ORDER
++
++# Included from bits/byteswap.h
++_BITS_BYTESWAP_H = 1
++def __bswap_constant_16(x): return \
++
++def __bswap_16(x): return \
++
++def __bswap_16(x): return \
++
++def __bswap_constant_32(x): return \
++
++def __bswap_32(x): return \
++
++def __bswap_32(x): return \
++
++def __bswap_32(x): return \
++
++def __bswap_constant_64(x): return \
++
++def __bswap_64(x): return \
++
++def htobe16(x): return __bswap_16 (x)
++
++def htole16(x): return (x)
++
++def be16toh(x): return __bswap_16 (x)
++
++def le16toh(x): return (x)
++
++def htobe32(x): return __bswap_32 (x)
++
++def htole32(x): return (x)
++
++def be32toh(x): return __bswap_32 (x)
++
++def le32toh(x): return (x)
++
++def htobe64(x): return __bswap_64 (x)
++
++def htole64(x): return (x)
++
++def be64toh(x): return __bswap_64 (x)
++
++def le64toh(x): return (x)
++
++def htobe16(x): return (x)
++
++def htole16(x): return __bswap_16 (x)
++
++def be16toh(x): return (x)
++
++def le16toh(x): return __bswap_16 (x)
++
++def htobe32(x): return (x)
++
++def htole32(x): return __bswap_32 (x)
++
++def be32toh(x): return (x)
++
++def le32toh(x): return __bswap_32 (x)
++
++def htobe64(x): return (x)
++
++def htole64(x): return __bswap_64 (x)
++
++def be64toh(x): return (x)
++
++def le64toh(x): return __bswap_64 (x)
++
++def ntohl(x): return (x)
++
++def ntohs(x): return (x)
++
++def htonl(x): return (x)
++
++def htons(x): return (x)
++
++def ntohl(x): return __bswap_32 (x)
++
++def ntohs(x): return __bswap_16 (x)
++
++def htonl(x): return __bswap_32 (x)
++
++def htons(x): return __bswap_16 (x)
++
++def IN6_IS_ADDR_UNSPECIFIED(a): return \
++
++def IN6_IS_ADDR_LOOPBACK(a): return \
++
++def IN6_IS_ADDR_LINKLOCAL(a): return \
++
++def IN6_IS_ADDR_SITELOCAL(a): return \
++
++def IN6_IS_ADDR_V4MAPPED(a): return \
++
++def IN6_IS_ADDR_V4COMPAT(a): return \
++
++def IN6_IS_ADDR_MC_NODELOCAL(a): return \
++
++def IN6_IS_ADDR_MC_LINKLOCAL(a): return \
++
++def IN6_IS_ADDR_MC_SITELOCAL(a): return \
++
++def IN6_IS_ADDR_MC_ORGLOCAL(a): return \
++
++def IN6_IS_ADDR_MC_GLOBAL(a): return \
++
+--- /dev/null
++++ b/Lib/plat-gnukfreebsd7/TYPES.py
+@@ -0,0 +1,303 @@
++# Generated by h2py from /usr/include/sys/types.h
++_SYS_TYPES_H = 1
++
++# Included from features.h
++_FEATURES_H = 1
++__USE_ANSI = 1
++__FAVOR_BSD = 1
++_ISOC99_SOURCE = 1
++_POSIX_SOURCE = 1
++_POSIX_C_SOURCE = 200809L
++_XOPEN_SOURCE = 700
++_XOPEN_SOURCE_EXTENDED = 1
++_LARGEFILE64_SOURCE = 1
++_BSD_SOURCE = 1
++_SVID_SOURCE = 1
++_ATFILE_SOURCE = 1
++_BSD_SOURCE = 1
++_SVID_SOURCE = 1
++__USE_ISOC99 = 1
++__USE_ISOC95 = 1
++_POSIX_SOURCE = 1
++_POSIX_C_SOURCE = 2
++_POSIX_C_SOURCE = 199506L
++_POSIX_C_SOURCE = 200112L
++_POSIX_C_SOURCE = 200809L
++__USE_POSIX_IMPLICITLY = 1
++__USE_POSIX = 1
++__USE_POSIX2 = 1
++__USE_POSIX199309 = 1
++__USE_POSIX199506 = 1
++__USE_XOPEN2K = 1
++__USE_ISOC99 = 1
++__USE_XOPEN2K8 = 1
++_ATFILE_SOURCE = 1
++__USE_XOPEN = 1
++__USE_XOPEN_EXTENDED = 1
++__USE_UNIX98 = 1
++_LARGEFILE_SOURCE = 1
++__USE_XOPEN2K8 = 1
++__USE_XOPEN2K = 1
++__USE_ISOC99 = 1
++__USE_XOPEN_EXTENDED = 1
++__USE_LARGEFILE = 1
++__USE_LARGEFILE64 = 1
++__USE_FILE_OFFSET64 = 1
++__USE_MISC = 1
++__USE_BSD = 1
++__USE_SVID = 1
++__USE_ATFILE = 1
++__USE_GNU = 1
++__USE_REENTRANT = 1
++__USE_FORTIFY_LEVEL = 2
++__USE_FORTIFY_LEVEL = 1
++__USE_FORTIFY_LEVEL = 0
++
++# Included from bits/predefs.h
++__STDC_IEC_559__ = 1
++__STDC_IEC_559_COMPLEX__ = 1
++__STDC_ISO_10646__ = 200009L
++__GNU_LIBRARY__ = 6
++__GLIBC__ = 2
++__GLIBC_MINOR__ = 11
++__GLIBC_HAVE_LONG_LONG = 1
++
++# Included from sys/cdefs.h
++_SYS_CDEFS_H = 1
++def __NTH(fct): return fct
++
++def __NTH(fct): return fct
++
++def __P(args): return args
++
++def __PMT(args): return args
++
++def __STRING(x): return #x
++
++def __bos(ptr): return __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1)
++
++def __bos0(ptr): return __builtin_object_size (ptr, 0)
++
++def __warnattr(msg): return __attribute__((__warning__ (msg)))
++
++__flexarr = []
++__flexarr = [0]
++__flexarr = []
++__flexarr = [1]
++def __ASMNAME(cname): return __ASMNAME2 (__USER_LABEL_PREFIX__, cname)
++
++def __attribute__(xyz): return  
++
++def __attribute_format_arg__(x): return __attribute__ ((__format_arg__ (x)))
++
++def __attribute_format_arg__(x): return  
++
++
++# Included from bits/wordsize.h
++__WORDSIZE = 32
++__LDBL_COMPAT = 1
++def __LDBL_REDIR_DECL(name): return \
++
++__USE_LARGEFILE = 1
++__USE_LARGEFILE64 = 1
++__USE_EXTERN_INLINES = 1
++__USE_EXTERN_INLINES_IN_LIBC = 1
++
++# Included from gnu/stubs.h
++
++# Included from bits/types.h
++_BITS_TYPES_H = 1
++__S32_TYPE = int
++__SWORD_TYPE = int
++__SLONG32_TYPE = int
++
++# Included from bits/typesizes.h
++_BITS_TYPESIZES_H = 1
++__PID_T_TYPE = __S32_TYPE
++__CLOCK_T_TYPE = __S32_TYPE
++__SWBLK_T_TYPE = __S32_TYPE
++__CLOCKID_T_TYPE = __S32_TYPE
++__TIMER_T_TYPE = __S32_TYPE
++__SSIZE_T_TYPE = __SWORD_TYPE
++__FD_SETSIZE = 1024
++
++# Included from time.h
++_TIME_H = 1
++
++# Included from bits/time.h
++_BITS_TIME_H = 1
++CLOCKS_PER_SEC = 1000000l
++CLK_TCK = 128
++CLOCK_REALTIME = 0
++CLOCK_PROCESS_CPUTIME_ID = 2
++CLOCK_THREAD_CPUTIME_ID = 3
++CLOCK_MONOTONIC = 4
++CLOCK_VIRTUAL = 1
++CLOCK_PROF = 2
++CLOCK_UPTIME = 5
++CLOCK_UPTIME_PRECISE = 7
++CLOCK_UPTIME_FAST = 8
++CLOCK_REALTIME_PRECISE = 9
++CLOCK_REALTIME_FAST = 10
++CLOCK_MONOTONIC_PRECISE = 11
++CLOCK_MONOTONIC_FAST = 12
++CLOCK_SECOND = 13
++TIMER_RELTIME = 0
++TIMER_ABSTIME = 1
++_STRUCT_TIMEVAL = 1
++CLK_TCK = CLOCKS_PER_SEC
++__clock_t_defined = 1
++__time_t_defined = 1
++__clockid_t_defined = 1
++__timer_t_defined = 1
++__timespec_defined = 1
++
++# Included from xlocale.h
++_XLOCALE_H = 1
++def __isleap(year): return \
++
++__BIT_TYPES_DEFINED__ = 1
++
++# Included from endian.h
++_ENDIAN_H = 1
++__LITTLE_ENDIAN = 1234
++__BIG_ENDIAN = 4321
++__PDP_ENDIAN = 3412
++
++# Included from bits/endian.h
++__BYTE_ORDER = __LITTLE_ENDIAN
++__FLOAT_WORD_ORDER = __BYTE_ORDER
++LITTLE_ENDIAN = __LITTLE_ENDIAN
++BIG_ENDIAN = __BIG_ENDIAN
++PDP_ENDIAN = __PDP_ENDIAN
++BYTE_ORDER = __BYTE_ORDER
++
++# Included from bits/byteswap.h
++_BITS_BYTESWAP_H = 1
++def __bswap_constant_16(x): return \
++
++def __bswap_16(x): return \
++
++def __bswap_16(x): return \
++
++def __bswap_constant_32(x): return \
++
++def __bswap_32(x): return \
++
++def __bswap_32(x): return \
++
++def __bswap_32(x): return \
++
++def __bswap_constant_64(x): return \
++
++def __bswap_64(x): return \
++
++def htobe16(x): return __bswap_16 (x)
++
++def htole16(x): return (x)
++
++def be16toh(x): return __bswap_16 (x)
++
++def le16toh(x): return (x)
++
++def htobe32(x): return __bswap_32 (x)
++
++def htole32(x): return (x)
++
++def be32toh(x): return __bswap_32 (x)
++
++def le32toh(x): return (x)
++
++def htobe64(x): return __bswap_64 (x)
++
++def htole64(x): return (x)
++
++def be64toh(x): return __bswap_64 (x)
++
++def le64toh(x): return (x)
++
++def htobe16(x): return (x)
++
++def htole16(x): return __bswap_16 (x)
++
++def be16toh(x): return (x)
++
++def le16toh(x): return __bswap_16 (x)
++
++def htobe32(x): return (x)
++
++def htole32(x): return __bswap_32 (x)
++
++def be32toh(x): return (x)
++
++def le32toh(x): return __bswap_32 (x)
++
++def htobe64(x): return (x)
++
++def htole64(x): return __bswap_64 (x)
++
++def be64toh(x): return (x)
++
++def le64toh(x): return __bswap_64 (x)
++
++
++# Included from sys/select.h
++_SYS_SELECT_H = 1
++
++# Included from bits/select.h
++def __FD_ZERO(fdsp): return \
++
++def __FD_ZERO(set): return \
++
++
++# Included from bits/sigset.h
++_SIGSET_H_types = 1
++_SIGSET_H_fns = 1
++def __sigword(sig): return (((sig) - 1) >> 5)
++
++def __sigemptyset(set): return \
++
++def __sigfillset(set): return \
++
++def __sigisemptyset(set): return \
++
++def __FDELT(d): return ((d) / __NFDBITS)
++
++FD_SETSIZE = __FD_SETSIZE
++def FD_ZERO(fdsetp): return __FD_ZERO (fdsetp)
++
++
++# Included from sys/sysmacros.h
++_SYS_SYSMACROS_H = 1
++def minor(dev): return ((int)((dev) & (-65281)))
++
++def gnu_dev_major(dev): return major (dev)
++
++def gnu_dev_minor(dev): return minor (dev)
++
++
++# Included from bits/pthreadtypes.h
++_BITS_PTHREADTYPES_H = 1
++
++# Included from bits/sched.h
++SCHED_OTHER = 2
++SCHED_FIFO = 1
++SCHED_RR = 3
++CSIGNAL = 0x000000ff
++CLONE_VM = 0x00000100
++CLONE_FS = 0x00000200
++CLONE_FILES = 0x00000400
++CLONE_SIGHAND = 0x00000800
++CLONE_PTRACE = 0x00002000
++CLONE_VFORK = 0x00004000
++CLONE_SYSVSEM = 0x00040000
++__defined_schedparam = 1
++__CPU_SETSIZE = 128
++def __CPUELT(cpu): return ((cpu) / __NCPUBITS)
++
++def __CPU_ALLOC_SIZE(count): return \
++
++def __CPU_ALLOC(count): return __sched_cpualloc (count)
++
++def __CPU_FREE(cpuset): return __sched_cpufree (cpuset)
++
+--- /dev/null
++++ b/Lib/plat-gnukfreebsd7/DLFCN.py
+@@ -0,0 +1,118 @@
++# Generated by h2py from /usr/include/dlfcn.h
++_DLFCN_H = 1
++
++# Included from features.h
++_FEATURES_H = 1
++__USE_ANSI = 1
++__FAVOR_BSD = 1
++_ISOC99_SOURCE = 1
++_POSIX_SOURCE = 1
++_POSIX_C_SOURCE = 200809L
++_XOPEN_SOURCE = 700
++_XOPEN_SOURCE_EXTENDED = 1
++_LARGEFILE64_SOURCE = 1
++_BSD_SOURCE = 1
++_SVID_SOURCE = 1
++_ATFILE_SOURCE = 1
++_BSD_SOURCE = 1
++_SVID_SOURCE = 1
++__USE_ISOC99 = 1
++__USE_ISOC95 = 1
++_POSIX_SOURCE = 1
++_POSIX_C_SOURCE = 2
++_POSIX_C_SOURCE = 199506L
++_POSIX_C_SOURCE = 200112L
++_POSIX_C_SOURCE = 200809L
++__USE_POSIX_IMPLICITLY = 1
++__USE_POSIX = 1
++__USE_POSIX2 = 1
++__USE_POSIX199309 = 1
++__USE_POSIX199506 = 1
++__USE_XOPEN2K = 1
++__USE_ISOC99 = 1
++__USE_XOPEN2K8 = 1
++_ATFILE_SOURCE = 1
++__USE_XOPEN = 1
++__USE_XOPEN_EXTENDED = 1
++__USE_UNIX98 = 1
++_LARGEFILE_SOURCE = 1
++__USE_XOPEN2K8 = 1
++__USE_XOPEN2K = 1
++__USE_ISOC99 = 1
++__USE_XOPEN_EXTENDED = 1
++__USE_LARGEFILE = 1
++__USE_LARGEFILE64 = 1
++__USE_FILE_OFFSET64 = 1
++__USE_MISC = 1
++__USE_BSD = 1
++__USE_SVID = 1
++__USE_ATFILE = 1
++__USE_GNU = 1
++__USE_REENTRANT = 1
++__USE_FORTIFY_LEVEL = 2
++__USE_FORTIFY_LEVEL = 1
++__USE_FORTIFY_LEVEL = 0
++
++# Included from bits/predefs.h
++__STDC_IEC_559__ = 1
++__STDC_IEC_559_COMPLEX__ = 1
++__STDC_ISO_10646__ = 200009L
++__GNU_LIBRARY__ = 6
++__GLIBC__ = 2
++__GLIBC_MINOR__ = 11
++__GLIBC_HAVE_LONG_LONG = 1
++
++# Included from sys/cdefs.h
++_SYS_CDEFS_H = 1
++def __NTH(fct): return fct
++
++def __NTH(fct): return fct
++
++def __P(args): return args
++
++def __PMT(args): return args
++
++def __STRING(x): return #x
++
++def __bos(ptr): return __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1)
++
++def __bos0(ptr): return __builtin_object_size (ptr, 0)
++
++def __warnattr(msg): return __attribute__((__warning__ (msg)))
++
++__flexarr = []
++__flexarr = [0]
++__flexarr = []
++__flexarr = [1]
++def __ASMNAME(cname): return __ASMNAME2 (__USER_LABEL_PREFIX__, cname)
++
++def __attribute__(xyz): return  
++
++def __attribute_format_arg__(x): return __attribute__ ((__format_arg__ (x)))
++
++def __attribute_format_arg__(x): return  
++
++
++# Included from bits/wordsize.h
++__WORDSIZE = 32
++__LDBL_COMPAT = 1
++def __LDBL_REDIR_DECL(name): return \
++
++__USE_LARGEFILE = 1
++__USE_LARGEFILE64 = 1
++__USE_EXTERN_INLINES = 1
++__USE_EXTERN_INLINES_IN_LIBC = 1
++
++# Included from gnu/stubs.h
++
++# Included from bits/dlfcn.h
++RTLD_LAZY = 0x00001
++RTLD_NOW = 0x00002
++RTLD_BINDING_MASK = 0x3
++RTLD_NOLOAD = 0x00004
++RTLD_DEEPBIND = 0x00008
++RTLD_GLOBAL = 0x00100
++RTLD_LOCAL = 0
++RTLD_NODELETE = 0x01000
++LM_ID_BASE = 0
++LM_ID_NEWLM = -1
+--- /dev/null
++++ b/Lib/plat-gnukfreebsd8/IN.py
+@@ -0,0 +1,809 @@
++# Generated by h2py from /usr/include/netinet/in.h
++_NETINET_IN_H = 1
++
++# Included from features.h
++_FEATURES_H = 1
++__USE_ANSI = 1
++__FAVOR_BSD = 1
++_ISOC99_SOURCE = 1
++_POSIX_SOURCE = 1
++_POSIX_C_SOURCE = 200809L
++_XOPEN_SOURCE = 700
++_XOPEN_SOURCE_EXTENDED = 1
++_LARGEFILE64_SOURCE = 1
++_BSD_SOURCE = 1
++_SVID_SOURCE = 1
++_ATFILE_SOURCE = 1
++_BSD_SOURCE = 1
++_SVID_SOURCE = 1
++__USE_ISOC99 = 1
++__USE_ISOC95 = 1
++_POSIX_SOURCE = 1
++_POSIX_C_SOURCE = 2
++_POSIX_C_SOURCE = 199506L
++_POSIX_C_SOURCE = 200112L
++_POSIX_C_SOURCE = 200809L
++__USE_POSIX_IMPLICITLY = 1
++__USE_POSIX = 1
++__USE_POSIX2 = 1
++__USE_POSIX199309 = 1
++__USE_POSIX199506 = 1
++__USE_XOPEN2K = 1
++__USE_ISOC99 = 1
++__USE_XOPEN2K8 = 1
++_ATFILE_SOURCE = 1
++__USE_XOPEN = 1
++__USE_XOPEN_EXTENDED = 1
++__USE_UNIX98 = 1
++_LARGEFILE_SOURCE = 1
++__USE_XOPEN2K8 = 1
++__USE_XOPEN2K = 1
++__USE_ISOC99 = 1
++__USE_XOPEN_EXTENDED = 1
++__USE_LARGEFILE = 1
++__USE_LARGEFILE64 = 1
++__USE_FILE_OFFSET64 = 1
++__USE_MISC = 1
++__USE_BSD = 1
++__USE_SVID = 1
++__USE_ATFILE = 1
++__USE_GNU = 1
++__USE_REENTRANT = 1
++__USE_FORTIFY_LEVEL = 2
++__USE_FORTIFY_LEVEL = 1
++__USE_FORTIFY_LEVEL = 0
++
++# Included from bits/predefs.h
++__STDC_IEC_559__ = 1
++__STDC_IEC_559_COMPLEX__ = 1
++__STDC_ISO_10646__ = 200009L
++__GNU_LIBRARY__ = 6
++__GLIBC__ = 2
++__GLIBC_MINOR__ = 11
++__GLIBC_HAVE_LONG_LONG = 1
++
++# Included from sys/cdefs.h
++_SYS_CDEFS_H = 1
++def __NTH(fct): return fct
++
++def __NTH(fct): return fct
++
++def __P(args): return args
++
++def __PMT(args): return args
++
++def __STRING(x): return #x
++
++def __bos(ptr): return __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1)
++
++def __bos0(ptr): return __builtin_object_size (ptr, 0)
++
++def __warnattr(msg): return __attribute__((__warning__ (msg)))
++
++__flexarr = []
++__flexarr = [0]
++__flexarr = []
++__flexarr = [1]
++def __ASMNAME(cname): return __ASMNAME2 (__USER_LABEL_PREFIX__, cname)
++
++def __attribute__(xyz): return  
++
++def __attribute_format_arg__(x): return __attribute__ ((__format_arg__ (x)))
++
++def __attribute_format_arg__(x): return  
++
++
++# Included from bits/wordsize.h
++__WORDSIZE = 32
++__LDBL_COMPAT = 1
++def __LDBL_REDIR_DECL(name): return \
++
++__USE_LARGEFILE = 1
++__USE_LARGEFILE64 = 1
++__USE_EXTERN_INLINES = 1
++__USE_EXTERN_INLINES_IN_LIBC = 1
++
++# Included from gnu/stubs.h
++
++# Included from stdint.h
++_STDINT_H = 1
++
++# Included from bits/wchar.h
++_BITS_WCHAR_H = 1
++__WCHAR_MAX = (2147483647)
++__WCHAR_MIN = (-__WCHAR_MAX - 1)
++def __INT64_C(c): return c ## L
++
++def __UINT64_C(c): return c ## UL
++
++def __INT64_C(c): return c ## LL
++
++def __UINT64_C(c): return c ## ULL
++
++INT8_MIN = (-128)
++INT16_MIN = (-32767-1)
++INT32_MIN = (-2147483647-1)
++INT64_MIN = (-__INT64_C(9223372036854775807)-1)
++INT8_MAX = (127)
++INT16_MAX = (32767)
++INT32_MAX = (2147483647)
++INT64_MAX = (__INT64_C(9223372036854775807))
++UINT8_MAX = (255)
++UINT16_MAX = (65535)
++UINT64_MAX = (__UINT64_C(18446744073709551615))
++INT_LEAST8_MIN = (-128)
++INT_LEAST16_MIN = (-32767-1)
++INT_LEAST32_MIN = (-2147483647-1)
++INT_LEAST64_MIN = (-__INT64_C(9223372036854775807)-1)
++INT_LEAST8_MAX = (127)
++INT_LEAST16_MAX = (32767)
++INT_LEAST32_MAX = (2147483647)
++INT_LEAST64_MAX = (__INT64_C(9223372036854775807))
++UINT_LEAST8_MAX = (255)
++UINT_LEAST16_MAX = (65535)
++UINT_LEAST64_MAX = (__UINT64_C(18446744073709551615))
++INT_FAST8_MIN = (-128)
++INT_FAST16_MIN = (-9223372036854775807L-1)
++INT_FAST32_MIN = (-9223372036854775807L-1)
++INT_FAST16_MIN = (-2147483647-1)
++INT_FAST32_MIN = (-2147483647-1)
++INT_FAST64_MIN = (-__INT64_C(9223372036854775807)-1)
++INT_FAST8_MAX = (127)
++INT_FAST16_MAX = (9223372036854775807L)
++INT_FAST32_MAX = (9223372036854775807L)
++INT_FAST16_MAX = (2147483647)
++INT_FAST32_MAX = (2147483647)
++INT_FAST64_MAX = (__INT64_C(9223372036854775807))
++UINT_FAST8_MAX = (255)
++UINT_FAST64_MAX = (__UINT64_C(18446744073709551615))
++INTPTR_MIN = (-9223372036854775807L-1)
++INTPTR_MAX = (9223372036854775807L)
++INTPTR_MIN = (-2147483647-1)
++INTPTR_MAX = (2147483647)
++INTMAX_MIN = (-__INT64_C(9223372036854775807)-1)
++INTMAX_MAX = (__INT64_C(9223372036854775807))
++UINTMAX_MAX = (__UINT64_C(18446744073709551615))
++PTRDIFF_MIN = (-9223372036854775807L-1)
++PTRDIFF_MAX = (9223372036854775807L)
++PTRDIFF_MIN = (-2147483647-1)
++PTRDIFF_MAX = (2147483647)
++SIG_ATOMIC_MIN = (-2147483647-1)
++SIG_ATOMIC_MAX = (2147483647)
++WCHAR_MIN = __WCHAR_MIN
++WCHAR_MAX = __WCHAR_MAX
++def INT8_C(c): return c
++
++def INT16_C(c): return c
++
++def INT32_C(c): return c
++
++def INT64_C(c): return c ## L
++
++def INT64_C(c): return c ## LL
++
++def UINT8_C(c): return c
++
++def UINT16_C(c): return c
++
++def UINT32_C(c): return c ## U
++
++def UINT64_C(c): return c ## UL
++
++def UINT64_C(c): return c ## ULL
++
++def INTMAX_C(c): return c ## L
++
++def UINTMAX_C(c): return c ## UL
++
++def INTMAX_C(c): return c ## LL
++
++def UINTMAX_C(c): return c ## ULL
++
++
++# Included from sys/socket.h
++_SYS_SOCKET_H = 1
++
++# Included from sys/uio.h
++_SYS_UIO_H = 1
++from TYPES import *
++
++# Included from bits/uio.h
++_BITS_UIO_H = 1
++from TYPES import *
++UIO_MAXIOV = 1024
++
++# Included from bits/sigset.h
++_SIGSET_H_types = 1
++_SIGSET_H_fns = 1
++def __sigword(sig): return (((sig) - 1) >> 5)
++
++def __sigemptyset(set): return \
++
++def __sigfillset(set): return \
++
++def __sigisemptyset(set): return \
++
++
++# Included from bits/socket.h
++__BITS_SOCKET_H = 1
++
++# Included from limits.h
++_LIBC_LIMITS_H_ = 1
++MB_LEN_MAX = 16
++_LIMITS_H = 1
++CHAR_BIT = 8
++SCHAR_MIN = (-128)
++SCHAR_MAX = 127
++UCHAR_MAX = 255
++CHAR_MIN = 0
++CHAR_MAX = UCHAR_MAX
++CHAR_MIN = SCHAR_MIN
++CHAR_MAX = SCHAR_MAX
++SHRT_MIN = (-32768)
++SHRT_MAX = 32767
++USHRT_MAX = 65535
++INT_MAX = 2147483647
++LONG_MAX = 9223372036854775807L
++LONG_MAX = 2147483647L
++LONG_MIN = (-LONG_MAX - 1L)
++
++# Included from bits/posix1_lim.h
++_BITS_POSIX1_LIM_H = 1
++_POSIX_AIO_LISTIO_MAX = 2
++_POSIX_AIO_MAX = 1
++_POSIX_ARG_MAX = 4096
++_POSIX_CHILD_MAX = 25
++_POSIX_CHILD_MAX = 6
++_POSIX_DELAYTIMER_MAX = 32
++_POSIX_HOST_NAME_MAX = 255
++_POSIX_LINK_MAX = 8
++_POSIX_LOGIN_NAME_MAX = 9
++_POSIX_MAX_CANON = 255
++_POSIX_MAX_INPUT = 255
++_POSIX_MQ_OPEN_MAX = 8
++_POSIX_MQ_PRIO_MAX = 32
++_POSIX_NAME_MAX = 14
++_POSIX_NGROUPS_MAX = 8
++_POSIX_NGROUPS_MAX = 0
++_POSIX_OPEN_MAX = 20
++_POSIX_OPEN_MAX = 16
++_POSIX_FD_SETSIZE = _POSIX_OPEN_MAX
++_POSIX_PATH_MAX = 256
++_POSIX_PIPE_BUF = 512
++_POSIX_RE_DUP_MAX = 255
++_POSIX_RTSIG_MAX = 8
++_POSIX_SEM_NSEMS_MAX = 256
++_POSIX_SEM_VALUE_MAX = 32767
++_POSIX_SIGQUEUE_MAX = 32
++_POSIX_SSIZE_MAX = 32767
++_POSIX_STREAM_MAX = 8
++_POSIX_SYMLINK_MAX = 255
++_POSIX_SYMLOOP_MAX = 8
++_POSIX_TIMER_MAX = 32
++_POSIX_TTY_NAME_MAX = 9
++_POSIX_TZNAME_MAX = 6
++_POSIX_QLIMIT = 1
++_POSIX_HIWAT = _POSIX_PIPE_BUF
++_POSIX_UIO_MAXIOV = 16
++_POSIX_CLOCKRES_MIN = 20000000
++
++# Included from bits/local_lim.h
++
++# Included from sys/syslimits.h
++ARG_MAX = 262144
++CHILD_MAX = 40
++LINK_MAX = 32767
++MAX_CANON = 255
++MAX_INPUT = 255
++NAME_MAX = 255
++NGROUPS_MAX = 1023
++OPEN_MAX = 64
++PATH_MAX = 1024
++PIPE_BUF = 512
++IOV_MAX = 1024
++_POSIX_THREAD_KEYS_MAX = 128
++PTHREAD_KEYS_MAX = 1024
++_POSIX_THREAD_DESTRUCTOR_ITERATIONS = 4
++PTHREAD_DESTRUCTOR_ITERATIONS = _POSIX_THREAD_DESTRUCTOR_ITERATIONS
++_POSIX_THREAD_THREADS_MAX = 64
++PTHREAD_THREADS_MAX = 1024
++AIO_PRIO_DELTA_MAX = 20
++PTHREAD_STACK_MIN = 16384
++TIMER_MAX = 256
++DELAYTIMER_MAX = 2147483647
++SSIZE_MAX = LONG_MAX
++NGROUPS_MAX = 8
++
++# Included from bits/posix2_lim.h
++_BITS_POSIX2_LIM_H = 1
++_POSIX2_BC_BASE_MAX = 99
++_POSIX2_BC_DIM_MAX = 2048
++_POSIX2_BC_SCALE_MAX = 99
++_POSIX2_BC_STRING_MAX = 1000
++_POSIX2_COLL_WEIGHTS_MAX = 2
++_POSIX2_EXPR_NEST_MAX = 32
++_POSIX2_LINE_MAX = 2048
++_POSIX2_RE_DUP_MAX = 255
++_POSIX2_CHARCLASS_NAME_MAX = 14
++BC_BASE_MAX = _POSIX2_BC_BASE_MAX
++BC_DIM_MAX = _POSIX2_BC_DIM_MAX
++BC_SCALE_MAX = _POSIX2_BC_SCALE_MAX
++BC_STRING_MAX = _POSIX2_BC_STRING_MAX
++COLL_WEIGHTS_MAX = 255
++EXPR_NEST_MAX = _POSIX2_EXPR_NEST_MAX
++LINE_MAX = _POSIX2_LINE_MAX
++CHARCLASS_NAME_MAX = 2048
++RE_DUP_MAX = (0x7fff)
++
++# Included from bits/xopen_lim.h
++_XOPEN_LIM_H = 1
++
++# Included from bits/stdio_lim.h
++L_tmpnam = 20
++TMP_MAX = 238328
++FILENAME_MAX = 1024
++L_ctermid = 9
++L_cuserid = 9
++FOPEN_MAX = 64
++IOV_MAX = 1024
++_XOPEN_IOV_MAX = _POSIX_UIO_MAXIOV
++NL_ARGMAX = _POSIX_ARG_MAX
++NL_LANGMAX = _POSIX2_LINE_MAX
++NL_MSGMAX = INT_MAX
++NL_NMAX = INT_MAX
++NL_SETMAX = INT_MAX
++NL_TEXTMAX = INT_MAX
++NZERO = 20
++WORD_BIT = 16
++WORD_BIT = 32
++WORD_BIT = 64
++WORD_BIT = 16
++WORD_BIT = 32
++WORD_BIT = 64
++WORD_BIT = 32
++LONG_BIT = 32
++LONG_BIT = 64
++LONG_BIT = 32
++LONG_BIT = 64
++LONG_BIT = 64
++LONG_BIT = 32
++
++# Included from bits/types.h
++_BITS_TYPES_H = 1
++__S32_TYPE = int
++__SWORD_TYPE = int
++__SLONG32_TYPE = int
++
++# Included from bits/typesizes.h
++_BITS_TYPESIZES_H = 1
++__PID_T_TYPE = __S32_TYPE
++__CLOCK_T_TYPE = __S32_TYPE
++__SWBLK_T_TYPE = __S32_TYPE
++__CLOCKID_T_TYPE = __S32_TYPE
++__TIMER_T_TYPE = __S32_TYPE
++__SSIZE_T_TYPE = __SWORD_TYPE
++__FD_SETSIZE = 1024
++PF_UNSPEC = 0
++PF_LOCAL = 1
++PF_UNIX = PF_LOCAL
++PF_FILE = PF_LOCAL
++PF_INET = 2
++PF_IMPLINK = 3
++PF_PUP = 4
++PF_CHAOS = 5
++PF_NS = 6
++PF_ISO = 7
++PF_OSI = PF_ISO
++PF_ECMA = 8
++PF_DATAKIT = 9
++PF_CCITT = 10
++PF_SNA = 11
++PF_DECnet = 12
++PF_DLI = 13
++PF_LAT = 14
++PF_HYLINK = 15
++PF_APPLETALK = 16
++PF_ROUTE = 17
++PF_LINK = 18
++PF_XTP = 19
++PF_COIP = 20
++PF_CNT = 21
++PF_RTIP = 22
++PF_IPX = 23
++PF_SIP = 24
++PF_PIP = 25
++PF_ISDN = 26
++PF_KEY = 27
++PF_INET6 = 28
++PF_NATM = 29
++PF_ATM = 30
++PF_HDRCMPLT = 31
++PF_NETGRAPH = 32
++PF_MAX = 33
++AF_UNSPEC = PF_UNSPEC
++AF_LOCAL = PF_LOCAL
++AF_UNIX = PF_UNIX
++AF_FILE = PF_FILE
++AF_INET = PF_INET
++AF_IMPLINK = PF_IMPLINK
++AF_PUP = PF_PUP
++AF_CHAOS = PF_CHAOS
++AF_NS = PF_NS
++AF_ISO = PF_ISO
++AF_OSI = PF_OSI
++AF_ECMA = PF_ECMA
++AF_DATAKIT = PF_DATAKIT
++AF_CCITT = PF_CCITT
++AF_SNA = PF_SNA
++AF_DECnet = PF_DECnet
++AF_DLI = PF_DLI
++AF_LAT = PF_LAT
++AF_HYLINK = PF_HYLINK
++AF_APPLETALK = PF_APPLETALK
++AF_ROUTE = PF_ROUTE
++AF_LINK = PF_LINK
++pseudo_AF_XTP = PF_XTP
++AF_COIP = PF_COIP
++AF_CNT = PF_CNT
++pseudo_AF_RTIP = PF_RTIP
++AF_IPX = PF_IPX
++AF_SIP = PF_SIP
++pseudo_AF_PIP = PF_PIP
++AF_ISDN = PF_ISDN
++AF_E164 = AF_ISDN
++pseudo_AF_KEY = PF_KEY
++AF_INET6 = PF_INET6
++AF_NATM = PF_NATM
++AF_ATM = PF_ATM
++pseudo_AF_HDRCMPLT = PF_HDRCMPLT
++AF_NETGRAPH = PF_NETGRAPH
++AF_MAX = PF_MAX
++SOMAXCONN = 128
++
++# Included from bits/sockaddr.h
++_BITS_SOCKADDR_H = 1
++def __SOCKADDR_COMMON(sa_prefix): return \
++
++_HAVE_SA_LEN = 1
++_SS_SIZE = 128
++def CMSG_FIRSTHDR(mhdr): return \
++
++CMGROUP_MAX = 16
++SOL_SOCKET = 0xffff
++LOCAL_PEERCRED = 0x001
++LOCAL_CREDS = 0x002
++LOCAL_CONNWAIT = 0x004
++
++# Included from bits/socket2.h
++def IN_CLASSA(a): return ((((in_addr_t)(a)) & (-2147483648)) == 0)
++
++IN_CLASSA_NET = (-16777216)
++IN_CLASSA_NSHIFT = 24
++IN_CLASSA_HOST = ((-1) & ~IN_CLASSA_NET)
++IN_CLASSA_MAX = 128
++def IN_CLASSB(a): return ((((in_addr_t)(a)) & (-1073741824)) == (-2147483648))
++
++IN_CLASSB_NET = (-65536)
++IN_CLASSB_NSHIFT = 16
++IN_CLASSB_HOST = ((-1) & ~IN_CLASSB_NET)
++IN_CLASSB_MAX = 65536
++def IN_CLASSC(a): return ((((in_addr_t)(a)) & (-536870912)) == (-1073741824))
++
++IN_CLASSC_NET = (-256)
++IN_CLASSC_NSHIFT = 8
++IN_CLASSC_HOST = ((-1) & ~IN_CLASSC_NET)
++def IN_CLASSD(a): return ((((in_addr_t)(a)) & (-268435456)) == (-536870912))
++
++def IN_MULTICAST(a): return IN_CLASSD(a)
++
++def IN_EXPERIMENTAL(a): return ((((in_addr_t)(a)) & (-536870912)) == (-536870912))
++
++def IN_BADCLASS(a): return ((((in_addr_t)(a)) & (-268435456)) == (-268435456))
++
++IN_LOOPBACKNET = 127
++INET_ADDRSTRLEN = 16
++INET6_ADDRSTRLEN = 46
++
++# Included from bits/in.h
++IMPLINK_IP = 155
++IMPLINK_LOWEXPER = 156
++IMPLINK_HIGHEXPER = 158
++IPPROTO_DIVERT = 258
++SOL_IP = 0
++IP_OPTIONS = 1
++IP_HDRINCL = 2
++IP_TOS = 3
++IP_TTL = 4
++IP_RECVOPTS = 5
++IP_RECVRETOPTS = 6
++IP_RECVDSTADDR = 7
++IP_SENDSRCADDR = IP_RECVDSTADDR
++IP_RETOPTS = 8
++IP_MULTICAST_IF = 9
++IP_MULTICAST_TTL = 10
++IP_MULTICAST_LOOP = 11
++IP_ADD_MEMBERSHIP = 12
++IP_DROP_MEMBERSHIP = 13
++IP_MULTICAST_VIF = 14
++IP_RSVP_ON = 15
++IP_RSVP_OFF = 16
++IP_RSVP_VIF_ON = 17
++IP_RSVP_VIF_OFF = 18
++IP_PORTRANGE = 19
++IP_RECVIF = 20
++IP_IPSEC_POLICY = 21
++IP_FAITH = 22
++IP_ONESBCAST = 23
++IP_NONLOCALOK = 24
++IP_FW_TABLE_ADD = 40
++IP_FW_TABLE_DEL = 41
++IP_FW_TABLE_FLUSH = 42
++IP_FW_TABLE_GETSIZE = 43
++IP_FW_TABLE_LIST = 44
++IP_FW_ADD = 50
++IP_FW_DEL = 51
++IP_FW_FLUSH = 52
++IP_FW_ZERO = 53
++IP_FW_GET = 54
++IP_FW_RESETLOG = 55
++IP_FW_NAT_CFG = 56
++IP_FW_NAT_DEL = 57
++IP_FW_NAT_GET_CONFIG = 58
++IP_FW_NAT_GET_LOG = 59
++IP_DUMMYNET_CONFIGURE = 60
++IP_DUMMYNET_DEL = 61
++IP_DUMMYNET_FLUSH = 62
++IP_DUMMYNET_GET = 64
++IP_RECVTTL = 65
++IP_MINTTL = 66
++IP_DONTFRAG = 67
++IP_ADD_SOURCE_MEMBERSHIP = 70
++IP_DROP_SOURCE_MEMBERSHIP = 71
++IP_BLOCK_SOURCE = 72
++IP_UNBLOCK_SOURCE = 73
++IP_MSFILTER = 74
++MCAST_JOIN_GROUP = 80
++MCAST_LEAVE_GROUP = 81
++MCAST_JOIN_SOURCE_GROUP = 82
++MCAST_LEAVE_SOURCE_GROUP = 83
++MCAST_BLOCK_SOURCE = 84
++MCAST_UNBLOCK_SOURCE = 85
++IP_DEFAULT_MULTICAST_TTL = 1
++IP_DEFAULT_MULTICAST_LOOP = 1
++IP_MIN_MEMBERSHIPS = 31
++IP_MAX_MEMBERSHIPS = 4095
++IP_MAX_SOURCE_FILTER = 1024
++MCAST_UNDEFINED = 0
++MCAST_INCLUDE = 1
++MCAST_EXCLUDE = 2
++IP_PORTRANGE_DEFAULT = 0
++IP_PORTRANGE_HIGH = 1
++IP_PORTRANGE_LOW = 2
++IPCTL_FORWARDING = 1
++IPCTL_SENDREDIRECTS = 2
++IPCTL_DEFTTL = 3
++IPCTL_DEFMTU = 4
++IPCTL_RTEXPIRE = 5
++IPCTL_RTMINEXPIRE = 6
++IPCTL_RTMAXCACHE = 7
++IPCTL_SOURCEROUTE = 8
++IPCTL_DIRECTEDBROADCAST = 9
++IPCTL_INTRQMAXLEN = 10
++IPCTL_INTRQDROPS = 11
++IPCTL_STATS = 12
++IPCTL_ACCEPTSOURCEROUTE = 13
++IPCTL_FASTFORWARDING = 14
++IPCTL_KEEPFAITH = 15
++IPCTL_GIF_TTL = 16
++IPCTL_MAXID = 17
++IPV6_SOCKOPT_RESERVED1 = 3
++IPV6_UNICAST_HOPS = 4
++IPV6_MULTICAST_IF = 9
++IPV6_MULTICAST_HOPS = 10
++IPV6_MULTICAST_LOOP = 11
++IPV6_JOIN_GROUP = 12
++IPV6_LEAVE_GROUP = 13
++IPV6_PORTRANGE = 14
++ICMP6_FILTER = 18
++IPV6_CHECKSUM = 26
++IPV6_V6ONLY = 27
++IPV6_IPSEC_POLICY = 28
++IPV6_FAITH = 29
++IPV6_FW_ADD = 30
++IPV6_FW_DEL = 31
++IPV6_FW_FLUSH = 32
++IPV6_FW_ZERO = 33
++IPV6_FW_GET = 34
++IPV6_RTHDRDSTOPTS = 35
++IPV6_RECVPKTINFO = 36
++IPV6_RECVHOPLIMIT = 37
++IPV6_RECVRTHDR = 38
++IPV6_RECVHOPOPTS = 39
++IPV6_RECVDSTOPTS = 40
++IPV6_USE_MIN_MTU = 42
++IPV6_RECVPATHMTU = 43
++IPV6_PATHMTU = 44
++IPV6_PKTINFO = 46
++IPV6_HOPLIMIT = 47
++IPV6_NEXTHOP = 48
++IPV6_HOPOPTS = 49
++IPV6_DSTOPTS = 50
++IPV6_RTHDR = 51
++IPV6_RECVTCLASS = 57
++IPV6_AUTOFLOWLABEL = 59
++IPV6_TCLASS = 61
++IPV6_DONTFRAG = 62
++IPV6_PREFER_TEMPADDR = 63
++IPV6_ADD_MEMBERSHIP = IPV6_JOIN_GROUP
++IPV6_DROP_MEMBERSHIP = IPV6_LEAVE_GROUP
++IPV6_RXHOPOPTS = IPV6_HOPOPTS
++IPV6_RXDSTOPTS = IPV6_DSTOPTS
++SOL_IPV6 = 41
++SOL_ICMPV6 = 58
++IPV6_DEFAULT_MULTICAST_HOPS = 1
++IPV6_DEFAULT_MULTICAST_LOOP = 1
++IPV6_PORTRANGE_DEFAULT = 0
++IPV6_PORTRANGE_HIGH = 1
++IPV6_PORTRANGE_LOW = 2
++IPV6_RTHDR_LOOSE = 0
++IPV6_RTHDR_STRICT = 1
++IPV6_RTHDR_TYPE_0 = 0
++IPV6CTL_FORWARDING = 1
++IPV6CTL_SENDREDIRECTS = 2
++IPV6CTL_DEFHLIM = 3
++IPV6CTL_FORWSRCRT = 5
++IPV6CTL_STATS = 6
++IPV6CTL_MRTSTATS = 7
++IPV6CTL_MRTPROTO = 8
++IPV6CTL_MAXFRAGPACKETS = 9
++IPV6CTL_SOURCECHECK = 10
++IPV6CTL_SOURCECHECK_LOGINT = 11
++IPV6CTL_ACCEPT_RTADV = 12
++IPV6CTL_KEEPFAITH = 13
++IPV6CTL_LOG_INTERVAL = 14
++IPV6CTL_HDRNESTLIMIT = 15
++IPV6CTL_DAD_COUNT = 16
++IPV6CTL_AUTO_FLOWLABEL = 17
++IPV6CTL_DEFMCASTHLIM = 18
++IPV6CTL_GIF_HLIM = 19
++IPV6CTL_KAME_VERSION = 20
++IPV6CTL_USE_DEPRECATED = 21
++IPV6CTL_RR_PRUNE = 22
++IPV6CTL_V6ONLY = 24
++IPV6CTL_RTEXPIRE = 25
++IPV6CTL_RTMINEXPIRE = 26
++IPV6CTL_RTMAXCACHE = 27
++IPV6CTL_USETEMPADDR = 32
++IPV6CTL_TEMPPLTIME = 33
++IPV6CTL_TEMPVLTIME = 34
++IPV6CTL_AUTO_LINKLOCAL = 35
++IPV6CTL_RIP6STATS = 36
++IPV6CTL_PREFER_TEMPADDR = 37
++IPV6CTL_ADDRCTLPOLICY = 38
++IPV6CTL_USE_DEFAULTZONE = 39
++IPV6CTL_MAXFRAGS = 41
++IPV6CTL_MCAST_PMTU = 44
++IPV6CTL_STEALTH = 45
++ICMPV6CTL_ND6_ONLINKNSRFC4861 = 47
++IPV6CTL_MAXID = 48
++
++# Included from endian.h
++_ENDIAN_H = 1
++__LITTLE_ENDIAN = 1234
++__BIG_ENDIAN = 4321
++__PDP_ENDIAN = 3412
++
++# Included from bits/endian.h
++__BYTE_ORDER = __LITTLE_ENDIAN
++__FLOAT_WORD_ORDER = __BYTE_ORDER
++LITTLE_ENDIAN = __LITTLE_ENDIAN
++BIG_ENDIAN = __BIG_ENDIAN
++PDP_ENDIAN = __PDP_ENDIAN
++BYTE_ORDER = __BYTE_ORDER
++
++# Included from bits/byteswap.h
++_BITS_BYTESWAP_H = 1
++def __bswap_constant_16(x): return \
++
++def __bswap_16(x): return \
++
++def __bswap_16(x): return \
++
++def __bswap_constant_32(x): return \
++
++def __bswap_32(x): return \
++
++def __bswap_32(x): return \
++
++def __bswap_32(x): return \
++
++def __bswap_constant_64(x): return \
++
++def __bswap_64(x): return \
++
++def htobe16(x): return __bswap_16 (x)
++
++def htole16(x): return (x)
++
++def be16toh(x): return __bswap_16 (x)
++
++def le16toh(x): return (x)
++
++def htobe32(x): return __bswap_32 (x)
++
++def htole32(x): return (x)
++
++def be32toh(x): return __bswap_32 (x)
++
++def le32toh(x): return (x)
++
++def htobe64(x): return __bswap_64 (x)
++
++def htole64(x): return (x)
++
++def be64toh(x): return __bswap_64 (x)
++
++def le64toh(x): return (x)
++
++def htobe16(x): return (x)
++
++def htole16(x): return __bswap_16 (x)
++
++def be16toh(x): return (x)
++
++def le16toh(x): return __bswap_16 (x)
++
++def htobe32(x): return (x)
++
++def htole32(x): return __bswap_32 (x)
++
++def be32toh(x): return (x)
++
++def le32toh(x): return __bswap_32 (x)
++
++def htobe64(x): return (x)
++
++def htole64(x): return __bswap_64 (x)
++
++def be64toh(x): return (x)
++
++def le64toh(x): return __bswap_64 (x)
++
++def ntohl(x): return (x)
++
++def ntohs(x): return (x)
++
++def htonl(x): return (x)
++
++def htons(x): return (x)
++
++def ntohl(x): return __bswap_32 (x)
++
++def ntohs(x): return __bswap_16 (x)
++
++def htonl(x): return __bswap_32 (x)
++
++def htons(x): return __bswap_16 (x)
++
++def IN6_IS_ADDR_UNSPECIFIED(a): return \
++
++def IN6_IS_ADDR_LOOPBACK(a): return \
++
++def IN6_IS_ADDR_LINKLOCAL(a): return \
++
++def IN6_IS_ADDR_SITELOCAL(a): return \
++
++def IN6_IS_ADDR_V4MAPPED(a): return \
++
++def IN6_IS_ADDR_V4COMPAT(a): return \
++
++def IN6_IS_ADDR_MC_NODELOCAL(a): return \
++
++def IN6_IS_ADDR_MC_LINKLOCAL(a): return \
++
++def IN6_IS_ADDR_MC_SITELOCAL(a): return \
++
++def IN6_IS_ADDR_MC_ORGLOCAL(a): return \
++
++def IN6_IS_ADDR_MC_GLOBAL(a): return \
++
+--- /dev/null
++++ b/Lib/plat-gnukfreebsd8/TYPES.py
+@@ -0,0 +1,303 @@
++# Generated by h2py from /usr/include/sys/types.h
++_SYS_TYPES_H = 1
++
++# Included from features.h
++_FEATURES_H = 1
++__USE_ANSI = 1
++__FAVOR_BSD = 1
++_ISOC99_SOURCE = 1
++_POSIX_SOURCE = 1
++_POSIX_C_SOURCE = 200809L
++_XOPEN_SOURCE = 700
++_XOPEN_SOURCE_EXTENDED = 1
++_LARGEFILE64_SOURCE = 1
++_BSD_SOURCE = 1
++_SVID_SOURCE = 1
++_ATFILE_SOURCE = 1
++_BSD_SOURCE = 1
++_SVID_SOURCE = 1
++__USE_ISOC99 = 1
++__USE_ISOC95 = 1
++_POSIX_SOURCE = 1
++_POSIX_C_SOURCE = 2
++_POSIX_C_SOURCE = 199506L
++_POSIX_C_SOURCE = 200112L
++_POSIX_C_SOURCE = 200809L
++__USE_POSIX_IMPLICITLY = 1
++__USE_POSIX = 1
++__USE_POSIX2 = 1
++__USE_POSIX199309 = 1
++__USE_POSIX199506 = 1
++__USE_XOPEN2K = 1
++__USE_ISOC99 = 1
++__USE_XOPEN2K8 = 1
++_ATFILE_SOURCE = 1
++__USE_XOPEN = 1
++__USE_XOPEN_EXTENDED = 1
++__USE_UNIX98 = 1
++_LARGEFILE_SOURCE = 1
++__USE_XOPEN2K8 = 1
++__USE_XOPEN2K = 1
++__USE_ISOC99 = 1
++__USE_XOPEN_EXTENDED = 1
++__USE_LARGEFILE = 1
++__USE_LARGEFILE64 = 1
++__USE_FILE_OFFSET64 = 1
++__USE_MISC = 1
++__USE_BSD = 1
++__USE_SVID = 1
++__USE_ATFILE = 1
++__USE_GNU = 1
++__USE_REENTRANT = 1
++__USE_FORTIFY_LEVEL = 2
++__USE_FORTIFY_LEVEL = 1
++__USE_FORTIFY_LEVEL = 0
++
++# Included from bits/predefs.h
++__STDC_IEC_559__ = 1
++__STDC_IEC_559_COMPLEX__ = 1
++__STDC_ISO_10646__ = 200009L
++__GNU_LIBRARY__ = 6
++__GLIBC__ = 2
++__GLIBC_MINOR__ = 11
++__GLIBC_HAVE_LONG_LONG = 1
++
++# Included from sys/cdefs.h
++_SYS_CDEFS_H = 1
++def __NTH(fct): return fct
++
++def __NTH(fct): return fct
++
++def __P(args): return args
++
++def __PMT(args): return args
++
++def __STRING(x): return #x
++
++def __bos(ptr): return __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1)
++
++def __bos0(ptr): return __builtin_object_size (ptr, 0)
++
++def __warnattr(msg): return __attribute__((__warning__ (msg)))
++
++__flexarr = []
++__flexarr = [0]
++__flexarr = []
++__flexarr = [1]
++def __ASMNAME(cname): return __ASMNAME2 (__USER_LABEL_PREFIX__, cname)
++
++def __attribute__(xyz): return  
++
++def __attribute_format_arg__(x): return __attribute__ ((__format_arg__ (x)))
++
++def __attribute_format_arg__(x): return  
++
++
++# Included from bits/wordsize.h
++__WORDSIZE = 32
++__LDBL_COMPAT = 1
++def __LDBL_REDIR_DECL(name): return \
++
++__USE_LARGEFILE = 1
++__USE_LARGEFILE64 = 1
++__USE_EXTERN_INLINES = 1
++__USE_EXTERN_INLINES_IN_LIBC = 1
++
++# Included from gnu/stubs.h
++
++# Included from bits/types.h
++_BITS_TYPES_H = 1
++__S32_TYPE = int
++__SWORD_TYPE = int
++__SLONG32_TYPE = int
++
++# Included from bits/typesizes.h
++_BITS_TYPESIZES_H = 1
++__PID_T_TYPE = __S32_TYPE
++__CLOCK_T_TYPE = __S32_TYPE
++__SWBLK_T_TYPE = __S32_TYPE
++__CLOCKID_T_TYPE = __S32_TYPE
++__TIMER_T_TYPE = __S32_TYPE
++__SSIZE_T_TYPE = __SWORD_TYPE
++__FD_SETSIZE = 1024
++
++# Included from time.h
++_TIME_H = 1
++
++# Included from bits/time.h
++_BITS_TIME_H = 1
++CLOCKS_PER_SEC = 1000000l
++CLK_TCK = 128
++CLOCK_REALTIME = 0
++CLOCK_PROCESS_CPUTIME_ID = 2
++CLOCK_THREAD_CPUTIME_ID = 3
++CLOCK_MONOTONIC = 4
++CLOCK_VIRTUAL = 1
++CLOCK_PROF = 2
++CLOCK_UPTIME = 5
++CLOCK_UPTIME_PRECISE = 7
++CLOCK_UPTIME_FAST = 8
++CLOCK_REALTIME_PRECISE = 9
++CLOCK_REALTIME_FAST = 10
++CLOCK_MONOTONIC_PRECISE = 11
++CLOCK_MONOTONIC_FAST = 12
++CLOCK_SECOND = 13
++TIMER_RELTIME = 0
++TIMER_ABSTIME = 1
++_STRUCT_TIMEVAL = 1
++CLK_TCK = CLOCKS_PER_SEC
++__clock_t_defined = 1
++__time_t_defined = 1
++__clockid_t_defined = 1
++__timer_t_defined = 1
++__timespec_defined = 1
++
++# Included from xlocale.h
++_XLOCALE_H = 1
++def __isleap(year): return \
++
++__BIT_TYPES_DEFINED__ = 1
++
++# Included from endian.h
++_ENDIAN_H = 1
++__LITTLE_ENDIAN = 1234
++__BIG_ENDIAN = 4321
++__PDP_ENDIAN = 3412
++
++# Included from bits/endian.h
++__BYTE_ORDER = __LITTLE_ENDIAN
++__FLOAT_WORD_ORDER = __BYTE_ORDER
++LITTLE_ENDIAN = __LITTLE_ENDIAN
++BIG_ENDIAN = __BIG_ENDIAN
++PDP_ENDIAN = __PDP_ENDIAN
++BYTE_ORDER = __BYTE_ORDER
++
++# Included from bits/byteswap.h
++_BITS_BYTESWAP_H = 1
++def __bswap_constant_16(x): return \
++
++def __bswap_16(x): return \
++
++def __bswap_16(x): return \
++
++def __bswap_constant_32(x): return \
++
++def __bswap_32(x): return \
++
++def __bswap_32(x): return \
++
++def __bswap_32(x): return \
++
++def __bswap_constant_64(x): return \
++
++def __bswap_64(x): return \
++
++def htobe16(x): return __bswap_16 (x)
++
++def htole16(x): return (x)
++
++def be16toh(x): return __bswap_16 (x)
++
++def le16toh(x): return (x)
++
++def htobe32(x): return __bswap_32 (x)
++
++def htole32(x): return (x)
++
++def be32toh(x): return __bswap_32 (x)
++
++def le32toh(x): return (x)
++
++def htobe64(x): return __bswap_64 (x)
++
++def htole64(x): return (x)
++
++def be64toh(x): return __bswap_64 (x)
++
++def le64toh(x): return (x)
++
++def htobe16(x): return (x)
++
++def htole16(x): return __bswap_16 (x)
++
++def be16toh(x): return (x)
++
++def le16toh(x): return __bswap_16 (x)
++
++def htobe32(x): return (x)
++
++def htole32(x): return __bswap_32 (x)
++
++def be32toh(x): return (x)
++
++def le32toh(x): return __bswap_32 (x)
++
++def htobe64(x): return (x)
++
++def htole64(x): return __bswap_64 (x)
++
++def be64toh(x): return (x)
++
++def le64toh(x): return __bswap_64 (x)
++
++
++# Included from sys/select.h
++_SYS_SELECT_H = 1
++
++# Included from bits/select.h
++def __FD_ZERO(fdsp): return \
++
++def __FD_ZERO(set): return \
++
++
++# Included from bits/sigset.h
++_SIGSET_H_types = 1
++_SIGSET_H_fns = 1
++def __sigword(sig): return (((sig) - 1) >> 5)
++
++def __sigemptyset(set): return \
++
++def __sigfillset(set): return \
++
++def __sigisemptyset(set): return \
++
++def __FDELT(d): return ((d) / __NFDBITS)
++
++FD_SETSIZE = __FD_SETSIZE
++def FD_ZERO(fdsetp): return __FD_ZERO (fdsetp)
++
++
++# Included from sys/sysmacros.h
++_SYS_SYSMACROS_H = 1
++def minor(dev): return ((int)((dev) & (-65281)))
++
++def gnu_dev_major(dev): return major (dev)
++
++def gnu_dev_minor(dev): return minor (dev)
++
++
++# Included from bits/pthreadtypes.h
++_BITS_PTHREADTYPES_H = 1
++
++# Included from bits/sched.h
++SCHED_OTHER = 2
++SCHED_FIFO = 1
++SCHED_RR = 3
++CSIGNAL = 0x000000ff
++CLONE_VM = 0x00000100
++CLONE_FS = 0x00000200
++CLONE_FILES = 0x00000400
++CLONE_SIGHAND = 0x00000800
++CLONE_PTRACE = 0x00002000
++CLONE_VFORK = 0x00004000
++CLONE_SYSVSEM = 0x00040000
++__defined_schedparam = 1
++__CPU_SETSIZE = 128
++def __CPUELT(cpu): return ((cpu) / __NCPUBITS)
++
++def __CPU_ALLOC_SIZE(count): return \
++
++def __CPU_ALLOC(count): return __sched_cpualloc (count)
++
++def __CPU_FREE(cpuset): return __sched_cpufree (cpuset)
++
+--- /dev/null
++++ b/Lib/plat-gnukfreebsd8/DLFCN.py
+@@ -0,0 +1,118 @@
++# Generated by h2py from /usr/include/dlfcn.h
++_DLFCN_H = 1
++
++# Included from features.h
++_FEATURES_H = 1
++__USE_ANSI = 1
++__FAVOR_BSD = 1
++_ISOC99_SOURCE = 1
++_POSIX_SOURCE = 1
++_POSIX_C_SOURCE = 200809L
++_XOPEN_SOURCE = 700
++_XOPEN_SOURCE_EXTENDED = 1
++_LARGEFILE64_SOURCE = 1
++_BSD_SOURCE = 1
++_SVID_SOURCE = 1
++_ATFILE_SOURCE = 1
++_BSD_SOURCE = 1
++_SVID_SOURCE = 1
++__USE_ISOC99 = 1
++__USE_ISOC95 = 1
++_POSIX_SOURCE = 1
++_POSIX_C_SOURCE = 2
++_POSIX_C_SOURCE = 199506L
++_POSIX_C_SOURCE = 200112L
++_POSIX_C_SOURCE = 200809L
++__USE_POSIX_IMPLICITLY = 1
++__USE_POSIX = 1
++__USE_POSIX2 = 1
++__USE_POSIX199309 = 1
++__USE_POSIX199506 = 1
++__USE_XOPEN2K = 1
++__USE_ISOC99 = 1
++__USE_XOPEN2K8 = 1
++_ATFILE_SOURCE = 1
++__USE_XOPEN = 1
++__USE_XOPEN_EXTENDED = 1
++__USE_UNIX98 = 1
++_LARGEFILE_SOURCE = 1
++__USE_XOPEN2K8 = 1
++__USE_XOPEN2K = 1
++__USE_ISOC99 = 1
++__USE_XOPEN_EXTENDED = 1
++__USE_LARGEFILE = 1
++__USE_LARGEFILE64 = 1
++__USE_FILE_OFFSET64 = 1
++__USE_MISC = 1
++__USE_BSD = 1
++__USE_SVID = 1
++__USE_ATFILE = 1
++__USE_GNU = 1
++__USE_REENTRANT = 1
++__USE_FORTIFY_LEVEL = 2
++__USE_FORTIFY_LEVEL = 1
++__USE_FORTIFY_LEVEL = 0
++
++# Included from bits/predefs.h
++__STDC_IEC_559__ = 1
++__STDC_IEC_559_COMPLEX__ = 1
++__STDC_ISO_10646__ = 200009L
++__GNU_LIBRARY__ = 6
++__GLIBC__ = 2
++__GLIBC_MINOR__ = 11
++__GLIBC_HAVE_LONG_LONG = 1
++
++# Included from sys/cdefs.h
++_SYS_CDEFS_H = 1
++def __NTH(fct): return fct
++
++def __NTH(fct): return fct
++
++def __P(args): return args
++
++def __PMT(args): return args
++
++def __STRING(x): return #x
++
++def __bos(ptr): return __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1)
++
++def __bos0(ptr): return __builtin_object_size (ptr, 0)
++
++def __warnattr(msg): return __attribute__((__warning__ (msg)))
++
++__flexarr = []
++__flexarr = [0]
++__flexarr = []
++__flexarr = [1]
++def __ASMNAME(cname): return __ASMNAME2 (__USER_LABEL_PREFIX__, cname)
++
++def __attribute__(xyz): return  
++
++def __attribute_format_arg__(x): return __attribute__ ((__format_arg__ (x)))
++
++def __attribute_format_arg__(x): return  
++
++
++# Included from bits/wordsize.h
++__WORDSIZE = 32
++__LDBL_COMPAT = 1
++def __LDBL_REDIR_DECL(name): return \
++
++__USE_LARGEFILE = 1
++__USE_LARGEFILE64 = 1
++__USE_EXTERN_INLINES = 1
++__USE_EXTERN_INLINES_IN_LIBC = 1
++
++# Included from gnu/stubs.h
++
++# Included from bits/dlfcn.h
++RTLD_LAZY = 0x00001
++RTLD_NOW = 0x00002
++RTLD_BINDING_MASK = 0x3
++RTLD_NOLOAD = 0x00004
++RTLD_DEEPBIND = 0x00008
++RTLD_GLOBAL = 0x00100
++RTLD_LOCAL = 0
++RTLD_NODELETE = 0x01000
++LM_ID_BASE = 0
++LM_ID_NEWLM = -1
--- python2.7-2.7.3.orig/debian/patches/db5.1.diff
+++ python2.7-2.7.3/debian/patches/db5.1.diff
@@ -0,0 +1,1768 @@
+Index: b/setup.py
+===================================================================
+--- a/setup.py
++++ b/setup.py
+@@ -799,7 +799,7 @@
+         # a release.  Most open source OSes come with one or more
+         # versions of BerkeleyDB already installed.
+ 
+-        max_db_ver = (4, 8)
++        max_db_ver = (5, 1)
+         min_db_ver = (4, 1)
+         db_setup_debug = False   # verbose debug prints from this script?
+ 
+@@ -821,7 +821,11 @@
+             return True
+ 
+         def gen_db_minor_ver_nums(major):
+-            if major == 4:
++            if major == 5:
++                for x in range(max_db_ver[1]+1):
++                    if allow_db_ver((5, x)):
++                        yield x
++            elif major == 4:
+                 for x in range(max_db_ver[1]+1):
+                     if allow_db_ver((4, x)):
+                         yield x
+Index: b/Lib/bsddb/__init__.py
+===================================================================
+--- a/Lib/bsddb/__init__.py
++++ b/Lib/bsddb/__init__.py
+@@ -33,7 +33,7 @@
+ #----------------------------------------------------------------------
+ 
+ 
+-"""Support for Berkeley DB 4.1 through 4.8 with a simple interface.
++"""Support for Berkeley DB 4.2 through 5.1 with a simple interface.
+ 
+ For the full featured object oriented interface use the bsddb.db module
+ instead.  It mirrors the Oracle Berkeley DB C API.
+Index: b/Lib/bsddb/test/test_all.py
+===================================================================
+--- a/Lib/bsddb/test/test_all.py
++++ b/Lib/bsddb/test/test_all.py
+@@ -484,6 +484,8 @@
+     print '-=' * 38
+     print db.DB_VERSION_STRING
+     print 'bsddb.db.version():   %s' % (db.version(), )
++    if db.version() >= (5, 0) :
++        print 'bsddb.db.full_version(): %s' %repr(db.full_version())
+     print 'bsddb.db.__version__: %s' % db.__version__
+     print 'bsddb.db.cvsid:       %s' % db.cvsid
+ 
+@@ -528,7 +530,8 @@
+ 
+ # This path can be overriden via "set_test_path_prefix()".
+ import os, os.path
+-get_new_path.prefix=os.path.join(os.sep,"tmp","z-Berkeley_DB")
++get_new_path.prefix=os.path.join(os.environ.get("TMPDIR",
++    os.path.join(os.sep,"tmp")), "z-Berkeley_DB")
+ get_new_path.num=0
+ 
+ def get_test_path_prefix() :
+Index: b/Lib/bsddb/test/test_associate.py
+===================================================================
+--- a/Lib/bsddb/test/test_associate.py
++++ b/Lib/bsddb/test/test_associate.py
+@@ -76,6 +76,11 @@
+ #----------------------------------------------------------------------
+ 
+ class AssociateErrorTestCase(unittest.TestCase):
++    import sys
++    if sys.version_info < (2, 4) :
++        def assertTrue(self, expr, msg=None):
++            self.failUnless(expr,msg=msg)
++
+     def setUp(self):
+         self.filename = self.__class__.__name__ + '.db'
+         self.homeDir = get_new_environment_path()
+@@ -120,6 +125,11 @@
+ 
+ 
+ class AssociateTestCase(unittest.TestCase):
++    import sys
++    if sys.version_info < (2, 4) :
++        def assertTrue(self, expr, msg=None):
++            self.failUnless(expr,msg=msg)
++
+     keytype = ''
+     envFlags = 0
+     dbFlags = 0
+Index: b/Lib/bsddb/test/test_basics.py
+===================================================================
+--- a/Lib/bsddb/test/test_basics.py
++++ b/Lib/bsddb/test/test_basics.py
+@@ -74,7 +74,6 @@
+         # create and open the DB
+         self.d = db.DB(self.env)
+         if not self.useEnv :
+-            if db.version() >= (4, 2) :
+                 self.d.set_cachesize(*self.cachesize)
+                 cachesize = self.d.get_cachesize()
+                 self.assertEqual(cachesize[0], self.cachesize[0])
+@@ -792,7 +791,6 @@
+         for log in logs:
+             if verbose:
+                 print 'log file: ' + log
+-        if db.version() >= (4,2):
+             logs = self.env.log_archive(db.DB_ARCH_REMOVE)
+             self.assertTrue(not logs)
+ 
+@@ -875,7 +873,6 @@
+ 
+     #----------------------------------------
+ 
+-    if db.version() >= (4, 2) :
+         def test_get_tx_max(self) :
+             self.assertEqual(self.env.get_tx_max(), 30)
+ 
+Index: b/Lib/bsddb/test/test_compat.py
+===================================================================
+--- a/Lib/bsddb/test/test_compat.py
++++ b/Lib/bsddb/test/test_compat.py
+@@ -11,6 +11,11 @@
+ 
+ 
+ class CompatibilityTestCase(unittest.TestCase):
++    import sys
++    if sys.version_info < (2, 4) :
++        def assertTrue(self, expr, msg=None):
++            self.failUnless(expr,msg=msg)
++
+     def setUp(self):
+         self.filename = get_new_database_path()
+ 
+Index: b/Lib/bsddb/test/test_db.py
+===================================================================
+--- a/Lib/bsddb/test/test_db.py
++++ b/Lib/bsddb/test/test_db.py
+@@ -11,6 +11,8 @@
+     if sys.version_info < (2, 4) :
+         def assertTrue(self, expr, msg=None):
+             self.failUnless(expr,msg=msg)
++        def assertFalse(self, expr, msg=None):
++            self.failIf(expr,msg=msg)
+ 
+     def setUp(self):
+         self.path = get_new_database_path()
+@@ -19,10 +21,28 @@
+     def tearDown(self):
+         self.db.close()
+         del self.db
+-        test_support.rmtree(self.path)
++        test_support.unlink(self.path)
+ 
+ class DB_general(DB) :
+-    if db.version() >= (4, 2) :
++    def test_get_open_flags(self) :
++        self.db.open(self.path, dbtype=db.DB_HASH, flags = db.DB_CREATE)
++        self.assertEqual(db.DB_CREATE, self.db.get_open_flags())
++
++    def test_get_open_flags2(self) :
++        self.db.open(self.path, dbtype=db.DB_HASH, flags = db.DB_CREATE |
++                db.DB_THREAD)
++        self.assertEqual(db.DB_CREATE | db.DB_THREAD, self.db.get_open_flags())
++
++    def test_get_dbname_filename(self) :
++        self.db.open(self.path, dbtype=db.DB_HASH, flags = db.DB_CREATE)
++        self.assertEqual((self.path, None), self.db.get_dbname())
++
++    def test_get_dbname_filename_database(self) :
++        name = "jcea-random-name"
++        self.db.open(self.path, dbname=name, dbtype=db.DB_HASH,
++                flags = db.DB_CREATE)
++        self.assertEqual((self.path, name), self.db.get_dbname())
++
+         def test_bt_minkey(self) :
+             for i in [17, 108, 1030] :
+                 self.db.set_bt_minkey(i)
+@@ -44,8 +64,13 @@
+                 self.db.set_priority(flag)
+                 self.assertEqual(flag, self.db.get_priority())
+ 
++    if db.version() >= (4, 3) :
++        def test_get_transactional(self) :
++            self.assertFalse(self.db.get_transactional())
++            self.db.open(self.path, dbtype=db.DB_HASH, flags = db.DB_CREATE)
++            self.assertFalse(self.db.get_transactional())
++
+ class DB_hash(DB) :
+-    if db.version() >= (4, 2) :
+         def test_h_ffactor(self) :
+             for ffactor in [4, 16, 256] :
+                 self.db.set_h_ffactor(ffactor)
+@@ -84,7 +109,6 @@
+         del self.env
+         test_support.rmtree(self.homeDir)
+ 
+-    if db.version() >= (4, 2) :
+         def test_flags(self) :
+             self.db.set_flags(db.DB_CHKSUM)
+             self.assertEqual(db.DB_CHKSUM, self.db.get_flags())
+@@ -92,8 +116,15 @@
+             self.assertEqual(db.DB_TXN_NOT_DURABLE | db.DB_CHKSUM,
+                     self.db.get_flags())
+ 
++    if db.version() >= (4, 3) :
++        def test_get_transactional(self) :
++            self.assertFalse(self.db.get_transactional())
++            # DB_AUTO_COMMIT = Implicit transaction
++            self.db.open("XXX", dbtype=db.DB_HASH,
++                    flags = db.DB_CREATE | db.DB_AUTO_COMMIT)
++            self.assertTrue(self.db.get_transactional())
++
+ class DB_recno(DB) :
+-    if db.version() >= (4, 2) :
+         def test_re_pad(self) :
+             for i in [' ', '*'] :  # Check chars
+                 self.db.set_re_pad(i)
+@@ -116,7 +147,6 @@
+                 self.assertEqual(i, self.db.get_re_source())
+ 
+ class DB_queue(DB) :
+-    if db.version() >= (4, 2) :
+         def test_re_len(self) :
+             for i in [33, 65, 300, 2000] :
+                 self.db.set_re_len(i)
+Index: b/Lib/bsddb/test/test_dbenv.py
+===================================================================
+--- a/Lib/bsddb/test/test_dbenv.py
++++ b/Lib/bsddb/test/test_dbenv.py
+@@ -25,12 +25,31 @@
+         test_support.rmtree(self.homeDir)
+ 
+ class DBEnv_general(DBEnv) :
++    def test_get_open_flags(self) :
++        flags = db.DB_CREATE | db.DB_INIT_MPOOL
++        self.env.open(self.homeDir, flags)
++        self.assertEqual(flags, self.env.get_open_flags())
++
++    def test_get_open_flags2(self) :
++        flags = db.DB_CREATE | db.DB_INIT_MPOOL | \
++                db.DB_INIT_LOCK | db.DB_THREAD
++        self.env.open(self.homeDir, flags)
++        self.assertEqual(flags, self.env.get_open_flags())
++
+     if db.version() >= (4, 7) :
+         def test_lk_partitions(self) :
+             for i in [10, 20, 40] :
+                 self.env.set_lk_partitions(i)
+                 self.assertEqual(i, self.env.get_lk_partitions())
+ 
++        def test_getset_intermediate_dir_mode(self) :
++            self.assertEqual(None, self.env.get_intermediate_dir_mode())
++            for mode in ["rwx------", "rw-rw-rw-", "rw-r--r--"] :
++                self.env.set_intermediate_dir_mode(mode)
++                self.assertEqual(mode, self.env.get_intermediate_dir_mode())
++            self.assertRaises(db.DBInvalidArgError,
++                    self.env.set_intermediate_dir_mode, "abcde")
++
+     if db.version() >= (4, 6) :
+         def test_thread(self) :
+             for i in [16, 100, 1000] :
+@@ -72,7 +91,6 @@
+                     v=self.env.get_mp_max_write()
+                     self.assertEqual((i, j), v)
+ 
+-    if db.version() >= (4, 2) :
+         def test_invalid_txn(self) :
+             # This environment doesn't support transactions
+             self.assertRaises(db.DBInvalidArgError, self.env.txn_begin)
+@@ -115,7 +133,7 @@
+                 self.assertEqual(i, self.env.get_lk_max_lockers())
+ 
+         def test_lg_regionmax(self) :
+-            for i in [128, 256, 1024] :
++            for i in [128, 256, 1000] :
+                 i = i*1024*1024
+                 self.env.set_lg_regionmax(i)
+                 j = self.env.get_lg_regionmax()
+@@ -172,8 +190,12 @@
+             self.env.open(self.homeDir, db.DB_CREATE | db.DB_INIT_MPOOL)
+             cachesize = (0, 2*1024*1024, 1)
+             self.assertRaises(db.DBInvalidArgError,
+-                self.env.set_cachesize, *cachesize)
+-            self.assertEqual(cachesize2, self.env.get_cachesize())
++                              self.env.set_cachesize, *cachesize)
++            cachesize3 = self.env.get_cachesize()
++            self.assertEqual(cachesize2[0], cachesize3[0])
++            self.assertEqual(cachesize2[2], cachesize3[2])
++            # In Berkeley DB 5.1, the cachesize can change when opening the Env
++            self.assertTrue(cachesize2[1] <= cachesize3[1])
+ 
+         def test_set_cachesize_dbenv_db(self) :
+             # You can not configure the cachesize using
+Index: b/Lib/bsddb/test/test_dbtables.py
+===================================================================
+--- a/Lib/bsddb/test/test_dbtables.py
++++ b/Lib/bsddb/test/test_dbtables.py
+@@ -38,6 +38,11 @@
+ #----------------------------------------------------------------------
+ 
+ class TableDBTestCase(unittest.TestCase):
++    import sys
++    if sys.version_info < (2, 4) :
++        def assertTrue(self, expr, msg=None):
++            self.failUnless(expr,msg=msg)
++
+     db_name = 'test-table.db'
+ 
+     def setUp(self):
+Index: b/Lib/bsddb/test/test_distributed_transactions.py
+===================================================================
+--- a/Lib/bsddb/test/test_distributed_transactions.py
++++ b/Lib/bsddb/test/test_distributed_transactions.py
+@@ -19,6 +19,11 @@
+ #----------------------------------------------------------------------
+ 
+ class DBTxn_distributed(unittest.TestCase):
++    import sys
++    if sys.version_info < (2, 4) :
++        def assertTrue(self, expr, msg=None):
++            self.failUnless(expr,msg=msg)
++
+     num_txns=1234
+     nosync=True
+     must_open_db=False
+@@ -37,15 +42,11 @@
+         self.db = db.DB(self.dbenv)
+         self.db.set_re_len(db.DB_GID_SIZE)
+         if must_open_db :
+-            if db.version() >= (4,2) :
+                 txn=self.dbenv.txn_begin()
+                 self.db.open(self.filename,
+                         db.DB_QUEUE, db.DB_CREATE | db.DB_THREAD, 0666,
+                         txn=txn)
+                 txn.commit()
+-            else :
+-                self.db.open(self.filename,
+-                        db.DB_QUEUE, db.DB_CREATE | db.DB_THREAD, 0666)
+ 
+     def setUp(self) :
+         self.homeDir = get_new_environment_path()
+Index: b/Lib/bsddb/test/test_get_none.py
+===================================================================
+--- a/Lib/bsddb/test/test_get_none.py
++++ b/Lib/bsddb/test/test_get_none.py
+@@ -11,6 +11,11 @@
+ #----------------------------------------------------------------------
+ 
+ class GetReturnsNoneTestCase(unittest.TestCase):
++    import sys
++    if sys.version_info < (2, 4) :
++        def assertTrue(self, expr, msg=None):
++            self.failUnless(expr,msg=msg)
++
+     def setUp(self):
+         self.filename = get_new_database_path()
+ 
+Index: b/Lib/bsddb/test/test_join.py
+===================================================================
+--- a/Lib/bsddb/test/test_join.py
++++ b/Lib/bsddb/test/test_join.py
+@@ -30,6 +30,11 @@
+ ]
+ 
+ class JoinTestCase(unittest.TestCase):
++    import sys
++    if sys.version_info < (2, 4) :
++        def assertTrue(self, expr, msg=None):
++            self.failUnless(expr,msg=msg)
++
+     keytype = ''
+ 
+     def setUp(self):
+Index: b/Lib/bsddb/test/test_lock.py
+===================================================================
+--- a/Lib/bsddb/test/test_lock.py
++++ b/Lib/bsddb/test/test_lock.py
+@@ -89,7 +89,6 @@
+         for t in threads:
+             t.join()
+ 
+-    if db.version() >= (4, 2) :
+         def test03_lock_timeout(self):
+             self.env.set_timeout(0, db.DB_SET_LOCK_TIMEOUT)
+             self.assertEqual(self.env.get_timeout(db.DB_SET_LOCK_TIMEOUT), 0)
+Index: b/Lib/bsddb/test/test_misc.py
+===================================================================
+--- a/Lib/bsddb/test/test_misc.py
++++ b/Lib/bsddb/test/test_misc.py
+@@ -97,10 +97,6 @@
+             test_support.unlink(self.filename)
+ 
+     def test07_DB_set_flags_persists(self):
+-        if db.version() < (4,2):
+-            # The get_flags API required for this to work is only available
+-            # in Berkeley DB >= 4.2
+-            return
+         try:
+             db1 = db.DB()
+             db1.set_flags(db.DB_DUPSORT)
+Index: b/Lib/bsddb/test/test_queue.py
+===================================================================
+--- a/Lib/bsddb/test/test_queue.py
++++ b/Lib/bsddb/test/test_queue.py
+@@ -99,11 +99,6 @@
+             print '\n', '-=' * 30
+             print "Running %s.test02_basicPost32..." % self.__class__.__name__
+ 
+-        if db.version() < (3, 2, 0):
+-            if verbose:
+-                print "Test not run, DB not new enough..."
+-            return
+-
+         d = db.DB()
+         d.set_re_len(40)  # Queues must be fixed length
+         d.open(self.filename, db.DB_QUEUE, db.DB_CREATE)
+Index: b/Lib/bsddb/test/test_recno.py
+===================================================================
+--- a/Lib/bsddb/test/test_recno.py
++++ b/Lib/bsddb/test/test_recno.py
+@@ -236,7 +236,9 @@
+         d.close()
+ 
+         # get the text from the backing source
+-        text = open(source, 'r').read()
++        f = open(source, 'r')
++        text = f.read()
++        f.close()
+         text = text.strip()
+         if verbose:
+             print text
+@@ -256,7 +258,9 @@
+         d.sync()
+         d.close()
+ 
+-        text = open(source, 'r').read()
++        f = open(source, 'r')
++        text = f.read()
++        f.close()
+         text = text.strip()
+         if verbose:
+             print text
+@@ -298,6 +302,18 @@
+         c.close()
+         d.close()
+ 
++    def test04_get_size_empty(self) :
++        d = db.DB()
++        d.open(self.filename, dbtype=db.DB_RECNO, flags=db.DB_CREATE)
++
++        row_id = d.append(' ')
++        self.assertEqual(1, d.get_size(key=row_id))
++        row_id = d.append('')
++        self.assertEqual(0, d.get_size(key=row_id))
++
++
++
++
+ 
+ #----------------------------------------------------------------------
+ 
+Index: b/Modules/_bsddb.c
+===================================================================
+--- a/Modules/_bsddb.c
++++ b/Modules/_bsddb.c
+@@ -202,9 +202,7 @@
+ static PyObject* DBNoSuchFileError;     /* ENOENT */
+ static PyObject* DBPermissionsError;    /* EPERM  */
+ 
+-#if (DBVER >= 42)
+ static PyObject* DBRepHandleDeadError;  /* DB_REP_HANDLE_DEAD */
+-#endif
+ #if (DBVER >= 44)
+ static PyObject* DBRepLockoutError;     /* DB_REP_LOCKOUT */
+ #endif
+@@ -715,9 +713,7 @@
+         case ENOENT:  errObj = DBNoSuchFileError;   break;
+         case EPERM :  errObj = DBPermissionsError;  break;
+ 
+-#if (DBVER >= 42)
+         case DB_REP_HANDLE_DEAD : errObj = DBRepHandleDeadError; break;
+-#endif
+ #if (DBVER >= 44)
+         case DB_REP_LOCKOUT : errObj = DBRepLockoutError; break;
+ #endif
+@@ -2132,7 +2128,7 @@
+     MYDB_BEGIN_ALLOW_THREADS;
+     err = self->db->get(self->db, txn, &key, &data, flags);
+     MYDB_END_ALLOW_THREADS;
+-    if (err == DB_BUFFER_SMALL) {
++    if ((err == DB_BUFFER_SMALL) || (err == 0)) {
+         retval = NUMBER_FromLong((long)data.size);
+         err = 0;
+     }
+@@ -2385,9 +2381,7 @@
+         return NULL;
+     }
+ 
+-#if (DBVER >= 42)
+     self->db->get_flags(self->db, &self->setflags);
+-#endif
+ 
+     self->flags = flags;
+ 
+@@ -2539,6 +2533,37 @@
+ #endif
+ 
+ static PyObject*
++DB_get_dbname(DBObject* self)
++{
++    int err;
++    const char *filename, *dbname;
++
++    CHECK_DB_NOT_CLOSED(self);
++
++    MYDB_BEGIN_ALLOW_THREADS;
++    err = self->db->get_dbname(self->db, &filename, &dbname);
++    MYDB_END_ALLOW_THREADS;
++    RETURN_IF_ERR();
++    /* If "dbname==NULL", it is correctly converted to "None" */
++    return Py_BuildValue("(ss)", filename, dbname);
++}
++
++static PyObject*
++DB_get_open_flags(DBObject* self)
++{
++    int err;
++    unsigned int flags;
++
++    CHECK_DB_NOT_CLOSED(self);
++
++    MYDB_BEGIN_ALLOW_THREADS;
++    err = self->db->get_open_flags(self->db, &flags);
++    MYDB_END_ALLOW_THREADS;
++    RETURN_IF_ERR();
++    return NUMBER_FromLong(flags);
++}
++
++static PyObject*
+ DB_set_q_extentsize(DBObject* self, PyObject* args)
+ {
+     int err;
+@@ -2555,7 +2580,6 @@
+     RETURN_NONE();
+ }
+ 
+-#if (DBVER >= 42)
+ static PyObject*
+ DB_get_q_extentsize(DBObject* self)
+ {
+@@ -2570,7 +2594,6 @@
+     RETURN_IF_ERR();
+     return NUMBER_FromLong(extentsize);
+ }
+-#endif
+ 
+ static PyObject*
+ DB_set_bt_minkey(DBObject* self, PyObject* args)
+@@ -2588,7 +2611,6 @@
+     RETURN_NONE();
+ }
+ 
+-#if (DBVER >= 42)
+ static PyObject*
+ DB_get_bt_minkey(DBObject* self)
+ {
+@@ -2603,7 +2625,6 @@
+     RETURN_IF_ERR();
+     return NUMBER_FromLong(bt_minkey);
+ }
+-#endif
+ 
+ static int
+ _default_cmp(const DBT *leftKey,
+@@ -2759,7 +2780,6 @@
+     RETURN_NONE();
+ }
+ 
+-#if (DBVER >= 42)
+ static PyObject*
+ DB_get_cachesize(DBObject* self)
+ {
+@@ -2777,7 +2797,6 @@
+ 
+     return Py_BuildValue("(iii)", gbytes, bytes, ncache);
+ }
+-#endif
+ 
+ static PyObject*
+ DB_set_flags(DBObject* self, PyObject* args)
+@@ -2797,7 +2816,6 @@
+     RETURN_NONE();
+ }
+ 
+-#if (DBVER >= 42)
+ static PyObject*
+ DB_get_flags(DBObject* self)
+ {
+@@ -2812,6 +2830,35 @@
+     RETURN_IF_ERR();
+     return NUMBER_FromLong(flags);
+ }
++
++#if (DBVER >= 43)
++static PyObject*
++DB_get_transactional(DBObject* self)
++{
++    int err;
++
++    CHECK_DB_NOT_CLOSED(self);
++
++    MYDB_BEGIN_ALLOW_THREADS;
++    err = self->db->get_transactional(self->db);
++    MYDB_END_ALLOW_THREADS;
++
++    if(err == 0) {
++        Py_INCREF(Py_False);
++        return Py_False;
++    } else if(err == 1) {
++        Py_INCREF(Py_True);
++        return Py_True;
++    }
++
++    /*
++    ** If we reach there, there was an error. The
++    ** "return" should be unreachable.
++    */
++    RETURN_IF_ERR();
++    assert(0);  /* This coude SHOULD be unreachable */
++    return NULL;
++}
+ #endif
+ 
+ static PyObject*
+@@ -2830,7 +2877,6 @@
+     RETURN_NONE();
+ }
+ 
+-#if (DBVER >= 42)
+ static PyObject*
+ DB_get_h_ffactor(DBObject* self)
+ {
+@@ -2845,7 +2891,6 @@
+     RETURN_IF_ERR();
+     return NUMBER_FromLong(ffactor);
+ }
+-#endif
+ 
+ static PyObject*
+ DB_set_h_nelem(DBObject* self, PyObject* args)
+@@ -2863,7 +2908,6 @@
+     RETURN_NONE();
+ }
+ 
+-#if (DBVER >= 42)
+ static PyObject*
+ DB_get_h_nelem(DBObject* self)
+ {
+@@ -2878,7 +2922,6 @@
+     RETURN_IF_ERR();
+     return NUMBER_FromLong(nelem);
+ }
+-#endif
+ 
+ static PyObject*
+ DB_set_lorder(DBObject* self, PyObject* args)
+@@ -2896,7 +2939,6 @@
+     RETURN_NONE();
+ }
+ 
+-#if (DBVER >= 42)
+ static PyObject*
+ DB_get_lorder(DBObject* self)
+ {
+@@ -2911,7 +2953,6 @@
+     RETURN_IF_ERR();
+     return NUMBER_FromLong(lorder);
+ }
+-#endif
+ 
+ static PyObject*
+ DB_set_pagesize(DBObject* self, PyObject* args)
+@@ -2929,7 +2970,6 @@
+     RETURN_NONE();
+ }
+ 
+-#if (DBVER >= 42)
+ static PyObject*
+ DB_get_pagesize(DBObject* self)
+ {
+@@ -2944,7 +2984,6 @@
+     RETURN_IF_ERR();
+     return NUMBER_FromLong(pagesize);
+ }
+-#endif
+ 
+ static PyObject*
+ DB_set_re_delim(DBObject* self, PyObject* args)
+@@ -2967,7 +3006,6 @@
+     RETURN_NONE();
+ }
+ 
+-#if (DBVER >= 42)
+ static PyObject*
+ DB_get_re_delim(DBObject* self)
+ {
+@@ -2981,7 +3019,6 @@
+     RETURN_IF_ERR();
+     return NUMBER_FromLong(re_delim);
+ }
+-#endif
+ 
+ static PyObject*
+ DB_set_re_len(DBObject* self, PyObject* args)
+@@ -2999,7 +3036,6 @@
+     RETURN_NONE();
+ }
+ 
+-#if (DBVER >= 42)
+ static PyObject*
+ DB_get_re_len(DBObject* self)
+ {
+@@ -3014,7 +3050,6 @@
+     RETURN_IF_ERR();
+     return NUMBER_FromLong(re_len);
+ }
+-#endif
+ 
+ static PyObject*
+ DB_set_re_pad(DBObject* self, PyObject* args)
+@@ -3036,7 +3071,6 @@
+     RETURN_NONE();
+ }
+ 
+-#if (DBVER >= 42)
+ static PyObject*
+ DB_get_re_pad(DBObject* self)
+ {
+@@ -3050,7 +3084,6 @@
+     RETURN_IF_ERR();
+     return NUMBER_FromLong(re_pad);
+ }
+-#endif
+ 
+ static PyObject*
+ DB_set_re_source(DBObject* self, PyObject* args)
+@@ -3069,7 +3102,6 @@
+     RETURN_NONE();
+ }
+ 
+-#if (DBVER >= 42)
+ static PyObject*
+ DB_get_re_source(DBObject* self)
+ {
+@@ -3084,7 +3116,6 @@
+     RETURN_IF_ERR();
+     return PyBytes_FromString(source);
+ }
+-#endif
+ 
+ static PyObject*
+ DB_stat(DBObject* self, PyObject* args, PyObject* kwargs)
+@@ -3381,7 +3412,6 @@
+     RETURN_NONE();
+ }
+ 
+-#if (DBVER >= 42)
+ static PyObject*
+ DB_get_encrypt_flags(DBObject* self)
+ {
+@@ -3396,7 +3426,6 @@
+ 
+     return NUMBER_FromLong(flags);
+ }
+-#endif
+ 
+ 
+ 
+@@ -4987,7 +5016,6 @@
+     RETURN_NONE();
+ }
+ 
+-#if (DBVER >= 42)
+ static PyObject*
+ DBEnv_get_encrypt_flags(DBEnvObject* self)
+ {
+@@ -5025,7 +5053,6 @@
+     RETURN_IF_ERR();
+     return NUMBER_FromLong(timeout);
+ }
+-#endif
+ 
+ 
+ static PyObject*
+@@ -5064,7 +5091,6 @@
+     RETURN_NONE();
+ }
+ 
+-#if (DBVER >= 42)
+ static PyObject*
+ DBEnv_get_shm_key(DBEnvObject* self)
+ {
+@@ -5081,7 +5107,6 @@
+ 
+     return NUMBER_FromLong(shm_key);
+ }
+-#endif
+ 
+ #if (DBVER >= 46)
+ static PyObject*
+@@ -5170,7 +5195,6 @@
+     RETURN_NONE();
+ }
+ 
+-#if (DBVER >= 42)
+ static PyObject*
+ DBEnv_get_cachesize(DBEnvObject* self)
+ {
+@@ -5188,7 +5212,6 @@
+ 
+     return Py_BuildValue("(iii)", gbytes, bytes, ncache);
+ }
+-#endif
+ 
+ 
+ static PyObject*
+@@ -5208,7 +5231,6 @@
+     RETURN_NONE();
+ }
+ 
+-#if (DBVER >= 42)
+ static PyObject*
+ DBEnv_get_flags(DBEnvObject* self)
+ {
+@@ -5223,7 +5245,6 @@
+     RETURN_IF_ERR();
+     return NUMBER_FromLong(flags);
+ }
+-#endif
+ 
+ #if (DBVER >= 47)
+ static PyObject*
+@@ -5423,7 +5444,6 @@
+     RETURN_NONE();
+ }
+ 
+-#if (DBVER >= 42)
+ static PyObject*
+ DBEnv_get_data_dirs(DBEnvObject* self)
+ {
+@@ -5463,7 +5483,6 @@
+     }
+     return tuple;
+ }
+-#endif
+ 
+ #if (DBVER >= 44)
+ static PyObject*
+@@ -5513,7 +5532,6 @@
+     RETURN_NONE();
+ }
+ 
+-#if (DBVER >= 42)
+ static PyObject*
+ DBEnv_get_lg_bsize(DBEnvObject* self)
+ {
+@@ -5528,7 +5546,6 @@
+     RETURN_IF_ERR();
+     return NUMBER_FromLong(lg_bsize);
+ }
+-#endif
+ 
+ static PyObject*
+ DBEnv_set_lg_dir(DBEnvObject* self, PyObject* args)
+@@ -5547,7 +5564,6 @@
+     RETURN_NONE();
+ }
+ 
+-#if (DBVER >= 42)
+ static PyObject*
+ DBEnv_get_lg_dir(DBEnvObject* self)
+ {
+@@ -5562,7 +5578,6 @@
+     RETURN_IF_ERR();
+     return PyBytes_FromString(dirp);
+ }
+-#endif
+ 
+ static PyObject*
+ DBEnv_set_lg_max(DBEnvObject* self, PyObject* args)
+@@ -5580,7 +5595,6 @@
+     RETURN_NONE();
+ }
+ 
+-#if (DBVER >= 42)
+ static PyObject*
+ DBEnv_get_lg_max(DBEnvObject* self)
+ {
+@@ -5595,8 +5609,6 @@
+     RETURN_IF_ERR();
+     return NUMBER_FromLong(lg_max);
+ }
+-#endif
+-
+ 
+ static PyObject*
+ DBEnv_set_lg_regionmax(DBEnvObject* self, PyObject* args)
+@@ -5614,7 +5626,6 @@
+     RETURN_NONE();
+ }
+ 
+-#if (DBVER >= 42)
+ static PyObject*
+ DBEnv_get_lg_regionmax(DBEnvObject* self)
+ {
+@@ -5629,7 +5640,6 @@
+     RETURN_IF_ERR();
+     return NUMBER_FromLong(lg_regionmax);
+ }
+-#endif
+ 
+ #if (DBVER >= 47)
+ static PyObject*
+@@ -5680,7 +5690,6 @@
+     RETURN_NONE();
+ }
+ 
+-#if (DBVER >= 42)
+ static PyObject*
+ DBEnv_get_lk_detect(DBEnvObject* self)
+ {
+@@ -5695,8 +5704,6 @@
+     RETURN_IF_ERR();
+     return NUMBER_FromLong(lk_detect);
+ }
+-#endif
+-
+ 
+ #if (DBVER < 45)
+ static PyObject*
+@@ -5734,7 +5741,6 @@
+     RETURN_NONE();
+ }
+ 
+-#if (DBVER >= 42)
+ static PyObject*
+ DBEnv_get_lk_max_locks(DBEnvObject* self)
+ {
+@@ -5749,7 +5755,6 @@
+     RETURN_IF_ERR();
+     return NUMBER_FromLong(lk_max);
+ }
+-#endif
+ 
+ static PyObject*
+ DBEnv_set_lk_max_lockers(DBEnvObject* self, PyObject* args)
+@@ -5767,7 +5772,6 @@
+     RETURN_NONE();
+ }
+ 
+-#if (DBVER >= 42)
+ static PyObject*
+ DBEnv_get_lk_max_lockers(DBEnvObject* self)
+ {
+@@ -5782,7 +5786,6 @@
+     RETURN_IF_ERR();
+     return NUMBER_FromLong(lk_max);
+ }
+-#endif
+ 
+ static PyObject*
+ DBEnv_set_lk_max_objects(DBEnvObject* self, PyObject* args)
+@@ -5800,7 +5803,6 @@
+     RETURN_NONE();
+ }
+ 
+-#if (DBVER >= 42)
+ static PyObject*
+ DBEnv_get_lk_max_objects(DBEnvObject* self)
+ {
+@@ -5815,9 +5817,7 @@
+     RETURN_IF_ERR();
+     return NUMBER_FromLong(lk_max);
+ }
+-#endif
+ 
+-#if (DBVER >= 42)
+ static PyObject*
+ DBEnv_get_mp_mmapsize(DBEnvObject* self)
+ {
+@@ -5832,8 +5832,6 @@
+     RETURN_IF_ERR();
+     return NUMBER_FromLong(mmapsize);
+ }
+-#endif
+-
+ 
+ static PyObject*
+ DBEnv_set_mp_mmapsize(DBEnvObject* self, PyObject* args)
+@@ -5869,8 +5867,6 @@
+     RETURN_NONE();
+ }
+ 
+-
+-#if (DBVER >= 42)
+ static PyObject*
+ DBEnv_get_tmp_dir(DBEnvObject* self)
+ {
+@@ -5887,8 +5883,6 @@
+ 
+     return PyBytes_FromString(dirpp);
+ }
+-#endif
+-
+ 
+ static PyObject*
+ DBEnv_txn_recover(DBEnvObject* self)
+@@ -6003,8 +5997,6 @@
+     RETURN_NONE();
+ }
+ 
+-
+-#if (DBVER >= 42)
+ static PyObject*
+ DBEnv_get_tx_max(DBEnvObject* self)
+ {
+@@ -6019,8 +6011,6 @@
+     RETURN_IF_ERR();
+     return PyLong_FromUnsignedLong(max);
+ }
+-#endif
+-
+ 
+ static PyObject*
+ DBEnv_set_tx_max(DBEnvObject* self, PyObject* args)
+@@ -6038,8 +6028,6 @@
+     RETURN_NONE();
+ }
+ 
+-
+-#if (DBVER >= 42)
+ static PyObject*
+ DBEnv_get_tx_timestamp(DBEnvObject* self)
+ {
+@@ -6054,7 +6042,6 @@
+     RETURN_IF_ERR();
+     return NUMBER_FromLong(timestamp);
+ }
+-#endif
+ 
+ static PyObject*
+ DBEnv_set_tx_timestamp(DBEnvObject* self, PyObject* args)
+@@ -6756,6 +6743,55 @@
+     RETURN_NONE();
+ }
+ 
++#if (DBVER >= 47)
++static PyObject*
++DBEnv_set_intermediate_dir_mode(DBEnvObject* self, PyObject* args)
++{
++    int err;
++    const char *mode;
++
++    if (!PyArg_ParseTuple(args,"s:set_intermediate_dir_mode", &mode))
++        return NULL;
++
++    CHECK_ENV_NOT_CLOSED(self);
++
++    MYDB_BEGIN_ALLOW_THREADS;
++    err = self->db_env->set_intermediate_dir_mode(self->db_env, mode);
++    MYDB_END_ALLOW_THREADS;
++    RETURN_IF_ERR();
++    RETURN_NONE();
++}
++
++static PyObject*
++DBEnv_get_intermediate_dir_mode(DBEnvObject* self)
++{
++    int err;
++    const char *mode;
++
++    CHECK_ENV_NOT_CLOSED(self);
++
++    MYDB_BEGIN_ALLOW_THREADS;
++    err = self->db_env->get_intermediate_dir_mode(self->db_env, &mode);
++    MYDB_END_ALLOW_THREADS;
++    RETURN_IF_ERR();
++    return Py_BuildValue("s", mode);
++}
++#endif
++
++static PyObject*
++DBEnv_get_open_flags(DBEnvObject* self)
++{
++    int err;
++    unsigned int flags;
++
++    CHECK_ENV_NOT_CLOSED(self);
++
++    MYDB_BEGIN_ALLOW_THREADS;
++    err = self->db_env->get_open_flags(self->db_env, &flags);
++    MYDB_END_ALLOW_THREADS;
++    RETURN_IF_ERR();
++    return NUMBER_FromLong(flags);
++}
+ 
+ #if (DBVER < 48)
+ static PyObject*
+@@ -6875,7 +6911,6 @@
+     RETURN_NONE();
+ }
+ 
+-#if (DBVER >= 42)
+ static PyObject*
+ DBEnv_get_verbose(DBEnvObject* self, PyObject* args)
+ {
+@@ -6893,7 +6928,6 @@
+     RETURN_IF_ERR();
+     return PyBool_FromLong(verbose);
+ }
+-#endif
+ 
+ #if (DBVER >= 45)
+ static void
+@@ -6975,9 +7009,7 @@
+     PyObject *control_py, *rec_py;
+     DBT control, rec;
+     int envid;
+-#if (DBVER >= 42)
+     DB_LSN lsn;
+-#endif
+ 
+     if (!PyArg_ParseTuple(args, "OOi:rep_process_message", &control_py,
+                 &rec_py, &envid))
+@@ -6994,13 +7026,8 @@
+     err = self->db_env->rep_process_message(self->db_env, &control, &rec,
+             envid, &lsn);
+ #else
+-#if (DBVER >= 42)
+     err = self->db_env->rep_process_message(self->db_env, &control, &rec,
+             &envid, &lsn);
+-#else
+-    err = self->db_env->rep_process_message(self->db_env, &control, &rec,
+-            &envid);
+-#endif
+ #endif
+     MYDB_END_ALLOW_THREADS;
+     switch (err) {
+@@ -7029,12 +7056,10 @@
+                 return r;
+                 break;
+             }
+-#if (DBVER >= 42)
+         case DB_REP_NOTPERM :
+         case DB_REP_ISPERM :
+             return Py_BuildValue("(i(ll))", err, lsn.file, lsn.offset);
+             break;
+-#endif
+     }
+     RETURN_IF_ERR();
+     return Py_BuildValue("(OO)", Py_None, Py_None);
+@@ -7086,20 +7111,6 @@
+     return ret;
+ }
+ 
+-#if (DBVER <= 41)
+-static int
+-_DBEnv_rep_transportCallbackOLD(DB_ENV* db_env, const DBT* control, const DBT* rec,
+-        int envid, u_int32_t flags)
+-{
+-    DB_LSN lsn;
+-
+-    lsn.file = -1;  /* Dummy values */
+-    lsn.offset = -1;
+-    return _DBEnv_rep_transportCallback(db_env, control, rec, &lsn, envid,
+-            flags);
+-}
+-#endif
+-
+ static PyObject*
+ DBEnv_rep_set_transport(DBEnvObject* self, PyObject* args)
+ {
+@@ -7120,13 +7131,8 @@
+     err = self->db_env->rep_set_transport(self->db_env, envid,
+             &_DBEnv_rep_transportCallback);
+ #else
+-#if (DBVER >= 42)
+     err = self->db_env->set_rep_transport(self->db_env, envid,
+             &_DBEnv_rep_transportCallback);
+-#else
+-    err = self->db_env->set_rep_transport(self->db_env, envid,
+-            &_DBEnv_rep_transportCallbackOLD);
+-#endif
+ #endif
+     MYDB_END_ALLOW_THREADS;
+     RETURN_IF_ERR();
+@@ -8482,65 +8488,43 @@
+     {"remove",          (PyCFunction)DB_remove,         METH_VARARGS|METH_KEYWORDS},
+     {"rename",          (PyCFunction)DB_rename,         METH_VARARGS},
+     {"set_bt_minkey",   (PyCFunction)DB_set_bt_minkey,  METH_VARARGS},
+-#if (DBVER >= 42)
+     {"get_bt_minkey",   (PyCFunction)DB_get_bt_minkey,  METH_NOARGS},
+-#endif
+     {"set_bt_compare",  (PyCFunction)DB_set_bt_compare, METH_O},
+     {"set_cachesize",   (PyCFunction)DB_set_cachesize,  METH_VARARGS},
+-#if (DBVER >= 42)
+     {"get_cachesize",   (PyCFunction)DB_get_cachesize,  METH_NOARGS},
+-#endif
+     {"set_encrypt",     (PyCFunction)DB_set_encrypt,    METH_VARARGS|METH_KEYWORDS},
+-#if (DBVER >= 42)
+     {"get_encrypt_flags", (PyCFunction)DB_get_encrypt_flags, METH_NOARGS},
+-#endif
+-
+     {"set_flags",       (PyCFunction)DB_set_flags,      METH_VARARGS},
+-#if (DBVER >= 42)
+     {"get_flags",       (PyCFunction)DB_get_flags,      METH_NOARGS},
++#if (DBVER >= 43)
++    {"get_transactional", (PyCFunction)DB_get_transactional, METH_NOARGS},
+ #endif
+     {"set_h_ffactor",   (PyCFunction)DB_set_h_ffactor,  METH_VARARGS},
+-#if (DBVER >= 42)
+     {"get_h_ffactor",   (PyCFunction)DB_get_h_ffactor,  METH_NOARGS},
+-#endif
+     {"set_h_nelem",     (PyCFunction)DB_set_h_nelem,    METH_VARARGS},
+-#if (DBVER >= 42)
+     {"get_h_nelem",     (PyCFunction)DB_get_h_nelem,    METH_NOARGS},
+-#endif
+     {"set_lorder",      (PyCFunction)DB_set_lorder,     METH_VARARGS},
+-#if (DBVER >= 42)
+     {"get_lorder",      (PyCFunction)DB_get_lorder,     METH_NOARGS},
+-#endif
+     {"set_pagesize",    (PyCFunction)DB_set_pagesize,   METH_VARARGS},
+-#if (DBVER >= 42)
+     {"get_pagesize",    (PyCFunction)DB_get_pagesize,   METH_NOARGS},
+-#endif
+     {"set_re_delim",    (PyCFunction)DB_set_re_delim,   METH_VARARGS},
+-#if (DBVER >= 42)
+     {"get_re_delim",    (PyCFunction)DB_get_re_delim,   METH_NOARGS},
+-#endif
+     {"set_re_len",      (PyCFunction)DB_set_re_len,     METH_VARARGS},
+-#if (DBVER >= 42)
+     {"get_re_len",      (PyCFunction)DB_get_re_len,     METH_NOARGS},
+-#endif
+     {"set_re_pad",      (PyCFunction)DB_set_re_pad,     METH_VARARGS},
+-#if (DBVER >= 42)
+     {"get_re_pad",      (PyCFunction)DB_get_re_pad,     METH_NOARGS},
+-#endif
+     {"set_re_source",   (PyCFunction)DB_set_re_source,  METH_VARARGS},
+-#if (DBVER >= 42)
+     {"get_re_source",   (PyCFunction)DB_get_re_source,  METH_NOARGS},
+-#endif
+     {"set_q_extentsize",(PyCFunction)DB_set_q_extentsize, METH_VARARGS},
+-#if (DBVER >= 42)
+     {"get_q_extentsize",(PyCFunction)DB_get_q_extentsize, METH_NOARGS},
+-#endif
+     {"set_private",     (PyCFunction)DB_set_private,    METH_O},
+     {"get_private",     (PyCFunction)DB_get_private,    METH_NOARGS},
+ #if (DBVER >= 46)
+     {"set_priority",    (PyCFunction)DB_set_priority,   METH_VARARGS},
+     {"get_priority",    (PyCFunction)DB_get_priority,   METH_NOARGS},
+ #endif
++    {"get_dbname",      (PyCFunction)DB_get_dbname,     METH_NOARGS},
++    {"get_open_flags",  (PyCFunction)DB_get_open_flags, METH_NOARGS},
+     {"stat",            (PyCFunction)DB_stat,           METH_VARARGS|METH_KEYWORDS},
+ #if (DBVER >= 43)
+     {"stat_print",      (PyCFunction)DB_stat_print,
+@@ -8639,24 +8623,18 @@
+     {"get_thread_count", (PyCFunction)DBEnv_get_thread_count, METH_NOARGS},
+ #endif
+     {"set_encrypt",     (PyCFunction)DBEnv_set_encrypt,      METH_VARARGS|METH_KEYWORDS},
+-#if (DBVER >= 42)
+     {"get_encrypt_flags", (PyCFunction)DBEnv_get_encrypt_flags, METH_NOARGS},
+     {"get_timeout",     (PyCFunction)DBEnv_get_timeout,
+         METH_VARARGS|METH_KEYWORDS},
+-#endif
+     {"set_timeout",     (PyCFunction)DBEnv_set_timeout,     METH_VARARGS|METH_KEYWORDS},
+     {"set_shm_key",     (PyCFunction)DBEnv_set_shm_key,     METH_VARARGS},
+-#if (DBVER >= 42)
+     {"get_shm_key",     (PyCFunction)DBEnv_get_shm_key,     METH_NOARGS},
+-#endif
+ #if (DBVER >= 46)
+     {"set_cache_max",   (PyCFunction)DBEnv_set_cache_max,   METH_VARARGS},
+     {"get_cache_max",   (PyCFunction)DBEnv_get_cache_max,   METH_NOARGS},
+ #endif
+     {"set_cachesize",   (PyCFunction)DBEnv_set_cachesize,   METH_VARARGS},
+-#if (DBVER >= 42)
+     {"get_cachesize",   (PyCFunction)DBEnv_get_cachesize,   METH_NOARGS},
+-#endif
+     {"memp_trickle",    (PyCFunction)DBEnv_memp_trickle,    METH_VARARGS},
+     {"memp_sync",       (PyCFunction)DBEnv_memp_sync,       METH_VARARGS},
+     {"memp_stat",       (PyCFunction)DBEnv_memp_stat,
+@@ -8685,33 +8663,21 @@
+ #endif
+ #endif
+     {"set_data_dir",    (PyCFunction)DBEnv_set_data_dir,    METH_VARARGS},
+-#if (DBVER >= 42)
+     {"get_data_dirs",   (PyCFunction)DBEnv_get_data_dirs,   METH_NOARGS},
+-#endif
+-#if (DBVER >= 42)
+     {"get_flags",       (PyCFunction)DBEnv_get_flags,       METH_NOARGS},
+-#endif
+     {"set_flags",       (PyCFunction)DBEnv_set_flags,       METH_VARARGS},
+ #if (DBVER >= 47)
+     {"log_set_config",  (PyCFunction)DBEnv_log_set_config,  METH_VARARGS},
+     {"log_get_config",  (PyCFunction)DBEnv_log_get_config,  METH_VARARGS},
+ #endif
+     {"set_lg_bsize",    (PyCFunction)DBEnv_set_lg_bsize,    METH_VARARGS},
+-#if (DBVER >= 42)
+     {"get_lg_bsize",    (PyCFunction)DBEnv_get_lg_bsize,    METH_NOARGS},
+-#endif
+     {"set_lg_dir",      (PyCFunction)DBEnv_set_lg_dir,      METH_VARARGS},
+-#if (DBVER >= 42)
+     {"get_lg_dir",      (PyCFunction)DBEnv_get_lg_dir,      METH_NOARGS},
+-#endif
+     {"set_lg_max",      (PyCFunction)DBEnv_set_lg_max,      METH_VARARGS},
+-#if (DBVER >= 42)
+     {"get_lg_max",      (PyCFunction)DBEnv_get_lg_max,      METH_NOARGS},
+-#endif
+     {"set_lg_regionmax",(PyCFunction)DBEnv_set_lg_regionmax, METH_VARARGS},
+-#if (DBVER >= 42)
+     {"get_lg_regionmax",(PyCFunction)DBEnv_get_lg_regionmax, METH_NOARGS},
+-#endif
+ #if (DBVER >= 44)
+     {"set_lg_filemode", (PyCFunction)DBEnv_set_lg_filemode, METH_VARARGS},
+     {"get_lg_filemode", (PyCFunction)DBEnv_get_lg_filemode, METH_NOARGS},
+@@ -8721,36 +8687,24 @@
+     {"get_lk_partitions", (PyCFunction)DBEnv_get_lk_partitions, METH_NOARGS},
+ #endif
+     {"set_lk_detect",   (PyCFunction)DBEnv_set_lk_detect,   METH_VARARGS},
+-#if (DBVER >= 42)
+     {"get_lk_detect",   (PyCFunction)DBEnv_get_lk_detect,   METH_NOARGS},
+-#endif
+ #if (DBVER < 45)
+     {"set_lk_max",      (PyCFunction)DBEnv_set_lk_max,      METH_VARARGS},
+ #endif
+     {"set_lk_max_locks", (PyCFunction)DBEnv_set_lk_max_locks, METH_VARARGS},
+-#if (DBVER >= 42)
+     {"get_lk_max_locks", (PyCFunction)DBEnv_get_lk_max_locks, METH_NOARGS},
+-#endif
+     {"set_lk_max_lockers", (PyCFunction)DBEnv_set_lk_max_lockers, METH_VARARGS},
+-#if (DBVER >= 42)
+     {"get_lk_max_lockers", (PyCFunction)DBEnv_get_lk_max_lockers, METH_NOARGS},
+-#endif
+     {"set_lk_max_objects", (PyCFunction)DBEnv_set_lk_max_objects, METH_VARARGS},
+-#if (DBVER >= 42)
+     {"get_lk_max_objects", (PyCFunction)DBEnv_get_lk_max_objects, METH_NOARGS},
+-#endif
+ #if (DBVER >= 43)
+     {"stat_print",          (PyCFunction)DBEnv_stat_print,
+         METH_VARARGS|METH_KEYWORDS},
+ #endif
+     {"set_mp_mmapsize", (PyCFunction)DBEnv_set_mp_mmapsize, METH_VARARGS},
+-#if (DBVER >= 42)
+     {"get_mp_mmapsize", (PyCFunction)DBEnv_get_mp_mmapsize, METH_NOARGS},
+-#endif
+     {"set_tmp_dir",     (PyCFunction)DBEnv_set_tmp_dir,     METH_VARARGS},
+-#if (DBVER >= 42)
+     {"get_tmp_dir",     (PyCFunction)DBEnv_get_tmp_dir,     METH_NOARGS},
+-#endif
+     {"txn_begin",       (PyCFunction)DBEnv_txn_begin,       METH_VARARGS|METH_KEYWORDS},
+     {"txn_checkpoint",  (PyCFunction)DBEnv_txn_checkpoint,  METH_VARARGS},
+     {"txn_stat",        (PyCFunction)DBEnv_txn_stat,        METH_VARARGS},
+@@ -8758,10 +8712,8 @@
+     {"txn_stat_print",  (PyCFunction)DBEnv_txn_stat_print,
+         METH_VARARGS|METH_KEYWORDS},
+ #endif
+-#if (DBVER >= 42)
+     {"get_tx_max",      (PyCFunction)DBEnv_get_tx_max,      METH_NOARGS},
+     {"get_tx_timestamp", (PyCFunction)DBEnv_get_tx_timestamp, METH_NOARGS},
+-#endif
+     {"set_tx_max",      (PyCFunction)DBEnv_set_tx_max,      METH_VARARGS},
+     {"set_tx_timestamp", (PyCFunction)DBEnv_set_tx_timestamp, METH_VARARGS},
+     {"lock_detect",     (PyCFunction)DBEnv_lock_detect,     METH_VARARGS},
+@@ -8804,11 +8756,16 @@
+     {"get_mp_max_write", (PyCFunction)DBEnv_get_mp_max_write, METH_NOARGS},
+ #endif
+     {"set_verbose",     (PyCFunction)DBEnv_set_verbose,     METH_VARARGS},
+-#if (DBVER >= 42)
+-    {"get_verbose",     (PyCFunction)DBEnv_get_verbose,       METH_VARARGS},
++    {"get_verbose",     (PyCFunction)DBEnv_get_verbose,     METH_VARARGS},
++    {"set_private",     (PyCFunction)DBEnv_set_private,     METH_O},
++    {"get_private",     (PyCFunction)DBEnv_get_private,     METH_NOARGS},
++    {"get_open_flags",  (PyCFunction)DBEnv_get_open_flags,  METH_NOARGS},
++#if (DBVER >= 47)
++    {"set_intermediate_dir_mode", (PyCFunction)DBEnv_set_intermediate_dir_mode,
++        METH_VARARGS},
++    {"get_intermediate_dir_mode", (PyCFunction)DBEnv_get_intermediate_dir_mode,
++        METH_NOARGS},
+ #endif
+-    {"set_private",     (PyCFunction)DBEnv_set_private,       METH_O},
+-    {"get_private",     (PyCFunction)DBEnv_get_private,       METH_NOARGS},
+     {"rep_start",       (PyCFunction)DBEnv_rep_start,
+         METH_VARARGS|METH_KEYWORDS},
+     {"rep_set_transport", (PyCFunction)DBEnv_rep_set_transport, METH_VARARGS},
+@@ -8922,13 +8879,9 @@
+ 
+     CHECK_ENV_NOT_CLOSED(self);
+ 
+-#if (DBVER >= 42)
+     MYDB_BEGIN_ALLOW_THREADS;
+     self->db_env->get_home(self->db_env, &home);
+     MYDB_END_ALLOW_THREADS;
+-#else
+-    home=self->db_env->db_home;
+-#endif
+ 
+     if (home == NULL) {
+         RETURN_NONE();
+@@ -9298,10 +9251,25 @@
+ {
+     int major, minor, patch;
+ 
++    /* This should be instantaneous, no need to release the GIL */
+     db_version(&major, &minor, &patch);
+     return Py_BuildValue("(iii)", major, minor, patch);
+ }
+ 
++#if (DBVER >= 50)
++static PyObject*
++bsddb_version_full(PyObject* self)
++{
++    char *version_string;
++    int family, release, major, minor, patch;
++
++    /* This should be instantaneous, no need to release the GIL */
++    version_string = db_full_version(&family, &release, &major, &minor, &patch);
++    return Py_BuildValue("(siiiii)",
++            version_string, family, release, major, minor, patch);
++}
++#endif
++
+ 
+ /* List of functions defined in the module */
+ static PyMethodDef bsddb_methods[] = {
+@@ -9311,6 +9279,9 @@
+     {"DBSequence",  (PyCFunction)DBSequence_construct,  METH_VARARGS | METH_KEYWORDS },
+ #endif
+     {"version",     (PyCFunction)bsddb_version,         METH_NOARGS, bsddb_version_doc},
++#if (DBVER >= 50)
++    {"full_version", (PyCFunction)bsddb_version_full, METH_NOARGS},
++#endif
+     {NULL,      NULL}       /* sentinel */
+ };
+ 
+@@ -9328,6 +9299,11 @@
+  */
+ #define ADD_INT(dict, NAME)         _addIntToDict(dict, #NAME, NAME)
+ 
++/*
++** We can rename the module at import time, so the string allocated
++** must be big enough, and any use of the name must use this particular
++** string.
++*/
+ #define MODULE_NAME_MAX_LEN     11
+ static char _bsddbModuleName[MODULE_NAME_MAX_LEN+1] = "_bsddb";
+ 
+@@ -9428,13 +9404,7 @@
+     ADD_INT(d, DB_MAX_RECORDS);
+ 
+ #if (DBVER < 48)
+-#if (DBVER >= 42)
+     ADD_INT(d, DB_RPCCLIENT);
+-#else
+-    ADD_INT(d, DB_CLIENT);
+-    /* allow apps to be written using DB_RPCCLIENT on older Berkeley DB */
+-    _addIntToDict(d, "DB_RPCCLIENT", DB_CLIENT);
+-#endif
+ #endif
+ 
+ #if (DBVER < 48)
+@@ -9477,6 +9447,14 @@
+     ADD_INT(d, DB_TXN_SYNC);
+     ADD_INT(d, DB_TXN_NOWAIT);
+ 
++#if (DBVER >= 51)
++    ADD_INT(d, DB_TXN_BULK);
++#endif
++
++#if (DBVER >= 48)
++    ADD_INT(d, DB_CURSOR_BULK);
++#endif
++
+ #if (DBVER >= 46)
+     ADD_INT(d, DB_TXN_WAIT);
+ #endif
+@@ -9561,9 +9539,7 @@
+     ADD_INT(d, DB_ARCH_ABS);
+     ADD_INT(d, DB_ARCH_DATA);
+     ADD_INT(d, DB_ARCH_LOG);
+-#if (DBVER >= 42)
+     ADD_INT(d, DB_ARCH_REMOVE);
+-#endif
+ 
+     ADD_INT(d, DB_BTREE);
+     ADD_INT(d, DB_HASH);
+@@ -9591,9 +9567,6 @@
+     ADD_INT(d, DB_CACHED_COUNTS);
+ #endif
+ 
+-#if (DBVER <= 41)
+-    ADD_INT(d, DB_COMMIT);
+-#endif
+     ADD_INT(d, DB_CONSUME);
+     ADD_INT(d, DB_CONSUME_WAIT);
+     ADD_INT(d, DB_CURRENT);
+@@ -9671,6 +9644,10 @@
+ #if (DBVER >= 43)
+     ADD_INT(d, DB_STAT_SUBSYSTEM);
+     ADD_INT(d, DB_STAT_MEMP_HASH);
++    ADD_INT(d, DB_STAT_LOCK_CONF);
++    ADD_INT(d, DB_STAT_LOCK_LOCKERS);
++    ADD_INT(d, DB_STAT_LOCK_OBJECTS);
++    ADD_INT(d, DB_STAT_LOCK_PARAMS);
+ #endif
+ 
+ #if (DBVER >= 48)
+@@ -9690,7 +9667,6 @@
+     ADD_INT(d, DB_EID_INVALID);
+     ADD_INT(d, DB_EID_BROADCAST);
+ 
+-#if (DBVER >= 42)
+     ADD_INT(d, DB_TIME_NOTGRANTED);
+     ADD_INT(d, DB_TXN_NOT_DURABLE);
+     ADD_INT(d, DB_TXN_WRITE_NOSYNC);
+@@ -9698,9 +9674,8 @@
+     ADD_INT(d, DB_INIT_REP);
+     ADD_INT(d, DB_ENCRYPT);
+     ADD_INT(d, DB_CHKSUM);
+-#endif
+ 
+-#if (DBVER >= 42) && (DBVER < 47)
++#if (DBVER < 47)
+     ADD_INT(d, DB_LOG_AUTOREMOVE);
+     ADD_INT(d, DB_DIRECT_LOG);
+ #endif
+@@ -9733,6 +9708,20 @@
+     ADD_INT(d, DB_VERB_REPLICATION);
+     ADD_INT(d, DB_VERB_WAITSFOR);
+ 
++#if (DBVER >= 50)
++    ADD_INT(d, DB_VERB_REP_SYSTEM);
++#endif
++
++#if (DBVER >= 47)
++    ADD_INT(d, DB_VERB_REP_ELECT);
++    ADD_INT(d, DB_VERB_REP_LEASE);
++    ADD_INT(d, DB_VERB_REP_MISC);
++    ADD_INT(d, DB_VERB_REP_MSGS);
++    ADD_INT(d, DB_VERB_REP_SYNC);
++    ADD_INT(d, DB_VERB_REPMGR_CONNFAIL);
++    ADD_INT(d, DB_VERB_REPMGR_MISC);
++#endif
++
+ #if (DBVER >= 45)
+     ADD_INT(d, DB_EVENT_PANIC);
+     ADD_INT(d, DB_EVENT_REP_CLIENT);
+@@ -9748,16 +9737,25 @@
+     ADD_INT(d, DB_EVENT_WRITE_FAILED);
+ #endif
+ 
++#if (DBVER >= 50)
++    ADD_INT(d, DB_REPMGR_CONF_ELECTIONS);
++    ADD_INT(d, DB_EVENT_REP_MASTER_FAILURE);
++    ADD_INT(d, DB_EVENT_REP_DUPMASTER);
++    ADD_INT(d, DB_EVENT_REP_ELECTION_FAILED);
++#endif
++#if (DBVER >= 48)
++    ADD_INT(d, DB_EVENT_REG_ALIVE);
++    ADD_INT(d, DB_EVENT_REG_PANIC);
++#endif
++
+     ADD_INT(d, DB_REP_DUPMASTER);
+     ADD_INT(d, DB_REP_HOLDELECTION);
+ #if (DBVER >= 44)
+     ADD_INT(d, DB_REP_IGNORE);
+     ADD_INT(d, DB_REP_JOIN_FAILURE);
+ #endif
+-#if (DBVER >= 42)
+     ADD_INT(d, DB_REP_ISPERM);
+     ADD_INT(d, DB_REP_NOTPERM);
+-#endif
+     ADD_INT(d, DB_REP_NEWSITE);
+ 
+     ADD_INT(d, DB_REP_MASTER);
+@@ -9766,7 +9764,13 @@
+     ADD_INT(d, DB_REP_PERMANENT);
+ 
+ #if (DBVER >= 44)
++#if (DBVER >= 50)
++    ADD_INT(d, DB_REP_CONF_AUTOINIT);
++#else
+     ADD_INT(d, DB_REP_CONF_NOAUTOINIT);
++#endif /* 5.0 */
++#endif /* 4.4 */
++#if (DBVER >= 44)
+     ADD_INT(d, DB_REP_CONF_DELAYCLIENT);
+     ADD_INT(d, DB_REP_CONF_BULK);
+     ADD_INT(d, DB_REP_CONF_NOWAIT);
+@@ -9774,9 +9778,7 @@
+     ADD_INT(d, DB_REP_REREQUEST);
+ #endif
+ 
+-#if (DBVER >= 42)
+     ADD_INT(d, DB_REP_NOBUFFER);
+-#endif
+ 
+ #if (DBVER >= 46)
+     ADD_INT(d, DB_REP_LEASE_EXPIRED);
+@@ -9819,6 +9821,28 @@
+     ADD_INT(d, DB_STAT_ALL);
+ #endif
+ 
++#if (DBVER >= 51)
++    ADD_INT(d, DB_REPMGR_ACKS_ALL_AVAILABLE);
++#endif
++
++#if (DBVER >= 48)
++    ADD_INT(d, DB_REP_CONF_INMEM);
++#endif
++
++    ADD_INT(d, DB_TIMEOUT);
++
++#if (DBVER >= 50)
++    ADD_INT(d, DB_FORCESYNC);
++#endif
++
++#if (DBVER >= 48)
++    ADD_INT(d, DB_FAILCHK);
++#endif
++
++#if (DBVER >= 51)
++    ADD_INT(d, DB_HOTBACKUP_IN_PROGRESS);
++#endif
++
+ #if (DBVER >= 43)
+     ADD_INT(d, DB_BUFFER_SMALL);
+     ADD_INT(d, DB_SEQ_DEC);
+@@ -9856,6 +9880,10 @@
+     ADD_INT(d, DB_SET_LOCK_TIMEOUT);
+     ADD_INT(d, DB_SET_TXN_TIMEOUT);
+ 
++#if (DBVER >= 48)
++    ADD_INT(d, DB_SET_REG_TIMEOUT);
++#endif
++
+     /* The exception name must be correct for pickled exception *
+      * objects to unpickle properly.                            */
+ #ifdef PYBSDDB_STANDALONE  /* different value needed for standalone pybsddb */
+@@ -9927,9 +9955,7 @@
+     MAKE_EX(DBNoSuchFileError);
+     MAKE_EX(DBPermissionsError);
+ 
+-#if (DBVER >= 42)
+     MAKE_EX(DBRepHandleDeadError);
+-#endif
+ #if (DBVER >= 44)
+     MAKE_EX(DBRepLockoutError);
+ #endif
+@@ -9947,6 +9973,7 @@
+ #undef MAKE_EX
+ 
+     /* Initialise the C API structure and add it to the module */
++    bsddb_api.api_version      = PYBSDDB_API_VERSION;
+     bsddb_api.db_type          = &DB_Type;
+     bsddb_api.dbcursor_type    = &DBCursor_Type;
+     bsddb_api.dblogcursor_type = &DBLogCursor_Type;
+@@ -9955,19 +9982,25 @@
+     bsddb_api.dblock_type      = &DBLock_Type;
+ #if (DBVER >= 43)
+     bsddb_api.dbsequence_type  = &DBSequence_Type;
++#else
++    bsddb_api.dbsequence_type  = NULL;
+ #endif
+     bsddb_api.makeDBError      = makeDBError;
+ 
+     /*
+-    ** Capsules exist from Python 3.1, but I
+-    ** don't want to break the API compatibility
+-    ** for already published Python versions.
++    ** Capsules exist from Python 2.7 and 3.1.
++    ** We don't support Python 3.0 anymore, so...
++    ** #if (PY_VERSION_HEX < ((PY_MAJOR_VERSION < 3) ? 0x02070000 : 0x03020000))
+     */
+-#if (PY_VERSION_HEX < 0x03020000)
++#if (PY_VERSION_HEX < 0x02070000)
+     py_api = PyCObject_FromVoidPtr((void*)&bsddb_api, NULL);
+ #else
+     {
+-        char py_api_name[250];
++        /*
++        ** The data must outlive the call!!. So, the static definition.
++        ** The buffer must be big enough...
++        */
++        static char py_api_name[MODULE_NAME_MAX_LEN+10];
+ 
+         strcpy(py_api_name, _bsddbModuleName);
+         strcat(py_api_name, ".api");
+Index: b/Modules/bsddb.h
+===================================================================
+--- a/Modules/bsddb.h
++++ b/Modules/bsddb.h
+@@ -109,7 +109,7 @@
+ #error "eek! DBVER can't handle minor versions > 9"
+ #endif
+ 
+-#define PY_BSDDB_VERSION "4.8.4.2"
++#define PY_BSDDB_VERSION "5.1.2"
+ 
+ /* Python object definitions */
+ 
+@@ -236,7 +236,7 @@
+ /* To access the structure from an external module, use code like the
+    following (error checking missed out for clarity):
+ 
+-     // If you are using Python before 3.2:
++     // If you are using Python before 2.7:
+      BSDDB_api* bsddb_api;
+      PyObject*  mod;
+      PyObject*  cobj;
+@@ -249,7 +249,7 @@
+      Py_DECREF(mod);
+ 
+ 
+-     // If you are using Python 3.2 or up:
++     // If you are using Python 2.7 or up: (except Python 3.0, unsupported)
+      BSDDB_api* bsddb_api;
+ 
+      // Use "bsddb3._pybsddb.api" if you're using
+@@ -257,10 +257,14 @@
+      bsddb_api = (void **)PyCapsule_Import("bsddb._bsddb.api", 1);
+ 
+ 
++   Check "api_version" number before trying to use the API.
++
+    The structure's members must not be changed.
+ */
+ 
++#define PYBSDDB_API_VERSION 1
+ typedef struct {
++    unsigned int api_version;
+     /* Type objects */
+     PyTypeObject* db_type;
+     PyTypeObject* dbcursor_type;
+@@ -268,9 +272,7 @@
+     PyTypeObject* dbenv_type;
+     PyTypeObject* dbtxn_type;
+     PyTypeObject* dblock_type;
+-#if (DBVER >= 43)
+-    PyTypeObject* dbsequence_type;
+-#endif
++    PyTypeObject* dbsequence_type;  /* If DBVER < 43 -> NULL */
+ 
+     /* Functions */
+     int (*makeDBError)(int err);
+@@ -289,9 +291,9 @@
+ #define DBEnvObject_Check(v)    ((v)->ob_type == bsddb_api->dbenv_type)
+ #define DBTxnObject_Check(v)    ((v)->ob_type == bsddb_api->dbtxn_type)
+ #define DBLockObject_Check(v)   ((v)->ob_type == bsddb_api->dblock_type)
+-#if (DBVER >= 43)
+-#define DBSequenceObject_Check(v)  ((v)->ob_type == bsddb_api->dbsequence_type)
+-#endif
++#define DBSequenceObject_Check(v)  \
++    ((bsddb_api->dbsequence_type) && \
++        ((v)->ob_type == bsddb_api->dbsequence_type))
+ 
+ #endif /* COMPILING_BSDDB_C */
+ 
--- python2.7-2.7.3.orig/debian/patches/makeflags.diff
+++ python2.7-2.7.3/debian/patches/makeflags.diff
@@ -0,0 +1,24 @@
+Index: b/Makefile.pre.in
+===================================================================
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -406,11 +406,15 @@
+ 
+ 
+ # Build the shared modules
++# MAKEFLAGS are sorted and normalized. Under GNU make the 's' for
++# -s, --silent or --quiet is always the first char.
+ sharedmods: $(BUILDPYTHON)
+-	@case $$MAKEFLAGS in \
+-	*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
++	@case "$$MAKEFLAGS" in \
++	    s*) quiet="-q";; \
++	    *) quiet="";; \
++	esac; \
++	$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
++		./$(BUILDPYTHON) -E $(srcdir)/setup.py $$quiet build
+ 
+ # Build static library
+ # avoid long command lines, same as LIBRARY_OBJS
--- python2.7-2.7.3.orig/debian/patches/xdg-gvfs-open.diff
+++ python2.7-2.7.3/debian/patches/xdg-gvfs-open.diff
@@ -0,0 +1,17 @@
+--- a/Lib/webbrowser.py
++++ b/Lib/webbrowser.py
+@@ -441,6 +441,14 @@
+ 
+ def register_X_browsers():
+ 
++    # use xdg-open if around
++    if _iscommand("xdg-open"):
++        register("xdg-open", None, BackgroundBrowser("xdg-open"))
++
++    # The default GNOME3 browser
++    if "GNOME_DESKTOP_SESSION_ID" in os.environ and _iscommand("gvfs-open"):
++        register("gvfs-open", None, BackgroundBrowser("gvfs-open"))
++
+     # The default GNOME browser
+     if "GNOME_DESKTOP_SESSION_ID" in os.environ and _iscommand("gnome-open"):
+         register("gnome-open", None, BackgroundBrowser("gnome-open"))
--- python2.7-2.7.3.orig/debian/patches/bsddb-libpath.diff
+++ python2.7-2.7.3/debian/patches/bsddb-libpath.diff
@@ -0,0 +1,19 @@
+# DP: Don't add the bsddb multilib path, if already in the standard lib path
+
+--- a/setup.py
++++ b/setup.py
+@@ -977,7 +977,13 @@
+             if db_setup_debug:
+                 print "bsddb using BerkeleyDB lib:", db_ver, dblib
+                 print "bsddb lib dir:", dblib_dir, " inc dir:", db_incdir
+-            db_incs = [db_incdir]
++            # only add db_incdir/dblib_dir if not in the standard paths
++            if db_incdir in inc_dirs:
++                db_incs = []
++            else:
++                db_incs = [db_incdir]
++            if dblib_dir[0] in lib_dirs:
++                dblib_dir = []
+             dblibs = [dblib]
+             # We add the runtime_library_dirs argument because the
+             # BerkeleyDB lib we're linking against often isn't in the
--- python2.7-2.7.3.orig/debian/patches/ncursesw-incdir.diff
+++ python2.7-2.7.3/debian/patches/ncursesw-incdir.diff
@@ -0,0 +1,66 @@
+# DP: use the correct include directory when linking with ncursesw.
+
+--- a/setup.py
++++ b/setup.py
+@@ -1251,13 +1251,17 @@
+         # Curses support, requiring the System V version of curses, often
+         # provided by the ncurses library.
+         panel_library = 'panel'
++        curses_incs = None
+         if curses_library.startswith('ncurses'):
+             if curses_library == 'ncursesw':
+                 # Bug 1464056: If _curses.so links with ncursesw,
+                 # _curses_panel.so must link with panelw.
+                 panel_library = 'panelw'
+             curses_libs = [curses_library]
++            curses_incs = find_file('curses.h', inc_dirs,
++                                    [os.path.join(d, 'ncursesw') for d in inc_dirs])
+             exts.append( Extension('_curses', ['_cursesmodule.c'],
++                                   include_dirs = curses_incs,
+                                    libraries = curses_libs) )
+         elif curses_library == 'curses' and platform != 'darwin':
+                 # OSX has an old Berkeley curses, not good enough for
+@@ -1278,6 +1282,7 @@
+         if (module_enabled(exts, '_curses') and
+             self.compiler.find_library_file(lib_dirs, panel_library)):
+             exts.append( Extension('_curses_panel', ['_curses_panel.c'],
++                                   include_dirs = curses_incs,
+                                    libraries = [panel_library] + curses_libs) )
+         else:
+             missing.append('_curses_panel')
+--- a/configure.ac
++++ b/configure.ac
+@@ -1374,6 +1374,8 @@
+ 
+ # checks for header files
+ AC_HEADER_STDC
++ac_save_cppflags="$CPPFLAGS"
++CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw"
+ AC_CHECK_HEADERS(asm/types.h conio.h curses.h direct.h dlfcn.h errno.h \
+ fcntl.h grp.h \
+ ieeefp.h io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \
+@@ -1395,6 +1397,7 @@
+ #include <curses.h>
+ #endif
+ ])
++CPPFLAGS=$ac_save_cppflags
+ 
+ # On Linux, netlink.h requires asm/types.h
+ AC_CHECK_HEADERS(linux/netlink.h,,,[
+@@ -4123,6 +4126,8 @@
+   [Define if you have struct stat.st_mtimensec])
+ fi
+ 
++ac_save_cppflags="$CPPFLAGS"
++CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw"
+ # On HP/UX 11.0, mvwdelch is a block with a return statement
+ AC_MSG_CHECKING(whether mvwdelch is an expression)
+ AC_CACHE_VAL(ac_cv_mvwdelch_is_expression,
+@@ -4177,6 +4182,7 @@
+    AC_MSG_RESULT(yes)],
+   [AC_MSG_RESULT(no)]
+ )
++CPPFLAGS=$ac_save_cppflags
+ 
+ AC_MSG_CHECKING(for /dev/ptmx)
+ 
--- python2.7-2.7.3.orig/debian/patches/issue9012a.diff
+++ python2.7-2.7.3/debian/patches/issue9012a.diff
@@ -0,0 +1,13 @@
+# DP: Link _math.o only once to the static library.
+
+--- a/Modules/Setup.dist
++++ b/Modules/Setup.dist
+@@ -169,7 +169,7 @@
+ # Modules that should always be present (non UNIX dependent):
+ 
+ #array arraymodule.c	# array objects
+-#cmath cmathmodule.c _math.c # -lm # complex math library functions
++#cmath cmathmodule.c # -lm # complex math library functions
+ #math mathmodule.c _math.c # -lm # math library functions, e.g. sin()
+ #_struct _struct.c	# binary structure packing/unpacking
+ #time timemodule.c # -lm # time operations and variables
--- python2.7-2.7.3.orig/debian/patches/hurd-disable-nonworking-constants.diff
+++ python2.7-2.7.3/debian/patches/hurd-disable-nonworking-constants.diff
@@ -0,0 +1,34 @@
+# DP: Comment out constant exposed on the API which are not implemented on
+# DP: GNU/Hurd. They would not work at runtime anyway.
+
+--- a/Modules/posixmodule.c
++++ b/Modules/posixmodule.c
+@@ -9193,12 +9193,14 @@
+ #ifdef O_LARGEFILE
+     if (ins(d, "O_LARGEFILE", (long)O_LARGEFILE)) return -1;
+ #endif
++#ifndef __GNU__
+ #ifdef O_SHLOCK
+     if (ins(d, "O_SHLOCK", (long)O_SHLOCK)) return -1;
+ #endif
+ #ifdef O_EXLOCK
+     if (ins(d, "O_EXLOCK", (long)O_EXLOCK)) return -1;
+ #endif
++#endif
+ 
+ /* MS Windows */
+ #ifdef O_NOINHERIT
+--- a/Modules/socketmodule.c
++++ b/Modules/socketmodule.c
+@@ -4815,9 +4815,11 @@
+ #ifdef  SO_OOBINLINE
+     PyModule_AddIntConstant(m, "SO_OOBINLINE", SO_OOBINLINE);
+ #endif
++#ifndef __GNU__
+ #ifdef  SO_REUSEPORT
+     PyModule_AddIntConstant(m, "SO_REUSEPORT", SO_REUSEPORT);
+ #endif
++#endif
+ #ifdef  SO_SNDBUF
+     PyModule_AddIntConstant(m, "SO_SNDBUF", SO_SNDBUF);
+ #endif
--- python2.7-2.7.3.orig/debian/patches/revert-sizeof-methods.diff
+++ python2.7-2.7.3/debian/patches/revert-sizeof-methods.diff
@@ -0,0 +1,1062 @@
+diff -urN a/Include/node.h b/Include/node.h
+--- a/Include/node.h	2012-12-25 13:41:08.431405725 +0100
++++ b/Include/node.h	2012-12-25 13:48:19.839405366 +0100
+@@ -20,9 +20,6 @@
+ PyAPI_FUNC(int) PyNode_AddChild(node *n, int type,
+                                       char *str, int lineno, int col_offset);
+ PyAPI_FUNC(void) PyNode_Free(node *n);
+-#ifndef Py_LIMITED_API
+-Py_ssize_t _PyNode_SizeOf(node *n);
+-#endif
+ 
+ /* Node access functions */
+ #define NCH(n)		((n)->n_nchildren)
+diff -urN a/Lib/test/test_array.py b/Lib/test/test_array.py
+--- a/Lib/test/test_array.py	2012-12-25 13:41:08.471405725 +0100
++++ b/Lib/test/test_array.py	2012-12-25 13:48:09.671405378 +0100
+@@ -985,19 +985,6 @@
+         upper = long(pow(2, a.itemsize * 8)) - 1L
+         self.check_overflow(lower, upper)
+ 
+-    @test_support.cpython_only
+-    def test_sizeof_with_buffer(self):
+-        a = array.array(self.typecode, self.example)
+-        basesize = test_support.calcvobjsize('4P')
+-        buffer_size = a.buffer_info()[1] * a.itemsize
+-        test_support.check_sizeof(self, a, basesize + buffer_size)
+-
+-    @test_support.cpython_only
+-    def test_sizeof_without_buffer(self):
+-        a = array.array(self.typecode)
+-        basesize = test_support.calcvobjsize('4P')
+-        test_support.check_sizeof(self, a, basesize)
+-
+ 
+ class ByteTest(SignedNumberTest):
+     typecode = 'b'
+diff -urN a/Lib/test/test_deque.py b/Lib/test/test_deque.py
+--- a/Lib/test/test_deque.py	2012-12-25 13:41:08.471405725 +0100
++++ b/Lib/test/test_deque.py	2012-12-25 13:48:19.843405367 +0100
+@@ -6,7 +6,6 @@
+ import copy
+ import cPickle as pickle
+ import random
+-import struct
+ 
+ BIG = 100000
+ 
+@@ -518,21 +517,6 @@
+             gc.collect()
+             self.assertTrue(ref() is None, "Cycle was not collected")
+ 
+-    check_sizeof = test_support.check_sizeof
+-
+-    @test_support.cpython_only
+-    def test_sizeof(self):
+-        BLOCKLEN = 62
+-        basesize = test_support.calcobjsize('2P4PlP')
+-        blocksize = struct.calcsize('2P%dP' % BLOCKLEN)
+-        self.assertEqual(object.__sizeof__(deque()), basesize)
+-        check = self.check_sizeof
+-        check(deque(), basesize + blocksize)
+-        check(deque('a'), basesize + blocksize)
+-        check(deque('a' * (BLOCKLEN // 2)), basesize + blocksize)
+-        check(deque('a' * (BLOCKLEN // 2 + 1)), basesize + 2 * blocksize)
+-        check(deque('a' * (42 * BLOCKLEN)), basesize + 43 * blocksize)
+-
+ class TestVariousIteratorArgs(unittest.TestCase):
+ 
+     def test_constructor(self):
+diff -urN a/Lib/test/test_io.py b/Lib/test/test_io.py
+--- a/Lib/test/test_io.py	2012-12-25 13:41:08.487405725 +0100
++++ b/Lib/test/test_io.py	2012-12-25 13:48:30.887405360 +0100
+@@ -748,20 +748,6 @@
+             buf.raw = x
+ 
+ 
+-class SizeofTest:
+-
+-    @support.cpython_only
+-    def test_sizeof(self):
+-        bufsize1 = 4096
+-        bufsize2 = 8192
+-        rawio = self.MockRawIO()
+-        bufio = self.tp(rawio, buffer_size=bufsize1)
+-        size = sys.getsizeof(bufio) - bufsize1
+-        rawio = self.MockRawIO()
+-        bufio = self.tp(rawio, buffer_size=bufsize2)
+-        self.assertEqual(sys.getsizeof(bufio), size + bufsize2)
+-
+-
+ class BufferedReaderTest(unittest.TestCase, CommonBufferedTests):
+     read_mode = "rb"
+ 
+@@ -945,7 +931,7 @@
+                              "failed for {}: {} != 0".format(n, rawio._extraneous_reads))
+ 
+ 
+-class CBufferedReaderTest(BufferedReaderTest, SizeofTest):
++class CBufferedReaderTest(BufferedReaderTest):
+     tp = io.BufferedReader
+ 
+     def test_constructor(self):
+@@ -1208,7 +1194,7 @@
+             self.tp(self.MockRawIO(), 8, 12)
+ 
+ 
+-class CBufferedWriterTest(BufferedWriterTest, SizeofTest):
++class CBufferedWriterTest(BufferedWriterTest):
+     tp = io.BufferedWriter
+ 
+     def test_constructor(self):
+@@ -1596,8 +1582,8 @@
+                 f.flush()
+                 self.assertEqual(raw.getvalue(), b'1b\n2def\n3\n')
+ 
+-class CBufferedRandomTest(CBufferedReaderTest, CBufferedWriterTest,
+-                          BufferedRandomTest, SizeofTest):
++
++class CBufferedRandomTest(CBufferedReaderTest, CBufferedWriterTest, BufferedRandomTest):
+     tp = io.BufferedRandom
+ 
+     def test_constructor(self):
+diff -urN a/Lib/test/test_memoryio.py b/Lib/test/test_memoryio.py
+--- a/Lib/test/test_memoryio.py	2012-12-25 13:41:08.487405725 +0100
++++ b/Lib/test/test_memoryio.py	2012-12-25 13:48:30.891405359 +0100
+@@ -638,17 +638,6 @@
+         memio.close()
+         self.assertRaises(ValueError, memio.__setstate__, (b"closed", 0, None))
+ 
+-    check_sizeof = support.check_sizeof
+-
+-    @support.cpython_only
+-    def test_sizeof(self):
+-        basesize = support.calcobjsize(b'P2PP2P')
+-        check = self.check_sizeof
+-        self.assertEqual(object.__sizeof__(io.BytesIO()), basesize)
+-        check(io.BytesIO(), basesize )
+-        check(io.BytesIO(b'a'), basesize + 1 + 1 )
+-        check(io.BytesIO(b'a' * 1000), basesize + 1000 + 1 )
+-
+ 
+ class CStringIOTest(PyStringIOTest):
+     ioclass = io.StringIO
+diff -urN a/Lib/test/test_parser.py b/Lib/test/test_parser.py
+--- a/Lib/test/test_parser.py	2012-12-25 13:41:08.487405725 +0100
++++ b/Lib/test/test_parser.py	2012-12-25 13:48:19.847405368 +0100
+@@ -1,8 +1,7 @@
+ import parser
+ import unittest
+ import sys
+-import struct
+-from test import test_support as support
++from test import test_support
+ 
+ #
+ #  First, we test that we can generate trees from valid source fragments,
+@@ -584,57 +583,12 @@
+         print >>sys.stderr, "Expecting 's_push: parser stack overflow' in next line"
+         self.assertRaises(MemoryError, parser.expr, e)
+ 
+-class STObjectTestCase(unittest.TestCase):
+-    """Test operations on ST objects themselves"""
+-
+-    check_sizeof = support.check_sizeof
+-
+-    @support.cpython_only
+-    def test_sizeof(self):
+-        def XXXROUNDUP(n):
+-            if n <= 1:
+-                return n
+-            if n <= 128:
+-                return (n + 3) & ~3
+-            return 1 << (n - 1).bit_length()
+-
+-        basesize = support.calcobjsize('Pii')
+-        nodesize = struct.calcsize('hP3iP0h')
+-        def sizeofchildren(node):
+-            if node is None:
+-                return 0
+-            res = 0
+-            hasstr = len(node) > 1 and isinstance(node[-1], str)
+-            if hasstr:
+-                res += len(node[-1]) + 1
+-            children = node[1:-1] if hasstr else node[1:]
+-            if children:
+-                res += XXXROUNDUP(len(children)) * nodesize
+-                for child in children:
+-                    res += sizeofchildren(child)
+-            return res
+-
+-        def check_st_sizeof(st):
+-            self.check_sizeof(st, basesize + nodesize +
+-                                  sizeofchildren(st.totuple()))
+-
+-        check_st_sizeof(parser.expr('2 + 3'))
+-        check_st_sizeof(parser.expr('2 + 3 + 4'))
+-        check_st_sizeof(parser.suite('x = 2 + 3'))
+-        check_st_sizeof(parser.suite(''))
+-        check_st_sizeof(parser.suite('# -*- coding: utf-8 -*-'))
+-        check_st_sizeof(parser.expr('[' + '2,' * 1000 + ']'))
+-
+-
+-    # XXX tests for pickling and unpickling of ST objects should go here
+-
+ def test_main():
+-    support.run_unittest(
++    test_support.run_unittest(
+         RoundtripLegalSyntaxTestCase,
+         IllegalSyntaxTestCase,
+         CompileTestCase,
+         ParserStackLimitTestCase,
+-        STObjectTestCase,
+     )
+ 
+ 
+diff -urN a/Lib/test/test_struct.py b/Lib/test/test_struct.py
+--- a/Lib/test/test_struct.py	2012-12-25 13:41:08.495405725 +0100
++++ b/Lib/test/test_struct.py	2012-12-25 13:48:48.943405345 +0100
+@@ -3,8 +3,7 @@
+ import unittest
+ import struct
+ import inspect
+-from test import test_support as support
+-from test.test_support import (check_warnings, check_py3k_warnings)
++from test.test_support import run_unittest, check_warnings, check_py3k_warnings
+ 
+ import sys
+ ISBIGENDIAN = sys.byteorder == "big"
+@@ -545,29 +544,8 @@
+         hugecount2 = '{}b{}H'.format(sys.maxsize//2, sys.maxsize//2)
+         self.assertRaises(struct.error, struct.calcsize, hugecount2)
+ 
+-    def check_sizeof(self, format_str, number_of_codes):
+-        # The size of 'PyStructObject'
+-        totalsize = support.calcobjsize('5P')
+-        # The size taken up by the 'formatcode' dynamic array
+-        totalsize += struct.calcsize('3P') * (number_of_codes + 1)
+-        support.check_sizeof(self, struct.Struct(format_str), totalsize)
+-
+-    @support.cpython_only
+-    def test__sizeof__(self):
+-        for code in integer_codes:
+-            self.check_sizeof(code, 1)
+-        self.check_sizeof('BHILfdspP', 9)
+-        self.check_sizeof('B' * 1234, 1234)
+-        self.check_sizeof('fd', 2)
+-        self.check_sizeof('xxxxxxxxxxxxxx', 0)
+-        self.check_sizeof('100H', 100)
+-        self.check_sizeof('187s', 1)
+-        self.check_sizeof('20p', 1)
+-        self.check_sizeof('0s', 1)
+-        self.check_sizeof('0c', 0)
+-
+ def test_main():
+-    support.run_unittest(StructTest)
++    run_unittest(StructTest)
+ 
+ if __name__ == '__main__':
+     test_main()
+diff -urN a/Lib/test/test_support.py b/Lib/test/test_support.py
+--- a/Lib/test/test_support.py	2012-12-25 13:41:08.495405725 +0100
++++ b/Lib/test/test_support.py	2012-12-25 13:48:30.891405359 +0100
+@@ -18,8 +18,6 @@
+ import UserDict
+ import re
+ import time
+-import struct
+-import _testcapi
+ try:
+     import thread
+ except ImportError:
+@@ -927,32 +925,6 @@
+     gc.collect()
+ 
+ 
+-_header = '2P'
+-if hasattr(sys, "gettotalrefcount"):
+-    _header = '2P' + _header
+-_vheader = _header + 'P'
+-
+-def calcobjsize(fmt):
+-    return struct.calcsize(_header + fmt + '0P')
+-
+-def calcvobjsize(fmt):
+-    return struct.calcsize(_vheader + fmt + '0P')
+-
+-
+-_TPFLAGS_HAVE_GC = 1<<14
+-_TPFLAGS_HEAPTYPE = 1<<9
+-
+-def check_sizeof(test, o, size):
+-    result = sys.getsizeof(o)
+-    # add GC header size
+-    if ((type(o) == type) and (o.__flags__ & _TPFLAGS_HEAPTYPE) or\
+-        ((type(o) != type) and (type(o).__flags__ & _TPFLAGS_HAVE_GC))):
+-        size += _testcapi.SIZEOF_PYGC_HEAD
+-    msg = 'wrong size for %s: got %d, expected %d' \
+-            % (type(o), result, size)
+-    test.assertEqual(result, size, msg)
+-
+-
+ #=======================================================================
+ # Decorator for running a function in a different locale, correctly resetting
+ # it afterwards.
+diff -urN a/Lib/test/test_sys.py b/Lib/test/test_sys.py
+--- a/Lib/test/test_sys.py	2012-12-25 13:41:08.499405725 +0100
++++ b/Lib/test/test_sys.py	2012-12-25 13:48:30.895405358 +0100
+@@ -490,8 +490,22 @@
+ 
+ class SizeofTest(unittest.TestCase):
+ 
++    TPFLAGS_HAVE_GC = 1<<14
++    TPFLAGS_HEAPTYPE = 1L<<9
++
+     def setUp(self):
+-        self.P = struct.calcsize('P')
++        self.c = len(struct.pack('c', ' '))
++        self.H = len(struct.pack('H', 0))
++        self.i = len(struct.pack('i', 0))
++        self.l = len(struct.pack('l', 0))
++        self.P = len(struct.pack('P', 0))
++        # due to missing size_t information from struct, it is assumed that
++        # sizeof(Py_ssize_t) = sizeof(void*)
++        self.header = 'PP'
++        self.vheader = self.header + 'P'
++        if hasattr(sys, "gettotalrefcount"):
++            self.header += '2P'
++            self.vheader += '2P'
+         self.longdigit = sys.long_info.sizeof_digit
+         import _testcapi
+         self.gc_headsize = _testcapi.SIZEOF_PYGC_HEAD
+@@ -501,109 +515,128 @@
+         self.file.close()
+         test.test_support.unlink(test.test_support.TESTFN)
+ 
+-    check_sizeof = test.test_support.check_sizeof
++    def check_sizeof(self, o, size):
++        result = sys.getsizeof(o)
++        if ((type(o) == type) and (o.__flags__ & self.TPFLAGS_HEAPTYPE) or\
++           ((type(o) != type) and (type(o).__flags__ & self.TPFLAGS_HAVE_GC))):
++            size += self.gc_headsize
++        msg = 'wrong size for %s: got %d, expected %d' \
++                % (type(o), result, size)
++        self.assertEqual(result, size, msg)
++
++    def calcsize(self, fmt):
++        """Wrapper around struct.calcsize which enforces the alignment of the
++        end of a structure to the alignment requirement of pointer.
++
++        Note: This wrapper should only be used if a pointer member is included
++        and no member with a size larger than a pointer exists.
++        """
++        return struct.calcsize(fmt + '0P')
+ 
+     def test_gc_head_size(self):
+         # Check that the gc header size is added to objects tracked by the gc.
+-        size = test.test_support.calcobjsize
++        h = self.header
++        size = self.calcsize
+         gc_header_size = self.gc_headsize
+         # bool objects are not gc tracked
+-        self.assertEqual(sys.getsizeof(True), size('l'))
++        self.assertEqual(sys.getsizeof(True), size(h + 'l'))
+         # but lists are
+-        self.assertEqual(sys.getsizeof([]), size('P PP') + gc_header_size)
++        self.assertEqual(sys.getsizeof([]), size(h + 'P PP') + gc_header_size)
+ 
+     def test_default(self):
+-        size = test.test_support.calcobjsize
+-        self.assertEqual(sys.getsizeof(True, -1), size('l'))
++        h = self.header
++        size = self.calcsize
++        self.assertEqual(sys.getsizeof(True, -1), size(h + 'l'))
+ 
+     def test_objecttypes(self):
+         # check all types defined in Objects/
+-        size = test.test_support.calcobjsize
+-        vsize = test.test_support.calcvobjsize
++        h = self.header
++        vh = self.vheader
++        size = self.calcsize
+         check = self.check_sizeof
+         # bool
+-        check(True, size('l'))
++        check(True, size(h + 'l'))
+         # buffer
+         with test.test_support.check_py3k_warnings():
+-            check(buffer(''), size('2P2Pil'))
++            check(buffer(''), size(h + '2P2Pil'))
+         # builtin_function_or_method
+-        check(len, size('3P'))
++        check(len, size(h + '3P'))
+         # bytearray
+         samples = ['', 'u'*100000]
+         for sample in samples:
+             x = bytearray(sample)
+-            check(x, vsize('iPP') + x.__alloc__())
++            check(x, size(vh + 'iPP') + x.__alloc__() * self.c)
+         # bytearray_iterator
+-        check(iter(bytearray()), size('PP'))
++        check(iter(bytearray()), size(h + 'PP'))
+         # cell
+         def get_cell():
+             x = 42
+             def inner():
+                 return x
+             return inner
+-        check(get_cell().func_closure[0], size('P'))
++        check(get_cell().func_closure[0], size(h + 'P'))
+         # classobj (old-style class)
+         class class_oldstyle():
+             def method():
+                 pass
+-        check(class_oldstyle, size('7P'))
++        check(class_oldstyle, size(h + '7P'))
+         # instance (old-style class)
+-        check(class_oldstyle(), size('3P'))
++        check(class_oldstyle(), size(h + '3P'))
+         # instancemethod (old-style class)
+-        check(class_oldstyle().method, size('4P'))
++        check(class_oldstyle().method, size(h + '4P'))
+         # complex
+-        check(complex(0,1), size('2d'))
++        check(complex(0,1), size(h + '2d'))
+         # code
+-        check(get_cell().func_code, size('4i8Pi3P'))
++        check(get_cell().func_code, size(h + '4i8Pi3P'))
+         # BaseException
+-        check(BaseException(), size('3P'))
++        check(BaseException(), size(h + '3P'))
+         # UnicodeEncodeError
+-        check(UnicodeEncodeError("", u"", 0, 0, ""), size('5P2PP'))
++        check(UnicodeEncodeError("", u"", 0, 0, ""), size(h + '5P2PP'))
+         # UnicodeDecodeError
+-        check(UnicodeDecodeError("", "", 0, 0, ""), size('5P2PP'))
++        check(UnicodeDecodeError("", "", 0, 0, ""), size(h + '5P2PP'))
+         # UnicodeTranslateError
+-        check(UnicodeTranslateError(u"", 0, 1, ""), size('5P2PP'))
++        check(UnicodeTranslateError(u"", 0, 1, ""), size(h + '5P2PP'))
+         # method_descriptor (descriptor object)
+-        check(str.lower, size('2PP'))
++        check(str.lower, size(h + '2PP'))
+         # classmethod_descriptor (descriptor object)
+         # XXX
+         # member_descriptor (descriptor object)
+         import datetime
+-        check(datetime.timedelta.days, size('2PP'))
++        check(datetime.timedelta.days, size(h + '2PP'))
+         # getset_descriptor (descriptor object)
+         import __builtin__
+-        check(__builtin__.file.closed, size('2PP'))
++        check(__builtin__.file.closed, size(h + '2PP'))
+         # wrapper_descriptor (descriptor object)
+-        check(int.__add__, size('2P2P'))
++        check(int.__add__, size(h + '2P2P'))
+         # dictproxy
+         class C(object): pass
+-        check(C.__dict__, size('P'))
++        check(C.__dict__, size(h + 'P'))
+         # method-wrapper (descriptor object)
+-        check({}.__iter__, size('2P'))
++        check({}.__iter__, size(h + '2P'))
+         # dict
+-        check({}, size('3P2P' + 8*'P2P'))
++        check({}, size(h + '3P2P' + 8*'P2P'))
+         x = {1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7, 8:8}
+-        check(x, size('3P2P' + 8*'P2P') + 16*struct.calcsize('P2P'))
++        check(x, size(h + '3P2P' + 8*'P2P') + 16*size('P2P'))
+         # dictionary-keyiterator
+-        check({}.iterkeys(), size('P2PPP'))
++        check({}.iterkeys(), size(h + 'P2PPP'))
+         # dictionary-valueiterator
+-        check({}.itervalues(), size('P2PPP'))
++        check({}.itervalues(), size(h + 'P2PPP'))
+         # dictionary-itemiterator
+-        check({}.iteritems(), size('P2PPP'))
++        check({}.iteritems(), size(h + 'P2PPP'))
+         # ellipses
+-        check(Ellipsis, size(''))
++        check(Ellipsis, size(h + ''))
+         # EncodingMap
+         import codecs, encodings.iso8859_3
+         x = codecs.charmap_build(encodings.iso8859_3.decoding_table)
+-        check(x, size('32B2iB'))
++        check(x, size(h + '32B2iB'))
+         # enumerate
+-        check(enumerate([]), size('l3P'))
++        check(enumerate([]), size(h + 'l3P'))
+         # file
+-        check(self.file, size('4P2i4P3i3P3i'))
++        check(self.file, size(h + '4P2i4P3i3P3i'))
+         # float
+-        check(float(0), size('d'))
++        check(float(0), size(h + 'd'))
+         # sys.floatinfo
+-        check(sys.float_info, vsize('') + self.P * len(sys.float_info))
++        check(sys.float_info, size(vh) + self.P * len(sys.float_info))
+         # frame
+         import inspect
+         CO_MAXBLOCKS = 20
+@@ -612,10 +645,10 @@
+         nfrees = len(x.f_code.co_freevars)
+         extras = x.f_code.co_stacksize + x.f_code.co_nlocals +\
+                  ncells + nfrees - 1
+-        check(x, vsize('12P3i' + CO_MAXBLOCKS*'3i' + 'P' + extras*'P'))
++        check(x, size(vh + '12P3i' + CO_MAXBLOCKS*'3i' + 'P' + extras*'P'))
+         # function
+         def func(): pass
+-        check(func, size('9P'))
++        check(func, size(h + '9P'))
+         class c():
+             @staticmethod
+             def foo():
+@@ -624,65 +657,65 @@
+             def bar(cls):
+                 pass
+             # staticmethod
+-            check(foo, size('P'))
++            check(foo, size(h + 'P'))
+             # classmethod
+-            check(bar, size('P'))
++            check(bar, size(h + 'P'))
+         # generator
+         def get_gen(): yield 1
+-        check(get_gen(), size('Pi2P'))
++        check(get_gen(), size(h + 'Pi2P'))
+         # integer
+-        check(1, size('l'))
+-        check(100, size('l'))
++        check(1, size(h + 'l'))
++        check(100, size(h + 'l'))
+         # iterator
+-        check(iter('abc'), size('lP'))
++        check(iter('abc'), size(h + 'lP'))
+         # callable-iterator
+         import re
+-        check(re.finditer('',''), size('2P'))
++        check(re.finditer('',''), size(h + '2P'))
+         # list
+         samples = [[], [1,2,3], ['1', '2', '3']]
+         for sample in samples:
+-            check(sample, vsize('PP') + len(sample)*self.P)
++            check(sample, size(vh + 'PP') + len(sample)*self.P)
+         # sortwrapper (list)
+         # XXX
+         # cmpwrapper (list)
+         # XXX
+         # listiterator (list)
+-        check(iter([]), size('lP'))
++        check(iter([]), size(h + 'lP'))
+         # listreverseiterator (list)
+-        check(reversed([]), size('lP'))
++        check(reversed([]), size(h + 'lP'))
+         # long
+-        check(0L, vsize(''))
+-        check(1L, vsize('') + self.longdigit)
+-        check(-1L, vsize('') + self.longdigit)
++        check(0L, size(vh))
++        check(1L, size(vh) + self.longdigit)
++        check(-1L, size(vh) + self.longdigit)
+         PyLong_BASE = 2**sys.long_info.bits_per_digit
+-        check(long(PyLong_BASE), vsize('') + 2*self.longdigit)
+-        check(long(PyLong_BASE**2-1), vsize('') + 2*self.longdigit)
+-        check(long(PyLong_BASE**2), vsize('') + 3*self.longdigit)
++        check(long(PyLong_BASE), size(vh) + 2*self.longdigit)
++        check(long(PyLong_BASE**2-1), size(vh) + 2*self.longdigit)
++        check(long(PyLong_BASE**2), size(vh) + 3*self.longdigit)
+         # module
+-        check(unittest, size('P'))
++        check(unittest, size(h + 'P'))
+         # None
+-        check(None, size(''))
++        check(None, size(h + ''))
+         # object
+-        check(object(), size(''))
++        check(object(), size(h + ''))
+         # property (descriptor object)
+         class C(object):
+             def getx(self): return self.__x
+             def setx(self, value): self.__x = value
+             def delx(self): del self.__x
+             x = property(getx, setx, delx, "")
+-            check(x, size('4Pi'))
++            check(x, size(h + '4Pi'))
+         # PyCObject
+         # PyCapsule
+         # XXX
+         # rangeiterator
+-        check(iter(xrange(1)), size('4l'))
++        check(iter(xrange(1)), size(h + '4l'))
+         # reverse
+-        check(reversed(''), size('PP'))
++        check(reversed(''), size(h + 'PP'))
+         # set
+         # frozenset
+         PySet_MINSIZE = 8
+         samples = [[], range(10), range(50)]
+-        s = size('3P2P' + PySet_MINSIZE*'lP' + 'lP')
++        s = size(h + '3P2P' + PySet_MINSIZE*'lP' + 'lP')
+         for sample in samples:
+             minused = len(sample)
+             if minused == 0: tmp = 1
+@@ -699,24 +732,23 @@
+                 check(set(sample), s + newsize*struct.calcsize('lP'))
+                 check(frozenset(sample), s + newsize*struct.calcsize('lP'))
+         # setiterator
+-        check(iter(set()), size('P3P'))
++        check(iter(set()), size(h + 'P3P'))
+         # slice
+-        check(slice(1), size('3P'))
++        check(slice(1), size(h + '3P'))
+         # str
+-        vh = test.test_support._vheader
+-        check('', struct.calcsize(vh + 'lic'))
+-        check('abc', struct.calcsize(vh + 'lic') + 3)
++        check('', struct.calcsize(vh + 'li') + 1)
++        check('abc', struct.calcsize(vh + 'li') + 1 + 3*self.c)
+         # super
+-        check(super(int), size('3P'))
++        check(super(int), size(h + '3P'))
+         # tuple
+-        check((), vsize(''))
+-        check((1,2,3), vsize('') + 3*self.P)
++        check((), size(vh))
++        check((1,2,3), size(vh) + 3*self.P)
+         # tupleiterator
+-        check(iter(()), size('lP'))
++        check(iter(()), size(h + 'lP'))
+         # type
+         # (PyTypeObject + PyNumberMethods +  PyMappingMethods +
+         #  PySequenceMethods + PyBufferProcs)
+-        s = vsize('P2P15Pl4PP9PP11PI') + struct.calcsize('41P 10P 3P 6P')
++        s = size(vh + 'P2P15Pl4PP9PP11PI') + size('41P 10P 3P 6P')
+         class newstyleclass(object):
+             pass
+         check(newstyleclass, s)
+@@ -731,40 +763,41 @@
+         # we need to test for both sizes, because we don't know if the string
+         # has been cached
+         for s in samples:
+-            check(s, size('PPlP') + usize * (len(s) + 1))
++            check(s, size(h + 'PPlP') + usize * (len(s) + 1))
+         # weakref
+         import weakref
+-        check(weakref.ref(int), size('2Pl2P'))
++        check(weakref.ref(int), size(h + '2Pl2P'))
+         # weakproxy
+         # XXX
+         # weakcallableproxy
+-        check(weakref.proxy(int), size('2Pl2P'))
++        check(weakref.proxy(int), size(h + '2Pl2P'))
+         # xrange
+-        check(xrange(1), size('3l'))
+-        check(xrange(66000), size('3l'))
++        check(xrange(1), size(h + '3l'))
++        check(xrange(66000), size(h + '3l'))
+ 
+     def test_pythontypes(self):
+         # check all types defined in Python/
+-        size = test.test_support.calcobjsize
+-        vsize = test.test_support.calcvobjsize
++        h = self.header
++        vh = self.vheader
++        size = self.calcsize
+         check = self.check_sizeof
+         # _ast.AST
+         import _ast
+-        check(_ast.AST(), size(''))
++        check(_ast.AST(), size(h + ''))
+         # imp.NullImporter
+         import imp
+-        check(imp.NullImporter(self.file.name), size(''))
++        check(imp.NullImporter(self.file.name), size(h + ''))
+         try:
+             raise TypeError
+         except TypeError:
+             tb = sys.exc_info()[2]
+             # traceback
+             if tb != None:
+-                check(tb, size('2P2i'))
++                check(tb, size(h + '2P2i'))
+         # symtable entry
+         # XXX
+         # sys.flags
+-        check(sys.flags, vsize('') + self.P * len(sys.flags))
++        check(sys.flags, size(vh) + self.P * len(sys.flags))
+ 
+ 
+ def test_main():
+diff -urN a/Misc/ACKS b/Misc/ACKS
+--- a/Misc/ACKS	2012-12-25 13:41:08.507405725 +0100
++++ b/Misc/ACKS	2012-12-25 13:48:09.675405378 +0100
+@@ -394,7 +394,6 @@
+ Greg Humphreys
+ Eric Huss
+ Jeremy Hylton
+-Ludwig HÃ¤hne
+ Gerhard HÃ¤ring
+ Fredrik HÃ¥Ã¥rd
+ Catalin Iacob
+diff -urN a/Misc/NEWS b/Misc/NEWS
+--- a/Misc/NEWS	2012-12-25 13:41:08.511405725 +0100
++++ b/Misc/NEWS	2012-12-25 13:48:48.947405345 +0100
+@@ -100,9 +100,6 @@
+ 
+ - Issue #15567: Fix NameError when running threading._test
+ 
+-- Issue #15424: Add a __sizeof__ implementation for array objects.
+-  Patch by Ludwig HÃ¤hne.
+-
+ - Issue #13052: Fix IDLE crashing when replace string in Search/Replace dialog
+   ended with '\'. Patch by Roger Serwy.
+ 
+@@ -115,22 +112,6 @@
+ - Issue #12288: Consider '0' and '0.0' as valid initialvalue
+   for tkinter SimpleDialog.
+ 
+-- Issue #15489: Add a __sizeof__ implementation for BytesIO objects.
+-  Patch by Serhiy Storchaka.
+-
+-- Issue #15469: Add a __sizeof__ implementation for deque objects.
+-  Patch by Serhiy Storchaka.
+-
+-- Issue #15487: Add a __sizeof__ implementation for buffered I/O objects.
+-  Patch by Serhiy Storchaka.
+-
+-- Issue #15512: Add a __sizeof__ implementation for parser.
+-  Patch by Serhiy Storchaka.
+-
+-- Issue #15402: An issue in the struct module that caused sys.getsizeof to
+-  return incorrect results for struct.Struct instances has been fixed.
+-  Initial patch by Serhiy Storchaka.
+-
+ - Issue #15232: when mangle_from is True, email.Generator now correctly mangles
+   lines that start with 'From ' that occur in a MIME preamble or epilog.
+ 
+@@ -934,9 +915,6 @@
+ Tests
+ -----
+ 
+-- Issue #15467: Move helpers for __sizeof__ tests into test_support.
+-  Patch by Serhiy Storchaka.
+-
+ - Issue #11689: Fix a variable scoping error in an sqlite3 test.
+   Initial patch by Torsten Landschoff.
+ 
+diff -urN a/Modules/arraymodule.c b/Modules/arraymodule.c
+--- a/Modules/arraymodule.c	2012-12-25 13:41:08.519405725 +0100
++++ b/Modules/arraymodule.c	2012-12-25 13:48:09.683405376 +0100
+@@ -1533,19 +1533,6 @@
+ PyDoc_STRVAR(reduce_doc, "Return state information for pickling.");
+ 
+ static PyObject *
+-array_sizeof(arrayobject *self, PyObject *unused)
+-{
+-    Py_ssize_t res;
+-    res = sizeof(arrayobject) + self->allocated * self->ob_descr->itemsize;
+-    return PyLong_FromSsize_t(res);
+-}
+-
+-PyDoc_STRVAR(sizeof_doc,
+-"__sizeof__() -> int\n\
+-\n\
+-Size of the array in memory, in bytes.");
+-
+-static PyObject *
+ array_get_typecode(arrayobject *a, void *closure)
+ {
+     char tc = a->ob_descr->typecode;
+@@ -1619,8 +1606,6 @@
+ #endif
+     {"write",           (PyCFunction)array_tofile_as_write,     METH_O,
+      tofile_doc},
+-    {"__sizeof__",      (PyCFunction)array_sizeof,      METH_NOARGS,
+-     sizeof_doc},
+     {NULL,              NULL}           /* sentinel */
+ };
+ 
+diff -urN a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c
+--- a/Modules/_collectionsmodule.c	2012-12-25 13:41:08.511405725 +0100
++++ b/Modules/_collectionsmodule.c	2012-12-25 13:48:19.855405367 +0100
+@@ -991,23 +991,6 @@
+ }
+ 
+ static PyObject *
+-deque_sizeof(dequeobject *deque, void *unused)
+-{
+-    Py_ssize_t res;
+-    Py_ssize_t blocks;
+-
+-    res = sizeof(dequeobject);
+-    blocks = (deque->leftindex + deque->len + BLOCKLEN - 1) / BLOCKLEN;
+-    assert(deque->leftindex + deque->len - 1 ==
+-           (blocks - 1) * BLOCKLEN + deque->rightindex);
+-    res += blocks * sizeof(block);
+-    return PyLong_FromSsize_t(res);
+-}
+-
+-PyDoc_STRVAR(sizeof_doc,
+-"D.__sizeof__() -- size of D in memory, in bytes");
+-
+-static PyObject *
+ deque_get_maxlen(dequeobject *deque)
+ {
+     if (deque->maxlen == -1)
+@@ -1070,9 +1053,7 @@
+     {"reverse",                 (PyCFunction)deque_reverse,
+         METH_NOARGS,             reverse_doc},
+     {"rotate",                  (PyCFunction)deque_rotate,
+-        METH_VARARGS,            rotate_doc},
+-    {"__sizeof__",              (PyCFunction)deque_sizeof,
+-        METH_NOARGS,             sizeof_doc},
++        METH_VARARGS,           rotate_doc},
+     {NULL,              NULL}   /* sentinel */
+ };
+ 
+diff -urN a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c
+--- a/Modules/_io/bufferedio.c	2012-12-25 13:41:08.515405725 +0100
++++ b/Modules/_io/bufferedio.c	2012-12-25 13:48:30.903405359 +0100
+@@ -386,17 +386,6 @@
+     Py_TYPE(self)->tp_free((PyObject *)self);
+ }
+ 
+-static PyObject *
+-buffered_sizeof(buffered *self, void *unused)
+-{
+-    Py_ssize_t res;
+-
+-    res = sizeof(buffered);
+-    if (self->buffer)
+-        res += self->buffer_size;
+-    return PyLong_FromSsize_t(res);
+-}
+-
+ static int
+ buffered_traverse(buffered *self, visitproc visit, void *arg)
+ {
+@@ -1571,7 +1560,6 @@
+     {"seek", (PyCFunction)buffered_seek, METH_VARARGS},
+     {"tell", (PyCFunction)buffered_tell, METH_NOARGS},
+     {"truncate", (PyCFunction)buffered_truncate, METH_VARARGS},
+-    {"__sizeof__", (PyCFunction)buffered_sizeof, METH_NOARGS},
+     {NULL, NULL}
+ };
+ 
+@@ -1964,7 +1952,6 @@
+     {"flush", (PyCFunction)buffered_flush, METH_NOARGS},
+     {"seek", (PyCFunction)buffered_seek, METH_VARARGS},
+     {"tell", (PyCFunction)buffered_tell, METH_NOARGS},
+-    {"__sizeof__", (PyCFunction)buffered_sizeof, METH_NOARGS},
+     {NULL, NULL}
+ };
+ 
+@@ -2360,7 +2347,6 @@
+     {"readline", (PyCFunction)buffered_readline, METH_VARARGS},
+     {"peek", (PyCFunction)buffered_peek, METH_VARARGS},
+     {"write", (PyCFunction)bufferedwriter_write, METH_VARARGS},
+-    {"__sizeof__", (PyCFunction)buffered_sizeof, METH_NOARGS},
+     {NULL, NULL}
+ };
+ 
+diff -urN a/Modules/_io/bytesio.c b/Modules/_io/bytesio.c
+--- a/Modules/_io/bytesio.c	2012-12-25 13:41:08.515405725 +0100
++++ b/Modules/_io/bytesio.c	2012-12-25 13:48:30.903405359 +0100
+@@ -794,17 +794,6 @@
+     return 0;
+ }
+ 
+-static PyObject *
+-bytesio_sizeof(bytesio *self, void *unused)
+-{
+-    Py_ssize_t res;
+-
+-    res = sizeof(bytesio);
+-    if (self->buf)
+-        res += self->buf_size;
+-    return PyLong_FromSsize_t(res);
+-}
+-
+ static int
+ bytesio_traverse(bytesio *self, visitproc visit, void *arg)
+ {
+@@ -846,7 +835,6 @@
+     {"truncate",   (PyCFunction)bytesio_truncate,   METH_VARARGS, truncate_doc},
+     {"__getstate__",  (PyCFunction)bytesio_getstate,  METH_NOARGS, NULL},
+     {"__setstate__",  (PyCFunction)bytesio_setstate,  METH_O, NULL},
+-    {"__sizeof__", (PyCFunction)bytesio_sizeof,     METH_NOARGS, NULL},
+     {NULL, NULL}        /* sentinel */
+ };
+ 
+diff -urN a/Modules/parsermodule.c b/Modules/parsermodule.c
+--- a/Modules/parsermodule.c	2012-12-25 13:41:08.523405725 +0100
++++ b/Modules/parsermodule.c	2012-12-25 13:48:19.859405367 +0100
+@@ -169,33 +169,9 @@
+ 
+ 
+ static void parser_free(PyST_Object *st);
+-static PyObject* parser_sizeof(PyST_Object *, void *);
+ static int parser_compare(PyST_Object *left, PyST_Object *right);
+ static PyObject *parser_getattr(PyObject *self, char *name);
+-static PyObject* parser_compilest(PyST_Object *, PyObject *, PyObject *);
+-static PyObject* parser_isexpr(PyST_Object *, PyObject *, PyObject *);
+-static PyObject* parser_issuite(PyST_Object *, PyObject *, PyObject *);
+-static PyObject* parser_st2list(PyST_Object *, PyObject *, PyObject *);
+-static PyObject* parser_st2tuple(PyST_Object *, PyObject *, PyObject *);
+ 
+-#define PUBLIC_METHOD_TYPE (METH_VARARGS|METH_KEYWORDS)
+-
+-static PyMethodDef
+-parser_methods[] = {
+-    {"compile",         (PyCFunction)parser_compilest,  PUBLIC_METHOD_TYPE,
+-        PyDoc_STR("Compile this ST object into a code object.")},
+-    {"isexpr",          (PyCFunction)parser_isexpr,     PUBLIC_METHOD_TYPE,
+-        PyDoc_STR("Determines if this ST object was created from an expression.")},
+-    {"issuite",         (PyCFunction)parser_issuite,    PUBLIC_METHOD_TYPE,
+-        PyDoc_STR("Determines if this ST object was created from a suite.")},
+-    {"tolist",          (PyCFunction)parser_st2list,    PUBLIC_METHOD_TYPE,
+-        PyDoc_STR("Creates a list-tree representation of this ST.")},
+-    {"totuple",         (PyCFunction)parser_st2tuple,   PUBLIC_METHOD_TYPE,
+-        PyDoc_STR("Creates a tuple-tree representation of this ST.")},
+-    {"__sizeof__",      (PyCFunction)parser_sizeof,     METH_NOARGS,
+-        PyDoc_STR("Returns size in memory, in bytes.")},
+-    {NULL, NULL, 0, NULL}
+-};
+ 
+ static
+ PyTypeObject PyST_Type = {
+@@ -224,14 +200,7 @@
+     Py_TPFLAGS_DEFAULT,                 /* tp_flags             */
+ 
+     /* __doc__ */
+-    "Intermediate representation of a Python parse tree.",
+-    0,                                  /* tp_traverse */
+-    0,                                  /* tp_clear */
+-    0,                                  /* tp_richcompare */
+-    0,                                  /* tp_weaklistoffset */
+-    0,                                  /* tp_iter */
+-    0,                                  /* tp_iternext */
+-    parser_methods,                     /* tp_methods */
++    "Intermediate representation of a Python parse tree."
+ };  /* PyST_Type */
+ 
+ 
+@@ -525,6 +494,25 @@
+ }
+ 
+ 
++#define PUBLIC_METHOD_TYPE (METH_VARARGS|METH_KEYWORDS)
++
++static PyMethodDef
++parser_methods[] = {
++    {"compile",         (PyCFunction)parser_compilest,  PUBLIC_METHOD_TYPE,
++        PyDoc_STR("Compile this ST object into a code object.")},
++    {"isexpr",          (PyCFunction)parser_isexpr,     PUBLIC_METHOD_TYPE,
++        PyDoc_STR("Determines if this ST object was created from an expression.")},
++    {"issuite",         (PyCFunction)parser_issuite,    PUBLIC_METHOD_TYPE,
++        PyDoc_STR("Determines if this ST object was created from a suite.")},
++    {"tolist",          (PyCFunction)parser_st2list,    PUBLIC_METHOD_TYPE,
++        PyDoc_STR("Creates a list-tree representation of this ST.")},
++    {"totuple",         (PyCFunction)parser_st2tuple,   PUBLIC_METHOD_TYPE,
++        PyDoc_STR("Creates a tuple-tree representation of this ST.")},
++
++    {NULL, NULL, 0, NULL}
++};
++
++
+ static PyObject*
+ parser_getattr(PyObject *self, char *name)
+ {
+@@ -707,15 +695,6 @@
+     return parser_tuple2st(self, args, kw);
+ }
+ 
+-static PyObject *
+-parser_sizeof(PyST_Object *st, void *unused)
+-{
+-    Py_ssize_t res;
+-
+-    res = sizeof(PyST_Object) + _PyNode_SizeOf(st->st_node);
+-    return PyLong_FromSsize_t(res);
+-}
+-
+ 
+ /*  node* build_node_children()
+  *
+diff -urN a/Modules/_struct.c b/Modules/_struct.c
+--- a/Modules/_struct.c	2012-12-25 13:41:08.519405725 +0100
++++ b/Modules/_struct.c	2012-12-25 13:48:48.951405344 +0100
+@@ -1693,18 +1693,6 @@
+     return PyInt_FromSsize_t(self->s_size);
+ }
+ 
+-PyDoc_STRVAR(s_sizeof__doc__,
+-"S.__sizeof__() -> size of S in memory, in bytes");
+-
+-static PyObject *
+-s_sizeof(PyStructObject *self, void *unused)
+-{
+-    Py_ssize_t size;
+-
+-    size = sizeof(PyStructObject) + sizeof(formatcode) * (self->s_len + 1);
+-    return PyLong_FromSsize_t(size);
+-}
+-
+ /* List of functions */
+ 
+ static struct PyMethodDef s_methods[] = {
+@@ -1713,7 +1701,6 @@
+     {"unpack",          s_unpack,       METH_O, s_unpack__doc__},
+     {"unpack_from",     (PyCFunction)s_unpack_from, METH_VARARGS|METH_KEYWORDS,
+                     s_unpack_from__doc__},
+-    {"__sizeof__",      (PyCFunction)s_sizeof, METH_NOARGS, s_sizeof__doc__},
+     {NULL,       NULL}          /* sentinel */
+ };
+ 
+diff -urN a/Parser/node.c b/Parser/node.c
+--- a/Parser/node.c	2012-12-25 13:41:08.551405725 +0100
++++ b/Parser/node.c	2012-12-25 13:48:19.859405367 +0100
+@@ -114,7 +114,6 @@
+ 
+ /* Forward */
+ static void freechildren(node *);
+-static Py_ssize_t sizeofchildren(node *n);
+ 
+ 
+ void
+@@ -126,16 +125,6 @@
+     }
+ }
+ 
+-Py_ssize_t
+-_PyNode_SizeOf(node *n)
+-{
+-    Py_ssize_t res = 0;
+-
+-    if (n != NULL)
+-        res = sizeof(node) + sizeofchildren(n);
+-    return res;
+-}
+-
+ static void
+ freechildren(node *n)
+ {
+@@ -147,18 +136,3 @@
+     if (STR(n) != NULL)
+         PyObject_FREE(STR(n));
+ }
+-
+-static Py_ssize_t
+-sizeofchildren(node *n)
+-{
+-    Py_ssize_t res = 0;
+-    int i;
+-    for (i = NCH(n); --i >= 0; )
+-        res += sizeofchildren(CHILD(n, i));
+-    if (n->n_child != NULL)
+-        /* allocated size of n->n_child array */
+-        res += XXXROUNDUP(NCH(n)) * sizeof(node);
+-    if (STR(n) != NULL)
+-        res += strlen(STR(n)) + 1;
+-    return res;
+-}
--- python2.7-2.7.3.orig/debian/patches/deb-locations.diff
+++ python2.7-2.7.3/debian/patches/deb-locations.diff
@@ -0,0 +1,63 @@
+# DP: adjust locations of directories to debian policy
+
+--- a/Demo/tkinter/guido/ManPage.py
++++ b/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':
+--- a/Demo/tkinter/guido/tkman.py
++++ b/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/share/man/mann']
++MAN3DIRLIST = ['/depot/sundry/man/man3','/usr/share/man/man3']
+ 
+ foundmanndir = 0
+ for dir in MANNDIRLIST:
+--- a/Misc/python.man
++++ b/Misc/python.man
+@@ -323,7 +323,7 @@
+ These are subject to difference depending on local installation
+ conventions; ${prefix} and ${exec_prefix} are installation-dependent
+ and should be interpreted as for GNU software; they may be the same.
+-The default for both is \fI/usr/local\fP.
++On Debian GNU/{Hurd,Linux} the default for both is \fI/usr\fP.
+ .IP \fI${exec_prefix}/bin/python\fP
+ Recommended location of the interpreter.
+ .PP
+--- a/Tools/faqwiz/faqconf.py
++++ b/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
+--- a/Tools/webchecker/webchecker.py
++++ b/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:
--- python2.7-2.7.3.orig/debian/patches/cthreads.diff
+++ python2.7-2.7.3/debian/patches/cthreads.diff
@@ -0,0 +1,39 @@
+# DP: Remove cthreads detection
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -2154,7 +2154,6 @@
+ 
+ # Templates for things AC_DEFINEd more than once.
+ # For a single AC_DEFINE, no template is needed.
+-AH_TEMPLATE(C_THREADS,[Define if you have the Mach cthreads package])
+ AH_TEMPLATE(_REENTRANT,
+   [Define to force use of thread-safe errno, h_errno, and other functions])
+ AH_TEMPLATE(WITH_THREAD,
+@@ -2236,17 +2235,6 @@
+     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, 1,
+-    [Define if you are using Mach cthreads directly under /include])
+-    LIBS="$LIBS -lthreads"
+-    THREADOBJ="Python/thread.o"],[
+-    AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
+-    AC_DEFINE(C_THREADS)
+-    AC_DEFINE(MACH_C_THREADS, 1,
+-    [Define if you are using Mach cthreads under mach /])
+-    THREADOBJ="Python/thread.o"],[
+     AC_MSG_CHECKING(for --with-pth)
+     AC_ARG_WITH([pth],
+                 AS_HELP_STRING([--with-pth], [use GNU pth threading libraries]),
+@@ -2301,7 +2289,7 @@
+     LIBS="$LIBS -lcma"
+     THREADOBJ="Python/thread.o"],[
+     USE_THREAD_MODULE="#"])
+-    ])])])])])])])])])])
++    ])])])])])])])])
+ 
+     AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
+     LIBS="$LIBS -lmpc"
--- python2.7-2.7.3.orig/debian/patches/series.in
+++ python2.7-2.7.3/debian/patches/series.in
@@ -0,0 +1,76 @@
+hg-updates.diff
+revert-sizeof-methods.diff
+revert-issue14635.diff
+makeflags.diff
+issue9374-followup.diff
+setup-modules-heapq.diff
+issue9189.diff
+issue15340.diff
+issue15847.diff
+deb-setup.diff
+deb-locations.diff
+site-locations.diff
+distutils-install-layout.diff
+locale-module.diff
+distutils-link.diff
+distutils-sysconfig.diff
+test-sundry.diff
+tkinter-import.diff
+link-opt.diff
+debug-build.diff
+hotshot-import.diff
+webbrowser.diff
+linecache.diff
+doc-nodownload.diff
+profiled-build.diff
+no-zip-on-sys.path.diff
+platform-lsbrelease.diff
+bdist-wininst-notfound.diff
+setup-modules-ssl.diff
+makesetup-bashism.diff
+hurd-broken-poll.diff
+hurd-disable-nonworking-constants.diff
+#ifdef WITH_FPECTL
+enable-fpectl.diff
+#endif
+statvfs-f_flag-constants.diff
+#if defined (arch_alpha)
+plat-linux2_alpha.diff
+#elif defined (arch_hppa)
+plat-linux2_hppa.diff
+#elif defined (arch_mips) || defined(arch_mipsel)
+plat-linux2_mips.diff
+#elif defined (arch_sparc) || defined (arch_sparc64)
+plat-linux2_sparc.diff
+#endif
+#if defined (BROKEN_UTIMES)
+disable-utimes.diff
+#endif
+#if defined (Ubuntu)
+langpack-gettext.diff
+#endif
+#if defined (arch_os_hurd)
+no-large-file-support.diff
+cthreads.diff
+#endif
+issue9012a.diff
+link-system-expat.diff
+plat-gnukfreebsd.diff
+link-whole-archive.diff
+bsddb-libpath.diff
+disable-sem-check.diff
+ncursesw-incdir.diff
+multiprocessing-typos.diff
+ctypes-arm.diff
+db5.1.diff
+lto-link-flags.diff
+disable-ssl-cert-tests.diff
+xdg-gvfs-open.diff
+sqlite-rpath.diff
+do-not-italicize-punctuation.patch
+sysconfigdata.diff
+CVE-2013-4238.diff
+CVE-2014-1912.diff
+CVE-2016-0772.diff
+CVE-2016-5636.diff
+CVE-2016-5699.diff
--- python2.7-2.7.3.orig/debian/patches/no-zip-on-sys.path.diff
+++ python2.7-2.7.3/debian/patches/no-zip-on-sys.path.diff
@@ -0,0 +1,52 @@
+# DP: Do not add /usr/lib/pythonXY.zip on sys.path.
+
+--- a/Modules/getpath.c
++++ b/Modules/getpath.c
+@@ -380,7 +380,9 @@
+     char *path = getenv("PATH");
+     char *prog = Py_GetProgramName();
+     char argv0_path[MAXPATHLEN+1];
++#ifdef WITH_ZIP_PATH
+     char zip_path[MAXPATHLEN+1];
++#endif
+     int pfound, efound; /* 1 if found; -1 if found build directory */
+     char *buf;
+     size_t bufsz;
+@@ -520,6 +522,7 @@
+     else
+         reduce(prefix);
+ 
++#ifdef WITH_ZIP_PATH
+     strncpy(zip_path, prefix, MAXPATHLEN);
+     zip_path[MAXPATHLEN] = '\0';
+     if (pfound > 0) { /* Use the reduced prefix returned by Py_GetPrefix() */
+@@ -532,6 +535,7 @@
+     bufsz = strlen(zip_path);   /* Replace "00" with version */
+     zip_path[bufsz - 6] = VERSION[0];
+     zip_path[bufsz - 5] = VERSION[2];
++#endif
+ 
+     if (!(efound = search_for_exec_prefix(argv0_path, home))) {
+         if (!Py_FrozenFlag)
+@@ -571,7 +575,9 @@
+         defpath = delim + 1;
+     }
+ 
++#ifdef WITH_ZIP_PATH
+     bufsz += strlen(zip_path) + 1;
++#endif
+     bufsz += strlen(exec_prefix) + 1;
+ 
+     /* This is the only malloc call in this file */
+@@ -592,9 +598,11 @@
+         else
+             buf[0] = '\0';
+ 
++#ifdef WITH_ZIP_PATH
+         /* Next is the default zip path */
+         strcat(buf, zip_path);
+         strcat(buf, delimiter);
++#endif
+ 
+         /* Next goes merge of compile-time $PYTHONPATH with
+          * dynamically located prefix.
--- python2.7-2.7.3.orig/debian/patches/do-not-italicize-punctuation.patch
+++ python2.7-2.7.3/debian/patches/do-not-italicize-punctuation.patch
@@ -0,0 +1,50 @@
+diff -ru python2.5-2.5.2/Misc/python.man python2.5/Misc/python.man
+--- python2.5-2.5.2/Misc/python.man	2010-04-26 09:17:43.000000000 -0700
++++ python2.5/Misc/python.man	2010-04-26 09:16:39.000000000 -0700
+@@ -243,9 +243,9 @@
+ from that file;
+ when called with
+ .B \-c
+-.I command,
++.IR command ,
+ it executes the Python statement(s) given as
+-.I command.
++.IR command .
+ Here
+ .I command
+ may contain multiple statements separated by newlines.
+@@ -255,7 +255,7 @@
+ .PP
+ If available, the script name and additional arguments thereafter are
+ passed to the script in the Python variable
+-.I sys.argv ,
++.IR sys.argv ,
+ which is a list of strings (you must first
+ .I import sys
+ to be able to access it).
+@@ -269,14 +269,14 @@
+ .I '-c'.
+ Note that options interpreted by the Python interpreter itself
+ are not placed in
+-.I sys.argv.
++.IR sys.argv .
+ .PP
+ In interactive mode, the primary prompt is `>>>'; the second prompt
+ (which appears when a command is not complete) is `...'.
+ The prompts can be changed by assignment to
+ .I sys.ps1
+ or
+-.I sys.ps2.
++.IR sys.ps2 .
+ The interpreter quits when it reads an EOF at a prompt.
+ When an unhandled exception occurs, a stack trace is printed and
+ control returns to the primary prompt; in non-interactive mode, the
+@@ -335,7 +335,7 @@
+ inserted in the path in front of $PYTHONPATH.
+ The search path can be manipulated from within a Python program as the
+ variable
+-.I sys.path .
++.IR sys.path .
+ .IP PYTHONSTARTUP
+ If this is the name of a readable file, the Python commands in that
+ file are executed before the first prompt is displayed in interactive
--- python2.7-2.7.3.orig/debian/patches/ctypes-arm.diff
+++ python2.7-2.7.3/debian/patches/ctypes-arm.diff
@@ -0,0 +1,32 @@
+--- a/Lib/ctypes/util.py
++++ b/Lib/ctypes/util.py
+@@ -206,16 +206,27 @@
+ 
+         def _findSoname_ldconfig(name):
+             import struct
++            # XXX this code assumes that we know all unames and that a single
++            # ABI is supported per uname; instead we should find what the
++            # ABI is (e.g. check ABI of current process) or simply ask libc
++            # to load the library for us
++            uname = os.uname()[4]
++            # ARM has a variety of unames, e.g. armv7l
++            if uname.startswith("arm"):
++                uname = "arm"
+             if struct.calcsize('l') == 4:
+-                machine = os.uname()[4] + '-32'
++                machine = uname + '-32'
+             else:
+-                machine = os.uname()[4] + '-64'
++                machine = uname + '-64'
+             mach_map = {
+                 'x86_64-64': 'libc6,x86-64',
+                 'ppc64-64': 'libc6,64bit',
+                 'sparc64-64': 'libc6,64bit',
+                 's390x-64': 'libc6,64bit',
+                 'ia64-64': 'libc6,IA-64',
++                # this actually breaks on biarch or multiarch as the first
++                # library wins; uname doesn't tell us which ABI we're using
++                'arm-32': 'libc6(,hard-float)?',
+                 }
+             abi_type = mach_map.get(machine, 'libc6')
+ 
--- python2.7-2.7.3.orig/debian/patches/CVE-2013-4238.diff
+++ python2.7-2.7.3/debian/patches/CVE-2013-4238.diff
@@ -0,0 +1,247 @@
+diff -r 9ddc63c039ba Lib/test/nullbytecert.pem
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/Lib/test/nullbytecert.pem	Sun Aug 11 18:13:17 2013 +0200
+@@ -0,0 +1,90 @@
++Certificate:
++    Data:
++        Version: 3 (0x2)
++        Serial Number: 0 (0x0)
++    Signature Algorithm: sha1WithRSAEncryption
++        Issuer: C=US, ST=Oregon, L=Beaverton, O=Python Software Foundation, OU=Python Core Development, CN=null.python.org\x00example.org/emailAddress=python-dev@python.org
++        Validity
++            Not Before: Aug  7 13:11:52 2013 GMT
++            Not After : Aug  7 13:12:52 2013 GMT
++        Subject: C=US, ST=Oregon, L=Beaverton, O=Python Software Foundation, OU=Python Core Development, CN=null.python.org\x00example.org/emailAddress=python-dev@python.org
++        Subject Public Key Info:
++            Public Key Algorithm: rsaEncryption
++                Public-Key: (2048 bit)
++                Modulus:
++                    00:b5:ea:ed:c9:fb:46:7d:6f:3b:76:80:dd:3a:f3:
++                    03:94:0b:a7:a6:db:ec:1d:df:ff:23:74:08:9d:97:
++                    16:3f:a3:a4:7b:3e:1b:0e:96:59:25:03:a7:26:e2:
++                    88:a9:cf:79:cd:f7:04:56:b0:ab:79:32:6e:59:c1:
++                    32:30:54:eb:58:a8:cb:91:f0:42:a5:64:27:cb:d4:
++                    56:31:88:52:ad:cf:bd:7f:f0:06:64:1f:cc:27:b8:
++                    a3:8b:8c:f3:d8:29:1f:25:0b:f5:46:06:1b:ca:02:
++                    45:ad:7b:76:0a:9c:bf:bb:b9:ae:0d:16:ab:60:75:
++                    ae:06:3e:9c:7c:31:dc:92:2f:29:1a:e0:4b:0c:91:
++                    90:6c:e9:37:c5:90:d7:2a:d7:97:15:a3:80:8f:5d:
++                    7b:49:8f:54:30:d4:97:2c:1c:5b:37:b5:ab:69:30:
++                    68:43:d3:33:78:4b:02:60:f5:3c:44:80:a1:8f:e7:
++                    f0:0f:d1:5e:87:9e:46:cf:62:fc:f9:bf:0c:65:12:
++                    f1:93:c8:35:79:3f:c8:ec:ec:47:f5:ef:be:44:d5:
++                    ae:82:1e:2d:9a:9f:98:5a:67:65:e1:74:70:7c:cb:
++                    d3:c2:ce:0e:45:49:27:dc:e3:2d:d4:fb:48:0e:2f:
++                    9e:77:b8:14:46:c0:c4:36:ca:02:ae:6a:91:8c:da:
++                    2f:85
++                Exponent: 65537 (0x10001)
++        X509v3 extensions:
++            X509v3 Basic Constraints: critical
++                CA:FALSE
++            X509v3 Subject Key Identifier:
++                88:5A:55:C0:52:FF:61:CD:52:A3:35:0F:EA:5A:9C:24:38:22:F7:5C
++            X509v3 Key Usage:
++                Digital Signature, Non Repudiation, Key Encipherment
++            X509v3 Subject Alternative Name:
++                *************************************************************
++                WARNING: The values for DNS, email and URI are WRONG. OpenSSL
++                         doesn't print the text after a NULL byte.
++                *************************************************************
++                DNS:altnull.python.org, email:null@python.org, URI:http://null.python.org, IP Address:192.0.2.1, IP Address:2001:DB8:0:0:0:0:0:1
++    Signature Algorithm: sha1WithRSAEncryption
++         ac:4f:45:ef:7d:49:a8:21:70:8e:88:59:3e:d4:36:42:70:f5:
++         a3:bd:8b:d7:a8:d0:58:f6:31:4a:b1:a4:a6:dd:6f:d9:e8:44:
++         3c:b6:0a:71:d6:7f:b1:08:61:9d:60:ce:75:cf:77:0c:d2:37:
++         86:02:8d:5e:5d:f9:0f:71:b4:16:a8:c1:3d:23:1c:f1:11:b3:
++         56:6e:ca:d0:8d:34:94:e6:87:2a:99:f2:ae:ae:cc:c2:e8:86:
++         de:08:a8:7f:c5:05:fa:6f:81:a7:82:e6:d0:53:9d:34:f4:ac:
++         3e:40:fe:89:57:7a:29:a4:91:7e:0b:c6:51:31:e5:10:2f:a4:
++         60:76:cd:95:51:1a:be:8b:a1:b0:fd:ad:52:bd:d7:1b:87:60:
++         d2:31:c7:17:c4:18:4f:2d:08:25:a3:a7:4f:b7:92:ca:e2:f5:
++         25:f1:54:75:81:9d:b3:3d:61:a2:f7:da:ed:e1:c6:6f:2c:60:
++         1f:d8:6f:c5:92:05:ab:c9:09:62:49:a9:14:ad:55:11:cc:d6:
++         4a:19:94:99:97:37:1d:81:5f:8b:cf:a3:a8:96:44:51:08:3d:
++         0b:05:65:12:eb:b6:70:80:88:48:72:4f:c6:c2:da:cf:cd:8e:
++         5b:ba:97:2f:60:b4:96:56:49:5e:3a:43:76:63:04:be:2a:f6:
++         c1:ca:a9:94
++-----BEGIN CERTIFICATE-----
++MIIE2DCCA8CgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBxTELMAkGA1UEBhMCVVMx
++DzANBgNVBAgMBk9yZWdvbjESMBAGA1UEBwwJQmVhdmVydG9uMSMwIQYDVQQKDBpQ
++eXRob24gU29mdHdhcmUgRm91bmRhdGlvbjEgMB4GA1UECwwXUHl0aG9uIENvcmUg
++RGV2ZWxvcG1lbnQxJDAiBgNVBAMMG251bGwucHl0aG9uLm9yZwBleGFtcGxlLm9y
++ZzEkMCIGCSqGSIb3DQEJARYVcHl0aG9uLWRldkBweXRob24ub3JnMB4XDTEzMDgw
++NzEzMTE1MloXDTEzMDgwNzEzMTI1MlowgcUxCzAJBgNVBAYTAlVTMQ8wDQYDVQQI
++DAZPcmVnb24xEjAQBgNVBAcMCUJlYXZlcnRvbjEjMCEGA1UECgwaUHl0aG9uIFNv
++ZnR3YXJlIEZvdW5kYXRpb24xIDAeBgNVBAsMF1B5dGhvbiBDb3JlIERldmVsb3Bt
++ZW50MSQwIgYDVQQDDBtudWxsLnB5dGhvbi5vcmcAZXhhbXBsZS5vcmcxJDAiBgkq
++hkiG9w0BCQEWFXB5dGhvbi1kZXZAcHl0aG9uLm9yZzCCASIwDQYJKoZIhvcNAQEB
++BQADggEPADCCAQoCggEBALXq7cn7Rn1vO3aA3TrzA5QLp6bb7B3f/yN0CJ2XFj+j
++pHs+Gw6WWSUDpybiiKnPec33BFawq3kyblnBMjBU61ioy5HwQqVkJ8vUVjGIUq3P
++vX/wBmQfzCe4o4uM89gpHyUL9UYGG8oCRa17dgqcv7u5rg0Wq2B1rgY+nHwx3JIv
++KRrgSwyRkGzpN8WQ1yrXlxWjgI9de0mPVDDUlywcWze1q2kwaEPTM3hLAmD1PESA
++oY/n8A/RXoeeRs9i/Pm/DGUS8ZPINXk/yOzsR/XvvkTVroIeLZqfmFpnZeF0cHzL
++08LODkVJJ9zjLdT7SA4vnne4FEbAxDbKAq5qkYzaL4UCAwEAAaOB0DCBzTAMBgNV
++HRMBAf8EAjAAMB0GA1UdDgQWBBSIWlXAUv9hzVKjNQ/qWpwkOCL3XDALBgNVHQ8E
++BAMCBeAwgZAGA1UdEQSBiDCBhYIeYWx0bnVsbC5weXRob24ub3JnAGV4YW1wbGUu
++Y29tgSBudWxsQHB5dGhvbi5vcmcAdXNlckBleGFtcGxlLm9yZ4YpaHR0cDovL251
++bGwucHl0aG9uLm9yZwBodHRwOi8vZXhhbXBsZS5vcmeHBMAAAgGHECABDbgAAAAA
++AAAAAAAAAAEwDQYJKoZIhvcNAQEFBQADggEBAKxPRe99SaghcI6IWT7UNkJw9aO9
++i9eo0Fj2MUqxpKbdb9noRDy2CnHWf7EIYZ1gznXPdwzSN4YCjV5d+Q9xtBaowT0j
++HPERs1ZuytCNNJTmhyqZ8q6uzMLoht4IqH/FBfpvgaeC5tBTnTT0rD5A/olXeimk
++kX4LxlEx5RAvpGB2zZVRGr6LobD9rVK91xuHYNIxxxfEGE8tCCWjp0+3ksri9SXx
++VHWBnbM9YaL32u3hxm8sYB/Yb8WSBavJCWJJqRStVRHM1koZlJmXNx2BX4vPo6iW
++RFEIPQsFZRLrtnCAiEhyT8bC2s/Njlu6ly9gtJZWSV46Q3ZjBL4q9sHKqZQ=
++-----END CERTIFICATE-----
+diff -r 9ddc63c039ba Lib/test/test_ssl.py
+--- a/Lib/test/test_ssl.py	Sun Aug 11 13:04:50 2013 +0300
++++ b/Lib/test/test_ssl.py	Sun Aug 11 18:13:17 2013 +0200
+@@ -25,6 +25,7 @@
+ HOST = test_support.HOST
+ CERTFILE = None
+ SVN_PYTHON_ORG_ROOT_CERT = None
++NULLBYTECERT = None
+ 
+ def handle_error(prefix):
+     exc_format = ' '.join(traceback.format_exception(*sys.exc_info()))
+@@ -123,6 +124,27 @@
+                           ('DNS', 'projects.forum.nokia.com'))
+                         )
+ 
++    def test_parse_cert_CVE_2013_4073(self):
++        p = ssl._ssl._test_decode_cert(NULLBYTECERT)
++        if test_support.verbose:
++            sys.stdout.write("\n" + pprint.pformat(p) + "\n")
++        subject = ((('countryName', 'US'),),
++                   (('stateOrProvinceName', 'Oregon'),),
++                   (('localityName', 'Beaverton'),),
++                   (('organizationName', 'Python Software Foundation'),),
++                   (('organizationalUnitName', 'Python Core Development'),),
++                   (('commonName', 'null.python.org\x00example.org'),),
++                   (('emailAddress', 'python-dev@python.org'),))
++        self.assertEqual(p['subject'], subject)
++        self.assertEqual(p['issuer'], subject)
++        self.assertEqual(p['subjectAltName'],
++                         (('DNS', 'altnull.python.org\x00example.com'),
++                         ('email', 'null@python.org\x00user@example.org'),
++                         ('URI', 'http://null.python.org\x00http://example.org'),
++                         ('IP Address', '192.0.2.1'),
++                         ('IP Address', '2001:DB8:0:0:0:0:0:1\n'))
++                        )
++
+     def test_DER_to_PEM(self):
+         with open(SVN_PYTHON_ORG_ROOT_CERT, 'r') as f:
+             pem = f.read()
+@@ -1360,7 +1382,7 @@
+ 
+ 
+ def test_main(verbose=False):
+-    global CERTFILE, SVN_PYTHON_ORG_ROOT_CERT, NOKIACERT
++    global CERTFILE, SVN_PYTHON_ORG_ROOT_CERT, NOKIACERT, NULLBYTECERT
+     CERTFILE = os.path.join(os.path.dirname(__file__) or os.curdir,
+                             "keycert.pem")
+     SVN_PYTHON_ORG_ROOT_CERT = os.path.join(
+@@ -1368,10 +1390,13 @@
+         "https_svn_python_org_root.pem")
+     NOKIACERT = os.path.join(os.path.dirname(__file__) or os.curdir,
+                              "nokia.pem")
++    NULLBYTECERT = os.path.join(os.path.dirname(__file__) or os.curdir,
++                                "nullbytecert.pem")
+ 
+     if (not os.path.exists(CERTFILE) or
+         not os.path.exists(SVN_PYTHON_ORG_ROOT_CERT) or
+-        not os.path.exists(NOKIACERT)):
++        not os.path.exists(NOKIACERT) or
++        not os.path.exists(NULLBYTECERT)):
+         raise test_support.TestFailed("Can't read certificate files!")
+ 
+     tests = [BasicTests, BasicSocketTests]
+diff -r 9ddc63c039ba Modules/_ssl.c
+--- a/Modules/_ssl.c	Sun Aug 11 13:04:50 2013 +0300
++++ b/Modules/_ssl.c	Sun Aug 11 18:13:17 2013 +0200
+@@ -741,8 +741,13 @@
+ 
+             /* get a rendering of each name in the set of names */
+ 
++            int gntype;
++            ASN1_STRING *as = NULL;
++
+             name = sk_GENERAL_NAME_value(names, j);
+-            if (name->type == GEN_DIRNAME) {
++            gntype = name-> type;
++            switch (gntype) {
++            case GEN_DIRNAME:
+ 
+                 /* we special-case DirName as a tuple of tuples of attributes */
+ 
+@@ -764,11 +769,61 @@
+                     goto fail;
+                 }
+                 PyTuple_SET_ITEM(t, 1, v);
++                break;
+ 
+-            } else {
++            case GEN_EMAIL:
++            case GEN_DNS:
++            case GEN_URI:
++                /* GENERAL_NAME_print() doesn't handle NUL bytes in ASN1_string
++                   correctly. */
++                t = PyTuple_New(2);
++                if (t == NULL)
++                    goto fail;
++                switch (gntype) {
++                case GEN_EMAIL:
++                    v = PyUnicode_FromString("email");
++                    as = name->d.rfc822Name;
++                    break;
++                case GEN_DNS:
++                    v = PyUnicode_FromString("DNS");
++                    as = name->d.dNSName;
++                    break;
++                case GEN_URI:
++                    v = PyUnicode_FromString("URI");
++                    as = name->d.uniformResourceIdentifier;
++                    break;
++                }
++                if (v == NULL) {
++                    Py_DECREF(t);
++                    goto fail;
++                }
++                PyTuple_SET_ITEM(t, 0, v);
++                v = PyString_FromStringAndSize((char *)ASN1_STRING_data(as),
++                                               ASN1_STRING_length(as));
++                if (v == NULL) {
++                    Py_DECREF(t);
++                    goto fail;
++                }
++                PyTuple_SET_ITEM(t, 1, v);
++                break;
+ 
++            default:
+                 /* for everything else, we use the OpenSSL print form */
+-
++                switch (gntype) {
++                    /* check for new general name type */
++                    case GEN_OTHERNAME:
++                    case GEN_X400:
++                    case GEN_EDIPARTY:
++                    case GEN_IPADD:
++                    case GEN_RID:
++                        break;
++                    default:
++                        if (PyErr_Warn(PyExc_RuntimeWarning,
++				       "Unknown general name type") == -1) {
++                            goto fail;
++                        }
++                        break;
++                }
+                 (void) BIO_reset(biobuf);
+                 GENERAL_NAME_print(biobuf, name);
+                 len = BIO_gets(biobuf, buf, sizeof(buf)-1);
+@@ -794,6 +849,7 @@
+                     goto fail;
+                 }
+                 PyTuple_SET_ITEM(t, 1, v);
++		break;
+             }
+ 
+             /* and add that rendering to the list */
--- python2.7-2.7.3.orig/debian/patches/CVE-2016-5699.diff
+++ python2.7-2.7.3/debian/patches/CVE-2016-5699.diff
@@ -0,0 +1,146 @@
+
+# HG changeset patch
+# User Serhiy Storchaka <storchaka@gmail.com>
+# Date 1426151571 -7200
+# Node ID 1c45047c51020d46246385949d5c02e026d47320
+# Parent  36bd5add973285cce9d3ec7e068bbb20c9080565
+Issue #22928: Disabled HTTP header injections in httplib.
+Original patch by Demian Brecht.
+
+diff --git a/Lib/httplib.py b/Lib/httplib.py
+--- a/Lib/httplib.py
++++ b/Lib/httplib.py
+@@ -68,6 +68,7 @@ Req-sent-unread-response       _CS_REQ_S
+ 
+ from array import array
+ import os
++import re
+ import socket
+ from sys import py3kwarning
+ from urlparse import urlsplit
+@@ -218,6 +219,34 @@ MAXAMOUNT = 1048576
+ # maximum amount of headers accepted
+ _MAXHEADERS = 100
+ 
++# Header name/value ABNF (http://tools.ietf.org/html/rfc7230#section-3.2)
++#
++# VCHAR          = %x21-7E
++# obs-text       = %x80-FF
++# header-field   = field-name ":" OWS field-value OWS
++# field-name     = token
++# field-value    = *( field-content / obs-fold )
++# field-content  = field-vchar [ 1*( SP / HTAB ) field-vchar ]
++# field-vchar    = VCHAR / obs-text
++#
++# obs-fold       = CRLF 1*( SP / HTAB )
++#                ; obsolete line folding
++#                ; see Section 3.2.4
++
++# token          = 1*tchar
++#
++# tchar          = "!" / "#" / "$" / "%" / "&" / "'" / "*"
++#                / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
++#                / DIGIT / ALPHA
++#                ; any VCHAR, except delimiters
++#
++# VCHAR defined in http://tools.ietf.org/html/rfc5234#appendix-B.1
++
++# the patterns for both name and value are more leniant than RFC
++# definitions to allow for backwards compatibility
++_is_legal_header_name = re.compile(r'\A[^:\s][^:\r\n]*\Z').match
++_is_illegal_header_value = re.compile(r'\n(?![ \t])|\r(?![ \t\n])').search
++
+ 
+ class HTTPMessage(mimetools.Message):
+ 
+@@ -983,7 +1012,16 @@ class HTTPConnection:
+         if self.__state != _CS_REQ_STARTED:
+             raise CannotSendHeader()
+ 
+-        hdr = '%s: %s' % (header, '\r\n\t'.join([str(v) for v in values]))
++        header = '%s' % header
++        if not _is_legal_header_name(header):
++            raise ValueError('Invalid header name %r' % (header,))
++
++        values = [str(v) for v in values]
++        for one_value in values:
++            if _is_illegal_header_value(one_value):
++                raise ValueError('Invalid header value %r' % (one_value,))
++
++        hdr = '%s: %s' % (header, '\r\n\t'.join(values))
+         self._output(hdr)
+ 
+     def endheaders(self, message_body=None):
+diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py
+--- a/Lib/test/test_httplib.py
++++ b/Lib/test/test_httplib.py
+@@ -145,6 +145,33 @@ class HeaderTests(TestCase):
+         conn.putheader('Content-length',42)
+         self.assertIn('Content-length: 42', conn._buffer)
+ 
++        conn.putheader('Foo', ' bar ')
++        self.assertIn(b'Foo:  bar ', conn._buffer)
++        conn.putheader('Bar', '\tbaz\t')
++        self.assertIn(b'Bar: \tbaz\t', conn._buffer)
++        conn.putheader('Authorization', 'Bearer mytoken')
++        self.assertIn(b'Authorization: Bearer mytoken', conn._buffer)
++        conn.putheader('IterHeader', 'IterA', 'IterB')
++        self.assertIn(b'IterHeader: IterA\r\n\tIterB', conn._buffer)
++        conn.putheader('LatinHeader', b'\xFF')
++        self.assertIn(b'LatinHeader: \xFF', conn._buffer)
++        conn.putheader('Utf8Header', b'\xc3\x80')
++        self.assertIn(b'Utf8Header: \xc3\x80', conn._buffer)
++        conn.putheader('C1-Control', b'next\x85line')
++        self.assertIn(b'C1-Control: next\x85line', conn._buffer)
++        conn.putheader('Embedded-Fold-Space', 'is\r\n allowed')
++        self.assertIn(b'Embedded-Fold-Space: is\r\n allowed', conn._buffer)
++        conn.putheader('Embedded-Fold-Tab', 'is\r\n\tallowed')
++        self.assertIn(b'Embedded-Fold-Tab: is\r\n\tallowed', conn._buffer)
++        conn.putheader('Key Space', 'value')
++        self.assertIn(b'Key Space: value', conn._buffer)
++        conn.putheader('KeySpace ', 'value')
++        self.assertIn(b'KeySpace : value', conn._buffer)
++        conn.putheader(b'Nonbreak\xa0Space', 'value')
++        self.assertIn(b'Nonbreak\xa0Space: value', conn._buffer)
++        conn.putheader(b'\xa0NonbreakSpace', 'value')
++        self.assertIn(b'\xa0NonbreakSpace: value', conn._buffer)
++
+     def test_ipv6host_header(self):
+         # Default host header on IPv6 transaction should wrapped by [] if
+         # its actual IPv6 address
+@@ -174,6 +201,35 @@ class HeaderTests(TestCase):
+         self.assertEqual(resp.getheader('First'), 'val')
+         self.assertEqual(resp.getheader('Second'), 'val')
+ 
++    def test_invalid_headers(self):
++        conn = httplib.HTTPConnection('example.com')
++        conn.sock = FakeSocket('')
++        conn.putrequest('GET', '/')
++
++        # http://tools.ietf.org/html/rfc7230#section-3.2.4, whitespace is no
++        # longer allowed in header names
++        cases = (
++            (b'Invalid\r\nName', b'ValidValue'),
++            (b'Invalid\rName', b'ValidValue'),
++            (b'Invalid\nName', b'ValidValue'),
++            (b'\r\nInvalidName', b'ValidValue'),
++            (b'\rInvalidName', b'ValidValue'),
++            (b'\nInvalidName', b'ValidValue'),
++            (b' InvalidName', b'ValidValue'),
++            (b'\tInvalidName', b'ValidValue'),
++            (b'Invalid:Name', b'ValidValue'),
++            (b':InvalidName', b'ValidValue'),
++            (b'ValidName', b'Invalid\r\nValue'),
++            (b'ValidName', b'Invalid\rValue'),
++            (b'ValidName', b'Invalid\nValue'),
++            (b'ValidName', b'InvalidValue\r\n'),
++            (b'ValidName', b'InvalidValue\r'),
++            (b'ValidName', b'InvalidValue\n'),
++        )
++        for name, value in cases:
++            with self.assertRaisesRegexp(ValueError, 'Invalid header'):
++                conn.putheader(name, value)
++
+ 
+ class BasicTest(TestCase):
+     def test_status_lines(self):
--- python2.7-2.7.3.orig/debian/patches/distutils-sysconfig.diff
+++ python2.7-2.7.3/debian/patches/distutils-sysconfig.diff
@@ -0,0 +1,33 @@
+# DP: Allow setting BASECFLAGS, OPT and EXTRA_LDFLAGS (like, CC, CXX, CPP,
+# DP: CFLAGS, CPPFLAGS, CCSHARED, LDSHARED) from the environment.
+
+Index: b/Lib/distutils/sysconfig.py
+===================================================================
+--- a/Lib/distutils/sysconfig.py
++++ b/Lib/distutils/sysconfig.py
+@@ -153,8 +153,8 @@
+     varies across Unices and is stored in Python's Makefile.
+     """
+     if compiler.compiler_type == "unix":
+-        (cc, cxx, opt, cflags, ccshared, ldshared, so_ext, ar, ar_flags) = \
+-            get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS',
++        (cc, cxx, opt, cflags, extra_cflags, basecflags, ccshared, ldshared, so_ext, ar, ar_flags) = \
++            get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS', 'EXTRA_CFLAGS', 'BASECFLAGS',
+                             'CCSHARED', 'LDSHARED', 'SO', 'AR',
+                             'ARFLAGS')
+ 
+@@ -200,8 +200,13 @@
+             cpp = cc + " -E"           # not always
+         if 'LDFLAGS' in os.environ:
+             ldshared = ldshared + ' ' + os.environ['LDFLAGS']
++        if 'BASECFLAGS' in os.environ:
++            basecflags = os.environ['BASECFLAGS']
++        if 'OPT' in os.environ:
++            opt = os.environ['OPT']
++        cflags = ' '.join(str(x) for x in (basecflags, opt, extra_cflags) if x)
+         if 'CFLAGS' in os.environ:
+-            cflags = opt + ' ' + os.environ['CFLAGS']
++            cflags = ' '.join(str(x) for x in (basecflags, opt, os.environ['CFLAGS'], extra_cflags) if x)
+             ldshared = ldshared + ' ' + os.environ['CFLAGS']
+         if 'CPPFLAGS' in os.environ:
+             cpp = cpp + ' ' + os.environ['CPPFLAGS']
--- python2.7-2.7.3.orig/debian/patches/CVE-2014-1912.diff
+++ python2.7-2.7.3/debian/patches/CVE-2014-1912.diff
@@ -0,0 +1,43 @@
+
+# HG changeset patch
+# User Benjamin Peterson <benjamin@python.org>
+# Date 1389671978 18000
+# Node ID 87673659d8f7ba1623cd4914f09ad3d2ade034e9
+# Parent  2631d33ee7fbd5f0288931ef37872218d511d2e8
+complain when nbytes > buflen to fix possible buffer overflow (closes #20246)
+
+diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
+--- a/Lib/test/test_socket.py
++++ b/Lib/test/test_socket.py
+@@ -1620,6 +1620,16 @@ class BufferIOTest(SocketConnectedTest):
+ 
+     _testRecvFromIntoMemoryview = _testRecvFromIntoArray
+ 
++    def testRecvFromIntoSmallBuffer(self):
++        # See issue #20246.
++        buf = bytearray(8)
++        self.assertRaises(ValueError, self.cli_conn.recvfrom_into, buf, 1024)
++
++    def _testRecvFromIntoSmallBuffer(self):
++        with test_support.check_py3k_warnings():
++            buf = buffer(MSG*2048)
++        self.serv_conn.send(buf)
++
+ 
+ TIPC_STYPE = 2000
+ TIPC_LOWER = 200
+diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
+--- a/Modules/socketmodule.c
++++ b/Modules/socketmodule.c
+@@ -2742,6 +2742,10 @@ sock_recvfrom_into(PySocketSockObject *s
+     if (recvlen == 0) {
+         /* If nbytes was not specified, use the buffer's length */
+         recvlen = buflen;
++    } else if (recvlen > buflen) {
++        PyErr_SetString(PyExc_ValueError,
++                        "nbytes is greater than the length of the buffer");
++        goto error;
+     }
+ 
+     readlen = sock_recvfrom_guts(s, buf.buf, recvlen, flags, &addr);
+
--- python2.7-2.7.3.orig/debian/patches/plat-linux2_hppa.diff
+++ python2.7-2.7.3/debian/patches/plat-linux2_hppa.diff
@@ -0,0 +1,72 @@
+Index: Lib/plat-linux2/IN.py
+===================================================================
+--- ./Lib/plat-linux2/IN.py	(Revision 77754)
++++ ./Lib/plat-linux2/IN.py	(Arbeitskopie)
+@@ -442,37 +442,37 @@
+ SIOCGPGRP = 0x8904
+ SIOCATMARK = 0x8905
+ SIOCGSTAMP = 0x8906
+-SOL_SOCKET = 1
+-SO_DEBUG = 1
+-SO_REUSEADDR = 2
+-SO_TYPE = 3
+-SO_ERROR = 4
+-SO_DONTROUTE = 5
+-SO_BROADCAST = 6
+-SO_SNDBUF = 7
+-SO_RCVBUF = 8
+-SO_KEEPALIVE = 9
+-SO_OOBINLINE = 10
+-SO_NO_CHECK = 11
+-SO_PRIORITY = 12
+-SO_LINGER = 13
+-SO_BSDCOMPAT = 14
+-SO_PASSCRED = 16
+-SO_PEERCRED = 17
+-SO_RCVLOWAT = 18
+-SO_SNDLOWAT = 19
+-SO_RCVTIMEO = 20
+-SO_SNDTIMEO = 21
+-SO_SECURITY_AUTHENTICATION = 22
+-SO_SECURITY_ENCRYPTION_TRANSPORT = 23
+-SO_SECURITY_ENCRYPTION_NETWORK = 24
+-SO_BINDTODEVICE = 25
+-SO_ATTACH_FILTER = 26
+-SO_DETACH_FILTER = 27
+-SO_PEERNAME = 28
+-SO_TIMESTAMP = 29
++SOL_SOCKET = 0xffff
++SO_DEBUG = 0x0001
++SO_REUSEADDR = 0x0004
++SO_TYPE = 0x1008
++SO_ERROR = 0x1007
++SO_DONTROUTE = 0x0010
++SO_BROADCAST = 0x0020
++SO_SNDBUF = 0x1001
++SO_RCVBUF = 0x1002
++SO_KEEPALIVE = 0x0008
++SO_OOBINLINE = 0x0100
++SO_NO_CHECK = 0x400b
++SO_PRIORITY = 0x400c
++SO_LINGER = 0x0080
++SO_BSDCOMPAT = 0x400e
++SO_PASSCRED = 0x4010
++SO_PEERCRED = 0x4011
++SO_RCVLOWAT = 0x1004
++SO_SNDLOWAT = 0x1003
++SO_RCVTIMEO = 0x1006
++SO_SNDTIMEO = 0x1005
++SO_SECURITY_AUTHENTICATION = 0x4016
++SO_SECURITY_ENCRYPTION_TRANSPORT = 0x4017
++SO_SECURITY_ENCRYPTION_NETWORK = 0x4018
++SO_BINDTODEVICE = 0x4019
++SO_ATTACH_FILTER = 0x401a
++SO_DETACH_FILTER = 0x401b
++SO_PEERNAME = 0x2000
++SO_TIMESTAMP = 0x4012
+ SCM_TIMESTAMP = SO_TIMESTAMP
+-SO_ACCEPTCONN = 30
++SO_ACCEPTCONN = 0x401c
+ SOCK_STREAM = 1
+ SOCK_DGRAM = 2
+ SOCK_RAW = 3
--- python2.7-2.7.3.orig/debian/patches/plat-linux2_alpha.diff
+++ python2.7-2.7.3/debian/patches/plat-linux2_alpha.diff
@@ -0,0 +1,73 @@
+Index: Lib/plat-linux2/IN.py
+===================================================================
+--- ./Lib/plat-linux2/IN.py	(Revision 77754)
++++ ./Lib/plat-linux2/IN.py	(Arbeitskopie)
+@@ -436,43 +436,43 @@
+ # Included from asm/socket.h
+ 
+ # Included from asm/sockios.h
+-FIOSETOWN = 0x8901
+-SIOCSPGRP = 0x8902
+-FIOGETOWN = 0x8903
+-SIOCGPGRP = 0x8904
+-SIOCATMARK = 0x8905
++FIOSETOWN = 0x8004667c
++SIOCSPGRP = 0x80047308
++FIOGETOWN = 0x4004667b
++SIOCGPGRP = 0x40047309
++SIOCATMARK = 0x40047307
+ SIOCGSTAMP = 0x8906
+-SOL_SOCKET = 1
+-SO_DEBUG = 1
+-SO_REUSEADDR = 2
+-SO_TYPE = 3
+-SO_ERROR = 4
+-SO_DONTROUTE = 5
+-SO_BROADCAST = 6
+-SO_SNDBUF = 7
+-SO_RCVBUF = 8
+-SO_KEEPALIVE = 9
+-SO_OOBINLINE = 10
++SOL_SOCKET = 0xffff
++SO_DEBUG = 0x0001
++SO_REUSEADDR = 0x0004
++SO_TYPE = 0x1008
++SO_ERROR = 0x1007
++SO_DONTROUTE = 0x0010
++SO_BROADCAST = 0x0020
++SO_SNDBUF = 0x1001
++SO_RCVBUF = 0x1002
++SO_KEEPALIVE = 0x0008
++SO_OOBINLINE = 0x0100
+ SO_NO_CHECK = 11
+ SO_PRIORITY = 12
+-SO_LINGER = 13
++SO_LINGER = 0x0080
+ SO_BSDCOMPAT = 14
+ SO_PASSCRED = 16
+ SO_PEERCRED = 17
+-SO_RCVLOWAT = 18
+-SO_SNDLOWAT = 19
+-SO_RCVTIMEO = 20
+-SO_SNDTIMEO = 21
+-SO_SECURITY_AUTHENTICATION = 22
+-SO_SECURITY_ENCRYPTION_TRANSPORT = 23
+-SO_SECURITY_ENCRYPTION_NETWORK = 24
++SO_RCVLOWAT = 0x1010
++SO_SNDLOWAT = 0x1011
++SO_RCVTIMEO = 0x1012
++SO_SNDTIMEO = 0x1013
++SO_SECURITY_AUTHENTICATION = 19
++SO_SECURITY_ENCRYPTION_TRANSPORT = 20
++SO_SECURITY_ENCRYPTION_NETWORK = 21
+ SO_BINDTODEVICE = 25
+ SO_ATTACH_FILTER = 26
+ SO_DETACH_FILTER = 27
+ SO_PEERNAME = 28
+ SO_TIMESTAMP = 29
+ SCM_TIMESTAMP = SO_TIMESTAMP
+-SO_ACCEPTCONN = 30
++SO_ACCEPTCONN = 0x1014
+ SOCK_STREAM = 1
+ SOCK_DGRAM = 2
+ SOCK_RAW = 3
--- python2.7-2.7.3.orig/debian/patches/CVE-2016-5636.diff
+++ python2.7-2.7.3/debian/patches/CVE-2016-5636.diff
@@ -0,0 +1,24 @@
+
+# HG changeset patch
+# User Benjamin Peterson <benjamin@python.org>
+# Date 1453357424 28800
+# Node ID 985fc64c60d6adffd1138b6cc46df388ca91ca5d
+# Parent  7ec954b9fc54448a35b56d271340ba109eb381b9
+prevent buffer overflow in get_data (closes #26171)
+
+diff --git a/Modules/zipimport.c b/Modules/zipimport.c
+--- a/Modules/zipimport.c
++++ b/Modules/zipimport.c
+@@ -895,6 +895,11 @@ get_data(char *archive, PyObject *toc_en
+         PyMarshal_ReadShortFromFile(fp);        /* local header size */
+     file_offset += l;           /* Start of file data */
+ 
++    if (data_size > LONG_MAX - 1) {
++        fclose(fp);
++        PyErr_NoMemory();
++        return NULL;
++    }
+     raw_data = PyString_FromStringAndSize((char *)NULL, compress == 0 ?
+                                           data_size : data_size + 1);
+     if (raw_data == NULL) {
+
--- python2.7-2.7.3.orig/debian/patches/setup-modules-ssl.diff
+++ python2.7-2.7.3/debian/patches/setup-modules-ssl.diff
@@ -0,0 +1,24 @@
+# DP: Modules/Setup.dist: patch to build _hashlib and _ssl extensions statically
+
+--- a/Modules/Setup.dist
++++ b/Modules/Setup.dist
+@@ -211,10 +211,7 @@
+ 
+ # Socket module helper for SSL support; you must comment out the other
+ # socket line above, and possibly edit the SSL variable:
+-#SSL=/usr/local/ssl
+-#_ssl _ssl.c \
+-#	-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
+-#	-L$(SSL)/lib -lssl -lcrypto
++#_ssl _ssl.c -lssl -lcrypto
+ 
+ # The crypt module is now disabled by default because it breaks builds
+ # on many systems (where -lcrypt is needed), e.g. Linux (I believe).
+@@ -257,6 +254,7 @@
+ #_sha256 sha256module.c
+ #_sha512 sha512module.c
+ 
++#_hashlib _hashopenssl.c -lssl -lcrypto
+ 
+ # SGI IRIX specific modules -- off by default.
+ 
--- python2.7-2.7.3.orig/debian/patches/makesetup-bashism.diff
+++ python2.7-2.7.3/debian/patches/makesetup-bashism.diff
@@ -0,0 +1,13 @@
+# DP: Fix bashism in makesetup shell script
+
+--- a/Modules/makesetup
++++ b/Modules/makesetup
+@@ -281,7 +281,7 @@
+ 	-)	;;
+ 	*)	sedf="@sed.in.$$"
+ 		trap 'rm -f $sedf' 0 1 2 3
+-		echo "1i\\" >$sedf
++		printf "1i\\" >$sedf
+ 		str="# Generated automatically from $makepre by makesetup."
+ 		echo "$str" >>$sedf
+ 		echo "s%_MODOBJS_%$OBJS%" >>$sedf
--- python2.7-2.7.3.orig/debian/patches/doc-nodownload.diff
+++ python2.7-2.7.3/debian/patches/doc-nodownload.diff
@@ -0,0 +1,13 @@
+# DP: Don't try to download documentation tools
+
+--- a/Doc/Makefile
++++ b/Doc/Makefile
+@@ -57,7 +57,7 @@
+ 
+ update: clean checkout
+ 
+-build: checkout
++build:
+ 	mkdir -p build/$(BUILDER) build/doctrees
+ 	$(PYTHON) tools/sphinx-build.py $(ALLSPHINXOPTS)
+ 	@echo
--- python2.7-2.7.3.orig/debian/patches/disable-ssl-cert-tests.diff
+++ python2.7-2.7.3/debian/patches/disable-ssl-cert-tests.diff
@@ -0,0 +1,75 @@
+--- a/Lib/test/test_ssl.py
++++ b/Lib/test/test_ssl.py
+@@ -231,59 +231,6 @@
+             finally:
+                 s.close()
+ 
+-            # this should succeed because we specify the root cert
+-            s = ssl.wrap_socket(socket.socket(socket.AF_INET),
+-                                cert_reqs=ssl.CERT_REQUIRED,
+-                                ca_certs=SVN_PYTHON_ORG_ROOT_CERT)
+-            try:
+-                s.connect(("svn.python.org", 443))
+-            finally:
+-                s.close()
+-
+-    def test_connect_ex(self):
+-        # Issue #11326: check connect_ex() implementation
+-        with test_support.transient_internet("svn.python.org"):
+-            s = ssl.wrap_socket(socket.socket(socket.AF_INET),
+-                                cert_reqs=ssl.CERT_REQUIRED,
+-                                ca_certs=SVN_PYTHON_ORG_ROOT_CERT)
+-            try:
+-                self.assertEqual(0, s.connect_ex(("svn.python.org", 443)))
+-                self.assertTrue(s.getpeercert())
+-            finally:
+-                s.close()
+-
+-    def test_non_blocking_connect_ex(self):
+-        # Issue #11326: non-blocking connect_ex() should allow handshake
+-        # to proceed after the socket gets ready.
+-        with test_support.transient_internet("svn.python.org"):
+-            s = ssl.wrap_socket(socket.socket(socket.AF_INET),
+-                                cert_reqs=ssl.CERT_REQUIRED,
+-                                ca_certs=SVN_PYTHON_ORG_ROOT_CERT,
+-                                do_handshake_on_connect=False)
+-            try:
+-                s.setblocking(False)
+-                rc = s.connect_ex(('svn.python.org', 443))
+-                # EWOULDBLOCK under Windows, EINPROGRESS elsewhere
+-                self.assertIn(rc, (0, errno.EINPROGRESS, errno.EWOULDBLOCK))
+-                # Wait for connect to finish
+-                select.select([], [s], [], 5.0)
+-                # Non-blocking handshake
+-                while True:
+-                    try:
+-                        s.do_handshake()
+-                        break
+-                    except ssl.SSLError as err:
+-                        if err.args[0] == ssl.SSL_ERROR_WANT_READ:
+-                            select.select([s], [], [], 5.0)
+-                        elif err.args[0] == ssl.SSL_ERROR_WANT_WRITE:
+-                            select.select([], [s], [], 5.0)
+-                        else:
+-                            raise
+-                # SSL established
+-                self.assertTrue(s.getpeercert())
+-            finally:
+-                s.close()
+-
+     @unittest.skipIf(os.name == "nt", "Can't use a socket as a file under Windows")
+     def test_makefile_close(self):
+         # Issue #5238: creating a file-like object with makefile() shouldn't
+@@ -343,12 +290,6 @@
+             else:
+                 self.fail("Got server certificate %s for svn.python.org!" % pem)
+ 
+-            pem = ssl.get_server_certificate(("svn.python.org", 443), ca_certs=SVN_PYTHON_ORG_ROOT_CERT)
+-            if not pem:
+-                self.fail("No server certificate on svn.python.org:443!")
+-            if test_support.verbose:
+-                sys.stdout.write("\nVerified certificate for svn.python.org:443 is\n%s\n" % pem)
+-
+     def test_algorithms(self):
+         # Issue #8484: all algorithms should be available when verifying a
+         # certificate.
--- python2.7-2.7.3.orig/debian/patches/platform-lsbrelease.diff
+++ python2.7-2.7.3/debian/patches/platform-lsbrelease.diff
@@ -0,0 +1,41 @@
+# DP: Use /etc/lsb-release to identify the platform.
+
+--- a/Lib/platform.py
++++ b/Lib/platform.py
+@@ -288,6 +288,10 @@
+             id = l[1]
+     return '', version, id
+ 
++_distributor_id_file_re = re.compile("(?:DISTRIB_ID\s*=)\s*(.*)", re.I)
++_release_file_re = re.compile("(?:DISTRIB_RELEASE\s*=)\s*(.*)", re.I)
++_codename_file_re = re.compile("(?:DISTRIB_CODENAME\s*=)\s*(.*)", re.I)
++
+ def linux_distribution(distname='', version='', id='',
+ 
+                        supported_dists=_supported_dists,
+@@ -312,6 +316,25 @@
+         args given as parameters.
+ 
+     """
++    # check for the Debian/Ubuntu /etc/lsb-release file first, needed so
++    # that the distribution doesn't get identified as Debian.
++    try:
++        etclsbrel = open("/etc/lsb-release", "rU")
++        for line in etclsbrel:
++            m = _distributor_id_file_re.search(line)
++            if m:
++                _u_distname = m.group(1).strip()
++            m = _release_file_re.search(line)
++            if m:
++                _u_version = m.group(1).strip()
++            m = _codename_file_re.search(line)
++            if m:
++                _u_id = m.group(1).strip()
++        if _u_distname and _u_version:
++            return (_u_distname, _u_version, _u_id)
++    except (EnvironmentError, UnboundLocalError):
++            pass
++
+     try:
+         etc = os.listdir('/etc')
+     except os.error:
--- python2.7-2.7.3.orig/debian/patches/issue15847.diff
+++ python2.7-2.7.3/debian/patches/issue15847.diff
@@ -0,0 +1,47 @@
+# DP: Fix issue #15847: allow args to be a tuple in parse_args.
+
+diff -r edbf37ace03c -r a2147bbf7868 Lib/argparse.py
+--- a/Lib/argparse.py	Fri Sep 07 23:49:07 2012 +0200
++++ b/Lib/argparse.py	Sat Sep 08 12:15:25 2012 -0400
+@@ -1692,9 +1692,12 @@
+         return args
+ 
+     def parse_known_args(self, args=None, namespace=None):
+-        # args default to the system args
+         if args is None:
++            # args default to the system args
+             args = _sys.argv[1:]
++        else:
++            # make sure that args are mutable
++            args = list(args)
+ 
+         # default Namespace built from parser defaults
+         if namespace is None:
+diff -r edbf37ace03c -r a2147bbf7868 Lib/test/test_argparse.py
+--- a/Lib/test/test_argparse.py	Fri Sep 07 23:49:07 2012 +0200
++++ b/Lib/test/test_argparse.py	Sat Sep 08 12:15:25 2012 -0400
+@@ -4486,6 +4486,24 @@
+ 
+ class TestParseKnownArgs(TestCase):
+ 
++    def test_arguments_tuple(self):
++        parser = argparse.ArgumentParser()
++        parser.parse_args(())
++
++    def test_arguments_list(self):
++        parser = argparse.ArgumentParser()
++        parser.parse_args([])
++
++    def test_arguments_tuple_positional(self):
++        parser = argparse.ArgumentParser()
++        parser.add_argument('x')
++        parser.parse_args(('x',))
++
++    def test_arguments_list_positional(self):
++        parser = argparse.ArgumentParser()
++        parser.add_argument('x')
++        parser.parse_args(['x'])
++
+     def test_optionals(self):
+         parser = argparse.ArgumentParser()
+         parser.add_argument('--foo')
--- python2.7-2.7.3.orig/debian/patches/disable-utimes.diff
+++ python2.7-2.7.3/debian/patches/disable-utimes.diff
@@ -0,0 +1,13 @@
+# DP: disable check for utimes function, which is broken in glibc-2.3.2
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -2698,7 +2698,7 @@
+  setsid setpgid setpgrp setuid setvbuf snprintf \
+  sigaction siginterrupt sigrelse strftime \
+  sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
+- truncate uname unsetenv utimes waitpid wait3 wait4 wcscoll _getpty)
++ truncate uname unsetenv waitpid wait3 wait4 wcscoll _getpty)
+ 
+ # For some functions, having a definition is not sufficient, since
+ # we want to take their address.
--- python2.7-2.7.3.orig/debian/patches/lto-link-flags.diff
+++ python2.7-2.7.3/debian/patches/lto-link-flags.diff
@@ -0,0 +1,22 @@
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -114,8 +114,8 @@
+ 
+ # Symbols used for using shared libraries
+ SO=		@SO@
+-LDSHARED=	@LDSHARED@ $(LDFLAGS)
+-BLDSHARED=	@BLDSHARED@ $(LDFLAGS)
++LDSHARED=	@LDSHARED@ $(PY_LDFLAGS)
++BLDSHARED=	@BLDSHARED@ $(PY_LDFLAGS) $(PY_CFLAGS)
+ LDCXXSHARED=	@LDCXXSHARED@
+ DESTSHARED=	$(BINLIBDEST)/lib-dynload
+ 
+@@ -404,7 +404,7 @@
+ 
+ # Build the interpreter
+ $(BUILDPYTHON):	Modules/python.o $(LIBRARY) $(LDLIBRARY)
+-		$(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ \
++		$(LINKCC) $(PY_LDFLAGS) $(PY_CFLAGS) $(LINKFORSHARED) -o $@ \
+ 			Modules/python.o \
+ 			-Wl,--whole-archive $(BLDLIBRARY) -Wl,--no-whole-archive $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
+ 
--- python2.7-2.7.3.orig/debian/patches/issue9374-followup.diff
+++ python2.7-2.7.3/debian/patches/issue9374-followup.diff
@@ -0,0 +1,30 @@
+# DP: Follwup for issue #9374. Restore the removed lists of the urlparse module.
+
+# HG changeset patch
+# User Georg Brandl <georg@python.org>
+# Date 1345825048 -7200
+# Node ID a434812109641df2c2af33afa030d8d06eef693c
+# Parent  787ed9b03ef9b8e26638b28ec55330a871e76495
+Closes #9374: add back now-unused module attributes; removing them is a backward compatibility issue, since they have a public-seeming name.
+
+diff --git a/Lib/urlparse.py b/Lib/urlparse.py
+--- a/Lib/urlparse.py
++++ b/Lib/urlparse.py
+@@ -44,6 +44,16 @@ uses_params = ['ftp', 'hdl', 'prospero',
+                'https', 'shttp', 'rtsp', 'rtspu', 'sip', 'sips',
+                'mms', '', 'sftp']
+ 
++# These are not actually used anymore, but should stay for backwards
++# compatibility.  (They are undocumented, but have a public-looking name.)
++non_hierarchical = ['gopher', 'hdl', 'mailto', 'news',
++                    'telnet', 'wais', 'imap', 'snews', 'sip', 'sips']
++uses_query = ['http', 'wais', 'imap', 'https', 'shttp', 'mms',
++              'gopher', 'rtsp', 'rtspu', 'sip', 'sips', '']
++uses_fragment = ['ftp', 'hdl', 'http', 'gopher', 'news',
++                 'nntp', 'wais', 'https', 'shttp', 'snews',
++                 'file', 'prospero', '']
++
+ # Characters valid in scheme names
+ scheme_chars = ('abcdefghijklmnopqrstuvwxyz'
+                 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+
--- python2.7-2.7.3.orig/debian/patches/site-builddir.diff
+++ python2.7-2.7.3/debian/patches/site-builddir.diff
@@ -0,0 +1,32 @@
+--- site.py~	2010-06-29 00:20:33.000000000 +0200
++++ site.py	2010-06-29 00:26:17.440243273 +0200
+@@ -115,19 +115,6 @@
+     sys.path[:] = L
+     return known_paths
+ 
+-# XXX This should not be part of site.py, since it is needed even when
+-# using the -S option for Python.  See http://www.python.org/sf/586680
+-def addbuilddir():
+-    """Append ./build/lib.<platform> in case we're running in the build dir
+-    (especially for Guido :-)"""
+-    from sysconfig import get_platform
+-    s = "build/lib.%s-%.3s" % (get_platform(), sys.version)
+-    if hasattr(sys, 'gettotalrefcount'):
+-        s += '-pydebug'
+-    s = os.path.join(os.path.dirname(sys.path.pop()), s)
+-    sys.path.append(s)
+-
+-
+ def _init_pathinfo():
+     """Return a set containing all existing directory entries from sys.path"""
+     d = set()
+@@ -538,9 +525,6 @@
+ 
+     abs__file__()
+     known_paths = removeduppaths()
+-    if (os.name == "posix" and sys.path and
+-        os.path.basename(sys.path[-1]) == "Modules"):
+-        addbuilddir()
+     if ENABLE_USER_SITE is None:
+         ENABLE_USER_SITE = check_enableusersite()
+     known_paths = addusersitepackages(known_paths)
--- python2.7-2.7.3.orig/debian/patches/setup-modules.dpatch
+++ python2.7-2.7.3/debian/patches/setup-modules.dpatch
@@ -0,0 +1,75 @@
+#! /bin/sh -e
+
+# DP: Modules/Setup.dist: patches to build some extensions statically
+
+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
+        ;;
+    -unpatch)
+        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
+        ;;
+    *)
+	echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+        exit 1
+esac
+exit 0
+
+--- Modules/_elementtree.c~	2008-11-27 10:01:33.000000000 +0100
++++ Modules/_elementtree.c	2008-11-27 10:03:30.000000000 +0100
+@@ -1837,7 +1837,10 @@
+ static struct PyExpat_CAPI* expat_capi;
+ #define EXPAT(func) (expat_capi->func)
+ #else
+-#define EXPAT(func) (XML_##func)
++#define EXPAT(func) (PyExpat_XML_##func)
++#define PyExpat_XML_GetErrorLineNumber   PyExpat_XML_GetCurrentLineNumber
++#define PyExpat_XML_GetErrorColumnNumber PyExpat_XML_GetCurrentColumnNumber
++#define PyExpat_XML_GetErrorByteIndex    PyExpat_XML_GetCurrentByteIndex
+ #endif
+ 
+ typedef struct {
+--- Modules/Setup.dist~	2008-11-27 10:59:37.000000000 +0100
++++ Modules/Setup.dist	2008-11-27 11:00:26.000000000 +0100
+@@ -165,7 +165,7 @@
+ #itertools itertoolsmodule.c	# Functions creating iterators for efficient looping 
+ #atexit atexitmodule.c      # Register functions to be run at interpreter-shutdown
+ #_functools _functoolsmodule.c	# Tools for working with functions and callable objects
+-#_elementtree -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI _elementtree.c	# elementtree accelerator
++#_elementtree -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H _elementtree.c	# elementtree accelerator
+ #_pickle _pickle.c	# pickle accelerator
+ #datetime datetimemodule.c	# date/time type
+ #_bisect _bisectmodule.c	# Bisection algorithms
+@@ -257,6 +257,7 @@
+ #_sha256 sha256module.c
+ #_sha512 sha512module.c
+ 
++#_hashlib _hashopenssl.c -lssl -lcrypto
+ 
+ # SGI IRIX specific modules -- off by default.
+ 
+@@ -341,6 +341,7 @@
+ #DBLIB=$(DB)/lib
+ #_bsddb _bsddb.c -I$(DBINC) -L$(DBLIB) -ldb-$(DBLIBVER)
+ 
++#_ctypes _ctypes/_ctypes.c _ctypes/callbacks.c _ctypes/callproc.c _ctypes/stgdict.c _ctypes/cfield.c _ctypes/malloc_closure.c -Wl,-Bstatic -lffi -Wl,-Bdynamic
+ 
+ # Helper module for various ascii-encoders
+ #binascii binascii.c
+@@ -382,7 +382,7 @@
+ #
+ # More information on Expat can be found at www.libexpat.org.
+ #
+-#pyexpat expat/xmlparse.c expat/xmlrole.c expat/xmltok.c pyexpat.c -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI
++#pyexpat expat/xmlparse.c expat/xmlrole.c expat/xmltok.c pyexpat.c -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H
+ 
+ # Hye-Shik Chang's CJKCodecs
+ 
--- python2.7-2.7.3.orig/debian/patches/deb-setup.diff
+++ python2.7-2.7.3/debian/patches/deb-setup.diff
@@ -0,0 +1,17 @@
+# DP: Don't include /usr/local/include and /usr/local/lib as gcc search paths
+
+--- a/setup.py
++++ b/setup.py
+@@ -368,9 +368,9 @@
+             os.unlink(tmpfile)
+ 
+     def detect_modules(self):
+-        # Ensure that /usr/local is always used
+-        add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
+-        add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
++        # On Debian /usr/local is always used, so we don't include it twice
++        #add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
++        #add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
+         self.add_multiarch_paths()
+ 
+         # Add paths specified in the environment variables LDFLAGS and
--- python2.7-2.7.3.orig/debian/patches/no-large-file-support.diff
+++ python2.7-2.7.3/debian/patches/no-large-file-support.diff
@@ -0,0 +1,14 @@
+# DP: disable large file support for GNU/Hurd
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -1434,6 +1434,9 @@
+   use_lfs=no
+ fi
+ 
++# Don't use largefile support anyway.
++use_lfs=no
++
+ if test "$use_lfs" = "yes"; then
+ # Two defines needed to enable largefile support on various platforms
+ # These may affect some typedefs
--- python2.7-2.7.3.orig/debian/patches/sqlite-rpath.diff
+++ python2.7-2.7.3/debian/patches/sqlite-rpath.diff
@@ -0,0 +1,10 @@
+--- a/setup.py
++++ b/setup.py
+@@ -1106,7 +1106,6 @@
+                                   include_dirs=["Modules/_sqlite",
+                                                 sqlite_incdir],
+                                   library_dirs=sqlite_libdir,
+-                                  runtime_library_dirs=sqlite_libdir,
+                                   extra_link_args=sqlite_extra_link_args,
+                                   libraries=["sqlite3",]))
+         else:
--- python2.7-2.7.3.orig/debian/patches/sysconfigdata.diff
+++ python2.7-2.7.3/debian/patches/sysconfigdata.diff
@@ -0,0 +1,91 @@
+Index: b/Lib/sysconfig.py
+===================================================================
+--- a/Lib/sysconfig.py
++++ b/Lib/sysconfig.py
+@@ -330,9 +330,10 @@
+         return os.path.join(_PROJECT_BASE, "Makefile")
+     return os.path.join(get_path('platstdlib').replace("/usr/local","/usr",1), "config" + (sys.pydebug and "_d" or ""), "Makefile")
+ 
+-
+-def _init_posix(vars):
+-    """Initialize the module as appropriate for POSIX systems."""
++def _generate_posix_vars():
++    """Generate the Python module containing build-time variables."""
++    import pprint
++    vars = {}
+     # load the installed Makefile:
+     makefile = _get_makefile_filename()
+     try:
+@@ -360,6 +361,19 @@
+     if _PYTHON_BUILD:
+         vars['LDSHARED'] = vars['BLDSHARED']
+ 
++    destfile = '_sysconfigdata.py'
++    with open(destfile, 'w') as f:
++        f.write('# system configuration generated and used by'
++                ' the sysconfig module\n')
++        f.write('build_time_vars = ')
++        pprint.pprint(vars, stream=f)
++
++def _init_posix(vars):
++    """Initialize the module as appropriate for POSIX systems."""
++    # _sysconfigdata is generated at build time, see _generate_posix_vars()
++    from _sysconfigdata import build_time_vars
++    vars.update(build_time_vars)
++
+ def _init_non_posix(vars):
+     """Initialize the module as appropriate for NT"""
+     # set basic install directories
+Index: b/Makefile.pre.in
+===================================================================
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -374,7 +374,7 @@
+ 
+ # Default target
+ all:		build_all
+-build_all:	$(BUILDPYTHON) oldsharedmods sharedmods gdbhooks
++build_all:	$(BUILDPYTHON) $(SYSCONFIGDATA) oldsharedmods sharedmods gdbhooks
+ 
+ # Compile a binary with gcc profile guided optimization.
+ profile-opt:
+@@ -402,6 +402,7 @@
+ 	$(MAKE) clean
+ 	$(MAKE) all PY_CFLAGS="$(PY_CFLAGS) -O0 -pg -fprofile-arcs -ftest-coverage" LIBS="$(LIBS) -lgcov"
+ 
++SYSCONFIGDATA=_sysconfigdata.py
+ 
+ # Build the interpreter
+ $(BUILDPYTHON):	Modules/python.o $(LIBRARY) $(LDLIBRARY)
+@@ -409,14 +410,20 @@
+ 			Modules/python.o \
+ 			-Wl,--whole-archive $(BLDLIBRARY) -Wl,--no-whole-archive $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
+ 
+-platform: $(BUILDPYTHON)
++platform: $(BUILDPYTHON) $(SYSCONFIGDATA)
+ 	$(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from sysconfig import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
+ 
++# Generate the sysconfig build-time data
++$(SYSCONFIGDATA): $(BUILDPYTHON)
++	$(RUNSHARED) ./$(BUILDPYTHON) -SE -c 'import sysconfig; sysconfig._generate_posix_vars()'
++	$(RUNSHARED) ./$(BUILDPYTHON) -S -c 'import os,sys ; from distutils.util import get_platform ; d=os.path.join("build", "lib."+get_platform()+"-"+sys.version[0:3]+("-pydebug" if hasattr(sys, "gettotalrefcount") else "")); sys.stdout.write(d)' > pybuilddir.txt
++	mkdir -p `cat pybuilddir.txt`
++	cp $(SYSCONFIGDATA) `cat pybuilddir.txt`/.
+ 
+ # Build the shared modules
+ # MAKEFLAGS are sorted and normalized. Under GNU make the 's' for
+ # -s, --silent or --quiet is always the first char.
+-sharedmods: $(BUILDPYTHON)
++sharedmods: $(BUILDPYTHON) $(SYSCONFIGDATA)
+ 	@case "$$MAKEFLAGS" in \
+ 	    s*) quiet="-q";; \
+ 	    *) quiet="";; \
+@@ -910,7 +917,7 @@
+ 		else	true; \
+ 		fi; \
+ 	done
+-	@for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \
++	@for i in $(srcdir)/Lib/*.py $(SYSCONFIGDATA) $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \
+ 	do \
+ 		if test -x $$i; then \
+ 			$(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
--- python2.7-2.7.3.orig/debian/patches/plat-linux2_sparc.diff
+++ python2.7-2.7.3/debian/patches/plat-linux2_sparc.diff
@@ -0,0 +1,72 @@
+Index: Lib/plat-linux2/IN.py
+===================================================================
+--- ./Lib/plat-linux2/IN.py	(Revision 77754)
++++ ./Lib/plat-linux2/IN.py	(Arbeitskopie)
+@@ -442,37 +442,37 @@
+ SIOCGPGRP = 0x8904
+ SIOCATMARK = 0x8905
+ SIOCGSTAMP = 0x8906
+-SOL_SOCKET = 1
+-SO_DEBUG = 1
+-SO_REUSEADDR = 2
+-SO_TYPE = 3
+-SO_ERROR = 4
+-SO_DONTROUTE = 5
+-SO_BROADCAST = 6
+-SO_SNDBUF = 7
+-SO_RCVBUF = 8
+-SO_KEEPALIVE = 9
+-SO_OOBINLINE = 10
+-SO_NO_CHECK = 11
+-SO_PRIORITY = 12
+-SO_LINGER = 13
+-SO_BSDCOMPAT = 14
+-SO_PASSCRED = 16
+-SO_PEERCRED = 17
+-SO_RCVLOWAT = 18
+-SO_SNDLOWAT = 19
+-SO_RCVTIMEO = 20
+-SO_SNDTIMEO = 21
+-SO_SECURITY_AUTHENTICATION = 22
+-SO_SECURITY_ENCRYPTION_TRANSPORT = 23
+-SO_SECURITY_ENCRYPTION_NETWORK = 24
+-SO_BINDTODEVICE = 25
+-SO_ATTACH_FILTER = 26
+-SO_DETACH_FILTER = 27
+-SO_PEERNAME = 28
+-SO_TIMESTAMP = 29
++SOL_SOCKET = 0xffff
++SO_DEBUG = 0x0001
++SO_REUSEADDR = 0x0004
++SO_TYPE = 0x1008
++SO_ERROR = 0x1007
++SO_DONTROUTE = 0x0010
++SO_BROADCAST = 0x0020
++SO_SNDBUF = 0x1001
++SO_RCVBUF = 0x1002
++SO_KEEPALIVE = 0x0008
++SO_OOBINLINE = 0x0100
++SO_NO_CHECK = 0x000b
++SO_PRIORITY = 0x000c
++SO_LINGER = 0x0080
++SO_BSDCOMPAT = 0x0400
++SO_PASSCRED = 0x0002
++SO_PEERCRED = 0x0040
++SO_RCVLOWAT = 0x0800
++SO_SNDLOWAT = 0x1000
++SO_RCVTIMEO = 0x2000
++SO_SNDTIMEO = 0x4000
++SO_SECURITY_AUTHENTICATION = 0x5001
++SO_SECURITY_ENCRYPTION_TRANSPORT = 0x5002
++SO_SECURITY_ENCRYPTION_NETWORK = 0x5004
++SO_BINDTODEVICE = 0x000d
++SO_ATTACH_FILTER = 0x001a
++SO_DETACH_FILTER = 0x001b
++SO_PEERNAME = 0x001c
++SO_TIMESTAMP = 0x001d
+ SCM_TIMESTAMP = SO_TIMESTAMP
+-SO_ACCEPTCONN = 30
++SO_ACCEPTCONN = 0x8000
+ SOCK_STREAM = 1
+ SOCK_DGRAM = 2
+ SOCK_RAW = 3
--- python2.7-2.7.3.orig/debian/patches/statvfs-f_flag-constants.diff
+++ python2.7-2.7.3/debian/patches/statvfs-f_flag-constants.diff
@@ -0,0 +1,57 @@
+From 21fda4c78000d78cb1824fdf0373031d07f5325a Mon Sep 17 00:00:00 2001
+From: Peter Jones <pjones@redhat.com>
+Date: Wed, 6 Jan 2010 15:22:38 -0500
+Subject: [PATCH] Add flags for statvfs.f_flag to constant list.
+
+You really need these to figure out what statvfs is trying to say to
+you, so add them here.
+---
+ Modules/posixmodule.c |   37 +++++++++++++++++++++++++++++++++++++
+ 1 files changed, 37 insertions(+), 0 deletions(-)
+
+--- a/Modules/posixmodule.c
++++ b/Modules/posixmodule.c
+@@ -9301,6 +9301,43 @@
+     if (ins(d, "EX_NOTFOUND", (long)EX_NOTFOUND)) return -1;
+ #endif /* EX_NOTFOUND */
+ 
++	/* These came from statvfs.h */
++#ifdef ST_RDONLY
++	if (ins(d, "ST_RDONLY", (long)ST_RDONLY)) return -1;
++#endif /* ST_RDONLY */
++#ifdef ST_NOSUID
++	if (ins(d, "ST_NOSUID", (long)ST_NOSUID)) return -1;
++#endif /* ST_NOSUID */
++
++	/* GNU extensions */
++#ifdef ST_NODEV
++	if (ins(d, "ST_NODEV", (long)ST_NODEV)) return -1;
++#endif /* ST_NODEV */
++#ifdef ST_NOEXEC
++	if (ins(d, "ST_NOEXEC", (long)ST_NOEXEC)) return -1;
++#endif /* ST_NOEXEC */
++#ifdef ST_SYNCHRONOUS
++	if (ins(d, "ST_SYNCHRONOUS", (long)ST_SYNCHRONOUS)) return -1;
++#endif /* ST_SYNCHRONOUS */
++#ifdef ST_MANDLOCK
++	if (ins(d, "ST_MANDLOCK", (long)ST_MANDLOCK)) return -1;
++#endif /* ST_MANDLOCK */
++#ifdef ST_WRITE
++	if (ins(d, "ST_WRITE", (long)ST_WRITE)) return -1;
++#endif /* ST_WRITE */
++#ifdef ST_APPEND
++	if (ins(d, "ST_APPEND", (long)ST_APPEND)) return -1;
++#endif /* ST_APPEND */
++#ifdef ST_NOATIME
++	if (ins(d, "ST_NOATIME", (long)ST_NOATIME)) return -1;
++#endif /* ST_NOATIME */
++#ifdef ST_NODIRATIME
++	if (ins(d, "ST_NODIRATIME", (long)ST_NODIRATIME)) return -1;
++#endif /* ST_NODIRATIME */
++#ifdef ST_RELATIME
++	if (ins(d, "ST_RELATIME", (long)ST_RELATIME)) return -1;
++#endif /* ST_RELATIME */
++
+ #ifdef HAVE_SPAWNV
+ #if defined(PYOS_OS2) && defined(PYCC_GCC)
+     if (ins(d, "P_WAIT", (long)P_WAIT)) return -1;
--- python2.7-2.7.3.orig/debian/patches/webbrowser.diff
+++ python2.7-2.7.3/debian/patches/webbrowser.diff
@@ -0,0 +1,27 @@
+# DP: Recognize other browsers: www-browser, x-www-browser, iceweasel, iceape.
+
+--- a/Lib/webbrowser.py
++++ b/Lib/webbrowser.py
+@@ -449,9 +449,13 @@
+     if "KDE_FULL_SESSION" in os.environ and _iscommand("kfmclient"):
+         register("kfmclient", Konqueror, Konqueror("kfmclient"))
+ 
++    if _iscommand("x-www-browser"):
++        register("x-www-browser", None, BackgroundBrowser("x-www-browser"))
++
+     # The Mozilla/Netscape browsers
+     for browser in ("mozilla-firefox", "firefox",
+                     "mozilla-firebird", "firebird",
++                    "iceweasel", "iceape",
+                     "seamonkey", "mozilla", "netscape"):
+         if _iscommand(browser):
+             register(browser, None, Mozilla(browser))
+@@ -489,6 +493,8 @@
+ 
+ # Also try console browsers
+ if os.environ.get("TERM"):
++    if _iscommand("www-browser"):
++        register("www-browser", None, GenericBrowser("www-browser"))
+     # The Links/elinks browsers <http://artax.karlin.mff.cuni.cz/~mikulas/links/>
+     if _iscommand("links"):
+         register("links", None, GenericBrowser("links"))
--- python2.7-2.7.3.orig/debian/patches/link-whole-archive.diff
+++ python2.7-2.7.3/debian/patches/link-whole-archive.diff
@@ -0,0 +1,13 @@
+# DP: Link libpython with --whole-archive.
+
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -406,7 +406,7 @@
+ $(BUILDPYTHON):	Modules/python.o $(LIBRARY) $(LDLIBRARY)
+ 		$(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ \
+ 			Modules/python.o \
+-			$(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
++			-Wl,--whole-archive $(BLDLIBRARY) -Wl,--no-whole-archive $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
+ 
+ platform: $(BUILDPYTHON)
+ 	$(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from sysconfig import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
--- python2.7-2.7.3.orig/debian/patches/arm-float.dpatch
+++ python2.7-2.7.3/debian/patches/arm-float.dpatch
@@ -0,0 +1,119 @@
+#! /bin/sh -e
+
+# DP: Support mixed-endian IEEE floating point, as found in the ARM old-ABI.
+
+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
+        ;;
+    -unpatch)
+        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
+        ;;
+    *)
+	echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+        exit 1
+esac
+exit 0
+
+--- Objects/floatobject.c.orig	2006-05-25 10:53:30.000000000 -0500
++++ Objects/floatobject.c	2007-07-27 06:43:15.000000000 -0500
+@@ -982,7 +982,7 @@
+ /* this is for the benefit of the pack/unpack routines below */
+ 
+ typedef enum {
+-	unknown_format, ieee_big_endian_format, ieee_little_endian_format
++	unknown_format, ieee_big_endian_format, ieee_little_endian_format, ieee_mixed_endian_format
+ } float_format_type;
+ 
+ static float_format_type double_format, float_format;
+@@ -1021,6 +1021,8 @@
+ 		return PyString_FromString("IEEE, little-endian");
+ 	case ieee_big_endian_format:
+ 		return PyString_FromString("IEEE, big-endian");
++	case ieee_mixed_endian_format:
++		return PyString_FromString("IEEE, mixed-endian");
+ 	default:
+ 		Py_FatalError("insane float_format or double_format");
+ 		return NULL;
+@@ -1073,11 +1075,14 @@
+ 	else if (strcmp(format, "IEEE, big-endian") == 0) {
+ 		f = ieee_big_endian_format;
+ 	}
++	else if (strcmp(format, "IEEE, mixed-endian") == 0) {
++		f = ieee_mixed_endian_format;
++	}
+ 	else {
+ 		PyErr_SetString(PyExc_ValueError,
+ 				"__setformat__() argument 2 must be "
+-				"'unknown', 'IEEE, little-endian' or "
+-				"'IEEE, big-endian'");
++				"'unknown', 'IEEE, little-endian', "
++				"'IEEE, big-endian' or 'IEEE, mixed-endian'");
+ 		return NULL;
+ 
+ 	}
+@@ -1230,6 +1235,8 @@
+ 			detected_double_format = ieee_big_endian_format;
+ 		else if (memcmp(&x, "\x05\x04\x03\x02\x01\xff\x3f\x43", 8) == 0)
+ 			detected_double_format = ieee_little_endian_format;
++		else if (memcmp(&x, "\x01\xff\x3f\x43\x05\x04\x03\x02", 8) == 0)
++			detected_double_format = ieee_mixed_endian_format;
+ 		else 
+ 			detected_double_format = unknown_format;
+ 	}
+@@ -1565,8 +1572,19 @@
+ 			p += 7;
+ 			incr = -1;
+ 		}
++		else if (double_format == ieee_mixed_endian_format) {
++			if (le)
++				p += 4;
++			else {
++				p += 3;
++				incr = -1;
++			}
++		}
+ 		
+ 		for (i = 0; i < 8; i++) {
++			if (double_format == ieee_mixed_endian_format && i == 4)
++				p += -8 * incr;
++
+ 			*p = *s++;
+ 			p += incr;
+ 		}
+@@ -1739,6 +1757,27 @@
+ 			}
+ 			memcpy(&x, buf, 8);
+ 		}
++		else if (double_format == ieee_mixed_endian_format) {
++			char buf[8];
++			char *d;
++			int i, incr = 1;
++
++			if (le)
++				d = &buf[4];
++			else
++				d = &buf[3];
++			
++			for (i = 0; i < 4; i++) {
++				*d = *p++;
++				d += incr;
++			}
++			d += -8 * incr;
++			for (i = 0; i < 4; i++) {
++				*d = *p++;
++				d += incr;
++			}
++			memcpy(&x, buf, 8);
++		}
+ 		else {
+ 			memcpy(&x, p, 8);
+ 		}
--- python2.7-2.7.3.orig/debian/patches/issue9189.diff
+++ python2.7-2.7.3/debian/patches/issue9189.diff
@@ -0,0 +1,342 @@
+Index: b/Lib/sysconfig.py
+===================================================================
+--- a/Lib/sysconfig.py
++++ b/Lib/sysconfig.py
+@@ -227,11 +227,19 @@
+                     done[n] = v
+ 
+     # do variable interpolation here
+-    while notdone:
+-        for name in notdone.keys():
++    variables = list(notdone.keys())
++
++    # Variables with a 'PY_' prefix in the makefile. These need to
++    # be made available without that prefix through sysconfig.
++    # Special care is needed to ensure that variable expansion works, even
++    # if the expansion uses the name without a prefix.
++    renamed_variables = ('CFLAGS', 'LDFLAGS', 'CPPFLAGS')
++
++    while len(variables) > 0:
++        for name in tuple(variables):
+             value = notdone[name]
+             m = _findvar1_rx.search(value) or _findvar2_rx.search(value)
+-            if m:
++            if m is not None:
+                 n = m.group(1)
+                 found = True
+                 if n in done:
+@@ -242,23 +250,48 @@
+                 elif n in os.environ:
+                     # do it like make: fall back to environment
+                     item = os.environ[n]
++
++                elif n in renamed_variables:
++                    if name.startswith('PY_') and name[3:] in renamed_variables:
++                        item = ""
++
++                    elif 'PY_' + n in notdone:
++                        found = False
++
++                    else:
++                        item = str(done['PY_' + n])
++
+                 else:
+                     done[n] = item = ""
++
+                 if found:
+                     after = value[m.end():]
+                     value = value[:m.start()] + item + after
+                     if "$" in after:
+                         notdone[name] = value
+                     else:
+-                        try: value = int(value)
++                        try:
++                            value = int(value)
+                         except ValueError:
+                             done[name] = value.strip()
+                         else:
+                             done[name] = value
+-                        del notdone[name]
++                        variables.remove(name)
++
++                        if name.startswith('PY_') \
++                        and name[3:] in renamed_variables:
++
++                            name = name[3:]
++                            if name not in done:
++                                done[name] = value
++
++
+             else:
+-                # bogus variable reference; just drop it since we can't deal
+-                del notdone[name]
++                # bogus variable reference (e.g. "prefix=$/opt/python");
++                # just drop it since we can't deal
++                done[name] = value
++                variables.remove(name)
++
+     # strip spurious spaces
+     for k, v in done.items():
+         if isinstance(v, str):
+Index: b/Makefile.pre.in
+===================================================================
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -62,12 +62,18 @@
+ # Compiler options
+ OPT=		@OPT@
+ BASECFLAGS=	@BASECFLAGS@
+-CFLAGS=		$(BASECFLAGS) @CFLAGS@ $(OPT) $(EXTRA_CFLAGS)
++CONFIGURE_CFLAGS=	@CFLAGS@
++CONFIGURE_CPPFLAGS=	@CPPFLAGS@
++CONFIGURE_LDFLAGS=	@LDFLAGS@
++# Avoid assigning CFLAGS, LDFLAGS, etc. so users can use them on the
++# command line to append to these values without stomping the pre-set
++# values.
++PY_CFLAGS=	$(BASECFLAGS) $(OPT) $(CONFIGURE_CFLAGS) $(CFLAGS) $(EXTRA_CFLAGS)
+ # Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to
+ # be able to build extension modules using the directories specified in the
+ # environment variables
+-CPPFLAGS=	-I. -IInclude -I$(srcdir)/Include @CPPFLAGS@
+-LDFLAGS=	@LDFLAGS@
++PY_CPPFLAGS=	-I. -IInclude -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) $(CPPFLAGS)
++PY_LDFLAGS=	$(CONFIGURE_LDFLAGS) $(LDFLAGS)
+ LDLAST=		@LDLAST@
+ SGI_ABI=	@SGI_ABI@
+ CCSHARED=	@CCSHARED@
+@@ -76,7 +82,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) -DPy_BUILD_CORE
++PY_CORE_CFLAGS=	$(PY_CFLAGS) $(PY_CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE
+ 
+ 
+ # Machine-dependent subdirectories
+@@ -397,7 +403,7 @@
+ 
+ # Build the interpreter
+ $(BUILDPYTHON):	Modules/python.o $(LIBRARY) $(LDLIBRARY)
+-		$(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
++		$(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ \
+ 			Modules/python.o \
+ 			$(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
+ 
+@@ -413,7 +419,7 @@
+ 	    s*) quiet="-q";; \
+ 	    *) quiet="";; \
+ 	esac; \
+-	$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
++	$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(PY_LDFLAGS)' OPT='$(OPT)' \
+ 		./$(BUILDPYTHON) -E $(srcdir)/setup.py $$quiet build
+ 
+ # Build static library
+@@ -430,18 +436,18 @@
+ 
+ libpython$(VERSION).so: $(LIBRARY_OBJS)
+ 	if test $(INSTSONAME) != $(LDLIBRARY); then \
+-		$(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
++		$(BLDSHARED) $(PY_LDFLAGS) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
+ 		$(LN) -f $(INSTSONAME) $@; \
+ 	else \
+-		$(BLDSHARED) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
++		$(BLDSHARED) $(PY_LDFLAGS) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
+ 	fi
+ 
+ libpython$(VERSION).dylib: $(LIBRARY_OBJS)
+-	 $(CC) -dynamiclib -Wl,-single_module $(LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(VERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
++	 $(CC) -dynamiclib -Wl,-single_module $(PY_LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(VERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
+ 		 
+ 
+ libpython$(VERSION).sl: $(LIBRARY_OBJS)
+-	$(LDSHARED) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST)
++	$(LDSHARED) $(PY_LDFLAGS) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST)
+ 
+ # Copy up the gdb python hooks into a position where they can be automatically
+ # loaded by gdb during Lib/test/test_gdb.py
+@@ -480,7 +486,7 @@
+ # for a shared core library; otherwise, this rule is a noop.
+ $(DLLLIBRARY) libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
+ 	if test -n "$(DLLLIBRARY)"; then \
+-		$(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
++		$(LDSHARED) $(PY_LDFLAGS) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
+ 			$(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST); \
+ 	else true; \
+ 	fi
+@@ -524,7 +530,7 @@
+ 		$(SIGNAL_OBJS) \
+ 		$(MODOBJS) \
+ 		$(srcdir)/Modules/getbuildinfo.c
+-	$(CC) -c $(PY_CFLAGS) \
++	$(CC) -c $(PY_CORE_CFLAGS) \
+ 	      -DSVNVERSION="\"`LC_ALL=C $(SVNVERSION)`\"" \
+ 	      -DHGVERSION="\"`LC_ALL=C $(HGVERSION)`\"" \
+ 	      -DHGTAG="\"`LC_ALL=C $(HGTAG)`\"" \
+@@ -532,7 +538,7 @@
+ 	      -o $@ $(srcdir)/Modules/getbuildinfo.c
+ 
+ Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
+-	$(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
++	$(CC) -c $(PY_CORE_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
+ 		-DPREFIX='"$(prefix)"' \
+ 		-DEXEC_PREFIX='"$(exec_prefix)"' \
+ 		-DVERSION='"$(VERSION)"' \
+@@ -540,7 +546,7 @@
+ 		-o $@ $(srcdir)/Modules/getpath.c
+ 
+ Modules/python.o: $(srcdir)/Modules/python.c
+-	$(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c
++	$(MAINCC) -c $(PY_CORE_CFLAGS) -o $@ $(srcdir)/Modules/python.c
+ 
+ 
+ # Use a stamp file to prevent make -j invoking pgen twice
+@@ -551,7 +557,7 @@
+ 		-touch Parser/pgen.stamp
+ 
+ $(PGEN):	$(PGENOBJS)
+-		$(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
++		$(CC) $(OPT) $(PY_LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
+ 
+ Parser/grammar.o:	$(srcdir)/Parser/grammar.c \
+ 				$(srcdir)/Include/token.h \
+@@ -571,10 +577,10 @@
+ Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H)
+ 
+ Python/getplatform.o: $(srcdir)/Python/getplatform.c
+-		$(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
++		$(CC) -c $(PY_CORE_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
+ 
+ Python/importdl.o: $(srcdir)/Python/importdl.c
+-		$(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
++		$(CC) -c $(PY_CORE_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
+ 
+ Objects/unicodectype.o:	$(srcdir)/Objects/unicodectype.c \
+ 				$(srcdir)/Objects/unicodetype_db.h
+@@ -1157,7 +1163,7 @@
+ 
+ # Some make's put the object file in the current directory
+ .c.o:
+-	$(CC) -c $(PY_CFLAGS) -o $@ $<
++	$(CC) -c $(PY_CORE_CFLAGS) -o $@ $<
+ 
+ # Run reindent on the library
+ reindent:
+Index: b/Modules/makesetup
+===================================================================
+--- a/Modules/makesetup
++++ b/Modules/makesetup
+@@ -219,7 +219,7 @@
+ 			case $doconfig in
+ 			no)	cc="$cc \$(CCSHARED) \$(CFLAGS) \$(CPPFLAGS)";;
+ 			*)
+-				cc="$cc \$(PY_CFLAGS)";;
++				cc="$cc \$(PY_CORE_CFLAGS)";;
+ 			esac
+ 			rule="$obj: $src; $cc $cpps -c $src -o $obj"
+ 			echo "$rule" >>$rulesf
+Index: b/configure.ac
+===================================================================
+--- a/configure.ac
++++ b/configure.ac
+@@ -507,14 +507,13 @@
+ (it is also a good idea to do 'make clean' before compiling)])
+ fi
+ 
+-# If the user set CFLAGS, use this instead of the automatically
+-# determined setting
+-preset_cflags="$CFLAGS"
+-AC_PROG_CC
+-if test ! -z "$preset_cflags"
+-then
+-	CFLAGS=$preset_cflags
++# Don't let AC_PROG_CC set the default CFLAGS. It normally sets -g -O2
++# when the compiler supports them, but we don't always want -O2, and
++# we set -g later.
++if test -z "$CFLAGS"; then
++        CFLAGS=
+ fi
++AC_PROG_CC
+ 
+ AC_SUBST(CXX)
+ AC_SUBST(MAINCC)
+Index: b/Lib/distutils/sysconfig.py
+===================================================================
+--- a/Lib/distutils/sysconfig.py
++++ b/Lib/distutils/sysconfig.py
+@@ -322,11 +322,19 @@
+                     done[n] = v
+ 
+     # do variable interpolation here
+-    while notdone:
+-        for name in notdone.keys():
++    variables = list(notdone.keys())
++
++    # Variables with a 'PY_' prefix in the makefile. These need to
++    # be made available without that prefix through sysconfig.
++    # Special care is needed to ensure that variable expansion works, even
++    # if the expansion uses the name without a prefix.
++    renamed_variables = ('CFLAGS', 'LDFLAGS', 'CPPFLAGS')
++
++    while len(variables) > 0:
++        for name in tuple(variables):
+             value = notdone[name]
+             m = _findvar1_rx.search(value) or _findvar2_rx.search(value)
+-            if m:
++            if m is not None:
+                 n = m.group(1)
+                 found = True
+                 if n in done:
+@@ -337,25 +345,47 @@
+                 elif n in os.environ:
+                     # do it like make: fall back to environment
+                     item = os.environ[n]
++
++                elif n in renamed_variables:
++                    if name.startswith('PY_') and name[3:] in renamed_variables:
++                        item = ""
++
++                    elif 'PY_' + n in notdone:
++                        found = False
++
++                    else:
++                        item = str(done['PY_' + n])
++
+                 else:
+                     done[n] = item = ""
++
+                 if found:
+                     after = value[m.end():]
+                     value = value[:m.start()] + item + after
+                     if "$" in after:
+                         notdone[name] = value
+                     else:
+-                        try: value = int(value)
++                        try:
++                            value = int(value)
+                         except ValueError:
+                             done[name] = value.strip()
+                         else:
+                             done[name] = value
+-                        del notdone[name]
+-            else:
+-                # bogus variable reference; just drop it since we can't deal
+-                del notdone[name]
++                        variables.remove(name)
++
++                        if name.startswith('PY_') \
++                        and name[3:] in renamed_variables:
+ 
+-    fp.close()
++                            name = name[3:]
++                            if name not in done:
++                                done[name] = value
++
++
++            else:
++                # bogus variable reference (e.g. "prefix=$/opt/python");
++                # just drop it since we can't deal
++                done[name] = value
++                variables.remove(name)
+ 
+     # strip spurious spaces
+     for k, v in done.items():
--- python2.7-2.7.3.orig/debian/patches/pydebug-path.dpatch
+++ python2.7-2.7.3/debian/patches/pydebug-path.dpatch
@@ -0,0 +1,100 @@
+#! /bin/sh -e
+
+# DP: When built with --with-pydebug, add a debug directory
+# DP: <prefix>/lib-dynload/debug to sys.path just before
+# DP: <prefix>/lib-dynload und install the extension modules
+# DP: of the debug build in this directory.
+
+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
+        ;;
+    -unpatch)
+        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
+        ;;
+    *)
+	echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
+        exit 1
+esac
+exit 0
+
+--- Modules/getpath.c.orig	2005-01-18 00:56:31.571961744 +0100
++++ Modules/getpath.c	2005-01-18 01:02:23.811413208 +0100
+@@ -112,9 +112,14 @@
+ #endif
+ 
+ #ifndef PYTHONPATH
++#ifdef Py_DEBUG
++#define PYTHONPATH PREFIX "/lib/python" VERSION ":" \
++              EXEC_PREFIX "/lib/python" VERSION "/lib-dynload/debug"
++#else
+ #define PYTHONPATH PREFIX "/lib/python" VERSION ":" \
+               EXEC_PREFIX "/lib/python" VERSION "/lib-dynload"
+ #endif
++#endif
+ 
+ #ifndef LANDMARK
+ #define LANDMARK "os.py"
+@@ -323,6 +328,9 @@
+             strncpy(exec_prefix, home, MAXPATHLEN);
+         joinpath(exec_prefix, lib_python);
+         joinpath(exec_prefix, "lib-dynload");
++#ifdef Py_DEBUG
++        joinpath(exec_prefix, "debug");
++#endif
+         return 1;
+     }
+ 
+@@ -340,6 +348,9 @@
+         n = strlen(exec_prefix);
+         joinpath(exec_prefix, lib_python);
+         joinpath(exec_prefix, "lib-dynload");
++#ifdef Py_DEBUG
++        joinpath(exec_prefix, "debug");
++#endif
+         if (isdir(exec_prefix))
+             return 1;
+         exec_prefix[n] = '\0';
+@@ -350,6 +361,9 @@
+     strncpy(exec_prefix, EXEC_PREFIX, MAXPATHLEN);
+     joinpath(exec_prefix, lib_python);
+     joinpath(exec_prefix, "lib-dynload");
++#ifdef Py_DEBUG
++    joinpath(exec_prefix, "debug");
++#endif
+     if (isdir(exec_prefix))
+         return 1;
+ 
+@@ -654,6 +654,9 @@
+         reduce(exec_prefix);
+         reduce(exec_prefix);
+         reduce(exec_prefix);
++#ifdef Py_DEBUG
++        reduce(exec_prefix);
++#endif
+ 	if (!exec_prefix[0])
+ 		strcpy(exec_prefix, separator);
+     }
+--- Lib/site.py~	2004-12-04 00:39:05.000000000 +0100
++++ Lib/site.py	2005-01-18 01:33:36.589707632 +0100
+@@ -188,6 +188,12 @@
+                                          "python" + sys.version[:3],
+                                          "site-packages"),
+                             os.path.join(prefix, "lib", "site-python")]
++                try:
++                    # sys.getobjects only available in --with-pydebug build
++                    sys.getobjects
++                    sitedirs.insert(0, os.path.join(sitedirs[0], 'debug'))
++                except AttributeError:
++                    pass
+             else:
+                 sitedirs = [prefix, os.path.join(prefix, "lib", "site-packages")]
+             if sys.platform == 'darwin':
