From 83bbabdc29e6e2a23fa3464901eaecdbb2692c8b Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Sun, 7 Dec 2008 15:52:13 +0000 Subject: 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 (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' ........ --- Doc/c-api/arg.rst | 2 +- Doc/extending/newtypes.rst | 171 ++++++++++++++++++++--------------------- Doc/howto/webservers.rst | 15 ++-- Doc/includes/noddy.c | 59 +++++++------- Doc/includes/noddy2.c | 63 ++++++++------- Doc/includes/noddy3.c | 63 ++++++++------- Doc/includes/noddy4.c | 64 +++++++-------- Doc/includes/shoddy.c | 19 +++-- Doc/includes/typestruct.h | 3 - Doc/library/array.rst | 7 +- Doc/library/fractions.rst | 2 +- Doc/library/functions.rst | 110 +++++++++++++------------- Doc/library/sys.rst | 6 ++ Doc/library/urllib.parse.rst | 4 +- Doc/library/urllib.request.rst | 8 +- Doc/tutorial/classes.rst | 11 ++- Doc/whatsnew/3.0.rst | 35 ++++----- Lib/os.py | 4 +- Misc/build.sh | 2 +- Parser/Python.asdl | 2 +- Python/Python-ast.c | 4 +- Python/bltinmodule.c | 4 +- 22 files changed, 328 insertions(+), 330 deletions(-) diff --git a/Doc/c-api/arg.rst b/Doc/c-api/arg.rst index d64cc5c..e90ac39 100644 --- a/Doc/c-api/arg.rst +++ b/Doc/c-api/arg.rst @@ -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. diff --git a/Doc/extending/newtypes.rst b/Doc/extending/newtypes.rst index 931c2b5..e6b52c5 100644 --- a/Doc/extending/newtypes.rst +++ b/Doc/extending/newtypes.rst @@ -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 diff --git a/Doc/howto/webservers.rst b/Doc/howto/webservers.rst index 97c2267..401f94e 100644 --- a/Doc/howto/webservers.rst +++ b/Doc/howto/webservers.rst @@ -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 '

FastCGI Environment

' yield '' for k, v in sorted(environ.items()): - yield '' % (escape(k), escape(v)) + yield ''.format( + escape(k), escape(v)) yield '
%s%s
{0}{1}
' WSGIServer(app).run() @@ -476,8 +477,8 @@ placeholders. Python already includes such simple templates:: # a simple template - template = "

Hello %s!

" - print template % "Reader" + template = "

Hello {who}!

" + 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 diff --git a/Doc/includes/noddy.c b/Doc/includes/noddy.c index ec2d669..26a49a9 100644 --- a/Doc/includes/noddy.c +++ b/Doc/includes/noddy.c @@ -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); diff --git a/Doc/includes/noddy2.c b/Doc/includes/noddy2.c index eaa355f..5daecf9 100644 --- a/Doc/includes/noddy2.c +++ b/Doc/includes/noddy2.c @@ -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); diff --git a/Doc/includes/noddy3.c b/Doc/includes/noddy3.c index 3a1c0c2..39cdfdb 100644 --- a/Doc/includes/noddy3.c +++ b/Doc/includes/noddy3.c @@ -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); diff --git a/Doc/includes/noddy4.c b/Doc/includes/noddy4.c index ac0b1f4..94507ec 100644 --- a/Doc/includes/noddy4.c +++ b/Doc/includes/noddy4.c @@ -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); diff --git a/Doc/includes/shoddy.c b/Doc/includes/shoddy.c index 4c46bea..3757bca 100644 --- a/Doc/includes/shoddy.c +++ b/Doc/includes/shoddy.c @@ -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); diff --git a/Doc/includes/typestruct.h b/Doc/includes/typestruct.h index 0afe375..f6451b9 100644 --- a/Doc/includes/typestruct.h +++ b/Doc/includes/typestruct.h @@ -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; diff --git a/Doc/library/array.rst b/Doc/library/array.rst index 08142e1..2fb4f8a 100644 --- a/Doc/library/array.rst +++ b/Doc/library/array.rst @@ -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]) diff --git a/Doc/library/fractions.rst b/Doc/library/fractions.rst index b5a7239..0861e68 100644 --- a/Doc/library/fractions.rst +++ b/Doc/library/fractions.rst @@ -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] diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index 01849ee..2fcf027 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -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 diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index e4dbf17..e5d1781 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -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__ diff --git a/Doc/library/urllib.parse.rst b/Doc/library/urllib.parse.rst index 26376e7..d013601 100644 --- a/Doc/library/urllib.parse.rst +++ b/Doc/library/urllib.parse.rst @@ -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]]) diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst index 3038588..0b5f892 100644 --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -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" diff --git a/Doc/tutorial/classes.rst b/Doc/tutorial/classes.rst index 5831f6c..d6e8ca1 100644 --- a/Doc/tutorial/classes.rst +++ b/Doc/tutorial/classes.rst @@ -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 diff --git a/Doc/whatsnew/3.0.rst b/Doc/whatsnew/3.0.rst index 457fce0..f2d9362 100644 --- a/Doc/whatsnew/3.0.rst +++ b/Doc/whatsnew/3.0.rst @@ -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`. diff --git a/Lib/os.py b/Lib/os.py index 2fdf668..5a020d3 100644 --- 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 diff --git a/Misc/build.sh b/Misc/build.sh index 70bba81..a9b032e 100755 --- a/Misc/build.sh +++ b/Misc/build.sh @@ -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" diff --git a/Parser/Python.asdl b/Parser/Python.asdl index b4dd792..789e07b 100644 --- a/Parser/Python.asdl +++ b/Parser/Python.asdl @@ -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$" { diff --git a/Python/Python-ast.c b/Python/Python-ast.c index a0f42d5..cf79b37 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -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; diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index d7f5084..546bc20 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -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) -- cgit v0.12