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

Skip to content

Commit 13f959b

Browse files
committed
Merged revisions 83561,83563,83565-83566,83569,83571,83574-83575,83580,83584,83599,83612,83659,83977,84015-84018,84020,84141 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k ........ r83561 | georg.brandl | 2010-08-02 22:17:50 +0200 (Mo, 02 Aug 2010) | 1 line #4280: remove outdated "versionchecker" tool. ........ r83563 | georg.brandl | 2010-08-02 22:21:21 +0200 (Mo, 02 Aug 2010) | 1 line #9037: add example how to raise custom exceptions from C code. ........ r83565 | georg.brandl | 2010-08-02 22:27:20 +0200 (Mo, 02 Aug 2010) | 1 line #9111: document that do_help() looks at docstrings. ........ r83566 | georg.brandl | 2010-08-02 22:30:57 +0200 (Mo, 02 Aug 2010) | 1 line #9019: remove false (in 3k) claim about Headers updates. ........ r83569 | georg.brandl | 2010-08-02 22:39:35 +0200 (Mo, 02 Aug 2010) | 1 line #7797: be explicit about bytes-oriented interface of base64 functions. ........ r83571 | georg.brandl | 2010-08-02 22:44:34 +0200 (Mo, 02 Aug 2010) | 1 line Clarify that abs() is not a namespace. ........ r83574 | georg.brandl | 2010-08-02 22:47:56 +0200 (Mo, 02 Aug 2010) | 1 line #6867: epoll.register() returns None. ........ r83575 | georg.brandl | 2010-08-02 22:52:10 +0200 (Mo, 02 Aug 2010) | 1 line #9238: zipfile does handle archive comments. ........ r83580 | georg.brandl | 2010-08-02 23:02:36 +0200 (Mo, 02 Aug 2010) | 1 line #8119: fix copy-paste error. ........ r83584 | georg.brandl | 2010-08-02 23:07:14 +0200 (Mo, 02 Aug 2010) | 1 line #9457: fix documentation links for 3.2. ........ r83599 | georg.brandl | 2010-08-02 23:51:18 +0200 (Mo, 02 Aug 2010) | 1 line #9061: warn that single quotes are never escaped. ........ r83612 | georg.brandl | 2010-08-03 00:59:44 +0200 (Di, 03 Aug 2010) | 1 line Fix unicode literal. ........ r83659 | georg.brandl | 2010-08-03 14:06:29 +0200 (Di, 03 Aug 2010) | 1 line Terminology fix: exceptions are raised, except in generator.throw(). ........ r83977 | georg.brandl | 2010-08-13 17:10:49 +0200 (Fr, 13 Aug 2010) | 1 line Fix copy-paste error. ........ r84015 | georg.brandl | 2010-08-14 17:44:34 +0200 (Sa, 14 Aug 2010) | 1 line Add some maintainers. ........ r84016 | georg.brandl | 2010-08-14 17:46:15 +0200 (Sa, 14 Aug 2010) | 1 line Wording fix. ........ r84017 | georg.brandl | 2010-08-14 17:46:59 +0200 (Sa, 14 Aug 2010) | 1 line Typo fix. ........ r84018 | georg.brandl | 2010-08-14 17:48:49 +0200 (Sa, 14 Aug 2010) | 1 line Typo fix. ........ r84020 | georg.brandl | 2010-08-14 17:57:20 +0200 (Sa, 14 Aug 2010) | 1 line Fix format. ........ r84141 | georg.brandl | 2010-08-17 16:11:59 +0200 (Di, 17 Aug 2010) | 1 line Markup nits. ........
1 parent 4009c9e commit 13f959b

32 files changed

Lines changed: 93 additions & 282 deletions

Doc/c-api/init.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,7 @@ Python-level trace functions in previous versions.
959959
.. cvar:: int PyTrace_C_EXCEPTION
960960

961961
The value for the *what* parameter to :ctype:`Py_tracefunc` functions when a C
962-
function has thrown an exception.
962+
function has raised an exception.
963963

964964

965965
.. cvar:: int PyTrace_C_RETURN

Doc/c-api/unicode.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ These are the UTF-7 codec APIs:
653653
*s*. Return *NULL* if an exception was raised by the codec.
654654

655655

656-
.. cfunction:: PyObject* PyUnicode_DecodeUTF8Stateful(const char *s, Py_ssize_t size, const char *errors, Py_ssize_t *consumed)
656+
.. cfunction:: PyObject* PyUnicode_DecodeUTF7Stateful(const char *s, Py_ssize_t size, const char *errors, Py_ssize_t *consumed)
657657

658658
If *consumed* is *NULL*, behave like :cfunc:`PyUnicode_DecodeUTF7`. If
659659
*consumed* is not *NULL*, trailing incomplete UTF-7 base-64 sections will not

