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

Skip to content

Commit 5478b47

Browse files
committed
Merged revisions 66457-66459,66465-66468,66483-66485,66487-66491 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r66457 | antoine.pitrou | 2008-09-13 15:30:30 -0500 (Sat, 13 Sep 2008) | 5 lines Issue #3850: Misc/find_recursionlimit.py was broken. Reviewed by A.M. Kuchling. ........ r66458 | benjamin.peterson | 2008-09-13 17:54:43 -0500 (Sat, 13 Sep 2008) | 1 line fix a name issue; note all doc files should be encoded in utf8 ........ r66459 | benjamin.peterson | 2008-09-14 11:02:22 -0500 (Sun, 14 Sep 2008) | 1 line clarify that radix for int is not 'guessed' ........ r66465 | skip.montanaro | 2008-09-14 21:03:05 -0500 (Sun, 14 Sep 2008) | 3 lines Review usage. Fix a mistake in the new-style class definition. Add a couple new definitions (CPython and virtual machine). ........ r66466 | skip.montanaro | 2008-09-14 21:19:53 -0500 (Sun, 14 Sep 2008) | 2 lines Pick up a few more definitions from the glossary on the wiki. ........ r66467 | benjamin.peterson | 2008-09-14 21:53:23 -0500 (Sun, 14 Sep 2008) | 1 line mention that object.__init__ no longer takes arbitrary args and kwargs ........ r66468 | andrew.kuchling | 2008-09-15 08:08:32 -0500 (Mon, 15 Sep 2008) | 1 line Rewrite item a bit ........ r66483 | georg.brandl | 2008-09-16 05:17:45 -0500 (Tue, 16 Sep 2008) | 2 lines Fix typo. ........ r66484 | benjamin.peterson | 2008-09-16 16:20:28 -0500 (Tue, 16 Sep 2008) | 2 lines be less wordy ........ r66485 | georg.brandl | 2008-09-17 03:45:54 -0500 (Wed, 17 Sep 2008) | 2 lines #3888: add some deprecated modules in whatsnew. ........ r66487 | skip.montanaro | 2008-09-17 06:50:36 -0500 (Wed, 17 Sep 2008) | 2 lines usage ........ r66488 | andrew.kuchling | 2008-09-17 07:57:04 -0500 (Wed, 17 Sep 2008) | 1 line Markup fixes ........ r66489 | andrew.kuchling | 2008-09-17 07:58:22 -0500 (Wed, 17 Sep 2008) | 2 lines Remove comment about improvement: pystone is about the same, and the improvements seem to be difficult to quantify ........ r66490 | andrew.kuchling | 2008-09-17 08:04:53 -0500 (Wed, 17 Sep 2008) | 1 line Note sqlite3 version; move item ........ r66491 | benjamin.peterson | 2008-09-17 16:54:56 -0500 (Wed, 17 Sep 2008) | 1 line document compileall command flags ........
1 parent 357877c commit 5478b47

7 files changed

Lines changed: 216 additions & 113 deletions

File tree

Doc/glossary.rst

Lines changed: 149 additions & 85 deletions
Large diffs are not rendered by default.

Doc/library/2to3.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@ flag. Note that *only* doctests will be refactored.
7979
The :option:`-v` option enables the output of more information on the
8080
translation process.
8181

82-
When the :option:`-p` is passed to it, 2to3 treats ``print`` as a function
83-
instead of a statement. This is useful when ``from __future__ import
84-
print_function`` is being used. If this option is not given, the print fixer
85-
will surround print calls in an extra set of parentheses because it cannot
86-
differentiate between the and print statement with parentheses (such as ``print
87-
("a" + "b" + "c")``) and a true function call.
82+
When the :option:`-p` is passed, 2to3 treats ``print`` as a function instead of
83+
a statement. This is useful when ``from __future__ import print_function`` is
84+
being used. If this option is not given, the print fixer will surround print
85+
calls in an extra set of parentheses because it cannot differentiate between the
86+
and print statement with parentheses (such as ``print ("a" + "b" + "c")``) and a
87+
true function call.
8888

8989

9090
:mod:`lib2to3` - 2to3's library

Doc/library/collections.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ in Unix::
359359

360360
.. method:: defaultdict.__missing__(key)
361361

362-
If the :attr:`default_factory` attribute is ``None``, this raises an
362+
If the :attr:`default_factory` attribute is ``None``, this raises a
363363
:exc:`KeyError` exception with the *key* as argument.
364364

365365
If :attr:`default_factory` is not ``None``, it is called without arguments

Doc/library/compileall.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,13 @@ libraries. These functions compile Python source files in a directory tree,
1111
allowing users without permission to write to the libraries to take advantage of
1212
cached byte-code files.
1313

14-
The source file for this module may also be used as a script to compile Python
15-
sources in directories named on the command line or in ``sys.path``.
14+
This module may also be used as a script (using the :option:`-m` Python flag) to
15+
compile Python sources. Directories to recursively traverse (passing
16+
:option:`-l` stops the recursive behavior) for sources are listed on the command
17+
line. If no arguments are given, the invocation is equivalent to ``-l
18+
sys.path``. Printing lists of the files compiled can be disabled with the
19+
:option:`-q` flag. In addition, the :option:`-x` option takes a regular
20+
expression argument. All files that match the expression will be skipped.
1621

1722

1823
.. function:: compile_dir(dir[, maxlevels[, ddir[, force[, rx[, quiet]]]]])

Doc/tutorial/errors.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ complicated example::
368368
As you can see, the :keyword:`finally` clause is executed in any event. The
369369
:exc:`TypeError` raised by dividing two strings is not handled by the
370370
:keyword:`except` clause and therefore re-raised after the :keyword:`finally`
371-
clauses has been executed.
371+
clause has been executed.
372372

373373
In real world applications, the :keyword:`finally` clause is useful for
374374
releasing external resources (such as files or network connections), regardless

Doc/whatsnew/2.6.rst

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1723,9 +1723,6 @@ Optimizations
17231723
free lists when garbage-collecting the highest generation of objects.
17241724
This may return memory to the operating system sooner.
17251725

1726-
The net result of the 2.6 optimizations is that Python 2.6 runs the pystone
1727-
benchmark around XXX% faster than Python 2.5.
1728-
17291726
.. ======================================================================
17301727
17311728
.. _new-26-interpreter:
@@ -1794,7 +1791,6 @@ changes, or look through the Subversion logs for all the details.
17941791
:mod:`mimetools`,
17951792
:mod:`multifile`,
17961793
:mod:`new`,
1797-
:mod:`popen2`,
17981794
:mod:`pure`,
17991795
:mod:`statvfs`,
18001796
:mod:`sunaudiodev`,
@@ -1806,12 +1802,10 @@ changes, or look through the Subversion logs for all the details.
18061802
were applied. (Maintained by Josiah Carlson; see :issue:`1736190` for
18071803
one patch.)
18081804

1809-
.. |uacute| unicode:: 0xA9
1810-
1811-
* The :mod:`bsddb` module also has a new maintainer, Jes|uacute|s Cea,
1812-
and the package is now available as a standalone package.
1813-
The web page for the package is
1814-
`www.jcea.es/programacion/pybsddb.htm <http://www.jcea.es/programacion/pybsddb.htm>`__.
1805+
* The :mod:`bsddb` module also has a new maintainer, Jesús Cea, and the package
1806+
is now available as a standalone package. The web page for the package is
1807+
`www.jcea.es/programacion/pybsddb.htm
1808+
<http://www.jcea.es/programacion/pybsddb.htm>`__.
18151809

18161810
* The :mod:`bsddb.dbshelve` module now uses the highest pickling protocol
18171811
available, instead of restricting itself to protocol 1.
@@ -2134,6 +2128,13 @@ changes, or look through the Subversion logs for all the details.
21342128

21352129
(Contributed by Christian Heimes and Mark Dickinson.)
21362130

2131+
* The :mod:`MimeWriter` module and :mod:`mimify` module
2132+
have been deprecated; use the :mod:`email`
2133+
package instead.
2134+
2135+
* The :mod:`md5` module has been deprecated; use the :mod:`hashlib` module
2136+
instead.
2137+
21372138
* :class:`mmap` objects now have a :meth:`rfind` method that searches for a
21382139
substring beginning at the end of the string and searching
21392140
backwards. The :meth:`find` method also gained an *end* parameter
@@ -2216,6 +2217,9 @@ changes, or look through the Subversion logs for all the details.
22162217
and can optionally take new command-line arguments for the program.
22172218
(Contributed by Rocky Bernstein; :issue:`1393667`.)
22182219

