[Python-checkins] r64419 - in python/branches/tlee-ast-optimize: Doc/conf.py Doc/library/math.rst Doc/library/multiprocessing.rst Doc/library/someos.rst Include/patchlevel.h Lib/distutils/__init__.py Lib/idlelib/idlever.py Lib/lib2to3/refactor.py Lib/logging/__init__.py Lib/logging/config.py Lib/numbers.py Lib/test/regrtest.py Lib/test/test_grammar.py Lib/test/test_macostools.py Lib/test/test_multiprocessing.py Lib/test/test_site.py Lib/test/test_socket_ssl.py Lib/test/test_sys.py Lib/test/test_weakref.py Misc/NEWS Misc/RPM/python-2.6.spec Misc/developers.txt Modules/_cursesmodule.c Modules/mathmodule.c Objects/weakrefobject.c Python/marshal.c README Tools/buildbot/external-amd64.bat Tools/scripts/2to3
thomas.lee
python-checkins at python.org
Fri Jun 20 01:42:49 CEST 2008
Author: thomas.lee
Date: Fri Jun 20 01:42:48 2008
New Revision: 64419
Log:
Merged revisions 64288-64417 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r64301 | georg.brandl | 2008-06-16 05:54:36 +1000 (Mon, 16 Jun 2008) | 2 lines
Forward-port new test from r64300.
........
r64303 | raymond.hettinger | 2008-06-16 11:42:40 +1000 (Mon, 16 Jun 2008) | 1 line
Issue 3116: fix quadratic behavior in marshal.dumps().
........
r64309 | amaury.forgeotdarc | 2008-06-17 05:12:42 +1000 (Tue, 17 Jun 2008) | 8 lines
Issue 3110: Crash with weakref subclass,
seen after a "import multiprocessing.reduction"
An instance of a weakref subclass can have attributes.
If such a weakref holds the only strong reference to the object,
deleting the weakref will delete the object. In this case,
the callback must not be called, because the ref object is being deleted!
........
r64313 | benjamin.peterson | 2008-06-17 06:18:18 +1000 (Tue, 17 Jun 2008) | 1 line
fix Tools/scripts/2to3 as the result of a merge error
........
r64317 | benjamin.peterson | 2008-06-17 06:52:48 +1000 (Tue, 17 Jun 2008) | 1 line
reduce the test_multiprocessing load to ones that shouldn't hang. These will be reenabled gradually as we find the problems.
........
r64320 | georg.brandl | 2008-06-17 07:00:47 +1000 (Tue, 17 Jun 2008) | 2 lines
Add Jesse Noller to the developers list.
........
r64326 | robert.schuppenies | 2008-06-17 18:42:15 +1000 (Tue, 17 Jun 2008) | 2 lines
Issue 3048: Fixed sys.sizeof test fails with wide unicode.
........
r64328 | georg.brandl | 2008-06-17 19:01:35 +1000 (Tue, 17 Jun 2008) | 2 lines
Split the HTML index.
........
r64338 | vinay.sajip | 2008-06-17 21:02:14 +1000 (Tue, 17 Jun 2008) | 1 line
Bug #3126: StreamHandler and FileHandler check before calling "flush" and "close" that the stream object has these, using hasattr (thanks to bobf for the patch).
........
r64339 | vinay.sajip | 2008-06-17 21:04:02 +1000 (Tue, 17 Jun 2008) | 1 line
Updated with fix for #3126.
........
r64342 | guido.van.rossum | 2008-06-18 03:38:02 +1000 (Wed, 18 Jun 2008) | 3 lines
Roll back Raymond's -r64098 while we think of something better.
(See issue 3056 -- we're close to a resolution but need unittests.)
........
r64349 | mark.dickinson | 2008-06-18 07:16:55 +1000 (Wed, 18 Jun 2008) | 4 lines
Issue 3118: make test_math pass on Ubuntu/ia64. exp(-745.0) was raising
OverflowError incorrectly on this platform, presumably as a result of
the libm setting errno = ERANGE for this call.
........
r64356 | benjamin.peterson | 2008-06-18 08:40:44 +1000 (Wed, 18 Jun 2008) | 1 line
skip test_multiprocessing when /dev/shm doesn't exist. This seems to be a chroot problem in the buildbot env.
........
r64358 | benjamin.peterson | 2008-06-18 09:01:59 +1000 (Wed, 18 Jun 2008) | 1 line
add needed import
........
r64360 | amaury.forgeotdarc | 2008-06-18 09:09:19 +1000 (Wed, 18 Jun 2008) | 3 lines
On windows, lib2to3 should accept / and \ in the fixer_dir argument
Needed to let the tests pass
........
r64361 | amaury.forgeotdarc | 2008-06-18 09:14:19 +1000 (Wed, 18 Jun 2008) | 2 lines
Fix the previous fix
........
r64365 | raymond.hettinger | 2008-06-18 10:56:57 +1000 (Wed, 18 Jun 2008) | 1 line
Fix double decref.
........
r64370 | mark.dickinson | 2008-06-18 19:20:17 +1000 (Wed, 18 Jun 2008) | 2 lines
Typo fix
........
r64371 | georg.brandl | 2008-06-18 19:28:22 +1000 (Wed, 18 Jun 2008) | 2 lines
Add versionadded tags to new math functions.
........
r64375 | jesse.noller | 2008-06-18 23:29:52 +1000 (Wed, 18 Jun 2008) | 1 line
Attempt RLock creation prior to test execution on Linux, if it raises the OSError in issue 3111, skip the test suite
........
r64378 | jesse.noller | 2008-06-19 02:34:50 +1000 (Thu, 19 Jun 2008) | 1 line
Remove test_listener_client to remove possible race condition in the multiprocessing tests
........
r64386 | amaury.forgeotdarc | 2008-06-19 07:18:27 +1000 (Thu, 19 Jun 2008) | 3 lines
The ssl certificate at https://sf.net is not valid.
Switch to https://sourceforge.net
........
r64387 | amaury.forgeotdarc | 2008-06-19 07:33:58 +1000 (Thu, 19 Jun 2008) | 2 lines
Typo in a directory name. Should help the AMD64 buildbots
........
r64392 | benjamin.peterson | 2008-06-19 08:59:32 +1000 (Thu, 19 Jun 2008) | 2 lines
Fix test_socket_ssl the easy way and remove it per #1489
........
r64398 | barry.warsaw | 2008-06-19 11:48:07 +1000 (Thu, 19 Jun 2008) | 1 line
Bumping to 2.6b1
........
r64400 | barry.warsaw | 2008-06-19 12:31:54 +1000 (Thu, 19 Jun 2008) | 1 line
Post release changes
........
r64406 | andrew.kuchling | 2008-06-20 00:02:30 +1000 (Fri, 20 Jun 2008) | 1 line
Only include update_lines_cols() function when it's actually going to be used
........
r64407 | andrew.kuchling | 2008-06-20 05:48:42 +1000 (Fri, 20 Jun 2008) | 1 line
Remove some standalone material from the introduction; various markup and typo fixes
........
r64408 | amaury.forgeotdarc | 2008-06-20 05:57:39 +1000 (Fri, 20 Jun 2008) | 2 lines
test_macos can be skipped on non-mac platforms.
........
r64409 | andrew.kuchling | 2008-06-20 06:33:31 +1000 (Fri, 20 Jun 2008) | 1 line
Put threading in front of thread
........
r64412 | amaury.forgeotdarc | 2008-06-20 07:17:12 +1000 (Fri, 20 Jun 2008) | 3 lines
In test_site, correctly escape backslashes in path names.
This allows the test to pass when the username begins with a lowercase 't'...
........
r64413 | benjamin.peterson | 2008-06-20 07:39:06 +1000 (Fri, 20 Jun 2008) | 1 line
skip test_macostools when UCS4 is enabled
........
r64416 | vinay.sajip | 2008-06-20 08:40:17 +1000 (Fri, 20 Jun 2008) | 2 lines
Bug #3136: fileConfig()'s disabling of old loggers is now conditional via an optional disable_existing_loggers parameter, but the default value is such that the old behaviour is preserved.
Thanks to Leandro Lucarella for the patch.
........
r64417 | vinay.sajip | 2008-06-20 08:41:08 +1000 (Fri, 20 Jun 2008) | 1 line
Updated with fix for #3136.
........
Removed:
python/branches/tlee-ast-optimize/Lib/test/test_socket_ssl.py
Modified:
python/branches/tlee-ast-optimize/ (props changed)
python/branches/tlee-ast-optimize/Doc/conf.py
python/branches/tlee-ast-optimize/Doc/library/math.rst
python/branches/tlee-ast-optimize/Doc/library/multiprocessing.rst
python/branches/tlee-ast-optimize/Doc/library/someos.rst
python/branches/tlee-ast-optimize/Include/patchlevel.h
python/branches/tlee-ast-optimize/Lib/distutils/__init__.py
python/branches/tlee-ast-optimize/Lib/idlelib/idlever.py
python/branches/tlee-ast-optimize/Lib/lib2to3/refactor.py
python/branches/tlee-ast-optimize/Lib/logging/__init__.py
python/branches/tlee-ast-optimize/Lib/logging/config.py
python/branches/tlee-ast-optimize/Lib/numbers.py
python/branches/tlee-ast-optimize/Lib/test/regrtest.py
python/branches/tlee-ast-optimize/Lib/test/test_grammar.py
python/branches/tlee-ast-optimize/Lib/test/test_macostools.py
python/branches/tlee-ast-optimize/Lib/test/test_multiprocessing.py
python/branches/tlee-ast-optimize/Lib/test/test_site.py
python/branches/tlee-ast-optimize/Lib/test/test_sys.py
python/branches/tlee-ast-optimize/Lib/test/test_weakref.py
python/branches/tlee-ast-optimize/Misc/NEWS
python/branches/tlee-ast-optimize/Misc/RPM/python-2.6.spec
python/branches/tlee-ast-optimize/Misc/developers.txt
python/branches/tlee-ast-optimize/Modules/_cursesmodule.c
python/branches/tlee-ast-optimize/Modules/mathmodule.c
python/branches/tlee-ast-optimize/Objects/weakrefobject.c
python/branches/tlee-ast-optimize/Python/marshal.c
python/branches/tlee-ast-optimize/README
python/branches/tlee-ast-optimize/Tools/buildbot/external-amd64.bat
python/branches/tlee-ast-optimize/Tools/scripts/2to3
Modified: python/branches/tlee-ast-optimize/Doc/conf.py
==============================================================================
--- python/branches/tlee-ast-optimize/Doc/conf.py (original)
+++ python/branches/tlee-ast-optimize/Doc/conf.py Fri Jun 20 01:42:48 2008
@@ -94,6 +94,9 @@
# Output file base name for HTML help builder.
htmlhelp_basename = 'python' + release.replace('.', '')
+# Split the index
+html_split_index = True
+
# Options for LaTeX output
# ------------------------
Modified: python/branches/tlee-ast-optimize/Doc/library/math.rst
==============================================================================
--- python/branches/tlee-ast-optimize/Doc/library/math.rst (original)
+++ python/branches/tlee-ast-optimize/Doc/library/math.rst Fri Jun 20 01:42:48 2008
@@ -42,11 +42,15 @@
Return the absolute value of *x*.
+
.. function:: factorial(x)
- Return *x* factorial. Raises :exc:`ValueError` if *x* is not intergral or
+ Return *x* factorial. Raises :exc:`ValueError` if *x* is not integral or
is negative.
+ .. versionadded:: 2.6
+
+
.. function:: floor(x)
Return the floor of *x* as a float, the largest integer value less than or equal
@@ -107,6 +111,7 @@
Return the fractional and integer parts of *x*. Both results carry the sign of
*x*, and both are floats.
+
.. function:: sum(iterable)
Return an accurate floating point sum of values in the iterable. Avoids
@@ -114,6 +119,9 @@
algorithm's accuracy depends on IEEE-754 arithmetic guarantees and the
typical case where the rounding mode is half-even.
+ .. versionadded:: 2.6
+
+
.. function:: trunc(x)
Return the :class:`Real` value *x* truncated to an :class:`Integral` (usually
@@ -121,6 +129,7 @@
.. versionadded:: 2.6
+
Note that :func:`frexp` and :func:`modf` have a different call/return pattern
than their C equivalents: they take a single argument and return a pair of
values, rather than returning their second return value through an 'output
@@ -134,7 +143,6 @@
Power and logarithmic functions:
-
.. function:: exp(x)
Return ``e**x``.
@@ -179,8 +187,8 @@
Return the square root of *x*.
-Trigonometric functions:
+Trigonometric functions:
.. function:: acos(x)
@@ -227,8 +235,8 @@
Return the tangent of *x* radians.
-Angular conversion:
+Angular conversion:
.. function:: degrees(x)
@@ -239,8 +247,8 @@
Converts angle *x* from degrees to radians.
-Hyperbolic functions:
+Hyperbolic functions:
.. function:: acosh(x)
@@ -278,10 +286,8 @@
Return the hyperbolic tangent of *x*.
-
The module also defines two mathematical constants:
-
.. data:: pi
The mathematical constant *pi*.
Modified: python/branches/tlee-ast-optimize/Doc/library/multiprocessing.rst
==============================================================================
--- python/branches/tlee-ast-optimize/Doc/library/multiprocessing.rst (original)
+++ python/branches/tlee-ast-optimize/Doc/library/multiprocessing.rst Fri Jun 20 01:42:48 2008
@@ -6,75 +6,17 @@
.. versionadded:: 2.6
-:mod:`multiprocessing` is a package for the Python language which supports the
-spawning of processes using a similar API of the :mod:`threading` module. It
-runs on both Unix and Windows.
-
-The :mod:`multiprocessing` module offers the capability of both local and remote
-concurrency effectively side-stepping the Global Interpreter Lock by utilizing
-subprocesses for "threads". Due to this, the :mod:`multiprocessing` module
-allows the programmer to fully leverage multiple processors on a given machine.
-
-
Introduction
-------------
-
-
-Threads, processes and the GIL
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-To run more than one piece of code at the same time on the same computer one has
-the choice of either using multiple processes or multiple threads.
-
-Although a program can be made up of multiple processes, these processes are in
-effect completely independent of one another: different processes are not able
-to cooperate with one another unless one sets up some means of communication
-between them (such as by using sockets). If a lot of data must be transferred
-between processes then this can be inefficient.
-
-On the other hand, multiple threads within a single process are intimately
-connected: they share their data but often can interfere badly with one another.
-It is often argued that the only way to make multithreaded programming "easy" is
-to avoid relying on any shared state and for the threads to only communicate by
-passing messages to each other.
-
-CPython has a *Global Interpreter Lock* (GIL) which in many ways makes threading
-easier than it is in most languages by making sure that only one thread can
-manipulate the interpreter's objects at a time. As a result, it is often safe
-to let multiple threads access data without using any additional locking as one
-would need to in a language such as C.
-
-One downside of the GIL is that on multi-processor (or multi-core) systems a
-multithreaded Python program can only make use of one processor at a time unless
-your application makes heavy use of I/O which effectively side-steps this. This
-is a problem that can be overcome by using multiple processes instead.
-
-This package allows one to write multi-process programs using much the same API
-that one uses for writing threaded programs.
-
-
-Forking and spawning
-~~~~~~~~~~~~~~~~~~~~
-
-There are two ways of creating a new process in Python:
-
-* The current process can *fork* a new child process by using the
- :func:`os.fork` function. This effectively creates an identical copy of the
- current process which is now able to go off and perform some task set by the
- parent process. This means that the child process inherits *copies* of all
- variables that the parent process had. However, :func:`os.fork` is not
- available on every platform: in particular Windows does not support it.
-
-* Alternatively, the current process can spawn a completely new Python
- interpreter by using the :mod:`subprocess` module or one of the
- :func:`os.spawn*` functions. Getting this new interpreter in to a fit state
- to perform the task set for it by its parent process is, however, a bit of a
- challenge.
-
-The :mod:`multiprocessing` module uses :func:`os.fork` if it is available since
-it makes life a lot simpler. Forking the process is also more efficient in
-terms of memory usage and the time needed to create the new process.
+----------------------
+:mod:`multiprocessing` is a package that supports spawning processes
+using an API similar to the :mod:`threading` module. The
+:mod:`multiprocessing` package offers both local and remote
+concurrency, effectively side-stepping the :term:`Global Interpreter
+Lock` by using subprocesses instead of threads. Due to this, the
+:mod:`multiprocessing` module allows the programmer to fully leverage
+multiple processors on a given machine. It runs on both Unix and
+Windows.
The :class:`Process` class
~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -270,7 +212,7 @@
Using a pool of workers
~~~~~~~~~~~~~~~~~~~~~~~
-The :class:`multiprocessing.pool.Pool()` class represens a pool of worker
+The :class:`multiprocessing.pool.Pool()` class represents a pool of worker
processes. It has methods which allows tasks to be offloaded to the worker
processes in a few different ways.
@@ -305,7 +247,7 @@
:class:`threading.Thread`.
The constructor should always be called with keyword arguments. *group*
- should always be ``None``; it exists soley for compatibility with
+ should always be ``None``; it exists solely for compatibility with
:class:`threading.Thread`. *target* is the callable object to be invoked by
the :meth:`run()` method. It defaults to None, meaning nothing is
called. *name* is the process name. By default, a unique name is constructed
@@ -415,11 +357,11 @@
Set the process's authentication key which must be a byte string.
- .. method:: terminate()`
+ .. method:: terminate()
- Terminate the process. On Unix this is done using the ``SIGTERM`` signal,
+ Terminate the process. On Unix this is done using the ``SIGTERM`` signal;
on Windows ``TerminateProcess()`` is used. Note that exit handlers and
- finally clauses etc will not be executed.
+ finally clauses, etc., will not be executed.
Note that descendant processes of the process will *not* be terminated --
they will simply become orphaned.
@@ -559,10 +501,10 @@
Return ``True`` if the queue is full, ``False`` otherwise. Because of
multithreading/multiprocessing semantics, this is not reliable.
- .. method:: put(item[, block[, timeout]])`
+ .. method:: put(item[, block[, timeout]])
- Put item into the queue. If optional args *block* is ``True`` (the
- default) and *timeout* is ``None`` (the default), block if necessary until
+ Put item into the queue. If the optional argument *block* is ``True``
+ (the default) and *timeout* is ``None`` (the default), block if necessary until
a free slot is available. If *timeout* is a positive number, it blocks at
most *timeout* seconds and raises the :exc:`Queue.Full` exception if no
free slot was available within that time. Otherwise (*block* is
@@ -1782,10 +1724,10 @@
Address Formats
>>>>>>>>>>>>>>>
-* An ``'AF_INET'`` address is a tuple of the form ``(hostname, port)``` where
+* An ``'AF_INET'`` address is a tuple of the form ``(hostname, port)`` where
*hostname* is a string and *port* is an integer.
-* An ``'AF_UNIX'``` address is a string representing a filename on the
+* An ``'AF_UNIX'`` address is a string representing a filename on the
filesystem.
* An ``'AF_PIPE'`` address is a string of the form
@@ -1914,7 +1856,7 @@
Better to inherit than pickle/unpickle
- On Windows many of types from :mod:`multiprocessing` need to be picklable so
+ On Windows many types from :mod:`multiprocessing` need to be picklable so
that child processes can use them. However, one should generally avoid
sending shared objects to other processes using pipes or queues. Instead
you should arrange the program so that a process which need access to a
@@ -1961,7 +1903,7 @@
A fix here would be to swap the last two lines round (or simply remove the
``p.join()`` line).
-Explicity pass resources to child processes
+Explicitly pass resources to child processes
On Unix a child process can make use of a shared resource created in a
parent process using a global resource. However, it is better to pass the
Modified: python/branches/tlee-ast-optimize/Doc/library/someos.rst
==============================================================================
--- python/branches/tlee-ast-optimize/Doc/library/someos.rst (original)
+++ python/branches/tlee-ast-optimize/Doc/library/someos.rst Fri Jun 20 01:42:48 2008
@@ -14,10 +14,10 @@
.. toctree::
select.rst
- thread.rst
threading.rst
- dummy_thread.rst
+ thread.rst
dummy_threading.rst
+ dummy_thread.rst
multiprocessing.rst
mmap.rst
readline.rst
Modified: python/branches/tlee-ast-optimize/Include/patchlevel.h
==============================================================================
--- python/branches/tlee-ast-optimize/Include/patchlevel.h (original)
+++ python/branches/tlee-ast-optimize/Include/patchlevel.h Fri Jun 20 01:42:48 2008
@@ -23,11 +23,11 @@
#define PY_MAJOR_VERSION 2
#define PY_MINOR_VERSION 6
#define PY_MICRO_VERSION 0
-#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_ALPHA
-#define PY_RELEASE_SERIAL 3
+#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_BETA
+#define PY_RELEASE_SERIAL 1
/* Version as a string */
-#define PY_VERSION "2.6a3+"
+#define PY_VERSION "2.6b1+"
/*--end constants--*/
/* Subversion Revision number of this file (not of the repository) */
Modified: python/branches/tlee-ast-optimize/Lib/distutils/__init__.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/distutils/__init__.py (original)
+++ python/branches/tlee-ast-optimize/Lib/distutils/__init__.py Fri Jun 20 01:42:48 2008
@@ -22,5 +22,5 @@
#
#--start constants--
-__version__ = "2.6a3"
+__version__ = "2.6b1"
#--end constants--
Modified: python/branches/tlee-ast-optimize/Lib/idlelib/idlever.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/idlelib/idlever.py (original)
+++ python/branches/tlee-ast-optimize/Lib/idlelib/idlever.py Fri Jun 20 01:42:48 2008
@@ -1 +1 @@
-IDLE_VERSION = "2.6a3"
+IDLE_VERSION = "2.6b1"
Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/refactor.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/lib2to3/refactor.py (original)
+++ python/branches/tlee-ast-optimize/Lib/lib2to3/refactor.py Fri Jun 20 01:42:48 2008
@@ -172,7 +172,9 @@
want a pre-order AST traversal, and post_order is the list that want
post-order traversal.
"""
- fixer_pkg = ".".join(self.fixer_dir.split(os.path.sep))
+ fixer_pkg = self.fixer_dir.replace(os.path.sep, ".")
+ if os.path.altsep:
+ fixer_pkg = fixer_pkg.replace(os.path.altsep, ".")
pre_order_fixers = []
post_order_fixers = []
fix_names = self.options.fix
Modified: python/branches/tlee-ast-optimize/Lib/logging/__init__.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/logging/__init__.py (original)
+++ python/branches/tlee-ast-optimize/Lib/logging/__init__.py Fri Jun 20 01:42:48 2008
@@ -735,7 +735,7 @@
"""
Flushes the stream.
"""
- if self.stream:
+ if self.stream and hasattr(self.stream, "flush"):
self.stream.flush()
def emit(self, record):
@@ -791,7 +791,8 @@
"""
if self.stream:
self.flush()
- self.stream.close()
+ if hasattr(self.stream, "close"):
+ self.stream.close()
StreamHandler.close(self)
self.stream = None
Modified: python/branches/tlee-ast-optimize/Lib/logging/config.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/logging/config.py (original)
+++ python/branches/tlee-ast-optimize/Lib/logging/config.py Fri Jun 20 01:42:48 2008
@@ -52,7 +52,7 @@
# _listener holds the server object doing the listening
_listener = None
-def fileConfig(fname, defaults=None):
+def fileConfig(fname, defaults=None, disable_existing_loggers=1):
"""
Read the logging configuration from a ConfigParser-format file.
@@ -82,7 +82,7 @@
del logging._handlerList[:]
# Handlers add themselves to logging._handlers
handlers = _install_handlers(cp, formatters)
- _install_loggers(cp, handlers)
+ _install_loggers(cp, handlers, disable_existing_loggers)
finally:
logging._releaseLock()
@@ -170,7 +170,7 @@
return handlers
-def _install_loggers(cp, handlers):
+def _install_loggers(cp, handlers, disable_existing_loggers):
"""Create and install loggers"""
# configure the root first
@@ -255,7 +255,7 @@
logger.level = logging.NOTSET
logger.handlers = []
logger.propagate = 1
- else:
+ elif disable_existing_loggers:
logger.disabled = 1
Modified: python/branches/tlee-ast-optimize/Lib/numbers.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/numbers.py (original)
+++ python/branches/tlee-ast-optimize/Lib/numbers.py Fri Jun 20 01:42:48 2008
@@ -283,54 +283,87 @@
class Integral(Rational):
- """Integral adds a conversion to int and the bit-string operations."""
+ """Integral adds a conversion to long and the bit-string operations."""
@abstractmethod
- def __int__(self):
- """int(self)"""
+ def __long__(self):
+ """long(self)"""
raise NotImplementedError
def __index__(self):
"""index(self)"""
- return int(self)
+ return long(self)
+ @abstractmethod
+ def __pow__(self, exponent, modulus=None):
+ """self ** exponent % modulus, but maybe faster.
+
+ Accept the modulus argument if you want to support the
+ 3-argument version of pow(). Raise a TypeError if exponent < 0
+ or any argument isn't Integral. Otherwise, just implement the
+ 2-argument version described in Complex.
+ """
+ raise NotImplementedError
+
+ @abstractmethod
def __lshift__(self, other):
- return int(self) << int(other)
+ """self << other"""
+ raise NotImplementedError
+ @abstractmethod
def __rlshift__(self, other):
- return int(other) << int(self)
+ """other << self"""
+ raise NotImplementedError
+ @abstractmethod
def __rshift__(self, other):
- return int(self) >> int(other)
+ """self >> other"""
+ raise NotImplementedError
+ @abstractmethod
def __rrshift__(self, other):
- return int(other) >> int(self)
+ """other >> self"""
+ raise NotImplementedError
+ @abstractmethod
def __and__(self, other):
- return int(self) & int(other)
+ """self & other"""
+ raise NotImplementedError
+ @abstractmethod
def __rand__(self, other):
- return int(other) & int(self)
+ """other & self"""
+ raise NotImplementedError
+ @abstractmethod
def __xor__(self, other):
- return int(self) ^ int(other)
+ """self ^ other"""
+ raise NotImplementedError
+ @abstractmethod
def __rxor__(self, other):
- return int(other) ^ int(self)
+ """other ^ self"""
+ raise NotImplementedError
+ @abstractmethod
def __or__(self, other):
- return int(self) | int(other)
+ """self | other"""
+ raise NotImplementedError
+ @abstractmethod
def __ror__(self, other):
- return int(other) | int(self)
+ """other | self"""
+ raise NotImplementedError
+ @abstractmethod
def __invert__(self):
- return ~int(self)
+ """~self"""
+ raise NotImplementedError
# Concrete implementations of Rational and Real abstract methods.
def __float__(self):
- """float(self) == float(int(self))"""
- return float(int(self))
+ """float(self) == float(long(self))"""
+ return float(long(self))
@property
def numerator(self):
Modified: python/branches/tlee-ast-optimize/Lib/test/regrtest.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/test/regrtest.py (original)
+++ python/branches/tlee-ast-optimize/Lib/test/regrtest.py Fri Jun 20 01:42:48 2008
@@ -1128,11 +1128,14 @@
self.expected.add('test_imageop')
if not sys.platform in ("mac", "darwin"):
- MAC_ONLY = ["test_macostools", "test_aepack",
+ MAC_ONLY = ["test_macos", "test_macostools", "test_aepack",
"test_plistlib", "test_scriptpackages",
"test_applesingle"]
for skip in MAC_ONLY:
self.expected.add(skip)
+ elif len(u'\0'.encode('unicode-internal')) == 4:
+ self.expected.add("test_macostools")
+
if sys.platform != "win32":
# test_sqlite is only reliable on Windows where the library
Modified: python/branches/tlee-ast-optimize/Lib/test/test_grammar.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/test/test_grammar.py (original)
+++ python/branches/tlee-ast-optimize/Lib/test/test_grammar.py Fri Jun 20 01:42:48 2008
@@ -299,6 +299,7 @@
self.assertEquals(l5(1, 2), 5)
self.assertEquals(l5(1, 2, 3), 6)
check_syntax_error(self, "lambda x: x = 2")
+ check_syntax_error(self, "lambda (None,): None")
### stmt: simple_stmt | compound_stmt
# Tested below
Modified: python/branches/tlee-ast-optimize/Lib/test/test_macostools.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/test/test_macostools.py (original)
+++ python/branches/tlee-ast-optimize/Lib/test/test_macostools.py Fri Jun 20 01:42:48 2008
@@ -91,6 +91,9 @@
def test_main():
+ # Skip on wide unicode
+ if len(u'\0'.encode('unicode-internal')) == 4:
+ raise test_support.TestSkipped("test_macostools is broken in USC4")
test_support.run_unittest(TestMacostools)
Modified: python/branches/tlee-ast-optimize/Lib/test/test_multiprocessing.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/test/test_multiprocessing.py (original)
+++ python/branches/tlee-ast-optimize/Lib/test/test_multiprocessing.py Fri Jun 20 01:42:48 2008
@@ -390,7 +390,7 @@
def _test_get(self, queue, child_can_start, parent_can_continue):
child_can_start.wait()
- queue.put(1)
+ #queue.put(1)
queue.put(2)
queue.put(3)
queue.put(4)
@@ -417,7 +417,8 @@
time.sleep(DELTA)
self.assertEqual(queue_empty(queue), False)
- self.assertEqual(queue.get(), 1)
+ # Hangs unexpectedly, remove for now
+ #self.assertEqual(queue.get(), 1)
self.assertEqual(queue.get(True, None), 2)
self.assertEqual(queue.get(True), 3)
self.assertEqual(queue.get(timeout=1), 4)
@@ -959,7 +960,7 @@
def sqr(x, wait=0.0):
time.sleep(wait)
return x*x
-
+"""
class _TestPool(BaseTestCase):
def test_apply(self):
@@ -1029,7 +1030,7 @@
join = TimingWrapper(self.pool.join)
join()
self.assertTrue(join.elapsed < 0.2)
-
+"""
#
# Test that manager has expected number of shared objects left
#
@@ -1332,7 +1333,7 @@
self.assertRaises(ValueError, a.send_bytes, msg, 4, -1)
-
+"""
class _TestListenerClient(BaseTestCase):
ALLOWED_TYPES = ('processes', 'threads')
@@ -1352,11 +1353,11 @@
self.assertEqual(conn.recv(), 'hello')
p.join()
l.close()
-
+"""
#
# Test of sending connection and socket objects between processes
#
-
+"""
class _TestPicklingConnections(BaseTestCase):
ALLOWED_TYPES = ('processes',)
@@ -1438,7 +1439,7 @@
lp.join()
rp.join()
-
+"""
#
#
#
@@ -1754,6 +1755,13 @@
#
def test_main(run=None):
+ if sys.platform.startswith("linux"):
+ try:
+ lock = multiprocessing.RLock()
+ except OSError:
+ from test.test_support import TestSkipped
+ raise TestSkipped("OSError raises on RLock creation, see issue 3111!")
+
if run is None:
from test.test_support import run_unittest as run
@@ -1761,28 +1769,28 @@
multiprocessing.get_logger().setLevel(LOG_LEVEL)
- ProcessesMixin.pool = multiprocessing.Pool(4)
- ThreadsMixin.pool = multiprocessing.dummy.Pool(4)
- ManagerMixin.manager.__init__()
- ManagerMixin.manager.start()
- ManagerMixin.pool = ManagerMixin.manager.Pool(4)
+ #ProcessesMixin.pool = multiprocessing.Pool(4)
+ #ThreadsMixin.pool = multiprocessing.dummy.Pool(4)
+ #ManagerMixin.manager.__init__()
+ #ManagerMixin.manager.start()
+ #ManagerMixin.pool = ManagerMixin.manager.Pool(4)
testcases = (
- sorted(testcases_processes.values(), key=lambda tc:tc.__name__) +
- sorted(testcases_threads.values(), key=lambda tc:tc.__name__) +
- sorted(testcases_manager.values(), key=lambda tc:tc.__name__)
+ sorted(testcases_processes.values(), key=lambda tc:tc.__name__) #+
+ #sorted(testcases_threads.values(), key=lambda tc:tc.__name__) +
+ #sorted(testcases_manager.values(), key=lambda tc:tc.__name__)
)
loadTestsFromTestCase = unittest.defaultTestLoader.loadTestsFromTestCase
suite = unittest.TestSuite(loadTestsFromTestCase(tc) for tc in testcases)
run(suite)
- ThreadsMixin.pool.terminate()
- ProcessesMixin.pool.terminate()
- ManagerMixin.pool.terminate()
- ManagerMixin.manager.shutdown()
+ #ThreadsMixin.pool.terminate()
+ #ProcessesMixin.pool.terminate()
+ #ManagerMixin.pool.terminate()
+ #ManagerMixin.manager.shutdown()
- del ProcessesMixin.pool, ThreadsMixin.pool, ManagerMixin.pool
+ #del ProcessesMixin.pool, ThreadsMixin.pool, ManagerMixin.pool
def main():
test_main(unittest.TextTestRunner(verbosity=2).run)
Modified: python/branches/tlee-ast-optimize/Lib/test/test_site.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/test/test_site.py (original)
+++ python/branches/tlee-ast-optimize/Lib/test/test_site.py Fri Jun 20 01:42:48 2008
@@ -101,17 +101,17 @@
self.assert_(usersite in sys.path)
rc = subprocess.call([sys.executable, '-c',
- 'import sys; sys.exit("%s" in sys.path)' % usersite])
+ 'import sys; sys.exit(%r in sys.path)' % usersite])
self.assertEqual(rc, 1)
rc = subprocess.call([sys.executable, '-s', '-c',
- 'import sys; sys.exit("%s" in sys.path)' % usersite])
+ 'import sys; sys.exit(%r in sys.path)' % usersite])
self.assertEqual(rc, 0)
env = os.environ.copy()
env["PYTHONNOUSERSITE"] = "1"
rc = subprocess.call([sys.executable, '-c',
- 'import sys; sys.exit("%s" in sys.path)' % usersite],
+ 'import sys; sys.exit(%r in sys.path)' % usersite],
env=env)
self.assertEqual(rc, 0)
Deleted: python/branches/tlee-ast-optimize/Lib/test/test_socket_ssl.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/test/test_socket_ssl.py Fri Jun 20 01:42:48 2008
+++ (empty file)
@@ -1,283 +0,0 @@
-# Test just the SSL support in the socket module, in a moderately bogus way.
-
-import sys
-import unittest
-from test import test_support
-import socket
-import errno
-import threading
-import subprocess
-import time
-import os
-import urllib
-import warnings
-
-warnings.filterwarnings(
- 'ignore',
- 'socket.ssl.. is deprecated. Use ssl.wrap_socket.. instead.',
- DeprecationWarning)
-
-# Optionally test SSL support, if we have it in the tested platform
-skip_expected = not hasattr(socket, "ssl")
-
-HOST = test_support.HOST
-
-class ConnectedTests(unittest.TestCase):
-
- def urlopen(self, host, *args, **kwargs):
- # Connecting to remote hosts is flaky. Make it more robust
- # by retrying the connection several times.
- for i in range(3):
- try:
- return urllib.urlopen(host, *args, **kwargs)
- except IOError, e:
- last_exc = e
- continue
- except:
- raise
- raise last_exc
-
- def testBasic(self):
- socket.RAND_status()
- try:
- socket.RAND_egd(1)
- except TypeError:
- pass
- else:
- print "didn't raise TypeError"
- socket.RAND_add("this is a random string", 75.0)
-
- with test_support.transient_internet():
- f = self.urlopen('https://sf.net')
- buf = f.read()
- f.close()
-
- def testTimeout(self):
- def error_msg(extra_msg):
- print >> sys.stderr, """\
- WARNING: an attempt to connect to %r %s, in
- testTimeout. That may be legitimate, but is not the outcome we
- hoped for. If this message is seen often, testTimeout should be
- changed to use a more reliable address.""" % (ADDR, extra_msg)
-
- # A service which issues a welcome banner (without need to write
- # anything).
- ADDR = "pop.gmail.com", 995
-
- s = socket.socket()
- s.settimeout(30.0)
- try:
- s.connect(ADDR)
- except socket.timeout:
- error_msg('timed out')
- return
- except socket.error, exc: # In case connection is refused.
- if exc.args[0] == errno.ECONNREFUSED:
- error_msg('was refused')
- return
- else:
- raise
-
- ss = socket.ssl(s)
- # Read part of return welcome banner twice.
- ss.read(1)
- ss.read(1)
- s.close()
-
-class BasicTests(unittest.TestCase):
-
- def testRudeShutdown(self):
- listener_ready = threading.Event()
- listener_gone = threading.Event()
- sock = socket.socket()
- port = test_support.bind_port(sock)
-
- # `listener` runs in a thread. It opens a socket and sits in accept()
- # until the main thread connects. Then it rudely closes the socket,
- # and sets Event `listener_gone` to let the main thread know the socket
- # is gone.
- def listener(s):
- s.listen(5)
- listener_ready.set()
- s.accept()
- s = None # reclaim the socket object, which also closes it
- listener_gone.set()
-
- def connector():
- listener_ready.wait()
- s = socket.socket()
- s.connect((HOST, port))
- listener_gone.wait()
- try:
- ssl_sock = socket.ssl(s)
- except socket.sslerror:
- pass
- else:
- raise test_support.TestFailed(
- 'connecting to closed SSL socket should have failed')
-
- t = threading.Thread(target=listener, args=(sock,))
- t.start()
- connector()
- t.join()
-
- def connect(self, s, host_port):
- # Connecting to remote hosts is flaky. Make it more robust
- # by retrying the connection several times.
- for i in range(3):
- try:
- return s.connect(host_port)
- except IOError, e:
- last_exc = e
- continue
- except:
- raise
- raise last_exc
-
- def test_978833(self):
- if not test_support.is_resource_enabled("network"):
- return
- if test_support.verbose:
- print "test_978833 ..."
-
- import os, httplib, ssl
- with test_support.transient_internet():
- s = socket.socket(socket.AF_INET)
- try:
- self.connect(s, ("svn.python.org", 443))
- except IOError:
- print >> sys.stderr, """\
- WARNING: an attempt to connect to svn.python.org:443 failed, in
- test_978833. That may be legitimate, but is not the outcome we
- hoped for. If this message is seen often, test_978833 should be
- changed to use a more reliable address."""
- return
- fd = s._sock.fileno()
- sock = ssl.wrap_socket(s)
- s = None
- sock.close()
- try:
- os.fstat(fd)
- except OSError:
- pass
- else:
- raise test_support.TestFailed("Failed to close socket")
-
-class OpenSSLTests(unittest.TestCase):
-
- def testBasic(self):
- s = socket.socket()
- s.connect((HOST, OpenSSLServer.PORT))
- ss = socket.ssl(s)
- ss.write("Foo\n")
- i = ss.read(4)
- self.assertEqual(i, "Foo\n")
- s.close()
-
- def testMethods(self):
- # read & write is already tried in the Basic test
- # now we'll try to get the server info about certificates
- # this came from the certificate I used, one I found in /usr/share/openssl
- info = "/C=PT/ST=Queensland/L=Lisboa/O=Neuronio, Lda./OU=Desenvolvimento/CN=brutus.neuronio.pt/emailAddress=sampo at iki.fi"
-
- s = socket.socket()
- s.connect((HOST, OpenSSLServer.PORT))
- ss = socket.ssl(s)
- cert = ss.server()
- self.assertEqual(cert, info)
- cert = ss.issuer()
- self.assertEqual(cert, info)
- s.close()
-
-
-class OpenSSLServer(threading.Thread):
- PORT = None
- def __init__(self):
- self.s = None
- self.keepServing = True
- self._external()
- if self.haveServer:
- threading.Thread.__init__(self)
-
- def _external(self):
- # let's find the .pem files
- curdir = os.path.dirname(__file__) or os.curdir
- cert_file = os.path.join(curdir, "ssl_cert.pem")
- if not os.access(cert_file, os.F_OK):
- raise ValueError("No cert file found! (tried %r)" % cert_file)
- key_file = os.path.join(curdir, "ssl_key.pem")
- if not os.access(key_file, os.F_OK):
- raise ValueError("No key file found! (tried %r)" % key_file)
-
- try:
- # XXX TODO: on Windows, this should make more effort to use the
- # openssl.exe that would have been built by the pcbuild.sln.
- OpenSSLServer.PORT = test_support.find_unused_port()
- args = (OpenSSLServer.PORT, cert_file, key_file)
- cmd = "openssl s_server -accept %d -cert %s -key %s -quiet" % args
- self.s = subprocess.Popen(cmd.split(), stdin=subprocess.PIPE,
- stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT)
- time.sleep(1)
- except:
- self.haveServer = False
- else:
- # let's try if it is actually up
- try:
- s = socket.socket()
- s.connect((HOST, OpenSSLServer.PORT))
- s.close()
- if self.s.stdout.readline() != "ERROR\n":
- raise ValueError
- except:
- self.haveServer = False
- else:
- self.haveServer = True
-
- def run(self):
- while self.keepServing:
- time.sleep(.5)
- l = self.s.stdout.readline()
- self.s.stdin.write(l)
-
- def shutdown(self):
- self.keepServing = False
- if not self.s:
- return
- if sys.platform == "win32":
- subprocess.TerminateProcess(int(self.s._handle), -1)
- else:
- os.kill(self.s.pid, 15)
-
-def test_main():
- if not hasattr(socket, "ssl"):
- raise test_support.TestSkipped("socket module has no ssl support")
-
- tests = [BasicTests]
-
- if test_support.is_resource_enabled('network'):
- tests.append(ConnectedTests)
-
- # in these platforms we can kill the openssl process
- if sys.platform in ("sunos5", "darwin", "linux1",
- "linux2", "win32", "hp-ux11"):
-
- server = OpenSSLServer()
- if server.haveServer:
- tests.append(OpenSSLTests)
- server.start()
- else:
- server = None
-
- thread_info = test_support.threading_setup()
-
- try:
- test_support.run_unittest(*tests)
- finally:
- if server is not None and server.haveServer:
- server.shutdown()
-
- test_support.threading_cleanup(*thread_info)
-
-if __name__ == "__main__":
- test_main()
Modified: python/branches/tlee-ast-optimize/Lib/test/test_sys.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/test/test_sys.py (original)
+++ python/branches/tlee-ast-optimize/Lib/test/test_sys.py Fri Jun 20 01:42:48 2008
@@ -538,8 +538,7 @@
self.check_sizeof([], h + l + p + l)
self.check_sizeof([1, 2, 3], h + l + p + l + 3*l)
# unicode
- import math
- usize = math.log(sys.maxunicode + 1, 2) / 8
+ usize = len(u'\0'.encode('unicode-internal'))
samples = [u'', u'1'*100]
# we need to test for both sizes, because we don't know if the string
# has been cached
Modified: python/branches/tlee-ast-optimize/Lib/test/test_weakref.py
==============================================================================
--- python/branches/tlee-ast-optimize/Lib/test/test_weakref.py (original)
+++ python/branches/tlee-ast-optimize/Lib/test/test_weakref.py Fri Jun 20 01:42:48 2008
@@ -666,7 +666,7 @@
w = Target()
-class SubclassableWeakrefTestCase(unittest.TestCase):
+class SubclassableWeakrefTestCase(TestBase):
def test_subclass_refs(self):
class MyRef(weakref.ref):
@@ -730,6 +730,44 @@
self.assertEqual(r.meth(), "abcdef")
self.failIf(hasattr(r, "__dict__"))
+ def test_subclass_refs_with_cycle(self):
+ # Bug #3110
+ # An instance of a weakref subclass can have attributes.
+ # If such a weakref holds the only strong reference to the object,
+ # deleting the weakref will delete the object. In this case,
+ # the callback must not be called, because the ref object is
+ # being deleted.
+ class MyRef(weakref.ref):
+ pass
+
+ # Use a local callback, for "regrtest -R::"
+ # to detect refcounting problems
+ def callback(w):
+ self.cbcalled += 1
+
+ o = C()
+ r1 = MyRef(o, callback)
+ r1.o = o
+ del o
+
+ del r1 # Used to crash here
+
+ self.assertEqual(self.cbcalled, 0)
+
+ # Same test, with two weakrefs to the same object
+ # (since code paths are different)
+ o = C()
+ r1 = MyRef(o, callback)
+ r2 = MyRef(o, callback)
+ r1.r = r2
+ r2.o = o
+ del o
+ del r2
+
+ del r1 # Used to crash here
+
+ self.assertEqual(self.cbcalled, 0)
+
class Object:
def __init__(self, arg):
@@ -1171,6 +1209,7 @@
MappingTestCase,
WeakValueDictionaryTestCase,
WeakKeyDictionaryTestCase,
+ SubclassableWeakrefTestCase,
)
test_support.run_doctest(sys.modules[__name__])
Modified: python/branches/tlee-ast-optimize/Misc/NEWS
==============================================================================
--- python/branches/tlee-ast-optimize/Misc/NEWS (original)
+++ python/branches/tlee-ast-optimize/Misc/NEWS Fri Jun 20 01:42:48 2008
@@ -7,11 +7,14 @@
What's New in Python 2.6 beta 1?
================================
-*Release date: XX-June-2008*
+*Release date: 18-June-2008*
Core and Builtins
-----------------
+- Issue #3100: Corrected a crash on deallocation of a subclassed weakref which
+ holds the last (strong) reference to its referent.
+
- Add future_builtins.ascii().
- Several set methods now accept multiple arguments: update(), union(),
@@ -50,6 +53,8 @@
Extension Modules
-----------------
+- Issue #3116: marshal.dumps() had quadratic behavior for strings > 32Mb.
+
- Issue #2138: Add factorial() the math module.
- The heapq module does comparisons using LT instead of LE. This
@@ -84,6 +89,15 @@
Library
-------
+- Issue #3136: fileConfig()'s disabling of old loggers is now conditional via
+ an optional disable_existing_loggers parameter, but the default value is
+ such that the old behaviour is preserved. Thanks to Leandro Lucarella for
+ the patch.
+
+- Issue #3126: StreamHandler and FileHandler check before calling "flush" and
+ "close" that the stream object has these, using hasattr (thanks to bobf for
+ the patch).
+
- Issue #2912: platform.uname now tries to determine unknown information even if
os.uname exists.
@@ -107,7 +121,7 @@
- Issue #2404: ctypes objects support the new pep3118 buffer interface.
-- Patch #2125: Add GetInteger and GetString methods for
+- Patch #2125: Add GetInteger and GetString methods for
msilib.Record objects.
- Issue #2782: The datetime module's strftime methods now accept
@@ -294,7 +308,7 @@
- The Mac Modules (including Carbon) have been deprecated for removal
in Python 3.0.
-- Library: on MacOS X you can now set ``ARCHFLAGS`` in the shell
+- Library: on MacOS X you can now set ``ARCHFLAGS`` in the shell
environment to control the '-arch' flags that are used to build
an extension. This was added for compatibility with Apple's build
of Python.
Modified: python/branches/tlee-ast-optimize/Misc/RPM/python-2.6.spec
==============================================================================
--- python/branches/tlee-ast-optimize/Misc/RPM/python-2.6.spec (original)
+++ python/branches/tlee-ast-optimize/Misc/RPM/python-2.6.spec Fri Jun 20 01:42:48 2008
@@ -34,7 +34,7 @@
%define name python
#--start constants--
-%define version 2.6a3
+%define version 2.6b1
%define libver 2.6
#--end constants--
%define release 1pydotorg
Modified: python/branches/tlee-ast-optimize/Misc/developers.txt
==============================================================================
--- python/branches/tlee-ast-optimize/Misc/developers.txt (original)
+++ python/branches/tlee-ast-optimize/Misc/developers.txt Fri Jun 20 01:42:48 2008
@@ -17,6 +17,9 @@
Permissions History
-------------------
+- Jesse Noller was given SVN access on 16 June 2008 by Georg Brandl,
+ for work on the multiprocessing module.
+
- Gregor Lingl was given SVN access on 10 June 2008 by MvL,
for work on the turtle module.
Modified: python/branches/tlee-ast-optimize/Modules/_cursesmodule.c
==============================================================================
--- python/branches/tlee-ast-optimize/Modules/_cursesmodule.c (original)
+++ python/branches/tlee-ast-optimize/Modules/_cursesmodule.c Fri Jun 20 01:42:48 2008
@@ -2319,6 +2319,7 @@
/* Internal helper used for updating curses.LINES, curses.COLS, _curses.LINES
* and _curses.COLS */
+#if defined(HAVE_CURSES_RESIZETERM) || defined(HAVE_CURSES_RESIZE_TERM)
static int
update_lines_cols(void)
{
@@ -2363,6 +2364,7 @@
Py_DECREF(m);
return 1;
}
+#endif
#ifdef HAVE_CURSES_RESIZETERM
static PyObject *
Modified: python/branches/tlee-ast-optimize/Modules/mathmodule.c
==============================================================================
--- python/branches/tlee-ast-optimize/Modules/mathmodule.c (original)
+++ python/branches/tlee-ast-optimize/Modules/mathmodule.c Fri Jun 20 01:42:48 2008
@@ -82,12 +82,17 @@
* should return a zero on underflow, and +- HUGE_VAL on
* overflow, so testing the result for zero suffices to
* distinguish the cases).
+ *
+ * On some platforms (Ubuntu/ia64) it seems that errno can be
+ * set to ERANGE for subnormal results that do *not* underflow
+ * to zero. So to be safe, we'll ignore ERANGE whenever the
+ * function result is less than one in absolute value.
*/
- if (x)
+ if (fabs(x) < 1.0)
+ result = 0;
+ else
PyErr_SetString(PyExc_OverflowError,
"math range error");
- else
- result = 0;
}
else
/* Unexpected math error */
@@ -554,7 +559,6 @@
error:
Py_DECREF(result);
- Py_XDECREF(iobj);
return NULL;
}
Modified: python/branches/tlee-ast-optimize/Objects/weakrefobject.c
==============================================================================
--- python/branches/tlee-ast-optimize/Objects/weakrefobject.c (original)
+++ python/branches/tlee-ast-optimize/Objects/weakrefobject.c Fri Jun 20 01:42:48 2008
@@ -907,7 +907,8 @@
current->wr_callback = NULL;
clear_weakref(current);
if (callback != NULL) {
- handle_callback(current, callback);
+ if (current->ob_refcnt > 0)
+ handle_callback(current, callback);
Py_DECREF(callback);
}
}
@@ -925,9 +926,15 @@
for (i = 0; i < count; ++i) {
PyWeakReference *next = current->wr_next;
- Py_INCREF(current);
- PyTuple_SET_ITEM(tuple, i * 2, (PyObject *) current);
- PyTuple_SET_ITEM(tuple, i * 2 + 1, current->wr_callback);
+ if (current->ob_refcnt > 0)
+ {
+ Py_INCREF(current);
+ PyTuple_SET_ITEM(tuple, i * 2, (PyObject *) current);
+ PyTuple_SET_ITEM(tuple, i * 2 + 1, current->wr_callback);
+ }
+ else {
+ Py_DECREF(current->wr_callback);
+ }
current->wr_callback = NULL;
clear_weakref(current);
current = next;
@@ -935,6 +942,7 @@
for (i = 0; i < count; ++i) {
PyObject *callback = PyTuple_GET_ITEM(tuple, i * 2 + 1);
+ /* The tuple may have slots left to NULL */
if (callback != NULL) {
PyObject *item = PyTuple_GET_ITEM(tuple, i * 2);
handle_callback((PyWeakReference *)item, callback);
Modified: python/branches/tlee-ast-optimize/Python/marshal.c
==============================================================================
--- python/branches/tlee-ast-optimize/Python/marshal.c (original)
+++ python/branches/tlee-ast-optimize/Python/marshal.c Fri Jun 20 01:42:48 2008
@@ -67,7 +67,7 @@
size = PyString_Size(p->str);
newsize = size + size + 1024;
if (newsize > 32*1024*1024) {
- newsize = size + 1024*1024;
+ newsize = size + (size >> 3); /* 12.5% overallocation */
}
if (_PyString_Resize(&p->str, newsize) != 0) {
p->ptr = p->end = NULL;
Modified: python/branches/tlee-ast-optimize/README
==============================================================================
--- python/branches/tlee-ast-optimize/README (original)
+++ python/branches/tlee-ast-optimize/README Fri Jun 20 01:42:48 2008
@@ -1,5 +1,5 @@
-This is Python version 2.6 alpha 3
-==================================
+This is Python version 2.6 beta 1
+=================================
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
Python Software Foundation.
Modified: python/branches/tlee-ast-optimize/Tools/buildbot/external-amd64.bat
==============================================================================
--- python/branches/tlee-ast-optimize/Tools/buildbot/external-amd64.bat (original)
+++ python/branches/tlee-ast-optimize/Tools/buildbot/external-amd64.bat Fri Jun 20 01:42:48 2008
@@ -12,7 +12,7 @@
)
if not exist tcltk64\bin\tk85g.dll (
- cd tk-8.5.2.1\win
+ cd tk-8.5.2.0\win
nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 OPTS=noxp DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 TCLDIR=..\..\tcl-8.5.2.1 clean
nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 OPTS=noxp DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 TCLDIR=..\..\tcl-8.5.2.1 all
nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 OPTS=noxp DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 TCLDIR=..\..\tcl-8.5.2.1 install
Modified: python/branches/tlee-ast-optimize/Tools/scripts/2to3
==============================================================================
--- python/branches/tlee-ast-optimize/Tools/scripts/2to3 (original)
+++ python/branches/tlee-ast-optimize/Tools/scripts/2to3 Fri Jun 20 01:42:48 2008
@@ -2,4 +2,4 @@
from lib2to3 import refactor
import sys
-sys.exit(refactor.main())
+sys.exit(refactor.main("lib2to3/fixes"))
More information about the Python-checkins
mailing list