Doc/extending/extending.rst

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,28 @@ needed to ensure that it will not be discarded, causing :cdata:`SpamError` to
219219
become a dangling pointer. Should it become a dangling pointer, C code which
220220
raises the exception could cause a core dump or other unintended side effects.
221221

222-
We discuss the use of PyMODINIT_FUNC as a function return type later in this
222+
We discuss the use of ``PyMODINIT_FUNC`` as a function return type later in this
223223
sample.
224224

225+
The :exc:`spam.error` exception can be raised in your extension module using a
226+
call to :cfunc:`PyErr_SetString` as shown below::
227+
228+
static PyObject *
229+
spam_system(PyObject *self, PyObject *args)
230+
{
231+
const char *command;
232+
int sts;
233+
234+
if (!PyArg_ParseTuple(args, "s", &command))
235+
return NULL;
236+
sts = system(command);
237+
if (sts < 0) {
238+
PyErr_SetString(SpamError, "System command failed");
239+
return NULL;
240+
}
241+
return PyLong_FromLong(sts);
242+
}
243+
225244

226245
.. _backtoexample:
227246

Doc/faq/library.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -674,8 +674,8 @@ Yes. Here's a simple example that uses urllib.request::
674674
'/cgi-bin/some-cgi-script', data=qs)
675675
msg, hdrs = req.read(), req.info()
676676

677-
Note that in general for a percent-encoded POST operations, query strings must be
678-
quoted by using :func:`urllib.parse.urlencode`. For example to send name="Guy Steele,
677+
Note that in general for percent-encoded POST operations, query strings must be
678+
quoted using :func:`urllib.parse.urlencode`. For example to send name="Guy Steele,
679679
Jr."::
680680

681681
>>> import urllib.parse

Doc/library/base64.rst

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,62 +24,62 @@ The modern interface provides:
2424

2525
.. function:: b64encode(s, altchars=None)
2626

27-
Encode a string use Base64.
27+
Encode a byte string use Base64.
2828

2929
*s* is the string to encode. Optional *altchars* must be a string of at least
3030
length 2 (additional characters are ignored) which specifies an alternative
3131
alphabet for the ``+`` and ``/`` characters. This allows an application to e.g.
3232
generate URL or filesystem safe Base64 strings. The default is ``None``, for
3333
which the standard Base64 alphabet is used.
3434

35-
The encoded string is returned.
35+
The encoded byte string is returned.
3636

3737

3838
.. function:: b64decode(s, altchars=None)
3939

40-
Decode a Base64 encoded string.
40+
Decode a Base64 encoded byte string.
4141

4242
*s* is the string to decode. Optional *altchars* must be a string of at least
4343
length 2 (additional characters are ignored) which specifies the alternative
4444
alphabet used instead of the ``+`` and ``/`` characters.
4545

46-
The decoded string is returned. A :exc:`TypeError` is raised if *s* were
46+
The decoded byte string is returned. A :exc:`TypeError` is raised if *s* were
4747
incorrectly padded or if there are non-alphabet characters present in the
4848
string.
4949

5050

5151
.. function:: standard_b64encode(s)
5252

53-
Encode string *s* using the standard Base64 alphabet.
53+
Encode byte string *s* using the standard Base64 alphabet.
5454

5555

5656
.. function:: standard_b64decode(s)
5757

58-
Decode string *s* using the standard Base64 alphabet.
58+
Decode byte string *s* using the standard Base64 alphabet.
5959

6060

6161
.. function:: urlsafe_b64encode(s)
6262

63-
Encode string *s* using a URL-safe alphabet, which substitutes ``-`` instead of
63+
Encode byte string *s* using a URL-safe alphabet, which substitutes ``-`` instead of
6464
``+`` and ``_`` instead of ``/`` in the standard Base64 alphabet. The result
6565
can still contain ``=``.
6666

6767

6868
.. function:: urlsafe_b64decode(s)
6969

70-
Decode string *s* using a URL-safe alphabet, which substitutes ``-`` instead of
70+
Decode byte string *s* using a URL-safe alphabet, which substitutes ``-`` instead of
7171
``+`` and ``_`` instead of ``/`` in the standard Base64 alphabet.
7272

7373

7474
.. function:: b32encode(s)
7575

76-
Encode a string using Base32. *s* is the string to encode. The encoded string
76+
Encode a byte string using Base32. *s* is the string to encode. The encoded string
7777
is returned.
7878

7979

8080
.. function:: b32decode(s, casefold=False, map01=None)
8181

82-
Decode a Base32 encoded string.
82+
Decode a Base32 encoded byte string.
8383

8484
*s* is the string to decode. Optional *casefold* is a flag specifying whether a
8585
lowercase alphabet is acceptable as input. For security purposes, the default
@@ -92,27 +92,27 @@ The modern interface provides:
9292
digit 0 is always mapped to the letter O). For security purposes the default is
9393
``None``, so that 0 and 1 are not allowed in the input.
9494

