[Python-checkins] r67644 - in python/branches/release30-maint: 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

georg.brandl python-checkins at python.org
Sun Dec 7 16:52:14 CET 2008


Author: georg.brandl
Date: Sun Dec 7 16:52:13 2008
New Revision: 67644
Log:
Merged revisions 67525-67527,67529,67548-67549,67551-67552,67555,67578,67586,67593-67594,67596,67605-67606,67609,67612,67616-67617,67632,67635,67638 via svnmerge from 
svn+ssh://svn.python.org/python/branches/py3k
........
 r67525 | georg.brandl | 2008年12月04日 19:18:16 +0100 (2008年12月04日) | 2 lines
 
 #4527: fix "unicode or string".
........
 r67526 | georg.brandl | 2008年12月04日 19:19:41 +0100 (2008年12月04日) | 2 lines
 
 #4526: fix typo.
........
 r67527 | georg.brandl | 2008年12月04日 19:21:46 +0100 (2008年12月04日) | 2 lines
 
 #4521: fix getcwdu() vs getcwdb().
........
 r67529 | georg.brandl | 2008年12月04日 19:28:38 +0100 (2008年12月04日) | 2 lines
 
 #4513: remove traces of zip() docstring from when it was izip().
........
 r67548 | guido.van.rossum | 2008年12月05日 06:49:12 +0100 (2008年12月05日) | 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 (2008年12月05日) | 2 lines
 
 Send mails to python-checkins now.
........
 r67551 | georg.brandl | 2008年12月05日 08:32:56 +0100 (2008年12月05日) | 2 lines
 
 #4355: refer to urlencode in the correct module.
........
 r67552 | georg.brandl | 2008年12月05日 08:45:54 +0100 (2008年12月05日) | 2 lines
 
 #4401: Re-add os.extsep.
........
 r67555 | georg.brandl | 2008年12月05日 08:57:51 +0100 (2008年12月05日) | 2 lines
 
 #4427: fix arguments for "y" BuildValue type.
........
 r67578 | georg.brandl | 2008年12月05日 16:12:15 +0100 (2008年12月05日) | 2 lines
 
 #4504, #4505: Update noddy examples in "Extending & Embedding".
........
 r67586 | georg.brandl | 2008年12月05日 16:55:41 +0100 (2008年12月05日) | 2 lines
 
 Manually merged r67583: move __import__ doc to the bottom.
........
 r67593 | georg.brandl | 2008年12月05日 19:04:41 +0100 (2008年12月05日) | 2 lines
 
 #4550: fix 2.x syntax in webservers howto.
........
 r67594 | georg.brandl | 2008年12月05日 19:06:58 +0100 (2008年12月05日) | 2 lines
 
 #4549: Mention nonlocal statement in tutorial section about scoping.
........
 r67596 | georg.brandl | 2008年12月05日 19:31:51 +0100 (2008年12月05日) | 2 lines
 
 Use :samp: role.
........
 r67605 | georg.brandl | 2008年12月06日 09:12:11 +0100 (2008年12月06日) | 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 (2008年12月06日) | 2 lines
 
 cmp() is not really gone.
........
 r67609 | georg.brandl | 2008年12月06日 15:28:56 +0100 (2008年12月06日) | 2 lines
 
 #4562: fix zip() examples.
........
 r67612 | skip.montanaro | 2008年12月06日 18:25:02 +0100 (2008年12月06日) | 2 lines
 
 issue 4483 - _dbm build failures on systems with gdbm_compat lib.
........
 r67616 | benjamin.peterson | 2008年12月06日 19:32:13 +0100 (2008年12月06日) | 1 line
 
 there are only four asdl builtin types in py3k
........
 r67617 | benjamin.peterson | 2008年12月06日 19:33:20 +0100 (2008年12月06日) | 1 line
 
 update version number
........
 r67632 | georg.brandl | 2008年12月07日 15:09:20 +0100 (2008年12月07日) | 2 lines
 
 #4576: fix ob_type access.
........
 r67635 | benjamin.peterson | 2008年12月07日 15:58:03 +0100 (2008年12月07日) | 1 line
 
 document how to deal with binary standard streams
........
 r67638 | benjamin.peterson | 2008年12月07日 16:07:02 +0100 (2008年12月07日) | 1 line
 
 remove extraneous 'text'
