]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Merged revisions 67525-67527,67529,67548-67549,67551-67552,67555,67578,67586,67593...
authorGeorg Brandl <georg@python.org>
Sun, 7 Dec 2008 15:52:13 +0000 (15:52 +0000)
committerGeorg Brandl <georg@python.org>
Sun, 7 Dec 2008 15:52:13 +0000 (15:52 +0000)
svn+ssh://svn.python.org/python/branches/py3k

........
  r67525 | georg.brandl | 2008-12-04 19:18:16 +0100 (Thu, 04 Dec 2008) | 2 lines

  #4527: fix "unicode or string".
........
  r67526 | georg.brandl | 2008-12-04 19:19:41 +0100 (Thu, 04 Dec 2008) | 2 lines

  #4526: fix typo.
........
  r67527 | georg.brandl | 2008-12-04 19:21:46 +0100 (Thu, 04 Dec 2008) | 2 lines

  #4521: fix getcwdu() vs getcwdb().
........
  r67529 | georg.brandl | 2008-12-04 19:28:38 +0100 (Thu, 04 Dec 2008) | 2 lines

  #4513: remove traces of zip() docstring from when it was izip().
........
  r67548 | guido.van.rossum | 2008-12-05 06:49:12 +0100 (Fri, 05 Dec 2008) | 3 lines

  Tweak verbiage and markup for relative/absolute import.  Backport candidate.
  (I guess *all* changes to this file should be backported to the 3.0 branch.)
........
  r67549 | martin.v.loewis | 2008-12-05 08:20:46 +0100 (Fri, 05 Dec 2008) | 2 lines

  Send mails to python-checkins now.
........
  r67551 | georg.brandl | 2008-12-05 08:32:56 +0100 (Fri, 05 Dec 2008) | 2 lines

  #4355: refer to urlencode in the correct module.
........
  r67552 | georg.brandl | 2008-12-05 08:45:54 +0100 (Fri, 05 Dec 2008) | 2 lines

  #4401: Re-add os.extsep.
........
  r67555 | georg.brandl | 2008-12-05 08:57:51 +0100 (Fri, 05 Dec 2008) | 2 lines

  #4427: fix arguments for "y" BuildValue type.
........
  r67578 | georg.brandl | 2008-12-05 16:12:15 +0100 (Fri, 05 Dec 2008) | 2 lines

  #4504, #4505: Update noddy examples in "Extending & Embedding".
........
  r67586 | georg.brandl | 2008-12-05 16:55:41 +0100 (Fri, 05 Dec 2008) | 2 lines

  Manually merged r67583: move __import__ doc to the bottom.
........
  r67593 | georg.brandl | 2008-12-05 19:04:41 +0100 (Fri, 05 Dec 2008) | 2 lines

  #4550: fix 2.x syntax in webservers howto.
........
  r67594 | georg.brandl | 2008-12-05 19:06:58 +0100 (Fri, 05 Dec 2008) | 2 lines

  #4549: Mention nonlocal statement in tutorial section about scoping.
........
  r67596 | georg.brandl | 2008-12-05 19:31:51 +0100 (Fri, 05 Dec 2008) | 2 lines

  Use :samp: role.
........
  r67605 | georg.brandl | 2008-12-06 09:12:11 +0100 (Sat, 06 Dec 2008) | 2 lines

  #4557: remove 'c' typecode from array docs and add a note in whatsnew.
........
  r67606 | georg.brandl | 2008-12-06 09:14:46 +0100 (Sat, 06 Dec 2008) | 2 lines

  cmp() is not really gone.
........
  r67609 | georg.brandl | 2008-12-06 15:28:56 +0100 (Sat, 06 Dec 2008) | 2 lines

  #4562: fix zip() examples.
........
  r67612 | skip.montanaro | 2008-12-06 18:25:02 +0100 (Sat, 06 Dec 2008) | 2 lines

  issue 4483 - _dbm build failures on systems with gdbm_compat lib.
........
  r67616 | benjamin.peterson | 2008-12-06 19:32:13 +0100 (Sat, 06 Dec 2008) | 1 line

  there are only four asdl builtin types in py3k
........
  r67617 | benjamin.peterson | 2008-12-06 19:33:20 +0100 (Sat, 06 Dec 2008) | 1 line

  update version number
........
  r67632 | georg.brandl | 2008-12-07 15:09:20 +0100 (Sun, 07 Dec 2008) | 2 lines

  #4576: fix ob_type access.
........
  r67635 | benjamin.peterson | 2008-12-07 15:58:03 +0100 (Sun, 07 Dec 2008) | 1 line

  document how to deal with binary standard streams
........
  r67638 | benjamin.peterson | 2008-12-07 16:07:02 +0100 (Sun, 07 Dec 2008) | 1 line

  remove extraneous 'text'
........

22 files changed:
Doc/c-api/arg.rst
Doc/extending/newtypes.rst
Doc/howto/webservers.rst
Doc/includes/noddy.c
Doc/includes/noddy2.c
Doc/includes/noddy3.c
Doc/includes/noddy4.c
Doc/includes/shoddy.c
Doc/includes/typestruct.h
Doc/library/array.rst
Doc/library/fractions.rst
Doc/library/functions.rst
Doc/library/sys.rst
Doc/library/urllib.parse.rst
Doc/library/urllib.request.rst
Doc/tutorial/classes.rst
Doc/whatsnew/3.0.rst
Lib/os.py
Misc/build.sh
Parser/Python.asdl
Python/Python-ast.c
Python/bltinmodule.c

index d64cc5c3abce50a3cb8585173efd4ac6676203e2..e90ac3972b5e51e607a88ef9a582043280dc5b18 100644 (file)
@@ -438,7 +438,7 @@ and the following format units are left untouched.
       Convert a C string and its length to a Python object.  If the C string pointer
       is *NULL*, the length is ignored and ``None`` is returned.
 
-   ``y`` (bytes) [char \*, int]
+   ``y`` (bytes) [char \*]
       This converts a C string to a Python :func:`bytes` object.  If the C
       string pointer is *NULL*, ``None`` is returned.
 
index 931c2b5c8db65ee7c58591a990c5136eefe4cd9a..e6b52c5c556c80cb90f2a6a002aa277f8a3afd2a 100644 (file)
@@ -73,26 +73,25 @@ Moving on, we come to the crunch --- the type object. ::
 
    static PyTypeObject noddy_NoddyType = {
        PyObject_HEAD_INIT(NULL)
-       0,                         /*ob_size*/
-       "noddy.Noddy",             /*tp_name*/
-       sizeof(noddy_NoddyObject), /*tp_basicsize*/
-       0,                         /*tp_itemsize*/
-       0,                         /*tp_dealloc*/
-       0,                         /*tp_print*/
-       0,                         /*tp_getattr*/
-       0,                         /*tp_setattr*/
-       0,                         /*tp_compare*/
-       0,                         /*tp_repr*/
-       0,                         /*tp_as_number*/
-       0,                         /*tp_as_sequence*/
-       0,                         /*tp_as_mapping*/
-       0,                         /*tp_hash */
-       0,                         /*tp_call*/
-       0,                         /*tp_str*/
-       0,                         /*tp_getattro*/
-       0,                         /*tp_setattro*/
-       0,                         /*tp_as_buffer*/
-       Py_TPFLAGS_DEFAULT,        /*tp_flags*/
+       "noddy.Noddy",             /* tp_name */
+       sizeof(noddy_NoddyObject), /* tp_basicsize */
+       0,                         /* tp_itemsize */
+       0,                         /* tp_dealloc */
+       0,                         /* tp_print */
+       0,                         /* tp_getattr */
+       0,                         /* tp_setattr */
+       0,                         /* tp_compare */
+       0,                         /* tp_repr */
+       0,                         /* tp_as_number */
+       0,                         /* tp_as_sequence */
+       0,                         /* tp_as_mapping */
+       0,                         /* tp_hash  */
+       0,                         /* tp_call */
+       0,                         /* tp_str */
+       0,                         /* tp_getattro */
+       0,                         /* tp_setattro */
+       0,                         /* tp_as_buffer */
+       Py_TPFLAGS_DEFAULT,        /* tp_flags */
        "Noddy objects",           /* tp_doc */
    };
 
@@ -114,13 +113,6 @@ as the type of a type object is "type", but this isn't strictly conforming C and
 some compilers complain.  Fortunately, this member will be filled in for us by
 :cfunc:`PyType_Ready`. ::
 
-   0,                          /* ob_size */
-
-The :attr:`ob_size` field of the header is not used; its presence in the type
-structure is a historical artifact that is maintained for binary compatibility
-with extension modules compiled for older versions of Python.  Always set this
-field to zero. ::
-
    "noddy.Noddy",              /* tp_name */
 
 The name of our type.  This will appear in the default textual representation of
@@ -162,7 +154,7 @@ for now.
 Skipping a number of type methods that we don't provide, we set the class flags
 to :const:`Py_TPFLAGS_DEFAULT`. ::
 
-   Py_TPFLAGS_DEFAULT,        /*tp_flags*/
+   Py_TPFLAGS_DEFAULT,        /* tp_flags */
 
 All types should include this constant in their flags.  It enables all of the
 members defined by the current version of Python.
@@ -193,7 +185,7 @@ All the other type methods are *NULL*, so we'll go over them later --- that's
 for a later section!
 
 Everything else in the file should be familiar, except for some code in
-:cfunc:`initnoddy`::
+:cfunc:`PyInit_noddy`::
 
    if (PyType_Ready(&noddy_NoddyType) < 0)
        return;
@@ -273,7 +265,7 @@ allocation and deallocation.  At a minimum, we need a deallocation method::
    {
        Py_XDECREF(self->first);
        Py_XDECREF(self->last);
-       self->ob_type->tp_free((PyObject*)self);
+       Py_TYPE(self)->tp_free((PyObject*)self);
    }
 
 which is assigned to the :attr:`tp_dealloc` member::
@@ -523,8 +515,8 @@ object being created or used, so all we need to do is to add the
 
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
 
-We rename :cfunc:`initnoddy` to :cfunc:`initnoddy2` and update the module name
-passed to :cfunc:`Py_InitModule3`.
+We rename :cfunc:`PyInit_noddy` to :cfunc:`PyInit_noddy2` and update the module
+name in the :ctype:`PyModuleDef` struct.
 
 Finally, we update our :file:`setup.py` file to build the new module::
 
@@ -767,7 +759,7 @@ to use it::
    Noddy_dealloc(Noddy* self)
    {
        Noddy_clear(self);
-       self->ob_type->tp_free((PyObject*)self);
+       Py_TYPE(self)->tp_free((PyObject*)self);
    }
 
 Notice the use of a temporary variable in :cfunc:`Noddy_clear`. We use the
@@ -794,7 +786,7 @@ be simplified::
 
 Finally, we add the :const:`Py_TPFLAGS_HAVE_GC` flag to the class flags::
 
-   Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+   Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* tp_flags */
 
 That's pretty much it.  If we had written custom :attr:`tp_alloc` or
 :attr:`tp_free` slots, we'd need to modify them for cyclic-garbage collection.
@@ -865,20 +857,20 @@ fill that field directly with the :cfunc:`PyList_Type`; it can be done later in
 the module's :cfunc:`init` function. ::
 
    PyMODINIT_FUNC
-   initshoddy(void)
+   PyInit_shoddy(void)
    {
-       PyObject *m;
+        PyObject *m;
 
-       ShoddyType.tp_base = &PyList_Type;
-       if (PyType_Ready(&ShoddyType) < 0)
-               return;
+        ShoddyType.tp_base = &PyList_Type;
+        if (PyType_Ready(&ShoddyType) < 0)
+            return NULL;
 
-       m = Py_InitModule3("shoddy", NULL, "Shoddy module");
-       if (m == NULL)
-               return;
+        m = PyModule_Create(&shoddymodule);
+        if (m == NULL)
+            return NULL;
 
-       Py_INCREF(&ShoddyType);
-       PyModule_AddObject(m, "Shoddy", (PyObject *) &ShoddyType);
+        Py_INCREF(&ShoddyType);
+        PyModule_AddObject(m, "Shoddy", (PyObject *) &ShoddyType);
    }
 
 Before calling :cfunc:`PyType_Ready`, the type structure must have the
@@ -960,7 +952,7 @@ needs to be freed here as well.  Here is an example of this function::
    newdatatype_dealloc(newdatatypeobject * obj)
    {
        free(obj->obj_UnderlyingDatatypePtr);
-       obj->ob_type->tp_free(obj);
+       Py_TYPE(obj)->tp_free(obj);
    }
 
 .. index::
@@ -1003,7 +995,7 @@ done.  This can be done using the :cfunc:`PyErr_Fetch` and
 
            Py_DECREF(self->my_callback);
        }
-       obj->ob_type->tp_free((PyObject*)self);
+       Py_TYPE(obj)->tp_free((PyObject*)self);
    }
 
 
@@ -1241,49 +1233,50 @@ example that simply raises an exception; if this were really all you wanted, the
        return -1;
    }
 
