diff -r 360f9d483f94 -r 2a20cee18add Doc/library/multiprocessing.rst --- a/Doc/library/multiprocessing.rst Mon Jun 18 19:57:23 2012 +0200 +++ b/Doc/library/multiprocessing.rst Mon Jun 18 08:33:13 2012 -0600 @@ -834,10 +834,6 @@ Connection objects themselves can now be transferred between processes using :meth:`Connection.send` and :meth:`Connection.recv`. - .. versionadded:: 3.3 - Connection objects now support the context manager protocol -- see - :ref:`typecontextmanager`. :meth:`__enter__` returns the - connection object, and :meth:`__exit__` calls :meth:`close`. For example: @@ -1281,9 +1277,6 @@ The address used by the manager. - Manager objects support the context manager protocol -- see - :ref:`typecontextmanager`. :meth:`__enter__` returns the - manager object, and :meth:`__exit__` calls :meth:`shutdown`. .. class:: SyncManager @@ -1754,11 +1747,6 @@ Wait for the worker processes to exit. One must call :meth:`close` or :meth:`terminate` before using :meth:`join`. - .. versionadded:: 3.3 - Pool objects now support the context manager protocol -- see - :ref:`typecontextmanager`. :meth:`__enter__` returns the pool - object, and :meth:`__exit__` calls :meth:`terminate`. - .. class:: AsyncResult @@ -1923,11 +1911,6 @@ The address from which the last accepted connection came. If this is unavailable then it is ``None``. - .. versionadded:: 3.3 - Listener objects now support the context manager protocol -- see - :ref:`typecontextmanager`. :meth:`__enter__` returns the - listener object, and :meth:`__exit__` calls :meth:`close`. - .. function:: wait(object_list, timeout=None) Wait till an object in *object_list* is ready. Returns the list of diff -r 360f9d483f94 -r 2a20cee18add Lib/multiprocessing/connection.py --- a/Lib/multiprocessing/connection.py Mon Jun 18 19:57:23 2012 +0200 +++ b/Lib/multiprocessing/connection.py Mon Jun 18 08:33:13 2012 -0600 @@ -257,12 +257,6 @@ self._check_readable() return self._poll(timeout) - def __enter__(self): - return self - - def __exit__(self, exc_type, exc_value, exc_tb): - self.close() - if _winapi: @@ -442,8 +436,6 @@ Returns a `Connection` object. ''' - if self._listener is None: - raise IOError('listener is closed') c = self._listener.accept() if self._authkey: deliver_challenge(c, self._authkey) @@ -454,19 +446,11 @@ ''' Close the bound socket or named pipe of `self`. ''' - if self._listener is not None: - self._listener.close() - self._listener = None + return self._listener.close() address = property(lambda self: self._listener._address) last_accepted = property(lambda self: self._listener._last_accepted) - def __enter__(self): - return self - - def __exit__(self, exc_type, exc_value, exc_tb): - self.close() - def Client(address, family=None, authkey=None): ''' diff -r 360f9d483f94 -r 2a20cee18add Lib/multiprocessing/dummy/connection.py --- a/Lib/multiprocessing/dummy/connection.py Mon Jun 18 19:57:23 2012 +0200 +++ b/Lib/multiprocessing/dummy/connection.py Mon Jun 18 08:33:13 2012 -0600 @@ -53,12 +53,6 @@ address = property(lambda self: self._backlog_queue) - def __enter__(self): - return self - - def __exit__(self, exc_type, exc_value, exc_tb): - self.close() - def Client(address): _in, _out = Queue(), Queue() @@ -91,9 +85,3 @@ def close(self): pass - - def __enter__(self): - return self - - def __exit__(self, exc_type, exc_value, exc_tb): - self.close() diff -r 360f9d483f94 -r 2a20cee18add Lib/multiprocessing/pool.py --- a/Lib/multiprocessing/pool.py Mon Jun 18 19:57:23 2012 +0200 +++ b/Lib/multiprocessing/pool.py Mon Jun 18 08:33:13 2012 -0600 @@ -496,8 +496,7 @@ # We must wait for the worker handler to exit before terminating # workers because we don't want workers to be restarted behind our back. debug('joining worker handler') - if threading.current_thread() is not worker_handler: - worker_handler.join() + worker_handler.join() # Terminate workers which haven't already finished. if pool and hasattr(pool[0], 'terminate'): @@ -507,12 +506,10 @@ p.terminate() debug('joining task handler') - if threading.current_thread() is not task_handler: - task_handler.join() + task_handler.join() debug('joining result handler') - if threading.current_thread() is not result_handler: - result_handler.join() + result_handler.join() if pool and hasattr(pool[0], 'terminate'): debug('joining pool workers') @@ -522,12 +519,6 @@ debug('cleaning up worker %d' % p.pid) p.join() - def __enter__(self): - return self - - def __exit__(self, exc_type, exc_val, exc_tb): - self.terminate() - # # Class whose instances are returned by `Pool.apply_async()` # diff -r 360f9d483f94 -r 2a20cee18add Lib/test/test_multiprocessing.py --- a/Lib/test/test_multiprocessing.py Mon Jun 18 19:57:23 2012 +0200 +++ b/Lib/test/test_multiprocessing.py Mon Jun 18 08:33:13 2012 -0600 @@ -1719,15 +1719,6 @@ p.close() p.join() - def test_context(self): - if self.TYPE == 'processes': - L = list(range(10)) - expected = [sqr(i) for i in L] - with multiprocessing.Pool(2) as p: - r = p.map_async(sqr, L) - self.assertEqual(r.get(), expected) - self.assertRaises(AssertionError, p.map_async, sqr, L) - def raising(): raise KeyError("key") @@ -2275,22 +2266,6 @@ self.assertRaises(RuntimeError, reduction.recv_handle, conn) p.join() - def test_context(self): - a, b = self.Pipe() - - with a, b: - a.send(1729) - self.assertEqual(b.recv(), 1729) - if self.TYPE == 'processes': - self.assertFalse(a.closed) - self.assertFalse(b.closed) - - if self.TYPE == 'processes': - self.assertTrue(a.closed) - self.assertTrue(b.closed) - self.assertRaises(IOError, a.recv) - self.assertRaises(IOError, b.recv) - class _TestListener(BaseTestCase): ALLOWED_TYPES = ('processes',) @@ -2302,16 +2277,6 @@ self.assertRaises(OSError, self.connection.Listener, l.address, family) - def test_context(self): - with self.connection.Listener() as l: - with self.connection.Client(l.address) as c: - with l.accept() as d: - c.send(1729) - self.assertEqual(d.recv(), 1729) - - if self.TYPE == 'processes': - self.assertRaises(IOError, l.accept) - class _TestListenerClient(BaseTestCase): ALLOWED_TYPES = ('processes', 'threads') diff -r 360f9d483f94 -r 2a20cee18add Misc/NEWS --- a/Misc/NEWS Mon Jun 18 19:57:23 2012 +0200 +++ b/Misc/NEWS Mon Jun 18 08:33:13 2012 -0600 @@ -29,10 +29,6 @@ Library ------- -- Issue #15064: Implement context manager protocol for multiprocessing types - -- Issue #15101: Make pool finalizer avoid joining current thread. - - Issue #14657: The frozen instance of importlib used for bootstrap is now also the module imported as importlib._bootstrap. diff -r 360f9d483f94 -r 2a20cee18add Modules/_decimal/libmpdec/mpdecimal.c --- a/Modules/_decimal/libmpdec/mpdecimal.c Mon Jun 18 19:57:23 2012 +0200 +++ b/Modules/_decimal/libmpdec/mpdecimal.c Mon Jun 18 08:33:13 2012 -0600 @@ -5984,10 +5984,8 @@ mpd_qfinalize(result, ctx, status); } -/* - * If the exponent is infinite and base equals one, the result is one - * with a coefficient of length prec. Otherwise, result is undefined. - * Return the value of the comparison against one. +/* + * This is an internal function that does not check for NaNs. */ static int _qcheck_pow_one_inf(mpd_t *result, const mpd_t *base, uint8_t resultsign, @@ -6008,7 +6006,7 @@ } /* - * If abs(base) equals one, calculate the correct power of one result. + * If base equals one, calculate the correct power of one result. * Otherwise, result is undefined. Return the value of the comparison * against 1. * @@ -6062,7 +6060,7 @@ /* * Detect certain over/underflow of x**y. - * ACL2 proof: pow-bounds.lisp. + * ACL2 proof: pow_bounds.lisp. * * Symbols: * @@ -6217,10 +6215,7 @@ } */ -/* - * The power function for real exponents. - * Relative error: abs(result - e**y) < e**y * 1/5 * 10**(-prec - 1) - */ +/* The power function for real exponents */ static void _mpd_qpow_real(mpd_t *result, const mpd_t *base, const mpd_t *exp, const mpd_context_t *ctx, uint32_t *status) @@ -6239,30 +6234,6 @@ workctx.round = MPD_ROUND_HALF_EVEN; workctx.allcr = ctx->allcr; - /* - * extra := MPD_EXPDIGITS = MPD_EXP_MAX_T - * wp := prec + 4 + extra - * abs(err) < 5 * 10**-wp - * y := log(base) * exp - * Calculate: - * 1) e**(y * (1 + err)**2) * (1 + err) - * = e**y * e**(y * (2*err + err**2)) * (1 + err) - * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - * Relative error of the underlined term: - * 2) abs(e**(y * (2*err + err**2)) - 1) - * Case abs(y) >= 10**extra: - * 3) adjexp(y)+1 > log10(abs(y)) >= extra - * This triggers the Overflow/Underflow shortcut in _mpd_qexp(), - * so no further analysis is necessary. - * Case abs(y) < 10**extra: - * 4) abs(y * (2*err + err**2)) < 1/5 * 10**(-prec - 2) - * Use (see _mpd_qexp): - * 5) abs(x) <= 9/10 * 10**-p ==> abs(e**x - 1) < 10**-p - * With 2), 4) and 5): - * 6) abs(e**(y * (2*err + err**2)) - 1) < 10**(-prec - 2) - * The complete relative error of 1) is: - * 7) abs(result - e**y) < e**y * 1/5 * 10**(-prec - 1) - */ mpd_qln(result, base, &workctx, &workctx.status); mpd_qmul(result, result, &texp, &workctx, &workctx.status); mpd_qexp(result, result, &workctx, status); diff -r 360f9d483f94 -r 2a20cee18add PC/python_nt.rc --- a/PC/python_nt.rc Mon Jun 18 19:57:23 2012 +0200 +++ b/PC/python_nt.rc Mon Jun 18 08:33:13 2012 -0600 @@ -6,11 +6,7 @@ #define MS_WINDOWS #include "modsupport.h" #include "patchlevel.h" -#ifdef _DEBUG -# include "pythonnt_rc_d.h" -#else -# include "pythonnt_rc.h" -#endif +#include "pythonnt_rc.h" /* e.g., 3.3.0a1 * PY_VERSION comes from patchevel.h diff -r 360f9d483f94 -r 2a20cee18add PCbuild/make_versioninfo.vcxproj --- a/PCbuild/make_versioninfo.vcxproj Mon Jun 18 19:57:23 2012 +0200 +++ b/PCbuild/make_versioninfo.vcxproj Mon Jun 18 08:33:13 2012 -0600 @@ -1,199 +1,70 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {F0E0541E-F17D-430B-97C4-93ADF0DD284E} - make_versioninfo - - - - Application - false - NotSet - - - Application - false - MultiByte - - - Application - - - Application - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.40219.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - Build PC/pythonnt_rc(_d).h + + + + + Release + Win32 + + + + {F0E0541E-F17D-430B-97C4-93ADF0DD284E} + make_versioninfo + + + + Application + false + MultiByte + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + AllRules.ruleset + + + + + + Build PC/pythonnt_rc(_d).h cd $(SolutionDir) make_versioninfo.exe > ..\PC\pythonnt_rc.h - - $(SolutionDir)..\PC\pythonnt_rc.h;%(Outputs) - - - MaxSpeed - OnlyExplicitInline - true - %(AdditionalIncludeDirectories) - _CONSOLE;%(PreprocessorDefinitions) - true - MultiThreadedDLL - true - Default - - - $(SolutionDir)make_versioninfo.exe - Console - 0x1d000000 - - + + $(SolutionDir)..\PC\pythonnt_rc.h;%(Outputs) + + + MaxSpeed + OnlyExplicitInline + true + %(AdditionalIncludeDirectories) + _CONSOLE;%(PreprocessorDefinitions) + true + MultiThreadedDLL + true + Default + + + $(SolutionDir)make_versioninfo.exe + Console + 0x1d000000 + + cd $(SolutionDir) -make_versioninfo.exe > ..\PC\python_nt.h - - - - - - Build PC/pythonnt_rc(_d).h - cd $(SolutionDir) -make_versioninfo.exe > ..\PC\pythonnt_rc.h - - $(SolutionDir)..\PC\pythonnt_rc.h;%(Outputs) - - - MaxSpeed - OnlyExplicitInline - true - _CONSOLE;%(PreprocessorDefinitions) - - - $(SolutionDir)make_versioninfo.exe - - - cd $(SolutionDir) -make_versioninfo.exe > ..\PC\python_nt.h - - - - - - Build PC/pythonnt_rc(_d).h - cd $(SolutionDir) -make_versioninfo_d.exe > ..\PC\pythonnt_rc_d.h - - $(SolutionDir)..\PC\pythonnt_rc_d.h;%(Outputs) - - - Disabled - OnlyExplicitInline - false - %(AdditionalIncludeDirectories) - _CONSOLE;%(PreprocessorDefinitions) - true - MultiThreadedDLL - true - Default - - - $(SolutionDir)make_versioninfo_d.exe - Console - 0x1d000000 - - - cd $(SolutionDir) -make_versioninfo_d.exe > ..\PC\python_nt_d.h - - - - - - Build PC/pythonnt_rc(_d).h - cd $(SolutionDir) -make_versioninfo_d.exe > ..\PC\pythonnt_rc_d.h - - $(SolutionDir)..\PC\pythonnt_rc_d.h;%(Outputs) - - - X64 - - - Disabled - OnlyExplicitInline - false - _CONSOLE;%(PreprocessorDefinitions) - - - $(SolutionDir)make_versioninfo_d.exe - MachineX64 - - - cd $(SolutionDir) -make_versioninfo_d.exe > ..\PC\python_nt_d.h - - - - - - - - - +make_versioninfo.exe > ..\PC\python_nt$(PyDebugExt).h + + + + + + + + + \ No newline at end of file diff -r 360f9d483f94 -r 2a20cee18add PCbuild/pcbuild.sln --- a/PCbuild/pcbuild.sln Mon Jun 18 19:57:23 2012 +0200 +++ b/PCbuild/pcbuild.sln Mon Jun 18 08:33:13 2012 -0600 @@ -96,10 +96,9 @@ {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Release|Win32.Build.0 = Release|Win32 {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Release|x64.ActiveCfg = Release|x64 {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Release|x64.Build.0 = Release|x64 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|Win32.ActiveCfg = Debug|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|Win32.Build.0 = Debug|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|x64.ActiveCfg = Debug|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|x64.Build.0 = Debug|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|Win32.ActiveCfg = Release|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|Win32.Build.0 = Release|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|x64.ActiveCfg = Release|Win32 {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGInstrument|Win32.ActiveCfg = Release|Win32 {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGInstrument|Win32.Build.0 = Release|Win32 {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGInstrument|x64.ActiveCfg = Release|Win32 diff -r 360f9d483f94 -r 2a20cee18add PCbuild/x64.props --- a/PCbuild/x64.props Mon Jun 18 19:57:23 2012 +0200 +++ b/PCbuild/x64.props Mon Jun 18 08:33:13 2012 -0600 @@ -1,14 +1,14 @@  - - $(HOST_PYTHON) - <_ProjectFileVersion>10.0.30319.1 <_PropertySheetDisplayName>amd64 $(SolutionDir)amd64\ $(SolutionDir)$(PlatformName)-temp-$(Configuration)\$(ProjectName)\ + + $(OutDir)python$(PyDebugExt).exe + /USECL:MS_OPTERON /GS- %(AdditionalOptions) @@ -18,9 +18,4 @@ MachineX64 - - - $(PythonExe) - - \ No newline at end of file diff -r 360f9d483f94 -r 2a20cee18add Tools/buildbot/build-amd64.bat --- a/Tools/buildbot/build-amd64.bat Mon Jun 18 19:57:23 2012 +0200 +++ b/Tools/buildbot/build-amd64.bat Mon Jun 18 08:33:13 2012 -0600 @@ -1,7 +1,8 @@ @rem Used by the buildbot "compile" step. cmd /c Tools\buildbot\external-amd64.bat -call "%VS100COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64 cmd /c Tools\buildbot\clean-amd64.bat +call "%VS100COMNTOOLS%..\..\VC\vcvarsall.bat" x86_amd64 msbuild /p:useenv=true PCbuild\kill_python.vcxproj /p:Configuration=Debug /p:PlatformTarget=x64 PCbuild\amd64\kill_python_d.exe +cmd /c Tools\buildbot\build-common.bat msbuild /p:useenv=true PCbuild\pcbuild.sln /p:Configuration=Debug /p:Platform=x64 diff -r 360f9d483f94 -r 2a20cee18add Tools/buildbot/build-common.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Tools/buildbot/build-common.bat Mon Jun 18 08:33:13 2012 -0600 @@ -0,0 +1,5 @@ +@rem Common file shared between build.bat and build-amd64.bat. + +call "%VS100COMNTOOLS%vsvars32.bat" +msbuild /p:useenv=true PCbuild\make_buildinfo.vcxproj /p:Configuration=Release /p:Platform=Win32 +msbuild /p:useenv=true PCbuild\make_versioninfo.vcxproj /p:Configuration=Release /p:Platform=Win32 diff -r 360f9d483f94 -r 2a20cee18add Tools/buildbot/build.bat --- a/Tools/buildbot/build.bat Mon Jun 18 19:57:23 2012 +0200 +++ b/Tools/buildbot/build.bat Mon Jun 18 08:33:13 2012 -0600 @@ -1,7 +1,7 @@ @rem Used by the buildbot "compile" step. cmd /c Tools\buildbot\external.bat +cmd /c Tools\buildbot\clean.bat call "%VS100COMNTOOLS%vsvars32.bat" -cmd /c Tools\buildbot\clean.bat msbuild /p:useenv=true PCbuild\kill_python.vcxproj /p:Configuration=Debug /p:PlatformTarget=x86 PCbuild\kill_python_d.exe msbuild /p:useenv=true PCbuild\pcbuild.sln /p:Configuration=Debug /p:Platform=Win32 diff -r 360f9d483f94 -r 2a20cee18add Tools/buildbot/clean-amd64.bat --- a/Tools/buildbot/clean-amd64.bat Mon Jun 18 19:57:23 2012 +0200 +++ b/Tools/buildbot/clean-amd64.bat Mon Jun 18 08:33:13 2012 -0600 @@ -1,10 +1,3 @@ @rem Used by the buildbot "clean" step. -call "%VS100COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64 -@echo Deleting .pyc/.pyo files ... -del /s Lib\*.pyc Lib\*.pyo -@echo Deleting test leftovers ... -rmdir /s /q build -cd PCbuild -msbuild /target:clean pcbuild.sln /p:Configuration=Release /p:PlatformTarget=x64 -msbuild /target:clean pcbuild.sln /p:Configuration=Debug /p:PlatformTarget=x64 -cd .. +call "%VS100COMNTOOLS%..\..\VC\vcvarsall.bat" x86_amd64 +call "Tools\buildbot\clean-common.bat" x64 diff -r 360f9d483f94 -r 2a20cee18add Tools/buildbot/clean-common.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Tools/buildbot/clean-common.bat Mon Jun 18 08:33:13 2012 -0600 @@ -0,0 +1,10 @@ +@rem Common file shared between clean.bat and clean-amd64.bat. + +@echo Deleting test leftovers ... +if exist build ( + rmdir /s /q build +) +cd PCbuild +msbuild /target:clean pcbuild.sln /p:Configuration=Release /p:PlatformTarget=%1 +msbuild /target:clean pcbuild.sln /p:Configuration=Debug /p:PlatformTarget=%1 +cd .. diff -r 360f9d483f94 -r 2a20cee18add Tools/buildbot/clean.bat --- a/Tools/buildbot/clean.bat Mon Jun 18 19:57:23 2012 +0200 +++ b/Tools/buildbot/clean.bat Mon Jun 18 08:33:13 2012 -0600 @@ -1,8 +1,3 @@ @rem Used by the buildbot "clean" step. call "%VS100COMNTOOLS%vsvars32.bat" -@echo Deleting test leftovers ... -rmdir /s /q build -cd PCbuild -msbuild /target:clean pcbuild.sln /p:Configuration=Release /p:PlatformTarget=x86 -msbuild /target:clean pcbuild.sln /p:Configuration=Debug /p:PlatformTarget=x86 -cd .. +call "Tools\buildbot\clean-common.bat" x86