[Python-checkins] r83593 - in python/branches/release27-maint: Doc/c-api/unicode.rst Doc/c-api/weakref.rst Doc/distutils/builtdist.rst Doc/extending/extending.rst Doc/library/cmd.rst Doc/library/functions.rst Doc/library/os.path.rst Doc/library/zipfile.rst Doc/reference/lexical_analysis.rst Doc/tutorial/classes.rst Lib/curses/wrapper.py Lib/distutils/command/bdist_msi.py Lib/distutils/command/bdist_wininst.py Modules/selectmodule.c PCbuild/readme.txt

georg.brandl python-checkins at python.org
Mon Aug 2 23:44:26 CEST 2010


Author: georg.brandl
Date: Mon Aug  2 23:44:25 2010
New Revision: 83593

Log:
Merged revisions 83536,83546-83548,83550,83554-83555,83558,83563,83565,83571,83574-83575 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r83536 | georg.brandl | 2010-08-02 19:49:25 +0200 (Mo, 02 Aug 2010) | 1 line
  
  #8578: mention danger of not incref'ing weak referenced object.
........
  r83546 | georg.brandl | 2010-08-02 21:16:34 +0200 (Mo, 02 Aug 2010) | 1 line
  
  #7973: Fix distutils options spelling.
........
  r83547 | georg.brandl | 2010-08-02 21:19:26 +0200 (Mo, 02 Aug 2010) | 1 line
  
  #7386: add example that shows that trailing path separators are stripped.
........
  r83548 | georg.brandl | 2010-08-02 21:23:34 +0200 (Mo, 02 Aug 2010) | 1 line
  
  #8172: how does one use a property?
........
  r83550 | georg.brandl | 2010-08-02 21:32:43 +0200 (Mo, 02 Aug 2010) | 1 line
  
  #9451: strengthen warning about __*__ special name usage.
........
  r83554 | georg.brandl | 2010-08-02 21:43:05 +0200 (Mo, 02 Aug 2010) | 1 line
  
  #7280: note about nasmw.exe.
........
  r83555 | georg.brandl | 2010-08-02 21:44:48 +0200 (Mo, 02 Aug 2010) | 1 line
  
  #8861: remove unused variable.
........
  r83558 | georg.brandl | 2010-08-02 22:05:19 +0200 (Mo, 02 Aug 2010) | 1 line
  
  #8648: document UTF-7 codec functions.
........
  r83563 | georg.brandl | 2010-08-02 22:21:21 +0200 (Mo, 02 Aug 2010) | 1 line
  
  #9037: add example how to raise custom exceptions from C code.
........
  r83565 | georg.brandl | 2010-08-02 22:27:20 +0200 (Mo, 02 Aug 2010) | 1 line
  
  #9111: document that do_help() looks at docstrings.
........
  r83571 | georg.brandl | 2010-08-02 22:44:34 +0200 (Mo, 02 Aug 2010) | 1 line
  
  Clarify that abs() is not a namespace.
........
  r83574 | georg.brandl | 2010-08-02 22:47:56 +0200 (Mo, 02 Aug 2010) | 1 line
  
  #6867: epoll.register() returns None.
........
  r83575 | georg.brandl | 2010-08-02 22:52:10 +0200 (Mo, 02 Aug 2010) | 1 line
  
  #9238: zipfile does handle archive comments.
........


Modified:
   python/branches/release27-maint/   (props changed)
   python/branches/release27-maint/Doc/c-api/unicode.rst
   python/branches/release27-maint/Doc/c-api/weakref.rst
   python/branches/release27-maint/Doc/distutils/builtdist.rst
   python/branches/release27-maint/Doc/extending/extending.rst
   python/branches/release27-maint/Doc/library/cmd.rst
   python/branches/release27-maint/Doc/library/functions.rst
   python/branches/release27-maint/Doc/library/os.path.rst
   python/branches/release27-maint/Doc/library/zipfile.rst
   python/branches/release27-maint/Doc/reference/lexical_analysis.rst
   python/branches/release27-maint/Doc/tutorial/classes.rst
   python/branches/release27-maint/Lib/curses/wrapper.py
   python/branches/release27-maint/Lib/distutils/command/bdist_msi.py
   python/branches/release27-maint/Lib/distutils/command/bdist_wininst.py
   python/branches/release27-maint/Modules/selectmodule.c
   python/branches/release27-maint/PCbuild/readme.txt