........
Modified:
 python/branches/release30-maint/ (props changed)
 python/branches/release30-maint/Doc/c-api/arg.rst
 python/branches/release30-maint/Doc/extending/newtypes.rst
 python/branches/release30-maint/Doc/howto/webservers.rst
 python/branches/release30-maint/Doc/includes/noddy.c
 python/branches/release30-maint/Doc/includes/noddy2.c
 python/branches/release30-maint/Doc/includes/noddy3.c
 python/branches/release30-maint/Doc/includes/noddy4.c
 python/branches/release30-maint/Doc/includes/shoddy.c
 python/branches/release30-maint/Doc/includes/typestruct.h
 python/branches/release30-maint/Doc/library/array.rst
 python/branches/release30-maint/Doc/library/fractions.rst
 python/branches/release30-maint/Doc/library/functions.rst
 python/branches/release30-maint/Doc/library/sys.rst
 python/branches/release30-maint/Doc/library/urllib.parse.rst
 python/branches/release30-maint/Doc/library/urllib.request.rst
 python/branches/release30-maint/Doc/tutorial/classes.rst
 python/branches/release30-maint/Doc/whatsnew/3.0.rst
 python/branches/release30-maint/Lib/os.py
 python/branches/release30-maint/Misc/build.sh
 python/branches/release30-maint/Parser/Python.asdl
 python/branches/release30-maint/Python/Python-ast.c
 python/branches/release30-maint/Python/bltinmodule.c
Modified: python/branches/release30-maint/Doc/c-api/arg.rst
==============================================================================
--- python/branches/release30-maint/Doc/c-api/arg.rst	(original)
+++ python/branches/release30-maint/Doc/c-api/arg.rst	Sun Dec 7 16:52:13 2008
@@ -438,7 +438,7 @@
 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.
 
Modified: python/branches/release30-maint/Doc/extending/newtypes.rst
==============================================================================
--- python/branches/release30-maint/Doc/extending/newtypes.rst	(original)
+++ python/branches/release30-maint/Doc/extending/newtypes.rst	Sun Dec 7 16:52:13 2008
@@ -73,26 +73,25 @@
 
 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 @@
 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 @@
 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 @@
 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 @@
 {
 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 @@
 
 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 @@
 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 @@
 
 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 @@
 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 @@
 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 @@
 
 Py_DECREF(self->my_callback);
 }
- obj->ob_type->tp_free((PyObject*)self);
+ Py_TYPE(obj)->tp_free((PyObject*)self);
 }
 
 
@@ -1241,49 +1233,50 @@
 return -1;
 }
 
+.. 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;
- }
+ 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
Modified: python/branches/release30-maint/Doc/howto/webservers.rst
==============================================================================
--- python/branches/release30-maint/Doc/howto/webservers.rst	(original)
+++ python/branches/release30-maint/Doc/howto/webservers.rst	Sun Dec 7 16:52:13 2008
@@ -101,10 +101,10 @@
 # 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 @@
 #!/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 @@
 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 @@
 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
Modified: python/branches/release30-maint/Doc/includes/noddy.c
==============================================================================
--- python/branches/release30-maint/Doc/includes/noddy.c	(original)
+++ python/branches/release30-maint/Doc/includes/noddy.c	Sun Dec 7 16:52:13 2008
@@ -7,47 +7,48 @@
 
 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);
Modified: python/branches/release30-maint/Doc/includes/noddy2.c
==============================================================================
--- python/branches/release30-maint/Doc/includes/noddy2.c	(original)
+++ python/branches/release30-maint/Doc/includes/noddy2.c	Sun Dec 7 16:52:13 2008
@@ -13,7 +13,7 @@
 {
 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 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 @@
 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);
Modified: python/branches/release30-maint/Doc/includes/noddy3.c
==============================================================================
--- python/branches/release30-maint/Doc/includes/noddy3.c	(original)
+++ python/branches/release30-maint/Doc/includes/noddy3.c	Sun Dec 7 16:52:13 2008
@@ -13,7 +13,7 @@
 {
 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 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 @@
 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);
Modified: python/branches/release30-maint/Doc/includes/noddy4.c
==============================================================================
--- python/branches/release30-maint/Doc/includes/noddy4.c	(original)
+++ python/branches/release30-maint/Doc/includes/noddy4.c	Sun Dec 7 16:52:13 2008
@@ -47,7 +47,7 @@
 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 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 @@
 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);
Modified: python/branches/release30-maint/Doc/includes/shoddy.c
==============================================================================
--- python/branches/release30-maint/Doc/includes/shoddy.c	(original)
+++ python/branches/release30-maint/Doc/includes/shoddy.c	Sun Dec 7 16:52:13 2008
@@ -32,7 +32,6 @@
 
 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 @@
 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 @@
 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);
Modified: python/branches/release30-maint/Doc/includes/typestruct.h
==============================================================================
--- python/branches/release30-maint/Doc/includes/typestruct.h	(original)
+++ python/branches/release30-maint/Doc/includes/typestruct.h	Sun Dec 7 16:52:13 2008
@@ -34,21 +34,18 @@
 
 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;
Modified: python/branches/release30-maint/Doc/library/array.rst
==============================================================================
--- python/branches/release30-maint/Doc/library/array.rst	(original)
+++ python/branches/release30-maint/Doc/library/array.rst	Sun Dec 7 16:52:13 2008
@@ -18,8 +18,6 @@
 +-----------+----------------+-------------------+-----------------------+
 | 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 @@
 
 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])
 
Modified: python/branches/release30-maint/Doc/library/fractions.rst
==============================================================================
--- python/branches/release30-maint/Doc/library/fractions.rst	(original)
+++ python/branches/release30-maint/Doc/library/fractions.rst	Sun Dec 7 16:52:13 2008
@@ -25,7 +25,7 @@
 :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]
Modified: python/branches/release30-maint/Doc/library/functions.rst
==============================================================================
--- python/branches/release30-maint/Doc/library/functions.rst	(original)
+++ python/branches/release30-maint/Doc/library/functions.rst	Sun Dec 7 16:52:13 2008
@@ -8,59 +8,6 @@
 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 @@
 >>> 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
Modified: python/branches/release30-maint/Doc/library/sys.rst
==============================================================================
--- python/branches/release30-maint/Doc/library/sys.rst	(original)
+++ python/branches/release30-maint/Doc/library/sys.rst	Sun Dec 7 16:52:13 2008
@@ -709,6 +709,12 @@
 :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__
Modified: python/branches/release30-maint/Doc/library/urllib.parse.rst
==============================================================================
--- python/branches/release30-maint/Doc/library/urllib.parse.rst	(original)
+++ python/branches/release30-maint/Doc/library/urllib.parse.rst	Sun Dec 7 16:52:13 2008
@@ -106,8 +106,8 @@
 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]])
Modified: python/branches/release30-maint/Doc/library/urllib.request.rst
==============================================================================
--- python/branches/release30-maint/Doc/library/urllib.request.rst	(original)
+++ python/branches/release30-maint/Doc/library/urllib.request.rst	Sun Dec 7 16:52:13 2008
@@ -23,8 +23,8 @@
 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 @@
 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"
Modified: python/branches/release30-maint/Doc/tutorial/classes.rst
==============================================================================
--- python/branches/release30-maint/Doc/tutorial/classes.rst	(original)
+++ python/branches/release30-maint/Doc/tutorial/classes.rst	Sun Dec 7 16:52:13 2008
@@ -119,12 +119,11 @@
 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
Modified: python/branches/release30-maint/Doc/whatsnew/3.0.rst
==============================================================================
--- python/branches/release30-maint/Doc/whatsnew/3.0.rst	(original)
+++ python/branches/release30-maint/Doc/whatsnew/3.0.rst	Sun Dec 7 16:52:13 2008
@@ -189,12 +189,11 @@
 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 @@
 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 @@
 
 (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 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 @@
 --------------
 
 * :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 @@
 :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 @@
 * 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 @@
 
 * 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`.
Modified: python/branches/release30-maint/Lib/os.py
==============================================================================
--- python/branches/release30-maint/Lib/os.py	(original)
+++ python/branches/release30-maint/Lib/os.py	Sun Dec 7 16:52:13 2008
@@ -7,6 +7,7 @@
 - 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 @@
 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
 
Modified: python/branches/release30-maint/Misc/build.sh
==============================================================================
--- python/branches/release30-maint/Misc/build.sh	(original)
+++ python/branches/release30-maint/Misc/build.sh	Sun Dec 7 16:52:13 2008
@@ -46,7 +46,7 @@
 
 FAILURE_SUBJECT="Python Regression Test Failures"
 #FAILURE_MAILTO="YOUR_ACCOUNT at gmail.com"
-FAILURE_MAILTO="python-3000-checkins at python.org"
+FAILURE_MAILTO="python-checkins at python.org"
 #FAILURE_CC="optional--uncomment and set to desired address"
 
 REMOTE_SYSTEM="neal at dinsdale.python.org"
Modified: python/branches/release30-maint/Parser/Python.asdl
==============================================================================
--- python/branches/release30-maint/Parser/Python.asdl	(original)
+++ python/branches/release30-maint/Parser/Python.asdl	Sun Dec 7 16:52:13 2008
@@ -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$"
 {
Modified: python/branches/release30-maint/Python/Python-ast.c
==============================================================================
--- python/branches/release30-maint/Python/Python-ast.c	(original)
+++ python/branches/release30-maint/Python/Python-ast.c	Sun Dec 7 16:52:13 2008
@@ -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 @@
 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;
Modified: python/branches/release30-maint/Python/bltinmodule.c
==============================================================================
--- python/branches/release30-maint/Python/bltinmodule.c	(original)
+++ python/branches/release30-maint/Python/bltinmodule.c	Sun Dec 7 16:52:13 2008
@@ -2178,9 +2178,7 @@
 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)


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /