]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Merged revisions 70282-70283 via svnmerge from
authorBenjamin Peterson <benjamin@python.org>
Mon, 9 Mar 2009 21:12:36 +0000 (21:12 +0000)
committerBenjamin Peterson <benjamin@python.org>
Mon, 9 Mar 2009 21:12:36 +0000 (21:12 +0000)
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r70282 | benjamin.peterson | 2009-03-09 16:04:33 -0500 (Mon, 09 Mar 2009) | 73 lines

  Merged revisions 69998-69999,70002,70022-70023,70025-70026,70061,70086,70145,70171,70183,70188,70235,70244,70275,70281 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r69998 | benjamin.peterson | 2009-02-26 13:04:40 -0600 (Thu, 26 Feb 2009) | 1 line

    the startship is rather outdated now
  ........
    r69999 | benjamin.peterson | 2009-02-26 13:05:59 -0600 (Thu, 26 Feb 2009) | 1 line

    comma
  ........
    r70002 | andrew.kuchling | 2009-02-26 16:34:30 -0600 (Thu, 26 Feb 2009) | 1 line

    The curses panel library is now supported
  ........
    r70022 | georg.brandl | 2009-02-27 10:23:18 -0600 (Fri, 27 Feb 2009) | 1 line

    #5361: fix typo.
  ........
    r70023 | georg.brandl | 2009-02-27 10:39:26 -0600 (Fri, 27 Feb 2009) | 1 line

    #5363: fix cmpfiles() docs. Another instance where a prose description is twice as long as the code.
  ........
    r70025 | georg.brandl | 2009-02-27 10:52:55 -0600 (Fri, 27 Feb 2009) | 1 line

    #5344: fix punctuation.
  ........
    r70026 | georg.brandl | 2009-02-27 10:59:03 -0600 (Fri, 27 Feb 2009) | 1 line

    #5365: add quick look conversion table for different time representations.
  ........
    r70061 | hirokazu.yamamoto | 2009-02-28 09:24:00 -0600 (Sat, 28 Feb 2009) | 1 line

    Binary flag is needed on windows.
  ........
    r70086 | benjamin.peterson | 2009-03-01 21:35:12 -0600 (Sun, 01 Mar 2009) | 1 line

    fix a silly problem of caching gone wrong #5401
  ........
    r70145 | benjamin.peterson | 2009-03-03 16:51:57 -0600 (Tue, 03 Mar 2009) | 1 line

    making the writing more formal
  ........
    r70171 | facundo.batista | 2009-03-04 15:18:17 -0600 (Wed, 04 Mar 2009) | 3 lines

    Fixed a typo.
  ........
    r70183 | benjamin.peterson | 2009-03-04 18:17:57 -0600 (Wed, 04 Mar 2009) | 1 line

    add example
  ........
    r70188 | hirokazu.yamamoto | 2009-03-05 03:34:14 -0600 (Thu, 05 Mar 2009) | 1 line

    Fixed memory leak on failure.
  ........
    r70235 | benjamin.peterson | 2009-03-07 18:21:17 -0600 (Sat, 07 Mar 2009) | 1 line

    fix funky indentation
  ........
    r70244 | martin.v.loewis | 2009-03-08 09:06:19 -0500 (Sun, 08 Mar 2009) | 2 lines

    Add Chris Withers.
  ........
    r70275 | georg.brandl | 2009-03-09 11:35:48 -0500 (Mon, 09 Mar 2009) | 2 lines

    Add missing space.
  ........
    r70281 | benjamin.peterson | 2009-03-09 15:38:56 -0500 (Mon, 09 Mar 2009) | 1 line

    gzip and bz2 are context managers
  ........
................
  r70283 | benjamin.peterson | 2009-03-09 16:08:47 -0500 (Mon, 09 Mar 2009) | 1 line

  fix versionchanged
................

14 files changed:
Doc/howto/curses.rst
Doc/library/bz2.rst
Doc/library/filecmp.rst
Doc/library/gzip.rst
Doc/library/mmap.rst
Doc/library/stdtypes.rst
Doc/library/struct.rst
Doc/library/symtable.rst
Doc/library/time.rst
Doc/whatsnew/2.6.rst
Lib/mimetypes.py
Misc/NEWS
Misc/developers.txt
Objects/bytearrayobject.c

index 1c191adc12cee2f5f62bd8c96941ffc2fed4fb27..53ef7deb9d7a0cf43a16e7f4c25e565f25af7501 100644 (file)
@@ -426,7 +426,7 @@ quirks, and provide complete lists of all the functions, attributes, and
 Because the curses API is so large, some functions aren't supported in the
 Python interface, not because they're difficult to implement, but because no one
 has needed them yet.  Feel free to add them and then submit a patch.  Also, we
-don't yet have support for the menus or panels libraries associated with
+don't yet have support for the menu library associated with
 ncurses; feel free to add that.
 
 If you write an interesting little program, feel free to contribute it as
index cde574992666363cd009800a9f2f688f09a397f0..3666e908177033835612f18987724b5f31f91472 100644 (file)
@@ -58,7 +58,6 @@ Handling of compressed files is offered by the :class:`BZ2File` class.
    reading. Instances support iteration in the same way as normal :class:`file`
    instances.
 
-
    .. method:: close()
 
       Close the file. Sets data attribute :attr:`closed` to true. A closed file
index 3377d974364b8d53c78b81a967a020975fd6823a..11d74ba770c766837804478933067fde47c3a7f8 100644 (file)
@@ -31,17 +31,24 @@ The :mod:`filecmp` module defines the following functions:
 
 .. function:: cmpfiles(dir1, dir2, common[, shallow])
 
-   Returns three lists of file names: *match*, *mismatch*, *errors*.  *match*
-   contains the list of files match in both directories, *mismatch* includes the
-   names of those that don't, and *errros* lists the names of files which could not
-   be compared.  Files may be listed in *errors* because the user may lack
-   permission to read them or many other reasons, but always that the comparison
-   could not be done for some reason.
-
-   The *common* parameter is a list of file names found in both directories. The
-   *shallow* parameter has the same meaning and default value as for
+   Compare the files in the two directories *dir1* and *dir2* whose names are
+   given by *common*.
+
+   Returns three lists of file names: *match*, *mismatch*,
+   *errors*.  *match* contains the list of files that match, *mismatch* contains
+   the names of those that don't, and *errors* lists the names of files which
+   could not be compared.  Files are listed in *errors* if they don't exist in
+   one of the directories, the user lacks permission to read them or if the
+   comparison could not be done for some other reason.
+
+   The *shallow* parameter has the same meaning and default value as for
    :func:`filecmp.cmp`.
 
+   For example, ``cmpfiles('a', 'b', ['c', 'd/e'])`` will compare ``a/c`` with
+   ``b/c`` and ``a/d/e`` with ``b/d/e``.  ``'c'`` and ``'d/e'`` will each be in
+   one of the three returned lists.
+
+
 Example::
 
    >>> import filecmp
index c6f9ef82bd3182d2242a43a947b310b1c26cafac..dd25f777332bfeb5009d173fc5b19bd1b17df97b 100644 (file)
@@ -52,6 +52,15 @@ The module defines the following items:
    level of compression; ``1`` is fastest and produces the least compression, and
    ``9`` is slowest and produces the most compression.  The default is ``9``.
 
+   The *mtime* argument is an optional numeric timestamp to be written to
+   the stream when compressing.  All :program:`gzip` compressed streams are
+   required to contain a timestamp.  If omitted or ``None``, the current
+   time is used.  This module ignores the timestamp when decompressing;
+   however, some programs, such as :program:`gunzip`\ , make use of it.
+   The format of the timestamp is the same as that of the return value of
+   ``time.time()`` and of the ``st_mtime`` member of the object returned
+   by ``os.stat()``.
+
    Calling a :class:`GzipFile` object's :meth:`close` method does not close
    *fileobj*, since you might wish to append more material after the compressed
    data.  This also allows you to pass a :class:`StringIO` object opened for
