From 1f01debe6f94d7f178e14ee7417786461b724e96 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Sat, 3 Jan 2009 22:47:39 +0000 Subject: Merged revisions 68162,68166,68171,68176,68195-68196,68210,68232 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r68162 | ronald.oussoren | 2009-01-02 16:06:00 +0100 (Fri, 02 Jan 2009) | 3 lines Fix for issue 4472 is incompatible with Cygwin, this patch should fix that. ........ r68166 | benjamin.peterson | 2009-01-02 19:26:23 +0100 (Fri, 02 Jan 2009) | 1 line document PyMemberDef ........ r68171 | georg.brandl | 2009-01-02 21:25:14 +0100 (Fri, 02 Jan 2009) | 3 lines #4811: fix markup glitches (mostly remains of the conversion), found by Gabriel Genellina. ........ r68176 | andrew.kuchling | 2009-01-02 22:00:35 +0100 (Fri, 02 Jan 2009) | 1 line Add various items ........ r68195 | georg.brandl | 2009-01-03 14:45:15 +0100 (Sat, 03 Jan 2009) | 2 lines Remove useless string literal. ........ r68196 | georg.brandl | 2009-01-03 15:29:53 +0100 (Sat, 03 Jan 2009) | 2 lines Fix indentation. ........ r68210 | georg.brandl | 2009-01-03 20:10:12 +0100 (Sat, 03 Jan 2009) | 2 lines Set eol-style correctly for mp_distributing.py. ........ r68232 | georg.brandl | 2009-01-03 22:52:16 +0100 (Sat, 03 Jan 2009) | 2 lines Grammar fix. ........ --- Doc/ACKS.txt | 1 + Doc/c-api/arg.rst | 5 ++-- Doc/c-api/structures.rst | 61 +++++++++++++++++++++++++++++++++++++++++ Doc/distutils/apiref.rst | 7 +++-- Doc/howto/functional.rst | 2 +- Doc/howto/urllib2.rst | 2 +- Doc/install/index.rst | 2 +- Doc/library/email.mime.rst | 4 +-- Doc/library/gzip.rst | 2 +- Doc/library/http.cookiejar.rst | 2 +- Doc/library/json.rst | 2 +- Doc/library/multiprocessing.rst | 30 ++++++++++---------- Doc/library/numbers.rst | 12 ++++---- Doc/library/parser.rst | 2 +- Doc/library/smtplib.rst | 2 +- Doc/library/urllib.parse.rst | 2 +- Doc/tutorial/inputoutput.rst | 2 +- Doc/using/cmdline.rst | 2 +- Doc/whatsnew/2.4.rst | 2 +- Doc/whatsnew/2.5.rst | 2 +- Doc/whatsnew/2.7.rst | 29 ++++++++++++++++++-- Makefile.pre.in | 4 +-- Parser/asdl.py | 2 +- 23 files changed, 135 insertions(+), 46 deletions(-) diff --git a/Doc/ACKS.txt b/Doc/ACKS.txt index 4537c65..775798b 100644 --- a/Doc/ACKS.txt +++ b/Doc/ACKS.txt @@ -60,6 +60,7 @@ docs@python.org), and we'll be glad to correct the problem. * Peter Funk * Lele Gaifax * Matthew Gallagher + * Gabriel Genellina * Ben Gertzfield * Nadim Ghaznavi * Jonathan Giddy diff --git a/Doc/c-api/arg.rst b/Doc/c-api/arg.rst index 1b2ab8f..96068d9 100644 --- a/Doc/c-api/arg.rst +++ b/Doc/c-api/arg.rst @@ -53,8 +53,9 @@ variable(s) whose address should be passed. string may contain embedded null bytes. Unicode objects pass back a pointer to the default encoded string version of the object if such a conversion is possible. All other read-buffer compatible objects pass back a reference to - the raw internal data representation. Since this format doesn't allow writable buffer compatible objects like byte - arrays, ``s*`` is to be preferred. + the raw internal data representation. Since this format doesn't allow + writable buffer compatible objects like byte arrays, ``s*`` is to be + preferred. The type of the length argument (int or :ctype:`Py_ssize_t`) is controlled by defining the macro :cmacro:`PY_SSIZE_T_CLEAN` before including diff --git a/Doc/c-api/structures.rst b/Doc/c-api/structures.rst index 04fe8f4..fdbd806 100644 --- a/Doc/c-api/structures.rst +++ b/Doc/c-api/structures.rst @@ -198,3 +198,64 @@ definition with the same method name. object and will co-exist with the slot. This is helpful because calls to PyCFunctions are optimized more than wrapper object calls. + +.. ctype:: PyMemberDef + + Structure which describes an attribute of a type which corresponds to a C + struct member. Its fields are: + + +------------------+-------------+-------------------------------+ + | Field | C Type | Meaning | + +==================+=============+===============================+ + | :attr:`name` | char \* | name of the member | + +------------------+-------------+-------------------------------+ + | :attr:`type` | int | the type of the member in the | + | | | C struct | + +------------------+-------------+-------------------------------+ + | :attr:`offset` | Py_ssize_t | the offset in bytes that the | + | | | member is located on the | + | | | type's object struct | + +------------------+-------------+-------------------------------+ + | :attr:`flags` | int | flag bits indicating if the | + | | | field should be read-only or | + | | | writable | + +------------------+-------------+-------------------------------+ + | :attr:`doc` | char \* | points to the contents of the | + | | | docstring | + +------------------+-------------+-------------------------------+ + + :attr:`type` can be one of many ``T_`` macros corresponding to various C + types. When the member is accessed in Python, it will be converted to the + equivalent Python type. + + =============== ================== + Macro name C type + =============== ================== + T_SHORT short + T_INT int + T_LONG long + T_FLOAT float + T_DOUBLE double + T_STRING char \* + T_OBJECT PyObject \* + T_OBJECT_EX PyObject \* + T_CHAR char + T_BYTE char + T_UNBYTE unsigned char + T_UINT unsigned int + T_USHORT unsigned short + T_ULONG unsigned long + T_BOOL char + T_LONGLONG long long + T_ULONGLONG unsigned long long + T_PYSSIZET Py_ssize_t + =============== ================== + + :cmacro:`T_OBJECT` and :cmacro:`T_OBJECT_EX` differ in that + :cmacro:`T_OBJECT` returns ``None`` if the member is *NULL* and + :cmacro:`T_OBJECT_EX` raises an :exc:`AttributeError`. + + :attr:`flags` can be 0 for write and read access or :cmacro:`READONLY` for + read-only access. Using :cmacro:`T_STRING` for :attr:`type` implies + :cmacro:`READONLY`. Only :cmacro:`T_OBJECT` and :cmacro:`T_OBJECT_EX` + members can be deleted. (They are set to *NULL*). diff --git a/Doc/distutils/apiref.rst b/Doc/distutils/apiref.rst index 868099b..6129934 100644 --- a/Doc/distutils/apiref.rst +++ b/Doc/distutils/apiref.rst @@ -188,9 +188,10 @@ the full reference. | | for C/C++ header files (in | | | | Unix form for portability) | | +------------------------+--------------------------------+---------------------------+ - | *define_macros* | list of macros to define; each | (string,string) tuple or | - | | macro is defined using a | (name,``None``) | - | | 2-tuple, where 'value' is | | + | *define_macros* | list of macros to define; each | (string, string) tuple or | + | | macro is defined using a | (name, ``None``) | + | | 2-tuple ``(name, value)``, | | + | | where *value* is | | | | either the string to define it | | | | to or ``None`` to define it | | | | without a particular value | | diff --git a/Doc/howto/functional.rst b/Doc/howto/functional.rst index cfa831e..9aa0aed 100644 --- a/Doc/howto/functional.rst +++ b/Doc/howto/functional.rst @@ -586,7 +586,7 @@ And here's an example of changing the counter: 9 >>> next(it) Traceback (most recent call last): - File ``t.py'', line 15, in ? + File "t.py", line 15, in ? it.next() StopIteration diff --git a/Doc/howto/urllib2.rst b/Doc/howto/urllib2.rst index b71b300..e57f9e5 100644 --- a/Doc/howto/urllib2.rst +++ b/Doc/howto/urllib2.rst @@ -475,7 +475,7 @@ than the URL you pass to .add_password() will also match. :: password_mgr = urllib.request.HTTPPasswordMgrWithDefaultRealm() # Add the username and password. - # If we knew the realm, we could use it instead of ``None``. + # If we knew the realm, we could use it instead of None. top_level_url = "http://example.com/foo/" password_mgr.add_password(None, top_level_url, username, password) diff --git a/Doc/install/index.rst b/Doc/install/index.rst index 3b47f72..42f41a7 100644 --- a/Doc/install/index.rst +++ b/Doc/install/index.rst @@ -584,7 +584,7 @@ value of ``sys.path``. :: $ python Python 2.2 (#11, Oct 3 2002, 13:31:27) [GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2 - Type ``help'', ``copyright'', ``credits'' or ``license'' for more information. + Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> sys.path ['', '/usr/local/lib/python2.3', '/usr/local/lib/python2.3/plat-linux2', diff --git a/Doc/library/email.mime.rst b/Doc/library/email.mime.rst index 83f4228..95407b0 100644 --- a/Doc/library/email.mime.rst +++ b/Doc/library/email.mime.rst @@ -55,14 +55,14 @@ Here are the classes: .. currentmodule:: email.mime.multipart -.. class:: MIMEMultipart([subtype[, boundary[, _subparts[, _params]]]]) +.. class:: MIMEMultipart([_subtype[, boundary[, _subparts[, _params]]]]) Module: :mod:`email.mime.multipart` A subclass of :class:`MIMEBase`, this is an intermediate base class for MIME messages that are :mimetype:`multipart`. Optional *_subtype* defaults to :mimetype:`mixed`, but can be used to specify the subtype of the message. A - :mailheader:`Content-Type` header of :mimetype:`multipart/`*_subtype* will be + :mailheader:`Content-Type` header of :mimetype:`multipart/_subtype` will be added to the message object. A :mailheader:`MIME-Version` header will also be added. diff --git a/Doc/library/gzip.rst b/Doc/library/gzip.rst index 86be3cd..c6f9ef8 100644 --- a/Doc/library/gzip.rst +++ b/Doc/library/gzip.rst @@ -7,7 +7,7 @@ This module provides a simple interface to compress and decompress files just like the GNU programs :program:`gzip` and :program:`gunzip` would. -The data compression is provided by the :mod:``zlib`` module. +The data compression is provided by the :mod:`zlib` module. The :mod:`gzip` module provides the :class:`GzipFile` class which is modeled after Python's File Object. The :class:`GzipFile` class reads and writes diff --git a/Doc/library/http.cookiejar.rst b/Doc/library/http.cookiejar.rst index 79c89c7..7141d5b 100644 --- a/Doc/library/http.cookiejar.rst +++ b/Doc/library/http.cookiejar.rst @@ -704,7 +704,7 @@ accessed using the following methods: The :class:`Cookie` class also defines the following method: -.. method:: Cookie.is_expired([now=:const:`None`]) +.. method:: Cookie.is_expired([now=None]) True if cookie has passed the time at which the server requested it should expire. If *now* is given (in seconds since the epoch), return whether the diff --git a/Doc/library/json.rst b/Doc/library/json.rst index 69d4c10..22925f5 100644 --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -151,7 +151,7 @@ Basic Usage *default(obj)* is a function that should return a serializable version of *obj* or raise :exc:`TypeError`. The default simply raises :exc:`TypeError`. - To use a custom :class:`JSONEncoder`` subclass (e.g. one that overrides the + To use a custom :class:`JSONEncoder` subclass (e.g. one that overrides the :meth:`default` method to serialize additional types), specify it with the *cls* kwarg. diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst index e5dd1ed..6334d32 100644 --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -107,12 +107,12 @@ processes: def f(q): q.put([42, None, 'hello']) - if __name__ == '__main__': - q = Queue() - p = Process(target=f, args=(q,)) - p.start() - print(q.get()) # prints "[42, None, 'hello']" - p.join() + if __name__ == '__main__': + q = Queue() + p = Process(target=f, args=(q,)) + p.start() + print(q.get()) # prints "[42, None, 'hello']" + p.join() Queues are thread and process safe. @@ -1136,18 +1136,18 @@ their parent process exits. The manager classes are defined in the Returns a :class:`Server` object which represents the actual server under the control of the Manager. The :class:`Server` object supports the - :meth:`serve_forever` method:: + :meth:`serve_forever` method: - >>> from multiprocessing.managers import BaseManager - >>> m = BaseManager(address=('', 50000), authkey='abc')) - >>> server = m.get_server() - >>> s.serve_forever() + >>> from multiprocessing.managers import BaseManager + >>> m = BaseManager(address=('', 50000), authkey='abc')) + >>> server = m.get_server() + >>> s.serve_forever() - :class:`Server` additionally have an :attr:`address` attribute. + :class:`Server` additionally have an :attr:`address` attribute. .. method:: connect() - Connect a local manager object to a remote manager process:: + Connect a local manager object to a remote manager process: >>> from multiprocessing.managers import BaseManager >>> m = BaseManager(address='127.0.0.1', authkey='abc)) @@ -1293,7 +1293,7 @@ Customized managers >>>>>>>>>>>>>>>>>>> To create one's own manager, one creates a subclass of :class:`BaseManager` and -use the :meth:`~BaseManager.resgister` classmethod to register new types or +use the :meth:`~BaseManager.register` classmethod to register new types or callables with the manager class. For example:: from multiprocessing.managers import BaseManager @@ -1809,7 +1809,7 @@ Address Formats * An ``'AF_PIPE'`` address is a string of the form :samp:`r'\\\\.\\pipe\\{PipeName}'`. To use :func:`Client` to connect to a named - pipe on a remote computer called ServerName* one should use an address of the + pipe on a remote computer called *ServerName* one should use an address of the form :samp:`r'\\\\{ServerName}\\pipe\\{PipeName}'`` instead. Note that any string beginning with two backslashes is assumed by default to be diff --git a/Doc/library/numbers.rst b/Doc/library/numbers.rst index e2d08bb..ae14c90 100644 --- a/Doc/library/numbers.rst +++ b/Doc/library/numbers.rst @@ -49,14 +49,14 @@ The numeric tower :func:`round`, :func:`math.floor`, :func:`math.ceil`, :func:`divmod`, ``//``, ``%``, ``<``, ``<=``, ``>``, and ``>=``. - Real also provides defaults for :func:`complex`, :attr:`Complex.real`, - :attr:`Complex.imag`, and :meth:`Complex.conjugate`. + Real also provides defaults for :func:`complex`, :attr:`~Complex.real`, + :attr:`~Complex.imag`, and :meth:`~Complex.conjugate`. .. class:: Rational Subtypes :class:`Real` and adds - :attr:`Rational.numerator` and :attr:`Rational.denominator` properties, which + :attr:`~Rational.numerator` and :attr:`~Rational.denominator` properties, which should be in lowest terms. With these, it provides a default for :func:`float`. @@ -72,8 +72,8 @@ The numeric tower .. class:: Integral Subtypes :class:`Rational` and adds a conversion to :class:`int`. - Provides defaults for :func:`float`, :attr:`Rational.numerator`, and - :attr:`Rational.denominator`, and bit-string operations: ``<<``, + Provides defaults for :func:`float`, :attr:`~Rational.numerator`, and + :attr:`~Rational.denominator`, and bit-string operations: ``<<``, ``>>``, ``&``, ``^``, ``|``, ``~``. @@ -169,7 +169,7 @@ Complex``. I'll consider ``a + b``: knowledge of ``A``, so it can handle those instances before delegating to :class:`Complex`. -If ``A<:Complex`` and ``B<:Real`` without sharing any other knowledge, +If ``A <: Complex`` and ``B <: Real`` without sharing any other knowledge, then the appropriate shared operation is the one involving the built in :class:`complex`, and both :meth:`__radd__` s land there, so ``a+b == b+a``. diff --git a/Doc/library/parser.rst b/Doc/library/parser.rst index f5cd877..5aad938 100644 --- a/Doc/library/parser.rst +++ b/Doc/library/parser.rst @@ -635,7 +635,7 @@ on the same line as the definition of the code block, as in :: while the long form uses an indented block and allows nested definitions:: def make_power(exp): - "Make a function that raises an argument to the exponent `exp'." + "Make a function that raises an argument to the exponent `exp`." def raiser(x, y=exp): return x ** y return raiser diff --git a/Doc/library/smtplib.rst b/Doc/library/smtplib.rst index 21065b2..5363120 100644 --- a/Doc/library/smtplib.rst +++ b/Doc/library/smtplib.rst @@ -200,7 +200,7 @@ An :class:`SMTP` instance has the following methods: previous ``EHLO`` or ``HELO`` command this session. It tries ESMTP ``EHLO`` first. - :exc:SMTPHeloError + :exc:`SMTPHeloError` The server didn't reply properly to the ``HELO`` greeting. .. method:: SMTP.has_extn(name) diff --git a/Doc/library/urllib.parse.rst b/Doc/library/urllib.parse.rst index d013601..28fa66f 100644 --- a/Doc/library/urllib.parse.rst +++ b/Doc/library/urllib.parse.rst @@ -365,7 +365,7 @@ described in those functions, as well as provide an additional method: 'http://www.Python.org/doc/' -The following classes provide the implementations of the parse results:: +The following classes provide the implementations of the parse results: .. class:: BaseResult diff --git a/Doc/tutorial/inputoutput.rst b/Doc/tutorial/inputoutput.rst index 1fd779f..9b90323 100644 --- a/Doc/tutorial/inputoutput.rst +++ b/Doc/tutorial/inputoutput.rst @@ -151,7 +151,7 @@ Positional and keyword arguments can be arbitrarily combined:: other='Georg')) The story of Bill, Manfred, and Georg. -An optional ``':``` and format specifier can follow the field name. This also +An optional ``':'`` and format specifier can follow the field name. This also greater control over how the value is formatted. The following example truncates the Pi to three places after the decimal. diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst index bfebd9d..3481d5b 100644 --- a/Doc/using/cmdline.rst +++ b/Doc/using/cmdline.rst @@ -343,7 +343,7 @@ These environment variables influence Python's behavior. compiled form). Extension modules cannot be imported from zipfiles. The default search path is installation dependent, but generally begins with - :file:`{prefix}/lib/python{version}`` (see :envvar:`PYTHONHOME` above). It + :file:`{prefix}/lib/python{version}` (see :envvar:`PYTHONHOME` above). It is *always* appended to :envvar:`PYTHONPATH`. An additional directory will be inserted in the search path in front of diff --git a/Doc/whatsnew/2.4.rst b/Doc/whatsnew/2.4.rst index 67478c2..9e438ac 100644 --- a/Doc/whatsnew/2.4.rst +++ b/Doc/whatsnew/2.4.rst @@ -1428,7 +1428,7 @@ Running the above function's tests with :const:`doctest.REPORT_UDIFF` specified, you get the following output:: ********************************************************************** - File ``t.py'', line 15, in g + File "t.py", line 15, in g Failed example: g(4) Differences (unified diff with -expected +actual): diff --git a/Doc/whatsnew/2.5.rst b/Doc/whatsnew/2.5.rst index 16350ac..e1e2887 100644 --- a/Doc/whatsnew/2.5.rst +++ b/Doc/whatsnew/2.5.rst @@ -485,7 +485,7 @@ And here's an example of changing the counter:: 9 >>> print it.next() Traceback (most recent call last): - File ``t.py'', line 15, in ? + File "t.py", line 15, in ? print it.next() StopIteration diff --git a/Doc/whatsnew/2.7.rst b/Doc/whatsnew/2.7.rst index 61084c8..da17620 100644 --- a/Doc/whatsnew/2.7.rst +++ b/Doc/whatsnew/2.7.rst @@ -103,7 +103,23 @@ changes, sorted alphabetically by module name. Consult the :file:`Misc/NEWS` file in the source tree for a more complete list of changes, or look through the Subversion logs for all the details. -* To be written. +* A new function in the :mod:`subprocess` module, + :func:`check_output`, runs a command with a specified set of arguments + and returns the command's output as a string if the command runs without + error, or raises a :exc:`CalledProcessError` exception otherwise. + + :: + + >>> subprocess.check_output(['df', '-h', '.']) + 'Filesystem Size Used Avail Capacity Mounted on\n + /dev/disk0s2 52G 49G 3.0G 94% /\n' + + >>> subprocess.check_output(['df', '-h', '/bogus']) + ... + subprocess.CalledProcessError: Command '['df', '-h', '/bogus']' returned non-zero exit status 1 + + (Contributed by Gregory P. Smith.) + .. ====================================================================== .. whole new modules get described in subsections here @@ -116,13 +132,22 @@ Build and C API Changes Changes to Python's build process and to the C API include: -* To be written. +* If you use the :file:`.gdbinit` file provided with Python, + the "pyo" macro in the 2.7 version will now work when the thread being + debugged doesn't hold the GIL; the macro will now acquire it before printing. + (Contributed by haypo XXX; :issue:`3632`.) .. ====================================================================== Port-Specific Changes: Windows ----------------------------------- +* The :mod:`msvcrt` module now contains some constants from + the :file:`crtassem.h` header file: + :data:`CRT_ASSEMBLY_VERSION`, + :data:`VC_ASSEMBLY_PUBLICKEYTOKEN`, + and :data:`LIBRARIES_ASSEMBLY_NAME_PREFIX`. + (Added by Martin von Loewis (XXX check); :issue:`4365`.) .. ====================================================================== diff --git a/Makefile.pre.in b/Makefile.pre.in index 6f89a21..7cd0b4d 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -777,8 +777,8 @@ altbininstall: $(BUILDPYTHON) done $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE) if test -f $(LDLIBRARY); then \ - if test "$(SO)" = .dll; then \ - $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(BINDIR); \ + if test -n "$(DLLLIBRARY)" ; then \ + $(INSTALL_SHARED) $(DLLLIBRARY) $(DESTDIR)$(BINDIR); \ else \ $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \ if test $(LDLIBRARY) != $(INSTSONAME); then \ diff --git a/Parser/asdl.py b/Parser/asdl.py index 3583d84..418ac57 100644 --- a/Parser/asdl.py +++ b/Parser/asdl.py @@ -176,7 +176,7 @@ class ASDLParser(spark.GenericParser, object): return Product(fields) def p_sum_0(self, constructor): - " sum ::= constructor """ + " sum ::= constructor " return [constructor[0]] def p_sum_1(self, info): -- cgit v0.12