summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Doc/c-api/structures.rst2
-rw-r--r--Doc/distutils/apiref.rst10
-rw-r--r--Doc/library/doctest.rst66
-rw-r--r--Doc/library/re.rst16
-rw-r--r--Doc/library/stdtypes.rst17
-rw-r--r--Doc/library/sys.rst11
-rw-r--r--Doc/library/urllib.rst2
-rw-r--r--Doc/tutorial/datastructures.rst12
-rw-r--r--Doc/tutorial/introduction.rst29
-rw-r--r--Lib/SimpleXMLRPCServer.py6
-rw-r--r--Lib/distutils/command/__init__.py2
-rw-r--r--Lib/glob.py2
-rw-r--r--Lib/optparse.py1
-rwxr-xr-xLib/pdb.py9
-rw-r--r--Lib/test/test_sys.py5
-rw-r--r--Lib/test/test_xmlrpc.py6
-rw-r--r--Misc/NEWS29
-rw-r--r--Misc/gdbinit13
-rw-r--r--README73
19 files changed, 171 insertions, 140 deletions
diff --git a/Doc/c-api/structures.rst b/Doc/c-api/structures.rst
index e92827d..c79c4cb 100644
--- a/Doc/c-api/structures.rst
+++ b/Doc/c-api/structures.rst
@@ -247,7 +247,7 @@ definition with the same method name.
T_OBJECT_EX PyObject \*
T_CHAR char
T_BYTE char
- T_UNBYTE unsigned char
+ T_UBYTE unsigned char
T_UINT unsigned int
T_USHORT unsigned short
T_ULONG unsigned long
diff --git a/Doc/distutils/apiref.rst b/Doc/distutils/apiref.rst
index 4d65de0..b4887cf 100644
--- a/Doc/distutils/apiref.rst
+++ b/Doc/distutils/apiref.rst
@@ -1775,8 +1775,16 @@ This module supplies the abstract base class :class:`Command`.
.. module:: distutils.command.bdist_msi
:synopsis: Build a binary distribution as a Windows MSI file
+.. class:: bdist_msi(Command)
-.. % todo
+ Builds a `Windows Installer`_ (.msi) binary package.
+
+ .. _Windows Installer: http://msdn.microsoft.com/en-us/library/cc185688(VS.85).aspx
+
+ In most cases, the ``bdist_msi`` installer is a better choice than the
+ ``bdist_wininst`` installer, because it provides better support for
+ Win64 platforms, allows administrators to perform non-interactive
+ installations, and allows installation through group policies.
:mod:`distutils.command.bdist_rpm` --- Build a binary distribution as a Redhat RPM and SRPM
diff --git a/Doc/library/doctest.rst b/Doc/library/doctest.rst
index 31e6d0f..bd990b4 100644
--- a/Doc/library/doctest.rst
+++ b/Doc/library/doctest.rst
@@ -965,7 +965,7 @@ There are two main functions for creating :class:`unittest.TestSuite` instances
from text files and modules with doctests:
-.. function:: DocFileSuite([module_relative][, package][, setUp][, tearDown][, globs][, optionflags][, parser][, encoding])
+.. function:: DocFileSuite(*paths, [module_relative][, package][, setUp][, tearDown][, globs][, optionflags][, parser][, encoding])
Convert doctest tests from one or more text files to a
:class:`unittest.TestSuite`.
@@ -983,45 +983,47 @@ from text files and modules with doctests:
Optional argument *module_relative* specifies how the filenames in *paths*
should be interpreted:
- * If *module_relative* is ``True`` (the default), then each filename specifies
- an OS-independent module-relative path. By default, this path is relative to
- the calling module's directory; but if the *package* argument is specified, then
- it is relative to that package. To ensure OS-independence, each filename should
- use ``/`` characters to separate path segments, and may not be an absolute path
- (i.e., it may not begin with ``/``).
-
- * If *module_relative* is ``False``, then each filename specifies an OS-specific
- path. The path may be absolute or relative; relative paths are resolved with
- respect to the current working directory.
-
- Optional argument *package* is a Python package or the name of a Python package
- whose directory should be used as the base directory for module-relative
- filenames. If no package is specified, then the calling module's directory is
- used as the base directory for module-relative filenames. It is an error to
- specify *package* if *module_relative* is ``False``.
-
- Optional argument *setUp* specifies a set-up function for the test suite. This
- is called before running the tests in each file. The *setUp* function will be
- passed a :class:`DocTest` object. The setUp function can access the test
- globals as the *globs* attribute of the test passed.
-
- Optional argument *tearDown* specifies a tear-down function for the test suite.
- This is called after running the tests in each file. The *tearDown* function
+ * If *module_relative* is ``True`` (the default), then each filename in
+ *paths* specifies an OS-independent module-relative path. By default, this
+ path is relative to the calling module's directory; but if the *package*
+ argument is specified, then it is relative to that package. To ensure
+ OS-independence, each filename should use ``/`` characters to separate path
+ segments, and may not be an absolute path (i.e., it may not begin with
+ ``/``).
+
+ * If *module_relative* is ``False``, then each filename in *paths* specifies
+ an OS-specific path. The path may be absolute or relative; relative paths
+ are resolved with respect to the current working directory.
+
+ Optional argument *package* is a Python package or the name of a Python
+ package whose directory should be used as the base directory for
+ module-relative filenames in *paths*. If no package is specified, then the
+ calling module's directory is used as the base directory for module-relative
+ filenames. It is an error to specify *package* if *module_relative* is
+ ``False``.
+
+ Optional argument *setUp* specifies a set-up function for the test suite.
+ This is called before running the tests in each file. The *setUp* function
will be passed a :class:`DocTest` object. The setUp function can access the
test globals as the *globs* attribute of the test passed.
+ Optional argument *tearDown* specifies a tear-down function for the test
+ suite. This is called after running the tests in each file. The *tearDown*
+ function will be passed a :class:`DocTest` object. The setUp function can
+ access the test globals as the *globs* attribute of the test passed.
+
Optional argument *globs* is a dictionary containing the initial global
variables for the tests. A new copy of this dictionary is created for each
test. By default, *globs* is a new empty dictionary.
Optional argument *optionflags* specifies the default doctest options for the
tests, created by or-ing together individual option flags. See section
- :ref:`doctest-options`. See function :func:`set_unittest_reportflags` below for
- a better way to set reporting options.
+ :ref:`doctest-options`. See function :func:`set_unittest_reportflags` below
+ for a better way to set reporting options.
- Optional argument *parser* specifies a :class:`DocTestParser` (or subclass) that
- should be used to extract tests from the files. It defaults to a normal parser
- (i.e., ``DocTestParser()``).
+ Optional argument *parser* specifies a :class:`DocTestParser` (or subclass)
+ that should be used to extract tests from the files. It defaults to a normal
+ parser (i.e., ``DocTestParser()``).
Optional argument *encoding* specifies an encoding that should be used to
convert the file to unicode.
@@ -1029,8 +1031,8 @@ from text files and modules with doctests:
.. versionadded:: 2.4
.. versionchanged:: 2.5
- The global ``__file__`` was added to the globals provided to doctests loaded
- from a text file using :func:`DocFileSuite`.
+ The global ``__file__`` was added to the globals provided to doctests
+ loaded from a text file using :func:`DocFileSuite`.
.. versionchanged:: 2.5
The parameter *encoding* was added.
diff --git a/Doc/library/re.rst b/Doc/library/re.rst
index 906444a..6ff89ea 100644
--- a/Doc/library/re.rst
+++ b/Doc/library/re.rst
@@ -231,16 +231,18 @@ The special characters are:
``(?P<name>...)``
Similar to regular parentheses, but the substring matched by the group is
- accessible via the symbolic group name *name*. Group names must be valid Python
- identifiers, and each group name must be defined only once within a regular
- expression. A symbolic group is also a numbered group, just as if the group
- were not named. So the group named 'id' in the example below can also be
- referenced as the numbered group 1.
+ accessible within the rest of the regular expression via the symbolic group
+ name *name*. Group names must be valid Python identifiers, and each group
+ name must be defined only once within a regular expression. A symbolic group
+ is also a numbered group, just as if the group were not named. So the group
+ named ``id`` in the example below can also be referenced as the numbered group
+ ``1``.
For example, if the pattern is ``(?P<id>[a-zA-Z_]\w*)``, the group can be
referenced by its name in arguments to methods of match objects, such as
- ``m.group('id')`` or ``m.end('id')``, and also by name in pattern text (for
- example, ``(?P=id)``) and replacement text (such as ``\g<id>``).
+ ``m.group('id')`` or ``m.end('id')``, and also by name in the regular
+ expression itself (using ``(?P=id)``) and replacement text given to
+ ``.sub()`` (using ``\g<id>``).
``(?P=name)``
Matches whatever text was matched by the earlier group named *name*.
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
index 9c207b0..998ae77 100644
--- a/Doc/library/stdtypes.rst
+++ b/Doc/library/stdtypes.rst
@@ -2653,9 +2653,24 @@ types, where they are relevant. Some of these are not reported by the
The name of the class or type.
+The following attributes are only supported by :term:`new-style class`\ es.
+
+.. attribute:: class.__mro__
+
+ This attribute is a tuple of classes that are considered when looking for
+ base classes during method resolution.
+
+
+.. method:: class.mro()
+
+ This method can be overridden by a metaclass to customize the method
+ resolution order for its instances. It is called at class instantiation, and
+ its result is stored in :attr:`__mro__`.
+
+
.. method:: class.__subclasses__
- :term:`New-style class`\ es keep a list of weak references to their immediate
+ Each new-style class keeps a list of weak references to its immediate
subclasses. This method returns a list of all those references still alive.
Example::
diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst
index b556a3c..a476f4d 100644
--- a/Doc/library/sys.rst
+++ b/Doc/library/sys.rst
@@ -850,9 +850,14 @@ always available.
__stderr__
These objects contain the original values of ``stdin``, ``stderr`` and
- ``stdout`` at the start of the program. They are used during finalization, and
- could be useful to restore the actual files to known working file objects in
- case they have been overwritten with a broken object.
+ ``stdout`` at the start of the program. They are used during finalization,
+ and could be useful to print to the actual standard stream no matter if the
+ ``sys.std*`` object has been redirected.
+
+ It can also be used to restore the actual files to known working file objects
+ in case they have been overwritten with a broken object. However, the
+ preferred way to do this is to explicitly save the previous stream before
+ replacing it, and restore the saved object.
.. data:: tracebacklimit
diff --git a/Doc/library/urllib.rst b/Doc/library/urllib.rst
index 1d02b1c..905c324 100644
--- a/Doc/library/urllib.rst
+++ b/Doc/library/urllib.rst
@@ -49,7 +49,7 @@ High-level interface
.. index:: module: mimetools
The :meth:`info` method returns an instance of the class
- :class:`mimetools.Message` containing meta-information associated with the
+ :class:`httplib.HTTPMessage` containing meta-information associated with the
URL. When the method is HTTP, these headers are those returned by the server
at the head of the retrieved HTML page (including Content-Length and
Content-Type). When the method is FTP, a Content-Length header will be
diff --git a/Doc/tutorial/datastructures.rst b/Doc/tutorial/datastructures.rst
index 2cc1e60..047ae36 100644
--- a/Doc/tutorial/datastructures.rst
+++ b/Doc/tutorial/datastructures.rst
@@ -401,13 +401,11 @@ The reverse operation is also possible::
>>> x, y, z = t
-This is called, appropriately enough, *sequence unpacking*. Sequence unpacking
-requires the list of variables on the left to have the same number of elements
-as the length of the sequence. Note that multiple assignment is really just a
-combination of tuple packing and sequence unpacking!
-
-There is a small bit of asymmetry here: packing multiple values always creates
-a tuple, and unpacking works for any sequence.
+This is called, appropriately enough, *sequence unpacking* and works for any
+sequence on the right-hand side. Sequence unpacking requires the list of
+variables on the left to have the same number of elements as the length of the
+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.
diff --git a/Doc/tutorial/introduction.rst b/Doc/tutorial/introduction.rst
index 99e82a3..21d3627 100644
--- a/Doc/tutorial/introduction.rst
+++ b/Doc/tutorial/introduction.rst
@@ -199,21 +199,6 @@ the following::
several lines of text just as you would do in C.
Note that whitespace at the beginning of the line is significant.
-If we make the string literal a "raw" string, however, the ``\n`` sequences are
-not converted to newlines, but the backslash at the end of the line, and the
-newline character in the source, are both included in the string as data. Thus,
-the example::
-
- hello = r"This is a rather long string containing\n\
- several lines of text much as you would do in C."
-
- print hello
-
-would print::
-
- This is a rather long string containing\n\
- several lines of text much as you would do in C.
-
Or, strings can be surrounded in a pair of matching triple-quotes: ``"""`` or
``'''``. End of lines do not need to be escaped when using triple-quotes, but
they will be included in the string. ::
@@ -230,6 +215,20 @@ produces the following output::
-h Display this usage message
-H hostname Hostname to connect to
+If we make the string literal a "raw" string, ``\n`` sequences are not converted
+to newlines, but the backslash at the end of the line, and the newline character
+in the source, are both included in the string as data. Thus, the example::
+
+ hello = r"This is a rather long string containing\n\
+ several lines of text much as you would do in C."
+
+ print hello
+
+would print::
+
+ This is a rather long string containing\n\
+ several lines of text much as you would do in C.
+
The interpreter prints the result of string operations in the same way as they
are typed for input: inside quotes, and with quotes and other funny characters
escaped by backslashes, to show the precise value. The string is enclosed in
diff --git a/Lib/SimpleXMLRPCServer.py b/Lib/SimpleXMLRPCServer.py
index 43757a0..b304e45 100644
--- a/Lib/SimpleXMLRPCServer.py
+++ b/Lib/SimpleXMLRPCServer.py
@@ -598,8 +598,12 @@ class CGIXMLRPCRequestHandler(SimpleXMLRPCDispatcher):
self.handle_get()
else:
# POST data is normally available through stdin
+ try:
+ length = int(os.environ.get('CONTENT_LENGTH', None))
+ except (TypeError, ValueError):
+ length = -1
if request_text is None:
- request_text = sys.stdin.read()
+ request_text = sys.stdin.read(length)
self.handle_xmlrpc(request_text)
diff --git a/Lib/distutils/command/__init__.py b/Lib/distutils/command/__init__.py
index 0888c27..05c758a 100644
--- a/Lib/distutils/command/__init__.py
+++ b/Lib/distutils/command/__init__.py
@@ -24,6 +24,8 @@ __all__ = ['build',
'bdist_dumb',
'bdist_rpm',
'bdist_wininst',
+ 'upload',
+
# These two are reserved for future use:
#'bdist_sdux',
#'bdist_pkgtool',
diff --git a/Lib/glob.py b/Lib/glob.py
index 75d7bf9..04364be 100644
--- a/Lib/glob.py
+++ b/Lib/glob.py
@@ -16,7 +16,7 @@ def glob(pathname):
return list(iglob(pathname))
def iglob(pathname):
- """Return a list of paths matching a pathname pattern.
+ """Return an iterator which yields the paths matching a pathname pattern.
The pattern may contain simple shell-style wildcards a la fnmatch.
diff --git a/Lib/optparse.py b/Lib/optparse.py
index 02f62e4..56b05d6 100644
--- a/Lib/optparse.py
+++ b/Lib/optparse.py
@@ -11,6 +11,7 @@ For support, use the optik-users@lists.sourceforge.net mailing list
__version__ = "1.5.3"
__all__ = ['Option',
+ 'make_option',
'SUPPRESS_HELP',
'SUPPRESS_USAGE',
'Values',
diff --git a/Lib/pdb.py b/Lib/pdb.py
index 3f76032..e9f5632 100755
--- a/Lib/pdb.py
+++ b/Lib/pdb.py
@@ -194,6 +194,12 @@ class Pdb(bdb.Bdb, cmd.Cmd):
self.cmdloop()
self.forget()
+ def displayhook(self, obj):
+ """Custom displayhook for the exec in default(), which prevents
+ assignment of the _ variable in the builtins.
+ """
+ print repr(obj)
+
def default(self, line):
if line[:1] == '!': line = line[1:]
locals = self.curframe.f_locals
@@ -202,13 +208,16 @@ class Pdb(bdb.Bdb, cmd.Cmd):
code = compile(line + '\n', '<stdin>', 'single')
save_stdout = sys.stdout
save_stdin = sys.stdin
+ save_displayhook = sys.displayhook
try:
sys.stdin = self.stdin
sys.stdout = self.stdout
+ sys.displayhook = self.displayhook
exec code in globals, locals
finally:
sys.stdout = save_stdout
sys.stdin = save_stdin
+ sys.displayhook = save_displayhook
except:
t, v = sys.exc_info()[:2]
if type(t) == type(''):
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
index 35467e4..9589771 100644
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -221,6 +221,11 @@ class SysModuleTest(unittest.TestCase):
sys.setdlopenflags(oldflags)
def test_refcount(self):
+ # n here must be a global in order for this test to pass while
+ # tracing with a python function. Tracing calls PyFrame_FastToLocals
+ # which will add a copy of any locals to the frame object, causing
+ # the reference count to increase by 2 instead of 1.
+ global n
self.assertRaises(TypeError, sys.getrefcount)
c = sys.getrefcount(None)
n = None
diff --git a/Lib/test/test_xmlrpc.py b/Lib/test/test_xmlrpc.py
index c9294b1..409a4f0 100644
--- a/Lib/test/test_xmlrpc.py
+++ b/Lib/test/test_xmlrpc.py
@@ -624,7 +624,11 @@ class CGIHandlerTestCase(unittest.TestCase):
sys.stdin = open("xmldata.txt", "r")
sys.stdout = open(test_support.TESTFN, "w")
- self.cgi.handle_request()
+ os.environ['CONTENT_LENGTH'] = str(len(data))
+ try:
+ self.cgi.handle_request()
+ finally:
+ del os.environ['CONTENT_LENGTH']
sys.stdin.close()
sys.stdout.close()
diff --git a/Misc/NEWS b/Misc/NEWS
index c108964..f518fa9 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -97,6 +97,23 @@ Library
- Issue 1726172: fix IndexError in the case of and empty response in ftplib.
+- In Pdb, prevent the reassignment of __builtin__._ by sys.displayhook on
+ printing out values.
+
+- Issue #4572: added SEEK_* symbolic constants to io module.
+
+- Issue #1665206 (partially): Move imports in cgitb to the top of the module
+ instead of performing them in functions. Helps prevent import deadlocking in
+ threads.
+
+- Issue #5647: MutableSet.__iand__() no longer mutates self during iteration.
+
+- Actually make the SimpleXMLRPCServer CGI handler work.
+
+- Issue #2522: locale.format now checks its first argument to ensure it has
+ been passed only one pattern, avoiding mysterious errors where it appeared
+ that it was failing to do localization.
+
- Issue 2625: added missing iteritems() call to the for loop in
mailbox.MH.get_message().
@@ -508,6 +525,18 @@ Extension Modules
- Issue #4396: The parser module now correctly validates the with statement.
+Tests
+-----
+
+- Issue #5635: Fix running test_sys with tracing enabled.
+
+- regrtest no longer treats ImportError as equivalent to SkipTest. Imports
+ that should cause a test to be skipped are now done using import_module
+ from test support, which does the conversion.
+
+- Issue #5083: New 'gui' resource for regrtest.
+
+
What's New in Python 2.6 final
==============================
diff --git a/Misc/gdbinit b/Misc/gdbinit
index f3cb2ea..e648f16 100644
--- a/Misc/gdbinit
+++ b/Misc/gdbinit
@@ -138,3 +138,16 @@ define pystackv
end
select-frame 0
end
+
+# generally useful macro to print a Unicode string
+def pu
+ set $uni = $arg0
+ set $i = 0
+ while (*$uni && $i++<100)
+ if (*$uni < 0x80)
+ print *(char*)$uni++
+ else
+ print /x *(short*)$uni++
+ end
+ end
+end
diff --git a/README b/README
index a34c9e7..5f14aa2 100644
--- a/README
+++ b/README
@@ -665,75 +665,10 @@ Cygwin: With recent (relative to the time of writing, 2001-12-19)
News regarding these platforms with more recent Cygwin
versions would be appreciated!
-AtheOS: Official support has been stopped as of Python 2.6. All code will be
- removed in Python 2.7 unless a maintainer steps forward for this
- platform.
-
- From Octavian Cerna <tavy at ylabs.com>:
-
- Before building:
-
- Make sure you have shared versions of the libraries you
- want to use with Python. You will have to compile them
- yourself, or download precompiled packages.
-
- Recommended libraries:
-
- ncurses-4.2
- readline-4.2a
- zlib-1.1.4
-
- Build:
-
- $ ./configure --prefix=/usr/python
- $ make
-
- Python is always built as a shared library, otherwise
- dynamic loading would not work.
-
- Testing:
-
- $ make test
-
- Install:
-
- # make install
- # pkgmanager -a /usr/python
-
-
- AtheOS issues:
-
- - large file support: due to a stdio bug in glibc/libio,
- access to large files may not work correctly. fseeko()
- tries to seek to a negative offset. ftello() returns a
- negative offset, it looks like a 32->64bit
- sign-extension issue. The lowlevel functions (open,
- lseek, etc) are OK.
- - sockets: AF_UNIX is defined in the C library and in
- Python, but not implemented in the system.
- - select: poll is available in the C library, but does not
- work (It does not return POLLNVAL for bad fds and
- hangs).
- - posix: statvfs and fstatvfs always return ENOSYS.
- - disabled modules:
- - mmap: not yet implemented in AtheOS
- - nis: broken (on an unconfigured system
- yp_get_default_domain() returns junk instead of
- error)
- - dl: dynamic loading doesn't work via dlopen()
- - resource: getrimit and setrlimit are not yet
- implemented
-
- - if you are getting segmentation faults, you probably are
- low on memory. AtheOS doesn't handle very well an
- out-of-memory condition and simply SEGVs the process.
-
- Tested on:
-
- AtheOS-0.3.7
- gcc-2.95
- binutils-2.10
- make-3.78
+Windows: When executing Python scripts on the command line using file type
+ associations (i.e. starting "script.py" instead of "python script.py"),
+ redirects may not work unless you set a specific registry key. See
+ the Knowledge Base article <http://support.microsoft.com/kb/321788>.
Configuring the bsddb and dbm modules