Modified: python/branches/release27-maint/Doc/c-api/unicode.rst
==============================================================================
--- python/branches/release27-maint/Doc/c-api/unicode.rst	(original)
+++ python/branches/release27-maint/Doc/c-api/unicode.rst	Mon Aug  2 23:44:25 2010
@@ -567,6 +567,38 @@
    *NULL* if an exception was raised by the codec.
 
 
+UTF-7 Codecs
+""""""""""""
+
+These are the UTF-7 codec APIs:
+
+
+.. cfunction:: PyObject* PyUnicode_DecodeUTF7(const char *s, Py_ssize_t size, const char *errors)
+
+   Create a Unicode object by decoding *size* bytes of the UTF-7 encoded string
+   *s*.  Return *NULL* if an exception was raised by the codec.
+
+
+.. cfunction:: PyObject* PyUnicode_DecodeUTF8Stateful(const char *s, Py_ssize_t size, const char *errors, Py_ssize_t *consumed)
+
+   If *consumed* is *NULL*, behave like :cfunc:`PyUnicode_DecodeUTF7`.  If
+   *consumed* is not *NULL*, trailing incomplete UTF-7 base-64 sections will not
+   be treated as an error.  Those bytes will not be decoded and the number of
+   bytes that have been decoded will be stored in *consumed*.
+
+
+.. cfunction:: PyObject* PyUnicode_EncodeUTF7(const Py_UNICODE *s, Py_ssize_t size, int base64SetO, int base64WhiteSpace, const char *errors)
+
+   Encode the :ctype:`Py_UNICODE` buffer of the given size using UTF-7 and
+   return a Python bytes object.  Return *NULL* if an exception was raised by
+   the codec.
+
+   If *base64SetO* is nonzero, "Set O" (punctuation that has no otherwise
+   special meaning) will be encoded in base-64.  If *base64WhiteSpace* is
+   nonzero, whitespace will be encoded in base-64.  Both are set to zero for the
+   Python "utf-7" codec.
+
+
 Unicode-Escape Codecs
 """""""""""""""""""""
 

Modified: python/branches/release27-maint/Doc/c-api/weakref.rst
==============================================================================
--- python/branches/release27-maint/Doc/c-api/weakref.rst	(original)
+++ python/branches/release27-maint/Doc/c-api/weakref.rst	Mon Aug  2 23:44:25 2010
@@ -63,10 +63,17 @@
 .. cfunction:: PyObject* PyWeakref_GetObject(PyObject *ref)
 
    Return the referenced object from a weak reference, *ref*.  If the referent is
-   no longer live, returns ``None``.
+   no longer live, returns :const:`Py_None`.
 
    .. versionadded:: 2.2
 
+   .. warning::
+
+      This function returns a **borrowed reference** to the referenced object.
+      This means that you should always call :cfunc:`Py_INCREF` on the object
+      except if you know that it cannot be destroyed while you are still
+      using it.
+
 
 .. cfunction:: PyObject* PyWeakref_GET_OBJECT(PyObject *ref)
 

Modified: python/branches/release27-maint/Doc/distutils/builtdist.rst
==============================================================================
--- python/branches/release27-maint/Doc/distutils/builtdist.rst	(original)
+++ python/branches/release27-maint/Doc/distutils/builtdist.rst	Mon Aug  2 23:44:25 2010
@@ -176,7 +176,7 @@
 explicitly specify multiple :command:`bdist_\*` commands and their options::
 
    python setup.py bdist_rpm --packager="John Doe <jdoe at example.org>" \
-                   bdist_wininst --target_version="2.0"
+                   bdist_wininst --target-version="2.0"
 
 Creating RPM packages is driven by a :file:`.spec` file, much as using the
 Distutils is driven by the setup script.  To make your life easier, the

Modified: python/branches/release27-maint/Doc/extending/extending.rst
==============================================================================
--- python/branches/release27-maint/Doc/extending/extending.rst	(original)
+++ python/branches/release27-maint/Doc/extending/extending.rst	Mon Aug  2 23:44:25 2010
@@ -228,9 +228,28 @@
 become a dangling pointer. Should it become a dangling pointer, C code which
 raises the exception could cause a core dump or other unintended side effects.
 
-We discuss the use of PyMODINIT_FUNC as a function return type later in this
+We discuss the use of ``PyMODINIT_FUNC`` as a function return type later in this
 sample.
 
+The :exc:`spam.error` exception can be raised in your extension module using a
+call to :cfunc:`PyErr_SetString` as shown below::
+
+   static PyObject *
+   spam_system(PyObject *self, PyObject *args)
+   {
+       const char *command;
+       int sts;
+
+       if (!PyArg_ParseTuple(args, "s", &command))
+           return NULL;
+       sts = system(command);
+       if (sts < 0) {
+           PyErr_SetString(SpamError, "System command failed");
+           return NULL;
+       }
+       return PyLong_FromLong(sts);
+   }
+
 
 .. _backtoexample:
 

Modified: python/branches/release27-maint/Doc/library/cmd.rst
==============================================================================
--- python/branches/release27-maint/Doc/library/cmd.rst	(original)
+++ python/branches/release27-maint/Doc/library/cmd.rst	Mon Aug  2 23:44:25 2010
@@ -80,11 +80,13 @@
    are the beginning and ending indexes of the prefix text, which could be used to
    provide different completion depending upon which position the argument is in.
 
-   All subclasses of :class:`Cmd` inherit a predefined :meth:`do_help`. This
+   All subclasses of :class:`Cmd` inherit a predefined :meth:`do_help`.  This
    method, called with an argument ``'bar'``, invokes the corresponding method
-   :meth:`help_bar`.  With no argument, :meth:`do_help` lists all available help
-   topics (that is, all commands with corresponding :meth:`help_\*` methods), and
-   also lists any undocumented commands.
+   :meth:`help_bar`, and if that is not present, prints the docstring of
+   :meth:`do_bar`, if available.  With no argument, :meth:`do_help` lists all
+   available help topics (that is, all commands with corresponding
+   :meth:`help_\*` methods or commands that have docstrings), and also lists any
+   undocumented commands.
 
 
 .. method:: Cmd.onecmd(str)

Modified: python/branches/release27-maint/Doc/library/functions.rst
==============================================================================
--- python/branches/release27-maint/Doc/library/functions.rst	(original)
+++ python/branches/release27-maint/Doc/library/functions.rst	Mon Aug  2 23:44:25 2010
@@ -874,7 +874,7 @@
 
    *fget* is a function for getting an attribute value, likewise *fset* is a
    function for setting, and *fdel* a function for del'ing, an attribute.  Typical
-   use is to define a managed attribute x::
+   use is to define a managed attribute ``x``::
 
       class C(object):
           def __init__(self):
@@ -888,6 +888,9 @@
               del self._x
           x = property(getx, setx, delx, "I'm the 'x' property.")
 
+   If then *c* is an instance of *C*, ``c.x`` will invoke the getter,
+   ``c.x = value`` will invoke the setter and ``del c.x`` the deleter.
+
    If given, *doc* will be the docstring of the property attribute. Otherwise, the
    property will copy *fget*'s docstring (if it exists).  This makes it possible to
    create read-only properties easily using :func:`property` as a :term:`decorator`::

Modified: python/branches/release27-maint/Doc/library/os.path.rst
==============================================================================
--- python/branches/release27-maint/Doc/library/os.path.rst	(original)
+++ python/branches/release27-maint/Doc/library/os.path.rst	Mon Aug  2 23:44:25 2010
@@ -212,7 +212,9 @@
 .. function:: normpath(path)
 
    Normalize a pathname.  This collapses redundant separators and up-level
-   references so that ``A//B``, ``A/./B`` and ``A/foo/../B`` all become ``A/B``.
+   references so that ``A//B``, ``A/B/``, ``A/./B`` and ``A/foo/../B`` all become
+   ``A/B``.
+
    It does not normalize the case (use :func:`normcase` for that).  On Windows, it
    converts forward slashes to backward slashes. It should be understood that this
    may change the meaning of the path if it contains symbolic links!

Modified: python/branches/release27-maint/Doc/library/zipfile.rst
==============================================================================
--- python/branches/release27-maint/Doc/library/zipfile.rst	(original)
+++ python/branches/release27-maint/Doc/library/zipfile.rst	Mon Aug  2 23:44:25 2010
@@ -15,10 +15,8 @@
 defined in `PKZIP Application Note
 <http://www.pkware.com/documents/casestudies/APPNOTE.TXT>`_.
 
-This module does not currently handle multi-disk ZIP files, or ZIP files
-which have appended comments (although it correctly handles comments
-added to individual archive members---for which see the :ref:`zipinfo-objects`
-documentation). It can handle ZIP files that use the ZIP64 extensions
+This module does not currently handle multi-disk ZIP files.
+It can handle ZIP files that use the ZIP64 extensions
 (that is ZIP files that are more than 4 GByte in size).  It supports
 decryption of encrypted files in ZIP archives, but it currently cannot
 create an encrypted file.  Decryption is extremely slow as it is
@@ -67,7 +65,6 @@
 
    Returns ``True`` if *filename* is a valid ZIP file based on its magic number,
    otherwise returns ``False``.  *filename* may be a file or file-like object too.
-   This module does not currently handle ZIP files which have appended comments.
 
    .. versionchanged:: 2.7
       Support for file and file-like objects.

Modified: python/branches/release27-maint/Doc/reference/lexical_analysis.rst
==============================================================================
--- python/branches/release27-maint/Doc/reference/lexical_analysis.rst	(original)
+++ python/branches/release27-maint/Doc/reference/lexical_analysis.rst	Mon Aug  2 23:44:25 2010
@@ -386,11 +386,12 @@
       information on this convention.
 
 ``__*__``
-   System-defined names.  These names are defined by the interpreter and its
-   implementation (including the standard library); applications should not expect
-   to define additional names using this convention.  The set of names of this
-   class defined by Python may be extended in future versions. See section
-   :ref:`specialnames`.
+   System-defined names. These names are defined by the interpreter and its
+   implementation (including the standard library).  Current system names are
+   discussed in the :ref:`specialnames` section and elsewhere.  More will likely
+   be defined in future versions of Python.  *Any* use of ``__*__`` names, in
+   any context, that does not follow explicitly documented use, is subject to
+   breakage without warning.
 
 ``__*``
    Class-private names.  Names in this category, when used within the context of a

Modified: python/branches/release27-maint/Doc/tutorial/classes.rst
==============================================================================
--- python/branches/release27-maint/Doc/tutorial/classes.rst	(original)
+++ python/branches/release27-maint/Doc/tutorial/classes.rst	Mon Aug  2 23:44:25 2010
@@ -64,7 +64,7 @@
 A *namespace* is a mapping from names to objects.  Most namespaces are currently
 implemented as Python dictionaries, but that's normally not noticeable in any
 way (except for performance), and it may change in the future.  Examples of
-namespaces are: the set of built-in names (functions such as :func:`abs`, and
+namespaces are: the set of built-in names (containing functions such as :func:`abs`, and
 built-in exception names); the global names in a module; and the local names in
 a function invocation.  In a sense the set of attributes of an object also form
 a namespace.  The important thing to know about namespaces is that there is

Modified: python/branches/release27-maint/Lib/curses/wrapper.py
==============================================================================
--- python/branches/release27-maint/Lib/curses/wrapper.py	(original)
+++ python/branches/release27-maint/Lib/curses/wrapper.py	Mon Aug  2 23:44:25 2010
@@ -17,10 +17,9 @@
     wrapper().
     """
 
