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

Skip to content

Commit f6cd967

Browse files
committed
Merged revisions 61913,61915-61916,61918-61919,61922-61926,61928-61929,61931,61935,61938,61943 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r61913 | benjamin.peterson | 2008-03-25 22:14:42 +0100 (Tue, 25 Mar 2008) | 2 lines Merged the ACKS from py3k ........ r61915 | thomas.heller | 2008-03-25 22:18:39 +0100 (Tue, 25 Mar 2008) | 1 line Make _ctypes.c PY_SSIZE_T_CLEAN. ........ r61916 | benjamin.peterson | 2008-03-25 22:55:50 +0100 (Tue, 25 Mar 2008) | 3 lines Opps! I merged the revisions, but forgot to add the header to ACKS ........ r61918 | andrew.kuchling | 2008-03-26 01:16:50 +0100 (Wed, 26 Mar 2008) | 1 line Minor docstring typos ........ r61919 | andrew.kuchling | 2008-03-26 01:30:02 +0100 (Wed, 26 Mar 2008) | 1 line Add various items ........ r61922 | neal.norwitz | 2008-03-26 05:55:51 +0100 (Wed, 26 Mar 2008) | 6 lines Try to get this test to be less flaky. It was failing sometimes because the connect would succeed before the timeout occurred. Try using an address and port that hopefully doesn't exist to ensure we get no response. If this doesn't work, we can use a public address close to python.org and hopefully that address never gets taken. ........ r61923 | jerry.seutter | 2008-03-26 06:03:03 +0100 (Wed, 26 Mar 2008) | 1 line Changed test so it no longer runs as a side effect of importing. ........ r61924 | neal.norwitz | 2008-03-26 06:19:41 +0100 (Wed, 26 Mar 2008) | 5 lines Ensure that the mailbox is closed to prevent problems on Windows with removing an open file. This doesn't seem to be a problem in 2.6, but that appears to be somewhat accidental (specific to reference counting). When this gets merged to 3.0, it will make the 3.0 code simpler. ........ r61925 | jerry.seutter | 2008-03-26 06:32:51 +0100 (Wed, 26 Mar 2008) | 1 line Changed test so it no longer runs as a side effect of importing. ........ r61926 | jerry.seutter | 2008-03-26 06:58:14 +0100 (Wed, 26 Mar 2008) | 1 line Changed test so it no longer runs as a side effect of importing. ........ r61928 | georg.brandl | 2008-03-26 10:04:36 +0100 (Wed, 26 Mar 2008) | 2 lines Add Josiah. ........ r61929 | georg.brandl | 2008-03-26 10:32:46 +0100 (Wed, 26 Mar 2008) | 2 lines Add an example for an RFC 822 continuation. ........ r61931 | benjamin.peterson | 2008-03-26 12:57:47 +0100 (Wed, 26 Mar 2008) | 2 lines Added help options to PDB ........ r61935 | christian.heimes | 2008-03-26 13:32:49 +0100 (Wed, 26 Mar 2008) | 1 line Prepare integration of bytearray backport branch ........ r61938 | christian.heimes | 2008-03-26 13:50:43 +0100 (Wed, 26 Mar 2008) | 3 lines Removed merge tracking for "svnmerge" for svn+ssh://[email protected]/python/branches/trunk-bytearray ........ r61943 | georg.brandl | 2008-03-26 13:57:47 +0100 (Wed, 26 Mar 2008) | 2 lines Fix and simplify error handling, silencing a compiler warning. ........
1 parent 41be953 commit f6cd967

12 files changed

Lines changed: 532 additions & 426 deletions

File tree

Doc/library/configparser.rst

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,20 @@ easily.
2929

3030
The configuration file consists of sections, led by a ``[section]`` header and
3131
followed by ``name: value`` entries, with continuations in the style of
32-
:rfc:`822`; ``name=value`` is also accepted. Note that leading whitespace is
33-
removed from values. The optional values can contain format strings which refer
34-
to other values in the same section, or values in a special ``DEFAULT`` section.
35-
Additional defaults can be provided on initialization and retrieval. Lines
36-
beginning with ``'#'`` or ``';'`` are ignored and may be used to provide
37-
comments.
32+
:rfc:`822` (see section 3.1.1, "LONG HEADER FIELDS"); ``name=value`` is also
33+
accepted. Note that leading whitespace is removed from values. The optional
34+
values can contain format strings which refer to other values in the same
35+
section, or values in a special ``DEFAULT`` section. Additional defaults can be
36+
provided on initialization and retrieval. Lines beginning with ``'#'`` or
37+
``';'`` are ignored and may be used to provide comments.
3838

3939
For example::
4040

4141
[My Section]
4242
foodir: %(dir)s/whatever
4343
dir=frob
44+
long: this value continues
45+
in the next line
4446

4547
would resolve the ``%(dir)s`` to the value of ``dir`` (``frob`` in this case).
4648
All reference expansions are done on demand.

Doc/whatsnew/2.6.rst

Lines changed: 78 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -555,10 +555,11 @@ adding a colon followed by a format specifier. For example::
555555
Format specifiers can reference other fields through nesting::
556556

557557
fmt = '{0:{1}}'
558-
fmt.format('Invoice #1234', width) ->
559-
'Invoice #1234 '
560558
fmt.format('Invoice #1234', 15) ->
561559
'Invoice #1234 '
560+
width = 35
561+
fmt.format('Invoice #1234', width) ->
562+
'Invoice #1234 '
562563

563564
The alignment of a field within the desired width can be specified:
564565

@@ -571,11 +572,38 @@ Character Effect
571572
= (For numeric types only) Pad after the sign.
572573
================ ============================================
573574

574-
Format data types::
575-
576-
... XXX take table from PEP 3101
577-
578-
Classes and types can define a __format__ method to control how it's
575+
Format specifiers can also include a presentation type, which
576+
controls how the value is formatted. For example, floating-point numbers
577+
can be formatted as a general number or in exponential notation:
578+
579+
>>> '{0:g}'.format(3.75)
580+
'3.75'
581+
>>> '{0:e}'.format(3.75)
582+
'3.750000e+00'
583+
584+
A variety of presentation types are available. Consult the 2.6
585+
documentation for a complete list (XXX add link, once it's in the 2.6
586+
docs), but here's a sample::
587+
588+
'b' - Binary. Outputs the number in base 2.
589+
'c' - Character. Converts the integer to the corresponding
590+
Unicode character before printing.
591+
'd' - Decimal Integer. Outputs the number in base 10.
592+
'o' - Octal format. Outputs the number in base 8.
593+
'x' - Hex format. Outputs the number in base 16, using lower-
594+
case letters for the digits above 9.
595+
'e' - Exponent notation. Prints the number in scientific
596+
notation using the letter 'e' to indicate the exponent.
597+
'g' - General format. This prints the number as a fixed-point
598+
number, unless the number is too large, in which case
599+
it switches to 'e' exponent notation.
600+
'n' - Number. This is the same as 'g', except that it uses the
601+
current locale setting to insert the appropriate
602+
number separator characters.
603+
'%' - Percentage. Multiplies the number by 100 and displays
604+
in fixed ('f') format, followed by a percent sign.
605+
606+
Classes and types can define a __format__ method to control how they're
579607
formatted. It receives a single argument, the format specifier::
580608

581609
def __format__(self, format_spec):
@@ -610,7 +638,6 @@ function from somewhere else.
610638
Python 2.6 has a ``__future__`` import that removes ``print`` as language
611639
syntax, letting you use the functional form instead. For example::
612640

613-
XXX need to check
614641
from __future__ import print_function
615642
print('# of entries', len(dictionary), file=sys.stderr)
616643

@@ -701,6 +728,21 @@ and it also supports the ``b''`` notation.
701728

702729
.. ======================================================================
703730
731+
.. _pep-3118:
732+
733+
PEP 3118: Revised Buffer Protocol
734+
=====================================================
735+
736+
The buffer protocol is a C-level API that lets Python extensions
737+
XXX
738+
739+
.. seealso::
740+
741+
:pep:`3118` - Revising the buffer protocol
742+
PEP written by Travis Oliphant and Carl Banks.
743+
744+
.. ======================================================================
745+
704746
.. _pep-3119:
705747

706748
PEP 3119: Abstract Base Classes
@@ -1082,7 +1124,7 @@ Optimizations
10821124
by using pymalloc for the Unicode string's data.
10831125

10841126
* The ``with`` statement now stores the :meth:`__exit__` method on the stack,
1085-
producing a small speedup. (Implemented by Nick Coghlan.)
1127+
producing a small speedup. (Implemented by Jeffrey Yasskin.)
10861128

10871129
* To reduce memory usage, the garbage collector will now clear internal
10881130
free lists when garbage-collecting the highest generation of objects.
@@ -1361,10 +1403,8 @@ complete list of changes, or look through the CVS logs for all the details.
13611403
the forward search.
13621404
(Contributed by John Lenton.)
13631405

1364-
* The :mod:`new` module has been removed from Python 3.0.
1365-
Importing it therefore
1366-
triggers a warning message when Python is running in 3.0-warning
1367-
mode.
1406+
* (3.0-warning mode) The :mod:`new` module has been removed from
1407+
Python 3.0. Importing it therefore triggers a warning message.
13681408

13691409
* The :mod:`operator` module gained a
13701410
:func:`methodcaller` function that takes a name and an optional
@@ -1483,6 +1523,14 @@ complete list of changes, or look through the CVS logs for all the details.
14831523

14841524
.. Issue 1727780
14851525
1526+
The new ``triangular(low, high, mode)`` function returns random
1527+
numbers following a triangular distribution. The returned values
1528+
are between *low* and *high*, not including *high* itself, and
1529+
with *mode* as the mode, the most frequently occurring value
1530+
in the distribution. (Contributed by Raymond Hettinger. XXX check)
1531+
1532+
.. Patch 1681432
1533+
14861534
* Long regular expression searches carried out by the :mod:`re`
14871535
module will now check for signals being delivered, so especially
14881536
long searches can now be interrupted.
@@ -1500,6 +1548,16 @@ complete list of changes, or look through the CVS logs for all the details.
15001548

15011549
.. Patch 1861
15021550
1551+
* The :mod:`select` module now has wrapper functions
1552+
for the Linux :cfunc:`epoll` and BSD :cfunc:`kqueue` system calls.
1553+
Also, a :meth:`modify` method was added to the existing :class:`poll`
1554+
objects; ``pollobj.modify(fd, eventmask)`` takes a file descriptor
1555+
or file object and an event mask,
1556+
1557+
(Contributed by XXX.)
1558+
1559+
.. Patch 1657
1560+
15031561
* The :mod:`sets` module has been deprecated; it's better to
15041562
use the built-in :class:`set` and :class:`frozenset` types.
15051563

@@ -1948,9 +2006,8 @@ Some of the more notable changes are:
19482006
Porting to Python 2.6
19492007
=====================
19502008

1951-
This section lists previously described changes, and a few
1952-
esoteric bugfixes, that may require changes to your
1953-
code:
2009+
This section lists previously described changes and other bugfixes
2010+
that may require changes to your code:
19542011

19552012
* The :meth:`__init__` method of :class:`collections.deque`
19562013
now clears any existing contents of the deque
@@ -1986,7 +2043,11 @@ code:
19862043

19872044
.. Issue 1330538
19882045
1989-
* In 3.0-warning mode, inequality comparisons between two dictionaries
2046+
* (3.0-warning mode) The :class:`Exception` class now warns
2047+
when accessed using slicing or index access; having
2048+
:class:`Exception` behave like a tuple is being phased out.
2049+
2050+
* (3.0-warning mode) inequality comparisons between two dictionaries
19902051
or two objects that don't implement comparison methods are reported
19912052
as warnings. ``dict1 == dict2`` still works, but ``dict1 < dict2``
19922053
is being phased out.

Lib/pdb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1233,7 +1233,7 @@ def help():
12331233
print('along the Python search path')
12341234

12351235
def main():
1236-
if not sys.argv[1:]:
1236+
if not sys.argv[1:] or sys.argv[1] in ("--help", "-h"):
12371237
print("usage: pdb.py scriptfile [arg] ...")
12381238
sys.exit(2)
12391239

0 commit comments

Comments
 (0)