Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e5384b0

Browse files
committed
Merged revisions 66670,66681,66688,66696-66699 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r66670 | georg.brandl | 2008-09-28 15:01:36 -0500 (Sun, 28 Sep 2008) | 2 lines Don't show version in title. ........ r66681 | georg.brandl | 2008-09-29 11:51:35 -0500 (Mon, 29 Sep 2008) | 2 lines Update nasm location. ........ r66688 | jesse.noller | 2008-09-29 19:15:45 -0500 (Mon, 29 Sep 2008) | 2 lines issue3770: if SEM_OPEN is 0, disable the mp.synchronize module, rev. Nick Coghlan, Damien Miller ........ r66696 | andrew.kuchling | 2008-09-30 07:31:07 -0500 (Tue, 30 Sep 2008) | 1 line Edits, and add markup ........ r66697 | andrew.kuchling | 2008-09-30 08:00:34 -0500 (Tue, 30 Sep 2008) | 1 line Markup fix ........ r66698 | andrew.kuchling | 2008-09-30 08:00:51 -0500 (Tue, 30 Sep 2008) | 1 line Markup fixes ........ r66699 | andrew.kuchling | 2008-09-30 08:01:46 -0500 (Tue, 30 Sep 2008) | 1 line Markup fixes. (optparse.rst probably needs an entire revision pass.) ........
1 parent 7d8d9a5 commit e5384b0

13 files changed

Lines changed: 71 additions & 32 deletions

File tree

Doc/c-api/number.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ Number Protocol
256256
.. cfunction:: PyObject* PyNumber_Index(PyObject *o)
257257

258258
Returns the *o* converted to a Python int or long on success or *NULL* with a
259-
TypeError exception raised on failure.
259+
:exc:`TypeError` exception raised on failure.
260260

261261

262262
.. cfunction:: PyObject* PyNumber_ToBase(PyObject *n, int base)

Doc/c-api/object.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ is considered sufficient for this determination.
257257

258258
.. cfunction:: long PyObject_HashNotImplemented(PyObject *o)
259259

260-
Set a TypeError indicating that ``type(o)`` is not hashable and return ``-1``.
260+
Set a :exc:`TypeError` indicating that ``type(o)`` is not hashable and return ``-1``.
261261
This function receives special treatment when stored in a ``tp_hash`` slot,
262262
allowing a type to explicitly indicate to the interpreter that it is not
263263
hashable.

Doc/howto/urllib2.rst

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,12 @@ which comes after we have a look at what happens when things go wrong.
182182
Handling Exceptions
183183
===================
184184

