Kaydet (Commit) 5478b473 authored tarafından Benjamin Peterson's avatar Benjamin Peterson

Merged revisions 66457-66459,66465-66468,66483-66485,66487-66491 via svnmerge from

svn+ssh://pythondev@svn.python.org/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
........
üst 357877c8
This diff is collapsed.
......@@ -79,12 +79,12 @@ flag. Note that *only* doctests will be refactored.
The :option:`-v` option enables the output of more information on the
translation process.
When the :option:`-p` is passed to it, 2to3 treats ``print`` as a function
instead of a statement. This is useful when ``from __future__ import
print_function`` is being used. If this option is not given, the print fixer
will surround print calls in an extra set of parentheses because it cannot
differentiate between the and print statement with parentheses (such as ``print
("a" + "b" + "c")``) and a true function call.
When the :option:`-p` is passed, 2to3 treats ``print`` as a function instead of
a statement. This is useful when ``from __future__ import print_function`` is
being used. If this option is not given, the print fixer will surround print
calls in an extra set of parentheses because it cannot differentiate between the
and print statement with parentheses (such as ``print ("a" + "b" + "c")``) and a
true function call.
:mod:`lib2to3` - 2to3's library
......
......@@ -359,7 +359,7 @@ in Unix::
.. method:: defaultdict.__missing__(key)
If the :attr:`default_factory` attribute is ``None``, this raises an
If the :attr:`default_factory` attribute is ``None``, this raises a
:exc:`KeyError` exception with the *key* as argument.
If :attr:`default_factory` is not ``None``, it is called without arguments
......
......@@ -11,8 +11,13 @@ libraries. These functions compile Python source files in a directory tree,
allowing users without permission to write to the libraries to take advantage of
cached byte-code files.
The source file for this module may also be used as a script to compile Python
sources in directories named on the command line or in ``sys.path``.
This module may also be used as a script (using the :option:`-m` Python flag) to
compile Python sources. Directories to recursively traverse (passing
:option:`-l` stops the recursive behavior) for sources are listed on the command
line. If no arguments are given, the invocation is equivalent to ``-l
sys.path``. Printing lists of the files compiled can be disabled with the
:option:`-q` flag. In addition, the :option:`-x` option takes a regular
expression argument. All files that match the expression will be skipped.
.. function:: compile_dir(dir[, maxlevels[, ddir[, force[, rx[, quiet]]]]])
......
......@@ -368,7 +368,7 @@ complicated example::
As you can see, the :keyword:`finally` clause is executed in any event. The
:exc:`TypeError` raised by dividing two strings is not handled by the
:keyword:`except` clause and therefore re-raised after the :keyword:`finally`
clauses has been executed.
clause has been executed.
In real world applications, the :keyword:`finally` clause is useful for
releasing external resources (such as files or network connections), regardless
......
......@@ -1723,9 +1723,6 @@ Optimizations
free lists when garbage-collecting the highest generation of objects.
This may return memory to the operating system sooner.
The net result of the 2.6 optimizations is that Python 2.6 runs the pystone
benchmark around XXX% faster than Python 2.5.
.. ======================================================================
.. _new-26-interpreter:
......@@ -1794,7 +1791,6 @@ changes, or look through the Subversion logs for all the details.
:mod:`mimetools`,
:mod:`multifile`,
:mod:`new`,
:mod:`popen2`,
:mod:`pure`,
:mod:`statvfs`,
:mod:`sunaudiodev`,
......@@ -1806,12 +1802,10 @@ changes, or look through the Subversion logs for all the details.
were applied. (Maintained by Josiah Carlson; see :issue:`1736190` for
one patch.)
.. |uacute| unicode:: 0xA9
* The :mod:`bsddb` module also has a new maintainer, Jes|uacute|s Cea,
and the package is now available as a standalone package.
The web page for the package is
`www.jcea.es/programacion/pybsddb.htm <http://www.jcea.es/programacion/pybsddb.htm>`__.
* The :mod:`bsddb` module also has a new maintainer, Jesús Cea, and the package
is now available as a standalone package. The web page for the package is
`www.jcea.es/programacion/pybsddb.htm
<http://www.jcea.es/programacion/pybsddb.htm>`__.
* The :mod:`bsddb.dbshelve` module now uses the highest pickling protocol
available, instead of restricting itself to protocol 1.
......@@ -2134,6 +2128,13 @@ changes, or look through the Subversion logs for all the details.
(Contributed by Christian Heimes and Mark Dickinson.)
* The :mod:`MimeWriter` module and :mod:`mimify` module
have been deprecated; use the :mod:`email`
package instead.
* The :mod:`md5` module has been deprecated; use the :mod:`hashlib` module
instead.
* :class:`mmap` objects now have a :meth:`rfind` method that searches for a
substring beginning at the end of the string and searching
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.
and can optionally take new command-line arguments for the program.
(Contributed by Rocky Bernstein; :issue:`1393667`.)
* The :mod:`posixfile` module has been deprecated; :func:`fcntl.lockf`
provides better locking.
The :func:`post_mortem` function, used to begin debugging a
traceback, will now use the traceback returned by :func:`sys.exc_info`
if no traceback is supplied. (Contributed by Facundo Batista;
......@@ -2226,6 +2230,9 @@ changes, or look through the Subversion logs for all the details.
opcodes, returning a shorter pickle that contains the same data structure.
(Contributed by Raymond Hettinger.)
* The :mod:`popen2` module has been deprecated; use the :mod:`subprocess`
module.
* A :func:`get_data` function was added to the :mod:`pkgutil`
module that returns the contents of resource files included
with an installed Python package. For example::
......@@ -2305,6 +2312,9 @@ changes, or look through the Subversion logs for all the details.
* The :mod:`sets` module has been deprecated; it's better to
use the built-in :class:`set` and :class:`frozenset` types.
* The :mod:`sha` module has been deprecated; use the :mod:`hashlib` module
instead.
* The :func:`shutil.copytree` function now has an optional *ignore* argument
that takes a callable object. This callable will receive each directory path
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.
(Contributed by Pedro Werneck and Jeffrey Yasskin;
:issue:`742598`, :issue:`1193577`.)
* The :mod:`sqlite3` module, maintained by Gerhard Haering,
has been updated from version 2.3.2 in Python 2.5 to
version 2.4.1.
* The :mod:`struct` module now supports the C99 :ctype:`_Bool` type,
using the format character ``'?'``.
(Contributed by David Remahl.)
......@@ -3158,6 +3172,13 @@ that may require changes to your code:
before adding elements from the iterable. This change makes the
behavior match ``list.__init__()``.
* :meth:`object.__init__` previously accepted arbitrary arguments and
keyword arguments, ignoring them. In Python 2.6, this is no longer
allowed and will result in a :exc:`TypeError`. This will affect
:meth:`__init__` methods that end up calling the corresponding
method on :class:`object` (perhaps through using :func:`super`).
See :issue:`1683368` for discussion.
* The :class:`Decimal` constructor now accepts leading and trailing
whitespace when passed a string. Previously it would raise an
:exc:`InvalidOperation` exception. On the other hand, the
......
#! /usr/bin/env python
"""Find the maximum recursion limit that prevents core dumps
"""Find the maximum recursion limit that prevents interpreter termination.
This script finds the maximum safe recursion limit on a particular
platform. If you need to change the recursion limit on your system,
this script will tell you a safe upper bound. To use the new limit,
call sys.setrecursionlimit.
call sys.setrecursionlimit().
This module implements several ways to create infinite recursion in
Python. Different implementations end up pushing different numbers of
C stack frames, depending on how many calls through Python's abstract
C API occur.
After each round of tests, it prints a message
Limit of NNNN is fine.
After each round of tests, it prints a message:
"Limit of NNNN is fine".
It ends when Python causes a segmentation fault because the limit is
too high. On platforms like Mac and Windows, it should exit with a
MemoryError.
The highest printed value of "NNNN" is therefore the highest potentially
safe limit for your system (which depends on the OS, architecture, but also
the compilation flags). Please note that it is practically impossible to
test all possible recursion paths in the interpreter, so the results of
this test should not be trusted blindly -- although they give a good hint
of which values are reasonable.
NOTE: When the C stack space allocated by your system is exceeded due
to excessive recursion, exact behaviour depends on the platform, although
the interpreter will always fail in a likely brutal way: either a
segmentation fault, a MemoryError, or just a silent abort.
NB: A program that does not use __methods__ can set a higher limit.
"""
import sys
......@@ -87,7 +97,10 @@ def check_limit(n, test_func_name):
test_func = globals()[test_func_name]
try:
test_func()
except RuntimeError:
# AttributeError can be raised because of the way e.g. PyDict_GetItem()
# silences all exceptions and returns NULL, which is usually interpreted
# as "missing attribute".
except (RuntimeError, AttributeError):
pass
else:
print("Yikes!")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment