Skip to content

Commit f07d002

Browse files
committed
Merged revisions 70342,70385-70387,70389-70390,70392-70393,70395,70400,70405-70406,70418,70438,70464,70468 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r70342 | georg.brandl | 2009-03-13 14:03:58 -0500 (Fri, 13 Mar 2009) | 1 line python#5486: typos. ........ r70385 | benjamin.peterson | 2009-03-15 09:38:55 -0500 (Sun, 15 Mar 2009) | 1 line fix tuple.index() error message python#5495 ........ r70386 | georg.brandl | 2009-03-15 16:32:06 -0500 (Sun, 15 Mar 2009) | 1 line python#5496: fix docstring of lookup(). ........ r70387 | georg.brandl | 2009-03-15 16:37:16 -0500 (Sun, 15 Mar 2009) | 1 line python#5493: clarify __nonzero__ docs. ........ r70389 | georg.brandl | 2009-03-15 16:43:38 -0500 (Sun, 15 Mar 2009) | 1 line Fix a small nit in the error message if bool() falls back on __len__ and it returns the wrong type: it would tell the user that __nonzero__ should return bool or int. ........ r70390 | georg.brandl | 2009-03-15 16:44:43 -0500 (Sun, 15 Mar 2009) | 1 line python#5491: clarify nested() semantics. ........ r70392 | georg.brandl | 2009-03-15 16:46:00 -0500 (Sun, 15 Mar 2009) | 1 line python#5488: add missing struct member. ........ r70393 | georg.brandl | 2009-03-15 16:47:42 -0500 (Sun, 15 Mar 2009) | 1 line python#5478: fix copy-paste oversight in function signature. ........ r70395 | georg.brandl | 2009-03-15 16:51:48 -0500 (Sun, 15 Mar 2009) | 1 line python#5276: document IDLESTARTUP and .Idle.py. ........ r70400 | georg.brandl | 2009-03-15 16:59:37 -0500 (Sun, 15 Mar 2009) | 3 lines Fix markup in re docs and give a mail address in regex howto, so that the recommendation to send suggestions to the author can be followed. ........ r70405 | georg.brandl | 2009-03-15 17:11:07 -0500 (Sun, 15 Mar 2009) | 7 lines Move the previously local import of threading to module level. This is cleaner and avoids lockups in obscure cases where a Queue is instantiated while the import lock is already held by another thread. OKed by Tim Peters. ........ r70406 | hirokazu.yamamoto | 2009-03-15 17:43:14 -0500 (Sun, 15 Mar 2009) | 1 line Added skip for old MSVC. ........ r70418 | georg.brandl | 2009-03-16 14:42:03 -0500 (Mon, 16 Mar 2009) | 1 line Add token markup. ........ r70438 | benjamin.peterson | 2009-03-17 15:29:51 -0500 (Tue, 17 Mar 2009) | 1 line I thought this was begging for an example ........ r70464 | benjamin.peterson | 2009-03-18 15:58:09 -0500 (Wed, 18 Mar 2009) | 1 line a much better example ........ r70468 | benjamin.peterson | 2009-03-18 22:04:31 -0500 (Wed, 18 Mar 2009) | 1 line close files after comparing them ........
1 parent 839d6ca commit f07d002

File tree

14 files changed

+66
-31
lines changed

14 files changed

+66
-31
lines changed

Doc/c-api/typeobj.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,6 +1052,7 @@ Number Object Structures
10521052
binaryfunc nb_inplace_add;
10531053
binaryfunc nb_inplace_subtract;
10541054
binaryfunc nb_inplace_multiply;
1055+
binaryfunc nb_inplace_divide;
10551056
binaryfunc nb_inplace_remainder;
10561057
ternaryfunc nb_inplace_power;
10571058
binaryfunc nb_inplace_lshift;

Doc/howto/regex.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Regular Expression HOWTO
55
****************************
66

7-
:Author: A.M. Kuchling
7+
:Author: A.M. Kuchling <amk@amk.ca>
88
:Release: 0.05
99

1010
.. TODO:

Doc/library/contextlib.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,15 @@ Functions provided:
6161

6262
from contextlib import nested
6363

64-
with nested(A, B, C) as (X, Y, Z):
64+
with nested(A(), B(), C()) as (X, Y, Z):
6565
do_something()
6666

6767
is equivalent to this::
6868

69-
with A as X:
70-
with B as Y:
71-
with C as Z:
69+
m1, m2, m3 = A(), B(), C()
70+
with m1 as X:
71+
with m2 as Y:
72+
with m3 as Z:
7273
do_something()
7374