-    res = None
     try:
         # Initialize curses
-        stdscr=curses.initscr()
+        stdscr = curses.initscr()
 
         # Turn off echoing of keys, and enter cbreak mode,
         # where no buffering is performed on keyboard input

Modified: python/branches/release27-maint/Lib/distutils/command/bdist_msi.py
==============================================================================
--- python/branches/release27-maint/Lib/distutils/command/bdist_msi.py	(original)
+++ python/branches/release27-maint/Lib/distutils/command/bdist_msi.py	Mon Aug  2 23:44:25 2010
@@ -148,7 +148,7 @@
             if not self.skip_build and self.distribution.has_ext_modules()\
                and self.target_version != short_version:
                 raise DistutilsOptionError, \
-                      "target version can only be %s, or the '--skip_build'" \
+                      "target version can only be %s, or the '--skip-build'" \
                       " option must be specified" % (short_version,)
         else:
             self.versions = list(self.all_versions)

Modified: python/branches/release27-maint/Lib/distutils/command/bdist_wininst.py
==============================================================================
--- python/branches/release27-maint/Lib/distutils/command/bdist_wininst.py	(original)
+++ python/branches/release27-maint/Lib/distutils/command/bdist_wininst.py	Mon Aug  2 23:44:25 2010
@@ -95,7 +95,7 @@
             short_version = get_python_version()
             if self.target_version and self.target_version != short_version:
                 raise DistutilsOptionError, \