index e85a9646f636177c1872bdc65579a6f6d350b17a..ceca29a010250baaf3e6fc3d68ddc414d5db10f2 100644 (file)
@@ -93,10 +93,10 @@ To map anonymous memory, -1 should be passed as the fileno along with the length
       import mmap
 
       # write a simple example file
-      with open("hello.txt", "w") as f:
+      with open("hello.txt", "wb") as f:
           f.write("Hello Python!\n")
 
-      with open("hello.txt", "r+") as f:
+      with open("hello.txt", "r+b") as f:
           # memory-map the file, size 0 means whole file
           map = mmap.mmap(f.fileno(), 0)
           # read content via standard file methods
index 24fd9a7e58c916736cd1ed174a61005d2c31eaba..9a07c32b1a911ba020574635761aef1fb9da981e 100644 (file)
@@ -1247,7 +1247,7 @@ The conversion types are:
 +------------+-----------------------------------------------------+-------+
 | ``'o'``    | Signed octal value.                                 | \(1)  |
 +------------+-----------------------------------------------------+-------+
-| ``'u'``    | Obselete type -- it is identical to ``'d'``.        | \(7)  |
+| ``'u'``    | Obsolete type -- it is identical to ``'d'``.        | \(7)  |
 +------------+-----------------------------------------------------+-------+
 | ``'x'``    | Signed hexadecimal (lowercase).                     | \(2)  |
 +------------+-----------------------------------------------------+-------+
index 7802fdb1a003126177cbd6784c556aba57c187da..bd8a7a952f0aa9669f326574d3287f0d2b5d2340 100644 (file)
@@ -48,7 +48,7 @@ The module defines the following exception and functions:
 
 .. function:: unpack_from(fmt, buffer[,offset=0])
 
-   Unpack the *buffer* according to tthe given format. The result is a tuple even
+   Unpack the *buffer* according to the given format. The result is a tuple even
    if it contains exactly one item. The *buffer* must contain at least the amount
    of data required by the format (``len(buffer[offset:])`` must be at least
    ``calcsize(fmt)``).
index ee2482377decf39725a55cee727de85366e8c8fd..0d681b07fdd500c17c6268ac08e23b94b5e31cc9 100644 (file)
@@ -164,6 +164,12 @@ Examining Symbol Tables
       If the name is used as the target of a function or class statement, this
       will be true.
 
+      For example::
+
+         >>> table = symtable.symtable("def some_func(): pass", "string", "exec")
+         >>> table.lookup("some_func").is_namespace()
+         True
+
       Note that a single name can be bound to multiple objects.  If the result
       is ``True``, the name may also be bound to other objects, like an int or
       list, that does not introduce a new namespace.
index 0e82b7de2b1c3af939ccbe796f6f9558b63348e8..46d972a3f0e7cea7f4bb45440c238ce584f6a394 100644 (file)
@@ -114,6 +114,25 @@ An explanation of some terminology and conventions is in order.
   :class:`struct_time`, or having elements of the wrong type, a :exc:`TypeError`
   is raised.
 
+* Use the following functions to convert between time representations:
+
+  +-------------------------+-------------------------+-------------------------+
+  | From                    | To                      | Use                     |
+  +=========================+=========================+=========================+
+  | seconds since the epoch | :class:`struct_time` in | :func:`gmtime`          |
+  |                         | UTC                     |                         |
+  +-------------------------+-------------------------+-------------------------+
+  | seconds since the epoch | :class:`struct_time` in | :func:`localtime`       |
+  |                         | local time              |                         |
+  +-------------------------+-------------------------+-------------------------+
+  | :class:`struct_time` in | seconds since the epoch | :func:`calendar.timegm` |
+  | UTC                     |                         |                         |
+  +-------------------------+-------------------------+-------------------------+
+  | :class:`struct_time` in | seconds since the epoch | :func:`mktime`          |
+  | local time              |                         |                         |
+  +-------------------------+-------------------------+-------------------------+
+
+
 The module defines the following functions and data items:
 
 