2220+
* The :mod:`posixfile` module has been deprecated; :func:`fcntl.lockf`
2221+
provides better locking.
2222+
22192223
The :func:`post_mortem` function, used to begin debugging a
22202224
traceback, will now use the traceback returned by :func:`sys.exc_info`
22212225
if no traceback is supplied. (Contributed by Facundo Batista;
@@ -2226,6 +2230,9 @@ changes, or look through the Subversion logs for all the details.
22262230
opcodes, returning a shorter pickle that contains the same data structure.
22272231
(Contributed by Raymond Hettinger.)
22282232

2233+
* The :mod:`popen2` module has been deprecated; use the :mod:`subprocess`
2234+
module.
2235+
22292236
* A :func:`get_data` function was added to the :mod:`pkgutil`
22302237
module that returns the contents of resource files included
22312238
with an installed Python package. For example::
@@ -2305,6 +2312,9 @@ changes, or look through the Subversion logs for all the details.
23052312
* The :mod:`sets` module has been deprecated; it's better to
23062313
use the built-in :class:`set` and :class:`frozenset` types.
23072314

2315+
* The :mod:`sha` module has been deprecated; use the :mod:`hashlib` module
2316+
instead.
2317+
23082318
* The :func:`shutil.copytree` function now has an optional *ignore* argument
23092319
that takes a callable object. This callable will receive each directory path
23102320
and a list of the directory's contents, and returns a list of names that
@@ -2390,6 +2400,10 @@ changes, or look through the Subversion logs for all the details.
23902400
(Contributed by Pedro Werneck and Jeffrey Yasskin;
23912401
:issue:`742598`, :issue:`1193577`.)
23922402

2403+
* The :mod:`sqlite3` module, maintained by Gerhard Haering,
2404+
has been updated from version 2.3.2 in Python 2.5 to
2405+
version 2.4.1.
2406+
23932407
* The :mod:`struct` module now supports the C99 :ctype:`_Bool` type,
23942408
using the format character ``'?'``.
23952409
(Contributed by David Remahl.)
@@ -3158,6 +3172,13 @@ that may require changes to your code:
31583172
before adding elements from the iterable. This change makes the
31593173
behavior match ``list.__init__()``.
31603174

3175+
* :meth:`object.__init__` previously accepted arbitrary arguments and
3176+
keyword arguments, ignoring them. In Python 2.6, this is no longer
3177+
allowed and will result in a :exc:`TypeError`. This will affect
3178+
:meth:`__init__` methods that end up calling the corresponding
3179+
method on :class:`object` (perhaps through using :func:`super`).
3180+
See :issue:`1683368` for discussion.
3181+
31613182
* The :class:`Decimal` constructor now accepts leading and trailing
31623183
whitespace when passed a string. Previously it would raise an
31633184
:exc:`InvalidOperation` exception. On the other hand, the

Misc/find_recursionlimit.py

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,32 @@
11
#! /usr/bin/env python
2-
"""Find the maximum recursion limit that prevents core dumps
2+
"""Find the maximum recursion limit that prevents interpreter termination.
33
44
This script finds the maximum safe recursion limit on a particular
55
platform. If you need to change the recursion limit on your system,
66
this script will tell you a safe upper bound. To use the new limit,
7-
call sys.setrecursionlimit.
7+
call sys.setrecursionlimit().
88
99
This module implements several ways to create infinite recursion in
1010
Python. Different implementations end up pushing different numbers of
1111
C stack frames, depending on how many calls through Python's abstract
1212
C API occur.
1313
14-
After each round of tests, it prints a message
15-
Limit of NNNN is fine.
14+
After each round of tests, it prints a message:
15+
"Limit of NNNN is fine".
1616
17-
It ends when Python causes a segmentation fault because the limit is
18-
too high. On platforms like Mac and Windows, it should exit with a
19-
MemoryError.
17+
The highest printed value of "NNNN" is therefore the highest potentially
18+
safe limit for your system (which depends on the OS, architecture, but also
19+
the compilation flags). Please note that it is practically impossible to
20+
test all possible recursion paths in the interpreter, so the results of
21+
this test should not be trusted blindly -- although they give a good hint
22+
of which values are reasonable.
23+
24+
NOTE: When the C stack space allocated by your system is exceeded due
25+
to excessive recursion, exact behaviour depends on the platform, although
26+
the interpreter will always fail in a likely brutal way: either a
27+
segmentation fault, a MemoryError, or just a silent abort.
28+
29+
NB: A program that does not use __methods__ can set a higher limit.
2030
"""
2131

2232
import sys
@@ -87,7 +97,10 @@ def check_limit(n, test_func_name):
8797
test_func = globals()[test_func_name]
8898
try:
8999
test_func()
90-
except RuntimeError:
100+
# AttributeError can be raised because of the way e.g. PyDict_GetItem()
101+
# silences all exceptions and returns NULL, which is usually interpreted
102+
# as "missing attribute".
103+
except (RuntimeError, AttributeError):
91104
pass
92105
else:
93106
print("Yikes!")

0 commit comments

Comments
 (0)