-                      "target version can only be %s, or the '--skip_build'" \
+                      "target version can only be %s, or the '--skip-build'" \
                       " option must be specified" % (short_version,)
             self.target_version = short_version
 

Modified: python/branches/release27-maint/Modules/selectmodule.c
==============================================================================
--- python/branches/release27-maint/Modules/selectmodule.c	(original)
+++ python/branches/release27-maint/Modules/selectmodule.c	Mon Aug  2 23:44:25 2010
@@ -910,10 +910,9 @@
 }
 
 PyDoc_STRVAR(pyepoll_register_doc,
-"register(fd[, eventmask]) -> bool\n\
+"register(fd[, eventmask]) -> None\n\
 \n\
-Registers a new fd or modifies an already registered fd. register() returns\n\
-True if a new fd was registered or False if the event mask for fd was modified.\n\
+Registers a new fd or modifies an already registered fd.\n\
 fd is the target file descriptor of the operation.\n\
 events is a bit set composed of the various EPOLL constants; the default\n\
 is EPOLL_IN | EPOLL_OUT | EPOLL_PRI.\n\

Modified: python/branches/release27-maint/PCbuild/readme.txt
==============================================================================
--- python/branches/release27-maint/PCbuild/readme.txt	(original)
+++ python/branches/release27-maint/PCbuild/readme.txt	Mon Aug  2 23:44:25 2010
@@ -155,6 +155,8 @@
     You must install the NASM assembler from
         http://nasm.sf.net
     for x86 builds.  Put nasmw.exe anywhere in your PATH.
+    Note: recent releases of nasm only have nasm.exe. Just rename it to 
+    nasmw.exe.
 
     You can also install ActivePerl from
         http://www.activestate.com/Products/ActivePerl/


More information about the Python-checkins mailing list