index 65176097ff9b79fc7d4cb95549189405b505076e..f0e9eb4c087a504b93949f62f7ed820020cd772c 100644 (file)
@@ -274,7 +274,7 @@ structure is::
 
 The expression is evaluated, and it should result in an object that supports the
 context management protocol (that is, has :meth:`__enter__` and :meth:`__exit__`
-methods.
+methods).
 
 The object's :meth:`__enter__` is called before *with-block* is executed and
 therefore can run set-up code. It also may return a value that is bound to the
index 5812c0c573b9f862847a5a63faf9578d95dbd295..f25e133ebf048a274d7c3a93eae92745a686da68 100644 (file)
@@ -237,7 +237,8 @@ def guess_type(url, strict=True):
     Optional `strict' argument when false adds a bunch of commonly found, but
     non-standard types.
     """
-    init()
+    if not inited:
+        init()
     return guess_type(url, strict)
 
 
@@ -254,7 +255,8 @@ def guess_all_extensions(type, strict=True):
     Optional `strict' argument when false adds a bunch of commonly found,
     but non-standard types.
     """
-    init()
+    if not inited:
+        init()
     return guess_all_extensions(type, strict)
 
 def guess_extension(type, strict=True):
@@ -269,7 +271,8 @@ def guess_extension(type, strict=True):
     Optional `strict' argument when false adds a bunch of commonly found,
     but non-standard types.
     """
-    init()
+    if not inited:
+        init()
     return guess_extension(type, strict)
 
 def add_type(type, ext, strict=True):
@@ -284,7 +287,8 @@ def add_type(type, ext, strict=True):
     list of standard types, else to the list of non-standard
     types.
     """
-    init()
+    if not inited:
+        init()
     return add_type(type, ext, strict)
 
 
index 7b30f20a661f2059f7f06f094411067ada3c7776..3734db4bc6634b72bd7469101797d7ee281e1130 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -159,6 +159,9 @@ Library
 
 - Issue #5385: Fixed mmap crash after resize failure on windows.
 
+- Issue #5401: Fixed a performance problem in mimetypes when ``from mimetypes
+  import guess_extension`` was used.
+
 - Issue #1733986: Fixed mmap crash in accessing elements of second map object
   with same tagname but larger size than first map. (Windows)
 
index b4f6c702aade973ad7a9c3f6abc285c4d9f4ba2d..c32a4e9b562547f6b237cec074751379947cd639 100644 (file)
@@ -17,7 +17,10 @@ the format to accommodate documentation needs as they arise.
 Permissions History
 -------------------
 
-- Tarek Ziadé as given SVN access on Decmeber 21 2008 by NCN,
+- Chris Withers was given SVN access on March 8 2009 by MvL,
+  after recommendation by GvR.
+
+- Tarek Ziadé was given SVN access on December 21 2008 by NCN,
   for maintenance of distutils.
 
 - Hirokazu Yamamoto was given SVN access on August 12 2008 by MvL,
index fe7c732f15c6d322a6e09c71a0126baba6229387..3362bb0309553d64796818427a0f0c60e5980010 100644 (file)
@@ -249,7 +249,7 @@ PyByteArray_Concat(PyObject *a, PyObject *b)
 
     size = va.len + vb.len;
     if (size < 0) {
-            return PyErr_NoMemory();
+            PyErr_NoMemory();
             goto done;
     }
 
@@ -1019,11 +1019,11 @@ bytes_richcompare(PyObject *self, PyObject *other, int op)
 static void
 bytes_dealloc(PyByteArrayObject *self)
 {
-       if (self->ob_exports > 0) {
-               PyErr_SetString(PyExc_SystemError,
+    if (self->ob_exports > 0) {
+        PyErr_SetString(PyExc_SystemError,
                        "deallocated bytearray object has exported buffers");
-               PyErr_Print();
-       }
+        PyErr_Print();
+    }
     if (self->ob_bytes != 0) {
         PyMem_Free(self->ob_bytes);
     }