95-
The decoded string is returned. A :exc:`TypeError` is raised if *s* were
95+
The decoded byte string is returned. A :exc:`TypeError` is raised if *s* were
9696
incorrectly padded or if there are non-alphabet characters present in the
9797
string.
9898

9999

100100
.. function:: b16encode(s)
101101

102-
Encode a string using Base16.
102+
Encode a byte string using Base16.
103103

104-
*s* is the string to encode. The encoded string is returned.
104+
*s* is the string to encode. The encoded byte string is returned.
105105

106106

107107
.. function:: b16decode(s, casefold=False)
108108

109-
Decode a Base16 encoded string.
109+
Decode a Base16 encoded byte string.
110110

111111
*s* is the string to decode. Optional *casefold* is a flag specifying whether a
112112
lowercase alphabet is acceptable as input. For security purposes, the default
113113
is ``False``.
114114

115-
The decoded string is returned. A :exc:`TypeError` is raised if *s* were
115+
The decoded byte string is returned. A :exc:`TypeError` is raised if *s* were
116116
incorrectly padded or if there are non-alphabet characters present in the
117117
string.
118118

Doc/library/bdb.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ The :mod:`bdb` module also defines two classes:
108108
* ``"exception"``: An exception has occurred.
109109
* ``"c_call"``: A C function is about to be called.
110110
* ``"c_return"``: A C function has returned.
111-
* ``"c_exception"``: A C function has thrown an exception.
111+
* ``"c_exception"``: A C function has raised an exception.
112112

113113
For the Python events, specialized functions (see below) are called. For
114114
the C events, no action is taken.

Doc/library/cgi.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,10 @@ algorithms implemented in this module in other circumstances.
330330
:func:`~xml.sax.saxutils.quoteattr` function in the :mod:`xml.sax.saxutils`
331331
module instead.
332332

333+
If the value to be quoted might include single- or double-quote characters,
334+
or both, consider using the :func:`quoteattr` function in the
335+
:mod:`xml.sax.saxutils` module instead.
336+
333337

334338
.. _cgi-security:
335339

Doc/library/cmd.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,13 @@ A :class:`Cmd` instance has the following methods:
7676
are the beginning and ending indexes of the prefix text, which could be used to
7777
provide different completion depending upon which position the argument is in.
7878

79-
All subclasses of :class:`Cmd` inherit a predefined :meth:`do_help`. This
79+
All subclasses of :class:`Cmd` inherit a predefined :meth:`do_help`. This
8080
method, called with an argument ``'bar'``, invokes the corresponding method
81-
:meth:`help_bar`. With no argument, :meth:`do_help` lists all available help
82-
topics (that is, all commands with corresponding :meth:`help_\*` methods), and
83-
also lists any undocumented commands.
81+
:meth:`help_bar`, and if that is not present, prints the docstring of
82+
:meth:`do_bar`, if available. With no argument, :meth:`do_help` lists all
83+
available help topics (that is, all commands with corresponding
84+
:meth:`help_\*` methods or commands that have docstrings), and also lists any
85+
undocumented commands.
8486

8587

8688
.. method:: Cmd.onecmd(str)

Doc/library/doctest.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1657,7 +1657,7 @@ There are two exceptions that may be raised by :class:`DebugRunner` instances:
16571657

16581658
.. exception:: DocTestFailure(test, example, got)
16591659

1660-
An exception thrown by :class:`DocTestRunner` to signal that a doctest example's
1660+
An exception raised by :class:`DocTestRunner` to signal that a doctest example's
16611661
actual output did not match its expected output. The constructor arguments are
16621662
used to initialize the member variables of the same names.
16631663

@@ -1681,9 +1681,9 @@ There are two exceptions that may be raised by :class:`DebugRunner` instances:
16811681

16821682
.. exception:: UnexpectedException(test, example, exc_info)
16831683

1684-
An exception thrown by :class:`DocTestRunner` to signal that a doctest example
1685-
raised an unexpected exception. The constructor arguments are used to
1686-
initialize the member variables of the same names.
1684+
An exception raised by :class:`DocTestRunner` to signal that a doctest
1685+
example raised an unexpected exception. The constructor arguments are used
1686+
to initialize the member variables of the same names.
16871687

16881688
:exc:`UnexpectedException` defines the following member variables:
16891689

Doc/library/email.errors.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ The following exception classes are defined in the :mod:`email.errors` module:
1717

1818
.. exception:: MessageParseError()
1919

20-
This is the base class for exceptions thrown by the :class:`~email.parser.Parser`
20+
This is the base class for exceptions raised by the :class:`~email.parser.Parser`
2121
class. It is derived from :exc:`MessageError`.
2222

2323

0 commit comments

Comments
 (0)