-
-Object Comparison
------------------
-
-::
-
-   cmpfunc tp_compare;
-
-The :attr:`tp_compare` handler is called when comparisons are needed and the
-object does not implement the specific rich comparison method which matches the
-requested comparison.  (It is always used if defined and the
-:cfunc:`PyObject_Compare` or :cfunc:`PyObject_Cmp` functions are used, or if
-:func:`cmp` is used from Python.) It is analogous to the :meth:`__cmp__` method.
-This function should return ``-1`` if *obj1* is less than *obj2*, ``0`` if they
-are equal, and ``1`` if *obj1* is greater than *obj2*. (It was previously
-allowed to return arbitrary negative or positive integers for less than and
-greater than, respectively; as of Python 2.2, this is no longer allowed.  In the
-future, other return values may be assigned a different meaning.)
-
-A :attr:`tp_compare` handler may raise an exception.  In this case it should
-return a negative value.  The caller has to test for the exception using
-:cfunc:`PyErr_Occurred`.
-
-Here is a sample implementation::
-
-   static int
-   newdatatype_compare(newdatatypeobject * obj1, newdatatypeobject * obj2)
-   {
-       long result;
-
-       if (obj1->obj_UnderlyingDatatypePtr->size <
-           obj2->obj_UnderlyingDatatypePtr->size) {
-           result = -1;
-       }
-       else if (obj1->obj_UnderlyingDatatypePtr->size >
-                obj2->obj_UnderlyingDatatypePtr->size) {
-           result = 1;
-       }
-       else {
-           result = 0;
-       }
-       return result;
-   }
+.. XXX tp_compare is dead; need to rewrite for tp_richcompare!  
+
+   Object Comparison
+   -----------------
+    
+   ::
+    
+      cmpfunc tp_compare;
+    
+   The :attr:`tp_compare` handler is called when comparisons are needed and the
+   object does not implement the specific rich comparison method which matches the
+   requested comparison.  (It is always used if defined and the
+   :cfunc:`PyObject_Compare` or :cfunc:`PyObject_Cmp` functions are used, or if
+   :func:`cmp` is used from Python.) It is analogous to the :meth:`__cmp__` method.
+   This function should return ``-1`` if *obj1* is less than *obj2*, ``0`` if they
+   are equal, and ``1`` if *obj1* is greater than *obj2*. (It was previously
+   allowed to return arbitrary negative or positive integers for less than and
+   greater than, respectively; as of Python 2.2, this is no longer allowed.  In the
+   future, other return values may be assigned a different meaning.)
+    
+   A :attr:`tp_compare` handler may raise an exception.  In this case it should
+   return a negative value.  The caller has to test for the exception using
+   :cfunc:`PyErr_Occurred`.
+    
+   Here is a sample implementation::
+    
+      static int
+      newdatatype_compare(newdatatypeobject * obj1, newdatatypeobject * obj2)
+      {
+          long result;
+    
+          if (obj1->obj_UnderlyingDatatypePtr->size <
+              obj2->obj_UnderlyingDatatypePtr->size) {
+              result = -1;
+          }
+          else if (obj1->obj_UnderlyingDatatypePtr->size >
+                   obj2->obj_UnderlyingDatatypePtr->size) {
+              result = 1;
+          }
+          else {
+              result = 0;
+          }
+          return result;
+      }
 
 
 Abstract Protocol Support
index 97c2267b7e6f1060e452247cbcc6f7cfff2b9f4b..401f94e90656175055a72cbd8c92ce0e4816f9d6 100644 (file)
@@ -101,10 +101,10 @@ simple CGI program::
     # enable debugging
     import cgitb; cgitb.enable()
 
-    print "Content-Type: text/plain;charset=utf-8"
-    print
+    print("Content-Type: text/plain;charset=utf-8")
+    print()
 
-    print "Hello World!"
+    print("Hello World!")
 
 You need to write this code into a file with a ``.py`` or ``.cgi`` extension,
 this depends on your web server configuration.  Depending on your web server
@@ -278,8 +278,8 @@ following WSGI-application::
     #!/usr/bin/env python
     # -*- coding: UTF-8 -*-
 
-    from cgi import escape
     import sys, os
+    from cgi import escape
     from flup.server.fcgi import WSGIServer
 
     def app(environ, start_response):
@@ -288,7 +288,8 @@ following WSGI-application::
         yield '<h1>FastCGI Environment</h1>'
         yield '<table>'
         for k, v in sorted(environ.items()):
-             yield '<tr><th>%s</th><td>%s</td></tr>' % (escape(k), escape(v))
+             yield '<tr><th>{0}</th><td>{1}</td></tr>'.format(
+                 escape(k), escape(v))
         yield '</table>'
 
     WSGIServer(app).run()
@@ -476,8 +477,8 @@ placeholders.
 Python already includes such simple templates::
 
     # a simple template
-    template = "<html><body><h1>Hello %s!</h1></body></html>"
-    print template % "Reader"
+    template = "<html><body><h1>Hello {who}!</h1></body></html>"
+    print(template.format(who="Reader"))
 
 The Python standard library also includes some more advanced templates usable
 through :class:`string.Template`, but in HTML templates it is needed to use
index ec2d669dd1e8bf0fb31e30c4535009e277eb1890..26a49a91218745983a6800154a570070c5918113 100644 (file)
@@ -7,47 +7,48 @@ typedef struct {
 
 static PyTypeObject noddy_NoddyType = {
     PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "noddy.Noddy",             /*tp_name*/
-    sizeof(noddy_NoddyObject), /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    0,                         /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT,        /*tp_flags*/
+    "noddy.Noddy",             /* tp_name */
+    sizeof(noddy_NoddyObject), /* tp_basicsize */
+    0,                         /* tp_itemsize */
+    0,                         /* tp_dealloc */
+    0,                         /* tp_print */
+    0,                         /* tp_getattr */
+    0,                         /* tp_setattr */
+    0,                         /* tp_compare */
+    0,                         /* tp_repr */
+    0,                         /* tp_as_number */
+    0,                         /* tp_as_sequence */
+    0,                         /* tp_as_mapping */
+    0,                         /* tp_hash  */
+    0,                         /* tp_call */
+    0,                         /* tp_str */
+    0,                         /* tp_getattro */
+    0,                         /* tp_setattro */
+    0,                         /* tp_as_buffer */
+    Py_TPFLAGS_DEFAULT,        /* tp_flags */
     "Noddy objects",           /* tp_doc */
 };
 
-static PyMethodDef noddy_methods[] = {
-    {NULL}  /* Sentinel */
+static PyModuleDef noddymodule = {
+    PyModuleDef_HEAD_INIT,
+    "noddy",
+    "Example module that creates an extension type.",
+    -1,
+    NULL, NULL, NULL, NULL, NULL
 };
 
-#ifndef PyMODINIT_FUNC /* declarations for DLL import/export */
-#define PyMODINIT_FUNC void
-#endif
 PyMODINIT_FUNC
-initnoddy(void) 
+PyInit_noddy(void) 
 {
     PyObject* m;
 
     noddy_NoddyType.tp_new = PyType_GenericNew;
     if (PyType_Ready(&noddy_NoddyType) < 0)
-        return;
+        return NULL;
 
-    m = Py_InitModule3("noddy", noddy_methods,
-                       "Example module that creates an extension type.");
+    m = PyModule_Create(&noddymodule);
+    if (m == NULL)
+        return NULL;
 
     Py_INCREF(&noddy_NoddyType);
     PyModule_AddObject(m, "Noddy", (PyObject *)&noddy_NoddyType);
index eaa355fa491c27b1f93a667ab79512689d83965f..5daecf9d8aca3826d0b13d1f051d0044f3f8eef7 100644 (file)
@@ -13,7 +13,7 @@ Noddy_dealloc(Noddy* self)
 {
     Py_XDECREF(self->first);
     Py_XDECREF(self->last);
-    self->ob_type->tp_free((PyObject*)self);
+    Py_TYPE(self)->tp_free((PyObject*)self);
 }
 
 static PyObject *
@@ -124,26 +124,26 @@ static PyMethodDef Noddy_methods[] = {
 
 static PyTypeObject NoddyType = {
     PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "noddy.Noddy",             /*tp_name*/
-    sizeof(Noddy),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)Noddy_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
+    "noddy.Noddy",             /* tp_name */
+    sizeof(Noddy),             /* tp_basicsize */
+    0,                         /* tp_itemsize */
+    (destructor)Noddy_dealloc, /* tp_dealloc */
+    0,                         /* tp_print */
+    0,                         /* tp_getattr */
+    0,                         /* tp_setattr */
+    0,                         /* tp_compare */
+    0,                         /* tp_repr */
+    0,                         /* tp_as_number */
+    0,                         /* tp_as_sequence */
+    0,                         /* tp_as_mapping */
+    0,                         /* tp_hash  */
+    0,                         /* tp_call */
+    0,                         /* tp_str */
+    0,                         /* tp_getattro */
+    0,                         /* tp_setattro */
+    0,                         /* tp_as_buffer */
+    Py_TPFLAGS_DEFAULT |
+        Py_TPFLAGS_BASETYPE,   /* tp_flags */
     "Noddy objects",           /* tp_doc */
     0,                        /* tp_traverse */
     0,                        /* tp_clear */
@@ -164,26 +164,25 @@ static PyTypeObject NoddyType = {
     Noddy_new,                 /* tp_new */
 };
 
-static PyMethodDef module_methods[] = {
-    {NULL}  /* Sentinel */
+static PyModuleDef noddy2module = {
+    PyModuleDef_HEAD_INIT,
+    "noddy2",
+    "Example module that creates an extension type.",
+    -1,
+    NULL, NULL, NULL, NULL, NULL
 };
 
-#ifndef PyMODINIT_FUNC /* declarations for DLL import/export */
-#define PyMODINIT_FUNC void
-#endif
 PyMODINIT_FUNC
-initnoddy2(void) 
+PyInit_noddy2(void) 
 {
     PyObject* m;
 
     if (PyType_Ready(&NoddyType) < 0)
-        return;
-
-    m = Py_InitModule3("noddy2", module_methods,
-                       "Example module that creates an extension type.");
+        return NULL;
 
+    m = PyModule_Create(&noddy2module);
     if (m == NULL)
-      return;
+        return NULL;
 
     Py_INCREF(&NoddyType);
     PyModule_AddObject(m, "Noddy", (PyObject *)&NoddyType);
index 3a1c0c2beb12577c679fcf48809dcf0c08c6268f..39cdfdbea3ebbc8582c6de50cf04911b5be79854 100644 (file)
@@ -13,7 +13,7 @@ Noddy_dealloc(Noddy* self)
 {
     Py_XDECREF(self->first);
     Py_XDECREF(self->last);
-    self->ob_type->tp_free((PyObject*)self);
+    Py_TYPE(self)->tp_free((PyObject*)self);
 }
 
 static PyObject *
@@ -177,26 +177,26 @@ static PyMethodDef Noddy_methods[] = {
 
 static PyTypeObject NoddyType = {
     PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "noddy.Noddy",             /*tp_name*/
-    sizeof(Noddy),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)Noddy_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
+    "noddy.Noddy",             /* tp_name */
+    sizeof(Noddy),             /* tp_basicsize */
+    0,                         /* tp_itemsize */
+    (destructor)Noddy_dealloc, /* tp_dealloc */
+    0,                         /* tp_print */
+    0,                         /* tp_getattr */
+    0,                         /* tp_setattr */
+    0,                         /* tp_compare */
+    0,                         /* tp_repr */
+    0,                         /* tp_as_number */
+    0,                         /* tp_as_sequence */
+    0,                         /* tp_as_mapping */
+    0,                         /* tp_hash  */
+    0,                         /* tp_call */
+    0,                         /* tp_str */
+    0,                         /* tp_getattro */
+    0,                         /* tp_setattro */
+    0,                         /* tp_as_buffer */
+    Py_TPFLAGS_DEFAULT |
+        Py_TPFLAGS_BASETYPE,   /* tp_flags */
     "Noddy objects",           /* tp_doc */
     0,                        /* tp_traverse */
     0,                        /* tp_clear */
@@ -217,26 +217,25 @@ static PyTypeObject NoddyType = {
     Noddy_new,                 /* tp_new */
 };
 
-static PyMethodDef module_methods[] = {
-    {NULL}  /* Sentinel */
+static PyModuleDef noddy3module = {
+    PyModuleDef_HEAD_INIT,
+    "noddy3",
+    "Example module that creates an extension type.",
+    -1,
+    NULL, NULL, NULL, NULL, NULL
 };
 
-#ifndef PyMODINIT_FUNC /* declarations for DLL import/export */
-#define PyMODINIT_FUNC void
-#endif
 PyMODINIT_FUNC
-initnoddy3(void) 
+PyInit_noddy3(void) 
 {
     PyObject* m;
 
     if (PyType_Ready(&NoddyType) < 0)
-        return;
-
-    m = Py_InitModule3("noddy3", module_methods,
-                       "Example module that creates an extension type.");
+        return NULL;
 
+    m = PyModule_Create(&noddy3module);
     if (m == NULL)
-      return;
+        return NULL;
 
     Py_INCREF(&NoddyType);
     PyModule_AddObject(m, "Noddy", (PyObject *)&NoddyType);
index ac0b1f4d4074b1311c3a222edb3b8c8ae5b6e259..94507ecf82eaf675d857ce9c65fb41c66f29026f 100644 (file)
@@ -47,7 +47,7 @@ static void
 Noddy_dealloc(Noddy* self)
 {
     Noddy_clear(self);
-    self->ob_type->tp_free((PyObject*)self);
+    Py_TYPE(self)->tp_free((PyObject*)self);
 }
 
 static PyObject *
@@ -158,26 +158,27 @@ static PyMethodDef Noddy_methods[] = {
 
 static PyTypeObject NoddyType = {
     PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-    "noddy.Noddy",             /*tp_name*/
-    sizeof(Noddy),             /*tp_basicsize*/
-    0,                         /*tp_itemsize*/
-    (destructor)Noddy_dealloc, /*tp_dealloc*/
-    0,                         /*tp_print*/
-    0,                         /*tp_getattr*/
-    0,                         /*tp_setattr*/
-    0,                         /*tp_compare*/
-    0,                         /*tp_repr*/
-    0,                         /*tp_as_number*/
-    0,                         /*tp_as_sequence*/
-    0,                         /*tp_as_mapping*/
-    0,                         /*tp_hash */
-    0,                         /*tp_call*/
-    0,                         /*tp_str*/
-    0,                         /*tp_getattro*/
-    0,                         /*tp_setattro*/
-    0,                         /*tp_as_buffer*/
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+    "noddy.Noddy",             /* tp_name */
+    sizeof(Noddy),             /* tp_basicsize */
+    0,                         /* tp_itemsize */
+    (destructor)Noddy_dealloc, /* tp_dealloc */
+    0,                         /* tp_print */
+    0,                         /* tp_getattr */
+    0,                         /* tp_setattr */
+    0,                         /* tp_compare */
+    0,                         /* tp_repr */
+    0,                         /* tp_as_number */
+    0,                         /* tp_as_sequence */
+    0,                         /* tp_as_mapping */
+    0,                         /* tp_hash  */
+    0,                         /* tp_call */
+    0,                         /* tp_str */
+    0,                         /* tp_getattro */
+    0,                         /* tp_setattro */
+    0,                         /* tp_as_buffer */
+    Py_TPFLAGS_DEFAULT |
+        Py_TPFLAGS_BASETYPE |
+        Py_TPFLAGS_HAVE_GC,    /* tp_flags */
     "Noddy objects",           /* tp_doc */
     (traverseproc)Noddy_traverse,   /* tp_traverse */
     (inquiry)Noddy_clear,           /* tp_clear */
@@ -198,26 +199,25 @@ static PyTypeObject NoddyType = {
     Noddy_new,                 /* tp_new */
 };
 
-static PyMethodDef module_methods[] = {
-    {NULL}  /* Sentinel */
+static PyModuleDef noddy4module = {
+    PyModuleDef_HEAD_INIT,
+    "noddy4",
+    "Example module that creates an extension type.",
+    -1,
+    NULL, NULL, NULL, NULL, NULL
 };
 
-#ifndef PyMODINIT_FUNC /* declarations for DLL import/export */
-#define PyMODINIT_FUNC void
-#endif
 PyMODINIT_FUNC
-initnoddy4(void) 
+PyInit_noddy4(void) 
 {
     PyObject* m;
 
     if (PyType_Ready(&NoddyType) < 0)
-        return;
-
-    m = Py_InitModule3("noddy4", module_methods,
-                       "Example module that creates an extension type.");
+        return NULL;
 
+    m = PyModule_Create(&noddy4module);
     if (m == NULL)
-      return;
+        return NULL;
 
     Py_INCREF(&NoddyType);
     PyModule_AddObject(m, "Noddy", (PyObject *)&NoddyType);
index 4c46beaf8f5ecde71ef9d452c0c617dbbbcd85d9..3757bca0ef879b7773d5c46a736d06739e928e3a 100644 (file)
@@ -32,7 +32,6 @@ Shoddy_init(Shoddy *self, PyObject *args, PyObject *kwds)
 
 static PyTypeObject ShoddyType = {
     PyObject_HEAD_INIT(NULL)
-    0,                       /* ob_size */
     "shoddy.Shoddy",         /* tp_name */
     sizeof(Shoddy),          /* tp_basicsize */
     0,                       /* tp_itemsize */
@@ -52,7 +51,7 @@ static PyTypeObject ShoddyType = {
     0,                       /* tp_setattro */
     0,                       /* tp_as_buffer */
     Py_TPFLAGS_DEFAULT |
-      Py_TPFLAGS_BASETYPE,   /* tp_flags */
+        Py_TPFLAGS_BASETYPE, /* tp_flags */
     0,                       /* tp_doc */
     0,                       /* tp_traverse */
     0,                       /* tp_clear */
@@ -73,18 +72,26 @@ static PyTypeObject ShoddyType = {
     0,                       /* tp_new */
 };
 
+static PyModuleDef shoddymodule = {
+    PyModuleDef_HEAD_INIT,
+    "shoddy",
+    "Shoddy module",
+    -1,
+    NULL, NULL, NULL, NULL, NULL
+};
+
 PyMODINIT_FUNC
-initshoddy(void)
+PyInit_shoddy(void)
 {
     PyObject *m;
 
     ShoddyType.tp_base = &PyList_Type;
     if (PyType_Ready(&ShoddyType) < 0)
-        return;
+        return NULL;
 
-    m = Py_InitModule3("shoddy", NULL, "Shoddy module");
+    m = PyModule_Create(&shoddymodule);
     if (m == NULL)
-        return;
+        return NULL;
 
     Py_INCREF(&ShoddyType);
     PyModule_AddObject(m, "Shoddy", (PyObject *) &ShoddyType);
index 0afe375d4f0fffb868a27c89279e668f6675ba7b..f6451b925db5271a2ad5317c12492c39fe8f61ce 100644 (file)
@@ -34,21 +34,18 @@ typedef struct _typeobject {
 
     char *tp_doc; /* Documentation string */
 
-    /* Assigned meaning in release 2.0 */
     /* call function for all accessible objects */
     traverseproc tp_traverse;
 
     /* delete references to contained objects */
     inquiry tp_clear;
 
-    /* Assigned meaning in release 2.1 */
     /* rich comparisons */
     richcmpfunc tp_richcompare;
 
     /* weak reference enabler */
     long tp_weaklistoffset;
 
-    /* Added in release 2.2 */
     /* Iterators */
     getiterfunc tp_iter;
     iternextfunc tp_iternext;
index 08142e119fbcb09816aef19516f13071776d31e8..2fb4f8a00c89d73dcb84962367e6331ed372a7cb 100644 (file)
@@ -18,8 +18,6 @@ defined:
 +-----------+----------------+-------------------+-----------------------+
 | Type code | C Type         | Python Type       | Minimum size in bytes |
 +===========+================+===================+=======================+
-| ``'c'``   | char           | character         | 1                     |
-+-----------+----------------+-------------------+-----------------------+
 | ``'b'``   | signed char    | int               | 1                     |
 +-----------+----------------+-------------------+-----------------------+
 | ``'B'``   | unsigned char  | int               | 1                     |
@@ -219,15 +217,14 @@ The following data items and methods are also supported:
 
 When an array object is printed or converted to a string, it is represented as
 ``array(typecode, initializer)``.  The *initializer* is omitted if the array is
-empty, otherwise it is a string if the *typecode* is ``'c'``, otherwise it is a
+empty, otherwise it is a string if the *typecode* is ``'u'``, otherwise it is a
 list of numbers.  The string is guaranteed to be able to be converted back to an
 array with the same type and value using :func:`eval`, so long as the
 :func:`array` function has been imported using ``from array import array``.
 Examples::
 
    array('l')
-   array('c', 'hello world')
-   array('u', u'hello \u2641')
+   array('u', 'hello \u2641')
    array('l', [1, 2, 3, 4, 5])
    array('d', [1.0, 2.0, 3.14])
 
index b5a72396530409dc1b02729400ce257705531b05..0861e681d1101aceab09ff8dbacc7939efc14a68 100644 (file)
@@ -25,7 +25,7 @@ another rational number, or from a string.
    :exc:`ZeroDivisionError`. The second version requires that
    *other_fraction* is an instance of :class:`numbers.Rational` and
    returns an :class:`Fraction` instance with the same value.  The
-   last version of the constructor expects a string or unicode
+   last version of the constructor expects a string
    instance in one of two possible forms.  The first form is::
 
       [sign] numerator ['/' denominator]
index 01849eee14a8a618048b15f7e454f830c126dfb8..2fcf027f887467c76d92af993f41f1fe4b57f69d 100644 (file)
@@ -8,59 +8,6 @@ The Python interpreter has a number of functions and types built into it that
 are always available.  They are listed here in alphabetical order.
 
 
-.. function:: __import__(name[, globals[, locals[, fromlist[, level]]]])
-
-   .. index::
-      statement: import
-      module: imp
-
-   .. note::
-
-      This is an advanced function that is not needed in everyday Python
-      programming.
-
-   The function is invoked by the :keyword:`import` statement.  It mainly exists
-   so that you can replace it with another function that has a compatible
-   interface, in order to change the semantics of the :keyword:`import`
-   statement.  See the built-in module :mod:`imp`, which defines some useful
-   operations out of which you can build your own :func:`__import__` function.
-
-   For example, the statement ``import spam`` results in the following call:
-   ``__import__('spam', globals(), locals(), [], -1)``; the statement
-   ``from spam.ham import eggs`` results in ``__import__('spam.ham', globals(),
-   locals(), ['eggs'], -1)``.  Note that even though ``locals()`` and ``['eggs']``
-   are passed in as arguments, the :func:`__import__` function does not set the
-   local variable named ``eggs``; this is done by subsequent code that is generated
-   for the import statement.  (In fact, the standard implementation does not use
-   its *locals* argument at all, and uses its *globals* only to determine the
-   package context of the :keyword:`import` statement.)
-
-   When the *name* variable is of the form ``package.module``, normally, the
-   top-level package (the name up till the first dot) is returned, *not* the
-   module named by *name*.  However, when a non-empty *fromlist* argument is
-   given, the module named by *name* is returned.  This is done for
-   compatibility with the :term:`bytecode` generated for the different kinds of import
-   statement; when using ``import spam.ham.eggs``, the top-level package
-   :mod:`spam` must be placed in the importing namespace, but when using ``from
-   spam.ham import eggs``, the ``spam.ham`` subpackage must be used to find the
-   ``eggs`` variable.  As a workaround for this behavior, use :func:`getattr` to
-   extract the desired components.  For example, you could define the following
-   helper::
-
-      def my_import(name):
-          mod = __import__(name)
-          components = name.split('.')
-          for comp in components[1:]:
-              mod = getattr(mod, comp)
-          return mod
-
-   *level* specifies whether to use absolute or relative imports. The default is
-   ``-1`` which indicates both absolute and relative imports will be attempted.
-   ``0`` means only perform absolute imports. Positive values for *level* indicate
-   the number of parent directories to search relative to the directory of the
-   module calling :func:`__import__`.
-
-
 .. function:: abs(x)
 
    Return the absolute value of a number.  The argument may be an
@@ -1207,13 +1154,66 @@ are always available.  They are listed here in alphabetical order.
       >>> x = [1, 2, 3]
       >>> y = [4, 5, 6]
       >>> zipped = zip(x, y)
-      >>> zipped
+      >>> list(zipped)
       [(1, 4), (2, 5), (3, 6)]
-      >>> x2, y2 = zip(*zipped)
+      >>> x2, y2 = zip(*zip(x, y))
       >>> x == x2, y == y2
       True
 
 
+.. function:: __import__(name[, globals[, locals[, fromlist[, level]]]])
+
+   .. index::
+      statement: import
+      module: imp
+
+   .. note::
+
+      This is an advanced function that is not needed in everyday Python
+      programming.
+
+   The function is invoked by the :keyword:`import` statement.  It mainly exists
+   so that you can replace it with another function that has a compatible
+   interface, in order to change the semantics of the :keyword:`import`
+   statement.  See the built-in module :mod:`imp`, which defines some useful
+   operations out of which you can build your own :func:`__import__` function.
+
+   For example, the statement ``import spam`` results in the following call:
+   ``__import__('spam', globals(), locals(), [], -1)``; the statement
+   ``from spam.ham import eggs`` results in ``__import__('spam.ham', globals(),
+   locals(), ['eggs'], -1)``.  Note that even though ``locals()`` and ``['eggs']``
+   are passed in as arguments, the :func:`__import__` function does not set the
+   local variable named ``eggs``; this is done by subsequent code that is generated
+   for the import statement.  (In fact, the standard implementation does not use
+   its *locals* argument at all, and uses its *globals* only to determine the
+   package context of the :keyword:`import` statement.)
+
+   When the *name* variable is of the form ``package.module``, normally, the
+   top-level package (the name up till the first dot) is returned, *not* the
+   module named by *name*.  However, when a non-empty *fromlist* argument is
+   given, the module named by *name* is returned.  This is done for
+   compatibility with the :term:`bytecode` generated for the different kinds of import
+   statement; when using ``import spam.ham.eggs``, the top-level package
+   :mod:`spam` must be placed in the importing namespace, but when using ``from
+   spam.ham import eggs``, the ``spam.ham`` subpackage must be used to find the
+   ``eggs`` variable.  As a workaround for this behavior, use :func:`getattr` to
+   extract the desired components.  For example, you could define the following
+   helper::
+
+      def my_import(name):
+          mod = __import__(name)
+          components = name.split('.')
+          for comp in components[1:]:
+              mod = getattr(mod, comp)
+          return mod
+
+   *level* specifies whether to use absolute or relative imports. The default is
+   ``-1`` which indicates both absolute and relative imports will be attempted.
+   ``0`` means only perform absolute imports. Positive values for *level* indicate
+   the number of parent directories to search relative to the directory of the
+   module calling :func:`__import__`.
+
+
 .. rubric:: Footnotes
 
 .. [#] Specifying a buffer size currently has no effect on systems that don't have
index e4dbf177eb070e2480880f4f62b4fda87b144956..e5d17816fb6881ecebee02b0739bc02f50feea17 100644 (file)
@@ -709,6 +709,12 @@ always available.
    :func:`os.popen`, :func:`os.system` or the :func:`exec\*` family of functions in
    the :mod:`os` module.)
 
+   .. note::
+
+      The standard streams are in text mode by default.  To write or read binary
+      data to these, use the underlying binary buffer.  For example, to write
+      bytes to :data:`stdout`, use ``sys.stdout.buffer.write(b'abc')``.
+
 
 .. data:: __stdin__
           __stdout__
index 26376e722efecfc51022e80e1bc21aafc57e1e50..d013601e4837e61f09d26e1612a149bed0f1480a 100644 (file)
@@ -106,8 +106,8 @@ The :mod:`urllib.parse` module defines the following functions:
    parsing errors.  If false (the default), errors are silently ignored.  If true,
    errors raise a :exc:`ValueError` exception.
 
-   Use the :func:`urllib.urlencode` function to convert such dictionaries into
-   query strings.
+   Use the :func:`urllib.parse.urlencode` function to convert such
+   dictionaries into query strings.
 
 
 .. function:: parse_qsl(qs[, keep_blank_values[, strict_parsing]])
index 3038588de405c2bfd18a586edbafc8585c9a6167..0b5f892a8846f5fa2a115f7835c5a77d5b0f811b 100644 (file)
@@ -23,8 +23,8 @@ The :mod:`urllib.request` module defines the following functions:
    that use *data*; the HTTP request will be a POST instead of a GET when the
    *data* parameter is provided.  *data* should be a buffer in the standard
    :mimetype:`application/x-www-form-urlencoded` format.  The
-   :func:`urllib.urlencode` function takes a mapping or sequence of 2-tuples and
-   returns a string in this format.
+   :func:`urllib.parse.urlencode` function takes a mapping or sequence
+   of 2-tuples and returns a string in this format.
 
    The optional *timeout* parameter specifies a timeout in seconds for blocking
    operations like the connection attempt (if not specified, the global default
@@ -172,8 +172,8 @@ The following classes are provided:
    that use *data*; the HTTP request will be a POST instead of a GET when the
    *data* parameter is provided.  *data* should be a buffer in the standard
    :mimetype:`application/x-www-form-urlencoded` format.  The
-   :func:`urllib.urlencode` function takes a mapping or sequence of 2-tuples and
-   returns a string in this format.
+   :func:`urllib.parse.urlencode` function takes a mapping or sequence
+   of 2-tuples and returns a string in this format.
 
    *headers* should be a dictionary, and will be treated as if :meth:`add_header`
    was called with each key and value as arguments.  This is often used to "spoof"
index 5831f6c20ad0dc5e012d3e4307175d6dd930676e..d6e8ca1c2fd59b8dee36560fa4ef9eccb1123a11 100644 (file)
@@ -119,12 +119,11 @@ contains the current module's global names; and the outermost scope (searched
 last) is the namespace containing built-in names.
 
 If a name is declared global, then all references and assignments go directly to
-the middle scope containing the module's global names. Otherwise, all variables
-found outside of the innermost scope are read-only (an attempt to write to such
-a variable will simply create a *new* local variable in the innermost scope,
-leaving the identically named outer variable unchanged).
-
-.. XXX mention nonlocal
+the middle scope containing the module's global names.  To rebind variables
+found outside of the innermost scope, the :keyword:`nonlocal` statement can be
+used; if not declared nonlocal, those variable are read-only (an attempt to
+write to such a variable will simply create a *new* local variable in the
+innermost scope, leaving the identically named outer variable unchanged).
 
 Usually, the local scope references the local names of the (textually) current
 function.  Outside functions, the local scope references the same namespace as
index 457fce0110c5c70e8294a872856e0456631f74fd..f2d9362039817f5bdd0c160073379b4714258eb6 100644 (file)
@@ -189,12 +189,11 @@ Python 3.0 has simplified the rules for ordering comparisons:
   argument instead. N.B. the *key* and *reverse* arguments are now
   "keyword-only".
 
-* The :func:`cmp` function is gone, and the :meth:`__cmp__` special
-  method is no longer supported.  Use :meth:`__lt__` for sorting,
-  :meth:`__eq__` with :meth:`__hash__`, and other rich comparisons as
-  needed.  (If you really need the :func:`cmp` functionality, you
-  could use the expression ``(a > b) - (a < b)`` as the equivalent for
-  ``cmp(a, b)``.)
+* The :func:`cmp` function should be treated as gone, and the :meth:`__cmp__`
+  special method is no longer supported.  Use :meth:`__lt__` for sorting,
+  :meth:`__eq__` with :meth:`__hash__`, and other rich comparisons as needed.
+  (If you really need the :func:`cmp` functionality, you could use the
+  expression ``(a > b) - (a < b)`` as the equivalent for ``cmp(a, b)``.)
 
 Integers
 --------
@@ -303,7 +302,7 @@ changed.
   as well as strings, and a few APIs have a way to ask for a
   :class:`bytes` return value.  Thus, :func:`os.listdir` returns a
   list of :class:`bytes` instances if the argument is a :class:`bytes`
-  instance, and :func:`os.getcwdu` returns the current working
+  instance, and :func:`os.getcwdb` returns the current working
   directory as a :class:`bytes` instance.  Note that when
   :func:`os.listdir` returns a list of strings, filenames that
   cannot be decoded properly are omitted rather than raising
@@ -369,7 +368,7 @@ New Syntax
 
     (a, *rest, b) = range(5)
 
-  This sets *a* to ``0``, *b* to ``4``, and \*rest to ``[1, 2, 3]``.
+  This sets *a* to ``0``, *b* to ``4``, and *rest* to ``[1, 2, 3]``.
 
 * Dictionary comprehensions: ``{k: v for k, v in stuff}`` means the
   same thing as ``dict(stuff)`` but is more flexible.  (This is
@@ -383,8 +382,8 @@ New Syntax
 * New octal literals, e.g. ``0o720`` (already in 2.6).  The old octal
   literals (``0720``) are gone.
 
-* New binary literals, e.g. ``0b1010`` (already in 2.6) and a new
-  corresponding builtin function, :func:`bin`.
+* New binary literals, e.g. ``0b1010`` (already in 2.6), and
+  there is a new corresponding builtin function, :func:`bin`.
 
 * Bytes literals are introduced with a leading ``b`` or ``B``, and
   there is a new corresponding builtin function, :func:`bytes`.
@@ -393,7 +392,7 @@ Changed Syntax
 --------------
 
 * :pep:`3109` and :pep:`3134`: new :keyword:`raise` statement syntax:
-  ``raise [expr [from expr]]``.  See below.
+  :samp:`raise [{expr} [from {expr}]]`.  See below.
 
 * :keyword:`as` and :keyword:`with` are now reserved words.  (Since
   2.6, actually.)
@@ -422,8 +421,8 @@ Changed Syntax
   :class:`object`.)
 
 * List comprehensions no longer support the syntactic form
-  ``[... for var in item1, item2, ...]``.  Use
-  ``[... for var in (item1, item2, ...)]`` instead.
+  :samp:`[... for {var} in {item1}, {item2}, ...]`.  Use
+  :samp:`[... for {var} in ({item1}, {item2}, ...)]` instead.
   Also note that list comprehensions have different semantics: they
   are closer to syntactic sugar for a generator expression inside a
   :func:`list` constructor, and in particular the loop control
@@ -457,10 +456,8 @@ Removed Syntax
 * The :keyword:`from` *module* :keyword:`import` ``*`` syntax is only
   allowed at the module level, no longer inside functions.
 
-* The only acceptable syntaxes for relative imports are :keyword:`from`
-  ``.`` :keyword:`import` *name* or 
-  :keyword:`from` ``.module`` :keyword:`import` *name*.   
-  :keyword:`import` forms not starting with ``.`` are always
+* The only acceptable syntax for relative imports is :samp:`from .[{module}]
+  import {name}`.  All :keyword:`import` forms not starting with ``.`` are
   interpreted as absolute imports.  (:pep:`0328`)
 
 * Classic classes are gone.
@@ -627,7 +624,9 @@ Some other changes to standard library modules, not covered by
 
 * Cleanup of the :class:`array.array` type: the :meth:`read` and
   :meth:`write` methods are gone; use :meth:`fromfile` and
-  :meth:`tofile` instead.
+  :meth:`tofile` instead.  Also, the ``'c'`` typecode for array is
+  gone -- use either ``'b'`` for bytes or ``'u'`` for Unicode
+  characters.
 
 * Cleanup of the :mod:`operator` module: removed
   :func:`sequenceIncludes` and :func:`isCallable`.
index 2fdf6688a94bea970c2c318040197774524df2fb..5a020d322791b3c1651c7f16f4862b265cc23778 100644 (file)
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -7,6 +7,7 @@ This exports:
   - os.curdir is a string representing the current directory ('.' or ':')
   - os.pardir is a string representing the parent directory ('..' or '::')
   - os.sep is the (or a most common) pathname separator ('/' or ':' or '\\')
+  - os.extsep is the extension separator (always '.')
   - os.altsep is the alternate pathname separator (None or '/')
   - os.pathsep is the component separator used in $PATH etc
   - os.linesep is the line separator in text files ('\r' or '\n' or '\r\n')
@@ -102,7 +103,8 @@ else:
     raise ImportError('no os specific module found')
 
 sys.modules['os.path'] = path
-from os.path import curdir, pardir, sep, pathsep, defpath, altsep, devnull
+from os.path import (curdir, pardir, sep, pathsep, defpath, extsep, altsep,
+    devnull)
 
 del _names
 
index 70bba81f9fb3e2c49ffd0ebebe907004f7115f7e..a9b032e72c032d45c59eb3181f1fd7028721de45 100755 (executable)
@@ -46,7 +46,7 @@ DIR=`dirname $DIR`
 
 FAILURE_SUBJECT="Python Regression Test Failures"
 #FAILURE_MAILTO="YOUR_ACCOUNT@gmail.com"
-FAILURE_MAILTO="python-3000-checkins@python.org"
+FAILURE_MAILTO="python-checkins@python.org"
 #FAILURE_CC="optional--uncomment and set to desired address"
 
 REMOTE_SYSTEM="neal@dinsdale.python.org"
index b4dd7928c91988cbd6008fe5d5eee5f108c6d0f9..789e07bd3f9323d226effe97c9e181ad1b6a8d38 100644 (file)
@@ -1,4 +1,4 @@
--- ASDL's five builtin types are identifier, int, string, object
+-- ASDL's four builtin types are identifier, int, string, object
 
 module Python version "$Revision$"
 {
index a0f42d573f59ef0e4ffdc32f6cce4f03790506d7..cf79b3789bc637ecaac153743c8c51990c811631 100644 (file)
@@ -2,7 +2,7 @@
 
 
 /*
-   __version__ 62078.
+   __version__ 67616.
 
    This module must be committed separately after each AST grammar change;
    The __version__ number is set to the revision number of the commit
@@ -6417,7 +6417,7 @@ PyInit__ast(void)
             NULL;
         if (PyModule_AddIntConstant(m, "PyCF_ONLY_AST", PyCF_ONLY_AST) < 0)
                 return NULL;
-        if (PyModule_AddStringConstant(m, "__version__", "62078") < 0)
+        if (PyModule_AddStringConstant(m, "__version__", "67616") < 0)
                 return NULL;
         if (PyDict_SetItemString(d, "mod", (PyObject*)mod_type) < 0) return
             NULL;
index d7f5084a588d53a00d78af3c517f6e25384f550f..546bc20c00782e573065ea552bc7d9d68ee7fa72 100644 (file)
@@ -2178,9 +2178,7 @@ PyDoc_STRVAR(zip_doc,
 Return a zip object whose .__next__() method returns a tuple where\n\
 the i-th element comes from the i-th iterable argument.  The .__next__()\n\
 method continues until the shortest iterable in the argument sequence\n\
-is exhausted and then it raises StopIteration.  Works like the zip()\n\
-function but consumes less memory by returning an iterator instead of\n\
-a list.");
+is exhausted and then it raises StopIteration.");
 
 PyTypeObject PyZip_Type = {
        PyVarObject_HEAD_INIT(&PyType_Type, 0)