7475
Note that if the :meth:`__exit__` method of one of the nested context managers

Doc/library/functions.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,14 @@ are always available. They are listed here in alphabetical order.
561561
its :meth:`__next__` method; if the value returned is equal to *sentinel*,
562562
:exc:`StopIteration` will be raised, otherwise the value will be returned.
563563

564+
One useful application of the second form of :func:`iter` is to read lines of
565+
a file until a certain line is reached. The following example reads a file
566+
until ``"STOP"`` is reached: ::
567+
568+
with open("mydata.txt") as fp:
569+
for line in iter(fp.readline, "STOP"):
570+
process_line(line)
571+
564572

565573
.. function:: len(s)
566574

Doc/library/idle.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,24 @@ Shell colors:
253253
black
254254

255255

256+
Startup
257+
-------
258+
259+
Upon startup with the ``-s`` option, IDLE will execute the file referenced by
260+
the environment variables :envvar:`IDLESTARTUP` or :envvar:`PYTHONSTARTUP`.
261+
Idle first checks for ``IDLESTARTUP``; if ``IDLESTARTUP`` is present the file
262+
referenced is run. If ``IDLESTARTUP`` is not present, Idle checks for
263+
``PYTHONSTARTUP``. Files referenced by these environment variables are
264+
convenient places to store functions that are used frequently from the Idle
265+
shell, or for executing import statements to import common modules.
266+
267+
In addition, ``Tk`` also loads a startup file if it is present. Note that the
268+
Tk file is loaded unconditionally. This additional file is ``.Idle.py`` and is
269+
looked for in the user's home directory. Statements in this file will be
270+
executed in the Tk namespace, so this file is not useful for importing functions
271+
to be used from Idle's Python shell.
272+
273+
256274
Command line usage
257275
^^^^^^^^^^^^^^^^^^
258276

Doc/library/re.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1127,7 +1127,7 @@ For example:
11271127
string)`` or ``re.search(pattern, string)``.
11281128

11291129
:func:`match` has an optional second parameter that gives an index in the string
1130-
where the search is to start:
1130+
where the search is to start::
11311131

11321132
>>> pattern = re.compile("o")
11331133
>>> pattern.match("dog") # No match as "o" is not at the start of "dog."

Doc/library/string.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ The grammar for a replacement field is as follows:
196196

197197
.. productionlist:: sf
198198
replacement_field: "{" `field_name` ["!" `conversion`] [":" `format_spec`] "}"
199-
field_name: (`identifier` | `integer`) ("." `attribute_name` | "[" element_index "]")*
199+
field_name: (`identifier` | `integer`) ("." `attribute_name` | "[" `element_index` "]")*
200200
attribute_name: `identifier`
201201
element_index: `integer`
202202
conversion: "r" | "s" | "a"

Doc/library/xml.dom.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ of that class.
600600
Same as equivalent method in the :class:`Document` class.
601601

602602

603-
.. method:: Element.getElementsByTagNameNS(tagName)
603+
.. method:: Element.getElementsByTagNameNS(namespaceURI, localName)
604604

605605
Same as equivalent method in the :class:`Document` class.
606606

Doc/reference/datamodel.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,11 +1251,12 @@ Basic customization
12511251

12521252
.. index:: single: __len__() (mapping object method)
12531253

1254-
Called to implement truth value testing, and the built-in operation ``bool()``;
1255-
should return ``False`` or ``True``. When this method is not defined,
1256-
:meth:`__len__` is called, if it is defined (see below) and ``True`` is returned
1257-
when the length is not zero. If a class defines neither :meth:`__len__` nor
1258-
:meth:`__bool__`, all its instances are considered true.
1254+
Called to implement truth value testing and the built-in operation
1255+
``bool()``; should return ``False`` or ``True``, or their integer equivalents
1256+
``0`` or ``1``. When this method is not defined, :meth:`__len__` is called,
1257+
if it is defined, and the object is considered true if its result is nonzero.
1258+
If a class defines neither :meth:`__len__` nor :meth:`__bool__`, all its
1259+
instances are considered true.
12591260

12601261

12611262
.. _attribute-access:

Lib/distutils/tests/test_msvc9compiler.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ def test_reg_class(self):
3434
if sys.platform != 'win32':
3535
# this test is only for win32
3636
return
37+
from distutils.msvccompiler import get_build_version
38+
if get_build_version() < 8.0:
39+
# this test is only for MSVC8.0 or above
40+
return
3741

3842
from distutils.msvc9compiler import Reg
3943
self.assertRaises(KeyError, Reg.get_value, 'xxx', 'xxx')

0 commit comments

Comments
 (0)