185-
*urlopen* raises ``URLError`` when it cannot handle a response (though as usual
186-
with Python APIs, builtin exceptions such as ValueError, TypeError etc. may also
185+
*urlopen* raises :exc:`URLError` when it cannot handle a response (though as usual
186+
with Python APIs, builtin exceptions such as
187+
:exc:`ValueError`, :exc:`TypeError` etc. may also
187188
be raised).
188189

189-
``HTTPError`` is the subclass of ``URLError`` raised in the specific case of
190+
:exc:`HTTPError` is the subclass of :exc:`URLError` raised in the specific case of
190191
HTTP URLs.
191192

192193
The exception classes are exported from the :mod:`urllib.error` module.
@@ -217,12 +218,12 @@ the status code indicates that the server is unable to fulfil the request. The
217218
default handlers will handle some of these responses for you (for example, if
218219
the response is a "redirection" that requests the client fetch the document from
219220
a different URL, urllib will handle that for you). For those it can't handle,
220-
urlopen will raise an ``HTTPError``. Typical errors include '404' (page not
221+
urlopen will raise an :exc:`HTTPError`. Typical errors include '404' (page not
221222
found), '403' (request forbidden), and '401' (authentication required).
222223

223224
See section 10 of RFC 2616 for a reference on all the HTTP error codes.
224225

225-
The ``HTTPError`` instance raised will have an integer 'code' attribute, which
226+
The :exc:`HTTPError` instance raised will have an integer 'code' attribute, which
226227
corresponds to the error sent by the server.
227228

228229
Error Codes
@@ -305,7 +306,7 @@ dictionary is reproduced here for convenience ::
305306
}
306307

307308
When an error is raised the server responds by returning an HTTP error code
308-
*and* an error page. You can use the ``HTTPError`` instance as a response on the
309+
*and* an error page. You can use the :exc:`HTTPError` instance as a response on the
309310
page returned. This means that as well as the code attribute, it also has read,
310311
geturl, and info, methods as returned by the ``urllib.response`` module::
311312

@@ -327,7 +328,7 @@ geturl, and info, methods as returned by the ``urllib.response`` module::
327328
Wrapping it Up
328329
--------------
329330

330-
So if you want to be prepared for ``HTTPError`` *or* ``URLError`` there are two
331+
So if you want to be prepared for :exc:`HTTPError` *or* :exc:`URLError` there are two
331332
basic approaches. I prefer the second approach.
332333

333334
Number 1
@@ -354,7 +355,7 @@ Number 1
354355
.. note::
355356

356357
The ``except HTTPError`` *must* come first, otherwise ``except URLError``
357-
will *also* catch an ``HTTPError``.
358+
will *also* catch an :exc:`HTTPError`.
358359

359360
Number 2
360361
~~~~~~~~
@@ -380,9 +381,9 @@ Number 2
380381
info and geturl
381382
===============
382383

383-
The response returned by urlopen (or the ``HTTPError`` instance) has two useful
384-
methods ``info`` and ``geturl`` and is defined in the module
385-
:mod:`urllib.response`.
384+
The response returned by urlopen (or the :exc:`HTTPError` instance) has two
385+
useful methods :meth:`info` and :meth:`geturl` and is defined in the module
386+
:mod:`urllib.response`..
386387

387388
**geturl** - this returns the real URL of the page fetched. This is useful
388389
because ``urlopen`` (or the opener object used) may have followed a

Doc/library/ctypes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1390,7 +1390,7 @@ ctypes private copy to `value` and returns the former value.
13901390

13911391
The *use_last_error* parameter, when set to True, enables the same
13921392
mechanism for the Windows error code which is managed by the
1393-
GetLastError() and SetLastError() Windows api functions;
1393+
:func:`GetLastError` and :func:`SetLastError` Windows API functions;
13941394
`ctypes.get_last_error()` and `ctypes.set_last_error(value)` are used
13951395
to request and change the ctypes private copy of the windows error
13961396
code.

Doc/library/multiprocessing.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ to this, the :mod:`multiprocessing` module allows the programmer to fully
1616
leverage multiple processors on a given machine. It runs on both Unix and
1717
Windows.
1818

19+
.. warning::
20+
21+
Some of this package's functionality requires a functioning shared semaphore
22+
implementation on the host operating system. Without one, the
23+
:mod:`multiprocessing.synchronize` module will be disabled, and attempts to
24+
import it will result in an :exc:`ImportError`. See
25+
:issue:`3770` for additional information.
1926

2027
The :class:`Process` class
2128
~~~~~~~~~~~~~~~~~~~~~~~~~~

Doc/library/optparse.rst

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ There are two broad classes of errors that :mod:`optparse` has to worry about:
597597
programmer errors and user errors. Programmer errors are usually erroneous
598598
calls to ``parser.add_option()``, e.g. invalid option strings, unknown option
599599
attributes, missing option attributes, etc. These are dealt with in the usual
600-
way: raise an exception (either ``optparse.OptionError`` or ``TypeError``) and
600+
way: raise an exception (either ``optparse.OptionError`` or :exc:`TypeError`) and
601601
let the program crash.
602602

603603
Handling user errors is much more important, since they are guaranteed to happen
@@ -794,10 +794,10 @@ And to define an option with only a long option string::
794794
The keyword arguments define attributes of the new Option object. The most
795795
important option attribute is :attr:`action`, and it largely determines which
796796
other attributes are relevant or required. If you pass irrelevant option
797-
attributes, or fail to pass required ones, :mod:`optparse` raises an OptionError
798-
exception explaining your mistake.
797+
attributes, or fail to pass required ones, :mod:`optparse` raises an
798+
:exc:`OptionError` exception explaining your mistake.
799799

800-
An options's *action* determines what :mod:`optparse` does when it encounters
800+
An option's *action* determines what :mod:`optparse` does when it encounters
801801
this option on the command-line. The standard option actions hard-coded into
802802
:mod:`optparse` are:
803803

@@ -1054,7 +1054,7 @@ Option attributes
10541054
The following option attributes may be passed as keyword arguments to
10551055
``parser.add_option()``. If you pass an option attribute that is not relevant
10561056
to a particular option, or fail to pass a required option attribute,
1057-
:mod:`optparse` raises OptionError.
1057+
:mod:`optparse` raises :exc:`OptionError`.
10581058

10591059
* :attr:`action` (default: ``"store"``)
10601060

@@ -1147,7 +1147,7 @@ error message.
11471147
``choice`` options are a subtype of ``string`` options. The ``choices`` option
11481148
attribute (a sequence of strings) defines the set of allowed option arguments.
11491149
``optparse.check_choice()`` compares user-supplied option arguments against this
1150-
master list and raises OptionValueError if an invalid string is given.
1150+
master list and raises :exc:`OptionValueError` if an invalid string is given.
11511151

11521152

11531153
.. _optparse-parsing-arguments:
@@ -1220,10 +1220,10 @@ OptionParser provides several methods to help you out:
12201220
(e.g., ``"-q"`` or ``"--verbose"``).
12211221

12221222
``remove_option(opt_str)``
1223-
If the OptionParser has an option corresponding to ``opt_str``, that option is
1223+
If the :class:`OptionParser` has an option corresponding to ``opt_str``, that option is
12241224
removed. If that option provided any other option strings, all of those option
12251225
strings become invalid. If ``opt_str`` does not occur in any option belonging to
1226-
this OptionParser, raises ValueError.
1226+
this :class:`OptionParser`, raises :exc:`ValueError`.
12271227

12281228

12291229
.. _optparse-conflicts-between-options:
@@ -1254,13 +1254,13 @@ or with a separate call::
12541254
The available conflict handlers are:
12551255

12561256
``error`` (default)
1257-
assume option conflicts are a programming error and raise OptionConflictError
1257+
assume option conflicts are a programming error and raise :exc:`OptionConflictError`
12581258

12591259
``resolve``
12601260
resolve option conflicts intelligently (see below)
12611261

12621262

1263-
As an example, let's define an OptionParser that resolves conflicts
1263+
As an example, let's define an :class:`OptionParser` that resolves conflicts
12641264
intelligently and add conflicting options to it::
12651265

12661266
parser = OptionParser(conflict_handler="resolve")
@@ -1490,7 +1490,7 @@ where
14901490
Raising errors in a callback
14911491
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14921492

1493-
The callback function should raise OptionValueError if there are any problems
1493+
The callback function should raise :exc:`OptionValueError` if there are any problems
14941494
with the option or its argument(s). :mod:`optparse` catches this and terminates
14951495
the program, printing the error message you supply to stderr. Your message
14961496
should be clear, concise, accurate, and mention the option at fault. Otherwise,
@@ -1691,9 +1691,9 @@ type-checking function will wind up in the OptionValues instance returned by
16911691
:meth:`OptionParser.parse_args`, or be passed to a callback as the ``value``
16921692
parameter.
16931693

1694-
Your type-checking function should raise OptionValueError if it encounters any
1695-
problems. OptionValueError takes a single string argument, which is passed
1696-
as-is to OptionParser's :meth:`error` method, which in turn prepends the program
1694+
Your type-checking function should raise :exc:`OptionValueError` if it encounters any
1695+
problems. :exc:`OptionValueError` takes a single string argument, which is passed
1696+
as-is to :class:`OptionParser`'s :meth:`error` method, which in turn prepends the program
16971697
name and the string ``"error:"`` and prints everything to stderr before
16981698
terminating the process.
16991699

Doc/library/subprocess.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ This module also defines four shortcut functions:
133133
.. function:: check_call(*popenargs, **kwargs)
134134

135135
Run command with arguments. Wait for command to complete. If the exit code was
136-
zero then return, otherwise raise :exc:`CalledProcessError.` The
136+
zero then return, otherwise raise :exc:`CalledProcessError`. The
137137
:exc:`CalledProcessError` object will have the return code in the
138138
:attr:`returncode` attribute.
139139

Doc/tools/sphinxext/download.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
{% set dlbase = 'http://docs.python.org/ftp/python/doc/' + release %}
44
{% block body %}
55

6-
<h1>Download Python {{ release }} Documentation
7-
{%- if last_updated %} (last updated on {{ last_updated }}){% endif %}</h1>
6+
<h1>Download Python {{ release }} Documentation</h1>
87

98
{% if 'a' in release or 'b' in release or 'c' in release %}
109
<p>We don't package the documentation for development releases for download.
1110
Downloads will be available for the final release.</p>
1211

1312
{% else %}
13+
{% if last_updated %}<p><b>Last updated on: {{ last_updated }}.</b></p>{% endif %}
14+
1415
<p>To download an archive containing all the documents for this version of
1516
Python in one of various formats, follow one of links in this table. The numbers
1617
in the table are the size of the download files in Kilobytes.</p>

Lib/multiprocessing/synchronize.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,17 @@
2121
from multiprocessing.util import Finalize, register_after_fork, debug
2222
from multiprocessing.forking import assert_spawning, Popen
2323

24+
# Try to import the mp.synchronize module cleanly, if it fails
25+
# raise ImportError for platforms lacking a working sem_open implementation.
26+
# See issue 3770
27+
try:
28+
from _multiprocessing import SemLock
29+
except (ImportError):
30+
raise ImportError("This platform lacks a functioning sem_open" +
31+
" implementation, therefore, the required" +
32+
" synchronization primitives needed will not" +
33+
" function, see issue 3770.")
34+
2435
#
2536
# Constants
2637
#

Lib/test/regrtest.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,6 +1075,7 @@ def printlist(x, width=70, indent=4):
10751075
test_tcl
10761076
test_timeout
10771077
test_urllibnet
1078+
test_multiprocessing
10781079
""",
10791080
'aix5':
10801081
"""
@@ -1102,6 +1103,7 @@ def printlist(x, width=70, indent=4):
11021103
test_ossaudiodev
11031104
test_pep277
11041105
test_tcl
1106+
test_multiprocessing
11051107
""",
11061108
'netbsd3':
11071109
"""
@@ -1115,6 +1117,7 @@ def printlist(x, width=70, indent=4):
11151117
test_ossaudiodev
11161118
test_pep277
11171119
test_tcl
1120+
test_multiprocessing
11181121
""",
11191122
}
11201123
_expectations['freebsd5'] = _expectations['freebsd4']

0 commit comments

Comments
 (0)